diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-02-02 13:47:28 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-02-02 13:47:28 -0300 |
| commit | 8c064fdc23bd745bbd3456a58cc9e2521f8e4263 (patch) | |
| tree | 432ab16b342f39fab40e050ff4431fbfc8c60cf2 | |
| parent | 8dea54877a5e7b0a461b076e79fdc8b47d7e39e6 (diff) | |
| parent | cf08915d62e338c987b71c078b148490510e9fe7 (diff) | |
| download | lua-8c064fdc23bd745bbd3456a58cc9e2521f8e4263.tar.gz lua-8c064fdc23bd745bbd3456a58cc9e2521f8e4263.tar.bz2 lua-8c064fdc23bd745bbd3456a58cc9e2521f8e4263.zip | |
Merge branch 'master' into nextversion
| -rw-r--r-- | llimits.h | 21 | ||||
| -rw-r--r-- | loslib.c | 11 | ||||
| -rw-r--r-- | luaconf.h | 6 |
3 files changed, 33 insertions, 5 deletions
| @@ -70,11 +70,24 @@ typedef signed char ls_byte; | |||
| 70 | 70 | ||
| 71 | 71 | ||
| 72 | /* | 72 | /* |
| 73 | ** conversion of pointer to unsigned integer: | 73 | ** conversion of pointer to unsigned integer: this is for hashing only; |
| 74 | ** this is for hashing only; there is no problem if the integer | 74 | ** there is no problem if the integer cannot hold the whole pointer |
| 75 | ** cannot hold the whole pointer value | 75 | ** value. (In strict ISO C this may cause undefined behavior, but no |
| 76 | ** actual machine seems to bother.) | ||
| 76 | */ | 77 | */ |
| 77 | #define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX)) | 78 | #if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ |
| 79 | __STDC_VERSION__ >= 199901L | ||
| 80 | #include <stdint.h> | ||
| 81 | #if defined(UINTPTR_MAX) /* even in C99 this type is optional */ | ||
| 82 | #define L_P2I uintptr_t | ||
| 83 | #else /* no 'intptr'? */ | ||
| 84 | #define L_P2I uintmax_t /* use the largerst available integer */ | ||
| 85 | #endif | ||
| 86 | #else /* C89 option */ | ||
| 87 | #define L_P2I size_t | ||
| 88 | #endif | ||
| 89 | |||
| 90 | #define point2uint(p) ((unsigned int)((L_P2I)(p) & UINT_MAX)) | ||
| 78 | 91 | ||
| 79 | 92 | ||
| 80 | 93 | ||
| @@ -138,12 +138,21 @@ | |||
| 138 | /* }================================================================== */ | 138 | /* }================================================================== */ |
| 139 | 139 | ||
| 140 | 140 | ||
| 141 | #if !defined(l_system) | ||
| 142 | #if defined(LUA_USE_IOS) | ||
| 143 | /* Despite claiming to be ISO C, iOS does not implement 'system'. */ | ||
| 144 | #define l_system(cmd) ((cmd) == NULL ? 0 : -1) | ||
| 145 | #else | ||
| 146 | #define l_system(cmd) system(cmd) /* default definition */ | ||
| 147 | #endif | ||
| 148 | #endif | ||
| 149 | |||
| 141 | 150 | ||
| 142 | static int os_execute (lua_State *L) { | 151 | static int os_execute (lua_State *L) { |
| 143 | const char *cmd = luaL_optstring(L, 1, NULL); | 152 | const char *cmd = luaL_optstring(L, 1, NULL); |
| 144 | int stat; | 153 | int stat; |
| 145 | errno = 0; | 154 | errno = 0; |
| 146 | stat = system(cmd); | 155 | stat = l_system(cmd); |
| 147 | if (cmd != NULL) | 156 | if (cmd != NULL) |
| 148 | return luaL_execresult(L, stat); | 157 | return luaL_execresult(L, stat); |
| 149 | else { | 158 | else { |
| @@ -70,6 +70,12 @@ | |||
| 70 | #endif | 70 | #endif |
| 71 | 71 | ||
| 72 | 72 | ||
| 73 | #if defined(LUA_USE_IOS) | ||
| 74 | #define LUA_USE_POSIX | ||
| 75 | #define LUA_USE_DLOPEN | ||
| 76 | #endif | ||
| 77 | |||
| 78 | |||
| 73 | /* | 79 | /* |
| 74 | @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. | 80 | @@ LUAI_IS32INT is true iff 'int' has (at least) 32 bits. |
| 75 | */ | 81 | */ |
