diff options
| author | Philipp Janda <siffiejoe@gmx.net> | 2017-09-16 13:09:49 +0200 |
|---|---|---|
| committer | Philipp Janda <siffiejoe@gmx.net> | 2017-09-16 13:09:49 +0200 |
| commit | 9435c6c2e1f1373a5a9ffdb85a1a63ee0b7e6057 (patch) | |
| tree | a0fe768542ff46def4691e29935a89dcf17954b7 /c-api | |
| parent | 7fc7aba7defda15b7f9c56282e585eb91379fe3b (diff) | |
| parent | bf96f3d583e0dcd0e78f167b1d54ff90dcf0de64 (diff) | |
| download | lua-compat-5.3-9435c6c2e1f1373a5a9ffdb85a1a63ee0b7e6057.tar.gz lua-compat-5.3-9435c6c2e1f1373a5a9ffdb85a1a63ee0b7e6057.tar.bz2 lua-compat-5.3-9435c6c2e1f1373a5a9ffdb85a1a63ee0b7e6057.zip | |
Merge branch 'daurnimator-luaL_Stream'
Diffstat (limited to 'c-api')
| -rw-r--r-- | c-api/compat-5.3.h | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index 6c76930..d8e6827 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h | |||
| @@ -9,11 +9,13 @@ extern "C" { | |||
| 9 | #endif | 9 | #endif |
| 10 | #include <lua.h> | 10 | #include <lua.h> |
| 11 | #include <lauxlib.h> | 11 | #include <lauxlib.h> |
| 12 | #include <lualib.h> | ||
| 12 | #if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP) | 13 | #if defined(__cplusplus) && !defined(COMPAT53_LUA_CPP) |
| 13 | } | 14 | } |
| 14 | #endif | 15 | #endif |
| 15 | 16 | ||
| 16 | 17 | ||
| 18 | #undef COMPAT53_INCLUDE_SOURCE | ||
| 17 | #if defined(COMPAT53_PREFIX) | 19 | #if defined(COMPAT53_PREFIX) |
| 18 | /* - change the symbol names of functions to avoid linker conflicts | 20 | /* - change the symbol names of functions to avoid linker conflicts |
| 19 | * - compat-5.3.c needs to be compiled (and linked) separately | 21 | * - compat-5.3.c needs to be compiled (and linked) separately |
| @@ -21,7 +23,6 @@ extern "C" { | |||
| 21 | # if !defined(COMPAT53_API) | 23 | # if !defined(COMPAT53_API) |
| 22 | # define COMPAT53_API extern | 24 | # define COMPAT53_API extern |
| 23 | # endif | 25 | # endif |
| 24 | # undef COMPAT53_INCLUDE_SOURCE | ||
| 25 | #else /* COMPAT53_PREFIX */ | 26 | #else /* COMPAT53_PREFIX */ |
| 26 | /* - make all functions static and include the source. | 27 | /* - make all functions static and include the source. |
| 27 | * - compat-5.3.c doesn't need to be compiled (and linked) separately | 28 | * - compat-5.3.c doesn't need to be compiled (and linked) separately |
| @@ -88,12 +89,12 @@ extern "C" { | |||
| 88 | # define LUA_OPLE 2 | 89 | # define LUA_OPLE 2 |
| 89 | #endif | 90 | #endif |
| 90 | 91 | ||
| 91 | /* LuaJIT/Lua 5.1 does not have the updated | 92 | /* LuaJIT/Lua 5.1 does not have the updated |
| 92 | * error codes for thread status/function returns (but some patched versions do) | 93 | * error codes for thread status/function returns (but some patched versions do) |
| 93 | * define it only if it's not found | 94 | * define it only if it's not found |
| 94 | */ | 95 | */ |
| 95 | #if !defined(LUA_ERRGCMM) | 96 | #if !defined(LUA_ERRGCMM) |
| 96 | /* Use + 2 because in some versions of Lua (Lua 5.1) | 97 | /* Use + 2 because in some versions of Lua (Lua 5.1) |
| 97 | * LUA_ERRFILE is defined as (LUA_ERRERR+1) | 98 | * LUA_ERRFILE is defined as (LUA_ERRERR+1) |
| 98 | * so we need to avoid it (LuaJIT might have something at this | 99 | * so we need to avoid it (LuaJIT might have something at this |
| 99 | * integer value too) | 100 | * integer value too) |
| @@ -112,6 +113,14 @@ typedef struct luaL_Buffer_53 { | |||
| 112 | } luaL_Buffer_53; | 113 | } luaL_Buffer_53; |
| 113 | #define luaL_Buffer luaL_Buffer_53 | 114 | #define luaL_Buffer luaL_Buffer_53 |
| 114 | 115 | ||
| 116 | /* In PUC-Rio 5.1, userdata is a simple FILE* | ||
| 117 | * In LuaJIT, it's a struct where the first member is a FILE* | ||
| 118 | * We can't support the `closef` member | ||
| 119 | */ | ||
| 120 | typedef struct luaL_Stream { | ||
| 121 | FILE *f; | ||
| 122 | } luaL_Stream; | ||
| 123 | |||
| 115 | #define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex) | 124 | #define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex) |
| 116 | COMPAT53_API int lua_absindex (lua_State *L, int i); | 125 | COMPAT53_API int lua_absindex (lua_State *L, int i); |
| 117 | 126 | ||
