From da54b226e47650291a13b4e912adc708436b6e04 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Mon, 18 May 2015 11:29:29 -0400 Subject: [PATCH] WIP --- examples/hello-library/int-test/hello.c | 6 +++++- examples/hello-library/int-test/libs/lib1.c | 11 +++++++++-- examples/hello-library/int-test/libs/lib2.c | 10 ++++++++-- examples/hello-library/int-test/scheme/base.c | 14 ++++++++++++-- 4 files changed, 34 insertions(+), 7 deletions(-) diff --git a/examples/hello-library/int-test/hello.c b/examples/hello-library/int-test/hello.c index 76015e9b..50a5af4d 100644 --- a/examples/hello-library/int-test/hello.c +++ b/examples/hello-library/int-test/hello.c @@ -115,6 +115,7 @@ static void __lambda_1(int argc, closure _,object r_732) ; static void __lambda_0(int argc, closure _,object r_733) ; static void __lambda_3(int argc, closure _) { + printf("Done with library inits\n"); make_int(c_7318, 0); return_check1(__lambda_2,&c_7318);; } @@ -133,6 +134,9 @@ static void __lambda_0(int argc, closure _,object r_733) { __halt(Cyc_write(&c_7312)); } +extern void c_libslib2_entry_pt(int argc, closure cont); +extern void c_libslib1_entry_pt(int argc, closure cont); +extern void c_schemebase_entry_pt(int argc, closure cont); static void c_entry_pt(argc, env,cont) int argc; closure env,cont; { // TODO: should do these explicitly instead of using macros, in case they are not generated mclosure0(c_done, __lambda_3); @@ -142,7 +146,7 @@ static void c_entry_pt(argc, env,cont) int argc; closure env,cont; { // TODO: need to change each entry point to accept above closures // will need to check in each one for closure1 or closure0, I think??? - funcall0(c_base); + funcall0(&c_base); // TODO: these can't return, they need to call into each other as a continuation chain //c_schemebase_entry_pt(argc, env,cont); diff --git a/examples/hello-library/int-test/libs/lib1.c b/examples/hello-library/int-test/libs/lib1.c index 201b93fc..91748085 100644 --- a/examples/hello-library/int-test/libs/lib1.c +++ b/examples/hello-library/int-test/libs/lib1.c @@ -118,7 +118,8 @@ void __lambda_0(int argc, closure _,object k_735) { return_funcall1( k_735, Cyc_write(__glo_lib2_91hello));; } -void c_libslib1_entry_pt(argc, env,cont) int argc; closure env,cont; { +void c_libslib1_entry_pt(argc, cont) int argc; closure cont; { + printf("Initializing lib1\n"); add_global((object *) &__glo_lib1_91hello); add_global((object *) &__glo_internal_91func); @@ -136,4 +137,10 @@ void c_libslib1_entry_pt(argc, env,cont) int argc; closure env,cont; { make_cons(c_7333, &pair_7326,Cyc_global_variables); make_cons(c_7332, &pair_7328, &c_7333); make_cons(c_7331, &pair_7330, &c_7332); -Cyc_global_variables = &c_7331;} +Cyc_global_variables = &c_7331; + +if (((closure)cont)->tag == closure1_tag) { + ((cont)->fn)(1, ((closure1_type *)cont)->elt1); +} else { + ((cont)->fn)(0, cont); +}} diff --git a/examples/hello-library/int-test/libs/lib2.c b/examples/hello-library/int-test/libs/lib2.c index 3599c844..65c84f4f 100644 --- a/examples/hello-library/int-test/libs/lib2.c +++ b/examples/hello-library/int-test/libs/lib2.c @@ -46,7 +46,8 @@ object __glo_lib2_91hello = nil; #include "runtime.h" -void c_libslib2_entry_pt(argc, env,cont) int argc; closure env,cont; { +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"); @@ -55,4 +56,9 @@ void c_libslib2_entry_pt(argc, env,cont) int argc; closure env,cont; { 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; -} + +if (((closure)cont)->tag == closure1_tag) { + ((cont)->fn)(1, ((closure1_type *)cont)->elt1); +} else { + ((cont)->fn)(0, cont); +}} diff --git a/examples/hello-library/int-test/scheme/base.c b/examples/hello-library/int-test/scheme/base.c index ed79592a..f9e524e9 100644 --- a/examples/hello-library/int-test/scheme/base.c +++ b/examples/hello-library/int-test/scheme/base.c @@ -2641,7 +2641,8 @@ static void __lambda_0(int argc, object self_73378, object _191, object result) return_funcall1( ((closureN)self_73378)->elts[0], result);; } -void c_schemebase_entry_pt(argc, env,cont) int argc; closure env,cont; { +void c_schemebase_entry_pt(argc, cont) int argc; closure cont; { + printf("Initializing base\n"); add_global((object *) &__glo_Cyc_91remove_91exception_91handler); add_global((object *) &__glo_Cyc_91add_91exception_91handler); @@ -2891,4 +2892,13 @@ make_cons(c_731473, &pair_731463, &c_731474); make_cons(c_731472, &pair_731465, &c_731473); make_cons(c_731471, &pair_731467, &c_731472); make_cons(c_731470, &pair_731469, &c_731471); -Cyc_global_variables = &c_731470;} +Cyc_global_variables = &c_731470; + +if (((closure)cont)->tag == closure1_tag) { + ((cont)->fn)(1, ((closure1_type *)cont)->elt1); +} else { + ((cont)->fn)(0, cont); +} + + +}