diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-04-29 12:12:20 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-04-29 12:12:20 -0700 |
commit | cced80ab687b521a1d07e53e1be70a33ea711d0f (patch) | |
tree | 243d5940f0f3a7e12662662dd994c45bba31da94 /ffi.h | |
parent | a77610707ca983a74e4f0af8926d663fdb71ecbf (diff) | |
download | txr-cced80ab687b521a1d07e53e1be70a33ea711d0f.tar.gz txr-cced80ab687b521a1d07e53e1be70a33ea711d0f.tar.bz2 txr-cced80ab687b521a1d07e53e1be70a33ea711d0f.zip |
ffi: zarray type for null terminated array support.
A zarray is null terminated when we convert from Lisp
to C representation. The last element of the Lisp vector
is ignored and all zero bits are written to the destination
buffer in the size of the element.
* ffi.c (zarray_s): New symbol variable.
(struct txr_ffi_type): New bitfield member, null_term.
(ffi_array_in): If the array's null_term flag is set,
then don't process the last element, since the corresponding
put call wasn't done for that element in ffi_array_put.
(ffi_array_put): If the array's null_term flag is set,
then when processing the last element, just memset the
output element to zero and don't call put.
(ffi_type_compile): Recognize zarray_s and set up the
flag accordingly.
(ffi_init): Initialize zarray_s.
* ffi.h (zarray_s): Declared.
Diffstat (limited to 'ffi.h')
-rw-r--r-- | ffi.h | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -43,7 +43,7 @@ extern val buf_d_s; extern val ptr_in_s, ptr_out_s, ptr_in_d_s, ptr_out_d_s, ptr_s; -extern val array_s; +extern val array_s, zarray_s; extern val void_s; |