WIP - exec lambdas from interpreter

This commit is contained in:
Justin Ethier 2015-03-02 22:51:18 -05:00
parent a2fe40b348
commit c2dfdf39d5

View file

@ -1447,6 +1447,9 @@ static void dispatch_va(int argc, function_type_va func, object clo, object cont
static object apply(object cont, object func, object args){ static object apply(object cont, object func, object args){
common_type buf; common_type buf;
printf("DEBUG apply: ");
Cyc_display(args);
printf("\n");
if (!is_object_type(func)) { if (!is_object_type(func)) {
printf("Call of non-procedure: "); printf("Call of non-procedure: ");
Cyc_display(func); Cyc_display(func);
@ -1480,17 +1483,19 @@ static object apply(object cont, object func, object args){
// TODO: also, this only works if the generated code knows to call apply, want to do this, // TODO: also, this only works if the generated code knows to call apply, want to do this,
// but again only if CYC_EVAL is defined: // but again only if CYC_EVAL is defined:
//#define funcall2(cfn,a1,a2) if (type_of(cfn) == cons_tag || prim(cfn)) { Cyc_apply(1, (closure)a1, cfn,a2); } else { ((cfn)->fn)(2,cfn,a1,a2);} //#define funcall2(cfn,a1,a2) if (type_of(cfn) == cons_tag || prim(cfn)) { Cyc_apply(1, (closure)a1, cfn,a2); } else { ((cfn)->fn)(2,cfn,a1,a2);}
// case cons_tag: case cons_tag:
// if (!nullp(func) && eq(quote_Cyc_191procedure, car(func))) { if (!nullp(func) && eq(quote_Cyc_191procedure, car(func))) {
// make_cons(c, func, args); make_cons(c, func, args);
// //printf("TODO: apply compound proc\n"); printf("DEBUG apply cons: ");
// Cyc_display(&c); Cyc_display(&c);
// //exit(1); printf("\n");
// ((closure)__glo_eval)->fn(2, __glo_eval, cont, &c); //printf("TODO: apply compound proc\n");
// } else { //exit(1);
// printf("Unable to evaluate list\n"); ((closure)__glo_eval)->fn(3, __glo_eval, cont, &c, nil);
// exit(1); } else {
// } printf("Unable to evaluate list\n");
exit(1);
}
// TODO: #endif // TODO: #endif
default: default: