diff options
Diffstat (limited to 'core/src')
| m--------- | core/src/lua/lua | 0 | ||||
| -rw-r--r-- | core/src/lua/xmake.lua | 8 | ||||
| -rwxr-xr-x | core/src/lua/xmake.sh | 4 | ||||
| -rw-r--r-- | core/src/xmake/curses/curses.c | 42 | ||||
| -rw-r--r-- | core/src/xmake/os/sleep.c | 2 |
5 files changed, 32 insertions, 24 deletions
diff --git a/core/src/lua/lua b/core/src/lua/lua -Subproject 1ab3208a1fceb12fca8f24ba57d6e13c5bff15e +Subproject a5522f06d2679b8f18534fd6a9968f7eb539dc3 diff --git a/core/src/lua/xmake.lua b/core/src/lua/xmake.lua index 006480397..d732b89fb 100644 --- a/core/src/lua/xmake.lua +++ b/core/src/lua/xmake.lua @@ -14,13 +14,19 @@ target("lua") add_includedirs("lua", {public = true}) -- add the common source files - add_files("lua/*.c|lua.c|onelua.c|loslib.c") + add_files("lua/*.c|lua.c|onelua.c|loslib.c|lparser.c") + + -- allow reassignment of for-loop control variables (lua 5.4 compatible) + add_files("lua/lparser.c", {rules = "utils.replace", replaces = { + {"RDKCONST%);", "VDKREG);"}, + }}) if not is_plat("iphoneos") then add_files("lua/loslib.c") end -- add definitions add_defines("LUA_COMPAT_5_1", "LUA_COMPAT_5_2", "LUA_COMPAT_5_3", {public = true}) + if is_plat("windows", "mingw") then -- it has been defined in luaconf.h --add_defines("LUA_USE_WINDOWS") diff --git a/core/src/lua/xmake.sh b/core/src/lua/xmake.sh index 59eff5dd3..754cbcdb3 100755 --- a/core/src/lua/xmake.sh +++ b/core/src/lua/xmake.sh @@ -30,7 +30,8 @@ target "lua" add_files "lua/lobject.c" add_files "lua/lopcodes.c" add_files "lua/loslib.c" - add_files "lua/lparser.c" + # allow reassignment of for-loop control variables (lua 5.4 compatible) + add_files "lua/lparser.c" "{replace = {RDKCONST);, VDKREG);}}" add_files "lua/lstate.c" add_files "lua/lstring.c" add_files "lua/lstrlib.c" @@ -44,6 +45,7 @@ target "lua" # add definitions add_defines "LUA_COMPAT_5_1" "LUA_COMPAT_5_2" "LUA_COMPAT_5_3" "{public}" + if is_plat "mingw"; then true # it has been defined in luaconf.h #add_defines "LUA_USE_WINDOWS" diff --git a/core/src/xmake/curses/curses.c b/core/src/xmake/curses/curses.c index 95a0fcdac..6736ec05e 100644 --- a/core/src/xmake/curses/curses.c +++ b/core/src/xmake/curses/curses.c @@ -228,8 +228,8 @@ static int xm_curses_window_tostring(lua_State *lua) { // window:move(y, x) static int xm_curses_window_move(lua_State *lua) { WINDOW *w = xm_curses_window_check(lua, 1); - int y = luaL_checkint(lua, 2); - int x = luaL_checkint(lua, 3); + int y = (int)luaL_checkinteger(lua, 2); + int x = (int)luaL_checkinteger(lua, 3); lua_pushboolean(lua, XM_CURSES_OK(wmove(w, y, x))); return 1; } @@ -276,7 +276,7 @@ static int xm_curses_window_addch(lua_State *lua) { static int xm_curses_window_addnstr(lua_State *lua) { WINDOW *w = xm_curses_window_check(lua, 1); const char *str = luaL_checkstring(lua, 2); - int n = luaL_optint(lua, 3, -1); + int n = (int)luaL_optinteger(lua, 3, -1); if (n < 0) n = (int)lua_strlen(lua, 2); lua_pushboolean(lua, XM_CURSES_OK(waddnstr(w, str, n))); @@ -333,7 +333,7 @@ static int xm_curses_window_getch(lua_State *lua) { // window:attroff(attrs) static int xm_curses_window_attroff(lua_State *lua) { WINDOW *w = xm_curses_window_check(lua, 1); - int attrs = luaL_checkint(lua, 2); + int attrs = (int)luaL_checkinteger(lua, 2); lua_pushboolean(lua, XM_CURSES_OK(wattroff(w, attrs))); return 1; } @@ -341,7 +341,7 @@ static int xm_curses_window_attroff(lua_State *lua) { // window:attron(attrs) static int xm_curses_window_attron(lua_State *lua) { WINDOW *w = xm_curses_window_check(lua, 1); - int attrs = luaL_checkint(lua, 2); + int attrs = (int)luaL_checkinteger(lua, 2); lua_pushboolean(lua, XM_CURSES_OK(wattron(w, attrs))); return 1; } @@ -349,7 +349,7 @@ static int xm_curses_window_attron(lua_State *lua) { // window:attrset(attrs) static int xm_curses_window_attrset(lua_State *lua) { WINDOW *w = xm_curses_window_check(lua, 1); - int attrs = luaL_checkint(lua, 2); + int attrs = (int)luaL_checkinteger(lua, 2); lua_pushboolean(lua, XM_CURSES_OK(wattrset(w, attrs))); return 1; } @@ -358,12 +358,12 @@ static int xm_curses_window_attrset(lua_State *lua) { static int xm_curses_window_copywin(lua_State *lua) { WINDOW *srcwin = xm_curses_window_check(lua, 1); WINDOW *dstwin = xm_curses_window_check(lua, 2); - int sminrow = luaL_checkint(lua, 3); - int smincol = luaL_checkint(lua, 4); - int dminrow = luaL_checkint(lua, 5); - int dmincol = luaL_checkint(lua, 6); - int dmaxrow = luaL_checkint(lua, 7); - int dmaxcol = luaL_checkint(lua, 8); + int sminrow = (int)luaL_checkinteger(lua, 3); + int smincol = (int)luaL_checkinteger(lua, 4); + int dminrow = (int)luaL_checkinteger(lua, 5); + int dmincol = (int)luaL_checkinteger(lua, 6); + int dmaxrow = (int)luaL_checkinteger(lua, 7); + int dmaxcol = (int)luaL_checkinteger(lua, 8); int overlay = lua_toboolean(lua, 9); lua_pushboolean(lua, XM_CURSES_OK( @@ -646,7 +646,7 @@ static int xm_curses_getmouse(lua_State *lua) { } static int xm_curses_mousemask(lua_State *lua) { - mmask_t m = luaL_checkint(lua, 1); + mmask_t m = (mmask_t)luaL_checkinteger(lua, 1); mmask_t om; m = mousemask(m, &om); lua_pushinteger(lua, m); @@ -656,22 +656,22 @@ static int xm_curses_mousemask(lua_State *lua) { #endif static int xm_curses_init_pair(lua_State *lua) { - short pair = luaL_checkint(lua, 1); - short f = luaL_checkint(lua, 2); - short b = luaL_checkint(lua, 3); + short pair = (short)luaL_checkinteger(lua, 1); + short f = (short)luaL_checkinteger(lua, 2); + short b = (short)luaL_checkinteger(lua, 3); lua_pushboolean(lua, XM_CURSES_OK(init_pair(pair, f, b))); return 1; } static int xm_curses_COLOR_PAIR(lua_State *lua) { - int n = luaL_checkint(lua, 1); + int n = (int)luaL_checkinteger(lua, 1); lua_pushnumber(lua, COLOR_PAIR(n)); return 1; } static int xm_curses_curs_set(lua_State *lua) { - int vis = luaL_checkint(lua, 1); + int vis = (int)luaL_checkinteger(lua, 1); int state = curs_set(vis); if (state == ERR) return 0; @@ -681,7 +681,7 @@ static int xm_curses_curs_set(lua_State *lua) { } static int xm_curses_napms(lua_State *lua) { - int ms = luaL_checkint(lua, 1); + int ms = (int)luaL_checkinteger(lua, 1); lua_pushboolean(lua, XM_CURSES_OK(napms(ms))); return 1; } @@ -714,8 +714,8 @@ static int xm_curses_nl(lua_State *lua) { } static int xm_curses_newpad(lua_State *lua) { - int nlines = luaL_checkint(lua, 1); - int ncols = luaL_checkint(lua, 2); + int nlines = (int)luaL_checkinteger(lua, 1); + int ncols = (int)luaL_checkinteger(lua, 2); xm_curses_window_new(lua, newpad(nlines, ncols)); return 1; } diff --git a/core/src/xmake/os/sleep.c b/core/src/xmake/os/sleep.c index 0c8fa135e..384121981 100644 --- a/core/src/xmake/os/sleep.c +++ b/core/src/xmake/os/sleep.c @@ -35,7 +35,7 @@ */ tb_int_t xm_os_sleep(lua_State *lua) { tb_assert_and_check_return_val(lua, 0); - tb_long_t interval = (tb_long_t)luaL_checklong(lua, 1); + tb_long_t interval = (tb_long_t)luaL_checkinteger(lua, 1); if (interval >= 0) { tb_msleep(interval); } |
