diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-05-01 05:25:28 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-05-01 05:25:28 -0700 |
commit | 46df2055f1775e509aedb914a8315ed620111e21 (patch) | |
tree | d981529b21aea3293496dc38dc18807afd314a5a | |
parent | 4212fde1faadaad49c343fd1d02e7ef9609b444c (diff) | |
download | txr-46df2055f1775e509aedb914a8315ed620111e21.tar.gz txr-46df2055f1775e509aedb914a8315ed620111e21.tar.bz2 txr-46df2055f1775e509aedb914a8315ed620111e21.zip |
ffi: allow get for ptr-in and ptr-in-d.
This supports some benign ambiguity, allowing the user
to specify an extracted ptr return value as ptr-in or
ptr-in-d, and have it work.
-rw-r--r-- | ffi.c | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -894,7 +894,7 @@ static void ffi_ptr_out_put(struct txr_ffi_type *tft, val s, mem_t *dst, } } -static val ffi_ptr_out_get(struct txr_ffi_type *tft, mem_t *src, val self) +static val ffi_ptr_get(struct txr_ffi_type *tft, mem_t *src, val self) { val tgttype = tft->mtypes; struct txr_ffi_type *tgtft = ffi_type_struct(tgttype); @@ -902,7 +902,7 @@ static val ffi_ptr_out_get(struct txr_ffi_type *tft, mem_t *src, val self) return ptr ? tgtft->get(tgtft, ptr, self) : nil; } -static val ffi_ptr_out_d_get(struct txr_ffi_type *tft, mem_t *src, val self) +static val ffi_ptr_d_get(struct txr_ffi_type *tft, mem_t *src, val self) { val tgttype = tft->mtypes; struct txr_ffi_type *tgtft = ffi_type_struct(tgttype); @@ -1365,31 +1365,31 @@ val ffi_type_compile(val syntax) val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), &ffi_type_pointer, - ffi_ptr_in_put, ffi_void_get, + ffi_ptr_in_put, ffi_ptr_get, ffi_ptr_in_in, target_type); } else if (sym == ptr_in_d_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), &ffi_type_pointer, - ffi_ptr_in_d_put, ffi_void_get, + ffi_ptr_in_d_put, ffi_ptr_d_get, 0, target_type); } else if (sym == ptr_out_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), &ffi_type_pointer, - ffi_ptr_out_put, ffi_ptr_out_get, + ffi_ptr_out_put, ffi_ptr_get, ffi_ptr_out_in, target_type); } else if (sym == ptr_out_d_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), &ffi_type_pointer, - ffi_ptr_out_put, ffi_ptr_out_d_get, + ffi_ptr_out_put, ffi_ptr_d_get, ffi_ptr_out_in, target_type); } else if (sym == ptr_s) { val target_type = ffi_type_compile(cadr(syntax)); return make_ffi_type_pointer(syntax, cptr_s, sizeof (mem_t *), &ffi_type_pointer, - ffi_ptr_put, ffi_ptr_out_get, + ffi_ptr_put, ffi_ptr_get, ffi_ptr_out_in, target_type); } else if (sym == buf_s || sym == buf_d_s) { cnum nelem = c_num(cadr(syntax)); |