diff --git a/include/cyclone/runtime.h b/include/cyclone/runtime.h index 68152e63..aee80aee 100644 --- a/include/cyclone/runtime.h +++ b/include/cyclone/runtime.h @@ -401,7 +401,15 @@ extern const object primitive_Cyc_91display; extern const object primitive_call_95cc; /* -------------------------------------------- */ -/* Globals that are needed by the runtime */ +/** Globals that are needed by the runtime + * What's going on here is the globals are defined by a module, but + * are also used by the runtime. At least for now, these macros are + * used to point everybody to the objects, which are used by both + * those libraries and this module. + * + * The assumption for now is that a program that does not include + * the necessary libray would never use the corresponding function. + */ extern object Cyc_glo_eval; extern object Cyc_glo_eval_from_c; extern object Cyc_glo_call_cc; diff --git a/runtime.c b/runtime.c index 338b5366..191f3c64 100644 --- a/runtime.c +++ b/runtime.c @@ -2397,6 +2397,15 @@ object apply(void *data, object cont, object func, object args){ case closure0_tag: case closure1_tag: case closureN_tag: + if (func == Cyc_glo_call_cc) { + make_cons(c, cont, args); +//Cyc_display(args, stderr); +// args = &c; +//Cyc_display(&c, stderr); + count = Cyc_length(data, args); +// Cyc_check_num_args(data, "", ((closure)func)->num_args, args); + dispatch(data, obj_obj2int(count), ((closure)func)->fn, func, cont, args); + } count = Cyc_length(data, args); // TODO: validate number of args provided: Cyc_check_num_args(data, "", ((closure)func)->num_args, args); // TODO: could be more efficient, eg: cyc_length(args) is called twice.