output errors to stderr
This commit is contained in:
parent
d53548e1e7
commit
0c79b44ae0
@ -349,7 +349,7 @@ void fun_gcFn() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void print_funBI(B x) { printf("%s", pfn_repr(c(Fun,x)->extra)); }
|
static void print_funBI(FILE* f, B x) { fprintf(f, "%s", pfn_repr(c(Fun,x)->extra)); }
|
||||||
static B funBI_uc1(B t, B o, B x) { return c(BFn,t)->uc1(t, o, x); }
|
static B funBI_uc1(B t, B o, B x) { return c(BFn,t)->uc1(t, o, x); }
|
||||||
static B funBI_ucw(B t, B o, B w, B x) { return c(BFn,t)->ucw(t, o, w, x); }
|
static B funBI_ucw(B t, B o, B w, B x) { return c(BFn,t)->ucw(t, o, w, x); }
|
||||||
static B funBI_im(B t, B x) { return c(BFn,t)->im(t, x); }
|
static B funBI_im(B t, B x) { return c(BFn,t)->im(t, x); }
|
||||||
|
|||||||
@ -517,7 +517,7 @@ B insert_c2(Md1D* d, B w, B x) { B f = d->f;
|
|||||||
|
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
static void print_md1BI(B x) { printf("%s", pm1_repr(c(Md1,x)->extra)); }
|
static void print_md1BI(FILE* f, B x) { fprintf(f, "%s", pm1_repr(c(Md1,x)->extra)); }
|
||||||
static B md1BI_im(Md1D* d, B x) { return ((BMd1*)d->m1)->im(d, x); }
|
static B md1BI_im(Md1D* d, B x) { return ((BMd1*)d->m1)->im(d, x); }
|
||||||
static B md1BI_iw(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->iw(d, w, x); }
|
static B md1BI_iw(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->iw(d, w, x); }
|
||||||
static B md1BI_ix(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->ix(d, w, x); }
|
static B md1BI_ix(Md1D* d, B w, B x) { return ((BMd1*)d->m1)->ix(d, w, x); }
|
||||||
|
|||||||
@ -293,7 +293,7 @@ B depth_c1(Md2D* d, B x) { return m2c1(rt_depth, d->f, d->g, x); }
|
|||||||
B depth_c2(Md2D* d, B w, B x) { return m2c2(rt_depth, d->f, d->g, w, x); }
|
B depth_c2(Md2D* d, B w, B x) { return m2c2(rt_depth, d->f, d->g, w, x); }
|
||||||
|
|
||||||
|
|
||||||
static void print_md2BI(B x) { printf("%s", pm2_repr(c(Md1,x)->extra)); }
|
static void print_md2BI(FILE* f, B x) { fprintf(f, "%s", pm2_repr(c(Md1,x)->extra)); }
|
||||||
static B md2BI_im(Md2D* d, B x) { return ((BMd2*)d->m2)->im(d, x); }
|
static B md2BI_im(Md2D* d, B x) { return ((BMd2*)d->m2)->im(d, x); }
|
||||||
static B md2BI_iw(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->iw(d, w, x); }
|
static B md2BI_iw(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->iw(d, w, x); }
|
||||||
static B md2BI_ix(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->ix(d, w, x); }
|
static B md2BI_ix(Md2D* d, B w, B x) { return ((BMd2*)d->m2)->ix(d, w, x); }
|
||||||
|
|||||||
@ -754,6 +754,7 @@ extern char** environ;
|
|||||||
#if __has_include(<spawn.h>)
|
#if __has_include(<spawn.h>)
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
typedef struct pollfd pollfd;
|
||||||
void shClose(int fd) { if (close(fd)) err("bad file descriptor close"); }
|
void shClose(int fd) { if (close(fd)) err("bad file descriptor close"); }
|
||||||
|
|
||||||
// #define shDbg printf
|
// #define shDbg printf
|
||||||
@ -827,8 +828,14 @@ B sh_c2(B t, B w, B x) {
|
|||||||
// polling mess
|
// polling mess
|
||||||
const u64 bufsz = 1024;
|
const u64 bufsz = 1024;
|
||||||
TALLOC(char, oBuf, bufsz);
|
TALLOC(char, oBuf, bufsz);
|
||||||
struct pollfd ps[] = {{.fd=p_out[0], .events=POLLIN}, {.fd=p_err[0], .events=POLLIN}, {.fd=p_in[1], .events=POLLOUT}};
|
|
||||||
while (poll(&ps[0], iDone? 2 : 3, -1) > 0) {
|
pollfd ps[3];
|
||||||
|
i32 plen = 0;
|
||||||
|
ps[plen++] = (pollfd){.fd=p_err[0], .events=POLLIN};
|
||||||
|
ps[plen++] = (pollfd){.fd=p_out[0], .events=POLLIN};
|
||||||
|
ps[plen++] = (pollfd){.fd=p_in[1], .events=POLLOUT};
|
||||||
|
|
||||||
|
while (poll(&ps[0], plen - iDone, -1) > 0) {
|
||||||
shDbg("next poll; revents: out:%d err:%d in:%d\n", ps[0].revents, ps[1].revents, ps[2].revents);
|
shDbg("next poll; revents: out:%d err:%d in:%d\n", ps[0].revents, ps[1].revents, ps[2].revents);
|
||||||
if (ps[0].revents & POLLIN) while(true) { i64 len = read(p_out[0], &oBuf[0], bufsz); shDbg("read stdout "N64d"\n",len); if(len<=0)break; s_out = vec_join(s_out, fromUTF8(oBuf, len)); }
|
if (ps[0].revents & POLLIN) while(true) { i64 len = read(p_out[0], &oBuf[0], bufsz); shDbg("read stdout "N64d"\n",len); if(len<=0)break; s_out = vec_join(s_out, fromUTF8(oBuf, len)); }
|
||||||
if (ps[1].revents & POLLIN) while(true) { i64 len = read(p_err[0], &oBuf[0], bufsz); shDbg("read stderr "N64d"\n",len); if(len<=0)break; s_err = vec_join(s_err, fromUTF8(oBuf, len)); }
|
if (ps[1].revents & POLLIN) while(true) { i64 len = read(p_err[0], &oBuf[0], bufsz); shDbg("read stderr "N64d"\n",len); if(len<=0)break; s_err = vec_join(s_err, fromUTF8(oBuf, len)); }
|
||||||
|
|||||||
@ -14,11 +14,11 @@ static void md2H_visit(Value* x) { mm_visitP(((Md2H*)x)->m2); mm_visit(((Md2H*)x
|
|||||||
static void fork_visit(Value* x) { mm_visit (((Fork*)x)->f ); mm_visit(((Fork*)x)->g); mm_visit(((Fork*)x)->h); }
|
static void fork_visit(Value* x) { mm_visit (((Fork*)x)->f ); mm_visit(((Fork*)x)->g); mm_visit(((Fork*)x)->h); }
|
||||||
static void atop_visit(Value* x) { mm_visit(((Atop*)x)->g); mm_visit(((Atop*)x)->h); }
|
static void atop_visit(Value* x) { mm_visit(((Atop*)x)->g); mm_visit(((Atop*)x)->h); }
|
||||||
|
|
||||||
static void md1D_print(B x) { printf("(md1D ");print(c(Md1D,x)->f);printf(" ");print(tag(c(Md1D,x)->m1,MD1_TAG)); printf(")"); }
|
static void md1D_print(FILE* f, B x) { fprintf(f,"(md1D ");fprint(f,c(Md1D,x)->f);fprintf(f," ");fprint(f,tag(c(Md1D,x)->m1,MD1_TAG)); fprintf(f,")"); }
|
||||||
static void md2D_print(B x) { printf("(md2D ");print(c(Md2D,x)->f);printf(" ");print(tag(c(Md2D,x)->m2,MD2_TAG));printf(" ");print(c(Md2D,x)->g);printf(")"); }
|
static void md2D_print(FILE* f, B x) { fprintf(f,"(md2D ");fprint(f,c(Md2D,x)->f);fprintf(f," ");fprint(f,tag(c(Md2D,x)->m2,MD2_TAG));fprintf(f," ");fprint(f,c(Md2D,x)->g);fprintf(f,")"); }
|
||||||
static void md2H_print(B x) { printf("(md2H "); print(tag(c(Md2H,x)->m2,MD2_TAG));printf(" ");print(c(Md2H,x)->g);printf(")"); }
|
static void md2H_print(FILE* f, B x) { fprintf(f,"(md2H "); fprint(f,tag(c(Md2H,x)->m2,MD2_TAG));fprintf(f," ");fprint(f,c(Md2H,x)->g);fprintf(f,")"); }
|
||||||
static void fork_print(B x) { printf("(fork ");print(c(Fork,x)->f);printf(" ");print( c(Fork,x)->g );printf(" ");print(c(Fork,x)->h);printf(")"); }
|
static void fork_print(FILE* f, B x) { fprintf(f,"(fork ");fprint(f,c(Fork,x)->f);fprintf(f," ");fprint(f, c(Fork,x)->g );fprintf(f," ");fprint(f,c(Fork,x)->h);fprintf(f,")"); }
|
||||||
static void atop_print(B x) { printf("(atop "); print( c(Atop,x)->g );printf(" ");print(c(Atop,x)->h);printf(")"); }
|
static void atop_print(FILE* f, B x) { fprintf(f,"(atop "); fprint(f, c(Atop,x)->g );fprintf(f," ");fprint(f,c(Atop,x)->h);fprintf(f,")"); }
|
||||||
|
|
||||||
B md1D_c1(B t, B x) { Md1D* tc = c(Md1D, t); return ((Md1*)tc->m1)->c1(tc, x); }
|
B md1D_c1(B t, B x) { Md1D* tc = c(Md1D, t); return ((Md1*)tc->m1)->c1(tc, x); }
|
||||||
B md1D_c2(B t, B w, B x) { Md1D* tc = c(Md1D, t); return ((Md1*)tc->m1)->c2(tc, w, x); }
|
B md1D_c2(B t, B w, B x) { Md1D* tc = c(Md1D, t); return ((Md1*)tc->m1)->c2(tc, w, x); }
|
||||||
|
|||||||
@ -64,7 +64,7 @@ void fillarr_init() {
|
|||||||
TIi(t_fillarr,freeO) = fillarr_freeO; TIi(t_fillslice,freeO) = slice_freeO;
|
TIi(t_fillarr,freeO) = fillarr_freeO; TIi(t_fillslice,freeO) = slice_freeO;
|
||||||
TIi(t_fillarr,freeF) = fillarr_freeF; TIi(t_fillslice,freeF) = slice_freeF;
|
TIi(t_fillarr,freeF) = fillarr_freeF; TIi(t_fillslice,freeF) = slice_freeF;
|
||||||
TIi(t_fillarr,visit) = fillarr_visit; TIi(t_fillslice,visit) = slice_visit;
|
TIi(t_fillarr,visit) = fillarr_visit; TIi(t_fillslice,visit) = slice_visit;
|
||||||
TIi(t_fillarr,print) = arr_print; TIi(t_fillslice,print) = arr_print;
|
TIi(t_fillarr,print) = farr_print; TIi(t_fillslice,print) = farr_print;
|
||||||
TIi(t_fillarr,isArr) = true; TIi(t_fillslice,isArr) = true;
|
TIi(t_fillarr,isArr) = true; TIi(t_fillslice,isArr) = true;
|
||||||
TIi(t_fillarr,canStore) = fillarr_canStore;
|
TIi(t_fillarr,canStore) = fillarr_canStore;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -139,17 +139,17 @@ static void harrP_visit(Value* x) { assert(x->type == t_harrPartial);
|
|||||||
for (usz i = 0; i < am; i++) mm_visit(p[i]);
|
for (usz i = 0; i < am; i++) mm_visit(p[i]);
|
||||||
}
|
}
|
||||||
static B harrP_get(Arr* x, usz n) { err("getting item from t_harrPartial"); }
|
static B harrP_get(Arr* x, usz n) { err("getting item from t_harrPartial"); }
|
||||||
static void harrP_print(B x) {
|
static void harrP_print(FILE* f, B x) {
|
||||||
B* p = c(HArr,x)->a;
|
B* p = c(HArr,x)->a;
|
||||||
usz am = *c(HArr,x)->sh;
|
usz am = *c(HArr,x)->sh;
|
||||||
usz ia = a(x)->ia;
|
usz ia = a(x)->ia;
|
||||||
printf("(partial HArr "N64d"/"N64d": ⟨", (u64)am, (u64)ia);
|
fprintf(f, "(partial HArr "N64d"/"N64d": ⟨", (u64)am, (u64)ia);
|
||||||
for (usz i = 0; i < ia; i++) {
|
for (usz i = 0; i < ia; i++) {
|
||||||
if (i) printf(", ");
|
if (i) fprintf(f, ", ");
|
||||||
if (i>=am) printf("?");
|
if (i>=am) fprintf(f, "?");
|
||||||
else print(p[i]);
|
else fprint(f, p[i]);
|
||||||
}
|
}
|
||||||
printf("⟩)");
|
fprintf(f, "⟩)");
|
||||||
}
|
}
|
||||||
|
|
||||||
void harr_init() {
|
void harr_init() {
|
||||||
@ -159,7 +159,7 @@ void harr_init() {
|
|||||||
TIi(t_harr,freeO) = harr_freeO; TIi(t_hslice,freeO) = slice_freeO; TIi(t_harrPartial,freeO) = harrP_freeO;
|
TIi(t_harr,freeO) = harr_freeO; TIi(t_hslice,freeO) = slice_freeO; TIi(t_harrPartial,freeO) = harrP_freeO;
|
||||||
TIi(t_harr,freeF) = harr_freeF; TIi(t_hslice,freeF) = slice_freeF; TIi(t_harrPartial,freeF) = harrP_freeF;
|
TIi(t_harr,freeF) = harr_freeF; TIi(t_hslice,freeF) = slice_freeF; TIi(t_harrPartial,freeF) = harrP_freeF;
|
||||||
TIi(t_harr,visit) = harr_visit; TIi(t_hslice,visit) = slice_visit; TIi(t_harrPartial,visit) = harrP_visit;
|
TIi(t_harr,visit) = harr_visit; TIi(t_hslice,visit) = slice_visit; TIi(t_harrPartial,visit) = harrP_visit;
|
||||||
TIi(t_harr,print) = arr_print; TIi(t_hslice,print) = arr_print; TIi(t_harrPartial,print) = harrP_print;
|
TIi(t_harr,print) = farr_print; TIi(t_hslice,print) = farr_print; TIi(t_harrPartial,print) = harrP_print;
|
||||||
TIi(t_harr,isArr) = true; TIi(t_hslice,isArr) = true;
|
TIi(t_harr,isArr) = true; TIi(t_hslice,isArr) = true;
|
||||||
TIi(t_harr,canStore) = harr_canStore;
|
TIi(t_harr,canStore) = harr_canStore;
|
||||||
bi_emptyHVec = m_harrUv(0).b; gc_add(bi_emptyHVec);
|
bi_emptyHVec = m_harrUv(0).b; gc_add(bi_emptyHVec);
|
||||||
|
|||||||
@ -91,76 +91,77 @@ NOINLINE TStack* ts_e(TStack* o, u32 elsz, u64 am) { u64 size = o->size;
|
|||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
|
|
||||||
NOINLINE void arr_print(B x) { // should accept refc=0 arguments for debugging purposes
|
void fprint(FILE* f, B x);
|
||||||
|
void farr_print(FILE* f, B x) { // should accept refc=0 arguments for debugging purposes
|
||||||
ur r = rnk(x);
|
ur r = rnk(x);
|
||||||
SGetU(x)
|
SGetU(x)
|
||||||
usz ia = a(x)->ia;
|
usz ia = a(x)->ia;
|
||||||
if (r!=1) {
|
if (r!=1) {
|
||||||
if (r==0) {
|
if (r==0) {
|
||||||
printf("<");
|
fprintf(f, "<");
|
||||||
print(GetU(x,0));
|
fprint(f, GetU(x,0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
usz* sh = a(x)->sh;
|
usz* sh = a(x)->sh;
|
||||||
for (i32 i = 0; i < r; i++) {
|
for (i32 i = 0; i < r; i++) {
|
||||||
if(i==0)printf(N64d,(u64)sh[i]);
|
if(i==0)fprintf(f, N64d,(u64)sh[i]);
|
||||||
else printf("‿"N64d,(u64)sh[i]);
|
else fprintf(f, "‿"N64d,(u64)sh[i]);
|
||||||
}
|
}
|
||||||
printf("⥊");
|
fprintf(f, "⥊");
|
||||||
} else if (ia>0) {
|
} else if (ia>0) {
|
||||||
for (usz i = 0; i < ia; i++) {
|
for (usz i = 0; i < ia; i++) {
|
||||||
B c = GetU(x,i);
|
B c = GetU(x,i);
|
||||||
if (!isC32(c) || (u32)c.u=='\n') goto reg;
|
if (!isC32(c) || (u32)c.u=='\n') goto reg;
|
||||||
}
|
}
|
||||||
printf("\"");
|
fprintf(f, "\"");
|
||||||
for (usz i = 0; i < ia; i++) printUTF8((u32)GetU(x,i).u); // c32, no need to decrement
|
for (usz i = 0; i < ia; i++) fprintUTF8(f, (u32)GetU(x,i).u); // c32, no need to decrement
|
||||||
printf("\"");
|
fprintf(f, "\"");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
reg:;
|
reg:;
|
||||||
printf("⟨");
|
fprintf(f, "⟨");
|
||||||
for (usz i = 0; i < ia; i++) {
|
for (usz i = 0; i < ia; i++) {
|
||||||
if (i!=0) printf(", ");
|
if (i!=0) fprintf(f, ", ");
|
||||||
print(GetU(x,i));
|
fprint(f, GetU(x,i));
|
||||||
}
|
}
|
||||||
printf("⟩");
|
fprintf(f, "⟩");
|
||||||
}
|
}
|
||||||
|
|
||||||
NOINLINE void print(B x) {
|
void fprint(FILE* f, B x) {
|
||||||
if (isF64(x)) {
|
if (isF64(x)) {
|
||||||
NUM_FMT_BUF(buf, x.f);
|
NUM_FMT_BUF(buf, x.f);
|
||||||
printf("%s", buf);
|
fprintf(f, "%s", buf);
|
||||||
} else if (isC32(x)) {
|
} else if (isC32(x)) {
|
||||||
if ((u32)x.u>=32) { printf("'"); printUTF8((u32)x.u); printf("'"); }
|
if ((u32)x.u>=32) { fprintf(f, "'"); printUTF8((u32)x.u); fprintf(f, "'"); }
|
||||||
else if((u32)x.u>15) printf("\\x%x", (u32)x.u);
|
else if((u32)x.u>15) fprintf(f, "\\x%x", (u32)x.u);
|
||||||
else printf("\\x0%x", (u32)x.u);
|
else fprintf(f, "\\x0%x", (u32)x.u);
|
||||||
} else if (isVal(x)) {
|
} else if (isVal(x)) {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (isVal(x) && (v(x)->type==t_freed || v(x)->type==t_empty)) {
|
if (isVal(x) && (v(x)->type==t_freed || v(x)->type==t_empty)) {
|
||||||
u8 t = v(x)->type;
|
u8 t = v(x)->type;
|
||||||
v(x)->type = v(x)->flags;
|
v(x)->type = v(x)->flags;
|
||||||
printf(t==t_freed?"FREED:":"EMPTY:");
|
fprintf(f, t==t_freed?"FREED:":"EMPTY:");
|
||||||
TI(x,print)(x);
|
TI(x,print)(f, x);
|
||||||
v(x)->type = t;
|
v(x)->type = t;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
TI(x,print)(x);
|
TI(x,print)(f, x);
|
||||||
}
|
}
|
||||||
else if (isVar(x)) printf("(var d=%d i=%d)", (u16)(x.u>>32), (i32)x.u);
|
else if (isVar(x)) fprintf(f, "(var d=%d i=%d)", (u16)(x.u>>32), (i32)x.u);
|
||||||
else if (isExt(x)) printf("(extvar d=%d i=%d)", (u16)(x.u>>32), (i32)x.u);
|
else if (isExt(x)) fprintf(f, "(extvar d=%d i=%d)", (u16)(x.u>>32), (i32)x.u);
|
||||||
else if (x.u==bi_N.u) printf("·");
|
else if (x.u==bi_N.u) fprintf(f, "·");
|
||||||
else if (x.u==bi_optOut.u) printf("(value optimized out)");
|
else if (x.u==bi_optOut.u) fprintf(f, "(value optimized out)");
|
||||||
else if (x.u==bi_noVar.u) printf("(unset variable placeholder)");
|
else if (x.u==bi_noVar.u) fprintf(f, "(unset variable placeholder)");
|
||||||
else if (x.u==bi_okHdr.u) printf("(accepted SETH placeholder)");
|
else if (x.u==bi_okHdr.u) fprintf(f, "(accepted SETH placeholder)");
|
||||||
else if (x.u==bi_noFill.u) printf("(no fill placeholder)");
|
else if (x.u==bi_noFill.u) fprintf(f, "(no fill placeholder)");
|
||||||
else printf("(todo tag "N64x")", x.u>>48);
|
else fprintf(f, "(todo tag "N64x")", x.u>>48);
|
||||||
}
|
}
|
||||||
|
|
||||||
NOINLINE void printRaw(B x) {
|
NOINLINE void fprintRaw(FILE* f, B x) {
|
||||||
if (isAtm(x)) {
|
if (isAtm(x)) {
|
||||||
if (isF64(x)) { NUM_FMT_BUF(buf, x.f); printf("%s", buf); }
|
if (isF64(x)) { NUM_FMT_BUF(buf, x.f); fprintf(f, "%s", buf); }
|
||||||
else if (isC32(x)) printUTF8((u32)x.u);
|
else if (isC32(x)) fprintUTF8(f, (u32)x.u);
|
||||||
else thrM("bad printRaw argument: atom arguments should be either numerical or characters");
|
else thrM("bad printRaw argument: atom arguments should be either numerical or characters");
|
||||||
} else {
|
} else {
|
||||||
usz ia = a(x)->ia;
|
usz ia = a(x)->ia;
|
||||||
@ -168,13 +169,24 @@ NOINLINE void printRaw(B x) {
|
|||||||
for (usz i = 0; i < ia; i++) {
|
for (usz i = 0; i < ia; i++) {
|
||||||
B c = GetU(x,i);
|
B c = GetU(x,i);
|
||||||
#if !CATCH_ERRORS
|
#if !CATCH_ERRORS
|
||||||
if (c.u==0 || noFill(c)) { printf(" "); continue; }
|
if (c.u==0 || noFill(c)) { fprintf(f, " "); continue; }
|
||||||
#endif
|
#endif
|
||||||
if (!isC32(c)) thrM("bad printRaw argument: expected all character items");
|
if (!isC32(c)) thrM("bad printRaw argument: expected all character items");
|
||||||
printUTF8((u32)c.u);
|
fprintUTF8(f, (u32)c.u);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NOINLINE void printRaw(B x) {
|
||||||
|
fprintRaw(stdout, x);
|
||||||
|
}
|
||||||
|
NOINLINE void arr_print(B x) {
|
||||||
|
farr_print(stdout, x);
|
||||||
|
}
|
||||||
|
NOINLINE void print(B x) {
|
||||||
|
fprint(stdout, x);
|
||||||
|
}
|
||||||
|
|
||||||
i32 num_fmt(char buf[30], f64 x) {
|
i32 num_fmt(char buf[30], f64 x) {
|
||||||
// for (int i = 0; i < 30; i++) buf[i] = 'a';
|
// for (int i = 0; i < 30; i++) buf[i] = 'a';
|
||||||
snprintf(buf, 30, "%.16g", x); // should be %.17g to (probably?) never lose precision, but that also makes things ugly
|
snprintf(buf, 30, "%.16g", x); // should be %.17g to (probably?) never lose precision, but that also makes things ugly
|
||||||
|
|||||||
@ -124,7 +124,7 @@ static void bitarr_init() {
|
|||||||
TIi(t_bitarr,freeO) = tyarr_freeO;
|
TIi(t_bitarr,freeO) = tyarr_freeO;
|
||||||
TIi(t_bitarr,freeF) = tyarr_freeF;
|
TIi(t_bitarr,freeF) = tyarr_freeF;
|
||||||
TIi(t_bitarr,visit) = noop_visit;
|
TIi(t_bitarr,visit) = noop_visit;
|
||||||
TIi(t_bitarr,print) = arr_print;
|
TIi(t_bitarr,print) = farr_print;
|
||||||
TIi(t_bitarr,isArr) = true;
|
TIi(t_bitarr,isArr) = true;
|
||||||
TIi(t_bitarr,arrD1) = true;
|
TIi(t_bitarr,arrD1) = true;
|
||||||
TIi(t_bitarr,elType) = el_bit;
|
TIi(t_bitarr,elType) = el_bit;
|
||||||
|
|||||||
@ -22,7 +22,7 @@ static void TP(,arr_init)() {
|
|||||||
TIi(T_ARR,freeO) = tyarr_freeO; TIi(T_SLICE,freeO) = slice_freeO;
|
TIi(T_ARR,freeO) = tyarr_freeO; TIi(T_SLICE,freeO) = slice_freeO;
|
||||||
TIi(T_ARR,freeF) = tyarr_freeF; TIi(T_SLICE,freeF) = slice_freeF;
|
TIi(T_ARR,freeF) = tyarr_freeF; TIi(T_SLICE,freeF) = slice_freeF;
|
||||||
TIi(T_ARR,visit) = noop_visit; TIi(T_SLICE,visit) = slice_visit;
|
TIi(T_ARR,visit) = noop_visit; TIi(T_SLICE,visit) = slice_visit;
|
||||||
TIi(T_ARR,print) = arr_print; TIi(T_SLICE,print) = arr_print;
|
TIi(T_ARR,print) = farr_print; TIi(T_SLICE,print) = farr_print;
|
||||||
TIi(T_ARR,isArr) = true; TIi(T_SLICE,isArr) = true;
|
TIi(T_ARR,isArr) = true; TIi(T_SLICE,isArr) = true;
|
||||||
TIi(T_ARR,arrD1) = true; TIi(T_SLICE,arrD1) = true;
|
TIi(T_ARR,arrD1) = true; TIi(T_SLICE,arrD1) = true;
|
||||||
TIi(T_ARR,elType) = TP(el_,); TIi(T_SLICE,elType) = TP(el_,);
|
TIi(T_ARR,elType) = TP(el_,); TIi(T_SLICE,elType) = TP(el_,);
|
||||||
|
|||||||
8
src/h.h
8
src/h.h
@ -317,8 +317,11 @@ static void mm_visitP(void* x);
|
|||||||
static void dec(B x);
|
static void dec(B x);
|
||||||
static B inc(B x);
|
static B inc(B x);
|
||||||
static void ptr_dec(void* x);
|
static void ptr_dec(void* x);
|
||||||
void printRaw(B x); // doesn't consume
|
void fprint (FILE* f, B x); // doesn't consume
|
||||||
|
void fprintRaw (FILE* f, B x); // doesn't consume
|
||||||
|
void farr_print(FILE* f, B x); // doesn't consume
|
||||||
void print(B x); // doesn't consume
|
void print(B x); // doesn't consume
|
||||||
|
void printRaw(B x); // doesn't consume
|
||||||
void arr_print(B x); // doesn't consume
|
void arr_print(B x); // doesn't consume
|
||||||
bool equal(B w, B x); // doesn't consume
|
bool equal(B w, B x); // doesn't consume
|
||||||
bool eequal(B w, B x); // doesn't consume
|
bool eequal(B w, B x); // doesn't consume
|
||||||
@ -443,6 +446,7 @@ typedef struct Md2D Md2D;
|
|||||||
|
|
||||||
typedef bool (* B2b)(B);
|
typedef bool (* B2b)(B);
|
||||||
typedef void (* B2v)(B);
|
typedef void (* B2v)(B);
|
||||||
|
typedef void (* FB2v)(FILE*, B);
|
||||||
typedef Arr* (*BSS2A)(B, usz, usz);
|
typedef Arr* (*BSS2A)(B, usz, usz);
|
||||||
typedef B (* AS2B)(Arr*, usz);
|
typedef B (* AS2B)(Arr*, usz);
|
||||||
typedef B (* BS2B)(B, usz);
|
typedef B (* BS2B)(B, usz);
|
||||||
@ -492,7 +496,7 @@ typedef B (*D2C2)(Md2D*, B, B);
|
|||||||
F(B2b, canStore) /* doesn't consume */ \
|
F(B2b, canStore) /* doesn't consume */ \
|
||||||
F(u8, elType) /* guarantees that the corresponding i32any_ptr/f64any_ptr/c32any_ptr/… always succeeds */ \
|
F(u8, elType) /* guarantees that the corresponding i32any_ptr/f64any_ptr/c32any_ptr/… always succeeds */ \
|
||||||
\
|
\
|
||||||
F(B2v, print) /* doesn't consume */ \
|
F(FB2v, print) /* doesn't consume */ \
|
||||||
F(V2v, visit) /* call mm_visit for all referents */ \
|
F(V2v, visit) /* call mm_visit for all referents */ \
|
||||||
F(V2v, freeO) /* like freeF, but doesn't call mm_free for GC to be able to clear cycles */ \
|
F(V2v, freeO) /* like freeF, but doesn't call mm_free for GC to be able to clear cycles */ \
|
||||||
F(B2B, decompose) /* consumes; must return a HArr */ \
|
F(B2B, decompose) /* consumes; must return a HArr */ \
|
||||||
|
|||||||
@ -505,7 +505,7 @@ static void empty_free(Value* x) { err("FREEING EMPTY\n"); }
|
|||||||
static void builtin_free(Value* x) { err("FREEING BUILTIN\n"); }
|
static void builtin_free(Value* x) { err("FREEING BUILTIN\n"); }
|
||||||
DEF_FREE(def) { }
|
DEF_FREE(def) { }
|
||||||
static void def_visit(Value* x) { printf("(no visit for %d=%s)\n", x->type, type_repr(x->type)); }
|
static void def_visit(Value* x) { printf("(no visit for %d=%s)\n", x->type, type_repr(x->type)); }
|
||||||
static void def_print(B x) { printf("(%d=%s)", v(x)->type, type_repr(v(x)->type)); }
|
static void def_print(FILE* f, B x) { fprintf(f, "(%d=%s)", v(x)->type, type_repr(v(x)->type)); }
|
||||||
static bool def_canStore(B x) { return false; }
|
static bool def_canStore(B x) { return false; }
|
||||||
static B def_identity(B f) { return bi_N; }
|
static B def_identity(B f) { return bi_N; }
|
||||||
static B def_get(Arr* x, usz n) { err("def_get"); }
|
static B def_get(Arr* x, usz n) { err("def_get"); }
|
||||||
|
|||||||
@ -152,7 +152,7 @@ int main(int argc, char* argv[]) {
|
|||||||
if (startREPL) {
|
if (startREPL) {
|
||||||
repl_init();
|
repl_init();
|
||||||
while (CATCH) {
|
while (CATCH) {
|
||||||
printf("Error: "); printErrMsg(thrownMsg); putchar('\n');
|
fprintf(stderr, "Error: "); printErrMsg(thrownMsg); fputc('\n', stderr);
|
||||||
vm_pst(envCurr+1, envStart+envPrevHeight);
|
vm_pst(envCurr+1, envStart+envPrevHeight);
|
||||||
freeThrown();
|
freeThrown();
|
||||||
#ifdef HEAP_VERIFY
|
#ifdef HEAP_VERIFY
|
||||||
|
|||||||
@ -37,10 +37,10 @@ B nfn_name(B x) { VTY(x, t_nfn);
|
|||||||
|
|
||||||
DEF_FREE(nfn) { dec(((NFn*)x)->obj); }
|
DEF_FREE(nfn) { dec(((NFn*)x)->obj); }
|
||||||
void nfn_visit(Value* x) { mm_visit(((NFn*)x)->obj); }
|
void nfn_visit(Value* x) { mm_visit(((NFn*)x)->obj); }
|
||||||
void nfn_print(B x) { printRaw(c(NFnDesc,IGetU(nfn_list,c(NFn,x)->id))->name); }
|
void nfn_print(FILE* f, B x) { fprintRaw(f, c(NFnDesc,IGetU(nfn_list,c(NFn,x)->id))->name); }
|
||||||
DEF_FREE(nfnDesc) { err("nfnDesc shouldn't be freed!"); }
|
DEF_FREE(nfnDesc) { err("nfnDesc shouldn't be freed!"); }
|
||||||
void nfnDesc_visit(Value* x) { mm_visit(((NFnDesc*)x)->name); }
|
void nfnDesc_visit(Value* x) { mm_visit(((NFnDesc*)x)->name); }
|
||||||
void nfnDesc_print(B x) { printf("(native function description)"); }
|
void nfnDesc_print(FILE* f, B x) { fprintf(f, "(native function description)"); }
|
||||||
|
|
||||||
void nfn_gcRoot() {
|
void nfn_gcRoot() {
|
||||||
mm_visit(nfn_list);
|
mm_visit(nfn_list);
|
||||||
|
|||||||
16
src/ns.c
16
src/ns.c
@ -176,8 +176,8 @@ static void ns_visit(Value* x) {
|
|||||||
mm_visitP(c->desc);
|
mm_visitP(c->desc);
|
||||||
mm_visitP(c->sc);
|
mm_visitP(c->sc);
|
||||||
}
|
}
|
||||||
static void ns_print(B x) {
|
static void ns_print(FILE* f, B x) {
|
||||||
putchar('{');
|
fputc('{', f);
|
||||||
NSDesc* desc = c(NS,x)->desc;
|
NSDesc* desc = c(NS,x)->desc;
|
||||||
Scope* sc = c(NS,x)->sc;
|
Scope* sc = c(NS,x)->sc;
|
||||||
i32 am = desc->varAm;
|
i32 am = desc->varAm;
|
||||||
@ -186,13 +186,13 @@ static void ns_print(B x) {
|
|||||||
i32 id = desc->expGIDs[i];
|
i32 id = desc->expGIDs[i];
|
||||||
if (id>=0) {
|
if (id>=0) {
|
||||||
if (first) first=false;
|
if (first) first=false;
|
||||||
else printf(" ⋄ ");
|
else fprintf(f," ⋄ ");
|
||||||
printRaw(gid2str(id));
|
fprintRaw(f, gid2str(id));
|
||||||
printf("⇐");
|
fprintf(f, "⇐");
|
||||||
print(sc->vars[i]);
|
fprint(f, sc->vars[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
putchar('}');
|
fputc('}', f);
|
||||||
}
|
}
|
||||||
B nsFmt(B x) { // consumes
|
B nsFmt(B x) { // consumes
|
||||||
B s = emptyCVec();
|
B s = emptyCVec();
|
||||||
@ -213,7 +213,7 @@ B nsFmt(B x) { // consumes
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nsDesc_print(B x) { printf("(namespace description)"); }
|
static void nsDesc_print(FILE* f, B x) { fprintf(f, "(namespace description)"); }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,12 @@ void printUTF8(u32 c) {
|
|||||||
else if (c<=0xFFFF) printf("%c%c%c" , 0xE0| c>>12, 0x80|(c>>6 &0x3F), 0x80|(c &0x3F) );
|
else if (c<=0xFFFF) printf("%c%c%c" , 0xE0| c>>12, 0x80|(c>>6 &0x3F), 0x80|(c &0x3F) );
|
||||||
else printf("%c%c%c%c", 0xF0| c>>18, 0x80|(c>>12&0x3F), 0x80|(c>>6&0x3F), 0x80|(c&0x3F));
|
else printf("%c%c%c%c", 0xF0| c>>18, 0x80|(c>>12&0x3F), 0x80|(c>>6&0x3F), 0x80|(c&0x3F));
|
||||||
}
|
}
|
||||||
|
void fprintUTF8(FILE* f, u32 c) {
|
||||||
|
if (c<128) fprintf(f, "%c", c);
|
||||||
|
else if (c<=0x07FF) fprintf(f, "%c%c" , 0xC0| c>>6 , 0x80|(c &0x3F) );
|
||||||
|
else if (c<=0xFFFF) fprintf(f, "%c%c%c" , 0xE0| c>>12, 0x80|(c>>6 &0x3F), 0x80|(c &0x3F) );
|
||||||
|
else fprintf(f, "%c%c%c%c", 0xF0| c>>18, 0x80|(c>>12&0x3F), 0x80|(c>>6&0x3F), 0x80|(c&0x3F));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
u64 utf8lenB(B x) { // doesn't consume; may error as it verifies whether is all chars
|
u64 utf8lenB(B x) { // doesn't consume; may error as it verifies whether is all chars
|
||||||
|
|||||||
@ -4,6 +4,7 @@ B fromUTF8(char* s, i64 len);
|
|||||||
B fromUTF8l(char* s);
|
B fromUTF8l(char* s);
|
||||||
|
|
||||||
void printUTF8(u32 c);
|
void printUTF8(u32 c);
|
||||||
|
void fprintUTF8(FILE* f, u32 c);
|
||||||
|
|
||||||
u64 utf8lenB(B x); // doesn't consume; may error as it verifies whether is all chars
|
u64 utf8lenB(B x); // doesn't consume; may error as it verifies whether is all chars
|
||||||
void toUTF8(B x, char* p); // doesn't consume; doesn't verify anything; p must have utf8lenB(x) bytes (calculating which should verify that this call is ok), add trailing null yourself
|
void toUTF8(B x, char* p); // doesn't consume; doesn't verify anything; p must have utf8lenB(x) bytes (calculating which should verify that this call is ok), add trailing null yourself
|
||||||
|
|||||||
60
src/vm.c
60
src/vm.c
@ -946,24 +946,24 @@ void vfymO_visit(Value* x) { mm_visit(((VfyObj* )x)->obj); }
|
|||||||
void bBlks_visit(Value* x) { BlBlocks* c = (BlBlocks*)x; u16 am = c->am; for (i32 i = 0; i < am; i++) mm_visitP(c->a[i]); }
|
void bBlks_visit(Value* x) { BlBlocks* c = (BlBlocks*)x; u16 am = c->am; for (i32 i = 0; i < am; i++) mm_visitP(c->a[i]); }
|
||||||
void scExt_visit(Value* x) { ScopeExt* c = (ScopeExt*)x; u16 am = c->varAm*2; for (i32 i = 0; i < am; i++) mm_visit(c->vars[i]); }
|
void scExt_visit(Value* x) { ScopeExt* c = (ScopeExt*)x; u16 am = c->varAm*2; for (i32 i = 0; i < am; i++) mm_visit(c->vars[i]); }
|
||||||
|
|
||||||
void comp_print (B x) { printf("(%p: comp)",v(x)); }
|
void comp_print (FILE* f, B x) { fprintf(f,"(%p: comp)",v(x)); }
|
||||||
void body_print (B x) { printf("(%p: body varam=%d)",v(x),c(Body,x)->varAm); }
|
void body_print (FILE* f, B x) { fprintf(f,"(%p: body varam=%d)",v(x),c(Body,x)->varAm); }
|
||||||
void block_print(B x) { printf("(%p: block)",v(x)); }
|
void block_print(FILE* f, B x) { fprintf(f,"(%p: block)",v(x)); }
|
||||||
void scope_print(B x) { printf("(%p: scope; vars:",v(x));Scope*sc=c(Scope,x);for(u64 i=0;i<sc->varAm;i++){printf(" ");print(sc->vars[i]);}printf(")"); }
|
void scope_print(FILE* f, B x) { fprintf(f,"(%p: scope; vars:",v(x));Scope*sc=c(Scope,x);for(u64 i=0;i<sc->varAm;i++){fprintf(f," ");fprint(f,sc->vars[i]);}fprintf(f,")"); }
|
||||||
void alias_print(B x) { printf("(alias %d of ", c(FldAlias,x)->p); print(c(FldAlias,x)->obj); printf(")"); }
|
void alias_print(FILE* f, B x) { fprintf(f,"(alias %d of ", c(FldAlias,x)->p); fprint(f,c(FldAlias,x)->obj); fprintf(f,")"); }
|
||||||
void vfymO_print(B x) { print(c(FldAlias,x)->obj); }
|
void vfymO_print(FILE* f, B x) { fprint(f,c(FldAlias,x)->obj); }
|
||||||
void bBlks_print(B x) { printf("(block list)"); }
|
void bBlks_print(FILE* f, B x) { fprintf(f,"(block list)"); }
|
||||||
void scExt_print(B x) { printf("(scope extension with %d vars)", c(ScopeExt,x)->varAm); }
|
void scExt_print(FILE* f, B x) { fprintf(f,"(scope extension with %d vars)", c(ScopeExt,x)->varAm); }
|
||||||
|
|
||||||
// void funBl_print(B x) { printf("(%p: function"" block bl=%p sc=%p)",v(x),c(FunBlock,x)->bl,c(FunBlock,x)->sc); }
|
// void funBl_print(FILE* f, B x) { fprintf(f,"(%p: function"" block bl=%p sc=%p)",v(x),c(FunBlock,x)->bl,c(FunBlock,x)->sc); }
|
||||||
// void md1Bl_print(B x) { printf("(%p: 1-modifier block bl=%p sc=%p)",v(x),c(Md1Block,x)->bl,c(Md1Block,x)->sc); }
|
// void md1Bl_print(FILE* f, B x) { fprintf(f,"(%p: 1-modifier block bl=%p sc=%p)",v(x),c(Md1Block,x)->bl,c(Md1Block,x)->sc); }
|
||||||
// void md2Bl_print(B x) { printf("(%p: 2-modifier block bl=%p sc=%p)",v(x),c(Md2Block,x)->bl,c(Md2Block,x)->sc); }
|
// void md2Bl_print(FILE* f, B x) { fprintf(f,"(%p: 2-modifier block bl=%p sc=%p)",v(x),c(Md2Block,x)->bl,c(Md2Block,x)->sc); }
|
||||||
// void funBl_print(B x) { printf("(function"" block @%d)",c(FunBlock,x)->bl->body->map[0]); }
|
// void funBl_print(FILE* f, B x) { fprintf(f,"(function"" block @%d)",c(FunBlock,x)->bl->body->map[0]); }
|
||||||
// void md1Bl_print(B x) { printf("(1-modifier block @%d)",c(Md1Block,x)->bl->body->map[0]); }
|
// void md1Bl_print(FILE* f, B x) { fprintf(f,"(1-modifier block @%d)",c(Md1Block,x)->bl->body->map[0]); }
|
||||||
// void md2Bl_print(B x) { printf("(2-modifier block @%d)",c(Md2Block,x)->bl->body->map[0]); }
|
// void md2Bl_print(FILE* f, B x) { fprintf(f,"(2-modifier block @%d)",c(Md2Block,x)->bl->body->map[0]); }
|
||||||
void funBl_print(B x) { printf("{function"" block}"); }
|
void funBl_print(FILE* f, B x) { fprintf(f,"{function"" block}"); }
|
||||||
void md1Bl_print(B x) { printf("{1-modifier block}"); }
|
void md1Bl_print(FILE* f, B x) { fprintf(f,"{1-modifier block}"); }
|
||||||
void md2Bl_print(B x) { printf("{2-modifier block}"); }
|
void md2Bl_print(FILE* f, B x) { fprintf(f,"{2-modifier block}"); }
|
||||||
|
|
||||||
B block_decompose(B x) { return m_hVec2(m_i32(1), x); }
|
B block_decompose(B x) { return m_hVec2(m_i32(1), x); }
|
||||||
|
|
||||||
@ -1147,28 +1147,28 @@ NOINLINE void vm_printPos(Comp* comp, i32 bcPos, i64 pos) {
|
|||||||
// printf(" inds:%d…%d\n", cs, ce);
|
// printf(" inds:%d…%d\n", cs, ce);
|
||||||
if (CATCH) { // want to try really hard to print errors
|
if (CATCH) { // want to try really hard to print errors
|
||||||
freeThrown();
|
freeThrown();
|
||||||
int start = printf("at ");
|
int start = fprintf(stderr, "at ");
|
||||||
usz srcL = a(src)->ia;
|
usz srcL = a(src)->ia;
|
||||||
SGetU(src)
|
SGetU(src)
|
||||||
usz srcS = cs; while (srcS>0 && o2cu(GetU(src,srcS-1))!='\n') srcS--;
|
usz srcS = cs; while (srcS>0 && o2cu(GetU(src,srcS-1))!='\n') srcS--;
|
||||||
usz srcE = srcS; while (srcE<srcL) { u32 chr = o2cu(GetU(src, srcE)); if(chr=='\n')break; printUTF8(chr); srcE++; }
|
usz srcE = srcS; while (srcE<srcL) { u32 chr = o2cu(GetU(src, srcE)); if(chr=='\n')break; printUTF8(chr); srcE++; }
|
||||||
if (ce>srcE) ce = srcE;
|
if (ce>srcE) ce = srcE;
|
||||||
cs-= srcS; ce-= srcS;
|
cs-= srcS; ce-= srcS;
|
||||||
putchar('\n');
|
fputc('\n', stderr);
|
||||||
for (i32 i = 0; i < cs+start; i++) putchar(' ');
|
for (i32 i = 0; i < cs+start; i++) fputc(' ', stderr);
|
||||||
for (i32 i = cs; i < ce; i++) putchar('^');
|
for (i32 i = cs; i < ce; i++) fputc('^', stderr);
|
||||||
putchar('\n');
|
fputc('\n', stderr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
B s = emptyCVec();
|
B s = emptyCVec();
|
||||||
printRaw(vm_fmtPoint(src, s, comp->path, cs, ce));
|
fprintRaw(stderr, vm_fmtPoint(src, s, comp->path, cs, ce));
|
||||||
putchar('\n');
|
fputc('\n', stderr);
|
||||||
popCatch();
|
popCatch();
|
||||||
//print_BCStream((u32*)i32arr_ptr(comp->bc)+bcPos);
|
//print_BCStream((u32*)i32arr_ptr(comp->bc)+bcPos);
|
||||||
} else {
|
} else {
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (pos!=-1) printf(N64d": ", pos);
|
if (pos!=-1) fprintf(stderr, N64d": ", pos);
|
||||||
printf("source unknown\n");
|
fprintf(stderr, "source unknown\n");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1180,7 +1180,7 @@ NOINLINE void vm_pst(Env* s, Env* e) { // e not included
|
|||||||
while (i>=0) {
|
while (i>=0) {
|
||||||
Env* c = s+i;
|
Env* c = s+i;
|
||||||
if (l>30 && i==l-10) {
|
if (l>30 && i==l-10) {
|
||||||
printf("("N64d" entries omitted)\n", l-20);
|
fprintf(stderr, "("N64d" entries omitted)\n", l-20);
|
||||||
i = 10;
|
i = 10;
|
||||||
}
|
}
|
||||||
Comp* comp = c->sc->body->bl->comp;
|
Comp* comp = c->sc->body->bl->comp;
|
||||||
@ -1213,11 +1213,11 @@ NOINLINE void printErrMsg(B msg) {
|
|||||||
SGetU(msg)
|
SGetU(msg)
|
||||||
usz msgLen = a(msg)->ia;
|
usz msgLen = a(msg)->ia;
|
||||||
for (usz i = 0; i < msgLen; i++) if (!isC32(GetU(msg,i))) goto base;
|
for (usz i = 0; i < msgLen; i++) if (!isC32(GetU(msg,i))) goto base;
|
||||||
printRaw(msg);
|
fprintRaw(stderr,msg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
base:
|
base:
|
||||||
print(msg);
|
fprint(stderr, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1240,7 +1240,7 @@ NOINLINE NORETURN void throwImpl(bool rethrow) {
|
|||||||
longjmp(cf->jmp, 1);
|
longjmp(cf->jmp, 1);
|
||||||
} else { // uncaught error
|
} else { // uncaught error
|
||||||
assert(cf==cfStart);
|
assert(cf==cfStart);
|
||||||
printf("Error: "); printErrMsg(thrownMsg); putchar('\n'); fflush(stdout);
|
fprintf(stderr, "Error: "); printErrMsg(thrownMsg); fputc('\n',stderr); fflush(stderr);
|
||||||
Env* envEnd = envCurr+1;
|
Env* envEnd = envCurr+1;
|
||||||
unwindEnv(envStart-1);
|
unwindEnv(envStart-1);
|
||||||
vm_pst(envCurr+1, envEnd);
|
vm_pst(envCurr+1, envEnd);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user