Skip to content

Commit

Permalink
Merge pull request #253 from zhaozg/master
Browse files Browse the repository at this point in the history
update lrexlib to rel-2-9-1
  • Loading branch information
zhaozg authored Jul 31, 2021
2 parents 1614bf9 + 39d40b0 commit afea1cd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,18 @@ jobs:
matrix:
os: [macos-latest, ubuntu-latest]
build_type: [tiny, regular-asm]
lua_engine: [LuaJIT, Lua]
env:
BUILD_TYPE: ${{ matrix.build_type }}
WITH_LUA_ENGINE: ${{ matrix.lua_engine }}

steps:
- uses: actions/checkout@v2
with:
submodules: recursive

- name: Configure
run: WITHOUT_AMALG=1 make ${BUILD_TYPE}
run: WITHOUT_AMALG=1 make ${BUILD_TYPE} WITH_LUA_ENGINE=${WITH_LUA_ENGINE}

- name: Build
run: make
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ else (WithSharedLibluv)
include_directories(deps/luv/src)
include_directories(deps/luv/deps/libuv/include)
if (WITH_LUA_ENGINE STREQUAL Lua)
include_directories(deps/luv/deps/lua/src)
include_directories(deps/luv/deps/lua)
set(LUVI_LIBRARIES libluv_a lualib uv_a)
else()
include_directories(deps/luv/deps/luajit/src)
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ ifdef WITHOUT_AMALG
CMAKE_FLAGS+= -DWITH_AMALG=OFF
endif

ifdef WITH_LUA_ENGINE
CMAKE_FLAGS+= -DWITH_LUA_ENGINE=$(WITH_LUA_ENGINE)
endif

WITH_SHARED_LIBLUV ?= OFF

CMAKE_FLAGS += \
Expand Down
11 changes: 9 additions & 2 deletions src/luvi_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,30 @@
#define lutf8lib_c

#include "luvi.h"

#if (LUA_VERSION_NUM < 503)
#include "compat-5.3.h"
#include "compat-5.3.c"

#include "lprefix.h"
#include "lstrlib.c"
#include "ltablib.c"
#include "lutf8lib.c"
#endif

#if (LUA_VERSION_NUM == 501)
#ifndef LUA_UTF8LIBNAME
#define LUA_UTF8LIBNAME "utf8"
#endif

#if (LUA_VERSION_NUM == 501)
#ifndef UTF8PATT_501
#define UTF8PATT_501 "[%z\x01-\x7F\xC2-\xF4][\x80-\xBF]*"
#endif
#endif

void luvi_openlibs(lua_State *L) {
luaL_openlibs(L);
#if (LUA_VERSION_NUM!=503)
#if (LUA_VERSION_NUM < 503)
{
static luaL_Reg const funcs[] = {
{ "pack", str_pack },
Expand All @@ -32,7 +35,11 @@ void luvi_openlibs(lua_State *L) {
{ NULL, NULL }
};

#if (LUA_VERSION_NUM > 501)
luaL_newlib(L, funcs);
#else
luaL_register(L, LUA_STRLIBNAME, funcs);
#endif
}
lua_pop(L, 1);

Expand Down
5 changes: 5 additions & 0 deletions src/snapshot.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#include "./luvi.h"

#if (LUA_VERSION_NUM > 501)
#define lua_getfenv lua_getuservalue
#define lua_setfenv lua_setuservalue
#endif

#if defined(_MSC_VER) && _MSC_VER < 1900

#define snprintf c99_snprintf
Expand Down

0 comments on commit afea1cd

Please sign in to comment.