aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2012-08-23 14:20:14 +0000
committerdos-reis <gdr@axiomatics.org>2012-08-23 14:20:14 +0000
commit2a353d15669a83a5b7bc0a9710f81b829667ece7 (patch)
tree0b3630c16bdae0aa2e40820492247dbcb29e6f92 /src/boot
parent9d2967000ee40227f9120c256f47fbc5f55183cd (diff)
downloadopen-axiom-2a353d15669a83a5b7bc0a9710f81b829667ece7.tar.gz
* boot/ast.boot ($ffs): New.
(genImportDeclaration): Update it. * boot/translator.boot (genModuleFinalization): Tidy. Generate code to update $dynamicForeignFunctions where necessary. (atLoadOrExecutionTime): New. * lisp/core.lisp.in (UNBIND-FOREIGN-FUNCTION-SYMBOLS): New. (saveCore): Use it. ($dynamicForeignFunctions): New. Export.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/ast.boot4
-rw-r--r--src/boot/translator.boot19
2 files changed, 14 insertions, 9 deletions
diff --git a/src/boot/ast.boot b/src/boot/ast.boot
index c898c6d8..6410b524 100644
--- a/src/boot/ast.boot
+++ b/src/boot/ast.boot
@@ -1919,6 +1919,9 @@ genCLOZUREnativeTranslation(op,s,t,op') ==
-- Finally, return the definition form
[["DEFUN", op, parms, call]]
+++ List of foreign function symbols defined in this module.
+$ffs := nil
+
++ Generate an import declaration for `op' as equivalent of the
++ foreign signature `sig'. Here, `foreign' operationally means that
++ the entity is from the C language world.
@@ -1926,6 +1929,7 @@ genImportDeclaration(op, sig) ==
sig isnt ["%Signature", op', m] => coreError '"invalid signature"
m isnt ["%Mapping", t, s] => coreError '"invalid function type"
if s ~= nil and symbol? s then s := [s]
+ $ffs := [op,:$ffs]
%hasFeature KEYWORD::GCL => genGCLnativeTranslation(op,s,t,op')
%hasFeature KEYWORD::SBCL => genSBCLnativeTranslation(op,s,t,op')
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index 5ade6ce3..bed6328c 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -53,17 +53,15 @@ reallyPrettyPrint(x,st == _*STANDARD_-OUTPUT_*) ==
writeNewline st
genModuleFinalization(stream) ==
+ $ffs = nil => nil
+ $currentModuleName = nil => coreError '"current module has no name"
+ setFFS := ["SETQ","$dynamicForeignFunctions",
+ ["append!",quote $ffs,"$dynamicForeignFunctions"]]
+ reallyPrettyPrint(atLoadOrExecutionTime setFFS,stream)
%hasFeature KEYWORD::CLISP =>
$foreignsDefsForCLisp = nil => nil
- $currentModuleName = nil =>
- coreError '"current module has no name"
- init :=
- ["EVAL-WHEN", [KEYWORD::LOAD_-TOPLEVEL,KEYWORD::EXECUTE],
- ["PROGN",
- ["MAPC",["FUNCTION", "FMAKUNBOUND"],
- quote [second d for d in $foreignsDefsForCLisp]],
- :[["EVAL",quote d] for d in $foreignsDefsForCLisp]]]
- reallyPrettyPrint(init,stream)
+ init := ["PROGN", :[["EVAL",quote d] for d in $foreignsDefsForCLisp]]
+ reallyPrettyPrint(atLoadOrExecutionTime init,stream)
nil
genOptimizeOptions stream ==
@@ -403,6 +401,9 @@ inAllContexts x ==
KEYWORD::LOAD_-TOPLEVEL,
KEYWORD::EXECUTE], x]
+atLoadOrExecutionTime x ==
+ ["EVAL-WHEN",[KEYWORD::LOAD_-TOPLEVEL,KEYWORD::EXECUTE],x]
+
exportNames ns ==
ns = nil => nil
[inAllContexts ["EXPORT",quote ns]]