| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
| |
Why have this verbose naming for the most basic case.
Rather, ptr-in and ptr-out are optimizations of ptr which
just avoid copying the object in one direction.
* ffi.c (ptr_in_out_s): Renamed to ptr_s.
(ffi_ptr_in_out_put): Renamed to ffi_ptr_put.
(ffi_type_compile, ffi_init): Follow rename.
* ffi.h (ptr_in_out_s): Declaration updated
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The FFI types str-d, wstr-d and buf-d are like their
unsuffixed counterparts, but indicate that ownership of a
dynamically allocated object is being passed which the
receiver is responsible for freeing.
If we pass a str, wstr or buf into a foreign function, we are
generally only guaranteeing the lifetime of the buffer over
the function call. If we pass a str-d or buf-d, then the
callee keeps the pointer indefinitely, and must free it.
If we get str or buf return value from a function, it
is assumed that the pointer is static or something borrowed
with some limited lifetime. A copy of it is made.
If we get a str-d, wstr-d or buf-d, it is assumed that
the pointer has been malloc-ed for us. The object is
either duplicated, and the original one immediately
freed, or else the pointer is retained directly in the
Lisp object and freed if that object becomes garbage.
* ffi.c (str_d_s, wstr_d_s, buf_d_s): New symbol variables.
(ffi_str_get): Coalesce assignment with declaration.
(ffi_str_d_get, ffi_str_d_put): New static functions.
(ffi_buf_d_get, ffi_buf_d_put): New static functions.
(ffi_type_compile): Handle buf_d_s, str_d_s and wstr_d_s.
(ffi_init): Initialize str_d_s, wstr_d_s and buf_d_s.
* ffi.c (str_d_s, wstr_d_s, buf_d_s): Declared.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (float_s): Variable removed. This is a duplicate
definition; we already have this symbol in lib.c.
(ffi_type_s): Duplicate definition removed; it is
repeated two lines below.
(ffi_str_put): Remove pointless const qualifier on u8s
variable.
(ffi_call_wrap): Cast return value of alloca. Also,
rc pointer needs to be cast to mem_t *.
(ffi_init): Remove initialization of float_s.
* ffi.h (float_s): Declaration removed.
|
|
|
|
|
|
|
|
|
|
|
| |
* ffi.c (array_s): New symbol variable.
(ffi_array_put, ffi_array_get, ffi_array_fill,
make_ffi_type_array): New static functions.
(ffi_type_compile): Support (array <dim> <type>)
syntax.
(ffi_init): Initialize array_s.
* ffi.h (array_s): Declared.
|
|
* Makefile (OBJS): Add ffi.o.
* configure (have_libffi): New variable.
(gen_config_make): Generate have_libffi make variable.
New check for availability of libffi.
* ffi.c, ffi.h: New files.
* lib.c (init): Call ffi_init.
|