aboutsummaryrefslogtreecommitdiff
path: root/module/c/eval2.scm
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-07-03 12:36:35 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-07-07 21:31:32 +0200
commitcba504b509cd59f376063f6e590362b197147a2c (patch)
tree954e90b0053ab4c0247ef242607654c862d02e48 /module/c/eval2.scm
parentMerge branch 'new-object-system' into c-parser (diff)
downloadcalp-cba504b509cd59f376063f6e590362b197147a2c.tar.gz
calp-cba504b509cd59f376063f6e590362b197147a2c.tar.xz
Major work.
Diffstat (limited to 'module/c/eval2.scm')
-rw-r--r--module/c/eval2.scm20
1 files changed, 20 insertions, 0 deletions
diff --git a/module/c/eval2.scm b/module/c/eval2.scm
new file mode 100644
index 00000000..d58f20bf
--- /dev/null
+++ b/module/c/eval2.scm
@@ -0,0 +1,20 @@
+(define-module (c eval2)
+ :use-module ((hnh util) :select (->))
+ :export (C-TRUE
+ C-FALSE
+ boolean->c-boolean
+ c-boolean->boolean
+ c-not))
+
+
+(define C-TRUE 1)
+(define C-FALSE 0)
+
+(define (boolean->c-boolean bool)
+ (if bool C-TRUE C-FALSE))
+
+(define (c-boolean->boolean bool)
+ (not (zero? bool)))
+
+(define (c-not b)
+ (-> b c-boolean->boolean not boolean->c-boolean))