some cleanup

This commit is contained in:
dzaima 2021-10-11 00:06:21 +03:00
parent 1072a8aa77
commit 363309a218
3 changed files with 7 additions and 5 deletions

View File

@ -9,8 +9,10 @@ bool inErr;
NORETURN NOINLINE void err(char* s) { NORETURN NOINLINE void err(char* s) {
if (inErr) { if (inErr) {
printf("\nCBQN encountered fatal error during information printing of another fatal error. Exiting without printing more info.\n"); printf("\nCBQN encountered fatal error during information printing of another fatal error. Exiting without printing more info.\n");
#ifdef DEBUG
__builtin_trap();
#endif
exit(1); exit(1);
__builtin_abort();
} }
inErr = true; inErr = true;
puts(s); fflush(stdout); puts(s); fflush(stdout);

View File

@ -4,7 +4,7 @@
B eachd_fn(BBB2B f, B fo, B w, B x); // consumes w,x; assumes at least one is array B eachd_fn(BBB2B f, B fo, B w, B x); // consumes w,x; assumes at least one is array
B eachm_fn(BB2B f, B fo, B x); // consumes x; x must be array B eachm_fn(BB2B f, B fo, B x); // consumes x; x must be array
static B eachm(B f, B x) { // complete F¨ x without fills static B eachm(B f, B x) { // complete F¨ x without fills; consumes x
if (isAtm(x)) return m_hunit(c1(f, x)); if (isAtm(x)) return m_hunit(c1(f, x));
if (isFun(f)) return eachm_fn(c(Fun,f)->c1, f, x); if (isFun(f)) return eachm_fn(c(Fun,f)->c1, f, x);
if (isMd(f)) if (isAtm(x) || a(x)->ia) { decR(x); thrM("Calling a modifier"); } if (isMd(f)) if (isAtm(x) || a(x)->ia) { decR(x); thrM("Calling a modifier"); }
@ -15,7 +15,7 @@ static B eachm(B f, B x) { // complete F¨ x without fills
return mut_fcd(r, x); return mut_fcd(r, x);
} }
static B eachd(B f, B w, B x) { // complete w F¨ x without fills static B eachd(B f, B w, B x) { // complete w F¨ x without fills; consumes w,x
if (isAtm(w) & isAtm(x)) return m_hunit(c2(f, w, x)); if (isAtm(w) & isAtm(x)) return m_hunit(c2(f, w, x));
return eachd_fn(c2fn(f), f, w, x); return eachd_fn(c2fn(f), f, w, x);
} }

View File

@ -582,7 +582,7 @@ B evalBC(Block* bl, Body* b, Scope* sc) { // doesn't consume
} }
case FN1C: { P(f)P(x) case FN1C: { P(f)P(x)
GS_UPD;POS_UPD; GS_UPD;POS_UPD;
ADD(c1(f, x); dec(f)); ADD(c1(f, x)); dec(f);
break; break;
} }
case FN1O: { P(f)P(x) case FN1O: { P(f)P(x)
@ -592,7 +592,7 @@ B evalBC(Block* bl, Body* b, Scope* sc) { // doesn't consume
} }
case FN2C: { P(w)P(f)P(x) case FN2C: { P(w)P(f)P(x)
GS_UPD;POS_UPD; GS_UPD;POS_UPD;
ADD(c2(f, w, x); dec(f)); ADD(c2(f, w, x)); dec(f);
break; break;
} }
case FN2O: { P(w)P(f)P(x) case FN2O: { P(w)P(f)P(x)