diff --git a/cc.bqn b/cc.bqn index 2a218410..1a221a0b 100755 --- a/cc.bqn +++ b/cc.bqn @@ -22,7 +22,7 @@ Esc←{ ∾(i<≠in) /⟜"\"⊸∾¨ 𝕩 # Insert \ } -OStr ← "m_str32(U"""∾Esc∾""")"˙ # A BQN string +OStr ← "m_c32vec_0(U"""∾Esc∾""")"˙ # A BQN string OChr ← {"m_c32(U'"∾(Esc⥊𝕩)∾"')"} # A BQN character ONum ← {s←"-"/˜𝕩<0 ⋄ ∞⊸=∘|◶⟨"m_f64("∾")"∾˜s∾F∘| ⋄ "m_f64("∾s∾"1.0/0.0)"⟩𝕩} # Format number OAny ← ≡◶⟨@⊸≤◶ONum‿OChr, OStr, ⊑⟩ diff --git a/src/README.md b/src/README.md index 9f89e0bd..abdf7e20 100644 --- a/src/README.md +++ b/src/README.md @@ -226,12 +226,13 @@ HArr_p r = m_harrUp(10); // 10-item array without any set shape. Use the arr_shW // you can use withFill to add a fill element to a created array (or manually create a fillarr, see src/core/fillarr.h) -B r = m_str32(U"⟨1⋄2⋄3⟩"); // a constant string with unicode chars -B r = m_ascii("hello", 5); // an ASCII string with specified length -B r = m_ascii0("hello"); // ↑ but read as null-terminated -#include "utils/utf.h" +B r = m_c32vec(U"⟨1⋄2⋄3⟩", 7); // a constant string with unicode chars +B r = m_c32vec_0(U"⟨1⋄2⋄3⟩"); // ..or with implicit length +B r = m_c8vec("hello", 5); // a constant ASCII string +B r = m_c8vec_0("hello"); // ..or with implicit length B r = utf8Decode("⟨1⋄2⋄3⟩", 17) // decode UTF-8 from a char* -B r = utf8Decode0("⟨1⋄2⋄3⟩") // ↑ but read as null-terminated +B r = utf8Decode_0("⟨1⋄2⋄3⟩") // ..or with implicit length +#include "utils/utf.h" u64 sz = utf8lenB(x); TALLOC(char, buf, sz+1); toUTF8(x, buf); buf[sz]=0; /*use buf as a C-string*/ TFREE(buf); // src/utils/mut.h provides a way to build an array by copying parts of other arrays diff --git a/src/builtins/internal.c b/src/builtins/internal.c index e3283b25..2bd41a34 100644 --- a/src/builtins/internal.c +++ b/src/builtins/internal.c @@ -7,14 +7,14 @@ B itype_c1(B t, B x) { B r; if(isVal(x)) { - r = m_ascii0(type_repr(v(x)->type)); + r = m_c8vec_0(type_repr(v(x)->type)); } else { - if (isF64(x)) r = m_ascii0("tagged f64"); - else if (isC32(x)) r = m_ascii0("tagged c32"); - else if (isTag(x)) r = m_ascii0("tagged tag"); - else if (isVar(x)) r = m_ascii0("tagged var"); - else if (isExt(x)) r = m_ascii0("tagged extvar"); - else r = m_ascii0("tagged unknown"); + if (isF64(x)) r = m_c8vec_0("tagged f64"); + else if (isC32(x)) r = m_c8vec_0("tagged c32"); + else if (isTag(x)) r = m_c8vec_0("tagged tag"); + else if (isVar(x)) r = m_c8vec_0("tagged var"); + else if (isExt(x)) r = m_c8vec_0("tagged extvar"); + else r = m_c8vec_0("tagged unknown"); } dec(x); return r; @@ -25,7 +25,7 @@ B elType_c1(B t, B x) { return r; } B refc_c1(B t, B x) { - B r = isVal(x)? m_i32(v(x)->refc) : m_ascii0("(not heap-allocated)"); + B r = isVal(x)? m_i32(v(x)->refc) : m_c8vec_0("(not heap-allocated)"); dec(x); return r; } @@ -301,10 +301,10 @@ B unshare_c1(B t, B x) { static B internalNS; B getInternalNS() { if (internalNS.u == 0) { - #define F(X) v_##X = m_ascii0(#X); + #define F(X) v_##X = m_c8vec_0(#X); FOR_VARIATION(F) #undef F - listVariations_def = m_ascii0("if"); + listVariations_def = m_c8vec_0("if"); gc_addFn(variation_gcRoot); #define F(X) incG(bi_##X), Body* d = m_nnsDesc("type","eltype","refc","squeeze","ispure","info","listvariations","variation","clearrefs","unshare","deepsqueeze","heapdump","eequal","temp"); diff --git a/src/builtins/inverse.c b/src/builtins/inverse.c index 22f3ddc3..68fec757 100644 --- a/src/builtins/inverse.c +++ b/src/builtins/inverse.c @@ -38,6 +38,6 @@ B nativeInvSwap_c1(B t, B x) { } void inverse_init() { - fn_invRegDesc = registerNFn(m_ascii0("(fn_invReg)"), fn_invReg_c1, fn_invReg_c2); - fn_invSwapDesc = registerNFn(m_ascii0("(fn_invSwap)"), fn_invSwap_c1, fn_invSwap_c2); + fn_invRegDesc = registerNFn(m_c8vec_0("(fn_invReg)"), fn_invReg_c1, fn_invReg_c2); + fn_invSwapDesc = registerNFn(m_c8vec_0("(fn_invSwap)"), fn_invSwap_c1, fn_invSwap_c2); } \ No newline at end of file diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index c4ea3acd..38a7ec01 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -62,7 +62,7 @@ B nsFmt(B x); B rtWrap_unwrap(B x); #endif B glyph_c1(B t, B x) { - if (!isVal(x)) return m_str32(U"(•Glyph: not given a function)"); + if (!isVal(x)) return m_c32vec_0(U"(•Glyph: not given a function)"); #ifdef RT_WRAP x = rtWrap_unwrap(x); #endif @@ -76,11 +76,11 @@ B glyph_c1(B t, B x) { if (ty==t_md1BI) { B r = utf8Decode0(pm1_repr(c(Md1,x)->extra)); decG(x); return r; } if (ty==t_md2BI) { B r = utf8Decode0(pm2_repr(c(Md2,x)->extra)); decG(x); return r; } if (ty==t_nfn) { B r = nfn_name(x); decG(x); return r; } - if (ty==t_funBl) { decG(x); return m_ascii0("(function block)"); } - if (ty==t_md1Bl) { decG(x); return m_ascii0("(1-modifier block)"); } - if (ty==t_md2Bl) { decG(x); return m_ascii0("(2-modifier block)"); } + if (ty==t_funBl) { decG(x); return m_c8vec_0("(function block)"); } + if (ty==t_md1Bl) { decG(x); return m_c8vec_0("(1-modifier block)"); } + if (ty==t_md2Bl) { decG(x); return m_c8vec_0("(2-modifier block)"); } if (ty==t_ns) return nsFmt(x); - return m_str32(U"(•Glyph: given object with unexpected type)"); + return m_c32vec_0(U"(•Glyph: given object with unexpected type)"); } B repr_c1(B t, B x) { @@ -536,9 +536,9 @@ static NOINLINE void rand_init() { rand_ns = m_nnsDesc("seed1", "seed2", "range", "deal", "subset"); NSDesc* d = rand_ns->nsDesc; d->expGIDs[0] = d->expGIDs[1] = -1; - rand_rangeName = m_ascii0("range"); gc_add(rand_rangeName); rand_rangeDesc = registerNFn(m_ascii0("(rand).Range"), rand_range_c1, rand_range_c2); - rand_dealName = m_ascii0("deal"); gc_add(rand_dealName); rand_dealDesc = registerNFn(m_ascii0("(rand).Deal"), rand_deal_c1, rand_deal_c2); - rand_subsetName = m_ascii0("subset"); gc_add(rand_subsetName); rand_subsetDesc = registerNFn(m_ascii0("(rand).Subset"), c1_bad, rand_subset_c2); + rand_rangeName = m_c8vec_0("range"); gc_add(rand_rangeName); rand_rangeDesc = registerNFn(m_c8vec_0("(rand).Range"), rand_range_c1, rand_range_c2); + rand_dealName = m_c8vec_0("deal"); gc_add(rand_dealName); rand_dealDesc = registerNFn(m_c8vec_0("(rand).Deal"), rand_deal_c1, rand_deal_c2); + rand_subsetName = m_c8vec_0("subset"); gc_add(rand_subsetName); rand_subsetDesc = registerNFn(m_c8vec_0("(rand).Subset"), c1_bad, rand_subset_c2); } B makeRand_c1(B t, B x) { if (!isNum(x)) thrM("•MakeRand: 𝕩 must be a number"); @@ -567,7 +567,7 @@ B reBQN_c1(B t, B x) { B prim = ns_getC(x, "primitives"); i32 replVal = q_N(repl) || eqStr(repl,U"none")? 0 : eqStr(repl,U"strict")? 1 : eqStr(repl,U"loose")? 2 : 3; if (replVal==3) thrM("•ReBQN: Invalid repl value"); - Block* initBlock = bqn_comp(m_ascii0("\"(REPL initializer)\""), inc(cdPath), m_f64(0)); + Block* initBlock = bqn_comp(m_c8vec_0("\"(REPL initializer)\""), inc(cdPath), m_f64(0)); B scVal; if (replVal==0) { scVal = bi_N; @@ -1246,21 +1246,21 @@ void sysfn_init() { #if CATCH_ERRORS lastErrMsg = bi_N; #endif - cdPath = m_ascii(".", 1); gc_add(cdPath); gc_addFn(sys_gcFn); - fCharsDesc = registerNFn(m_ascii0("(file).Chars"), fchars_c1, fchars_c2); - fileAtDesc = registerNFn(m_ascii0("(file).At"), fileAt_c1, fileAt_c2); - fLinesDesc = registerNFn(m_ascii0("(file).Lines"), flines_c1, flines_c2); - fBytesDesc = registerNFn(m_ascii0("(file).Bytes"), fbytes_c1, fbytes_c2); - fListDesc = registerNFn(m_ascii0("(file).List"), list_c1, c2_bad); - fTypeDesc = registerNFn(m_ascii0("(file).Type"), ftype_c1, c2_bad); - createdirDesc= registerNFn(m_ascii0("(file).CreateDir"), createdir_c1, c2_bad); - renameDesc = registerNFn(m_ascii0("(file).Rename"), c1_bad, rename_c2); - removeDesc = registerNFn(m_ascii0("(file).Remove"), remove_c1, c2_bad); - fMapBytesDesc= registerNFn(m_ascii0("(file).MapBytes"), mapBytes_c1, c2_bad); - fExistsDesc = registerNFn(m_ascii0("(file).Exists"), fexists_c1, c2_bad); - reBQNDesc = registerNFn(m_ascii0("(REPL)"), repl_c1, repl_c2); - importDesc = registerNFn(m_str32(U"•Import"), import_c1, import_c2); - ffiloadDesc = registerNFn(m_str32(U"•FFI"), c1_bad, ffiload_c2); + cdPath = m_c8vec(".", 1); gc_add(cdPath); gc_addFn(sys_gcFn); + fCharsDesc = registerNFn(m_c8vec_0("(file).Chars"), fchars_c1, fchars_c2); + fileAtDesc = registerNFn(m_c8vec_0("(file).At"), fileAt_c1, fileAt_c2); + fLinesDesc = registerNFn(m_c8vec_0("(file).Lines"), flines_c1, flines_c2); + fBytesDesc = registerNFn(m_c8vec_0("(file).Bytes"), fbytes_c1, fbytes_c2); + fListDesc = registerNFn(m_c8vec_0("(file).List"), list_c1, c2_bad); + fTypeDesc = registerNFn(m_c8vec_0("(file).Type"), ftype_c1, c2_bad); + createdirDesc= registerNFn(m_c8vec_0("(file).CreateDir"), createdir_c1, c2_bad); + renameDesc = registerNFn(m_c8vec_0("(file).Rename"), c1_bad, rename_c2); + removeDesc = registerNFn(m_c8vec_0("(file).Remove"), remove_c1, c2_bad); + fMapBytesDesc= registerNFn(m_c8vec_0("(file).MapBytes"), mapBytes_c1, c2_bad); + fExistsDesc = registerNFn(m_c8vec_0("(file).Exists"), fexists_c1, c2_bad); + reBQNDesc = registerNFn(m_c8vec_0("(REPL)"), repl_c1, repl_c2); + importDesc = registerNFn(m_c32vec_0(U"•Import"), import_c1, import_c2); + ffiloadDesc = registerNFn(m_c32vec_0(U"•FFI"), c1_bad, ffiload_c2); } void sysfnPost_init() { file_nsGen = m_nnsDesc("path","at","list","bytes","chars","lines","type","exists","name","mapbytes","createdir","rename","remove"); diff --git a/src/core/chrarr.h b/src/core/chrarr.h index d3156887..2d67ece2 100644 --- a/src/core/chrarr.h +++ b/src/core/chrarr.h @@ -17,9 +17,11 @@ #undef c32 -B m_str32(u32* s); -B m_ascii0(char* s); -B m_ascii(char* s, i64 sz); +B m_c32vec_0(u32* s); +B m_c32vec(u32* s, i64 sz); +B m_c8vec_0(char* s); +B m_c8vec(char* s, i64 sz); + B utf8Decode0(const char* x); B utf8Decode(const char* x, i64 sz); B utf8DecodeA(I8Arr* x); diff --git a/src/core/derv.c b/src/core/derv.c index 5844af41..7c18e0ab 100644 --- a/src/core/derv.c +++ b/src/core/derv.c @@ -148,8 +148,8 @@ void derv_init() { TIi(t_md1D,identity) = md1D_identity; } void dervPost_init() { - ucwWrapDesc = registerNFn(m_ascii0("(temporary function for ⌾)"), ucwWrap_c1, c2_bad); - uc1WrapDesc = registerNFn(m_ascii0("(temporary function for ⌾)"), uc1Wrap_c1, c2_bad); + ucwWrapDesc = registerNFn(m_c8vec_0("(temporary function for ⌾)"), ucwWrap_c1, c2_bad); + uc1WrapDesc = registerNFn(m_c8vec_0("(temporary function for ⌾)"), uc1Wrap_c1, c2_bad); TIi(t_fork,fn_uc1) = fork_uc1; // in post probably to make sure it's not used while not fully initialized or something? idk TIi(t_atop,fn_uc1) = atop_uc1; c(BMd2,bi_atop)->uc1 = atopM2_uc1; diff --git a/src/core/stuff.h b/src/core/stuff.h index 0e1ed65e..5c1ead1f 100644 --- a/src/core/stuff.h +++ b/src/core/stuff.h @@ -156,7 +156,7 @@ void print_fmt(char* p, ...); #define AJOIN(X) s = vec_join(s,X) // consumes X #define AOBJ(X) s = vec_addN(s,X) // consumes X #define ACHR(X) AOBJ(m_c32(X)) -#define A8(X) AJOIN(m_ascii0(X)) +#define A8(X) AJOIN(m_c8vec_0(X)) #define AU(X) AJOIN(utf8Decode0(X)) #define AFMT(...) s = append_fmt(s, __VA_ARGS__) diff --git a/src/core/tyarr.c b/src/core/tyarr.c index 7499787f..aebb1be3 100644 --- a/src/core/tyarr.c +++ b/src/core/tyarr.c @@ -45,16 +45,13 @@ B m_c8(u8 x) { return m_c32(x); } B m_c16(u16 x) { return m_c32(x); } #define TP(W,X) W##f64##X #include "tyarrTemplate.c" -NOINLINE B m_caf64(usz sz, f64* a) { f64* rp; B r = m_f64arrv(&rp, sz); for (usz i = 0; i < sz; i++) rp[i] = a[i]; return r; } -NOINLINE B m_cai32(usz sz, i32* a) { i32* rp; B r = m_i32arrv(&rp, sz); for (usz i = 0; i < sz; i++) rp[i] = a[i]; return r; } -NOINLINE B m_ascii(char* s, i64 sz) { u8* rp; B r = m_c8arrv (&rp, sz); for (u64 i = 0; i < sz; i++) rp[i] = s[i]; return r; } -NOINLINE B m_ascii0(char* s) { return m_ascii(s, strlen(s)); } -NOINLINE B m_str32(u32* s) { - usz sz = 0; while(s[sz]) sz++; - u32* rp; B r = m_c32arrv(&rp, sz); - for (usz i = 0; i < sz; i++) rp[i] = s[i]; - return r; -} +NOINLINE B m_caf64(usz sz, f64* a) { f64* rp; B r = m_f64arrv(&rp, sz); memcpy(rp, a, sz*sizeof( f64)); return r; } +NOINLINE B m_cai32(usz sz, i32* a) { i32* rp; B r = m_i32arrv(&rp, sz); memcpy(rp, a, sz*sizeof( i32)); return r; } +NOINLINE B m_c8vec(char* a, i64 sz) { u8* rp; B r = m_c8arrv (&rp, sz); memcpy(rp, a, sz*sizeof(char)); return r; } +NOINLINE B m_c32vec(u32* s, i64 sz) { u32* rp; B r = m_c32arrv(&rp, sz); memcpy(rp, s, sz*sizeof( u32)); return r; } +NOINLINE B m_c8vec_0(char* s) { return m_c8vec(s, strlen(s)); } +NOINLINE B m_c32vec_0(u32* s) { usz sz=0; while(s[sz]) sz++; return m_c32vec(s, sz); } + static Arr* bitarr_slice(B x, usz s, usz ia) { u64* rp; Arr* r = m_bitarrp(&rp, ia); diff --git a/src/ffi.c b/src/ffi.c index e6eb0470..11dfea31 100644 --- a/src/ffi.c +++ b/src/ffi.c @@ -758,8 +758,8 @@ void ffiType_print(FILE* f, B x) { } void ffi_init() { - boundFnDesc = registerNFn(m_ascii0("(foreign function)"), boundFn_c1, boundFn_c2); - foreignFnDesc = registerNFn(m_ascii0("(foreign function)"), directFn_c1, directFn_c2); + boundFnDesc = registerNFn(m_c8vec_0("(foreign function)"), boundFn_c1, boundFn_c2); + foreignFnDesc = registerNFn(m_c8vec_0("(foreign function)"), directFn_c1, directFn_c2); TIi(t_ffiType,freeO) = ffiType_freeO; TIi(t_ffiType,freeF) = ffiType_freeF; TIi(t_ffiType,visit) = ffiType_visit; diff --git a/src/h.h b/src/h.h index 69ff14b5..3426c4ef 100644 --- a/src/h.h +++ b/src/h.h @@ -344,7 +344,6 @@ B withFill(B x, B f); // consumes both static B m_unit (B x); // consumes static B m_hunit(B x); // consumes -B m_str32(u32* s); // meant to be used as m_str32(U"{𝕨‿𝕩}"), so doesn't free for you B bqn_exec(B str, B path, B args); // consumes all B bqn_execFile(B path, B args); // consumes diff --git a/src/jit/nvm_x86_64.c b/src/jit/nvm_x86_64.c index 381b864d..9359f131 100644 --- a/src/jit/nvm_x86_64.c +++ b/src/jit/nvm_x86_64.c @@ -493,22 +493,22 @@ void freeOpt(OptRes o) { static void write_asm(u8* p, u64 sz) { i32* rp; B r = m_i32arrv(&rp, sz); for (u64 i = 0; i < sz; i++) rp[i] = p[i]; - path_wBytes(m_ascii0("asm_bin"), r); dec(r); + path_wBytes(m_c8vec_0("asm_bin"), r); dec(r); char off[20]; snprintf(off, 20, "%p", p); - B o = m_ascii0(off); - path_wChars(m_ascii0("asm_off"), o); dec(o); + B o = m_c8vec_0(off); + path_wChars(m_c8vec_0("asm_off"), o); dec(o); B s = emptyCVec(); #define F(X) AFMT("s/%p$/%p # i_" #X "/;", i_##X, i_##X); F(POPS)F(INC)F(FN1C)F(FN1O)F(FN2C)F(FN2O)F(FN1Oi)F(FN2Oi)F(LST_0)F(LST_p)F(ARMM)F(ARMO)F(DFND_0)F(DFND_1)F(DFND_2)F(MD1C)F(MD2C)F(MD2R)F(TR2D)F(TR3D)F(TR3O)F(NOVAR)F(EXTO)F(EXTU)F(SETN)F(SETU)F(SETM)F(SETC)F(SETH1)F(SETH2)F(PRED1)F(PRED2)F(SETNi)F(SETUi)F(SETMi)F(SETCi)F(SETNv)F(SETUv)F(SETMv)F(SETCv)F(FLDO)F(VFYM)F(ALIM)F(CHKV)F(FAIL)F(RETD) #undef F - path_wChars(m_ascii0("asm_sed"), s); dec(s); + path_wChars(m_c8vec_0("asm_sed"), s); dec(s); } #endif static void onJIT(Body* body, u8* binEx, u64 sz) { #if USE_PERF if (!perf_map) { - B s = m_ascii0("/tmp/perf-"); AFMT("%l.map", getpid()); + B s = m_c8vec_0("/tmp/perf-"); AFMT("%l.map", getpid()); perf_map = file_open(s, "open", "wa"); print(s); printf(": map\n"); dec(s); diff --git a/src/load.c b/src/load.c index 2b1e5b20..c25bfb58 100644 --- a/src/load.c +++ b/src/load.c @@ -114,14 +114,15 @@ Block* load_compObj(B x, B src, B path, Scope* sc) { // consumes x,src decG(x); return r; } + #include "gen/src" #if RT_SRC Block* load_compImport(char* name, B bc, B objs, B blocks, B bodies, B inds, B src) { // consumes all - return compile(bc, objs, blocks, bodies, inds, bi_N, src, m_ascii0(name), NULL); + return compile(bc, objs, blocks, bodies, inds, bi_N, src, m_c8vec_0(name), NULL); } #else Block* load_compImport(char* name, B bc, B objs, B blocks, B bodies) { // consumes all - return compile(bc, objs, blocks, bodies, bi_N, bi_N, bi_N, m_ascii0(name), NULL); + return compile(bc, objs, blocks, bodies, bi_N, bi_N, bi_N, m_c8vec_0(name), NULL); } #endif @@ -462,7 +463,7 @@ void load_init() { // very last init function #include "gen/compiles" ); runtime[n_asrt] = prevAsrt; - load_glyphs = m_hVec3(m_str32(U"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!"), m_str32(U"˙˜˘¨⌜⁼´˝`"), m_str32(U"∘○⊸⟜⌾⊘◶⎉⚇⍟⎊")); + load_glyphs = m_hVec3(m_c32vec_0(U"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!"), m_c32vec_0(U"˙˜˘¨⌜⁼´˝`"), m_c32vec_0(U"∘○⊸⟜⌾⊘◶⎉⚇⍟⎊")); load_compgen = evalFunBlock(comp_b, 0); ptr_dec(comp_b); load_comp = c1(load_compgen, inc(load_glyphs)); gc_add(load_compgen); gc_add(load_comp); gc_add(load_glyphs); diff --git a/src/main.c b/src/main.c index dce890b7..9be7bfeb 100644 --- a/src/main.c +++ b/src/main.c @@ -14,7 +14,7 @@ static bool init = false; static void repl_init() { if (init) return; cbqn_init(); - replPath = m_ascii0("."); gc_add(replPath); + replPath = m_c8vec_0("."); gc_add(replPath); Body* body = m_nnsDesc(); B ns = m_nns(body); gsc = ptr_inc(c(NS, ns)->sc); gc_add(tag(gsc,OBJ_TAG)); @@ -341,18 +341,18 @@ int main(int argc, char* argv[]) { #define REQARG(X) if(*carg) { fprintf(stderr, "%s: -%s must end the option\n", argv[0], #X); exit(1); } if (i==argc) { fprintf(stderr, "%s: -%s requires an argument\n", argv[0], #X); exit(1); } case 'f': repl_init(); REQARG(f); goto execFile; case 'e': { repl_init(); REQARG(e); - dec(gsc_exec_inline(utf8Decode0(argv[i++]), m_ascii0("(-e)"), emptySVec())); + dec(gsc_exec_inline(utf8Decode0(argv[i++]), m_c8vec_0("(-e)"), emptySVec())); break; } case 'L': { repl_init(); break; } // just initialize. mostly for perf testing case 'p': { repl_init(); REQARG(p); - B r = bqn_fmt(gsc_exec_inline(utf8Decode0(argv[i++]), m_ascii0("(-p)"), emptySVec())); + B r = bqn_fmt(gsc_exec_inline(utf8Decode0(argv[i++]), m_c8vec_0("(-p)"), emptySVec())); printRaw(r); dec(r); printf("\n"); break; } case 'o': { repl_init(); REQARG(o); - B r = gsc_exec_inline(utf8Decode0(argv[i++]), m_ascii0("(-o)"), emptySVec()); + B r = gsc_exec_inline(utf8Decode0(argv[i++]), m_c8vec_0("(-o)"), emptySVec()); printRaw(r); dec(r); printf("\n"); break; @@ -403,7 +403,7 @@ int main(int argc, char* argv[]) { B execRes; if (execStdin) { - execRes = gsc_exec_inline(utf8DecodeA(stream_bytes(stdin)), m_ascii0("(-)"), args); + execRes = gsc_exec_inline(utf8DecodeA(stream_bytes(stdin)), m_c8vec_0("(-)"), args); } else { execRes = bqn_execFile(src, args); } diff --git a/src/ns.c b/src/ns.c index 72d28b2e..dbc8e929 100644 --- a/src/ns.c +++ b/src/ns.c @@ -69,7 +69,7 @@ B ns_getNU(B ns, B name, bool thrEmpty) { VTY(ns, t_ns); return bi_N; } B ns_getC(B ns, char* name) { - B field = m_ascii0(name); + B field = m_c8vec_0(name); B r = ns_getNU(ns, field, false); decG(field); return r; @@ -102,7 +102,7 @@ Body* m_nnsDescF(i32 n, char** names) { incBy(emptyi32obj, 3); M_HARR(nl, n) - for (usz i = 0; i < n; i++) HARR_ADD(nl, i, m_ascii0(names[i])); + for (usz i = 0; i < n; i++) HARR_ADD(nl, i, m_c8vec_0(names[i])); Comp* comp = mm_alloc(sizeof(Comp), t_comp); comp->bc = emptyi32obj; diff --git a/src/utils/file.c b/src/utils/file.c index 77c88cd0..7dba4fb6 100644 --- a/src/utils/file.c +++ b/src/utils/file.c @@ -217,7 +217,7 @@ B path_list(B path) { B res = emptySVec(); while ((c = readdir(d)) != NULL) { char* name = c->d_name; - if (name[0]=='.'? !(name[1]==0 || (name[1]=='.'&&name[2]==0)) : true) res = vec_addN(res, m_ascii0(name)); + if (name[0]=='.'? !(name[1]==0 || (name[1]=='.'&&name[2]==0)) : true) res = vec_addN(res, m_c8vec_0(name)); } closedir(d); dec(path); diff --git a/src/vm.c b/src/vm.c index be4cd2e4..b010b7b3 100644 --- a/src/vm.c +++ b/src/vm.c @@ -1230,7 +1230,7 @@ void comp_init() { TIi(t_funBl,fn_iw) = funBl_iw; TIi(t_md1Bl,m1_iw) = md1Bl_iw; TIi(t_md2Bl,m2_iw) = md2Bl_iw; TIi(t_funBl,fn_ix) = funBl_ix; TIi(t_md1Bl,m1_ix) = md1Bl_ix; TIi(t_md2Bl,m2_ix) = md2Bl_ix; - oomMessage = m_ascii0("Out of memory"); gc_add(oomMessage); + oomMessage = m_c8vec_0("Out of memory"); gc_add(oomMessage); WrappedObj* arm0 = mm_alloc(sizeof(WrappedObj), t_arrMerge); arm0->obj = emptyHVec(); emptyARMM = tag(arm0, OBJ_TAG);