Set Cyc_global_variables correctly in lib2

This commit is contained in:
Justin Ethier 2015-05-18 22:38:48 -04:00
parent 2e16c27b42
commit 1eb8a22995

View file

@ -977,7 +977,7 @@
(emit "static void c_entry_pt(argc, env,cont) int argc; closure env,cont; { ")) (emit "static void c_entry_pt(argc, env,cont) int argc; closure env,cont; { "))
(else (else
(emit (string-append "void c_" (lib:name->string lib-name) "_entry_pt(argc, env,cont) int argc; closure env,cont; { ")) (emit (string-append "void c_" (lib:name->string lib-name) "_entry_pt(argc, env,cont) int argc; closure env,cont; { "))
(emit (string-append "printf(\"init " (lib:name->string lib-name) "\\n\");")) ;DEBUG: (emit (string-append "printf(\"init " (lib:name->string lib-name) "\\n\");"))
)) ))
;; Initialize global table ;; Initialize global table
@ -1038,6 +1038,8 @@
(emits str)) (emits str))
code)) code))
((null? (cdr ps)) ((null? (cdr ps))
(if (not head-pair)
(set! head-pair (car cs)))
(loop (cons (string-append "make_cons(" (car cs) ", &" (car ps) ",Cyc_global_variables);\n") code) (loop (cons (string-append "make_cons(" (car cs) ", &" (car ps) ",Cyc_global_variables);\n") code)
(cdr ps) (cdr ps)
(cdr cs))) (cdr cs)))
@ -1048,7 +1050,7 @@
(cdr ps) (cdr ps)
(cdr cs))))) (cdr cs)))))
(if head-pair (if head-pair
(emits (emit
(string-append "Cyc_global_variables = &" head-pair ";")))) (string-append "Cyc_global_variables = &" head-pair ";"))))
(cond (cond
@ -1076,7 +1078,7 @@
(string-append "(" this-clo ".fn)(0, &" this-clo ", &" this-clo ");")) (string-append "(" this-clo ".fn)(0, &" this-clo ", &" this-clo ");"))
(emit "}") (emit "}")
(emit "static void c_entry_pt_first_lambda(int argc, closure env, closure cont) {") (emit "static void c_entry_pt_first_lambda(int argc, closure env, closure cont) {")
(emit (string-append "printf(\"init first lambda\\n\");")) ;DEBUG: (emit (string-append "printf(\"init first lambda\\n\");"))
(emit compiled-program))) (emit compiled-program)))
(else (else
;; Do not use funcall1 macro as it might not have been defined ;; Do not use funcall1 macro as it might not have been defined