diff options
author | daurnimator <quae@daurnimator.com> | 2017-09-08 18:24:30 +1000 |
---|---|---|
committer | daurnimator <quae@daurnimator.com> | 2017-09-08 18:24:30 +1000 |
commit | c0a59dda383c37fdeb786de7b3fc4e58e2ab886d (patch) | |
tree | d153c872d4f5a7a2bdb4db12f69df193976c7579 | |
parent | c0db566ba0a42d5beebce46ba1af9273c85d7536 (diff) | |
download | lua-compat-5.3-c0a59dda383c37fdeb786de7b3fc4e58e2ab886d.tar.gz lua-compat-5.3-c0a59dda383c37fdeb786de7b3fc4e58e2ab886d.tar.bz2 lua-compat-5.3-c0a59dda383c37fdeb786de7b3fc4e58e2ab886d.zip |
Add (partial) luaL_Stream definition
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | c-api/compat-5.3.h | 9 |
2 files changed, 17 insertions, 6 deletions
@@ -144,8 +144,9 @@ For Lua 5.1 additionally: | |||
144 | * `LUA_OP*` macros for `lua_arith` and `lua_compare` | 144 | * `LUA_OP*` macros for `lua_arith` and `lua_compare` |
145 | * `LUA_FILEHANDLE` | 145 | * `LUA_FILEHANDLE` |
146 | * `lua_Unsigned` | 146 | * `lua_Unsigned` |
147 | * `luaL_Stream` (limited compatibility, see[here][19]) | ||
147 | * `lua_absindex` | 148 | * `lua_absindex` |
148 | * `lua_arith` (see [here][19]) | 149 | * `lua_arith` (see [here][20]) |
149 | * `lua_compare` | 150 | * `lua_compare` |
150 | * `lua_len`, `lua_rawlen`, and `luaL_len` | 151 | * `lua_len`, `lua_rawlen`, and `luaL_len` |
151 | * `lua_pushstring`, `lua_pushlstring` (return value) | 152 | * `lua_pushstring`, `lua_pushlstring` (return value) |
@@ -159,10 +160,10 @@ For Lua 5.1 additionally: | |||
159 | * `luaL_execresult` | 160 | * `luaL_execresult` |
160 | * `luaL_fileresult` | 161 | * `luaL_fileresult` |
161 | * `luaL_checkversion` (with empty body, only to avoid compile errors, | 162 | * `luaL_checkversion` (with empty body, only to avoid compile errors, |
162 | see [here][20]) | 163 | see [here][21]) |
163 | * `luaL_tolstring` | 164 | * `luaL_tolstring` |
164 | * `luaL_buffinitsize`, `luaL_prepbuffsize`, and `luaL_pushresultsize` | 165 | * `luaL_buffinitsize`, `luaL_prepbuffsize`, and `luaL_pushresultsize` |
165 | (see [here][21]) | 166 | (see [here][22]) |
166 | * `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`, | 167 | * `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`, |
167 | `luaL_checkunsigned`, `luaL_optunsigned`, if | 168 | `luaL_checkunsigned`, `luaL_optunsigned`, if |
168 | `LUA_COMPAT_APIINTCASTS` is defined. | 169 | `LUA_COMPAT_APIINTCASTS` is defined. |
@@ -224,7 +225,8 @@ This package contains code written by: | |||
224 | [17]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_setuservalue | 225 | [17]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_setuservalue |
225 | [18]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_stringtonumber | 226 | [18]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_stringtonumber |
226 | [19]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith | 227 | [19]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith |
227 | [20]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion | 228 | [20]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Stream |
228 | [21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer | 229 | [21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion |
229 | [22]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running | 230 | [22]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer |
231 | [23]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running | ||
230 | 232 | ||
diff --git a/c-api/compat-5.3.h b/c-api/compat-5.3.h index 886b5ba..02712f3 100644 --- a/c-api/compat-5.3.h +++ b/c-api/compat-5.3.h | |||
@@ -102,6 +102,15 @@ typedef struct luaL_Buffer_53 { | |||
102 | } luaL_Buffer_53; | 102 | } luaL_Buffer_53; |
103 | #define luaL_Buffer luaL_Buffer_53 | 103 | #define luaL_Buffer luaL_Buffer_53 |
104 | 104 | ||
105 | /* | ||
106 | * In PUC-Rio 5.1, userdata is a simple FILE* | ||
107 | * In LuaJIT, it's a struct where the first member is a FILE* | ||
108 | * We can't support the `closef` member | ||
109 | */ | ||
110 | typedef struct luaL_Stream { | ||
111 | FILE *f; | ||
112 | } luaL_Stream; | ||
113 | |||
105 | #define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex) | 114 | #define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex) |
106 | COMPAT53_API int lua_absindex (lua_State *L, int i); | 115 | COMPAT53_API int lua_absindex (lua_State *L, int i); |
107 | 116 | ||