diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2022-03-15 07:50:09 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2022-03-15 07:50:09 -0700 |
commit | c80dc667dbcfa47b8a01c7f1ae0da43d4158086b (patch) | |
tree | efb2ada5789c3ba157b44071463bebdb3ebed394 /ffi.c | |
parent | e0f19f2e697665b63a6a665e373d23ebf63eb925 (diff) | |
download | txr-c80dc667dbcfa47b8a01c7f1ae0da43d4158086b.tar.gz txr-c80dc667dbcfa47b8a01c7f1ae0da43d4158086b.tar.bz2 txr-c80dc667dbcfa47b8a01c7f1ae0da43d4158086b.zip |
ffi: support intmax-t and uintmax-t types.
* configure: detect intmax_t and place HAVE_INTMAX_T into
config.h.
* ffi.c (ffi_init_extra_types): register intmax-t and
uintmax-t types. If HAVE_INTMAX_T is missing, then make them
aliases for longlong and ulonglong.
* txr.1: Documented.
* stdlib/doc-syms.tl: Updated.
Diffstat (limited to 'ffi.c')
-rw-r--r-- | ffi.c | 18 |
1 files changed, 18 insertions, 0 deletions
@@ -38,6 +38,9 @@ #include <wchar.h> #include <time.h> #include "config.h" +#if HAVE_INTMAX_T +#include <stdint.h> +#endif #if HAVE_LIBFFI #include <ffi.h> #endif @@ -4702,6 +4705,21 @@ static void ffi_init_extra_types(void) ffi_typedef(intern(lit("wint-t"), user_package), type_by_size[convert(wint_t, -1) > 0][sizeof (wint_t)]); + { +#if HAVE_INTMAX_T + typedef intmax_t imax_t; +#else + typedef long long imax_t; +#endif + + if (sizeof(imax_t) <= 8) { + ffi_typedef(intern(lit("intmax-t"), user_package), + type_by_size[0][sizeof (imax_t)]); + ffi_typedef(intern(lit("uintmax-t"), user_package), + type_by_size[1][sizeof (imax_t)]); + } + } + #if HAVE_SYS_TYPES_H ffi_typedef(intern(lit("blkcnt-t"), user_package), type_by_size[convert(blkcnt_t, -1) > 0][sizeof (blkcnt_t)]); |