diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-06-04 06:45:59 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-06-04 06:45:59 -0700 |
commit | 06352f1874845023738ab9eeb50c5612b1affcb4 (patch) | |
tree | 02e46f9a1e4e4b7b10c370b86f9c2bcc69e0d5f1 /chksums | |
parent | 57c9049794f108fe7ba593a5ed29511bdeb8314c (diff) | |
download | txr-06352f1874845023738ab9eeb50c5612b1affcb4.tar.gz txr-06352f1874845023738ab9eeb50c5612b1affcb4.tar.bz2 txr-06352f1874845023738ab9eeb50c5612b1affcb4.zip |
FFI: big improvement in bad call diagnosis.
FFI has the problem that when things go wrong in calls, or in
specifications of functions, the diagnostics refer to an
internal function like ffi-call or ffi-make-call-desc, which
is not helpful in identifying the error. We want the
diagnostics to refer to the foreign function, or foreignb
callback wrapper, to which the problem pertains.
The approach taken is to stick the name symbol into the
ffi-call-desc object. Functions which work with a
ffi-call-desc can pull out the name and use it for reporting.
* ffi.c (struct txr_ffi_call_desc): Add name member.
(ffi_call_desc_print_op): Include name in printed
representation.
(ffi_desc_mark_op): Mark the name.
(ffi_make_call_desc): Take new argument to specify the name,
storing it into the structure. If it is specified,then use
that name for reporting errors, otherwise stick with
ffi-make-call-desc.
(ffi_call_wrap, ffi_closure_dispatch,
ffi_closure_dispatch_safe, ffi_make_closure): Use the name
from the call descriptor, or else the function's own name if
that is nil.
(ffi_init): Update registration of ffi-make-call-desc
intrinsic to five arguments with four required.
* ffi.h (ffi_make_call_desc): Declaration updated.
* share/txr/stdlib/ffi.tl (deffi, deffi-cb-expander): Pass the
name symbol down to ffi-make-call-desc.
* txr.1: Documented.
Diffstat (limited to 'chksums')
0 files changed, 0 insertions, 0 deletions