mirror of
https://github.com/vxcontrol/lualibs-lrexlib.git
synced 2026-07-01 09:25:08 -04:00
Replace all occurrences of luaL_optint with casted luaL_optinteger.
This also achieves Lua 5.4 compatibility.
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
||||
local flavours = {"PCRE", "PCRE2", "POSIX", "oniguruma", "TRE", "GNU"}
|
||||
local version_dashed = version:gsub ("%.", "-")
|
||||
-- FIXME: PCRE2 define should be only in PCRE2 rockspec
|
||||
local defines = {"VERSION=\""..version.."\"", "LUA_COMPAT_5_2",
|
||||
local defines = {"VERSION=\""..version.."\"",
|
||||
"PCRE2_CODE_UNIT_WIDTH=8"}
|
||||
|
||||
-- FIXME: When Lua 5.1 support is dropped, use an env argument with
|
||||
|
||||
+6
-6
@@ -56,7 +56,7 @@ static int OptLimit (lua_State *L, int pos) {
|
||||
|
||||
|
||||
static int get_startoffset(lua_State *L, int stackpos, size_t len) {
|
||||
int startoffset = luaL_optint(L, stackpos, 1);
|
||||
int startoffset = (int)luaL_optinteger(L, stackpos, 1);
|
||||
if(startoffset > 0)
|
||||
startoffset--;
|
||||
else if(startoffset < 0) {
|
||||
@@ -155,7 +155,7 @@ static void checkarg_gsub (lua_State *L, TArgComp *argC, TArgExec *argE) {
|
||||
argE->funcpos2 = 4;
|
||||
argE->maxmatch = OptLimit (L, 4);
|
||||
argC->cflags = ALG_GETCFLAGS (L, 5);
|
||||
argE->eflags = luaL_optint (L, 6, ALG_EFLAGS_DFLT);
|
||||
argE->eflags = (int)luaL_optinteger (L, 6, ALG_EFLAGS_DFLT);
|
||||
ALG_GETCARGS (L, 7, argC);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ static void checkarg_count (lua_State *L, TArgComp *argC, TArgExec *argE) {
|
||||
check_subject (L, 1, argE);
|
||||
check_pattern (L, 2, argC);
|
||||
argC->cflags = ALG_GETCFLAGS (L, 3);
|
||||
argE->eflags = luaL_optint (L, 4, ALG_EFLAGS_DFLT);
|
||||
argE->eflags = (int)luaL_optinteger (L, 4, ALG_EFLAGS_DFLT);
|
||||
ALG_GETCARGS (L, 5, argC);
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ static void checkarg_find_func (lua_State *L, TArgComp *argC, TArgExec *argE) {
|
||||
check_pattern (L, 2, argC);
|
||||
argE->startoffset = get_startoffset (L, 3, argE->textlen);
|
||||
argC->cflags = ALG_GETCFLAGS (L, 4);
|
||||
argE->eflags = luaL_optint (L, 5, ALG_EFLAGS_DFLT);
|
||||
argE->eflags = (int)luaL_optinteger (L, 5, ALG_EFLAGS_DFLT);
|
||||
ALG_GETCARGS (L, 6, argC);
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ static void checkarg_gmatch_split (lua_State *L, TArgComp *argC, TArgExec *argE)
|
||||
check_subject (L, 1, argE);
|
||||
check_pattern (L, 2, argC);
|
||||
argC->cflags = ALG_GETCFLAGS (L, 3);
|
||||
argE->eflags = luaL_optint (L, 4, ALG_EFLAGS_DFLT);
|
||||
argE->eflags = (int)luaL_optinteger (L, 4, ALG_EFLAGS_DFLT);
|
||||
ALG_GETCARGS (L, 5, argC);
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ static void checkarg_find_method (lua_State *L, TArgExec *argE, TUserdata **ud)
|
||||
*ud = check_ud (L);
|
||||
check_subject (L, 2, argE);
|
||||
argE->startoffset = get_startoffset (L, 3, argE->textlen);
|
||||
argE->eflags = luaL_optint (L, 4, ALG_EFLAGS_DFLT);
|
||||
argE->eflags = (int)luaL_optinteger (L, 4, ALG_EFLAGS_DFLT);
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@
|
||||
#define ALG_CFLAGS_DFLT RE_SYNTAX_POSIX_EXTENDED
|
||||
#define ALG_EFLAGS_DFLT 0
|
||||
|
||||
#define ALG_GETCFLAGS(L,pos) luaL_optint(L, pos, ALG_CFLAGS_DFLT)
|
||||
#define ALG_GETCFLAGS(L,pos) (int)luaL_optinteger(L, pos, ALG_CFLAGS_DFLT)
|
||||
|
||||
static const unsigned char *gettranslate (lua_State *L, int pos);
|
||||
#define ALG_GETCARGS(L,pos,argC) argC->translate = gettranslate (L, pos)
|
||||
|
||||
+3
-3
@@ -127,9 +127,9 @@ static void checkarg_dfa_exec (lua_State *L, TArgExec *argE, TPcre **ud) {
|
||||
*ud = check_ud (L);
|
||||
argE->text = luaL_checklstring (L, 2, &argE->textlen);
|
||||
argE->startoffset = get_startoffset (L, 3, argE->textlen);
|
||||
argE->eflags = luaL_optint (L, 4, ALG_EFLAGS_DFLT);
|
||||
argE->ovecsize = luaL_optint (L, 5, 100);
|
||||
argE->wscount = luaL_optint (L, 6, 50);
|
||||
argE->eflags = (int)luaL_optinteger (L, 4, ALG_EFLAGS_DFLT);
|
||||
argE->ovecsize = (size_t)luaL_optinteger (L, 5, 100);
|
||||
argE->wscount = (size_t)luaL_optinteger (L, 6, 50);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
+4
-4
@@ -136,9 +136,9 @@ static void checkarg_dfa_exec (lua_State *L, TArgExec *argE, TPcre2 **ud) {
|
||||
*ud = check_ud (L);
|
||||
argE->text = luaL_checklstring (L, 2, &argE->textlen);
|
||||
argE->startoffset = get_startoffset (L, 3, argE->textlen);
|
||||
argE->eflags = luaL_optint (L, 4, ALG_EFLAGS_DFLT);
|
||||
argE->ovecsize = luaL_optint (L, 5, 100);
|
||||
argE->wscount = luaL_optint (L, 6, 50);
|
||||
argE->eflags = (int)luaL_optinteger (L, 4, ALG_EFLAGS_DFLT);
|
||||
argE->ovecsize = (size_t)luaL_optinteger (L, 5, 100);
|
||||
argE->wscount = (size_t)luaL_optinteger (L, 6, 50);
|
||||
}
|
||||
|
||||
static void push_chartables_meta (lua_State *L) {
|
||||
@@ -377,7 +377,7 @@ static int Lpcre2_version (lua_State *L) {
|
||||
//### TODO: write tests for this method.
|
||||
static int Lpcre2_jit_compile (lua_State *L) {
|
||||
TPcre2 *ud = check_ud (L);
|
||||
uint32_t options = (uint32_t) luaL_optint (L, 2, PCRE2_JIT_COMPLETE);
|
||||
uint32_t options = (uint32_t) luaL_optinteger (L, 2, PCRE2_JIT_COMPLETE);
|
||||
int errcode = pcre2_jit_compile (ud->pr, options);
|
||||
if (errcode == 0) {
|
||||
lua_pushboolean(L, 1);
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@
|
||||
(ALG_PUSHSTART(L,ud,offs,n), ALG_PUSHEND(L,ud,offs,n))
|
||||
|
||||
#define ALG_BASE(st) (st)
|
||||
#define ALG_GETCFLAGS(L,pos) luaL_optint(L, pos, ALG_CFLAGS_DFLT)
|
||||
#define ALG_GETCFLAGS(L,pos) (int)luaL_optinteger(L, pos, ALG_CFLAGS_DFLT)
|
||||
|
||||
typedef struct {
|
||||
regex_t r;
|
||||
|
||||
+2
-2
@@ -46,7 +46,7 @@ extern void add_wide_lib (lua_State *L);
|
||||
(ALG_PUSHSTART(L,ud,offs,n), ALG_PUSHEND(L,ud,offs,n))
|
||||
|
||||
#define ALG_BASE(st) (st)
|
||||
#define ALG_GETCFLAGS(L,pos) luaL_optint(L, pos, ALG_CFLAGS_DFLT)
|
||||
#define ALG_GETCFLAGS(L,pos) (int)luaL_optinteger(L, pos, ALG_CFLAGS_DFLT)
|
||||
|
||||
typedef struct {
|
||||
regex_t r;
|
||||
@@ -85,7 +85,7 @@ static void checkarg_atfind (lua_State *L, TArgExec *argE, TPosix **ud,
|
||||
argE->text = luaL_checklstring (L, 2, &argE->textlen);
|
||||
checkarg_regaparams (L, 3, argP);
|
||||
argE->startoffset = get_startoffset (L, 4, argE->textlen);
|
||||
argE->eflags = luaL_optint (L, 5, ALG_EFLAGS_DFLT);
|
||||
argE->eflags = (int)luaL_optinteger (L, 5, ALG_EFLAGS_DFLT);
|
||||
}
|
||||
|
||||
static int generate_error (lua_State *L, const TPosix *ud, int errcode) {
|
||||
|
||||
+2
-2
@@ -49,7 +49,7 @@ void bufferZ_putrepstringW (TBuffer *BufRep, int reppos, int nsub);
|
||||
(ALG_PUSHSTART(L,ud,offs,n), ALG_PUSHEND(L,ud,offs,n))
|
||||
|
||||
#define ALG_BASE(st) (st)
|
||||
#define ALG_GETCFLAGS(L,pos) luaL_optint(L, pos, ALG_CFLAGS_DFLT)
|
||||
#define ALG_GETCFLAGS(L,pos) (int)luaL_optinteger(L, pos, ALG_CFLAGS_DFLT)
|
||||
|
||||
typedef struct {
|
||||
regex_t r;
|
||||
@@ -88,7 +88,7 @@ static void checkarg_atfind (lua_State *L, TArgExec *argE, TPosix **ud,
|
||||
argE->text = luaL_checklstring (L, 2, &argE->textlen);
|
||||
checkarg_regaparams (L, 3, argP);
|
||||
argE->startoffset = get_startoffset (L, 4, argE->textlen);
|
||||
argE->eflags = luaL_optint (L, 5, ALG_EFLAGS_DFLT);
|
||||
argE->eflags = (int)luaL_optinteger (L, 5, ALG_EFLAGS_DFLT);
|
||||
}
|
||||
|
||||
static int generate_error (lua_State *L, const TPosix *ud, int errcode) {
|
||||
|
||||
@@ -20,7 +20,7 @@ PATH = $(GCC$(DIRBIT))
|
||||
# LUAINC : Path of Lua include files.
|
||||
# LIBPATH : Path of lua51.dll, lua52.dll, pcre.dll, etc.
|
||||
|
||||
INSTALLPATH = s:\exe\lib$(DIRBIT)\lua\$(LUADOTVERSION)
|
||||
INSTALLPATH = S:\Progr\Exe\lib$(DIRBIT)\lua\$(LUADOTVERSION)
|
||||
LUADLL = lua$(LUAVERSION)
|
||||
LUAINC = $(PATH_SYSTEM)\include\lua\$(LUADOTVERSION)
|
||||
LIBPATH = $(CROOT)\Programs\EXE$(DIRBIT)
|
||||
@@ -31,10 +31,6 @@ ifeq ($(LUAVERSION),51)
|
||||
else
|
||||
LUAEXE = $(LIBPATH)\lua$(LUAVERSION).exe
|
||||
endif
|
||||
|
||||
ifeq ($(LUAVERSION),53)
|
||||
LUA_COMPAT = -DLUA_COMPAT_5_2
|
||||
endif
|
||||
# --------------------------------------------------------------------------
|
||||
|
||||
BIN = $(PROJECT).dll
|
||||
@@ -44,7 +40,7 @@ AR = ar rcu
|
||||
RANLIB = ranlib
|
||||
CFLAGS = -W -Wall -O2 $(INCS) -DREX_OPENLIB=luaopen_$(PROJECT) \
|
||||
-DREX_LIBNAME=\"$(PROJECT)\" -DVERSION=\"$(VERSION)\" \
|
||||
-m$(DIRBIT) $(CREATEGLOBAL) $(LUA_COMPAT) $(MYCFLAGS)
|
||||
-m$(DIRBIT) $(CREATEGLOBAL) $(MYCFLAGS)
|
||||
DEFFILE = $(PROJECT).def
|
||||
EXPORTED = luaopen_$(PROJECT)
|
||||
INCS = -I$(LUAINC) $(MYINCS)
|
||||
|
||||
Reference in New Issue
Block a user