diff options
author | Philipp Janda <siffiejoe@gmx.net> | 2017-09-16 12:57:05 +0200 |
---|---|---|
committer | Philipp Janda <siffiejoe@gmx.net> | 2017-09-16 12:57:05 +0200 |
commit | bf96f3d583e0dcd0e78f167b1d54ff90dcf0de64 (patch) | |
tree | a0fe768542ff46def4691e29935a89dcf17954b7 /c-api | |
parent | f76fb008c8297dc0a9de579c20cfe57480890688 (diff) | |
download | lua-compat-5.3-bf96f3d583e0dcd0e78f167b1d54ff90dcf0de64.tar.gz lua-compat-5.3-bf96f3d583e0dcd0e78f167b1d54ff90dcf0de64.tar.bz2 lua-compat-5.3-bf96f3d583e0dcd0e78f167b1d54ff90dcf0de64.zip |
Include lualib.h, remove #define LUA_FILEHANDLE.
This avoids warnings about redefinitions when `lualib.h` is included
after `compat-5.3.h`. Lua 5.1 only.
Also make clear that `COMPAT53_INCLUDE_SOURCE` is an internal macro by
undefining it before we use it.
Diffstat (limited to 'c-api')
-rw-r--r-- | c-api/compat-5.3.h | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index a5b10d2..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 |
@@ -87,16 +88,13 @@ extern "C" { | |||
87 | #ifndef LUA_OPLE | 88 | #ifndef LUA_OPLE |
88 | # define LUA_OPLE 2 | 89 | # define LUA_OPLE 2 |
89 | #endif | 90 | #endif |
90 | #ifndef LUA_FILEHANDLE | ||
91 | # define LUA_FILEHANDLE "FILE*" | ||
92 | #endif | ||
93 | 91 | ||
94 | /* LuaJIT/Lua 5.1 does not have the updated | 92 | /* LuaJIT/Lua 5.1 does not have the updated |
95 | * 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) |
96 | * define it only if it's not found | 94 | * define it only if it's not found |
97 | */ | 95 | */ |
98 | #if !defined(LUA_ERRGCMM) | 96 | #if !defined(LUA_ERRGCMM) |
99 | /* Use + 2 because in some versions of Lua (Lua 5.1) | 97 | /* Use + 2 because in some versions of Lua (Lua 5.1) |
100 | * LUA_ERRFILE is defined as (LUA_ERRERR+1) | 98 | * LUA_ERRFILE is defined as (LUA_ERRERR+1) |
101 | * 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 |
102 | * integer value too) | 100 | * integer value too) |
@@ -115,8 +113,7 @@ typedef struct luaL_Buffer_53 { | |||
115 | } luaL_Buffer_53; | 113 | } luaL_Buffer_53; |
116 | #define luaL_Buffer luaL_Buffer_53 | 114 | #define luaL_Buffer luaL_Buffer_53 |
117 | 115 | ||
118 | /* | 116 | /* In PUC-Rio 5.1, userdata is a simple FILE* |
119 | * In PUC-Rio 5.1, userdata is a simple FILE* | ||
120 | * In LuaJIT, it's a struct where the first member is a FILE* | 117 | * In LuaJIT, it's a struct where the first member is a FILE* |
121 | * We can't support the `closef` member | 118 | * We can't support the `closef` member |
122 | */ | 119 | */ |