From 651f6b0c7afd884b5930b22cadf5afa9062dce22 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Mon, 2 Mar 2015 15:20:38 -0500 Subject: [PATCH] WIP --- runtime.h | 21 +++++++++++---------- test.scm | 7 ++++++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/runtime.h b/runtime.h index d2e40af9..d04781f4 100644 --- a/runtime.h +++ b/runtime.h @@ -1480,16 +1480,17 @@ 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))) { - //printf("TODO: apply compound proc\n"); - Cyc_display(func); - //exit(1); - ((closure)__glo_eval)->fn(2, __glo_eval, cont, func); - } 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("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); +// } // TODO: #endif default: diff --git a/test.scm b/test.scm index c9717e9e..a2ec710e 100644 --- a/test.scm +++ b/test.scm @@ -1,4 +1,7 @@ ;; Temporary testing, delete this once it works +(define (mywrite x) + (write x)) + (define (call fn a) (fn a)) @@ -7,4 +10,6 @@ ;; Demonstrate sending an interpreted function to compiled code ;; I think in order for this to work, the compiled code would have to ;; detect an interpreted proc, and use eval to execute it -(eval '(call (lambda (x) x))) +;(eval '(call (lambda (x) x) (display (+ 1 1)))) +;(eval '(call write 1)) +(eval '(call mywrite 1))