Skip to content

Commit 35ad7e2

Browse files
PatriceJiangdrelaptop
authored andcommitted
[luajit] upgrade to 2.1.0-beta3 & fix cmakelists.txt deps (#337)
1 parent 74fbf7e commit 35ad7e2

File tree

10 files changed

+33
-35
lines changed

10 files changed

+33
-35
lines changed

lua/luajit/include/lauxlib.h

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
#include "lua.h"
1616

1717

18-
#define luaL_getn(L,i) ((int)lua_objlen(L, i))
19-
#define luaL_setn(L,i,j) ((void)0) /* no op! */
20-
2118
/* extra error code for `luaL_load' */
2219
#define LUA_ERRFILE (LUA_ERRERR+1)
2320

@@ -58,6 +55,10 @@ LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...);
5855
LUALIB_API int (luaL_checkoption) (lua_State *L, int narg, const char *def,
5956
const char *const lst[]);
6057

58+
/* pre-defined references */
59+
#define LUA_NOREF (-2)
60+
#define LUA_REFNIL (-1)
61+
6162
LUALIB_API int (luaL_ref) (lua_State *L, int t);
6263
LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref);
6364

@@ -84,6 +85,11 @@ LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz,
8485
const char *name, const char *mode);
8586
LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
8687
int level);
88+
LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup);
89+
LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname,
90+
int sizehint);
91+
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
92+
LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname);
8793

8894

8995
/*
@@ -113,6 +119,11 @@ LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
113119

114120
#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n)))
115121

122+
/* From Lua 5.2. */
123+
#define luaL_newlibtable(L, l) \
124+
lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1)
125+
#define luaL_newlib(L, l) (luaL_newlibtable(L, l), luaL_setfuncs(L, l, 0))
126+
116127
/*
117128
** {======================================================
118129
** Generic Buffer manipulation
@@ -147,21 +158,4 @@ LUALIB_API void (luaL_pushresult) (luaL_Buffer *B);
147158

148159
/* }====================================================== */
149160

150-
151-
/* compatibility with ref system */
152-
153-
/* pre-defined references */
154-
#define LUA_NOREF (-2)
155-
#define LUA_REFNIL (-1)
156-
157-
#define lua_ref(L,lock) ((lock) ? luaL_ref(L, LUA_REGISTRYINDEX) : \
158-
(lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))
159-
160-
#define lua_unref(L,ref) luaL_unref(L, LUA_REGISTRYINDEX, (ref))
161-
162-
#define lua_getref(L,ref) lua_rawgeti(L, LUA_REGISTRYINDEX, (ref))
163-
164-
165-
#define luaL_reg luaL_Reg
166-
167161
#endif

lua/luajit/include/lua.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@
3939
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
4040

4141

42-
/* thread status; 0 is OK */
42+
/* thread status */
43+
#define LUA_OK 0
4344
#define LUA_YIELD 1
4445
#define LUA_ERRRUN 2
4546
#define LUA_ERRSYNTAX 3
@@ -347,6 +348,13 @@ LUA_API void *lua_upvalueid (lua_State *L, int idx, int n);
347348
LUA_API void lua_upvaluejoin (lua_State *L, int idx1, int n1, int idx2, int n2);
348349
LUA_API int lua_loadx (lua_State *L, lua_Reader reader, void *dt,
349350
const char *chunkname, const char *mode);
351+
LUA_API const lua_Number *lua_version (lua_State *L);
352+
LUA_API void lua_copy (lua_State *L, int fromidx, int toidx);
353+
LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *isnum);
354+
LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *isnum);
355+
356+
/* From Lua 5.3. */
357+
LUA_API int lua_isyieldable (lua_State *L);
350358

351359

352360
struct lua_Debug {

lua/luajit/include/luaconf.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
** Configuration header.
3-
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3+
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
44
*/
55

66
#ifndef luaconf_h
@@ -37,7 +37,7 @@
3737
#endif
3838
#define LUA_LROOT "/usr/local"
3939
#define LUA_LUADIR "/lua/5.1/"
40-
#define LUA_LJDIR "/luajit-2.1.0-beta2/"
40+
#define LUA_LJDIR "/luajit-2.1.0-beta3/"
4141

4242
#ifdef LUA_ROOT
4343
#define LUA_JROOT LUA_ROOT
@@ -79,7 +79,7 @@
7979
#define LUA_IGMARK "-"
8080
#define LUA_PATH_CONFIG \
8181
LUA_DIRSEP "\n" LUA_PATHSEP "\n" LUA_PATH_MARK "\n" \
82-
LUA_EXECDIR "\n" LUA_IGMARK
82+
LUA_EXECDIR "\n" LUA_IGMARK "\n"
8383

8484
/* Quoting in error messages. */
8585
#define LUA_QL(x) "'" x "'"
@@ -92,10 +92,6 @@
9292
#define LUAI_GCMUL 200 /* Run GC at 200% of allocation speed. */
9393
#define LUA_MAXCAPTURES 32 /* Max. pattern captures. */
9494

95-
/* Compatibility with older library function names. */
96-
#define LUA_COMPAT_MOD /* OLD: math.mod, NEW: math.fmod */
97-
#define LUA_COMPAT_GFIND /* OLD: string.gfind, NEW: string.gmatch */
98-
9995
/* Configuration for the frontend (the luajit executable). */
10096
#if defined(luajit_c)
10197
#define LUA_PROGNAME "luajit" /* Fallback frontend name. */

lua/luajit/include/luajit.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
** LuaJIT -- a Just-In-Time Compiler for Lua. http://luajit.org/
33
**
4-
** Copyright (C) 2005-2016 Mike Pall. All rights reserved.
4+
** Copyright (C) 2005-2017 Mike Pall. All rights reserved.
55
**
66
** Permission is hereby granted, free of charge, to any person obtaining
77
** a copy of this software and associated documentation files (the
@@ -30,10 +30,10 @@
3030

3131
#include "lua.h"
3232

33-
#define LUAJIT_VERSION "LuaJIT 2.1.0-beta2"
33+
#define LUAJIT_VERSION "LuaJIT 2.1.0-beta3"
3434
#define LUAJIT_VERSION_NUM 20100 /* Version 2.1.0 = 02.01.00. */
35-
#define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta2
36-
#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2016 Mike Pall"
35+
#define LUAJIT_VERSION_SYM luaJIT_version_2_1_0_beta3
36+
#define LUAJIT_COPYRIGHT "Copyright (C) 2005-2017 Mike Pall"
3737
#define LUAJIT_URL "http://luajit.org/"
3838

3939
/* Modes for luaJIT_setmode. */

lua/luajit/include/lualib.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
** Standard library header.
3-
** Copyright (C) 2005-2016 Mike Pall. See Copyright Notice in luajit.h
3+
** Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h
44
*/
55

66
#ifndef _LUALIB_H
Binary file not shown.
Binary file not shown.
-31.6 KB
Binary file not shown.

lua/luasocket/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ endif()
4444

4545
target_include_directories(${target_name}
4646
INTERFACE ..
47-
PRIVATE ../lua
47+
PRIVATE ../luajit/include
4848
)
4949

5050
set_target_properties(${target_name}

lua/tolua/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ add_library(${target_name} STATIC
1717
${${target_name}_src}
1818
)
1919

20-
target_include_directories(${target_name} PRIVATE ../lua)
20+
target_include_directories(${target_name} PRIVATE ../luajit/include)
2121
target_include_directories(${target_name} PUBLIC .)
2222

2323
set_target_properties(${target_name}

0 commit comments

Comments
 (0)