summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-17 05:55:07 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-17 05:55:07 -0700
commit2a7e64cd7911b43fed47e46ee5f27b27bcf50a26 (patch)
treee0f244c7769df4a7612b5d8532104622c7f67a45
parentef3794117b83555724e6becb2312dadbee595217 (diff)
downloadtxr-2a7e64cd7911b43fed47e46ee5f27b27bcf50a26.tar.gz
txr-2a7e64cd7911b43fed47e46ee5f27b27bcf50a26.tar.bz2
txr-2a7e64cd7911b43fed47e46ee5f27b27bcf50a26.zip
ffi: typedef macro instead of deffi-type.
* share/txr/stdlib/ffi.tl (typedef): New macro. * lisplib.c (ffi_set_entries): Add typedef to autoload name list. * txr.1: Doc update. Remove mentions of deffi-type, though it continues to work.
-rw-r--r--lisplib.c2
-rw-r--r--share/txr/stdlib/ffi.tl3
-rw-r--r--txr.114
3 files changed, 10 insertions, 9 deletions
diff --git a/lisplib.c b/lisplib.c
index f62e75e1..18ade143 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("sizeof"),
+ lit("typedef"), lit("sizeof"),
nil
};
set_dlt_entries(dlt, name, fun);
diff --git a/share/txr/stdlib/ffi.tl b/share/txr/stdlib/ffi.tl
index ec164b61..b2a14787 100644
--- a/share/txr/stdlib/ffi.tl
+++ b/share/txr/stdlib/ffi.tl
@@ -72,6 +72,9 @@
(defmacro deffi-type (name type-expr)
^(ffi-typedef ',name (ffi-type-compile ',type-expr)))
+(defmacro typedef (name type-expr)
+ ^(ffi-typedef ',name (ffi-type-compile ',type-expr)))
+
(defun sys:deffi-cb-expander (f name rettype argtypes safe-p abort-retval)
(let ((ret-type-sym (gensym "ret-type-"))
(arg-types-sym (gensym "arg-types-"))
diff --git a/txr.1 b/txr.1
index 580bb771..0202fa9f 100644
--- a/txr.1
+++ b/txr.1
@@ -53117,11 +53117,9 @@ in the C language,
.code typedef
names can be globally defined, using the
.code ffi-typedef
-function, or the macro
-.codn deffi-type .
-These
+function, or the
.code typedef
-names are also symbols.
+macro.
Like in the C language,
.code typedef
@@ -54348,13 +54346,13 @@ The result value of a
form is
.metn name .
-.coNP Macro @ deffi-type
+.coNP Macro @ typedef
.synb
-.mets (deffi-type < name << type-syntax )
+.mets (typedef < name << type-syntax )
.syne
.desc
The
-.code deffi-type
+.code typedef
macro provides a convenient way to define type aliases.
The
@@ -54364,7 +54362,7 @@ expression is compiled as FFI syntax, and the
symbol is installed as an alias denoting that type.
The
-.code deffi-type
+.code typedef
macro yields the compiled version of
.meta type-syntax
as its value.