From cced80ab687b521a1d07e53e1be70a33ea711d0f Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 29 Apr 2017 12:12:20 -0700 Subject: 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. --- ffi.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'ffi.h') diff --git a/ffi.h b/ffi.h index 1aca9f19..6134c5fc 100644 --- a/ffi.h +++ b/ffi.h @@ -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; -- cgit v1.2.3