mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-19 05:39:17 +02:00
67 lines
2.3 KiB
C
67 lines
2.3 KiB
C
/**
|
|
** This file was automatically generated by the Cyclone scheme compiler
|
|
**
|
|
** (c) 2014 Justin Ethier
|
|
** Version 0.0.1 (Pre-release)
|
|
**
|
|
**/
|
|
|
|
#define funcall1(cfn,a1) if (type_of(cfn) == cons_tag || prim(cfn)) { Cyc_apply(0, (closure)a1, cfn); } else { ((cfn)->fn)(1,cfn,a1);}
|
|
/* Return to continuation after checking for stack overflow. */
|
|
#define return_funcall1(cfn,a1) \
|
|
{char stack; \
|
|
if (check_overflow(&stack,stack_limit1)) { \
|
|
object buf[1]; buf[0] = a1;\
|
|
GC(cfn,buf,1); return; \
|
|
} else {funcall1((closure) (cfn),a1); return;}}
|
|
|
|
/* Evaluate an expression after checking for stack overflow. */
|
|
#define return_check1(_fn,a1) { \
|
|
char stack; \
|
|
if (check_overflow(&stack,stack_limit1)) { \
|
|
object buf[1]; buf[0] = a1; \
|
|
mclosure0(c1, _fn); \
|
|
GC(&c1, buf, 1); return; \
|
|
} else { (_fn)(1,(closure)_fn,a1); }}
|
|
|
|
#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);}
|
|
/* Return to continuation after checking for stack overflow. */
|
|
#define return_funcall2(cfn,a1,a2) \
|
|
{char stack; \
|
|
if (check_overflow(&stack,stack_limit1)) { \
|
|
object buf[2]; buf[0] = a1;buf[1] = a2;\
|
|
GC(cfn,buf,2); return; \
|
|
} else {funcall2((closure) (cfn),a1,a2); return;}}
|
|
|
|
/* Evaluate an expression after checking for stack overflow. */
|
|
#define return_check2(_fn,a1,a2) { \
|
|
char stack; \
|
|
if (check_overflow(&stack,stack_limit1)) { \
|
|
object buf[2]; buf[0] = a1;buf[1] = a2; \
|
|
mclosure0(c1, _fn); \
|
|
GC(&c1, buf, 2); return; \
|
|
} else { (_fn)(2,(closure)_fn,a1,a2); }}
|
|
|
|
#include "cyclone.h"
|
|
object __glo_lib2_91hello = nil;
|
|
#include "runtime.h"
|
|
|
|
void c_libslib2_entry_pt(argc, cont) int argc; closure cont; {
|
|
printf("Initializing lib2\n");
|
|
|
|
add_global((object *) &__glo_lib2_91hello);
|
|
make_string(c_733, "Hello from library #2");
|
|
__glo_lib2_91hello = &c_733;
|
|
|
|
make_cvar(cvar_737, (object *)&__glo_lib2_91hello);make_cons(pair_738, find_or_add_symbol("lib2-hello"), &cvar_737);
|
|
make_cons(c_739, &pair_738,Cyc_global_variables);
|
|
Cyc_global_variables = &c_739;
|
|
|
|
cont = ((closure1_type *)cont)->elt1;
|
|
((cont)->fn)(0, cont);
|
|
//if (((closure)cont)->tag == closure1_tag) {
|
|
// ((cont)->fn)(1, ((closure1_type *)cont)->elt1);
|
|
//} else {
|
|
// ((cont)->fn)(0, cont);
|
|
//}
|
|
}
|