From 695131a4d8debb3590895ea7c435e70c3e74669b Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Fri, 22 May 2015 21:46:20 -0400 Subject: [PATCH] First-cut of fixes to make symbols work with libraries --- cgen.scm | 9 ++++++++- cyclone.h | 3 +-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cgen.scm b/cgen.scm index 318c92d3..6b0e0f45 100644 --- a/cgen.scm +++ b/cgen.scm @@ -946,7 +946,7 @@ (if program? (emit "#include \"runtime-main.h\"")) - ;; Emit symbols + ;; Emit symbol definitions (for-each (lambda (sym) (emit* @@ -986,6 +986,13 @@ ; DEBUG (emit (string-append "printf(\"init " (lib:name->string lib-name) "\\n\");")) )) + ;; Initialize symbols + (for-each + (lambda (sym) + (emit* + " quote_" (mangle sym) " = find_or_add_symbol(\"" (symbol->string sym) "\");")) + *symbols*) + ;; Initialize global table (for-each (lambda (global) diff --git a/cyclone.h b/cyclone.h index ae158c3e..18273276 100644 --- a/cyclone.h +++ b/cyclone.h @@ -145,8 +145,7 @@ typedef symbol_type *symbol; #define symbol_plist(x) (((symbol_type *) x)->plist) #define defsymbol(name,pname) \ -static symbol_type name##_symbol = {symbol_tag, #pname, nil}; \ -static const object quote_##name = &name##_symbol +static object quote_##name = nil; /* Define numeric types */ typedef struct {tag_type tag; int value;} integer_type;