aboutsummaryrefslogtreecommitdiff
path: root/src/boot/translator.boot.pamphlet
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-01-08 04:28:41 +0000
committerdos-reis <gdr@axiomatics.org>2008-01-08 04:28:41 +0000
commit8d42d860e9f2fa6b71cfc1840134ad3b2a0a5dc9 (patch)
tree9337472021a5bf88da7f8edb1981684b6725b358 /src/boot/translator.boot.pamphlet
parent2ccae4d36c4bad637025e668b550c1e72d738193 (diff)
downloadopen-axiom-8d42d860e9f2fa6b71cfc1840134ad3b2a0a5dc9.tar.gz
Automate FFI at Boot level
Diffstat (limited to 'src/boot/translator.boot.pamphlet')
-rw-r--r--src/boot/translator.boot.pamphlet16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/boot/translator.boot.pamphlet b/src/boot/translator.boot.pamphlet
index 50e146aa..c66ba1f2 100644
--- a/src/boot/translator.boot.pamphlet
+++ b/src/boot/translator.boot.pamphlet
@@ -375,7 +375,18 @@ shoeConsoleTrees s ==
s:=CDR s
shoeAddComment l== CONCAT('"; ",CAR l)
-
+
+++ 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.
+genImportDeclaration(op, sig) ==
+ sig isnt ["Signature", op', m] => coreError '"invalid signature"
+ m isnt ["Mapping", t, s] => coreError '"invalid function type"
+ %hasFeature KEYWORD::GCL =>
+ if SYMBOLP s then s := [s]
+ ["DEFENTRY", op, s, [t, SYMBOL_-NAME op']]
+ fatalError '"import declaration not implemented for this Lisp"
+
shoeOutParse stream ==
$inputStream :local:= stream
$stack:local :=nil
@@ -415,6 +426,9 @@ bpOutItem()==
Import(m) =>
bpPush [["IMPORT-MODULE", m]]
+ ImportSignature(x, sig) =>
+ bpPush [genImportDeclaration(x, sig)]
+
TypeAlias(t, args, rhs) =>
bpPush [["DEFTYPE", t, args, ["QUOTE", rhs]]]