diff --git a/src/builtins/arithm.c b/src/builtins/arithm.c index 603595d1..5d8f26af 100644 --- a/src/builtins/arithm.c +++ b/src/builtins/arithm.c @@ -26,7 +26,7 @@ B add_c1(B t, B x) { if (isF64(x)) return x; if (!isArr(x)) thrM("+: Argument must consist of numbers"); if (elNum(TI(x,elType))) return x; - dec(eachm_fn(m_f64(0), inc(x), add_c1)); + decG(eachm_fn(m_f64(0), incG(x), add_c1)); return x; } #if SINGELI_SIMD @@ -167,13 +167,13 @@ B ne_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(1); } B r = m_f64(*SH( static B mathNS; B getMathNS(void) { if (mathNS.u == 0) { - #define F(X) inc(bi_##X), + #define F(X) incG(bi_##X), Body* d = m_nnsDesc("sin","cos","tan","asin","acos","atan","atan2","sinh","cosh","tanh","asinh","acosh","atanh","cbrt","log2","log10","log1p","expm1","hypot","fact","logfact","erf","erfc","comb","gcd","lcm","sum"); mathNS = m_nns(d, F(sin)F(cos)F(tan)F(asin)F(acos)F(atan)F(atan2)F(sinh)F(cosh)F(tanh)F(asinh)F(acosh)F(atanh)F(cbrt)F(log2)F(log10)F(log1p)F(expm1)F(hypot)F(fact)F(logfact)F(erf)F(erfc)F(comb)F(gcd)F(lcm)F(sum)); #undef F gc_add(mathNS); } - return inc(mathNS); + return incG(mathNS); } void arith_init(void) { diff --git a/src/builtins/fns.c b/src/builtins/fns.c index fc0636c4..63fea127 100644 --- a/src/builtins/fns.c +++ b/src/builtins/fns.c @@ -303,7 +303,7 @@ i32 str2gid(B s) { if(had) return globalNames->a[p].val; i32 r = IA(globalNameList); - globalNameList = vec_addN(globalNameList, inc(s)); + globalNameList = vec_addN(globalNameList, incG(s)); globalNames->a[p].val = r; return r; } diff --git a/src/builtins/grade.h b/src/builtins/grade.h index 5d62d7ac..2b120468 100644 --- a/src/builtins/grade.h +++ b/src/builtins/grade.h @@ -221,7 +221,7 @@ B SORT_C1(B t, B x) { } } else { B xf = getFillQ(x); - HArr* r0 = (HArr*)cpyHArr(inc(x)); + HArr* r0 = (HArr*)cpyHArr(incG(x)); CAT(GRADE_UD(bA,bD),tim_sort)(r0->a, n); r = withFill(taga(r0), xf); } diff --git a/src/builtins/group.c b/src/builtins/group.c index d96b8a3c..2a3c1fd5 100644 --- a/src/builtins/group.c +++ b/src/builtins/group.c @@ -93,13 +93,13 @@ static B group_simple(B w, B x, ur xr, usz wia, usz xn, usz* xsh, u8 we) { if (ria <= 1) { if (ria == 0) goto dec_ret; // Needed so wia>0 - if (neg == 0) { rp[0]=inc(x); goto dec_ret; } + if (neg == 0) { rp[0]=incG(x); goto dec_ret; } // else, 𝕨 is a mix of 0 and Β―1 (and maybe trailing 1) } if (we==el_bit) { assert(ria == 2); if (wia>xn) w = C2(take, m_f64(xn), w); - rp[1] = C2(slash, inc(w), inc(x)); + rp[1] = C2(slash, incG(w), incG(x)); rp[0] = C2(slash, bit_negate(w), x); return taga(r); } @@ -173,8 +173,8 @@ static B group_simple(B w, B x, ur xr, usz wia, usz xn, usz* xsh, u8 we) { // Many Β―1s: filter out, then continue if (xn>32 && neg>(bits?0:xn/4)+xn/8) { if (wia>xn) w = C2(take, m_f64(xn), w); - B m = C2(ne, m_f64(-1), inc(w)); - w = C2(slash, inc(m), w); + B m = C2(ne, m_f64(-1), incG(w)); + w = C2(slash, incG(m), w); x = C2(slash, m, x); xn = *SH(x); neg = 0; } @@ -263,7 +263,7 @@ static B group_simple(B w, B x, ur xr, usz wia, usz xn, usz* xsh, u8 we) { extern B rt_group; B group_c2(B t, B w, B x) { - if (!isArr(x)) thrM("βŠ”: 𝕩 must be an array"); + if (isAtm(x)) thrM("βŠ”: 𝕩 must be an array"); ur xr = RNK(x); if (isArr(w) && RNK(w)==1 && xr>=1 && depth(w)==1) { usz wia = IA(w); diff --git a/src/builtins/internal.c b/src/builtins/internal.c index 26a05cd0..6b6b121c 100644 --- a/src/builtins/internal.c +++ b/src/builtins/internal.c @@ -195,7 +195,7 @@ B variation_c2(B t, B w, B x) { } else thrF("β€’internal.Variation: Bad type \"%R\"", taga(wc)); if (slice) { - Arr* slice = TI(res,slice)(inc(res), 0, IA(res)); + Arr* slice = TI(res,slice)(incG(res), 0, IA(res)); arr_shCopy(slice, res); dec(res); res = taga(slice); diff --git a/src/builtins/md1.c b/src/builtins/md1.c index 81d3f814..e379c0ed 100644 --- a/src/builtins/md1.c +++ b/src/builtins/md1.c @@ -134,8 +134,8 @@ B swap_c2(Md1D* d, B w, B x) { return c2(d->f, x , w); } B timed_c2(Md1D* d, B w, B x) { B f = d->f; i64 am = o2i64(w); + if (am<=0) thrM("β€’_timed: 𝕨 must be an integer greater than 1"); incBy(x, am); - dec(x); u64 sns = nsTime(); for (i64 i = 0; i < am; i++) dec(c1(f, x)); u64 ens = nsTime(); diff --git a/src/builtins/md2.c b/src/builtins/md2.c index 475ec3f4..3432d4e6 100644 --- a/src/builtins/md2.c +++ b/src/builtins/md2.c @@ -50,8 +50,8 @@ void pushRe(void) { lastErrMsg = inc(thrownMsg); freeThrown(); } -B catch_c1(Md2D* d, B x) { if(CATCH) { pushRe(); B r = c1(d->g, x); dec(gsPop()); return r; } inc(x); B r = c1(d->f, x); popCatch(); dec(x); return r; } -B catch_c2(Md2D* d, B w, B x) { if(CATCH) { pushRe(); B r = c2(d->g, w,x); dec(gsPop()); return r; } inc(w); inc(x); B r = c2(d->f, w,x); popCatch(); dec(w); dec(x); return r; } +B catch_c1(Md2D* d, B x) { if(CATCH) { pushRe(); B r = c1(d->g, x); dec(gsPop()); return r; } B r = c1(d->f, inc(x)); popCatch(); dec(x); return r; } +B catch_c2(Md2D* d, B w, B x) { if(CATCH) { pushRe(); B r = c2(d->g, w,x); dec(gsPop()); return r; } B r = c2(d->f, inc(w),inc(x)); popCatch(); dec(w); dec(x); return r; } #else B fillBy_c1(Md2D* d, B x) { return c1(d->f, x); } B fillBy_c2(Md2D* d, B w, B x) { return c2(d->f, w,x); } diff --git a/src/builtins/select.c b/src/builtins/select.c index ab0a0038..6d611f7c 100644 --- a/src/builtins/select.c +++ b/src/builtins/select.c @@ -370,7 +370,7 @@ B select_ucw(B t, B o, B w, B x) { usz wia = IA(w); SGetU(w) if (TI(w,elType)!=el_i32) for (usz i = 0; i < wia; i++) if (!q_i64(GetU(w,i))) return def_fn_ucw(t, o, w, x); - B arg = select_c2(t, inc(w), inc(x)); + B arg = select_c2(t, incG(w), incG(x)); B rep = c1(o, arg); if (isAtm(rep) || !eqShape(w, rep)) thrF("π”½βŒΎ(a⊸⊏)𝕩: 𝔽 must return an array with the same shape as its input (expected %H, got %H)", w, rep); #if CHECK_VALID diff --git a/src/builtins/selfsearch.c b/src/builtins/selfsearch.c index 557ec974..87571055 100644 --- a/src/builtins/selfsearch.c +++ b/src/builtins/selfsearch.c @@ -338,7 +338,7 @@ B count_c1(B t, B x) { if (use_sorted(x, lw) && n>16 && (lw>4 || n<1<<16)) { // β†•βˆ˜β‰ (⊣-⌈`βˆ˜Γ—)∊ B c = shift_ne(x, n, lw, 1); B i = C1(ud, m_f64(n)); - B m = C2(mul, c, inc(i)); + B m = C2(mul, c, incG(i)); return C2(sub, i, scan_max_num(m, TI(m,elType), n)); } void* xv = tyany_ptr(x); @@ -542,5 +542,5 @@ B find_c1(B t, B x) { rp[0] = 2 ^ -x0; return r; } - return C2(slash, C1(memberOf, inc(x)), x); + return C2(slash, C1(memberOf, incG(x)), x); } diff --git a/src/builtins/slash.c b/src/builtins/slash.c index 99aff60c..9278c831 100644 --- a/src/builtins/slash.c +++ b/src/builtins/slash.c @@ -428,7 +428,7 @@ static B compress(B w, B x, usz wia, u8 xl, u8 xt) { usz wia0 = wia; wia = 64*(ie+1) - CLZ(we); usz wsum = bit_sum(wp, wia); - if (wsum == wia0) return inc(x); + if (wsum == wia0) return incG(x); B r; switch(xl) { diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index 22af7bf1..d49e9d45 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -1343,7 +1343,7 @@ B bitop1(B f, B x, enum BitOp1 op, char* name) { arr_shCopyUnchecked(ra, x); r = taga(ra); rp = tyany_ptr(r); } else { - r = inc(x); rp = xp; + r = incG(x); rp = xp; } switch (op) { default: UD; case op_not: { diff --git a/src/ffi.c b/src/ffi.c index 9ef46556..8ace184b 100644 --- a/src/ffi.c +++ b/src/ffi.c @@ -451,7 +451,7 @@ BQNFFIEnt ffi_parseType(B arg, bool forRes) { // doesn't consume; parse argument if (!forRes) thrM("FFI: Argument type empty"); return (BQNFFIEnt){.t = ffi_type_void, .o=m_c32(sty_void), .resSingle=false}; } - arg = chr_squeezeChk(inc(arg)); + arg = chr_squeezeChk(incG(arg)); MAKE_MUT_INIT(tmp, ia+1, el_c32); MUTG_INIT(tmp); mut_copyG(tmp, 0, arg, 0, ia); @@ -551,7 +551,7 @@ void genObj(B o, B c, bool anyMut, void* ptr) { usz ia = IA(c); if (t->ty==cty_tlarr && t->arrCount!=ia) thrF("FFI: Incorrect item count of %s corresponding to \"[%s]...\"", ia, (usz)t->arrCount); if (isC32(e)) { // *num / &num - inc(c); + incG(c); B cG; bool mut = t->a[0].mutPtr; switch(o2cG(e)) { default: thrF("FFI: \"*%S\" argument type NYI", sty_names[o2cG(e)]); @@ -590,7 +590,7 @@ void genObj(B o, B c, bool anyMut, void* ptr) { u8 etw = sty_w[et]*8; if (!isArr(c)) thrF("FFI: Expected array corresponding to \"%S:%c%i\"", sty_names[et], (u32)reT, 1<>reW) thrM("FFI: Bad input array length"); - B cG = toW(reT, reW, inc(c)); + B cG = toW(reT, reW, incG(c)); memcpy(ptr, tyany_ptr(cG), 8); // may over-read, Β―\_(ツ)_/Β― dec(cG); } else { // *scalar:any / &scalar:any @@ -598,7 +598,7 @@ void genObj(B o, B c, bool anyMut, void* ptr) { BQNFFIType* t2 = c(BQNFFIType, o2); B ore = t2->a[0].o; assert(t2->ty==cty_ptr && isC32(ore)); // we shouldn't be generating anything else - inc(c); + incG(c); B cG; bool mut = t->a[0].mutPtr; if (mut) { @@ -689,7 +689,7 @@ B buildObj(BQNFFIEnt ent, bool anyMut, B* objs, usz* objPos) { usz ia = IA(f); if (isC32(e)) { switch(o2cG(e)) { default: UD; - case sty_i8: case sty_i16: case sty_i32: case sty_f64: return inc(f); + case sty_i8: case sty_i16: case sty_i32: case sty_f64: return incG(f); case sty_u8: { u8* tp=tyarr_ptr(f); i16* rp; B r=m_i16arrv(&rp, ia); for (usz i=0; irtInvReg, x); } static B funBI_iwRt(B t, B w, B x) { return c2(c(BFn, t)->rtInvSwap, w, x); } static B funBI_ixRt(B t, B w, B x) { return c2(c(BFn, t)->rtInvReg, w, x); } -static B funBI_imInit(B t, B x) { B f=c(BFn,t)->rtInvReg; if(f.u==0) f=c(BFn,t)->rtInvReg=c1rt(invFnReg, inc(t)); c(BFn,t)->im=funBI_imRt; return c1(f, x); } -static B funBI_ixInit(B t, B w, B x) { B f=c(BFn,t)->rtInvReg; if(f.u==0) f=c(BFn,t)->rtInvReg=c1rt(invFnReg, inc(t)); c(BFn,t)->ix=funBI_ixRt; return c2(f, w, x); } -static B funBI_iwInit(B t, B w, B x) { B f=c(BFn,t)->rtInvSwap =c1rt(invFnSwap, inc(t)); c(BFn,t)->iw=funBI_iwRt; return c2(f, w, x); } +static B funBI_imInit(B t, B x) { B f=c(BFn,t)->rtInvReg; if(f.u==0) f=c(BFn,t)->rtInvReg=c1rt(invFnReg, incG(t)); c(BFn,t)->im=funBI_imRt; return c1(f, x); } +static B funBI_ixInit(B t, B w, B x) { B f=c(BFn,t)->rtInvReg; if(f.u==0) f=c(BFn,t)->rtInvReg=c1rt(invFnReg, incG(t)); c(BFn,t)->ix=funBI_ixRt; return c2(f, w, x); } +static B funBI_iwInit(B t, B w, B x) { B f=c(BFn,t)->rtInvSwap =c1rt(invFnSwap, incG(t)); c(BFn,t)->iw=funBI_iwRt; return c2(f, w, x); } void* m_customObj(u64 size, V2v visit, V2v freeO) { diff --git a/src/ns.c b/src/ns.c index f106f8df..e8d7fb7b 100644 --- a/src/ns.c +++ b/src/ns.c @@ -98,7 +98,7 @@ static i32* emptyi32ptr; static B emptyi32obj; Body* m_nnsDescF(i32 n, char** names) { if (emptyi32ptr==NULL) gc_add(emptyi32obj = m_i32arrv(&emptyi32ptr, 0)); - incBy(emptyi32obj, 3); + incByG(emptyi32obj, 3); M_HARR(nl, n) for (usz i = 0; i < n; i++) HARR_ADD(nl, i, m_c8vec_0(names[i])); diff --git a/src/utils/mut.c b/src/utils/mut.c index 102e7400..8b809f3f 100644 --- a/src/utils/mut.c +++ b/src/utils/mut.c @@ -168,7 +168,7 @@ DEF_S(void, fill, f64, isF64(x), x, (void* a, usz ms, B x, usz l), ms, x, l) { f DEF_G(void, fill, B , (void* a, usz ms, B x, usz l), ms, x, l) { B* p = ms + (B*)a; for (usz i = 0; i < l; i++) p[i] = x; - if (isVal(x)) incBy(x, l); + incBy(x, l); return; }