From 2a7e64cd7911b43fed47e46ee5f27b27bcf50a26 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Wed, 17 May 2017 05:55:07 -0700 Subject: 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. --- lisplib.c | 2 +- share/txr/stdlib/ffi.tl | 3 +++ txr.1 | 14 ++++++-------- 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. -- cgit v1.2.3