kbool_t Konoha_Eval(KonohaContext* kctx, const char *script, kfileline_t uline) { KBeginKonohaContext(); if(verbose_sugar) { DUMP_P("\n>>>----\n'%s'\n------\n", script); } kmodsugar->h.setupModuleContext(kctx, (KonohaModule *)kmodsugar, 0/*lazy*/); kbool_t res = (kNameSpace_Eval(kctx, KNULL(NameSpace), script, uline, NULL/*trace*/) == K_CONTINUE); // FIXME KEndKonohaContext(); return res; }
KONOHA_EXPORT(kbool_t) Konoha_Eval(KonohaContext* kctx, const char *script, kfileline_t uline) { KBeginKonohaContext(); if(verbose_sugar) { DUMP_P("\n>>>----\n'%s'\n------\n", script); } KPARSERM->h.setupModelContext(kctx, (KRuntimeModel *)KPARSERM, 0/*lazy*/); kbool_t res = (kNameSpace_Eval(kctx, KNULL(NameSpace), script, uline, NULL/*trace*/) == K_CONTINUE); // FIXME KEndKonohaContext(); return res; }
static void dumpOPCODE(KonohaContext *kctx, VirtualMachineInstruction *c, VirtualMachineInstruction *pc_start) { size_t i, size = OPDATA[c->opcode].size; const kushort_t *vmt = OPDATA[c->opcode].types; if(pc_start == NULL) { DUMP_P("[%p:%d]\t%s(%d)", c, c->line, T_opcode(c->opcode), (int)c->opcode); } else { DUMP_P("[L%d:%d]\t%s(%d)", (int)(c - pc_start), c->line, T_opcode(c->opcode), (int)c->opcode); } for(i = 0; i < size; i++) { DUMP_P(" "); switch(vmt[i]) { case VMT_VOID: break; case VMT_ADDR: if(pc_start == NULL) { DUMP_P("%p", c->p[i]); } else { DUMP_P("L%d", (int)((VirtualMachineInstruction*)c->p[i] - pc_start)); } break; case VMT_R: DUMP_P("sfp[%d,r=%d]", (int)c->data[i]/2, (int)c->data[i]); break; case VMT_U: DUMP_P("u%lu", c->data[i]); break; case VMT_I: case VMT_INT: DUMP_P("i%ld", c->data[i]); break; case VMT_F: DUMP_P("function(%p)", c->p[i]); break; case VMT_CID: DUMP_P("CT(%s)", CT_t(c->ct[i])); break; case VMT_CO: DUMP_P("CT(%s)", CT_t(O_ct(c->o[i]))); break; }/*switch*/ } DUMP_P("\n"); }