mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-23 20:15:05 +02:00
Use CYC_EVAL to selectively include eval code
This commit is contained in:
parent
e6aea0c388
commit
4dff6070ce
2 changed files with 13 additions and 14 deletions
3
cgen.scm
3
cgen.scm
|
@ -949,6 +949,9 @@
|
|||
(let ((compiled-program
|
||||
(apply string-append
|
||||
(map c-compile-program input-program))))
|
||||
(if (member 'eval globals)
|
||||
(emit "#define CYC_EVAL"))
|
||||
|
||||
(emit-c-macros)
|
||||
(emit "#include \"runtime.h\"")
|
||||
|
||||
|
|
24
runtime.h
24
runtime.h
|
@ -1485,26 +1485,22 @@ static object apply(object cont, object func, object args){
|
|||
}
|
||||
|
||||
break;
|
||||
// TODO: if #define CYC_EVAL
|
||||
// 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);}
|
||||
|
||||
#ifdef CYC_EVAL
|
||||
case cons_tag:
|
||||
{
|
||||
make_cons(c, func, args);
|
||||
|
||||
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");
|
||||
printf("Unable to evaluate: ");
|
||||
Cyc_display(&c);
|
||||
printf("\n");
|
||||
exit(1);
|
||||
}
|
||||
// TODO: #endif
|
||||
}
|
||||
#endif /* CYC_EVAL */
|
||||
|
||||
default:
|
||||
printf("Invalid object type %ld\n", type_of(func));
|
||||
|
|
Loading…
Add table
Reference in a new issue