aboutsummaryrefslogtreecommitdiff
path: root/src/interp/lisp-backend.boot
diff options
context:
space:
mode:
Diffstat (limited to 'src/interp/lisp-backend.boot')
-rw-r--r--src/interp/lisp-backend.boot56
1 files changed, 44 insertions, 12 deletions
diff --git a/src/interp/lisp-backend.boot b/src/interp/lisp-backend.boot
index 008ed3d1..a98ef3be 100644
--- a/src/interp/lisp-backend.boot
+++ b/src/interp/lisp-backend.boot
@@ -234,15 +234,6 @@ expandIlt ['%ilt,x,y] ==
expandIgt ['%igt,x,y] ==
expandIlt ['%ilt,y,x]
-expandBitand ['%bitand,x,y] ==
- ['BOOLE,'BOOLE_-AND,expandToVMForm x,expandToVMForm y]
-
-expandBitior ['%bitior,x,y] ==
- ['BOOLE,'BOOLE_-IOR,expandToVMForm x,expandToVMForm y]
-
-expandBitnot ['%bitnot,x] ==
- ['LOGNOT,expandToVMForm x]
-
-- Floating point support
expandFbase ['%fbase] ==
@@ -337,6 +328,24 @@ expandMakebitvec ['%makebitvec,x,y] ==
KEYWORD::ELEMENT_-TYPE,quoteForm '%Bit,
KEYWORD::INITIAL_-ELEMENT,expandToVMForm y]
+--% complex number conversions
+--% An OpenAxiom complex number is a pair (real and imaginary parts.)
+
+-- convert an OpenAxiom complex number to a Lisp complex number
+expandVal2z ['%val2z,x] ==
+ cons? x =>
+ g := gensym()
+ expandToVMForm ['%bind,[[g,x]],['%zlit,['%head,g],['%tail,g]]]
+ expandToVMForm ['%zlit,['%head,x],['%tail,x]]
+
+-- convert a Lisp complex number to an OpenAxiom complex number
+expandZ2val ['%z2val,x] ==
+ cons? x =>
+ g := gensym()
+ expandToVMForm ['%bind,[[g,x]],['%makepair,['%zreal,g],['%zimag,g]]]
+ expandToVMForm ['%makepair,['%zreal,x],['%zimag,x]]
+
+
-- Local variable bindings
expandBind ['%bind,inits,:body] ==
body := expandToVMForm body
@@ -445,6 +454,10 @@ for x in [
['%iquo, :'TRUNCATE],
['%ipow, :'EXPT],
['%isub, :"-"],
+ ['%bitand, :'LOGAND],
+ ['%bitior, :'LOGIOR],
+ ['%bitxor, :'LOGXOR],
+ ['%bitnot, :'LOGNOT],
-- unary float operations.
['%fabs, :'ABS],
@@ -478,6 +491,25 @@ for x in [
['%fasinh, :'ASINH],
['%facsch, :'ACSCH],
+ -- complex number operations
+ ['%zlit, :'COMPLEX],
+ ['%zreal, :'REALPART],
+ ['%zimag, :'IMAGPART],
+ ['%zexp, :'EXP],
+ ['%zlog, :'LOG],
+ ['%zsin, :'SIN],
+ ['%zcos, :'COS],
+ ['%ztan, :'TAN],
+ ['%zasin, :'ASIN],
+ ['%zacos, :'ACOS],
+ ['%zatan, :'ATAN],
+ ['%zsinh, :'SINH],
+ ['%zcosh, :'COSH],
+ ['%ztanh, :'TANH],
+ ['%zasinh, :'ASINH],
+ ['%zacosh, :'ACOSH],
+ ['%zatanh, :'ATANH],
+
-- string operations
['%f2s, :'DFLOAT_-FORMAT_-GENERAL],
@@ -546,9 +578,6 @@ for x in [
['%ilt, :function expandIlt],
['%ineg, :function expandIneg],
['%idivide, :function expandIdivide],
- ['%bitand, :function expandBitand],
- ['%bitior, :function expandBitior],
- ['%bitnot, :function expandBitnot],
['%i2f, :function expandI2f],
['%fbase, :function expandFbase],
@@ -561,6 +590,9 @@ for x in [
['%fprec, :function expandFprec],
['%fcstpi, :function expandFcstpi],
+ ['%z2val, :function expandZ2val],
+ ['%val2z, :function expandVal2z],
+
['%streq, :function expandStreq],
['%strlt, :function expandStrlt],
['%strstc, :function expandStrstc],