summaryrefslogtreecommitdiff
path: root/alien.lisp
diff options
context:
space:
mode:
authorJuan Manuel Tomás <jtomas1815@gmail.com>2023-01-16 00:30:57 -0300
committerJuan Manuel Tomás <jtomas1815@gmail.com>2023-01-16 00:30:57 -0300
commita8b56704b52488f2865387d8cded8e5f13cdf919 (patch)
treeb1fec64d8727e9f4692246702de3767435f7eaae /alien.lisp
parent42014cb6d5706f80d47ac2dbab7353ce832ee1e1 (diff)
downloadutils-a8b56704b52488f2865387d8cded8e5f13cdf919.tar.gz
utils-a8b56704b52488f2865387d8cded8e5f13cdf919.zip
Add alien call similar to what chezscheme has
Diffstat (limited to 'alien.lisp')
-rw-r--r--alien.lisp12
1 files changed, 12 insertions, 0 deletions
diff --git a/alien.lisp b/alien.lisp
new file mode 100644
index 0000000..3451dc9
--- /dev/null
+++ b/alien.lisp
@@ -0,0 +1,12 @@
+(in-package #:alien)
+
+(defmacro call (fname rtype &rest types-n-values)
+ (let ((tlist (queue:new))
+ (vlist (queue:new)))
+ (dolist (item types-n-values)
+ (queue:add tlist (first item))
+ (queue:add vlist (second item)))
+ `(alien-funcall (extern-alien ,fname
+ (function ,rtype
+ ,@(queue:to-list tlist)))
+ ,@(queue:to-list vlist))))