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){
common_type buf;
printf("DEBUG apply: ");
Cyc_display(args);
printf("\n");
if (!is_object_type(func)) {
printf("Call of non-procedure: ");
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,
// 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);}
// case cons_tag:
// if (!nullp(func) && eq(quote_Cyc_191procedure, car(func))) {
// make_cons(c, func, args);
// //printf("TODO: apply compound proc\n");
// Cyc_display(&c);
// //exit(1);
// ((closure)__glo_eval)->fn(2, __glo_eval, cont, &c);
// } else {
// printf("Unable to evaluate list\n");
// exit(1);
// }
case cons_tag:
if (!nullp(func) && eq(quote_Cyc_191procedure, car(func))) {
make_cons(c, func, args);
printf("DEBUG apply cons: ");
Cyc_display(&c);
printf("\n");
//printf("TODO: apply compound proc\n");
//exit(1);
((closure)__glo_eval)->fn(3, __glo_eval, cont, &c, nil);
} else {
printf("Unable to evaluate list\n");
exit(1);
}
// TODO: #endif
default: