Skip to content

Commit decc65d

Browse files
committed
Squashed 'vendor/compat-5.3/' changes from 77aa564..daebe77
daebe77 Fix feature test for C11 Annex K (strerror_s). d48f7f5 Provide strict lua_tointegerx for Lua 5.2 as well. 340f2f4 lua_tointeger(x) rejects non-ints for Lua 5.1. 30077d2 Verify that lua_getuservalue returns type. bc91f40 Merge pull request #38 from ThePhD/warnings/vcxx 3615e44 fix VC warnings for integer down-conversions to char db8446d Merge pull request #37 from keplerproject/strerror 447deca Add braces and suppress warning. b782901 Do less stuff when sz is 0 in compat53_strerror(). 9895acb Transparently handle GNU/XSI strerror_r. 9cb6834 Add Travis-CI integration ee2d198 Fix links in the README.md. c381aa3 Merge branch 'ThePhD-feature/luaL_loadfilebufferx' 09b201c Add tests for `luaL_load{buffer,file}x`. 3b52d81 Add Lua 5.3 version of `lua_load`. 8425f99 Merge branch 'feature/luaL_loadfilebufferx' of https://github.com/ThePhD/lua-compat-5.3 into ThePhD-feature/luaL_loadfilebufferx 9435c6c Merge branch 'daurnimator-luaL_Stream' bf96f3d Include lualib.h, remove #define LUA_FILEHANDLE. f76fb00 Merge branch 'luaL_Stream' of https://github.com/daurnimator/lua-compat-5.3 into daurnimator-luaL_Stream 7fc7aba Merge branch 'ThePhD-fix/lua_Number_casts' ee862eb Merge branch 'fix/lua_Number_casts' of https://github.com/ThePhD/lua-compat-5.3 into ThePhD-fix/lua_Number_casts f3b1160 Merge branch 'ThePhD-feature/LUA_ERRGCMM' 73a7b6b fix usage of tabs 0c9d432 fix `lua_Integer` casts that error on Visual C++ and other pedantic conversion-warning compilers for 64-bit builds 7320d58 define LUA_ERRGCMM code for return values 6065d10 update readme 8ee5245 implement luaL_loadbufferx and luaL_loadfilex 0821294 Merge pull request #26 from daurnimator/lua_resume c0a59dd Add (partial) luaL_Stream definition c0db566 Add LUA_FILEHANDLE define 690239b Add lua_resume 1037026 Merge pull request #24 from daurnimator/implicit-fallthrough a3f456a Use FALLTHROUGH annotation to fix -Wimplicit-fallthrough warning 6f3deea Add rockspec for new minor release. 7bc1476 Put parens around L macro parameter as well. 818e129 Update backports to Lua 5.3.4. aeb0720 Provide fixed luaL_tolstring for Lua 5.2 as well. 30144ee Fix compilation for older versions of Lua 5.3. 8ecb0d1 Add parens around macro arguments. 4e54e82 Handle lua_pushlstring edge case for Lua 5.2 too. 8b399a1 Merge branch 'daurnimator-pushstring-return' 67aabb8 Handle edge case for lua_pushlstring(). Add test. 3931e7f Add lua_pushlstring (return value) ace784b Have lua_pushstring return the pushed string 7ceb999 Add rockspec for new minor release. 574c090 Add tests for luaL_tolstring and string.pack. b1abaff Update behavior of luaL_tolstring(). f608371 Fix compilation issues with recent LuaJIT 2.1. 8b2d71e Fix lua_len and luaL_len to use lua_Integer. 80588ca Merge pull request #18 from jvprat/loadstring 0e4c9fc Fix loadstring on Lua 5.1 c3013bd Merge pull request #17 from jvprat/os_execute ee34136 Fix the return code of os.execute() on Windows. 2c732b8 Simplify utf8 helper function. af8c489 Add tests for utf8 backport. ca85188 Update backports. abf4ea9 OSX is a Unix. ce386e1 Add rockspec for version 0.3. git-subtree-dir: vendor/compat-5.3 git-subtree-split: daebe77a2f498817713df37f0bb316db1d82222f
1 parent 77aa564 commit decc65d

File tree

14 files changed

+1386
-480
lines changed

14 files changed

+1386
-480
lines changed

.travis.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
language: c
2+
compiler: gcc
3+
4+
sudo: false
5+
6+
env:
7+
- LUA="lua=5.1"
8+
- LUA="lua=5.1" EXTERNAL=true
9+
- LUA="lua=5.1" COMPILER="g++"
10+
- LUA="lua=5.1" EXTERNAL=true COMPILER="g++"
11+
- LUA="[email protected] --compat=none"
12+
- LUA="[email protected] --compat=none" EXTERNAL=true
13+
- LUA="[email protected] --compat=all"
14+
- LUA="[email protected] --compat=all" EXTERNAL=true
15+
- LUA="lua=5.2"
16+
- LUA="lua=5.2" EXTERNAL=true
17+
- LUA="lua=5.2" COMPILER="g++"
18+
- LUA="lua=5.2" EXTERNAL=true COMPILER="g++"
19+
20+
branches:
21+
only:
22+
- master
23+
24+
git:
25+
depth: 3
26+
27+
notifications:
28+
email: false
29+
30+
before_install:
31+
- pip install --user hererocks
32+
- hererocks old --$LUA
33+
- test -e old/bin/lua || (cd old/bin && ln -s luajit* lua)
34+
- hererocks new --lua=5.3
35+
36+
install:
37+
- export CC="${COMPILER:-gcc}" DEF="" SRC="" CFLAGS="-Wall -Wextra -Ic-api -O2 -fPIC"
38+
- if [ "x${EXTERNAL:-}" = xtrue ]; then DEF="-DCOMPAT53_PREFIX=compat53" SRC="c-api/compat-5.3.c"; fi
39+
- ${CC} ${CFLAGS} -Iold/include ${DEF} -shared -o old/testmod.so tests/testmod.c ${SRC}
40+
- ${CC} ${CFLAGS} -Inew/include ${DEF} -shared -o new/testmod.so tests/testmod.c ${SRC}
41+
- gcc ${CFLAGS} -Iold/include ${DEF} -shared -o old/compat53.so ltablib.c lutf8lib.c lstrlib.c ${SRC}
42+
43+
script:
44+
- (cd old && bin/lua ../tests/test.lua) > old.txt
45+
- (cd new && bin/lua ../tests/test.lua) > new.txt
46+
- diff old.txt new.txt || true
47+

README.md

Lines changed: 25 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Build Status](https://travis-ci.org/keplerproject/lua-compat-5.3.svg?branch=master)](https://travis-ci.org/keplerproject/lua-compat-5.3)
2+
13
# lua-compat-5.3
24

35
Lua-5.3-style APIs for Lua 5.2 and 5.1.
@@ -72,7 +74,11 @@ your project:
7274
compatibility functions in your code. You have to compile and link
7375
`compat-5.3.c` to your project yourself. You can change the way the
7476
functions are exported using the `COMPAT53_API` macro (e.g. if you need
75-
some `__declspec` magic).
77+
some `__declspec` magic). While it is technically possible to use
78+
the "lua" prefix (and it looks better in the debugger), this is
79+
discouraged because LuaJIT has started to implement its own Lua 5.2+
80+
C API functions, and with the "lua" prefix you'd violate the
81+
one-definition rule with recent LuaJIT versions.
7682

7783
## What's implemented
7884

@@ -129,6 +135,7 @@ For Lua 5.1 additionally:
129135
* `lua_isinteger`
130136
* `lua_numbertointeger`
131137
* `lua_callk` and `lua_pcallk` (limited compatibility, see [here][14])
138+
* `lua_resume`
132139
* `lua_rawget` and `lua_rawgeti` (return values)
133140
* `lua_rawgetp` and `lua_rawsetp`
134141
* `luaL_requiref` (now checks `package.loaded` first)
@@ -137,12 +144,17 @@ For Lua 5.1 additionally:
137144

138145
For Lua 5.1 additionally:
139146
* `LUA_OK`
147+
* `LUA_ERRGCMM`
140148
* `LUA_OP*` macros for `lua_arith` and `lua_compare`
149+
* `LUA_FILEHANDLE`
141150
* `lua_Unsigned`
151+
* `luaL_Stream` (limited compatibility, see [here][19])
142152
* `lua_absindex`
143-
* `lua_arith` (see [here][19])
153+
* `lua_arith` (see [here][20])
144154
* `lua_compare`
145155
* `lua_len`, `lua_rawlen`, and `luaL_len`
156+
* `lua_load` (mode argument)
157+
* `lua_pushstring`, `lua_pushlstring` (return value)
146158
* `lua_copy`
147159
* `lua_pushglobaltable`
148160
* `luaL_testudata`
@@ -152,11 +164,13 @@ For Lua 5.1 additionally:
152164
* `luaL_traceback`
153165
* `luaL_execresult`
154166
* `luaL_fileresult`
167+
* `luaL_loadbufferx`
168+
* `luaL_loadfilex`
155169
* `luaL_checkversion` (with empty body, only to avoid compile errors,
156-
see [here][20])
170+
see [here][21])
157171
* `luaL_tolstring`
158172
* `luaL_buffinitsize`, `luaL_prepbuffsize`, and `luaL_pushresultsize`
159-
(see [here][21])
173+
(see [here][22])
160174
* `lua_pushunsigned`, `lua_tounsignedx`, `lua_tounsigned`,
161175
`luaL_checkunsigned`, `luaL_optunsigned`, if
162176
`LUA_COMPAT_APIINTCASTS` is defined.
@@ -179,8 +193,6 @@ For Lua 5.1 additionally:
179193
* `lua_upvaluejoin` (5.1)
180194
* `lua_version` (5.1)
181195
* `lua_yieldk` (5.1)
182-
* `luaL_loadbufferx` (5.1)
183-
* `luaL_loadfilex` (5.1)
184196

185197
## See also
186198

@@ -197,6 +209,8 @@ This package contains code written by:
197209
* Tomás Guisasola Gorham ([@tomasguisasola](http://github.com/tomasguisasola))
198210
* Hisham Muhammad ([@hishamhm](http://github.com/hishamhm))
199211
* Renato Maia ([@renatomaia](http://github.com/renatomaia))
212+
* [@ThePhD](http://github.com/ThePhD)
213+
* [@Daurnimator](http://github.com/Daurnimator)
200214

201215

202216
[1]: http://www.inf.puc-rio.br/~roberto/struct/
@@ -217,8 +231,9 @@ This package contains code written by:
217231
[16]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_getuservalue
218232
[17]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_setuservalue
219233
[18]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_stringtonumber
220-
[19]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith
221-
[20]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion
222-
[21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer
223-
[22]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running
234+
[19]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Stream
235+
[20]: https://github.com/keplerproject/lua-compat-5.3/wiki/lua_arith
236+
[21]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_checkversion
237+
[22]: https://github.com/keplerproject/lua-compat-5.3/wiki/luaL_Buffer
238+
[23]: https://github.com/keplerproject/lua-compat-5.3/wiki/coroutine.running
224239

0 commit comments

Comments
 (0)