diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-06-23 06:21:14 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-06-23 06:21:14 -0700 |
commit | ee064377143aa9cefb503bf0c277929a7ca641a1 (patch) | |
tree | 32f4ce3b14a401083b96b68544171e9a33c39347 | |
parent | 6faa3362efe19984e428f15e92c6631654e1dd40 (diff) | |
download | txr-ee064377143aa9cefb503bf0c277929a7ca641a1.tar.gz txr-ee064377143aa9cefb503bf0c277929a7ca641a1.tar.bz2 txr-ee064377143aa9cefb503bf0c277929a7ca641a1.zip |
ffi: add back-pointer into type structure.
Upcoming work is going to benefit from a pointer for
navigating from the txr_ffi_type structure to the Lisp object
whose implementation is that structure.
* ffi.c (struct txr_ffi_type): New member, self.
(make_ffi_type_builtin, make_ffi_type_pointer,
make_ffi_type_struct, make_ffi_type_array,
make_ffi_type_enum): Initialize self pointer.
-rw-r--r-- | ffi.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -158,6 +158,7 @@ struct smemb { }; struct txr_ffi_type { + val self; ffi_type *ft; ffi_type *elements[1]; val lt; @@ -2659,6 +2660,7 @@ static val make_ffi_type_builtin(val syntax, val lisp_type, val obj = cobj(coerce(mem_t *, tft), ffi_type_s, &ffi_type_builtin_ops); + tft->self = obj; tft->ft = ft; tft->syntax = syntax; tft->lt = lisp_type; @@ -2702,6 +2704,7 @@ static val make_ffi_type_pointer(val syntax, val lisp_type, val obj = cobj(coerce(mem_t *, tft), ffi_type_s, &ffi_type_ptr_ops); + tft->self = obj; tft->ft = &ffi_type_pointer; tft->syntax = syntax; tft->lt = lisp_type; @@ -2757,6 +2760,7 @@ static val make_ffi_type_struct(val syntax, val lisp_type, int bit_offs = 0; const unsigned bits_int = 8 * sizeof(int); + tft->self = obj; tft->ft = ft; tft->syntax = syntax; tft->lt = lisp_type; @@ -2890,6 +2894,7 @@ static val make_ffi_type_array(val syntax, val lisp_type, struct txr_ffi_type *etft = ffi_type_struct(eltype); + tft->self = obj; tft->ft = ft; tft->syntax = syntax; tft->lt = lisp_type; @@ -2945,6 +2950,7 @@ static val make_ffi_type_enum(val syntax, val enums, val self) val enum_env = make_env(nil, nil, nil); val shadow_menv = make_env(nil, nil, nil); + tft->self = obj; tft->ft = &ffi_type_sint; tft->syntax = syntax; tft->lt = sym_s; |