diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2017-04-28 06:24:05 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2017-04-28 06:24:05 -0700 |
commit | 1473e5c50bae68d3fe2ac55eff12363385dc48b7 (patch) | |
tree | b413cecce7e295ce67a3beed00f6cfda1947e9f1 /lib.c | |
parent | 046fcbaca4d0abb62b572231a5f941514e92d35b (diff) | |
download | txr-1473e5c50bae68d3fe2ac55eff12363385dc48b7.tar.gz txr-1473e5c50bae68d3fe2ac55eff12363385dc48b7.tar.bz2 txr-1473e5c50bae68d3fe2ac55eff12363385dc48b7.zip |
ffi: allow ptr-in-out passing of cptr.
* ffi.c (ffi_ptr_alloc): New static function.
(ffi_type_compile): Give the cptr type alloc and free
functions: alloc just retrives the address of the pointer
inside the cptr object (pointer to pointer); free is a noop.
(cptr_make): New static function.
(ffi_init): Register cptr_make as cptr intrinsic. Register
cptr-null intrinsic variable denoting a ready-made null
pointer.
* lib.c (cptr_addr_of): New function.
* lib.h (cptr_addr_of): Declared.
Diffstat (limited to 'lib.c')
-rw-r--r-- | lib.c | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -7361,6 +7361,12 @@ mem_t *cptr_get(val cptr) return cobj_handle(cptr, cptr_s); } +mem_t **cptr_addr_of(val cptr) +{ + (void) cobj_handle(cptr, cptr_s); + return &cptr->co.handle; +} + val assoc(val key, val list) { list = nullify(list); |