summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* matcher: use function for match and match-ecase error.Kaz Kylheku2021-09-101-2/+8
| | | | | | | * stdlib/match.tl (match-pat-error, match-error): New functions. (match, match-ecase): Generate more compact code which just calls match-pat-error rather than throwf, and doesn't contain any string literals.
* oop: remove repeated code in slot lookup.Kaz Kylheku2021-09-091-24/+8
| | | | | | | | * struct.c (lookup_slot): Do not repeat the slot lookup logic for the case when the symbol's slot_cache must be boostrapped, which only happens exactly once in the life of a symbol. Just allocate the cache if necessary and fall through to the have-cache case.
* gcc11: warnings related to struct args allocation..Kaz Kylheku2021-09-084-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As reported by Paul A. Patience, GCC 11 warns about situations in a few places where we do args_decl(args, 0) to allocate an absolutely empty argument list object. (This by the way, is only done in places where we are absolutely sure that the function we call will not be accessing the arguments. The usual rule is that there have to be at least ARGS_MIN arguments allocated, currently 4, and code relies on that being the case! So the places which call args_decl(args, 0) are coded carefully, checking that args is not passed anywhere where ARGS_MIN space is required.) Anyway, in the 0 case, the val arg[1] member of struct args is not allocated at all, because we call alloca(offsetof (struct args, arg)). Now GCC 11 notices this and complains that accesses to the other members like args->fill or args->list are using a struct that has not been entirely allocated. This, even though those members lie entirely within the allocated area. The fix for this is two faceted. Firstly, on C99, this diagnostic goes away if we make one simple change: declare the arg array as a flexible array member: val arg[]. However, we still support C90 in maintainer mode. So in maintainer mode, we stick with the 1. But we ensure that the places which call args_decl(args, 0) will pass 1 instead of 0, so the whole structure is allocated. * lib.h (FLEX_ARRAY): New macro: empty definition in C99 or later, otherwise 1. * args.h (struct args): Declare the size of the arg member using the new FLEX_ARRAY macro from lib.h. (ARGS_ABS_MIN): New macro, the absolute args minimum: zero in C99 mode, 1 in maintainer C90 mode. * ffi.c (ffi_struct_in, ffi_struct_get, make_zstruct): Use ARGS_ABS_MIN instead of 0 when preparing dummy args for make_struct call. * struct.c (struct_from_plist, struct_from_args, make_struct_lit): Use ARGS_ABS_MIN instead of zero when preparing dummy args for make_struct_impl or make_struct call.
* poll: don't free array from alloca.Kaz Kylheku2021-09-081-2/+0
| | | | | | | * sysif.c (poll_wrap): April 23, 2020 commit 7fbf6b853893f65193ea9c81cf467be08c651244 left behind some stray free calls, which happen only in some error cases. Reported by Paul A. Patience, by way of GCC 11 testing.
* exceptions: hack to store errno in string object.Kaz Kylheku2021-09-0714-187/+365
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Basic idea: when we throw an exception that pertains to a system error which has an errno code, we can stick the errno into the memory area of the character string, into the wchar_t that immediately follows the null terminator. We can do this because strings track their actual allocation size. A pair of setter/getter functions to set and retrieve this value are provided, and all functions in the code which can set such a code are updated to do so, simply by calling the newly added uw_ethrowf that drop-in replaces for uw_throwf. * lib.[ch] (string_set_code, string_get_code): New functions. * unwind.[ch] (uw_ethrowf): New function. * eval.c (eval_init): Register string-set-code and string-get-code intrinsics. * ftw.c (ftw_wrap): Switch to uw_ethrowf. * parser.c (open_txr_file): Likewise. * socket.c (dgram_overflow): Store the ENOBUFS error in errno, and use uw_ethrowf instead uw_throwf. (dgram_get_byte_callback, dgram_flush, sock_bind, to_connect, open_sockfd, sock_connect, sock_listen, sock_accept, sock_shutdown, sock_timeout, socketpair_wrap): Switch to uw_ethrowf. * stream.c (dev_null_get_fd, stdio_maybe_read_error, stdio_maybe_error, stdio_close, pipe_close, open_directory, open_file, open_fileno, open_tail, fds_subst, open_subprocess, open_command, remove_path, rename_path, tmpfile_wrap, mkdtemp_wrap, mkstemp_wrap): Switch to uw_ethrowf. * sysif.c (mkdir_wrap, ensure_dir, chdir_wrap, getcwd_wrap, rmdir_wrap, mknod_wrap, mkfifo_wrap, chmod_wrap, do_chown, symlink_wrap, link_wrap, readlink_wrap, close_wrap, val exec_wrap, stat_impl, do_utimes, pipe_wrap, poll_wrap, getgroups_wrap, setuid_wrap, seteuid_wrap, setgid_wrap, setegid_wrap, setgroups_wrap, getresuid_wrap, setresuid_wrap, setresgid_wrap, crypt_wrap, uname_wrap, opendir_wrap, getrlimit_wrap, setrlimit_wrap): Likewise. * termios.c (tcgetattr_wrap, tcsetattr_wrap, tcsendbreak_wrap, tcdrain_wrap, tcflush_wrap, tcflow_wrap): Likewise. * tests/018/errno.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* unwind: remove unused uw_errorf.Kaz Kylheku2021-09-072-14/+0
| | | | * unwind.[ch] (uw_errorf): Function removed.
* string-extend: use num, not num_fast.Kaz Kylheku2021-09-071-3/+3
| | | | | | | | * lib.c (string_extend, string_finish): When we update the alloc value in the string, we should be using num, because the cnum value is not necessarily in the fixnum range. That's the whole reason we are using the set macro: because the assigned value could be a heap-allocated bignum. Which it will never be, if we use num_fast.
* string-finish: new function.Kaz Kylheku2021-09-075-0/+42
| | | | | | | | | | | | * eval.c (eval_init): Register string-finish intrinsic. * lib.c (string_finish): New function. * lib.h (string_finish): Declared. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* string-extend: third optional argument.Kaz Kylheku2021-09-078-30/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A Boolean optional argument to string-extend indicates whether this is likely the last call to string-extend, so memory can be trimmed accordingly. * eval.c (eval_init): Update string-extend registration. * filter.c (trie_filter_string): Pass nil for new argument of string_extend. * lib.c (str_seq, replace_str, lazy_str_force, lazy_str_force_upto): Pass nil for new argument of string_extend. (rem_impl, remove_if, separate): Pass t for new argument of string_extend on last iteration, nil otherwise. (string_extend): Implement new third argument, defaulted to nil. Switch from chk_grow_vec to the more specific chk_wrealloc, which simplifies the code. * lib.h (string_extend): Declaration updated. * parser.y (litchars): Pass t as last argument of string_extend since we know syntactically that these reductions finalize the string. (restlitchar): Pass nil as the last argument of string_extend, since we know syntactically that it isn't the last. * regex.c (scan_until_common): Pass nil for new argument of string_extend. * txr.1: Documented.
* tests: no gc torture for tests/019.Kaz Kylheku2021-09-071-0/+1
| | | | | | * Makefile (tst/tests/019/%): Clear TXR_DBG_OPTS for this recently introduced directory, so txr isn't run with --gc-debug.
* ffi: ffi macro uses load-time.Kaz Kylheku2021-09-062-2/+2
| | | | | | | | | | | | | | | A number of functions take an argument which is a ffi type. Typically, this argument is produced using by a ffi-type-compile call which is produced by the ffi macro. But this ffi-type-compile call is invoked at run time, each time such a function is called. A solution for this is to have the ffi macro hoist the compilation to load time. * stdlib/ffi.tl (ffi): Add load-time wrapping to generated expression. * txr.1: Updated correspondence between (ffi ...) form and equivalent (ffi-type-compile form).
* sockets: improve socked type patch.Kaz Kylheku2021-09-061-10/+12
| | | | | | | | * socket.c (SOCK_NONBLOCK, SOCK_CLOEXEC): #define these as 0 if they are missing. (open_socket, socketpair_wrap): Clear the SOCK_NONBLOCK and SOCK_CLOEXEC flags in a single operation instead of two. Use C native arithmetic instead of Lisp logand and lognot.
* sockets: clear non-type bits after fd creation.Paul A. Patience2021-09-061-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The SOCK_NONBLOCK and SOCK_CLOEXEC non-type bits are a convenience allowed by the socket and socketpair functions, but they prevent simple comparisons with the actual socket types SOCK_STREAM, SOCK_DGRAM, etc. Before this commit, opening datagram sockets with any of these bits ORed into the type would result in TXR not realizing that such sockets were datagram sockets because the type would be compared directly with SOCK_DGRAM. Various problems would ensue, such as calling listen on a datagram socket. This commit clears the SOCK_NONBLOCK and SOCK_CLOEXEC bits after calling socket or socketpair so that the socket streams get the actual socket type. A potentially better solution would be to manually define SOCK_TYPE_MASK as 0xF (because although Linux defines it as such in include/linux/net.h, it doesn't export it to userspace) and AND it with the socket type, because clearing SOCK_NONBLOCK and SOCK_CLOEXEC will not be enough if new flags are added in the future, and it's probably more likely for that to happen than for SOCK_TYPE_MASK to be changed. * socket.c (open_socket, socketpair_wrap): Clear the SOCK_NONBLOCK and SOCK_CLOEXEC bits from the socket type after calling socket or socketpair, and before initializing the socket streams.
* sockets: make error messages more consistent.Paul A. Patience2021-09-061-17/+17
| | | | | | | | | | * socket.c (dgram_set_sock_peer): set-sock-peer -> sock-set-peer. (sock_bind, to_connect, sock_accept, socketpair_wrap): Use ~a and self in uv_throwf calls. (to_connect): Add colon after self in a uv_throwf call not reporting "failed". (sock_listen): Remove colon after self from uv_throwf call reporting "failed".
* rand: remove redundant inclusion of buf.h.Paul A. Patience2021-09-061-1/+0
| | | | * rand.c: Remove redundant inclusion of buf.h.
* doc: fix description of carray-uint type argument.Paul A. Patience2021-09-061-1/+1
| | | | | | | | The optional type argument of carray-uint and carray-int was documented as defaulting to uint, but it actually defaults to uchar. * txr.1: uint -> uchar.
* ffi: add socklen-t type.Paul A. Patience2021-09-063-18/+28
| | | | | | | | | | * ffi.c: Include <sys/socket.h> if we HAVE_SOCKETS. (ffi_init_extra_types): Initialize socklen-t type if we HAVE_SOCKETS. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* itypes: fix usage of double_intptr_t.Paul A. Patience2021-09-061-1/+1
| | | | | | | | It has actually never yet been used since its introduction in commit 543f15cdc6b77f31639d87081b35aae3f1caf84a because we never HAVE_DBL_INTPTR_T (it's a typo). * itypes.h: HAVE_DBL_INTPTR_T -> HAVE_DOUBLE_INTPTR_T.
* doc: remove beta status from quasiliteral match.Kaz Kylheku2021-09-041-5/+0
| | | | | | * txr.1: Looks like quasiliteral patterns are staying the way they are. The feature has been out for a number of releases, so can be considered out of beta.
* doc: mention newer macros in pattern matchingKaz Kylheku2021-09-041-0/+14
| | | | | * txr.1: Structural Pattern Matching info now mentions and describes the two never macros.
* load: scope change for load hooks.Kaz Kylheku2021-09-032-20/+16
| | | | | | | | | | | | | | * eval.c (run_load_hooks): Install the given environment as dyn_env temporarily, and don't restore it until after calling the hooks. Thus the specified environment is now in effect when running the hooks. Also, pass nil to lookup_var, in the spirit of the previous commit. The fact that load_dyn_env had to be passed to lookup_var previously, which is an anti-pattern, tells us that this scoping rule was a code smell. If the *load-hooks* value comes from a given dynamic environment, then those functions should be executed in exactly that environment. * txr.1: Documentation updated.
* lookup_var: don't pass dyn_env explicitly.Kaz Kylheku2021-09-033-6/+6
| | | | | | | | | | | | | Since lookup_var(nil, ...) skips the environment and goes for dyn_env, there is no need to pass dyn_env explicitly; it's a bit of an anti-pattern. The argument is intended for lexical scopes. * eval.c (eval_exception, expand_eval, load): Pass nil to lookup_var instead of the current dynamic environment. * match.c (v_load): Likewise. * parser.c (txr_parse, read_eval_ret_last): Likewise.
* load: new macros push-after-load and pop-after-load.Kaz Kylheku2021-09-034-0/+73
| | | | | | | | | | | | | * eval.c (me_push_after_load, me_pop_after_load): New static functions. (eval_init): Register push-after-load and pop-after-load intrinsic macros. * tests/019/load-hook.tl: Tests for correct expansion. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* New function: delcons.Kaz Kylheku2021-09-026-0/+110
| | | | | | | | | | | | * eval.c (eval_init): Register delcons intrinsic. * lib.[ch] (delcons): New function. * tests/010/cons.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* load: new *load-hooks* feature.Kaz Kylheku2021-09-028-5/+136
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | *load-hooks* lets a .txr, .tl or .tlo file specify actions to be taken when the loading of that file completes, whether normally or via an exception. They are also honored by process exit. For instance, with this, we can have a Lisp file that behaves like a script which cleans up after itself (e.g. removing temporary files) even if it is not run as a stand-alone program, but invoked via (load ...). Because it's not a stand-alone program, it cannot simply use the at-exit-call mechanism. The unwind-protect operator could be used, but it's inconvenient because it protects a single form. The *load-hooks* feature in effect protects all the top level forms of a load, similarly to unwind-protect. Also, unwind-protect does not guard against a process exit. (However, *load-hooks* does not guard against an abnormal exit, only normal termination). * eval.c (load_hooks_s): New symbol variable. (run_load_hooks): New function. (run_load_hooks_atexit): New static function. (load): bind *load-hooks* to nil around load. Implement the hooks processing via run_load_hooks, taking care to pass the load-time dynamic environment that has already been undone. (eval_init): Initialize load_hooks_s and register the *load-hooks* variable. Register run_load_hooks_atexit with atexit, so the current value of *load-hooks* is processed on process exit. * eval.h (load_hooks_s, run_load_hooks): Declared. * match.c (v_load): Similar changes as in load. * txr.c (txr_main): Run the load hooks with run_load_hooks immediately after processing the .txr or .tl file, before entering the listener. * tests/019/load-hook.tl: New directory and file * tests/load-hook.tl: New file. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* tags: process only files in repo.Kaz Kylheku2021-09-011-1/+2
| | | | | | | | | * libtags.txr: use git ls-files instead of glob to obtain list of .c files. This also means that we go into subdirectories now, since git ls-files '*.c' lists items like linenoise/linenoise.c and chksums/md5.c. For now, we are not finding any new tags in these places, but in the future that could change.
* compiler: fix output path of compiled files.Paul A. Patience2021-09-011-1/+1
| | | | | | | | | | | The open-compile-streams function was calling trim-right with the arguments in the wrong order, resulting in an output path equal to the suffix of the input path. Regression introduced in 8d8fee2e506806d9c117b17432ef3a5ec0d6f457. * stdlib/compiler.tl (open-compile-streams): Swap in-path and suff arguments in trim-right call.
* tags: fix warnings using @(mdo ...).Kaz Kylheku2021-08-311-10/+10
| | | | | | | * libtags.txr: Use @(mdo) for defining variables and structures, so this is done as libtags.txr is parsed. The remaining top-level actions are split off in a separate @(do ...) placed later.
* tags: add script to tag interned symbols.Paul A. Patience2021-08-312-82/+610
| | | | * libtags.txr: New file. This is a work in progress.
* Version 270.txr-270Kaz Kylheku2021-08-304-5/+28
| | | | | | | | | | * RELNOTES: Updated. * configure (txr_ver): Bumped version. * stdlib/ver.tl (lib-version): Bumped. * txr.1: Bumped version and date.
* seq_iter: some new test cases.Kaz Kylheku2021-08-301-0/+8
| | | | | * tests/012/iter.tl: Several new cases to provide some coverage in recently fixed areas. All of these break in 268.
* doc: fix reference to buf-sub.Paul A. Patience2021-08-301-2/+2
| | | | | | It should be sub-buf. * txr.1: buf-sub -> sub-buf.
* doc: fix incorrect slet description.Paul A. Patience2021-08-291-1/+1
| | | | | | slet is a stronger form of rlet, not weaker. * txr.1: weaker -> stronger.
* buf, carray: remove de trop binding in accessors.Paul A. Patience2021-08-291-6/+2
| | | | | | | | They were forgotten in commit 1fb6f6691d5b6fb6b037bb14073694f651f2b9fc. * stdlib/ffi.tl (carray-sub, sub-buf): Remove binding which ensures the new value is evaluated only once (defset does this already).
* Makefile: whitespace fix.Kaz Kylheku2021-08-291-3/+3
| | | | | * Makefile (SRCS): Fix mixture of tabs and spaces, and bad alignment, reported by Paul A. Patience.
* open-file: improvement: "a" mode sets create flag.Kaz Kylheku2021-08-291-2/+2
| | | | | | | * stream.c (w_fopen_mode): Only test the m.create flag as the basis for O_CREAT, not m.append. (do_parse_mode): In the 'a' case, set m.create = 1, since all variants of append mode create the file.
* open-file: add mode option "x".Paul A. Patience2021-08-293-5/+26
| | | | | | | | | | | | * stream.h (struct stdio_mode): New member, excl flag. (stdio_mode_init_blank, stdio_mode_init_r, stdio_mode_init_rpb): Add initializer for excl flag. * stream.c (do_parse_mode): Handle 'x' in mode string. (w_fopen_mode): Add O_EXCL flag if m.excl is set. Throw an error if we don't HAVE_FCNTL and m.excl is set. * txr.1: Document mode option "x".
* open-file: fix broken file-creation modes.Paul A. Patience2021-08-291-2/+3
| | | | | | | | The "w+", "m+" and "a+" modes wouldn't create the file. * stream.c (w_fopen_mode): Add O_TRUNC and O_CREAT flags if m.create or m.append is set, rather than if m.read is unset and m.write is set.
* seq_iter: allow mixed fixnum/bignum ranges.Kaz Kylheku2021-08-291-6/+18
| | | | | | * lib.c (seq_iter_init_with_info): The to value in a range could be a bignum, which we should treat as a bignum range, rather than blowing up due to calling c_num on that value.
* seq_iter: fix gc issues.Kaz Kylheku2021-08-292-26/+25
| | | | | | | | | | | | | | | | | | | | * lib.h (struct seq_iter_ops): New operation, mark. (seq_iter_ops_init): Default the mark operation to seq_iter_mark_op. (seq_iter_ops_init_nomark): New macro. * lib.c (seq_iter_mark_op): New static function. (si_range_cnum_ops, si_range_chr_ops, si_rev_range_cnum_ops, si_rev_range_chr_ops, si_chr_ops): Initialize with seq_iter_ops_init_nomark so that the iterator has no mark operation. All other iterator types have the above new static function as their mark op. (seq_iter_mark): Simplified: if the iterator has a mark op, call it. (seq_next, iter_step): If the iterator has a mark op, that means that the seq_get operation is likely replacing one heap object with another, and so mut(iter) must be called to inform the garbage collector of the assignment.
* seq_iter: refactoring.Kaz Kylheku2021-08-292-42/+88
| | | | | | | | | | | | | | | | | | | | | This is needed in preparation for fixing some gc bugs in iteration in a less hacky way. * lib.h (struct seq_iter): Members get and peek removed, replaced by ops pointer. (struct seq_iter_ops): New struct type. (seq_get, seq_peek): Call get and peek through ops table. * lib.c (seq_geti): Refer to get through ops. (si_null_ops, si_list_ops, si_vec_ops, si_hash_ops, si_tree_ops, si_range_cnum_ops, si_range_chr_ops, si_range_bignum_ops, si_range_str_ops, si_rev_range_cnum_ops, si_rev_range_chr_ops, si_rev_range_bignum_ops, si_rev_range_str_ops, si_chr_ops, si_num_ops, si_oop_ops, si_fast_oop_ops): New static structures. (seq_iter_init_with_info): Point new ops member of seq_iter to one of the new structures. Remove initializations of get and peek.
* Version 269.txr-269Kaz Kylheku2021-08-287-1121/+1193
| | | | | | | | | | | | | | * RELNOTES: Updated. * configure (txr_ver): Bumped version. * stdlib/ver.tl (lib-version): Bumped. * txr.1: Bumped version and date. * txr.vim, tl.vim: Regenerated. * protsym.c: Likewise.
* doc: problem with Unix Memory Mapping heading.Kaz Kylheku2021-08-281-1/+1
| | | | * txr.1: fix .SS to .SS*.
* open-file: fix broken "+" mode string.Paul A. Patience2021-08-281-2/+1
| | | | | | | | The "+" mode string should be equivalent to "r+", according to the manual, but before this change it was equivalent to "r". * stream.c (do_parse_mode): Unconditionally set m.write to 1 when "+" is present in the mode string.
* mmap test: use random-buf.Kaz Kylheku2021-08-261-4/+2
| | | | | * tests/017/mmap.tl: Use the new random-buf function instead of converting pseudo-random bignums to a buffer.
* rand: provide random-buf function.Kaz Kylheku2021-08-264-0/+67
| | | | | | | | | | | * rand.c (random_buf): New function. (rand-init): random-buf intrinsic registered. * rand.h (random_buf): Declared. * txr.1: Documented. * stdlib/doc-syms.tl: Updated.
* itypes: provide a c_size function for size_t.Kaz Kylheku2021-08-262-0/+17
| | | | * itypes.[ch] (c_size): New function.
* random: bug: 32 bit shift.Kaz Kylheku2021-08-261-3/+3
| | | | | | | | | | | * rand.c (random): The msb_rand_mask calculation shifts by 32 when msb_rand_bits is zero, like when the modulus is (expt 2 32). By fluke, this has been treated as a zero bit shift on 64 bit intel, so the correct mask was calculated. However, in a PPC64 build, it yields zero. Instead, we calculate the required shift by negating the bit count, in unsigned semantics, and then reducing modulo 32. This gives us the correct value from 0 to 31, resulting in the correct mask.
* mmap test: bug: random buffer generation.Kaz Kylheku2021-08-261-1/+2
| | | | | | | * tests/017/mmap.tl: The random buffer procedure can generate buffers which are too small, because the random integer values are anywhere from 0 to the modulus. This showed up up on PPC-64 with 65536 byte pages.
* ffi: improve support for big/little-endian types.Kaz Kylheku2021-08-261-232/+187
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Instead of byte reads/writes, we use byte order swapping. Reads and writes that are aligned take place as a single data transfer, which makes it possible to use these be/le types for accessing hardware registers. This is useful in systems where the host processor accesses the bus in opposite endian relative to some peripheral. Moreover, when the functions match the local endian, we just use the native get/put functions via #define macro redirection. The source code size is reduced. * ffi.c (ffi_swap_u16, ffi_swap_u32, ffi_swap_u64, ffi_swap_i16, ffi_swap_i32, ffi_swap_i64): New static functions. (ffi_swap_i16_put, ffi_swap_i16_get, ffi_swap_u16_put, ffi_swap_u16_get, ffi_swap_i32_put, ffi_swap_i32_get, ffi_swap_u32_put, ffi_swap_u32_get, ffi_swap_i64_put, ffi_swap_i64_get, ffi_swap_u64_put, ffi_swap_u64_get): New static functions. (ffi_be_i16_put, ffi_be_i16_get, ffi_be_u16_put, ffi_be_u16_get, ffi_be_i32_put, ffi_be_i32_get, ffi_be_u32_put, ffi_be_u32_get, ffi_be_i64_put, ffi_be_i64_get, ffi_be_u64_put, ffi_be_u64_get, ffi_le_i16_put, ffi_le_i16_get, ffi_le_u16_put, ffi_le_u16_get, ffi_le_i32_put, ffi_le_i32_get, ffi_le_u32_put, ffi_le_u32_get, ffi_le_i64_put, ffi_le_i64_get, ffi_le_u64_put, ffi_le_u64_get): Functions deleted, replaced by same-named #define macros to redirect to the native functions or the _swap_ functions based on the endian. (ffi_be_i16_rput, ffi_be_i16_rget, ffi_be_u16_rput, ffi_be_u16_rget, ffi_be_i32_rput, ffi_be_i32_rget, ffi_be_u32_rput, ffi_be_u32_rget, ffi_le_i16_rput, ffi_le_i16_rget, ffi_le_u16_rput, ffi_le_u16_rget, ffi_le_i32_rput, ffi_le_i32_rget, ffi_le_u32_rput, ffi_le_u32_rget): Functions wrapped with #if in case these exact width types don't exist. (ffi_init_types): Wrap some exact-width-type type definitions with #if in case the types don't exist.