diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-02 21:55:23 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-02 21:55:23 -0700 |
commit | e538d15b836c6931bbd14b5fb26f57899a3bff54 (patch) | |
tree | 657f1a8cddd8e105a88e6b8eebcbb8f82be92756 /eval.h | |
parent | 9cf108dc6e06fbf22e4af312cb0164dc099038a3 (diff) | |
download | txr-e538d15b836c6931bbd14b5fb26f57899a3bff54.tar.gz txr-e538d15b836c6931bbd14b5fb26f57899a3bff54.tar.bz2 txr-e538d15b836c6931bbd14b5fb26f57899a3bff54.zip |
ffi: evaluate expressions in type notation.
Places where an integer constant was previously allowed
now allow an expression.
The way enum syntax works is now different. A temporary
lexical environment is created, and each enumeration is
bound in that environment. The value expressions are
evaluated in that environment. The decision to allow
keyword symbols to be enumeration contants is retracted.
* eval.h (special_s): Declared.
* ffi.c (ffi_eval_expr): New static function.
(make_ffi_type_enum): Enums are introduced into a temporary
environment, in which the value expressions are evaluated. By
this means, the expressions can refer can refer to previous
enums and do arbitrary computation. Also, we drop the
requirement that enums can be keyword symbols.
(ffi_type_compile): Array dimension and buf size are evaluated
as expresions. Array and buffer syntax is transformed by
substitution of the evaluated size.
* txr.1: Documented use of expressions in FFI type notation.
Diffstat (limited to 'eval.h')
-rw-r--r-- | eval.h | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -32,6 +32,7 @@ extern val eq_s, eql_s, equal_s; extern val car_s, cdr_s; extern val last_form_evaled, last_form_expanded; extern val load_path_s, load_recursive_s; +extern val special_s; #define load_path (deref(lookup_var_l(nil, load_path_s))) |