summaryrefslogtreecommitdiffstats
path: root/ffi.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-05-11 20:02:12 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-05-11 20:02:12 -0700
commite43849b3f941b12e14571aa09a5c18c3e105440f (patch)
tree335134dcf4b2093519eec949f2658e49821fbb53 /ffi.h
parent1b615a6667660b353c7719d805a0a40cdd948789 (diff)
downloadtxr-e43849b3f941b12e14571aa09a5c18c3e105440f.tar.gz
txr-e43849b3f941b12e14571aa09a5c18c3e105440f.tar.bz2
txr-e43849b3f941b12e14571aa09a5c18c3e105440f.zip
ffi: support programmable abort return value.
* ffi.c (stuct txr_ffi_closure): New member, abort_retval. (ffi_closure_mark_op): Mark the new member. (ffi_closure_dispatch_safe): Implement the abort_retval. If it is not nil, use put to place the value into the return buffer. There is a risk that this could also throw an exception, which is no longer protected: programer's problem. (ffi_make_closure): New abort_ret_in argument, which is defaulted and stored. (ffi_init): Update registration of ffi-make-closure to reflect new argument. * ffi.h (ffi_make_closure): Declaration updated. * share/txr/stdlib/ffi.tl (sys:deffi-cb-expander): Add abort-retval parameter; insert into ffi-make-closure call. (deffi-cb): Take optional abort-retval expression; pass it down to the expander function. (deffi-cb-unsafe): Pass nil as abort-retval down to expander. * txr.1: Documented.
Diffstat (limited to 'ffi.h')
-rw-r--r--ffi.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/ffi.h b/ffi.h
index 8eb54a78..4364a615 100644
--- a/ffi.h
+++ b/ffi.h
@@ -53,7 +53,7 @@ extern val ffi_type_s, ffi_call_desc_s, ffi_closure_s;
val ffi_type_compile(val syntax);
val ffi_make_call_desc(val ntotal, val nfixed, val rettype, val argtypes);
-val ffi_make_closure(val fun, val call_desc, val safe_p_in);
+val ffi_make_closure(val fun, val call_desc, val safe_p_in, val abort_ret_in);
mem_t *ffi_closure_get_fptr(val closure);
val ffi_call_wrap(val ffi_call_desc, val fptr, val args);
val ffi_typedef(val name, val type);