add •CompObj to NATIVE_COMPILER

This commit is contained in:
dzaima 2023-01-26 01:53:09 +02:00
parent 9abe7506ab
commit cc5a5752bf
4 changed files with 16 additions and 9 deletions

View File

@ -8,8 +8,8 @@
/* sfns.c*/A(shifta,"«") A(take,"") A(drop,"") A(group,"") A(reverse,"") A(transp,"") \
/* sort.c*/A(gradeUp,"") A(gradeDown,"") \
/* everything before the definition of •Type is defined to be pure, and everything after is not */ \
/* sysfn.c*/A(invalidFn, "(invalid fn)") M(type,"•Type") M(decp,"•Decompose") M(primInd,"•PrimInd") M(glyph,"•Glyph") A(fill,"•FillFn") M(sys,"•getsys") A(grLen,"•GroupLen") \
/* sysfn.c*/D(grOrd,"•GroupOrd") M(repr,"•Repr") M(parseFloat,"•ParseFloat") M(fmt,"•Fmt") A(asrt,"!") A(casrt,"!") M(out,"•Out") M(show,"•Show") A(bqn,"•BQN") \
/* sysfn.c*/A(invalidFn, "(invalid fn)") A(grLen,"•GroupLen") D(grOrd,"•GroupOrd") M(compObj, "•CompObj") A(fill,"•FillFn") M(sys,"•getsys") M(primInd,"•PrimInd") M(glyph,"•Glyph") \
/* sysfn.c*/M(type,"•Type") M(decp,"•Decompose") M(repr,"•Repr") M(parseFloat,"•ParseFloat") M(fmt,"•Fmt") A(asrt,"!") A(casrt,"!") M(out,"•Out") M(show,"•Show") A(bqn,"•BQN") \
/* sysfn.c*/A(sh,"•SH") M(fromUtf8,"•FromUTF8") M(toUtf8,"•ToUTF8") M(currentError,"•CurrentError") D(cmp,"•Cmp") A(hash,"•Hash") M(unixTime,"•UnixTime")\
/* sysfn.c*/M(monoTime,"•MonoTime") M(delay,"•Delay") M(makeRand,"•MakeRand") M(reBQN,"•ReBQN") M(exit,"•Exit") M(getLine,"•GetLine") \
/* sysfn.c*/M(fName,"•file.Name") M(fParent,"•file.Parent") \

View File

@ -1420,6 +1420,9 @@ static Body* file_nsGen;
#else
#define FFIOPT 0
#endif
#if !NATIVE_COMPILER
#define NATIVE_COMPILER 0
#endif
#define OPTSYS_0(X)
#define OPTSYS_1(X) X
@ -1468,7 +1471,8 @@ static Body* file_nsGen;
F("file", U"•file", tag(14,VAR_TAG)) \
F("state", U"•state", tag(15,VAR_TAG)) \
F("args", U"•args", tag(16,VAR_TAG)) \
F("listsys", U"•listsys", tag(17,VAR_TAG))
F("listsys", U"•listsys", tag(17,VAR_TAG)) \
OPTSYS(NATIVE_COMPILER)(F("compobj", U"•CompObj", tag(18,VAR_TAG)))
NFnDesc* ffiloadDesc;
B ffiload_c2(B t, B w, B x);
@ -1570,9 +1574,8 @@ B sys_c1(B t, B x) {
cr = inc(comp_currArgs);
break;
}
case 17: { // •listsys
cr = incG(curr_ns);
}
case 17: cr = incG(curr_ns); break; // •listsys
case 18: cr = incG(bi_compObj); break; // •CompObj
}
HARR_ADD(r, i, cr);
}

View File

@ -147,6 +147,12 @@ void switchComp() {
load_comp = load_comp.u==load_rtComp.u? native_comp : load_rtComp;
}
#endif
B compObj_c1(B t, B x) {
Block* block = load_compObj(x, bi_N, bi_N, NULL);
B res = evalFunBlock(block, 0);
ptr_dec(block);
return res;
}
#if FORMATTER
B load_fmt, load_repr;

View File

@ -124,9 +124,7 @@ usz addObj(B* objs, B val) { // consumes val
return IA(*objs)-1;
}
i32 nc_ty(B x) {
assert(o2iG(IGetU(x, 0))<10);
return o2iG(IGetU(x, 0)); }
i32 nc_ty(B x) { return o2iG(IGetU(x, 0)); }
B nc_generate(B p1) { // consumes
// printf("p1: "); printI(p1); putchar('\n');