summaryrefslogtreecommitdiffstats
path: root/ffi.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-25 20:31:36 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-25 20:31:36 -0700
commita16a267958fb76b5cb1d7154d7c11800b6daeae5 (patch)
treeca97ab15ca420067bf5f040df06da9096623fb27 /ffi.h
parent5c676f789d9e896f4b8d88a977d4e0fcae3a9fc1 (diff)
downloadtxr-a16a267958fb76b5cb1d7154d7c11800b6daeae5.tar.gz
txr-a16a267958fb76b5cb1d7154d7c11800b6daeae5.tar.bz2
txr-a16a267958fb76b5cb1d7154d7c11800b6daeae5.zip
ffi: bitfield support.
* ffi.c (sbit_s, ubit_s): New symbol variables. (struct txr_ffi_type): New members, shift and mask. (ffi_sbit_put, ffi_sbit_get, ffi_ubit_put, ffi_ubit_get, bitfield_syntax_p): New static functions. (make_ffi_type_pointer): Disallow pointers to bitfields. (make_ffi_type_struct): Process bitfield members and set up shifts and masks accordingly. Recently introduced bug fixed here at the same time: the alignment calculation for each member must be done top-of-loop. (ffi_struct_compile): Exclude bitfields from the check against members with zero type. Compile the bitfield syntax. (ffi_typedef): Do not allow typedefs of bitfield type. Not only doesn't this make sense, but bitfield types are destructively modified in make_ffi_type_struct: they are imbued with a mask and offset tied to their position in a particular struct. * ffi.h (sbit_s, ubit_s): Delared. * txr.1: Documented bitfields.
Diffstat (limited to 'ffi.h')
-rw-r--r--ffi.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/ffi.h b/ffi.h
index c6a7102a..5d89e452 100644
--- a/ffi.h
+++ b/ffi.h
@@ -51,6 +51,8 @@ extern val ptr_in_s, ptr_out_s, ptr_in_d_s, ptr_out_d_s, ptr_out_s_s, ptr_s;
extern val closure_s;
+extern val sbit_s, ubit_s;
+
extern val ffi_type_s, ffi_call_desc_s, ffi_closure_s;
val ffi_type_compile(val syntax);