summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisplib.c2
-rw-r--r--share/txr/stdlib/ffi.tl3
-rw-r--r--txr.115
3 files changed, 19 insertions, 1 deletions
diff --git a/lisplib.c b/lisplib.c
index 18ade143..39159edd 100644
--- a/lisplib.c
+++ b/lisplib.c
@@ -524,7 +524,7 @@ static val ffi_set_entries(val dlt, val fun)
{
val name[] = {
lit("with-dyn-lib"), lit("deffi"), lit("deffi-type"), lit("deffi-cb"),
- lit("typedef"), lit("sizeof"),
+ lit("typedef"), lit("sizeof"), lit("ffi"),
nil
};
set_dlt_entries(dlt, name, fun);
diff --git a/share/txr/stdlib/ffi.tl b/share/txr/stdlib/ffi.tl
index b2a14787..902605fa 100644
--- a/share/txr/stdlib/ffi.tl
+++ b/share/txr/stdlib/ffi.tl
@@ -98,3 +98,6 @@
(defmacro sizeof (type)
(ffi-size (ffi-type-compile type)))
+
+(defmacro ffi (type)
+ ^(ffi-type-compile ',type))
diff --git a/txr.1 b/txr.1
index 0202fa9f..83c20001 100644
--- a/txr.1
+++ b/txr.1
@@ -54473,6 +54473,21 @@ macro expander. That is to say, the macro expands
to that integer, such that there is no run-time
computation.
+.coNP Macro @ ffi
+.synb
+.mets (ffi << type-syntax )
+.syne
+.desc
+The
+.code ffi
+macro provides a shorthand notation for compiling a literal
+FFI type expression to the corresponding type object. The
+following equivalence holds:
+
+.cblk
+ (ffi expr) <--> (ffi-type-compile 'expr)
+.cble
+
.coNP Functions @ ffi-put and @ ffi-put-into
.synb
.mets (ffi-put < obj << type )