summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* ffi: carray-free resets length.Kaz Kylheku2017-05-181-0/+1
| | | | | | * ffi.c (carray_free): Don't just reset the pointer to null, but also set the number of elements to zero. That will prevent indexing operations from dereferencing null.
* ffi: bugfix: broken buf in semantics, bad doc.Kaz Kylheku2017-05-182-29/+78
| | | | | | | | | | | | | * ffi.c (ffi_buf_in): The bug in this one is that if *loc has been mutated to a null pointer, we want to produce a nil, rather than to try to duplicate the buffer. (ffi_buf_d_in): The bug here is that *loc is always different from origptr, because origptr is from the original buffer object, whereas we placed a copy of it into *loc. The semantics is changed. We take ownership of whatever pointer is there. If it is null, then yield nil. * txr.1: buf and buf-d documentation revised.
* parser: bugfix: set line number on <lineno> tokens.Kaz Kylheku2017-05-181-0/+7
| | | | | | | | | | | | | | | | | This issue was revealed as a garbage line number in an unbound variable warning diagnostic, where the variable occurs in a quasi word list literal. A small test case is (list #`@var`) where var unbound. The fix is, in the lexer, to set the yylval->lineno for all tokens which are declared as <lineno> in the grammar file, for which doing so has beens neglected. We do this even for those tokens whose line number values are never accessd in any rule; it could arise in the future. * parser.l (grammar): Set the yylval->lineno for the tokens HASH_BACKSLASH, HASH_B_QUOTE, HASH_SLASH, WORDS, WSPLICE, QWORDS and QWSPLICE.
* ffi: new carray_buf function.Kaz Kylheku2017-05-172-0/+12
| | | | | | | | | Treat a buffer through a carray view. * ffi.c (carray_buf): New function. (ffi_init): Register carray-buf intrinsic. * ffi.h (carray_buf): Declared.
* ffi: carrays able to reference objects.Kaz Kylheku2017-05-172-5/+14
| | | | | | | | | | | | | | | | | | | | | The idea here is that carrays can have a pointer to some area that is owned by another object. So that the area doesn't disappear when the other object becomes garbage, a carray which does this maintains a pointer to that other object. * ffi.c (ffi_carray_get): Pass new parameter to make_carray. (struct carray): New member, ref. (carray_mark_op): Mark new ref member. (make_carray): New parameter: the object which is stored in the structure as ref. (carray_dup): Null out the ref member. When a carray is duplicated, it owns its own buffer, and henceforth mustn't prevent the original object from being reclaimed. (carray_own): Don't allow a carray to claim ownership of the pointer if it references another object; we have no protocol to inform that other object. * ffi.h (make_carray): Declaration updated.
* ffi: macro named ffi for type compiling shorthand.Kaz Kylheku2017-05-173-1/+19
| | | | | | | | | * lisplib.c (ffi_set_entries): Add "ffi" to autoload name list. * share/txr/stdlib/ffi.tl (ffi): New macro. * txr.1: Documented.
* ffi: typedef macro instead of deffi-type.Kaz Kylheku2017-05-173-9/+10
| | | | | | | | | | * share/txr/stdlib/ffi.tl (typedef): New macro. * lisplib.c (ffi_set_entries): Add typedef to autoload name list. * txr.1: Doc update. Remove mentions of deffi-type, though it continues to work.
* ffi: carray type to round out semantics.Kaz Kylheku2017-05-172-3/+305
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The carray type deals with C array passing conventions as a pointer to the first element of an array of unknown size. It fills in the functionality gap not covered by array and varray. * ffi.c (carray_s): New symbol variable. (ffi_carray_get, ffi_carray_put): New static functions. (ffi_type_compile): Handle (carray <type>) syntax. (struct carray): New struct type. (carray_struct, carray_struct_checked, carray_print_op, carray_mark_op, carray_destroy_op): New static functions. (carray_borrowed_ops, carray_owned_ops): New static structs. (make_carray, carray_set_length, carray_dup, carray_own, carray_free, carray_type, length_carray, carray_get, carray_vec, carray_blank, vec_carray, list_carray, carray_ref, carray_refset): New functions. (ffi_init): Initialize carray_s. Register carray-set_length, carray_dup, carray_own, carray-free, carray_type, length_carray, carray-vec, array_blank, vec_carray, list_carray, carray_ref and carray-refset intrinsics. * ffi.h (carray_s): Declared. (make_carray, carray_set_length, carray_dup, carray_own, carray_free, carray_type, length_carray, carray_get, carray_vec, carray_blank, vec_carray, list_carray, carray_ref, carray_refset): Declared.
* ffi: tagged cptr type, for improved safety.Kaz Kylheku2017-05-161-0/+8
|
* ffi: don't set up cptr as Lisp type inappropriately.Kaz Kylheku2017-05-151-7/+20
| | | | | | | | | | | | The type compiler specifies cptr as the Lisp type for various ptr types and the buf type. This will be misleading with the increasing role of cptr. * ffi.c (ffi_get_lisp_type): New static function. (ffi_type_compile): Use buf as the Lisp type for the buf and buf-d FFI types. For ptr and its variants, use the target type's Lisp type as the pointer's Lisp type. For instance (ptr int) has integer as its Lisp type.
* protsym: further refinement.Kaz Kylheku2017-05-151-7/+19
| | | | | | | | | | | | | In sysif.c, we have conditionally defined symbol variables. This has to be reflected with #if directivec in protsym.c. * genprotsym.txr: Associate each symbol with a list of preprocessor symbols which controls it, via a hash. All symbols coming from a conditional file are tagged with a list which includes at least the controlling symbol. If symbols are wrapped with #if <sym> directives, that is added. Nesting is supported. We group the symbols according to their controlling preprocessor symbol lists.
* Splitting cptr object into separate CPTR tag.Kaz Kylheku2017-05-157-25/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | CPTR shares representation and a lot of implementation with COBJ. The COBJ class symbol is the CPTR type tag. There is no hierarchy among CPTR tags. The nil tag is used for a modicum of type looseness, so that we don't straitjacket ourselves too much into this tag-based typing scheme. All existing cptr objects are becoming CPTR, and all get a nil tag, except for dlopen library handles, and dlsym symbols, which are tagged as dlhandle and dlsym. The FFI framework will support tag-declared cptr's. This will help with safety. For instance, suppose an API has half a dozen different kinds of opaque handles. If they are all just cptr on the TXR Lisp side, it's easy to mix them up, passing the wrong one to the wrong C function. * lib.h (enum type): New enum member, CPTR. (cptr_print_op, cptr_typed, cptrp, cptr_type, cptr_handle): Declared. (cptr_addr_of): Parameters added. * lib.c (code2type): Map CPTR type code to cptr_s. (equal): Handle CPTR objects. They are only equal to other CPTR objects which have the same operations, and are equal under the equal function of those operations. (cptr_print_op): New function. (cptr_ops): Use cptr_print_op rather than cobj_print_op. (cptr_typed): New function. (cptr): Use cptr_typed to make a cptr with tag nil, rather than using cobj. (cptrp, cptr_handle, cptr_type): New functions. (cptr_get): Go through cptr_handle rather than cobj_handle. (cptr_addr_of, cptr_zap, cptr_free): Use call to cptr_handle rather than cobj_handle for the type checking side effect. New parameters for type and parent function name. (obj_print_impl): Handle CPTR with same case as COBJ. * gc.c (finalize, mark_obj): Handle CPTR cases using common code with COBJ. * hash.c (equal_hash): Handle CPTR just like COBJ. * eval.c (eval_init): Register cptrp and cptr-type intrinsic functions. * ffi.c (ffi_cptr_put, ffi_cptr_get, ffi_cptr_alloc): Use the potentially type-safe cptr_handle, instead of cptr_get. However, for an untagged cptr, there is no type safety because tft->mtypes is nil. The argument can be any kind of cptr. * sysif.c (dlhandle_s, dlsym_s): New symbol variables. (cptr_dl_ops): Use cptr_print_op. (dlopen_wrap, dlclose_wrap): Use typed cptr with dlhandle as the type. (dlsym_wrap, dlsym_checked, dlvsym_wrap, dlvsym_checked): Recognize only a cptr of type dlhandle for the library. Construct a typed cptr of type dlsym. (sysif_init): Initialize dlhandle_s and dlsym_s. Register dlsym function using dlsym_s.
* less table robust against type renumbering.Kaz Kylheku2017-05-152-20/+15
| | | | | | | | | | * lib.c (less_tab_init): The type_prec table initialization will become incorrect if new type enums are added other than at the end. Let's switch to assignments. Anything not mentioned is zero. * lib.h: Add more advice to comment about extending type_t: consider all places where MAX_TYPE is used.
* bugfix: use proper hashing for cptr.Kaz Kylheku2017-05-153-2/+9
| | | | | | | | | | | | | | | Since cptr objects are equal if their handles are equal, they must have a hashing function over the handle rather than over their own address. * lib.c (cobj_handle_hash_op): New function. (cptr_ops): Use cobj_handle_hash_op instead of cobj_eq_hash_op. * lib.h (cobj_handle_hash_op): Declared. * sysif.c (cptr_dl_ops): Use cobj_handle_hash_op instead of cobj_eq_hash_op.
* cobj: rename poorly named default operation.Kaz Kylheku2017-05-1513-30/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renaming cobj_hash_op to cobj_eq_hash_op. This function is only appropriate to use with COBJ objects which use eq as their equal funtion. I've spotted one instance of an inappropriate use which have to be addressed by a different commit: the equal function is other than eq, but cobj_hash_op is used for the equal hash. * lib.h (cobj_hash_op): Declaration renamed to cobj_eq_hash_op. * hash.c (cobj_hash_op): Renamed to cobj_eq_hash_op. (hash_iter_ops): Refer to renamed cobj_hash_eq_op. * ffi.c (ffi_type_builtin_ops, ffi_type_struct_ops, ffi_type_ptr_ops, ffi-closure_ops, ffi_call_desc_ops): Likewise. * lib.c (cptr_ops): Likewise. * parser.c (parser_ops): Likewise. * rand.c (random_state_ops): Likewise. * regex.c (char_set_ops, regex_obj_ops): Likewise. * socket.c (dgram_strm_ops): Likewise. * stream.c (null_ops, stdio_ops, tail_ops, pipe_ops, dir_ops, string_in_ops, byte_in_ops, strlist_in_ops, string_out_ops, strlist_out_ops, cat_stream_ops, record_adapter_ops): Likewise. * struct.c (struct_type_ops): Likewise. * sysif.c (cptr_dl_ops): Likewise. * syslog.c (syslog_strm_ops): Likewise. * unwind.c (cont_ops): Likewise.
* protsym: don't refer to symbols excluded by config.Kaz Kylheku2017-05-151-6/+34
| | | | | | | | | | | | | | | | The protsym.c generated file refers to symbol variables without regard for whether they actually exist. Some symbol variables are defined in source files whose object files are only linked in conditionally. * genprotsym.txr: Update the logic to scan the Makefile to determine which files are conditionally included, based on what makefile flag, which is related to a preprocessor symbol. Thus, with some hashes, for each symbolic variable we subsequently scan, we know whether it came from a file that is associated with a preprocessor symbol. We group the emitted material accordingly, placing the conditionally existent symbols into #if...#endif blocks.
* Version 175.txr-175Kaz Kylheku2017-05-157-848/+958
| | | | | | | | | | * RELNOTES: Updated. * configure, txr.1: Bumped version and date. * share/txr/stdlib/ver.tl: Likewise. * txr.vim, tl.vim, protsym.c: Regenerated.
* ffi and utf8: C++ fixes.Kaz Kylheku2017-05-152-28/+30
| | | | | | | | | | | | * ffi.c (ffi_varray_alloc, ffi_char_array_put): Use cnum type consistently to avoid signed/unsigned comparison warning from g++. (ffi_closure_dispatch_safe): Put block of code into a braced statement so that the macro-generated switch case branch isn't crossing the initialization of a variable. Also, convert cast added where we are passing a void * to a mem_* parameter. * utf8.c (utf8_dup_from): Fix coerce macros being used to strip qualifiers, not only convert type.
* bugfix: gc-incorrect creation of catenated stream.Kaz Kylheku2017-05-131-1/+4
| | | | | | | | | | | | * stream.c (make_catenated_stream): Fix incorrect order of operations: list of streams stored into a structure that is not yet visible to the garbage collector. (Rules for coding this properly are explained in HACKING.) This was found by running a test with --gc-debug on 64 bit Darwin. The read_eval_stream function calls make_catenated_stream with an argument that is freshly constructed in the argument expression itself, triggering the issue.
* tests: first FFI regression test case.Kaz Kylheku2017-05-134-0/+54
| | | | | | | | | | | * tests/017/qsort.expected: New file. * tests/017/qsort.tl: New file. * tests/common.tl (libc): New function. * Makefile (tst/tests/017/%): Clear TXR_DBG_OPTS so the GC stress test isn't applied to tests in this directory.
* tests: use internal OS identification method.Kaz Kylheku2017-05-132-4/+10
| | | | | | | | | | * tests/common.tl (osname): Function based on calling shell command removed. (os-symbol): New symbol-returning function based on uname system call. * tests/014/dgram-stream.tl (dgram-test): Use os-symbol function rather than osname.
* ffi: null out all freed or borrowed pointers.Kaz Kylheku2017-05-131-15/+24
| | | | | | | | | | | | | | | | When taking ownership of any pointer from FFI space, null it out. This is safer in general and prevents corruption problems in the callback interface when an exception is thrown. For instance (ptr wstr-d) callback argument: callback takes ownership of the pointer in a string object; throws an exception. The FFI call dispatch runs the in semantics to get the string value out; but the old pointer is still there which may not be used. * ffi.c (ffi_str_d_get, ffi_wstr_d_get, ffi_bstr_d_get, ffi_buf_d_in, ffi_buf_d_get, ffi_ptr_d_get): Overwrite the source location of a freed or owned pointer with null.
* ffi: use dynamic allocation for wstr and wstr-d.Kaz Kylheku2017-05-132-39/+24
| | | | | | | | | | | | | | | | | | | The direct pointer use of the wstr type causes problems for callbacks. Plus allowing the foreign world to retain the pointers into string objects is inherenty unsafe. We can introduce an "unsafe wstr" type in a later release for efficiency. * ffi.c (ffi_wstr_in): New function. (ffi_wstr_put): Removed by ffi_wstr_d_put rename. (ffi_wstr_d_put): Renamed to ffi_wstr_put: both wstr and wstr-d strings have a dynamically-allocating put. (ffi_init_types): Give wstr type ffi_wstr_in handler. wstr-d type's registration switched to ffi_wstr_put, which is just ffi_wstr_d_put renamed. * txr.1: Memory management notes for wstr updated.
* gc: bug in --free-all --vg-debug combination.Kaz Kylheku2017-05-131-1/+1
| | | | | | | | * gc.c (gc_free_all): Mark defined the current block being iterated, not the next one. Otherwise Valgrind generates numerous false errors from accesses to free objects in the first block. Not to mention that next is a null pointer in the last iteration.
* gc: use symbolic constants for special vec slots.Kaz Kylheku2017-05-121-4/+4
| | | | | | | * gc.c (mark_obj): The vector alloc size and length which lie at negative indices should be accessed using the index constants vec_alloc and vec_length, rather than -2 and -1.
* ffi: darwin port: missing types.Kaz Kylheku2017-05-122-0/+42
| | | | | | | | * configure: detect clockid_t and loff_t, providing HAVE_CLOCKID_T and HAVE_LOFF_T config macros. * ffi.c (ffi_init_extra_types): Register clockid-t and loff-t types only if available.
* ffi: bugfix: broken i64 conversion.Kaz Kylheku2017-05-121-1/+1
| | | | | * itypes.c (c_i64): Fix c_num being called on the function pointer num rather than the correct operand n.
* windows: package libffi dll.Kaz Kylheku2017-05-111-0/+1
| | | | * inst.nsi: Add cygffi-6.dll to package.
* ffi and buf porting: stdarg.h needed.Kaz Kylheku2017-05-112-0/+2
| | | | * buf.c, ffi.c: Must include <stdarg.h> for va_list.
* dlopen: broken dlvsym configure test.Kaz Kylheku2017-05-111-3/+3
| | | | | | | * configure: the dlvsym test relies on a nonexistent make variable EXTRA_CFLAGS. The correct one is EXTRA_FLAGS. The function name is misspelled in the test code and the test message.
* ffi: support programmable abort return value.Kaz Kylheku2017-05-114-15/+44
| | | | | | | | | | | | | | | | | | | | | | | | | * 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.
* ffi: a measure of safety for callbacks.Kaz Kylheku2017-05-114-19/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't want, by default, for callbacks to capture delimited continuations across foreign code, or perpetrate non-local transfers across foreign code. Here, we take an approach similar for what was done in ftw_wrap. * ffi.c (s_exit_point): New global variable with internal linkage. (ffi_call_wrap): If s_exit_point isn't nil, then it means that the callback intercepted a nonlocal transfer and stored its exit point. We resume the transfer to that exit point instead of returning normally. (ffi_closure_dispatch_safe): New static function. (ffi_make_closure): Support a new argument which indicates whether to make a closure which uses ffi_closure_dispatch_safe, or ffi_closure_dispatch. (ffi_init): Update registration of ffi-make-closure intrinsic. * ffi.h (ffi_make_closure): Declaration updated. * share/txr/stdlib/ffi.tl (sys:deffi-cb-expander): New function. (deffi-cb): Macro internals replaced by call to new function. (deffi-cb-safe): New macro. * txr.1: Documentation of ffi-make-closure updated. New deffi-cb-unsafe macro documented.
* ffi: encode-side character array specializations.Kaz Kylheku2017-05-111-2/+65
| | | | | | | | | | | | If the object being encoded is a string, and the array element type is char, wchar or bchar, then encode a string, honoring null termination flag. Unused space in the destination array is filled with zeros. * ffi.c (ffi_char_array_put, ffi_wchar_array_put, ffi_bchar_array_put): New functions. (ffi_array_put, ffi_array_out): Use new functions under the right conditions.
* ffi: split varray behavior into separate virtuals.Kaz Kylheku2017-05-101-21/+26
| | | | | | | | | | | | | | * ffi.c (struct txr_ffi_type): is_varray flag removed. We no longer need to test this and adjust behavior. (ffi_array_in, ffi_array_out): Don't calculate nelem differently based on flag; just pass down tft->nelem. Code cleaned up. (ffi_varray_put, ffi_varray_in): New functions. (ffi_type_compile): Use ffi_varray_put and ffi_varray_in for variable array type instead of setting flag. Also, specify the out function as null; it never made sense to have one, since there is no get. Finally, set the size of the type to zero, since it has no pass by value semantics.
* ffi: bugfix: wrong type in allocation of varrays.Kaz Kylheku2017-05-101-2/+4
| | | | | | * ffi.c (ffi_varray_alloc): We must use the element type's size, not the array's size. Also, cosmetic issue in error message fixed.
* ffi: refactor array transfers.Kaz Kylheku2017-05-101-28/+58
| | | | | | | | | | | | | | This anticipates a redesign of variable arrays. Variable arrays will have their own put, in, get and out functions, which will share some implementation. * ffi.c (ffi_array_in_common): New function. (ffi_array_in): Bulk of code replaced by call to ffi_array_in_common. (ffi_array_put_common, ffi_array_out_common, ffi_array_get_common): New functions. (ffi_array_put, ffi_array_out, ffi_array_get): Reduced to thin wrappers.
* ffi: check against types that can't pass by value.Kaz Kylheku2017-05-101-2/+15
| | | | | | * ffi.c (ffi_make_call_desc): Throw if any argument type is something with zero size. Throw if the return type has zero size and isn't the type void.
* ffi: reduce char array code repetition.Kaz Kylheku2017-05-101-70/+53
| | | | | | | * ffi.c (ffi_char_array_get, ffi_wchar_array_get, ffi_bchar_array_get): New static functions. (ffi_array_in, ffi_array_get): Replace common code with calls to code moved out into functons.
* ffi: bugfix: use nelem, not size, in array in and get.Kaz Kylheku2017-05-101-4/+4
| | | | | | | | | Arrays can be varray, whose size is just pointer size. The string extraction operations shouldn't be referring to the size. * ffi.c (ffi_array_in, ffi_array_et): Use nelem instead of tft->size.
* ffi: do arg in semantics /after/ getting return val.Kaz Kylheku2017-05-101-1/+4
| | | | | | | | | | | | What this allows is for situations when a foreign function returns the pointer that it has been passed. If that pointer is temporary storage allocated by FFI, then it is no longer valid after performing the in pass on the args. Therefore, we should decode the return value first, while the returned pointer is valid. * ffi.c (ffi_call_wrap): Move the return value get before the argument post-processing in pass.
* ffi: adjust semantics of zarray of characters.Kaz Kylheku2017-05-102-14/+34
| | | | | | | | | | | | | We want to be able to extract null-terminated UTF-8 strings from arrays, without trailing junk, yet retain the ability to extract the entire array including embedded nulls. The natural way is to use the array/zarray distinction. * ffi.c (ffi_array_in, ffi_array_get): Don't try to guess whether the array is null terminated; just rely on the null_term flag, and treat accordingly. * txr.1: Doc updated.
* doc: cptr.Kaz Kylheku2017-05-101-0/+149
| | | | * txr.1: The cptr type is now documented.
* doc: relocate and rewrite buffer literal description.Kaz Kylheku2017-05-091-12/+25
| | | | | | * txr.1: Buffer literals are now described much earlier in the document under Additional Syntax rather than in the Buffers section.
* doc: add buf and cptr to type diagram.Kaz Kylheku2017-05-091-1/+5
| | | | * txr.1: Update ASCII diagram in Object Types section.
* doc: dlopen added.Kaz Kylheku2017-05-091-0/+166
| | | | | * txr.1: Documented dlopen, dlclose and friends, plus the rtld-* variables.
* cptr: new functions.Kaz Kylheku2017-05-093-0/+35
| | | | | | | | | | * eval.c (eval_init): Register cptr-int, ctpr-obj, cptr-zap and cptr-free functions and cptr-null variable. * lib.c (cptr_int, cptr_obj, cptr_zap, cptr_free): New functions. * lib.c (cptr_int, cptr_obj, cptr_zap, cptr_free): Declared.
* ffi: remove cptr stuff.Kaz Kylheku2017-05-091-7/+0
| | | | | * ffi.c (cptr_make): Function removed. (ffi_init): Registration of cptr and cptr-null removed.
* ffi: integers and chars may convert to C float.Kaz Kylheku2017-05-092-7/+33
| | | | | | | | | * ffi.c (ffi_float_put, ffi_double_put): Support a useful type looseness by allowing integers and character Lisp values to pair with FFI floating-point types, imitating the conversion which happens in C function calls. * txr.1: Updated.
* doc: FFI module documented.Kaz Kylheku2017-05-091-0/+1618
|
* ffi: eliminate memcpy in basic gets and puts.Kaz Kylheku2017-05-081-52/+36
| | | | | | | | | | | | | | * ffi.c (ffi_i8_put, ffi_u8_put, ffi_i16_put, ffi_i16_get, ffi_u16_put, ffi_u16_get, ffi_i32_put, ffi_i32_get, ffi_u32_put, ffi_u32_get, ffi_i64_put, ffi_i64_get, ffi_u64_put, ffi_u64_get, ffi_char_put, ffi_char_get, ffi_uchar_get, ffi_short_get, ffi_ushort_put, ffi_ushort_get, ffi_int_put, ffi_int_get, ffi_uint_put, ffi_uint_get, ffi_long_put, ffi_long_get, ffi_ulong_put, ffi_ulong_get, ffi_float_put, ffi_float_get, ffi_double_put, ffi_double_get, ffi_wchar_put, ffi_wchar_get, ffi_cptr_put, ffi_cptr_get): memcpy operations replaced by by assignments through pointer casts.