diff options
Diffstat (limited to 'source/luametatex/source/luacore/lua54')
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/llimits.h | 21 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/loslib.c | 17 | ||||
-rw-r--r-- | source/luametatex/source/luacore/lua54/src/luaconf.h | 6 |
3 files changed, 28 insertions, 16 deletions
diff --git a/source/luametatex/source/luacore/lua54/src/llimits.h b/source/luametatex/source/luacore/lua54/src/llimits.h index 52a32f92e..251a27021 100644 --- a/source/luametatex/source/luacore/lua54/src/llimits.h +++ b/source/luametatex/source/luacore/lua54/src/llimits.h @@ -71,11 +71,24 @@ typedef signed char ls_byte; /* -** conversion of pointer to unsigned integer: -** this is for hashing only; there is no problem if the integer -** cannot hold the whole pointer value +** conversion of pointer to unsigned integer: this is for hashing only; +** there is no problem if the integer cannot hold the whole pointer +** value. (In strict ISO C this may cause undefined behavior, but no +** actual machine seems to bother.) */ -#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX)) +#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 199901L +#include <stdint.h> +#if defined(UINTPTR_MAX) /* even in C99 this type is optional */ +#define L_P2I uintptr_t +#else /* no 'intptr'? */ +#define L_P2I uintmax_t /* use the largerst available integer */ +#endif +#else /* C89 option */ +#define L_P2I size_t +#endif + +#define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX)) diff --git a/source/luametatex/source/luacore/lua54/src/loslib.c b/source/luametatex/source/luacore/lua54/src/loslib.c index 7eb05cafd..89ac06bc4 100644 --- a/source/luametatex/source/luacore/lua54/src/loslib.c +++ b/source/luametatex/source/luacore/lua54/src/loslib.c @@ -138,21 +138,14 @@ /* }================================================================== */ -/* -** Despite claiming to be ISO, the C library in some Apple platforms -** does not implement 'system'. -*/ -#if !defined(l_system) && defined(__APPLE__) /* { */ -#include "TargetConditionals.h" -#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV -#define l_system(cmd) ((cmd) == NULL ? 0 : -1) -#endif -#endif /* } */ - #if !defined(l_system) +#if defined(LUA_USE_IOS) +/* Despite claiming to be ISO C, iOS does not implement 'system'. */ +#define l_system(cmd) ((cmd) == NULL ? 0 : -1) +#else #define l_system(cmd) system(cmd) /* default definition */ #endif - +#endif static int os_execute (lua_State *L) { diff --git a/source/luametatex/source/luacore/lua54/src/luaconf.h b/source/luametatex/source/luacore/lua54/src/luaconf.h index e4650fbce..137103ede 100644 --- a/source/luametatex/source/luacore/lua54/src/luaconf.h +++ b/source/luametatex/source/luacore/lua54/src/luaconf.h @@ -70,6 +70,12 @@ #endif +#if defined(LUA_USE_IOS) +#define LUA_USE_POSIX +#define LUA_USE_DLOPEN +#endif + + /* @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. */ |