Coder Social home page Coder Social logo

lua-compat-5.3's Introduction

Compat53 Status Bit32 Status

lua-compat-5.3

Lua-5.3-style APIs for Lua 5.2 and 5.1.

What is it

This is a small module that aims to make it easier to write code in a Lua-5.3-style that is compatible with Lua 5.1, Lua 5.2, and Lua 5.3. This does not make Lua 5.2 (or even Lua 5.1) entirely compatible with Lua 5.3, but it brings the API closer to that of Lua 5.3.

It includes:

  • For writing Lua: The Lua module compat53, which can be require'd from Lua scripts and run in Lua 5.1, 5.2, and 5.3, including a backport of the utf8 module, the 5.3 table module, and the string packing functions straight from the Lua 5.3 sources.
  • For writing C: A C header and file which can be linked to your Lua module written in C, providing some functions from the C API of Lua 5.3 that do not exist in Lua 5.2 or 5.1, making it easier to write C code that compiles with all three versions of liblua.

How to use it

Lua module

require("compat53")

compat53 makes changes to your global environment and does not return a meaningful return value, so the usual idiom of storing the return of require in a local variable makes no sense.

When run under Lua 5.3+, this module does nothing.

When run under Lua 5.2 or 5.1, it replaces some of your standard functions and adds new ones to bring your environment closer to that of Lua 5.3. It also tries to load the backported utf8, table, and string packing modules automatically. If unsuccessful, pure Lua versions of the new table functions are used as a fallback, and Roberto's struct library is tried for string packing.

Lua submodules

local _ENV = require("compat53.module")
if setfenv then setfenv(1, _ENV) end

The compat53.module module does not modify the global environment, and so it is safe to use in modules without affecting other Lua files. It is supposed to be set as the current environment (see above), i.e. cherry picking individual functions from this module is expressly not supported!). Not all features are available when using this module (e.g. yieldable (x)pcall support, string/file methods, etc.), so it is recommended to use plain require("compat53") whenever possible.

C code

There are two ways of adding the C API compatibility functions/macros to your project:

  • If COMPAT53_PREFIX is not #defined, compat-5.3.h #includes compat-5.3.c, and all functions are made static. You don't have to compile/link/add compat-5.3.c yourself. This is useful for one-file projects.
  • If COMPAT53_PREFIX is #defined, all exported functions are renamed behind the scenes using this prefix to avoid linker conflicts with other code using this package. This doesn't change the way you call the compatibility functions in your code. You have to compile and link compat-5.3.c to your project yourself. You can change the way the functions are exported using the COMPAT53_API macro (e.g. if you need some __declspec magic). While it is technically possible to use the "lua" prefix (and it looks better in the debugger), this is discouraged because LuaJIT has started to implement its own Lua 5.2+ C API functions, and with the "lua" prefix you'd violate the one-definition rule with recent LuaJIT versions.

What's implemented

Lua

  • the utf8 module backported from the Lua 5.3 sources
  • string.pack, string.packsize, and string.unpack from the Lua 5.3 sources or from the struct module. (struct is not 100% compatible to Lua 5.3's string packing!) (See here)
  • math.maxinteger and math.mininteger, math.tointeger, math.type, and math.ult (see here)
  • assert accepts non-string error messages
  • ipairs respects __index metamethod
  • table.move
  • table library respects metamethods

For Lua 5.1 additionally:

  • load and loadfile accept mode and env parameters
  • table.pack and table.unpack
  • string patterns may contain embedded zeros (but see here)
  • string.rep accepts sep argument
  • string.format calls tostring on arguments for %s
  • math.log accepts base argument
  • xpcall takes additional arguments
  • pcall and xpcall can execute functions that yield (see here for a possible problem with coroutine.running)
  • pairs respects __pairs metamethod (see here)
  • rawlen (but # still doesn't respect __len for tables)
  • package.searchers as alias for package.loaders
  • package.searchpath (see here)
  • coroutine functions dealing with the main coroutine (see here for a possible problem with coroutine.running)
  • coroutine.create accepts functions written in C
  • return code of os.execute (see here)
  • io.write and file:write return file handle
  • io.lines and file:lines accept format arguments (like io.read) (see here and here)
  • file:close returns three results when a process is opened with io.popen
  • debug.setmetatable returns object
  • debug.getuservalue (see here)
  • debug.setuservalue (see here)

C

  • lua_KContext (see here)
  • lua_KFunction (see here)
  • lua_dump (extra strip parameter, ignored, see here)
  • lua_getextraspace (limited compatibilitiy, see here)
  • lua_getfield (return value)
  • lua_geti and lua_seti
  • lua_getglobal (return value)
  • lua_getmetafield (return value)
  • lua_gettable (return value)
  • lua_getuservalue (limited compatibility, see here)
  • lua_setuservalue (limited compatibility, see here)
  • lua_isinteger
  • lua_numbertointeger
  • lua_callk and lua_pcallk (limited compatibility, see here)
  • lua_resume
  • lua_rawget and lua_rawgeti (return values)
  • lua_rawgetp and lua_rawsetp
  • luaL_requiref (now checks package.loaded first)
  • lua_rotate
  • lua_stringtonumber (see here)

For Lua 5.1 additionally:

  • LUA_OK
  • LUA_ERRGCMM
  • LUA_OP* macros for lua_arith and lua_compare
  • LUA_FILEHANDLE
  • lua_Unsigned
  • luaL_Stream (limited compatibility, see here)
  • lua_absindex
  • lua_arith (see here)
  • lua_compare
  • lua_len, lua_rawlen, and luaL_len
  • lua_load (mode argument)
  • lua_pushstring, lua_pushlstring (return value)
  • lua_copy
  • lua_pushglobaltable
  • luaL_testudata
  • luaL_setfuncs, luaL_newlibtable, and luaL_newlib
  • luaL_setmetatable
  • luaL_getsubtable
  • luaL_traceback
  • luaL_execresult
  • luaL_fileresult
  • luaL_loadbufferx
  • luaL_loadfilex
  • luaL_checkversion (with empty body, only to avoid compile errors, see here)
  • luaL_tolstring
  • luaL_buffinitsize, luaL_prepbuffsize, and luaL_pushresultsize (see here)
  • lua_pushunsigned, lua_tounsignedx, lua_tounsigned, luaL_checkunsigned, luaL_optunsigned, if LUA_COMPAT_APIINTCASTS is defined.

What's not implemented

  • bit operators
  • integer division operator
  • utf8 escape sequences
  • 64 bit integers
  • coroutine.isyieldable
  • Lua 5.1: _ENV, goto, labels, ephemeron tables, etc. See lua-compat-5.2 for a detailed list.
  • the following C API functions/macros:
    • lua_isyieldable
    • lua_arith (new operators missing)
    • lua_push(v)fstring (new formats missing)
    • lua_upvalueid (5.1)
    • lua_upvaluejoin (5.1)
    • lua_version (5.1)
    • lua_yieldk (5.1)

See also

  • For Lua-5.2-style APIs under Lua 5.1, see lua-compat-5.2, which also is the basis for most of the code in this project.
  • For Lua-5.1-style APIs under Lua 5.0, see Compat-5.1

Credits

This package contains code written by:

lua-compat-5.3's People

Contributors

daurnimator avatar ghedo avatar granpc avatar hishamhm avatar jvprat avatar siffiejoe avatar thephd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lua-compat-5.3's Issues

src/compat-5.3.c:451:42: error: initializer element is not computable at load time [-Werror=pedantic]

With compat-5.3.[ch] from 73fb49f I get following error:

gcc -O2 -fPIC -std=c89 -pedantic -Wall -Werror -O0 -g --coverage -D_XOPEN_SOURCE=600 -DPACKAGE_STRING="\"LuaLDAP 1.2.3\"" -DLUA_C89_NUMBERS -I/opt/luaenv/versions/5.1.5/include -I/usr/include -I/usr/include -I../compat/src   -c -o src/lualdap.o src/lualdap.c
In file included from src/compat-5.3.h:419:0,
                 from src/lualdap.c:26:
src/compat-5.3.c: In function 'compat53_load_53':
src/compat-5.3.c:451:42: error: initializer element is not computable at load time [-Werror=pedantic]
   compat53_reader_data compat53_data = { reader, data, 1, 0, 0 };
                                          ^~~~~~
src/compat-5.3.c:451:50: error: initializer element is not computable at load time [-Werror=pedantic]
   compat53_reader_data compat53_data = { reader, data, 1, 0, 0 };
                                                  ^~~~
cc1: all warnings being treated as errors

For details see:

Support missing "*" in file:read formats

Support missing * in file:read and file:lines formats.

$ lua -e 'print(io.stdin:read("a"))' <<< test
test

$ lua5.1 -l compat53 -e 'print(io.stdin:read("a"))' <<< test
lua5.1: (command line):1: bad argument #1 to 'read' (invalid option)
stack traceback:
    [C]: ?
    [C]: in function 'read'
    (command line):1: in main chunk
    [C]: ?

Macro safety

compat-5.3 doesn't make use of parenthesis to protect macros.

#define lua_getuservalue(L, i) \
  (lua_getfenv(L, i), lua_type(L, -1))

should be

#define lua_getuservalue(L, i) \
  (lua_getfenv(L, (i)), lua_type(L, -1))

luaossl installation fails on alpine docker image

Trying to install luaossl latest version with both luarocks and alpine apk fails.
Latest version that can be installed with luarocks is 20170903-0

luaossl contains local version of lua-compat 5.3 which should be aligned with v0.6 - see wahern/luaossl@3a2c1dc

Error during installation comes from this library:

vendor/compat53/c-api/compat-5.3.c: In function 'compat53_strerror':
vendor/compat53/c-api/compat-5.3.c:74:3: warning: implicit declaration of function 'strerror_s' [-Wimplicit-function-declaration]
   strerror_s(buff, sz, en);
   ^~~~~~~~~~

Reported also on luaossl: wahern/luaossl#136

Using alpine latest version / 3.6, lua5.1

Dockerfile:

FROM alpine

# Update apk index.
RUN apk update

# Build dependencies.
RUN apk add build-base bash curl unzip

# Install packages necessary for Lua, Luarocks.
RUN apk add lua5.1 lua5.1-dev luarocks5.1
RUN apk add openssl openssl-dev

RUN luarocks-5.1 install luaossl

Result:

$ docker build -t luaossl .
Sending build context to Docker daemon 2.048 kB
Step 1/6 : FROM alpine
 ---> 3fd9065eaf02
Step 2/6 : RUN apk update
 ---> Running in 3e07e75070fe
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz
fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/community/x86_64/APKINDEX.tar.gz
v3.7.0-214-g519be0a2d1 [http://dl-cdn.alpinelinux.org/alpine/v3.7/main]
v3.7.0-207-gac61833f9b [http://dl-cdn.alpinelinux.org/alpine/v3.7/community]
OK: 9054 distinct packages available
 ---> 78a6dabb0aba
Removing intermediate container 3e07e75070fe
Step 3/6 : RUN apk add build-base bash curl unzip
 ---> Running in 79306c4ac4cf
(1/30) Upgrading musl (1.1.18-r2 -> 1.1.18-r3)
(2/30) Installing pkgconf (1.3.10-r0)
(3/30) Installing ncurses-terminfo-base (6.0_p20171125-r0)
(4/30) Installing ncurses-terminfo (6.0_p20171125-r0)
(5/30) Installing ncurses-libs (6.0_p20171125-r0)
(6/30) Installing readline (7.0.003-r0)
(7/30) Installing bash (4.4.19-r1)
Executing bash-4.4.19-r1.post-install
(8/30) Installing binutils-libs (2.30-r1)
(9/30) Installing binutils (2.30-r1)
(10/30) Installing gmp (6.1.2-r1)
(11/30) Installing isl (0.18-r0)
(12/30) Installing libgomp (6.4.0-r5)
(13/30) Installing libatomic (6.4.0-r5)
(14/30) Installing libgcc (6.4.0-r5)
(15/30) Installing mpfr3 (3.1.5-r1)
(16/30) Installing mpc1 (1.0.3-r1)
(17/30) Installing libstdc++ (6.4.0-r5)
(18/30) Installing gcc (6.4.0-r5)
(19/30) Installing musl-dev (1.1.18-r3)
(20/30) Installing libc-dev (0.7.1-r0)
(21/30) Installing g++ (6.4.0-r5)
(22/30) Installing make (4.2.1-r0)
(23/30) Installing fortify-headers (0.9-r0)
(24/30) Installing build-base (0.5-r0)
(25/30) Installing ca-certificates (20171114-r0)
(26/30) Installing libssh2 (1.8.0-r2)
(27/30) Installing libcurl (7.60.0-r1)
(28/30) Installing curl (7.60.0-r1)
(29/30) Upgrading musl-utils (1.1.18-r2 -> 1.1.18-r3)
(30/30) Installing unzip (6.0-r2)
Executing busybox-1.27.2-r7.trigger
Executing ca-certificates-20171114-r0.trigger
OK: 171 MiB in 39 packages
 ---> 583a4d8b9da5
Removing intermediate container 79306c4ac4cf
Step 4/6 : RUN apk add lua5.1 lua5.1-dev luarocks5.1
 ---> Running in f53cf1233a04
(1/4) Installing lua5.1-libs (5.1.5-r3)
(2/4) Installing lua5.1 (5.1.5-r3)
(3/4) Installing lua5.1-dev (5.1.5-r3)
(4/4) Installing luarocks5.1 (2.4.3-r0)
Executing busybox-1.27.2-r7.trigger
OK: 172 MiB in 43 packages
 ---> a9feff4c83a3
Removing intermediate container f53cf1233a04
Step 5/6 : RUN apk add openssl openssl-dev
 ---> Running in 4c13c2f53b2c
(1/5) Installing libcrypto1.0 (1.0.2o-r0)
(2/5) Installing libssl1.0 (1.0.2o-r0)
(3/5) Installing openssl (1.0.2o-r0)
(4/5) Installing zlib-dev (1.2.11-r1)
(5/5) Installing openssl-dev (1.0.2o-r0)
Executing busybox-1.27.2-r7.trigger
Executing ca-certificates-20171114-r0.trigger
OK: 193 MiB in 48 packages
 ---> eed6414e9b32
Removing intermediate container 4c13c2f53b2c
Step 6/6 : RUN luarocks-5.1 install luaossl
 ---> Running in 92a1972d5aab
Warning: The directory '/root/.cache/luarocks' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and ow
Installing https://luarocks.org/luaossl-20180530-0.src.rock
Hunk 1 found at offset 2...
successfully patched /tmp/luarocks_luaossl-20180530-0-Lgokdg/luaossl-rel-20180530/src/openssl.c
vendor/compat53/c-api/compat-5.3.c: In function 'compat53_strerror':
vendor/compat53/c-api/compat-5.3.c:74:3: warning: implicit declaration of function 'strerror_s' [-Wimplicit-function-declaration]
   strerror_s(buff, sz, en);
   ^~~~~~~~~~
Applying patch config.h.diff...
gcc -O2 -fPIC -I/usr/include -c src/openssl.c -o src/openssl.o -D_REENTRANT -D_THREAD_SAFE -DCOMPAT53_PREFIX=luaossl -D_GNU_SOURCE -I/usr/include -I/usr/include
gcc -O2 -fPIC -I/usr/include -c vendor/compat53/c-api/compat-5.3.c -o vendor/compat53/c-api/compat-5.3.o -D_REENTRANT -D_THREAD_SAFE -DCOMPAT53_PREFIX=luaossl -D_GNU_SOURCE
gcc -shared -o _openssl.so -L/usr/lib src/openssl.o vendor/compat53/c-api/compat-5.3.o -L/usr/lib -L/usr/lib -Wl,-rpath,/usr/lib: -Wl,-rpath,/usr/lib: -lssl -lcrypto -lpthr
No existing manifest. Attempting to rebuild...
luaossl 20180530-0 is now installed in /usr/local (license: MIT/X11)

 ---> 06bb9bcb952b
Removing intermediate container 92a1972d5aab
Successfully built 06bb9bcb952b
Successfully tagged luaossl:latest

lua_tointegerx accepts non-integers

lua_tointegerx only looks for a nonzero result from lua_tointeger or a true result from lua_isnumber (NOT lua_isinteger). This results in it accepting non-integer values and truncating them to integers.

It needs to use the same comparison logic used in lua_isinteger instead.

Use from library

It'd be nice to use compat53 without having global side effects.
e.g. local xpcall = require "compat53.base".xpcall

The top level "compat53" could then import into the global scope.

luaL_typeerror

luaL_typeerror is not an officially documented function, but it is exported by Lua 5.3 and the code is simple:

int luaL_typeerror (lua_State *L, int arg, const char *tname) {
  const char *msg;
  const char *typearg;  /* name for the type of the actual argument */
  if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING)
    typearg = lua_tostring(L, -1);  /* use the given type name */
  else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA)
    typearg = "light userdata";  /* special name for messages */
  else
    typearg = luaL_typename(L, arg);  /* standard name */
  msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg);
  return luaL_argerror(L, arg, msg);
}

Return values for 'get' functions

In lua 5.3, many of the get functions return the type.

  • lua_getfield
  • lua_geti
  • lua_gettable
  • lua_getuservalue
  • lua_rawgeti
  • lua_rawgetp
  • luaL_getmetatable

Of these, only geti works with compat-5.3, as it has a new implementation.
rawgetp works with 5.1 (but not 5.2), as it's in the "5.1 only" section

new functions lua_geti lua_seti

http://www.lua.org/manual/5.3/manual.html#lua_geti

int lua_geti (lua_State *L, int index, lua_Integer i);
Pushes onto the stack the value t[i], where t is the value at the given index. As in Lua, this function may trigger a metamethod for the "index" event (see §2.4).

Returns the type of the pushed value.

http://www.lua.org/manual/5.3/manual.html#lua_seti

void lua_seti (lua_State *L, int index, lua_Integer n);
Does the equivalent to t[n] = v, where t is the value at the given index and v is the value at the top of the stack.

This function pops the value from the stack. As in Lua, this function may trigger a metamethod for the "newindex" event (see §2.4).

Tests fail on 32bit systems

Running tests on amd64 and arm64 seems to run fine, but fail on arm and x86. Do you have an idea, why?

lua: tests/test-bit32.lua:6: assertion failed!
stack traceback:
	[C]: in function 'assert'
	tests/test-bit32.lua:6: in main chunk
	[C]: ?

Lua 5.4

How should compat-5.3 be updated for Lua 5.4?

At least to allow projects to compile against 5.4 we need something like:

diff --git a/vendor/compat53/c-api/compat-5.3.h b/vendor/compat53/c-api/compat-5.3.h
index 8e10893..fb6cc25 100644
--- a/vendor/compat53/c-api/compat-5.3.h
+++ b/vendor/compat53/c-api/compat-5.3.h
@@ -397,11 +397,11 @@ COMPAT53_API void luaL_requiref (lua_State *L, const char *modname,


 /* other Lua versions */
-#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM > 503
+#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 || LUA_VERSION_NUM > 504

-#  error "unsupported Lua version (i.e. not Lua 5.1, 5.2, or 5.3)"
+#  error "unsupported Lua version (i.e. not Lua 5.1, 5.2, 5.3, or 5.4)"

-#endif /* other Lua versions except 5.1, 5.2, and 5.3 */
+#endif /* other Lua versions except 5.1, 5.2, 5.3, and 5.4 */

However, maybe we should be deprecating the compat-5.3 project and creating a compat-5.4?

Compiling on windows (through luarocks) fails, it thinks my system is POSIX

PS C:\Users\Frit\Documents> luarocks install tabular
Installing https://luarocks.org/tabular-0.4-1.src.rock
Missing dependencies for tabular 0.4-1:
   compat53 (not installed)
   ansicolors ~> 1.0 (not installed)

tabular 0.4-1 depends on lua >= 5.1 (5.4-1 provided by VM)
tabular 0.4-1 depends on compat53 (not installed)
Installing https://luarocks.org/compat53-0.12-1.src.rock

compat53 0.12-1 depends on lua >= 5.1, < 5.5 (5.4-1 provided by VM)
"C:\Program Files\LLVM\bin\gcc.exe" -O2 -c -o lutf8lib.o -IC:\Program Files\Lua\5.4\include lutf8lib.c
"C:\Program Files\LLVM\bin\gcc.exe"  -shared -o compat53/utf8.dll lutf8lib.o C:\Program Files\Lua\5.4\lib/lua54.dll -lucrt
"C:\Program Files\LLVM\bin\gcc.exe" -O2 -c -o lstrlib.o -IC:\Program Files\Lua\5.4\include lstrlib.c
"C:\Program Files\LLVM\bin\gcc.exe"  -shared -o compat53/string.dll lstrlib.o C:\Program Files\Lua\5.4\lib/lua54.dll -lucrt
"C:\Program Files\LLVM\bin\gcc.exe" -O2 -c -o liolib.o -IC:\Program Files\Lua\5.4\include liolib.c
liolib.c:408:13: error: call to undeclared function 'getc_unlocked'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  408 |     rn->c = l_getc(rn->f);  /* read next one */
      |             ^
liolib.c:86:20: note: expanded from macro 'l_getc'
   86 | #define l_getc(f)               getc_unlocked(f)
      |                                 ^
liolib.c:448:3: error: call to undeclared function 'flockfile'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  448 |   l_lockfile(rn.f);
      |   ^
liolib.c:87:24: note: expanded from macro 'l_lockfile'
   87 | #define l_lockfile(f)           flockfile(f)
      |                                 ^
liolib.c:448:3: note: did you mean '_lock_file'?
liolib.c:87:24: note: expanded from macro 'l_lockfile'
   87 | #define l_lockfile(f)           flockfile(f)
      |                                 ^
C:/Program Files/LLVM/include/stdio.h:1533:24: note: '_lock_file' declared here
 1533 |   _CRTIMP void __cdecl _lock_file(FILE *_File);
      |                        ^
liolib.c:449:15: error: call to undeclared function 'getc_unlocked'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  449 |   do { rn.c = l_getc(rn.f); } while (isspace(rn.c));  /* skip spaces */
      |               ^
liolib.c:86:20: note: expanded from macro 'l_getc'
   86 | #define l_getc(f)               getc_unlocked(f)
      |                                 ^
liolib.c:463:3: error: call to undeclared function 'funlockfile'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  463 |   l_unlockfile(rn.f);
      |   ^
liolib.c:88:26: note: expanded from macro 'l_unlockfile'
   88 | #define l_unlockfile(f)         funlockfile(f)
      |                                 ^
liolib.c:489:5: error: call to undeclared function 'flockfile'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  489 |     l_lockfile(f);  /* no memory errors can happen inside the lock */
      |     ^
liolib.c:87:24: note: expanded from macro 'l_lockfile'
   87 | #define l_lockfile(f)           flockfile(f)
      |                                 ^
liolib.c:490:40: error: call to undeclared function 'getc_unlocked'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  490 |     while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n')
      |                                        ^
liolib.c:86:20: note: expanded from macro 'l_getc'
   86 | #define l_getc(f)               getc_unlocked(f)
      |                                 ^
liolib.c:492:5: error: call to undeclared function 'funlockfile'; ISO C99 and later do not support implicit function
      declarations [-Wimplicit-function-declaration]
  492 |     l_unlockfile(f);
      |     ^
liolib.c:88:26: note: expanded from macro 'l_unlockfile'
   88 | #define l_unlockfile(f)         funlockfile(f)
      |                                 ^
7 errors generated.

Error: Failed installing dependency: https://luarocks.org/compat53-0.12-1.src.rock - Build error: Failed compiling object liolib.o

assert and non-string errors

compat53 should override assert to allow non-string errors.

$ lua5.1 -l compat53
Lua 5.1.5  Copyright (C) 1994-2012 Lua.org, PUC-Rio
> assert(nil, setmetatable({}, { __tostring=function() return "asdf" end }))
stdin:1: bad argument #2 to 'assert' (string expected, got table)
stack traceback:
    [C]: ?
    [C]: in function 'assert'
    stdin:1: in main chunk
    [C]: ?
$ lua5.2 -l compat53
Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> assert(nil, setmetatable({}, { __tostring=function() return "asdf" end }))
stdin:1: bad argument #2 to 'assert' (string expected, got table)
stack traceback:
    [C]: in function 'assert'
    stdin:1: in main chunk
    [C]: in ?
$ lua
Lua 5.3.1  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> assert(nil, setmetatable({}, { __tostring=function() return "asdf" end }))
asdf

Thanks to @Darkstalker for reminding me.

Lua 5.3 debug.traceback

As my failing test over at https://travis-ci.org/daurnimator/lua-http/builds/82309531 showed me: debug.traceback in 5.3 has minor changes from 5.1

  • It reports the type of the variable the function was in (from 'namewhat')
  • Doesn't return nil with a message of nil

Here's the code for lua 5.3 ported to 5.1:
I also had to wrap debug.getinfo because it would get confused with a nil thread argument.

        local LEVELS1 = 12 -- size of the first part of the stack
        local LEVELS2 = 10 -- size of the second part of the stack
        local function findfield(func, where, level)
            if level == 0 or type(where) ~= "table" then
                return nil
            end
            for k, v in next, where do
                if type(k) == "string" then
                    if rawequal(func, v) then
                        return k
                    end
                    local recur = findfield(func, v, level-1)
                    if recur then
                        return k .. "." .. recur
                    end
                end
            end
            return nil
        end
        local function getinfo(...)
            local n = select("#", ...)
            local co, func, what
            if n >= 3 then
                co, func, what = ...
            else
                func, what = ...
            end
            if type(func) == "number" then
                if func <= 0 then
                    return nil
                end
                func = func + 1
            end
            if type(co) == "thread" then
                return debug.getinfo(co, func, what)
            else
                return debug.getinfo(func, what)
            end
        end
        local function countlevels(co)
            local li, le = 1, 1
            -- get upper bound
            while getinfo(co, le, "") do
                li = le
                le = le * 2
            end
            -- binary search
            while li < le do
                local m = math.floor((li+le)/2)
                if getinfo(co, m, "") then
                    li = m + 1
                else
                    le = m
                end
            end
            return le - 1
        end
        function traceback(co, message, lvl)
            if type(co) ~= "thread" then
                co, message, lvl = coroutine.running(), co, message
            end
            if lvl then
                lvl = lvl + 2
            else
                lvl = 2
            end
            local output = {}
            if message then
                output[1] = message
            end
            table.insert(output, "stack traceback:")
            local numlevels = countlevels(co) - 1
            local mark
            -- Add 1 to LEVELS1 to account for this function
            if numlevels > LEVELS1 + 1 + LEVELS2 then
                mark = LEVELS1 + 1
            else
                mark = 0
            end
            while true do
                local info = getinfo(co, lvl, "Slnf")
                if info == nil then
                    break
                end
                lvl = lvl + 1
                if lvl == mark then
                    table.insert(output, "\t...")
                    lvl = numlevels - LEVELS2
                else
                    local line = string.format("\t%s:", info.short_src)
                    if info.currentline > 0 then
                        line = line .. string.format("%d:", info.currentline)
                    end
                    do
                        local location
                        local path = findfield(info.func, package.loaded, 2)
                        if path then
                            path = path:gsub("^_G%.", "")
                            location = string.format("function '%s'", path)
                        elseif info.namewhat ~= "" then
                            location = string.format("%s '%s'", info.namewhat, info.name)
                        elseif info.what == "main" then
                            location = "main chunk"
                        elseif info.what ~= "C" then
                            location = string.format("function <%s:%d>", info.short_src, info.linedefined)
                        else
                            location = "?"
                        end
                        line = line .. " in " .. location
                    end
                    table.insert(output, line)
                end
            end
            return table.concat(output, "\n")
        end

I ran into was http://article.gmane.org/gmane.comp.lang.lua.general/119076 which make it so wrapped functions get different sized tracebacks.... I think increasing LEVELS1 by one might be good enough here.

new function lua_stringtonumber

http://www.lua.org/manual/5.3/manual.html#lua_stringtonumber

size_t lua_stringtonumber (lua_State *L, const char *s);
Converts the zero-terminated string s to a number, pushes that number into the stack, and returns the total size of the string, that is, its length plus one. The conversion can result in an integer or a float, according to the lexical conventions of Lua (see §3.1). The string may have leading and trailing spaces and a sign. If the string is not a valid numeral, returns 0 and pushes nothing. (Note that the result can be used as a boolean, true if the conversion succeeds.)

So pretty much strtod.

How to compile on windows

I fail to compile this library on windows as dll to be loaded by lua.
After some attempts (see commented cmake code here) I took a look in the code and I cannot see any way to use dllexport or similar. Because of that the dll cannot be loaded by lua afterwards.

How is one supposed to compile this library as dll on windows?
Does it not support windows in current form?

Failure with luajit 2.1

https://travis-ci.org/daurnimator/lua-http/jobs/261447848

�[0K$ pip install hererocks
Collecting hererocks
  Downloading hererocks-0.16.0.tar.gz
Installing collected packages: hererocks
  Running setup.py install for hererocks
    Installing hererocks script to /home/travis/virtualenv/python2.7.9/bin
Successfully installed hererocks-0.16.0

travis_time:end:0423bda0:start=1501991986648263480,finish=1501991987312478441,duration=664214961
�[0Ktravis_fold:end:before_install.1
�[0Ktravis_fold:start:before_install.2
�[0Ktravis_time:start:3241b928
�[0K$ hererocks ~/hererocks -r^ --$LUA
Fetching LuaJIT 2.1.0-beta3 from https://github.com/LuaJIT/LuaJIT/archive/v2.1.0-beta3.tar.gz
Verifying SHA256 checksum
Building LuaJIT 2.1.0-beta3
Installing LuaJIT 2.1.0-beta3
Fetching LuaRocks 2.4.2 from http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz
Verifying SHA256 checksum
Building LuaRocks 2.4.2
Installing LuaRocks 2.4.2
Done.

travis_time:end:3241b928:start=1501991987318764648,finish=1501992017594980738,duration=30276216090
�[0Ktravis_fold:end:before_install.2
�[0Ktravis_fold:start:before_install.3
�[0Ktravis_time:start:0adf4d38
�[0K$ export PATH=$PATH:~/hererocks/bin

travis_time:end:0adf4d38:start=1501992017600519278,finish=1501992017604742153,duration=4222875
�[0Ktravis_fold:end:before_install.3
�[0Ktravis_fold:start:before_install.4
�[0Ktravis_time:start:001c00fe
�[0K$ eval `luarocks path --bin`

travis_time:end:001c00fe:start=1501992017610063019,finish=1501992017624253862,duration=14190843
�[0Ktravis_fold:end:before_install.4
�[0Ktravis_fold:start:before_install.5
�[0Ktravis_time:start:0107bc8f
�[0K$ luarocks install luacheck
Installing https://luarocks.org/luacheck-0.20.0-1.src.rock
Missing dependencies for luacheck 0.20.0-1:
   luafilesystem >= 1.6.3 (not installed)

luacheck 0.20.0-1 depends on luafilesystem >= 1.6.3 (not installed)
Installing https://luarocks.org/luafilesystem-1.6.3-2.src.rock
gcc -O2 -fPIC -I/home/travis/hererocks/include -c src/lfs.c -o src/lfs.o
src/lfs.c:81:0: warning: "luaL_newlib" redefined [enabled by default]
/home/travis/hererocks/include/lauxlib.h:125:0: note: this is the location of the previous definition
gcc -shared -o lfs.so -L/home/travis/hererocks/lib src/lfs.o
No existing manifest. Attempting to rebuild...
luafilesystem 1.6.3-2 is now installed in /home/travis/hererocks (license: MIT/X11)

luacheck 0.20.0-1 is now installed in /home/travis/hererocks (license: MIT <http://opensource.org/licenses/MIT>)


travis_time:end:0107bc8f:start=1501992017629400010,finish=1501992021440543130,duration=3811143120
�[0Ktravis_fold:end:before_install.5
�[0Ktravis_fold:start:before_install.6
�[0Ktravis_time:start:03bc0a84
�[0K$ luarocks install luacov-coveralls
Installing https://luarocks.org/luacov-coveralls-0.2.1-1.src.rock
Missing dependencies for luacov-coveralls 0.2.1-1:
   dkjson (not installed)
   luacov > 0.5 (not installed)
   lua-path (not installed)

luacov-coveralls 0.2.1-1 depends on dkjson (not installed)
Installing https://luarocks.org/dkjson-2.5-2.src.rock
dkjson 2.5-2 is now installed in /home/travis/hererocks (license: MIT/X11)

luacov-coveralls 0.2.1-1 depends on luacov > 0.5 (not installed)
Installing https://luarocks.org/luacov-0.12.0-1.src.rock
luacov 0.12.0-1 is now installed in /home/travis/hererocks (license: MIT/X11)

luacov-coveralls 0.2.1-1 depends on lua-path (not installed)
Installing https://luarocks.org/lua-path-0.3.0-2.src.rock
lua-path 0.3.0-2 is now installed in /home/travis/hererocks (license: MIT/X11)

luacov-coveralls 0.2.1-1 is now installed in /home/travis/hererocks (license: MIT/X11)


travis_time:end:03bc0a84:start=1501992021446120141,finish=1501992025645890641,duration=4199770500
�[0Ktravis_fold:end:before_install.6
�[0Ktravis_fold:start:before_install.7
�[0Ktravis_time:start:0de82629
�[0K$ luarocks install busted
Installing https://luarocks.org/busted-2.0.rc12-1.rockspec
Missing dependencies for busted 2.0.rc12-1:
   lua_cliargs == 3.0-1 (not installed)
   luasystem >= 0.2.0-0 (not installed)
   say >= 1.3-0 (not installed)
   luassert >= 1.7.8-0 (not installed)
   lua-term >= 0.1-1 (not installed)
   penlight >= 1.3.2-2 (not installed)
   mediator_lua >= 1.1.1-0 (not installed)

busted 2.0.rc12-1 depends on lua_cliargs == 3.0-1 (not installed)
Installing https://luarocks.org/lua_cliargs-3.0-1.src.rock
lua_cliargs 3.0-1 is now installed in /home/travis/hererocks (license: MIT <http://opensource.org/licenses/MIT>)

busted 2.0.rc12-1 depends on luasystem >= 0.2.0-0 (not installed)
Installing https://luarocks.org/luasystem-0.2.1-0.src.rock
gcc -O2 -fPIC -I/home/travis/hererocks/include -c src/core.c -o src/core.o
gcc -O2 -fPIC -I/home/travis/hererocks/include -c src/compat.c -o src/compat.o
gcc -O2 -fPIC -I/home/travis/hererocks/include -c src/time.c -o src/time.o
gcc -shared -o system/core.so -L/home/travis/hererocks/lib src/core.o src/compat.o src/time.o -lrt
luasystem 0.2.1-0 is now installed in /home/travis/hererocks (license: MIT <http://opensource.org/licenses/MIT>)

busted 2.0.rc12-1 depends on say >= 1.3-0 (not installed)
Installing https://luarocks.org/say-1.3-1.rockspec
say 1.3-1 is now installed in /home/travis/hererocks (license: MIT <http://opensource.org/licenses/MIT>)

busted 2.0.rc12-1 depends on luassert >= 1.7.8-0 (not installed)
Installing https://luarocks.org/luassert-1.7.10-0.rockspec
luassert 1.7.10-0 is now installed in /home/travis/hererocks (license: MIT <http://opensource.org/licenses/MIT>)

busted 2.0.rc12-1 depends on lua-term >= 0.1-1 (not installed)
Installing https://luarocks.org/lua-term-0.7-1.rockspec
gcc -O2 -fPIC -I/home/travis/hererocks/include -c core.c -o core.o
gcc -shared -o term/core.so -L/home/travis/hererocks/lib core.o
lua-term 0.7-1 is now installed in /home/travis/hererocks (license: MIT/X11)

busted 2.0.rc12-1 depends on penlight >= 1.3.2-2 (not installed)
Installing https://luarocks.org/penlight-1.5.4-1.rockspec
penlight 1.5.4-1 is now installed in /home/travis/hererocks (license: MIT/X11)

busted 2.0.rc12-1 depends on mediator_lua >= 1.1.1-0 (not installed)
Installing https://luarocks.org/mediator_lua-1.1.2-0.rockspec
mediator_lua 1.1.2-0 is now installed in /home/travis/hererocks (license: MIT <http://opensource.org/licenses/MIT>)

busted 2.0.rc12-1 is now installed in /home/travis/hererocks (license: MIT <http://opensource.org/licenses/MIT>)


travis_time:end:0de82629:start=1501992025651583194,finish=1501992032763786151,duration=7112202957
�[0Ktravis_fold:end:before_install.7
�[0Ktravis_fold:start:install.1
�[0Ktravis_time:start:2771e438
�[0K$ luarocks install --only-deps http-scm-0.rockspec
Missing dependencies for http scm-0:
   compat53 >= 0.3 (not installed)
   bit32 (not installed)
   cqueues >= 20161214 (not installed)
   luaossl >= 20161208 (not installed)
   basexx >= 0.2.0 (not installed)
   lpeg (not installed)
   lpeg_patterns >= 0.3 (not installed)
   fifo (not installed)

http scm-0 depends on compat53 >= 0.3 (not installed)
Installing https://luarocks.org/compat53-0.3-1.src.rock
gcc -O2 -fPIC -I/home/travis/hererocks/include -c lstrlib.c -o lstrlib.o
In file included from lprefix.h:46:0,
                 from lstrlib.c:10:
c-api/compat-5.3.h:99:1: error: static declaration of ‘lua_copy’ follows non-static declaration
/home/travis/hererocks/include/lua.h:352:14: note: previous declaration of ‘lua_copy’ was here
c-api/compat-5.3.h:109:0: warning: "luaL_newlibtable" redefined [enabled by default]
/home/travis/hererocks/include/lauxlib.h:123:0: note: this is the location of the previous definition
c-api/compat-5.3.h:111:0: warning: "luaL_newlib" redefined [enabled by default]
/home/travis/hererocks/include/lauxlib.h:125:0: note: this is the location of the previous definition
c-api/compat-5.3.h:126:1: error: static declaration of ‘lua_tointegerx’ follows non-static declaration
/home/travis/hererocks/include/lua.h:354:21: note: previous declaration of ‘lua_tointegerx’ was here
c-api/compat-5.3.h:129:1: error: static declaration of ‘lua_tonumberx’ follows non-static declaration
/home/travis/hererocks/include/lua.h:353:20: note: previous declaration of ‘lua_tonumberx’ was here
c-api/compat-5.3.h:144:1: error: static declaration of ‘luaL_setfuncs’ follows non-static declaration
/home/travis/hererocks/include/lauxlib.h:88:18: note: previous declaration of ‘luaL_setfuncs’ was here
c-api/compat-5.3.h:147:1: error: static declaration of ‘luaL_setmetatable’ follows non-static declaration
/home/travis/hererocks/include/lauxlib.h:92:18: note: previous declaration of ‘luaL_setmetatable’ was here
c-api/compat-5.3.h:150:1: error: static declaration of ‘luaL_testudata’ follows non-static declaration
/home/travis/hererocks/include/lauxlib.h:91:19: note: previous declaration of ‘luaL_testudata’ was here

Error: Failed installing dependency: https://luarocks.org/compat53-0.3-1.src.rock - Build error: Failed compiling object lstrlib.o

travis_time:end:2771e438:start=1501992032769567456,finish=1501992034385215431,duration=1615647975
�[0K
�[31;1mThe command "luarocks install --only-deps http-scm-0.rockspec" failed and exited with 1 during .�[0m

Unable to install from luarocks on Windows: C4047 issue on liolib.c

Hello,

I'm not very good at LUA or C compilation. I tried to install this library from luarocks, with both Visual C++ Build Tools 2017 and 2022. Same triggered the same error:

C:\myluaproject\luarocks>luarocks install compat53
Installing https://luarocks.org/compat53-0.13-1.src.rock

cl /nologo /MD /O2 -c -Folstrlib.obj -IC:\myluaproject\luajit\inc lstrlib.c
lstrlib.c
link -dll -subsystem:windows,5.01 -def:string.def -out:compat53/string.dll C:\myluaproject\luajit\lib/lua51.lib lstrlib.obj
Microsoft (R) Incremental Linker Version 14.16.27051.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Création de la bibliothèque compat53/string.lib et de l'objet compat53/string.exp
cl /nologo /MD /O2 -c -Foliolib.obj -IC:\myluaproject\luajit\inc liolib.c
liolib.c
liolib.c(280): warning C4047: '=' : les niveaux d'indirection de 'FILE *' et de 'int' sont différents
link -dll -subsystem:windows,5.01 -def:io.def -out:compat53/io.dll C:\myluaproject\luajit\lib/lua51.lib liolib.obj
Microsoft (R) Incremental Linker Version 14.16.27051.0
Copyright (C) Microsoft Corporation.  All rights reserved.

io.def : error LNK2001: symbole externe non résolu luaopen_compat53_io
compat53/io.lib : fatal error LNK1120: 1 externes non résolus

Error: Build error: Failed compiling module compat53/io.dll

Is this a Visual C++ version mismatch or a bug?

Thanks in advance.

Build fail with x86_64-w64-mingw32-gcc on MacOS

Use x86_64-w64-mingw32-gcc to cross compile for windows, get this.

In file included from /Users/zhaozg/work/luaclibs/compat/lua-compat-5.3/c-api/compat-5.3.h:417:0,
                 from /Users/zhaozg/workspace/mobile/SCertSDK/src/sc_private.h:20,
                 from /Users/zhaozg/workspace/mobile/SCertSDK/src/sdk_private.h:4,
                 from /Users/zhaozg/workspace/mobile/SCertSDK/src/sc_impl_v2.c:11:
/Users/zhaozg/work/luaclibs/compat/lua-compat-5.3/c-api/compat-5.3.c: 在函数‘compat53_strerror’中:
/Users/zhaozg/work/luaclibs/compat/lua-compat-5.3/c-api/compat-5.3.c:74:3: 警告:implicit declaration of function ‘strerror_s’; did you mean ‘strerror’? [-Wimplicit-function-declaration]
   strerror_s(buff, sz, en);
   ^~~~~~~~~~
   strerror

and -E -dM output is

zhaozgdeMacBook-Pro:c-api zhaozg$ x86_64-w64-mingw32-gcc compat-5.3.c -I$HOME/work/lua-forge/luajit/src -E -dM
#define LUA_ERRERR 5
#define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
#define __DBL_MIN_EXP__ (-1021)
#define luaL_pushresult COMPAT53_CONCAT(COMPAT53_PREFIX, _pushresult_53)
#define __FLT32X_MAX_EXP__ 1024
#define _islower_l(_Char,_Locale) _ischartype_l(_Char,_LOWER,_Locale)
#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n))
#define LUA_ERRFILE (LUA_ERRERR+1)
#define _MCRTIMP _CRTIMP
#define _CONST_RETURN
#define _IOSTRG 0x0040
#define __UINT_LEAST16_MAX__ 0xffff
#define _INTPTR_T_DEFINED
#define LUA_HOOKTAILRET 4
#define __ATOMIC_ACQUIRE 2
#define __FLT128_MAX_10_EXP__ 4932
#define LUA_LDIR "!\\lua\\"
#define __MINGW_GNU_PRINTF(__format,__args) __attribute__((__format__(gnu_printf,__format,__args)))
#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F
#define __GCC_IEC_559_COMPLEX 2
#define _NLSCMP_DEFINED
#define __UINT_LEAST8_TYPE__ unsigned char
#define __SIZEOF_FLOAT80__ 16
#define _CRT_ERRNO_DEFINED
#define _I8_MIN (-127 - 1)
#define _WSTRING_DEFINED
#define _isupper_l(_Char,_Locale) _ischartype_l(_Char,_UPPER,_Locale)
#define __MINGW64_VERSION_MAJOR 5
#define __pwctype_func() (* __MINGW_IMP_SYMBOL(_pwctype))
#define _WIN32 1
#define LUA_PATHSEP ";"
#define __INTMAX_C(c) c ## LL
#define LUA_OPMOD 4
#define _fmode (* __MINGW_IMP_SYMBOL(_fmode))
#define LUA_IOLIBNAME "io"
#define __CHAR_BIT__ 8
#define DUMMYUNIONNAME6
#define EAFNOSUPPORT 102
#define _CTYPE_DEFINED
#define __iswcsymf(_c) (iswalpha(_c) || ((_c)=='_'))
#define popen _popen
#define SHRT_MAX __SHRT_MAX__
#define __MINGW64_VERSION_RC 0
#define COMPAT53_PREFIX compat53
#define EACCES 13
#define _CONTROL 0x20
#define __UINT8_MAX__ 0xff
#define _ispunct_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT,_Locale)
#define _WIN64 1
#define iswascii(_c) ((unsigned)(_c) < 0x80)
#define _FILE_DEFINED
#define EDESTADDRREQ 109
#define _isprint_l(_Char,_Locale) _ischartype_l(_Char,_BLANK|_PUNCT|_ALPHA|_DIGIT,_Locale)
#define __WINT_MAX__ 0xffff
#define _WCTYPE_T_DEFINED
#define __FLT32_MIN_EXP__ (-125)
#define __MINGW_IMPORT extern __attribute__ ((__dllimport__))
#define LUA_TLIGHTUSERDATA 2
#define _wctype (* __MINGW_IMP_SYMBOL(_wctype))
#define stderr (&__iob_func()[2])
#define luaL_Buffer luaL_Buffer_53
#define LUA_PATH_MARK "?"
#define USE___UUIDOF 0
#define _OUT_TO_MSGBOX 2
#define _mm_malloc(a,b) _aligned_malloc(a,b)
#define EILSEQ 42
#define va_start(v,l) __builtin_va_start(v,l)
#define ESPIPE 29
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
#define EMLINK 31
#define __ORDER_LITTLE_ENDIAN__ 1234
#define __SIZE_MAX__ 0xffffffffffffffffULL
#define LUA_OPMUL 2
#define DUMMYUNIONNAME1
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#define DUMMYUNIONNAME4
#define DUMMYUNIONNAME5
#define __WCHAR_MAX__ 0xffff
#define DUMMYUNIONNAME7
#define DUMMYUNIONNAME8
#define DUMMYUNIONNAME9
#define _MM_MALLOC_H_INCLUDED
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_2_0(__ret,__func,__type1,__arg1,__type2,__arg2,__dsttype,__dst)
#define LUA_ERRGCMM (LUA_ERRERR + 2)
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1
#define __DBL_DENORM_MIN__ ((double)4.94065645841246544176568792868221372e-324L)
#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1
#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
#define _iswcntrl_l(_c,_p) (_iswctype_l(_c,_CONTROL,_p))
#define __MINGW_MSVC2005_DEPREC_STR "This POSIX function is deprecated beginning in Visual C++ 2005, use _CRT_NONSTDC_NO_DEPRECATE to disable deprecation"
#define __GCC_IEC_559 2
#define __FLT32X_DECIMAL_DIG__ 17
#define _IOFBF 0x0000
#define __nothrow
#define __FLT_EVAL_METHOD__ 0
#define COMPAT53_CONCAT_HELPER(a,b) a ##b
#define SHRT_MIN (-SHRT_MAX - 1)
#define __FLT64_DECIMAL_DIG__ 17
#define _WINT_T
#define LUA_NOREF (-2)
#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
#define _PUNCT 0x10
#define ENOFILE ENOENT
#define lua_dump(L,w,d,s) ((void)(s), lua_dump((L), (w), (d)))
#define __x86_64 1
#define iswspace(_c) (iswctype(_c,_SPACE))
#define _WSPAWN_DEFINED
#define lua_seti COMPAT53_CONCAT(COMPAT53_PREFIX, _seti)
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES 0
#define strcasecmp _stricmp
#define lua_pushglobaltable(L) lua_pushvalue((L), LUA_GLOBALSINDEX)
#define LUA_TBOOLEAN 1
#define luai_apicheck(L,o) { (void)L; }
#define LUA_PATH_DEFAULT ".\\?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;"
#define EOWNERDEAD 133
#define __iscsymf(_c) (isalpha(_c) || ((_c)=='_'))
#define LUA_EXECDIR "!"
#define __UINT_FAST64_MAX__ 0xffffffffffffffffULL
#define __SIG_ATOMIC_TYPE__ int
#define _DLL
#define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
#define _STDSTREAM_DEFINED
#define __DBL_MIN_10_EXP__ (-307)
#define ENOTTY 25
#define __FINITE_MATH_ONLY__ 0
#define LUA_GCRESTART 1
#define __argv (* __MINGW_IMP_SYMBOL(__argv))
#define LUA_MULTRET (-1)
#define _DIV_T_DEFINED
#define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
#define EBADF 9
#define iswalpha(_c) (iswctype(_c,_ALPHA))
#define __STDDEF_H__
#define ___mb_cur_max_func() (__mb_cur_max)
#define __MINGW_USE_UNDERSCORE_PREFIX 0
#define __MINGW_ATTRIB_USED __attribute__ ((__used__))
#define ERANGE 34
#define __GNUC_PATCHLEVEL__ 0
#define __FLT32_HAS_DENORM__ 1
#define ECANCELED 105
#define __MINGW_SEC_WARN_STR "This function or variable may be unsafe, use _CRT_SECURE_NO_WARNINGS to disable deprecation"
#define _ADDRESSOF(v) (&(v))
#define __UINT_FAST8_MAX__ 0xff
#define _INC_MINGW_SECAPI
#define _LIMITS_H___
#define _HEAPOK (-2)
#define __has_include(STR) __has_include__(STR)
#define lua_pcallk(L,na,nr,err,ctx,cont) ((void)(ctx), (void)(cont), lua_pcall((L), (na), (nr), (err)))
#define _stdcall __attribute__((__stdcall__))
#define __DEC64_MAX_EXP__ 385
#define _WCHAR_T_DEFINED
#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n)))
#define ENOMEM 12
#define __INT8_C(c) c
#define _CRT_OBSOLETE(_NewItem)
#define onexit_t _onexit_t
#define lua_Chunkwriter lua_Writer
#define __INT_LEAST8_WIDTH__ 8
#define __UINT_LEAST64_MAX__ 0xffffffffffffffffULL
#define __LONG32 long
#define __SHRT_MAX__ 0x7fff
#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
#define __FLT64X_MAX_10_EXP__ 4932
#define _crt_va_copy(d,s) __builtin_va_copy(d,s)
#define _pgmptr (* __MINGW_IMP_SYMBOL(_pgmptr))
#define _iswalnum_l(_c,_p) (_iswctype_l(_c,_ALPHA|_DIGIT,_p))
#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
#define luaL_traceback COMPAT53_CONCAT(COMPAT53_PREFIX, L_traceback)
#define __va_copy(d,s) __builtin_va_copy(d,s)
#define __iscsym(_c) (isalnum(_c) || ((_c)=='_'))
#define SCHAR_MAX __SCHAR_MAX__
#define __UINT_LEAST8_MAX__ 0xff
#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128
#define lua_isnoneornil(L,n) (lua_type(L, (n)) <= 0)
#define __UINTMAX_TYPE__ long long unsigned int
#define EINPROGRESS 112
#define _CRT_MEMORY_DEFINED
#define _getc_nolock(_stream) _fgetc_nolock(_stream)
#define LUA_GCCOUNT 3
#define __DEC32_EPSILON__ 1E-6DF
#define strtod __strtod
#define _CRT_DIRECTORY_DEFINED
#define __FLT_EVAL_METHOD_TS_18661_3__ 0
#define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1ULL)
#define lua_str2number(s,p) strtod((s), (p))
#define _CRT_ALIGN(x) __attribute__ ((__aligned__ (x)))
#define _INC_STRING
#define _INC_CTYPE
#define __MINGW_MS_SCANF(__format,__args) __attribute__((__format__(ms_scanf, __format,__args)))
#define __UINT32_MAX__ 0xffffffffU
#define __MINGW_ATTRIB_UNUSED __attribute__ ((__unused__))
#define __LDBL_MAX_EXP__ 16384
#define __FLT128_MIN_EXP__ (-16381)
#define LUA_VERSION_NUM 501
#define __WINT_MIN__ 0
#define EPROTOTYPE 136
#define COMPAT53_HAVE_STRERROR_R 0
#define COMPAT53_HAVE_STRERROR_S 1
#define __mingw_ovr static __attribute__ ((__unused__)) __inline__ __cdecl
#define lua_rawsetp COMPAT53_CONCAT(COMPAT53_PREFIX, _rawsetp)
#define _environ (* __MINGW_IMP_SYMBOL(_environ))
#define __FLT128_MIN_10_EXP__ (-4931)
#define lauxlib_h
#define SCHAR_MIN (-SCHAR_MAX - 1)
#define EXIT_FAILURE 1
#define LUA_COMPAT_GFIND
#define __INT_LEAST16_WIDTH__ 16
#define lua_copy COMPAT53_CONCAT(COMPAT53_PREFIX, _copy)
#define _FPOS_T_DEFINED
#define __SCHAR_MAX__ 0x7f
#define LUA_MINSTACK 20
#define _CRT_WSYSTEM_DEFINED
#define __FLT128_MANT_DIG__ 113
#define EALREADY 103
#define lua_setglobal(L,s) lua_setfield(L, LUA_GLOBALSINDEX, (s))
#define __WCHAR_MIN__ 0
#define _wpgmptr (* __MINGW_IMP_SYMBOL(_wpgmptr))
#define __INT64_C(c) c ## LL
#define __DBL_DIG__ 15
#define LUA_INTFRMLEN "l"
#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
#define _putwc_nolock(_c,_stm) _fputwc_nolock(_c,_stm)
#define _crt_va_arg(v,l) __builtin_va_arg(v,l)
#define __FLT64X_MANT_DIG__ 64
#define _TIME_T_DEFINED
#define luaL_len COMPAT53_CONCAT(COMPAT53_PREFIX, L_len)
#define _BLANK 0x40
#define _UINTPTR_T_DEFINED
#define __isascii(_Char) ((unsigned)(_Char) < 0x80)
#define __toascii(_Char) ((_Char) & 0x7f)
#define __SIZEOF_INT__ 4
#define __SIZEOF_POINTER__ 8
#define _INC_CRTDEFS_MACRO
#define _ANONYMOUS_STRUCT __MINGW_EXTENSION
#define _INC_STDIO
#define USHRT_MAX (SHRT_MAX * 2 + 1)
#define ETIMEDOUT 138
#define __USER_LABEL_PREFIX__
#define __C89_NAMELESSSTRUCTNAME1
#define __C89_NAMELESSSTRUCTNAME2
#define __C89_NAMELESSSTRUCTNAME3
#define __C89_NAMELESSSTRUCTNAME4
#define __C89_NAMELESSSTRUCTNAME5
#define _W64
#define _AGLOBAL
#define LUA_SIGNATURE "\033Lua"
#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x
#define _iswspace_l(_c,_p) (_iswctype_l(_c,_SPACE,_p))
#define __STDC_HOSTED__ 1
#define _RSIZE_T_DEFINED
#define __WIN32 1
#define luaL_newlib(L,l) (luaL_newlibtable((L), (l)), luaL_register((L), NULL, (l)))
#define _MAX_ENV 32767
#define LUA_KFUNCTION(_name) static int (_name)(lua_State *L, int status, lua_KContext ctx)
#define __LDBL_HAS_INFINITY__ 1
#define _HEAPBADBEGIN (-3)
#define LUA_LOADLIBNAME "package"
#define _P_tmpdir "\\"
#define LUA_GCSETPAUSE 6
#define LUA_OPUNM 6
#define _WConst_return _CONST_RETURN
#define _WSTDIO_DEFINED
#define __WIN64 1
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_EX(__ret_type,__ret_policy,__decl_spec,__name,__sec_name,__dst_attr,__dst_type,__dst)
#define __FLT32_DIG__ 6
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_0(__ret,__func,__dsttype,__dst)
#define EINTR 4
#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F
#define PATH_MAX 260
#define __SHRT_WIDTH__ 16
#define lua_stringtonumber COMPAT53_CONCAT(COMPAT53_PREFIX, _stringtonumber)
#define _iscsym_l(_c,_p) (_isalnum_l(_c,_p) || ((_c)=='_'))
#define TMP_MAX 32767
#define ENOTCONN 126
#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L
#define __STDC_UTF_16__ 1
#define __MINGW_ATTRIB_MALLOC __attribute__ ((__malloc__))
#define lua_load COMPAT53_CONCAT(COMPAT53_PREFIX, _load_53)
#define __DEC32_MAX__ 9.999999E96DF
#define _CVTBUFSIZE (309+40)
#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x
#define __MINGW32__ 1
#define LUA_OK 0
#define iswprint(_c) (iswctype(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT))
#define EPERM 1
#define _STDDEF_H
#define _MAX_EXT 256
#define LUA_NUMBER_FMT "%.14g"
#define __FLT32X_HAS_INFINITY__ 1
#define __INT32_MAX__ 0x7fffffff
#define _isalpha_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA,_Locale)
#define _CRT_UNUSED(x) (void)x
#define __INT_WIDTH__ 32
#define __SIZEOF_LONG__ 4
#define _IONBF 0x0004
#define __C89_NAMELESSSTRUCTNAME
#define LUA_QL(x) "'" x "'"
#define LUA_QS LUA_QL("%s")
#define _INC_STRING_S
#define EMFILE 24
#define _CRTIMP_NOIA64 _CRTIMP
#define __UINT16_C(c) c
#define __PTRDIFF_WIDTH__ 64
#define lua_len COMPAT53_CONCAT(COMPAT53_PREFIX, _len)
#define __MINGW_CRT_NAME_CONCAT2(sym) ::sym ##_s
#define lua_gettable(L,i) (lua_gettable((L), (i)), lua_type((L), -1))
#define __MINGW_ATTRIB_DEPRECATED_MSVC2005 __MINGW_ATTRIB_DEPRECATED_STR(__MINGW_MSVC2005_DEPREC_STR)
#define LUA_CPATH_DEFAULT ".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#define __DECIMAL_DIG__ 21
#define luaL_buffinitsize(L,B,s) (luaL_buffinit((L), (B)), luaL_prepbuffsize((B), (s)))
#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64
#define __INTMAX_WIDTH__ 64
#define SEEK_SET 0
#define iswlower(_c) (iswctype(_c,_LOWER))
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY 0
#define luaL_loadfilex COMPAT53_CONCAT(COMPAT53_PREFIX, L_loadfilex)
#define ENETDOWN 116
#define getwchar() fgetwc(stdin)
#define __has_include_next(STR) __has_include_next__(STR)
#define LUA_MAXCAPTURES 32
#define lua_newtable(L) lua_createtable(L, 0, 0)
#define _CRT_PERROR_DEFINED
#define _osplatform (* __MINGW_IMP_SYMBOL(_osplatform))
#define __FLT64X_MIN_10_EXP__ (-4931)
#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n)))
#define __LDBL_HAS_QUIET_NAN__ 1
#define _ALLOCA_S_HEAP_MARKER 0xDDDD
#define LUA_INIT "LUA_INIT"
#define _OUT_TO_DEFAULT 0
#define _INC__MINGW_H
#define LUA_MATHLIBNAME "math"
#define __FLT64_MANT_DIG__ 53
#define LUA_GCCOLLECT 2
#define LUA_OPADD 0
#define __w64
#define LUA_MASKCALL (1 << LUA_HOOKCALL)
#define L_tmpnam (sizeof(_P_tmpdir) + 12)
#define isascii __isascii
#define toascii __toascii
#define __GNUC__ 7
#define getwc(_stm) fgetwc(_stm)
#define sys_errlist _sys_errlist
#define _cdecl __attribute__((__cdecl__))
#define __MMX__ 1
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_EX(__ret_type,__ret_policy,__decl_spec,__name,__sec_name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1,__arg2_type,__arg2,__arg3_type,__arg3)
#define _HEAPBADPTR (-6)
#define _iswcsym_l(_c,_p) (_iswalnum_l(_c,_p) || ((_c)=='_'))
#define offsetof(TYPE,MEMBER) __builtin_offsetof (TYPE, MEMBER)
#define __FLT_HAS_DENORM__ 1
#define __SIZEOF_LONG_DOUBLE__ 16
#define lua_setuservalue(L,i) (luaL_checktype((L), -1, LUA_TTABLE), lua_setfenv((L), (i)))
#define LUA_TNUMBER 3
#define SSIZE_MAX _I64_MAX
#define LUA_NUMBER_DOUBLE
#define lua_pushlstring(L,s,len) ((((len) == 0) ? lua_pushlstring((L), "", 0) : lua_pushlstring((L), (s), (len))), lua_tostring((L), -1))
#define _LOWER 0x2
#define __BIGGEST_ALIGNMENT__ 16
#define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated)
#define LONG_MAX __LONG_MAX__
#define __MINGW32_MINOR_VERSION 11
#define STDERR_FILENO 2
#define _IOB_ENTRIES 20
#define __FLT64_MAX_10_EXP__ 308
#define LUA_IGMARK "-"
#define _threadid (__threadid())
#define __iswcsym(_c) (iswalnum(_c) || ((_c)=='_'))
#define DUMMYUNIONNAME
#define lua_arith COMPAT53_CONCAT(COMPAT53_PREFIX, _arith)
#define LUA_ENVIRONINDEX (-10001)
#define _FPOSOFF(fp) ((long)(fp))
#define COMPAT53_FOPEN_NO_LOCK 0
#define __USE_CRTIMP 1
#define EXIT_SUCCESS 0
#define _P_NOWAIT 1
#define __DBL_MAX__ ((double)1.79769313486231570814527423731704357e+308L)
#define _thiscall __attribute__((__thiscall__))
#define _CRT_WCTYPEDATA_DEFINED
#define __INT_FAST32_MAX__ 0x7fffffff
#define __WINNT 1
#define DUMMYSTRUCTNAME1
#define DUMMYSTRUCTNAME2
#define DUMMYSTRUCTNAME3
#define DUMMYSTRUCTNAME4
#define DUMMYSTRUCTNAME5
#define __DBL_HAS_INFINITY__ 1
#define _SPACE 0x8
#define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
#define _CRTNOALIAS
#define _I16_MAX 32767
#define __WINNT__ 1
#define stdin (&__iob_func()[0])
#define WINVER 0x0501
#define _isalnum_l(_Char,_Locale) _ischartype_l(_Char,_ALPHA|_DIGIT,_Locale)
#define LUA_TUSERDATA 7
#define luaL_newmetatable(L,tn) (luaL_newmetatable((L), (tn)) ? (lua_pushstring((L), (tn)), lua_setfield((L), -2, "__name"), 1) : 0)
#define __MINGW_HAVE_WIDE_C99_SCANF 1
#define __DEC32_MIN_EXP__ (-94)
#define _putc_nolock(_c,_stream) _fputc_nolock(_c,_stream)
#define lua_h
#define __pctype_func() (* __MINGW_IMP_SYMBOL(_pctype))
#define __INTPTR_WIDTH__ 64
#define EPIPE 32
#define __MINGW_LSYMBOL(sym) _ ##sym
#define __C89_NAMELESSUNIONNAME1
#define __C89_NAMELESSUNIONNAME2
#define __C89_NAMELESSUNIONNAME3
#define __C89_NAMELESSUNIONNAME4
#define __C89_NAMELESSUNIONNAME5
#define __C89_NAMELESSUNIONNAME6
#define __C89_NAMELESSUNIONNAME7
#define __C89_NAMELESSUNIONNAME8
#define _INC_STDIO_S
#define LONG_MIN (-LONG_MAX - 1L)
#define lua_Chunkreader lua_Reader
#define luaconf_h
#define MINGW_HAS_DDK_H 1
#define _ALPHA (0x0100|_UPPER|_LOWER)
#define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
#define __FLT32X_HAS_DENORM__ 1
#define __INT_FAST16_TYPE__ short int
#define iswdigit(_c) (iswctype(_c,_DIGIT))
#define _SIZE_T_DEFINED
#define LUA_DIRSEP "\\"
#define putwc(_c,_stm) fputwc(_c,_stm)
#define _NFILE _NSTREAM_
#define ECHILD 10
#define _iswlower_l(_c,_p) (_iswctype_l(_c,_LOWER,_p))
#define _fastcall __attribute__((__fastcall__))
#define __LDBL_HAS_DENORM__ 1
#define __MINGW_HAS_DXSDK 1
#define LUA_OPEQ 0
#define __FLT128_HAS_INFINITY__ 1
#define __MINGW_ATTRIB_NO_OPTIMIZE __attribute__((__optimize__ ("0")))
#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL
#define __INT_LEAST32_MAX__ 0x7fffffff
#define __DEC32_MIN__ 1E-95DF
#define _I16_MIN (-32767 - 1)
#define __DBL_MAX_EXP__ 1024
#define __WCHAR_WIDTH__ 16
#define _iswupper_l(_c,_p) (_iswctype_l(_c,_UPPER,_p))
#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32
#define __C89_NAMELESS __MINGW_EXTENSION
#define _M_X64 100
#define __DEC128_EPSILON__ 1E-33DL
#define _iob __iob_func()
#define __SSE2_MATH__ 1
#define __ATOMIC_HLE_RELEASE 131072
#define __WIN32__ 1
#define _VA_LIST_
#define __PTRDIFF_MAX__ 0x7fffffffffffffffLL
#define lua_pushliteral(L,s) lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
#define __MSABI_LONG(x) x ## l
#define luaL_setfuncs COMPAT53_CONCAT(COMPAT53_PREFIX, L_setfuncs)
#define _MAX_WAIT_MALLOC_CRT 60000
#define __amd64 1
#define ENOTSUP 129
#define luaL_checkstack COMPAT53_CONCAT(COMPAT53_PREFIX, L_checkstack_53)
#define _wenviron (* __MINGW_IMP_SYMBOL(_wenviron))
#define _iswpunct_l(_c,_p) (_iswctype_l(_c,_PUNCT,_p))
#define _SYS_OPEN 20
#define LUA_OPLE 2
#define _CRTIMP_ALTERNATIVE _CRTIMP
#define _UI8_MAX 0xffu
#define _iswprint_l(_c,_p) (_iswctype_l(_c,_BLANK|_PUNCT|_ALPHA|_DIGIT,_p))
#define luaL_putchar(B,c) luaL_addchar(B,c)
#define __ATOMIC_HLE_ACQUIRE 65536
#define __FLT32_HAS_QUIET_NAN__ 1
#define luaL_checkversion COMPAT53_CONCAT(COMPAT53_PREFIX, L_checkversion)
#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL
#define __SIZEOF_SIZE_T__ 8
#define LUA_TTABLE 5
#define _CRT_glob _dowildcard
#define _UI64_MAX 0xffffffffffffffffull
#define LUAI_GCMUL 200
#define ENOTEMPTY 41
#define __FLT64X_MIN_EXP__ (-16381)
#define SIZE_MAX _UI64_MAX
#define __SIZEOF_WINT_T__ 2
#define lua_pop(L,n) lua_settop(L, -(n)-1)
#define lua_rawget(L,i) (lua_rawget((L), (i)), lua_type((L), -1))
#define __LONG_LONG_WIDTH__ 64
#define _INT128_DEFINED
#define __CRT_WIDE(_String) L ## _String
#define __FLT32_MAX_EXP__ 128
#define __MINGW64_STRINGIFY(x) __STRINGIFY(x)
#define iscsymf __iscsymf
#define _TIME64_T_DEFINED
#define _iscsymf_l(_c,_p) (_isalpha_l(_c,_p) || ((_c)=='_'))
#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL)
#define __GXX_ABI_VERSION 1011
#define lua_getuservalue(L,i) (lua_getfenv((L), (i)), lua_type((L), -1))
#define COMPAT53_LEVELS1 12
#define COMPAT53_LEVELS2 10
#define MINGW_DDK_H
#define __FLT_MIN_EXP__ (-125)
#define _UPPER 0x1
#define LUA_REFNIL (-1)
#define _WSTDLIBP_DEFINED
#define COMPAT53_CONCAT(a,b) COMPAT53_CONCAT_HELPER(a, b)
#define luaL_addstring(B,s) luaL_addlstring((B), (s), strlen((s)))
#define alloca(x) __builtin_alloca((x))
#define LUA_TTHREAD 8
#define _SSIZE_T_DEFINED
#define LUA_MASKRET (1 << LUA_HOOKRET)
#define __MINGW_ATTRIB_DEPRECATED_SEC_WARN __MINGW_ATTRIB_DEPRECATED_STR(__MINGW_SEC_WARN_STR)
#define __FLT64X_HAS_QUIET_NAN__ 1
#define __INT_FAST64_TYPE__ long long int
#define _putwchar_nolock(_c) _putwc_nolock((_c),stdout)
#define _ANSI_STDDEF_H
#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE)
#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64
#define _osver (* __MINGW_IMP_SYMBOL(_osver))
#define __DBL_MIN__ ((double)2.22507385850720138309023271733240406e-308L)
#define EADDRINUSE 100
#define _VA_LIST
#define LUAI_GCPAUSE 200
#define LUAI_MAXCSTACK 8000
#define _CRT_DOUBLE_DEC
#define LUA_COLIBNAME "coroutine"
#define lua_getgccount(L) lua_gc(L, LUA_GCCOUNT, 0)
#define ENETRESET 117
#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x
#define _ALLOCA_S_MARKER_SIZE 16
#define _ALLOCA_S_STACK_MARKER 0xCCCC
#define EISDIR 21
#define __DECIMAL_BID_FORMAT__ 1
#define __FLT64_MIN_EXP__ (-1021)
#define CHAR_MAX SCHAR_MAX
#define putwchar(_c) fputwc((_c),stdout)
#define __GXX_TYPEINFO_EQUALITY_INLINE 0
#define __FLT64_MIN_10_EXP__ (-307)
#define lua_getglobal(L,s) lua_getfield(L, LUA_GLOBALSINDEX, (s))
#define luaL_tolstring COMPAT53_CONCAT(COMPAT53_PREFIX, L_tolstring)
#define ULONG_MAX (LONG_MAX * 2UL + 1UL)
#define _P_NOWAITO 3
#define _IOREAD 0x0001
#define LUAI_MAXNUMBER2STR 32
#define _ALLOCA_S_THRESHOLD 1024
#define __FLT64X_DECIMAL_DIG__ 21
#define __DEC128_MIN__ 1E-6143DL
#define __MINGW_BROKEN_INTERFACE(x) __MINGW_PRAGMA_PARAM(message ("Interface " _CRT_STRINGIZE(x) " has unverified layout."))
#define __REGISTER_PREFIX__
#define __UINT16_MAX__ 0xffff
#define _HEAPEND (-5)
#define __DBL_HAS_DENORM__ 1
#define _IOMYBUF 0x0008
#define __cdecl __attribute__((__cdecl__))
#define _LUALIB_H
#define CHAR_BIT __CHAR_BIT__
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
#define LUA_OPLT 1
#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32
#define __UINT8_TYPE__ unsigned char
#define _CRT_ALTERNATIVE_IMPORTED
#define __NO_INLINE__ 1
#define __MINGW_SCANF_FORMAT ms_scanf
#define LONG_LONG_MAX __LONG_LONG_MAX__
#define _MRTIMP2 _CRTIMP
#define CHAR_MIN SCHAR_MIN
#define __FLT_MANT_DIG__ 24
#define luaL_addlstring COMPAT53_CONCAT(COMPAT53_PREFIX, _addlstring_53)
#define __LDBL_DECIMAL_DIG__ 21
#define __VERSION__ "7.3.0"
#define __max(a,b) (((a) > (b)) ? (a) : (b))
#define _INC_SWPRINTF_INL
#define luaL_dostring(L,s) (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define _UI32_MAX 0xffffffffu
#define __UINT64_C(c) c ## ULL
#define LUA_INTEGER ptrdiff_t
#define _PTRDIFF_T_
#define _putchar_nolock(_c) _putc_nolock((_c),stdout)
#define __int16 short
#define _INC_CRTDEFS
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1(__ret,__func,__dsttype,__dst,__type1,__arg1)
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2(__ret,__func,__dsttype,__dst,__type1,__arg1,__type2,__arg2)
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_3(__ret,__func,__dsttype,__dst,__type1,__arg1,__type2,__arg2,__type3,__arg3)
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_4(__ret,__func,__dsttype,__dst,__type1,__arg1,__type2,__arg2,__type3,__arg3,__type4,__arg4)
#define lua_assert(x) ((void)0)
#define ENOTSOCK 128
#define _INC_LIMITS
#define __GCC_ATOMIC_INT_LOCK_FREE 2
#define EHOSTUNREACH 110
#define _MAX_PATH 260
#define WEOF (wint_t)(0xFFFF)
#define __int32 int
#define __wargv (* __MINGW_IMP_SYMBOL(__wargv))
#define __FLT128_MAX_EXP__ 16384
#define _CRT_ALLOCATION_DEFINED
#define __MINGW_MS_PRINTF(__format,__args) __attribute__((__format__(ms_printf, __format,__args)))
#define LONG_LONG_MIN (-LONG_LONG_MAX - 1LL)
#define _HEAPEMPTY (-1)
#define __FLT32_MANT_DIG__ 24
#define _INC_STDLIB_S
#define __MINGW_HAVE_ANSI_C99_SCANF 1
#define __int64 long long
#define _CRTIMP __attribute__ ((__dllimport__))
#define lua_numbertointeger(n,p) ((*(p) = (lua_Integer)(n)), 1)
#define _WIN32_WINNT 0x502
#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__
#define _STDIO_DEFINED
#define SEEK_CUR 1
#define LUA_ERRMEM 4
#define LUA_OPDIV 3
#define _INC_ERRNO
#define LUA_GCCOUNTB 4
#define lua_resume(L,from,nargs) ((void)(from), lua_resume((L), (nargs)))
#define __MSVCRT_VERSION__ 0x0700
#define ELOOP 114
#define _STATIC_ASSERT(expr) extern void __static_assert_t(int [(expr)?1:-1])
#define _PGLOBAL
#define __FLT128_HAS_DENORM__ 1
#define _ONEXIT_T_DEFINED
#define _CRT_WPERROR_DEFINED
#define __MINGW_INTRIN_INLINE extern __inline__ __attribute__((__always_inline__,__gnu_inline__))
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0(__ret_type,__ret_policy,__decl_spec,__name,__dst_attr,__dst_type,__dst) __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_0_EX(__ret_type, __ret_policy, __decl_spec, __func_name, __func_name ##_s, __dst_attr, __dst_type, __dst)
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1(__ret_type,__ret_policy,__decl_spec,__name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1) __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_EX(__ret_type, __ret_policy, __decl_spec, __func_name, __func_name ##_s, __dst_attr, __dst_type, __dst, __arg1_type, __arg1, __arg2_type, __arg2)
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2(__ret_type,__ret_policy,__decl_spec,__name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1,__arg2_type,__arg2) __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_EX(__ret_type, __ret_policy, __decl_spec, __func_name, __func_name ##_s, __dst_attr, __dst_type, __dst, __arg1_type, __arg1, __arg2_type, __arg2)
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4(__ret_type,__ret_policy,__decl_spec,__name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1,__arg2_type,__arg2,__arg3_type,__arg3,__arg4_type,__arg4) __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4_EX(__ret_type, __ret_policy, __decl_spec, __func_name, __func_name ##_s, __dst_attr, __dst_type, __dst, __arg1_type, __arg1, __arg2_type, __arg2, __arg3_type, __arg3, __arg4_type, __arg4)
#define __FLT128_DIG__ 33
#define __SCHAR_WIDTH__ 8
#define __INT32_C(c) c
#define __DEC64_EPSILON__ 1E-15DD
#define __ORDER_PDP_ENDIAN__ 3412
#define __DEC128_MIN_EXP__ (-6142)
#define _mm_free(a) _aligned_free(a)
#define LUA_COMPAT_MOD
#define _CRT_MANAGED_HEAP_DEPRECATE
#define __FLT32_MAX_10_EXP__ 38
#define _SECURECRT_ERRCODE_VALUES_DEFINED
#define _OFF_T_DEFINED
#define _chvalidchk_l(_Char,_Flag,_Locale) (!_Locale ? __chvalidchk(_Char,_Flag) : ((_locale_t)_Locale)->locinfo->pctype[_Char] & (_Flag))
#define LUA_TABLIBNAME "table"
#define __INT_FAST32_TYPE__ int
#define __MINGW_ATTRIB_NONNULL(arg) __attribute__ ((__nonnull__ (arg)))
#define __MINGW_IMP_LSYMBOL(sym) __imp_ ##sym
#define EINVAL 22
#define _ANSI_STDARG_H_
#define __UINT_LEAST16_TYPE__ short unsigned int
#define LUA_DBLIBNAME "debug"
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_2_ARGLIST(__ret,__func,__vfunc,__dsttype,__dst,__type1,__arg1,__type2,__arg2)
#define RAND_MAX 0x7fff
#define __FLT64X_HAS_INFINITY__ 1
#define LUA_INTFRM_T long
#define LUA_PATH_CONFIG LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" LUA_EXECDIR "\n" LUA_IGMARK
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
#define LUA_ERRRUN 2
#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
#define __INT16_MAX__ 0x7fff
#define __UNUSED_PARAM(x) x __attribute__ ((__unused__))
#define __SIZE_TYPE__ long long unsigned int
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_1_EX(__ret_type,__ret_policy,__decl_spec,__name,__sec_name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1)
#define __UINT64_MAX__ 0xffffffffffffffffULL
#define luaL_testudata COMPAT53_CONCAT(COMPAT53_PREFIX, L_testudata)
#define LUA_HOOKLINE 2
#define COMPAT53_C_
#define __FLT64X_DIG__ 18
#define __INT8_TYPE__ signed char
#define _IORW 0x0080
#define COMPAT53_API __attribute__((__unused__)) static
#define _OLD_P_OVERLAY 2
#define __GCC_ASM_FLAG_OUTPUTS__ 1
#define _DIGIT 0x4
#define _CRTIMP2 _CRTIMP
#define _toupper(_Char) ((_Char)-'a'+'A')
#define _iswalpha_l(_c,_p) (_iswctype_l(_c,_ALPHA,_p))
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
#define luaL_newlibtable(L,l) (lua_createtable((L), 0, sizeof((l))/sizeof(*(l))-1))
#define LUA_TSTRING 4
#define _winver (* __MINGW_IMP_SYMBOL(_winver))
#define _WSTDLIB_DEFINED
#define __ptr32
#define pclose _pclose
#define __FLT_RADIX__ 2
#define LUA_HOOKCOUNT 3
#define __INT_LEAST16_TYPE__ short int
#define wpopen _wpopen
#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L
#define iswalnum(_c) (iswctype(_c,_ALPHA|_DIGIT))
#define lua_open() luaL_newstate()
#define LUA_GCSETSTEPMUL 7
#define __UINTMAX_C(c) c ## ULL
#define COMPAT53_H_
#define _alloca(x) __builtin_alloca((x))
#define __SSE_MATH__ 1
#define __ANONYMOUS_DEFINED
#define LUA_TNIL 0
#define LUA_JITLIBNAME "jit"
#define __k8 1
#define _HEAP_MAXREQ 0xFFFFFFFFFFFFFFE0
#define __ptr64
#define __SEH__ 1
#define __SIG_ATOMIC_MAX__ 0x7fffffff
#define LUAL_BUFFERSIZE (BUFSIZ > 16384 ? 8192 : BUFSIZ)
#define _CRT_ABS_DEFINED
#define iswxdigit(_c) (iswctype(_c,_HEX))
#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
#define EOVERFLOW 132
#define LUAI_MAXSTACK 65500
#define UCHAR_MAX (SCHAR_MAX * 2 + 1)
#define __SIZEOF_PTRDIFF_T__ 8
#define __PCTYPE_FUNC __pctype_func()
#define LUA_RELEASE "Lua 5.1.4"
#define UNALIGNED __unaligned
#define LUA_COPYRIGHT "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
#define _HEAPBADNODE (-4)
#define strncasecmp _strnicmp
#define _OFF_T_
#define LUA_HOOKRET 1
#define luaL_dofile(L,fn) (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0))
#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d)))
#define __FLT32X_MANT_DIG__ 53
#define __restrict_arr __restrict
#define __CRT__NO_INLINE 1
#define _inline __inline
#define _UNION_NAME(x)
#define EBUSY 16
#define _GCC_LIMITS_H_
#define LUA_CPATH "LUA_CPATH"
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
#define __x86_64__ 1
#define _MAX_DRIVE 3
#define __FLT32X_MIN_EXP__ (-1021)
#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF
#define EPROTO 134
#define _isgraph_l(_Char,_Locale) _ischartype_l(_Char,_PUNCT|_ALPHA|_DIGIT,_Locale)
#define ENODEV 19
#define iswpunct(_c) (iswctype(_c,_PUNCT))
#define LUA_OSLIBNAME "os"
#define __MSVCRT__ 1
#define __INT_FAST16_MAX__ 0x7fff
#define __CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_MEMORY_0_3_(__ret,__func,__type1,__attrib1,__arg1,__type2,__attrib2,__arg2,__type3,__attrib3,__arg3) _CRTIMP __ret __cdecl __func(__type1 * __attrib1 __arg1, __type2 __attrib2 __arg2, __type3 __attrib3 __arg3) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
#define INT_MAX __INT_MAX__
#define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL)
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_4_EX(__ret_type,__ret_policy,__decl_spec,__name,__sec_name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1,__arg2_type,__arg2,__arg3_type,__arg3,__arg4_type,__arg4)
#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i)))
#define luaL_addsize(B,s) ((B)->nelems += (s))
#define _TAGLC_ID_DEFINED
#define _isdigit_l(_Char,_Locale) _ischartype_l(_Char,_DIGIT,_Locale)
#define __FLT64_DIG__ 15
#define EROFS 30
#define __UINT_FAST32_MAX__ 0xffffffffU
#define __UINT_LEAST64_TYPE__ long long unsigned int
#define iscsym __iscsym
#define __FLT_HAS_QUIET_NAN__ 1
#define __FLT_MAX_10_EXP__ 38
#define luaL_prepbuffsize COMPAT53_CONCAT(COMPAT53_PREFIX, _prepbufsize_53)
#define __LONG_MAX__ 0x7fffffffL
#define __argc (* __MINGW_IMP_SYMBOL(__argc))
#define LUA_PATH "LUA_PATH"
#define __FLT64X_HAS_DENORM__ 1
#define COMPAT53_INCLUDE_SOURCE
#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL
#define va_copy(d,s) __builtin_va_copy(d,s)
#define __FLT_HAS_INFINITY__ 1
#define _pwctype (* __MINGW_IMP_SYMBOL(_pwctype))
#define __UINT_FAST16_TYPE__ short unsigned int
#define __DEC64_MAX__ 9.999999999999999E384DD
#define _CRT_TERMINATE_DEFINED
#define LUA_HOOKCALL 0
#define __MINGW_EXTENSION __extension__
#define __INT_FAST32_WIDTH__ 32
#define _NSTREAM_ 512
#define NULL ((void *)0)
#define __CHAR16_TYPE__ short unsigned int
#define __PRAGMA_REDEFINE_EXTNAME 1
#define E2BIG 7
#define _VA_LIST_DEFINED
#define __SIZE_WIDTH__ 64
#define __MINGW_HAVE_WIDE_C99_PRINTF 1
#define __SEG_FS 1
#define __INT_LEAST16_MAX__ 0x7fff
#define INT_MIN (-INT_MAX - 1)
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES_MEMORY 0
#define __DEC64_MANT_DIG__ 16
#define lua_tostring(L,i) lua_tolstring(L, (i), NULL)
#define __INT64_MAX__ 0x7fffffffffffffffLL
#define EDEADLK 36
#define __UINT_LEAST32_MAX__ 0xffffffffU
#define __SEG_GS 1
#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32
#define __GCC_ATOMIC_LONG_LOCK_FREE 2
#define __SIG_ATOMIC_WIDTH__ 32
#define _fgetc_nolock(_stream) (--(_stream)->_cnt >= 0 ? 0xff & *(_stream)->_ptr++ : _filbuf(_stream))
#define __INT_LEAST64_TYPE__ long long int
#define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
#define __INT16_TYPE__ short int
#define __INT_LEAST8_TYPE__ signed char
#define lua_strlen(L,i) lua_objlen(L, (i))
#define _I32_MAX 2147483647
#define _CRT_SWAB_DEFINED
#define _doserrno (*__doserrno())
#define __STDC_VERSION__ 201112L
#define ENOTDIR 20
#define __DEC32_MAX_EXP__ 97
#define EDOM 33
#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
#define __INT_FAST8_MAX__ 0x7f
#define LUA_OPSUB 1
#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128
#define __INTPTR_MAX__ 0x7fffffffffffffffLL
#define ECONNRESET 108
#define _getwchar_nolock() _getwc_nolock(stdin)
#define _INC_VADEFS
#define _P_WAIT 0
#define LUA_MASKLINE (1 << LUA_HOOKLINE)
#define luaL_buffinit COMPAT53_CONCAT(COMPAT53_PREFIX, _buffinit_53)
#define ENXIO 6
#define __GXX_MERGED_TYPEINFO_NAMES 0
#define LUA_YIELD 1
#define LUA_GCSTEP 5
#define __FLT64_HAS_QUIET_NAN__ 1
#define sys_nerr _sys_nerr
#define _IOLBF 0x0040
#define __stdcall
#define __FLT32_MIN_10_EXP__ (-37)
#define __SSE2__ 1
#define _crt_va_end(v) __builtin_va_end(v)
#define LUA_BITLIBNAME "bit"
#define __FLT32X_DIG__ 15
#define _iscntrl_l(_Char,_Locale) _ischartype_l(_Char,_CONTROL,_Locale)
#define _WCTYPE_DEFINED
#define luaL_addchar(B,c) ((void)((B)->nelems < (B)->capacity || luaL_prepbuffsize((B), 1)), ((B)->ptr[(B)->nelems++] = (c)))
#define COMPAT53_LUA_FILE_BUFFER_SIZE 4096
#define _CRT_SECURE_CPP_OVERLOAD_SECURE_NAMES 0
#define lua_rotate COMPAT53_CONCAT(COMPAT53_PREFIX, _rotate)
#define __LDBL_MANT_DIG__ 64
#define __MINGW_GNU_SCANF(__format,__args) __attribute__((__format__(gnu_scanf, __format,__args)))
#define iswgraph(_c) (iswctype(_c,_PUNCT|_ALPHA|_DIGIT))
#define ENAMETOOLONG 38
#define _getwc_nolock(_c) _fgetwc_nolock(_c)
#define __MINGW64_VERSION_STR __MINGW64_STRINGIFY(__MINGW64_VERSION_MAJOR) "." __MINGW64_STRINGIFY(__MINGW64_VERSION_MINOR)
#define __DBL_HAS_QUIET_NAN__ 1
#define __FLT64_HAS_INFINITY__ 1
#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x
#define _CALL_REPORTFAULT 0x2
#define LUA_NUMBER_SCAN "%lf"
#define lua_compare COMPAT53_CONCAT(COMPAT53_PREFIX, _compare)
#define LUA_VERSION "Lua 5.1"
#define __GNUC_VA_LIST
#define _GCC_MAX_ALIGN_T
#define __chvalidchk(a,b) (__PCTYPE_FUNC[(a)] & (b))
#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1)
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
#define _MALLOC_H_
#define FILENAME_MAX 260
#define _CRT_ATOF_DEFINED
#define _WRITE_ABORT_MSG 0x1
#define __mb_cur_max (* __MINGW_IMP_SYMBOL(__mb_cur_max))
#define __k8__ 1
#define __INTPTR_TYPE__ long long int
#define __UINT16_TYPE__ short unsigned int
#define __WCHAR_TYPE__ short unsigned int
#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d)))
#define __SIZEOF_FLOAT__ 4
#define _INC_STDDEF
#define _UI16_MAX 0xffffu
#define _ARGMAX 100
#define __pic__ 1
#define __MINGW_USYMBOL(sym) sym
#define __UINTPTR_MAX__ 0xffffffffffffffffULL
#define __INT_FAST64_WIDTH__ 64
#define LUA_GCSTOP 0
#define __DEC64_MIN_EXP__ (-382)
#define luaL_prepbuffer(B) luaL_prepbuffsize((B), LUAL_BUFFERSIZE)
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_SPLITPATH(__ret,__func,__dsttype,__src)
#define _iswcsymf_l(_c,_p) (_iswalpha_l(_c,_p) || ((_c)=='_'))
#define __FLT32_DECIMAL_DIG__ 9
#define __uintptr_t_defined
#define EADDRNOTAVAIL 101
#define _FREEA_INLINE
#define __INT_FAST64_MAX__ 0x7fffffffffffffffLL
#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
#define __forceinline extern __inline__ __attribute__((__always_inline__,__gnu_inline__))
#define BUFSIZ 512
#define __FLT_DIG__ 6
#define __FLT32_HAS_INFINITY__ 1
#define _malloca(size) ((((size) + _ALLOCA_S_MARKER_SIZE) <= _ALLOCA_S_THRESHOLD) ? _MarkAllocaS(_alloca((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_STACK_MARKER) : _MarkAllocaS(malloc((size) + _ALLOCA_S_MARKER_SIZE),_ALLOCA_S_HEAP_MARKER))
#define __FLT64X_MAX_EXP__ 16384
#define __UINT_FAST64_TYPE__ long long unsigned int
#define __min(a,b) (((a) < (b)) ? (a) : (b))
#define lua_absindex COMPAT53_CONCAT(COMPAT53_PREFIX, _absindex)
#define STDIN_FILENO 0
#define __INT_MAX__ 0x7fffffff
#define __amd64__ 1
#define MINGW_DDRAW_VERSION 7
#define _WCTYPE_INLINE_DEFINED
#define lua_rawlen(L,i) lua_objlen((L), (i))
#define WIN32 1
#define LUA_ERRSYNTAX 3
#define EPROTONOSUPPORT 135
#define UINT_MAX (INT_MAX * 2U + 1U)
#define _P_OVERLAY 2
#define _CRT_ALGO_DEFINED
#define LLONG_MAX __LONG_LONG_MAX__
#define __CRT_UUID_DECL(type,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
#define __code_model_medium__ 1
#define _TWO_DIGIT_EXPONENT 0x1
#define _STRUCT_NAME(x)
#define __INT64_TYPE__ long long int
#define SYS_OPEN _SYS_OPEN
#define EIO 5
#define __FLT_MAX_EXP__ 128
#define ENETUNREACH 118
#define EXDEV 18
#define __GNU_EXTENSION __MINGW_EXTENSION
#define WIN64 1
#define __ORDER_BIG_ENDIAN__ 4321
#define __DBL_MANT_DIG__ 53
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(__ret,__func,__type0,__arg0,__dsttype,__dst,__type1,__arg1)
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_2(__ret,__func,__type0,__arg0,__dsttype,__dst,__type1,__arg1,__type2,__arg2)
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_3(__ret,__func,__type0,__arg0,__dsttype,__dst,__type1,__arg1,__type2,__arg2,__type3,__arg3)
#define _crt_va_start(v,l) __builtin_va_start(v,l)
#define __SIZEOF_FLOAT128__ 16
#define __INT_LEAST64_MAX__ 0x7fffffffffffffffLL
#define _iswxdigit_l(_c,_p) (_iswctype_l(_c,_HEX,_p))
#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
#define _IOWRT 0x0002
#define __DEC64_MIN__ 1E-383DD
#define __WINT_TYPE__ short unsigned int
#define __UINT_LEAST32_TYPE__ unsigned int
#define __SIZEOF_SHORT__ 2
#define STDOUT_FILENO 1
#define __SSE__ 1
#define LUALIB_API LUA_API
#define _FILE_OFFSET_BITS_SET_FTELLO
#define __intptr_t_defined
#define __LDBL_MIN_EXP__ (-16381)
#define lua_geti COMPAT53_CONCAT(COMPAT53_PREFIX, _geti)
#define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
#define __MINGW_ATTRIB_DEPRECATED_STR(X)
#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64
#define _HEAPINFO_DEFINED
#define LUA_CDIR "!\\"
#define __MINGW_PRAGMA_PARAM(x) _Pragma (#x)
#define ENOSPC 28
#define stdout (&__iob_func()[1])
#define ENOEXEC 8
#define __WINT_WIDTH__ 16
#define MINGW_SDK_INIT
#define luaL_pushresultsize(B,s) (luaL_addsize((B), (s)), luaL_pushresult((B)))
#define EOF (-1)
#define __INT_LEAST8_MAX__ 0x7f
#define iswcntrl(_c) (iswctype(_c,_CONTROL))
#define __FLT32X_MAX_10_EXP__ 308
#define __MINGW_MSC_PREREQ(major,minor) 0
#define __crt_typefix(ctype)
#define LLONG_MIN (-LLONG_MAX - 1LL)
#define __MINGW_IMP_SYMBOL(sym) __imp_ ##sym
#define lua_tointegerx COMPAT53_CONCAT(COMPAT53_PREFIX, _tointegerx_53)
#define __SIZEOF_INT128__ 16
#define _wP_tmpdir L"\\"
#define LUAI_UACNUMBER double
#define __LDBL_MAX_10_EXP__ 4932
#define __ATOMIC_RELAXED 0
#define __DBL_EPSILON__ ((double)2.22044604925031308084726333618164062e-16L)
#define EMSGSIZE 115
#define luaL_getmetafield(L,o,e) (luaL_getmetafield((L), (o), (e)) ? lua_type((L), -1) : LUA_TNIL)
#define _isxdigit_l(_Char,_Locale) _ischartype_l(_Char,_HEX,_Locale)
#define lua_getregistry(L) lua_pushvalue(L, LUA_REGISTRYINDEX)
#define __thiscall __attribute__((__thiscall__))
#define _tolower(_Char) ((_Char)-'A'+'a')
#define LUA_REGISTRYINDEX (-10000)
#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128
#define _CRTRESTRICT
#define __UINT8_C(c) c
#define EFBIG 27
#define __FLT64_MAX_EXP__ 1024
#define ESRCH 3
#define __INT_LEAST32_TYPE__ int
#define _NLSCMPERROR 2147483647
#define SEEK_END 2
#define __SIZEOF_WCHAR_T__ 2
#define __UINT64_TYPE__ long long unsigned int
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
#define __DEFINE_CPP_OVERLOAD_SECURE_FUNC_0_1_ARGLIST(__ret,__func,__vfunc,__dsttype,__dst,__type1,__arg1)
#define LUA_GLOBALSINDEX (-10002)
#define ENOLCK 39
#define _HEX 0x80
#define ENFILE 23
#define EAGAIN 11
#define __MINGW32_MAJOR_VERSION 3
#define lua_tointeger(L,i) lua_tointegerx((L), (i), NULL)
#define _STDDEF_H_
#define _PTRDIFF_T_DEFINED
#define _ANONYMOUS_UNION __MINGW_EXTENSION
#define MB_CUR_MAX ___mb_cur_max_func()
#define __FLT128_HAS_QUIET_NAN__ 1
#define ENOSYS 40
#define luaL_addvalue COMPAT53_CONCAT(COMPAT53_PREFIX, _addvalue_53)
#define _MAX_FNAME 256
#define __INT_FAST8_TYPE__ signed char
#define _getchar_nolock() _getc_nolock(stdin)
#define EOPNOTSUPP 130
#define __fastcall __attribute__((__fastcall__))
#define __MINGW_GNUC_PREREQ(major,minor) (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)))
#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT)
#define _IOEOF 0x0010
#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x
#define va_arg(v,l) __builtin_va_arg(v,l)
#define _I32_MIN (-2147483647 - 1)
#define __GNUC_STDC_INLINE__ 1
#define _THREADLOCALEINFO
#define P_tmpdir _P_tmpdir
#define __FLT64_HAS_DENORM__ 1
#define _FILE_OFFSET_BITS_SET_OFFT
#define LUA_OPPOW 5
#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32
#define _ischartype_l(_Char,_Flag,_Locale) (((_Locale)!=NULL && (((_locale_t)(_Locale))->locinfo->mb_cur_max) > 1) ? _isctype_l(_Char,(_Flag),_Locale) : _chvalidchk_l(_Char,_Flag,_Locale))
#define __STRINGIFY(x) #x
#define __DBL_DECIMAL_DIG__ 17
#define __STDC_UTF_32__ 1
#define __unaligned
#define __MINGW_PRINTF_FORMAT ms_printf
#define _IOERR 0x0020
#define __INT_FAST8_WIDTH__ 8
#define __FXSR__ 1
#define EDEADLOCK EDEADLK
#define __DEC_EVAL_METHOD__ 2
#define ECONNABORTED 106
#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x
#define FOPEN_MAX 20
#define _isspace_l(_Char,_Locale) _ischartype_l(_Char,_SPACE,_Locale)
#define __CRT_STRINGIZE(_Value) #_Value
#define luaL_fileresult COMPAT53_CONCAT(COMPAT53_PREFIX, L_fileresult)
#define __MINGW64__ 1
#define _CRT_CTYPEDATA_DEFINED
#define lua_pushstring(L,s) (lua_pushstring((L), (s)), lua_tostring((L), -1))
#define luaL_execresult COMPAT53_CONCAT(COMPAT53_PREFIX, L_execresult)
#define _CRT_PACKING 8
#define _TRUNCATE ((size_t)-1)
#define environ _environ
#define _WAIT_CHILD 0
#define lua_rawgeti(L,i,n) (lua_rawgeti((L), (i), (n)), lua_type((L), -1))
#define lua_rawgetp COMPAT53_CONCAT(COMPAT53_PREFIX, _rawgetp)
#define _USEDENTRY 1
#define __UINT32_C(c) c ## U
#define _CRT_SECURE_CPP_NOTHROW throw()
#define __INTMAX_MAX__ 0x7fffffffffffffffLL
#define EISCONN 113
#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0)
#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
#define luaL_setn(L,i,j) ((void)0)
#define WINNT 1
#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
#define _CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES_COUNT 0
#define l_inspectstat(stat,what) ((void)0)
#define lua_callk(L,na,nr,ctx,cont) ((void)(ctx), (void)(cont), lua_call((L), (na), (nr)))
#define MINGW_HAS_DDRAW_H 1
#define _VA_LIST_T_H
#define __INT8_MAX__ 0x7f
#define __LONG_WIDTH__ 32
#define __PIC__ 1
#define _WAIT_GRANDCHILD 1
#define _CRT_SYSTEM_DEFINED
#define __UINT_FAST32_TYPE__ unsigned int
#define __MINGW_NOTHROW __attribute__ ((__nothrow__))
#define __CHAR32_TYPE__ unsigned int
#define ENOPROTOOPT 123
#define __MINGW_MBWC_CONVERT_DEFINED
#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F
#define LUA_IDSIZE 60
#define LUA_TNONE (-1)
#define _OFF64_T_DEFINED
#define __int8 char
#define _winminor (* __MINGW_IMP_SYMBOL(_winminor))
#define __va_list__
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
#define wcswcs wcsstr
#define lua_tonumberx COMPAT53_CONCAT(COMPAT53_PREFIX, _tonumberx)
#define LUA_TFUNCTION 6
#define __INT32_TYPE__ int
#define luaL_reg luaL_Reg
#define _CRT_WIDE(_String) __CRT_WIDE(_String)
#define ENOBUFS 119
#define __SIZEOF_DOUBLE__ 8
#define luaL_getsubtable COMPAT53_CONCAT(COMPAT53_PREFIX, L_getsubtable)
#define __FLT_MIN_10_EXP__ (-37)
#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64
#define lua_isinteger COMPAT53_CONCAT(COMPAT53_PREFIX, _isinteger)
#define __INT_LEAST32_WIDTH__ 32
#define __MINGW_ATTRIB_PURE __attribute__ ((__pure__))
#define LUA_STRLIBNAME "string"
#define _MAX_DIR 256
#define __INTMAX_TYPE__ long long int
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
#define _OUT_TO_STDERR 1
#define EFAULT 14
#define _MT
#define _INTEGRAL_MAX_BITS 64
#define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
#define __DEC128_MAX_EXP__ 6145
#define _CRTIMP_PURE _CRTIMP
#define EWOULDBLOCK 140
#define __MINGW64_VERSION_STATE "alpha"
#define __FLT32X_HAS_QUIET_NAN__ 1
#define va_end(v) __builtin_va_end(v)
#define __ATOMIC_CONSUME 1
#define __GNUC_MINOR__ 3
#define __INT_FAST16_WIDTH__ 16
#define __UINTMAX_MAX__ 0xffffffffffffffffULL
#define __DEC32_MANT_DIG__ 7
#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x
#define luaL_loadbufferx COMPAT53_CONCAT(COMPAT53_PREFIX, L_loadbufferx)
#define iswupper(_c) (iswctype(_c,_UPPER))
#define __DECLSPEC_SUPPORTED
#define ECONNREFUSED 107
#define __DBL_MAX_10_EXP__ 308
#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_2_EX(__ret_type,__ret_policy,__decl_spec,__name,__sec_name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1,__arg2_type,__arg2)
#define __INT16_C(c) c
#define LUA_FFILIBNAME "ffi"
#define STRUNCATE 80
#define __STDC__ 1
#define __CRTDECL __cdecl
#define __MINGW_POISON_NAME(__IFACE) __IFACE ##_layout_has_not_been_verified_and_its_declaration_is_most_likely_incorrect
#define EEXIST 17
#define __MINGW_HAVE_ANSI_C99_PRINTF 1
#define __PTRDIFF_TYPE__ long long int
#define errno (*_errno())
#define _pctype (* __MINGW_IMP_SYMBOL(_pctype))
#define __MINGW_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#define _INC_STDLIB
#define _winmajor (* __MINGW_IMP_SYMBOL(_winmajor))
#define _PTR_LD(x) ((unsigned char *)(&(x)->ld))
#define __ATOMIC_SEQ_CST 5
#define ENOENT 2
#define __UINT32_TYPE__ unsigned int
#define __FLT32X_MIN_10_EXP__ (-307)
#define _I64_MAX 9223372036854775807ll
#define LUA_API extern
#define __C89_NAMELESSUNIONNAME
#define _SECIMP __declspec(dllimport)
#define __UINTPTR_TYPE__ long long unsigned int
#define luaL_argcheck(L,cond,numarg,extramsg) ((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
#define luaL_setmetatable COMPAT53_CONCAT(COMPAT53_PREFIX, L_setmetatable)
#define _fputc_nolock(_c,_stream) (--(_stream)->_cnt >= 0 ? 0xff & (*(_stream)->_ptr++ = (char)(_c)) : _flsbuf((_c),(_stream)))
#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD
#define __DEC128_MANT_DIG__ 34
#define __LDBL_MIN_10_EXP__ (-4931)
#define lua_getfield(L,i,k) (lua_getfield((L), (i), (k)), lua_type((L), -1))
#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128
#define __SIZEOF_LONG_LONG__ 8
#define _INC_STDARG
#define DUMMYSTRUCTNAME
#define __FLT128_DECIMAL_DIG__ 36
#define __GCC_ATOMIC_LLONG_LOCK_FREE 2
#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x
#define __MINGW64_VERSION_MINOR 0
#define __LDBL_DIG__ 18
#define _STDARG_H
#define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
#define __FLT_DECIMAL_DIG__ 9
#define __UINT_FAST16_MAX__ 0xffff
#define _ERRCODE_DEFINED
#define _LEADBYTE 0x8000
#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
#define _P_DETACH 4
#define luaL_requiref COMPAT53_CONCAT(COMPAT53_PREFIX, L_requiref_53)
#define MB_LEN_MAX 5
#define __INT_LEAST64_WIDTH__ 64
#define _SPAWNV_DEFINED
#define _iswgraph_l(_c,_p) (_iswctype_l(_c,_PUNCT|_ALPHA|_DIGIT,_p))
#define __UINT_FAST8_TYPE__ unsigned char
#define _I8_MAX 127
#define __WIN64__ 1
#define _REPORT_ERRMODE 3
#define _I64_MIN (-9223372036854775807ll - 1)
#define __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3(__ret_type,__ret_policy,__decl_spec,__name,__dst_attr,__dst_type,__dst,__arg1_type,__arg1,__arg2_type,__arg2,__arg3_type,__arg3) __DEFINE_CPP_OVERLOAD_STANDARD_FUNC_0_3_EX(__ret_type, __ret_policy, __decl_spec, __func_name, __func_name ##_s, __dst_attr, __dst_type, __dst, __arg1_type, __arg1, __arg2_type, __arg2, __arg3_type, __arg3)
#define LUA_FILEHANDLE "FILE*"
#define _TIME32_T_DEFINED
#define LUA_NUMBER double
#define __ATOMIC_ACQ_REL 4
#define __ATOMIC_RELEASE 3
#define _FREEENTRY 0
#define _FILE_OFFSET_BITS_SET_FSEEKO
#define _iswdigit_l(_c,_p) (_iswctype_l(_c,_DIGIT,_p))
#define __declspec(x) __attribute__((x))
#define _M_AMD64 100

table.maxn

table.maxn was deprecated at 5.2, does it have any alternative?

Some people says this is fine:

table.maxn = function(t) return #t end

But others disagree, so I'm lost.

src/compat-5.3.c:59:9: error: implicit declaration of function 'strerror_r' [-Werror=implicit-function-declaration]

With compat-5.3.[ch] from 73fb49f I get following error:

gcc -O2 -fPIC -std=c89 -pedantic -Wall -Werror -O0 -g --coverage -DPACKAGE_STRING="\"LuaLDAP 1.2.3\"" -DLUA_C89_NUMBERS -I/opt/luaenv/versions/luajit-2.1.0-beta3/include/luajit-2.1 -I/usr/include -I/usr/include -I../compat/src   -c -o src/lualdap.o src/lualdap.c
In file included from src/compat-5.3.h:419:0,
                 from src/lualdap.c:26:
src/compat-5.3.c: In function 'compat53_strerror':
src/compat-5.3.c:59:9: error: implicit declaration of function 'strerror_r' [-Werror=implicit-function-declaration]
     if (strerror_r(en, buff, sz)) {
         ^~~~~~~~~~

For details see:

The strerror(3) manpage says:

SYNOPSIS
       #include <string.h>

       char *strerror(int errnum);

       int strerror_r(int errnum, char *buf, size_t buflen);
                   /* XSI-compliant */

       char *strerror_r(int errnum, char *buf, size_t buflen);
                   /* GNU-specific */

       char *strerror_l(int errnum, locale_t locale);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

       strerror_r():
           The XSI-compliant version is provided if:
           (_POSIX_C_SOURCE >= 200112L) && !  _GNU_SOURCE
           Otherwise, the GNU-specific version is provided.

DESCRIPTION
       [...]

   strerror_r()
       The strerror_r() function is similar to strerror(), but is thread safe.  This function is available in two versions: an XSI-compliant version specified in POSIX.1-2001 (available since glibc 2.3.4, but not POSIX-compliant until glibc 2.13), and a GNU-specific version (available since glibc 2.0).  The XSI-compliant version is  provided  with  the
       feature test macros settings shown in the SYNOPSIS; otherwise the GNU-specific version is provided.  If no feature test macros are explicitly defined, then (since glibc 2.4) _POSIX_C_SOURCE is defined by default with the value 200112L, so that the XSI-compliant version of strerror_r() is provided by default.

However, the feature_test_macros(7) manpage appears to disagree (by stating that 200112L excludes the XSI extension):

DESCRIPTION
   [...]

   Feature test macros understood by glibc
       [...]

       _POSIX_C_SOURCE
               [...]

               ·  (Since glibc 2.3.3) The value 200112L or greater additionally exposes definitions corresponding to the POSIX.1-2001 base specification (excluding the XSI extension).  [...]

Hence I did not test setting _POSIX_C_SOURCE.

Defining _XOPEN_SOURCE=600 fixes the build. I suggest to add instructions regarding this fact to the readme.

New function lua_numbertointeger

http://www.lua.org/manual/5.3/manual.html#lua_numbertointeger

int lua_numbertointeger (lua_Number n, lua_Integer *p);
Converts a Lua float to a Lua integer. This macro assumes that n has an integral value. If that value is within the range of Lua integers, it is converted to an integer and assigned to *p. The macro results in a boolean indicating whether the conversion was successful. (Note that this range test can be tricky to do correctly without this macro, due to roundings.)

This macro may evaluate its arguments more than once.

Problems with detection of strerror_r

In my system (Linux, GCC 6.2.0, Glibc 2.24), the latest compat-5.3.c is failing to build:

lua-compat-5.3/compat-5.3.c:36:47: error: operator '!' has no right operand
         (!defined(_GNU_SOURCE) || !_GNU_SOURCE)
                                               ^

My app defines _GNU_SOURCE with #define _GNU_SOURCE with no value, as usual.

Changing that line into (!defined(_GNU_SOURCE)), however, produces this compile-time warning:

In file included from lua-compat-5.3/compat-5.3.h:415:0,
                 from lua-compat-5.3/compat-5.3.c:7:
lua-compat-5.3/compat-5.3.c: In function ‘compat53_strerror’:
lua-compat-5.3/compat-5.3.c:85:10: warning: implicit declaration of function ‘strerror_r’ [-Wimplicit-function-declaration]
   return strerror_r(en, buff, sz);
          ^~~~~~~~~~
lua-compat-5.3/compat-5.3.c:85:10: warning: return makes pointer from integer without a cast [-Wint-conversion]
   return strerror_r(en, buff, sz);
          ^~~~~~~~~~~~~~~~~~~~~~~~

I don't get the warning if I force the defines to use the XSI version:

#define COMPAT53_HAVE_STRERROR_R_XSI 1                                                                       
#define COMPAT53_HAVE_STRERROR_R_GNU 0

Something borked in my setup as well, maybe?

new function lua_rotate

http://www.lua.org/manual/5.3/manual.html#lua_rotate

void lua_rotate (lua_State *L, int idx, int n);
Rotates the stack elements from idx to the top n positions in the direction of the top, for a positive n, or -n positions in the direction of the bottom, for a negative n. The absolute value of n must not be greater than the size of the slice being rotated.

Compiling with Lua 5.3 fails

http 0.2-0 depends on compat53 >= 0.3 (not installed)
Installing https://luarocks.org/compat53-0.4-1.src.rock
gcc -O2 -fPIC -I/usr/include/lua5.3 -c lutf8lib.c -o lutf8lib.o
gcc -shared -o compat53/utf8.so -L/usr/lib lutf8lib.o
gcc -O2 -fPIC -I/usr/include/lua5.3 -c ltablib.c -o ltablib.o
gcc -shared -o compat53/table.so -L/usr/lib ltablib.o
gcc -O2 -fPIC -I/usr/include/lua5.3 -c lstrlib.c -o lstrlib.o
lstrlib.c: In function ‘str_format’:
lstrlib.c:1019:59: error: macro "lua_number2strx" passed 5 arguments, but takes just 4
                                   luaL_checknumber(L, arg));
                                                           ^
lstrlib.c:1018:16: error: ‘lua_number2strx’ undeclared (first use in this function)
           nb = lua_number2strx(L, buff, MAX_ITEM, form,
                ^
lstrlib.c:1018:16: note: each undeclared identifier is reported only once for each function it appears in

Error: Failed installing dependency: https://luarocks.org/http-0.2-0.all.rock - Failed installing dependency: https://luarocks.org/compat53-0.4-1.src.rock - Build error: Failed compiling object lstrlib.o

release automation

I see v12 got tagged here, but I don't see it on luarocks.org yet. I started using the C code directly, but now have a project with v11 Lua sources being installed with module tooling. Probably not a big deal given the minor change log, but still probably worth pushing.

Do you want CI deploy tooling setup for this repo to build and push on rockspec changes?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.