This commit is contained in:
Justin Ethier 2015-04-29 13:39:06 -04:00
parent 0b13361cc3
commit 4ec321882b
2 changed files with 233 additions and 0 deletions

View file

@ -0,0 +1,134 @@
/**
** This file was automatically generated by the Cyclone scheme compiler
**
** (c) 2014 Justin Ethier
** Version 0.0.1 (Pre-release)
**
**/
#define DECLARE_GLOBALS \
static volatile object __glo_lib2_91hello = nil; \
static volatile object __glo__85exception_91handler_91stack_85 = nil; \
static volatile object __glo_call_95cc = nil;
#define GC_GLOBALS \
{ \
transp(__glo_lib2_91hello); \
transp(__glo__85exception_91handler_91stack_85); \
transp(__glo_call_95cc);}
#define funcall0(cfn) ((cfn)->fn)(0,cfn)
/* Return to continuation after checking for stack overflow. */
#define return_funcall0(cfn) \
{char stack; \
if (check_overflow(&stack,stack_limit1)) { \
object buf[0]; \
GC(cfn,buf,0); return; \
} else {funcall0((closure) (cfn)); return;}}
/* Evaluate an expression after checking for stack overflow. */
#define return_check0(_fn) { \
char stack; \
if (check_overflow(&stack,stack_limit1)) { \
object buf[0]; \
mclosure0(c1, _fn); \
GC(&c1, buf, 0); return; \
} else { (_fn)(0,(closure)_fn); }}
#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 "runtime.h"
static void __lambda_4(int argc, closure _) ;
static void __lambda_3(int argc, closure _,object r_736) ;
static void __lambda_2(int argc, closure _,object r_735) ;
static void __lambda_1(int argc, closure _,object k, object f) ;
static void __lambda_0(int argc, object self_737, object _191, object result) ;
static void __lambda_4(int argc, closure _) {
return_check1(__lambda_3,nil);;
}
static void __lambda_3(int argc, closure _,object r_736) {
return_check1(__lambda_2,global_set(__glo__85exception_91handler_91stack_85, r_736));;
}
static void __lambda_2(int argc, closure _,object r_735) {
__halt(Cyc_write(__glo_lib2_91hello));
}
static void __lambda_1(int argc, closure _,object k, object f) {
closureN_type c_7310;
c_7310.tag = closureN_tag;
c_7310.fn = __lambda_0;
c_7310.num_elt = 1;
c_7310.elts = (object *)alloca(sizeof(object) * 1);
c_7310.elts[0] = k;
return_funcall2( f, k, &c_7310);;
}
static void __lambda_0(int argc, object self_737, object _191, object result) {
return_funcall1( ((closureN)self_737)->elts[0], result);;
}
static void c_entry_pt(argc, env,cont) int argc; closure env,cont; {
mclosure0(c_738, (function_type)__lambda_1);
__glo_call_95cc = &c_738;
make_string(c_7313, "Hello from library #2");
__glo_lib2_91hello = &c_7313;
__glo__85exception_91handler_91stack_85 = boolean_f;
make_cvar(cvar_7323, (object *)&__glo_lib2_91hello);make_cons(pair_7324, find_or_add_symbol("lib2-hello"), &cvar_7323);
make_cvar(cvar_7325, (object *)&__glo__85exception_91handler_91stack_85);make_cons(pair_7326, find_or_add_symbol("*exception-handler-stack*"), &cvar_7325);
make_cvar(cvar_7327, (object *)&__glo_call_95cc);make_cons(pair_7328, find_or_add_symbol("call/cc"), &cvar_7327);
make_cons(c_7331, &pair_7324,nil);
make_cons(c_7330, &pair_7326, &c_7331);
make_cons(c_7329, &pair_7328, &c_7330);
Cyc_global_variables = &c_7329;
return_check0(__lambda_4);
}
main(int argc,char **argv)
{long stack_size = long_arg(argc,argv,"-s",STACK_SIZE);
long heap_size = long_arg(argc,argv,"-h",HEAP_SIZE);
global_stack_size = stack_size;
global_heap_size = heap_size;
main_main(stack_size,heap_size,(char *) &stack_size);
return 0;}

View file

@ -0,0 +1,99 @@
/**
** This file was automatically generated by the Cyclone scheme compiler
**
** (c) 2014 Justin Ethier
** Version 0.0.1 (Pre-release)
**
**/
#define DECLARE_GLOBALS \
static volatile object __glo__85exception_91handler_91stack_85 = nil; \
static volatile object __glo_call_95cc = nil;
#define GC_GLOBALS \
{ \
transp(__glo__85exception_91handler_91stack_85); \
transp(__glo_call_95cc);}
#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 "runtime.h"
static void __lambda_2(int argc, closure _,object r_733) ;
static void __lambda_1(int argc, closure _,object k, object f) ;
static void __lambda_0(int argc, object self_734, object _191, object result) ;
static void __lambda_2(int argc, closure _,object r_733) {
__halt(global_set(__glo__85exception_91handler_91stack_85, r_733));
}
static void __lambda_1(int argc, closure _,object k, object f) {
closureN_type c_737;
c_737.tag = closureN_tag;
c_737.fn = __lambda_0;
c_737.num_elt = 1;
c_737.elts = (object *)alloca(sizeof(object) * 1);
c_737.elts[0] = k;
return_funcall2( f, k, &c_737);;
}
static void __lambda_0(int argc, object self_734, object _191, object result) {
return_funcall1( ((closureN)self_734)->elts[0], result);;
}
static void c_entry_pt(argc, env,cont) int argc; closure env,cont; {
mclosure0(c_735, (function_type)__lambda_1);
__glo_call_95cc = &c_735;
__glo__85exception_91handler_91stack_85 = boolean_f;
make_cvar(cvar_7315, (object *)&__glo__85exception_91handler_91stack_85);make_cons(pair_7316, find_or_add_symbol("*exception-handler-stack*"), &cvar_7315);
make_cvar(cvar_7317, (object *)&__glo_call_95cc);make_cons(pair_7318, find_or_add_symbol("call/cc"), &cvar_7317);
make_cons(c_7320, &pair_7316,nil);
make_cons(c_7319, &pair_7318, &c_7320);
Cyc_global_variables = &c_7319;
return_check1(__lambda_2,nil);
}
main(int argc,char **argv)
{long stack_size = long_arg(argc,argv,"-s",STACK_SIZE);
long heap_size = long_arg(argc,argv,"-h",HEAP_SIZE);
global_stack_size = stack_size;
global_heap_size = heap_size;
main_main(stack_size,heap_size,(char *) &stack_size);
return 0;}