From a4bc992fa7fad33ec1944ff017a1d40aa83f5ff6 Mon Sep 17 00:00:00 2001 From: Shmuel Zeigerman Date: Fri, 17 Feb 2012 15:36:58 +0200 Subject: Make internal function names more consistent. --- src/algo.h | 20 ++++++++++---------- src/gnu/lgnu.c | 28 ++++++++++++++-------------- src/oniguruma/lonig.c | 28 ++++++++++++++-------------- src/pcre/lpcre.c | 28 ++++++++++++++-------------- src/posix/lposix.c | 28 ++++++++++++++-------------- src/tre/ltre.c | 36 ++++++++++++++++++------------------ src/tre/ltre_w.c | 24 ++++++++++++------------ 7 files changed, 96 insertions(+), 96 deletions(-) diff --git a/src/algo.h b/src/algo.h index f196372..5a3b883 100644 --- a/src/algo.h +++ b/src/algo.h @@ -180,7 +180,7 @@ static void checkarg_find_method (lua_State *L, TArgExec *argE, TUserdata **ud) } -static int ud_new (lua_State *L) { +static int algf_new (lua_State *L) { TArgComp argC; checkarg_new (L, &argC); return compile_regex (L, &argC, NULL); @@ -199,7 +199,7 @@ static void push_substrings (lua_State *L, TUserdata *ud, const char *text, } } -static int gsub (lua_State *L) { +static int algf_gsub (lua_State *L) { TUserdata *ud; TArgComp argC; TArgExec argE; @@ -420,12 +420,12 @@ static int generic_find_func (lua_State *L, int method) { } -static int find (lua_State *L) { +static int algf_find (lua_State *L) { return generic_find_func (L, METHOD_FIND); } -static int match (lua_State *L) { +static int algf_match (lua_State *L) { return generic_find_func (L, METHOD_MATCH); } @@ -539,7 +539,7 @@ nomatch: } -static int gmatch (lua_State *L) +static int algf_gmatch (lua_State *L) { TArgComp argC; TArgExec argE; @@ -562,7 +562,7 @@ static int gmatch (lua_State *L) return 1; } -static int split (lua_State *L) +static int algf_split (lua_State *L) { TArgComp argC; TArgExec argE; @@ -647,15 +647,15 @@ static int generic_find_method (lua_State *L, int method) { } -static int ud_find (lua_State *L) { +static int algm_find (lua_State *L) { return generic_find_method (L, METHOD_FIND); } -static int ud_match (lua_State *L) { +static int algm_match (lua_State *L) { return generic_find_method (L, METHOD_MATCH); } -static int ud_tfind (lua_State *L) { +static int algm_tfind (lua_State *L) { return generic_find_method (L, METHOD_TFIND); } -static int ud_exec (lua_State *L) { +static int algm_exec (lua_State *L) { return generic_find_method (L, METHOD_EXEC); } diff --git a/src/gnu/lgnu.c b/src/gnu/lgnu.c index 9f12a81..b937a81 100644 --- a/src/gnu/lgnu.c +++ b/src/gnu/lgnu.c @@ -282,23 +282,23 @@ static int Gnu_get_flags (lua_State *L) { return get_flags (L, fps); } -static const luaL_Reg gnumeta[] = { - { "exec", ud_exec }, - { "tfind", ud_tfind }, /* old match */ - { "find", ud_find }, - { "match", ud_match }, +static const luaL_Reg r_methods[] = { + { "exec", algm_exec }, + { "tfind", algm_tfind }, /* old match */ + { "find", algm_find }, + { "match", algm_match }, { "__gc", Gnu_gc }, { "__tostring", Gnu_tostring }, { NULL, NULL} }; -static const luaL_Reg rexlib[] = { - { "match", match }, - { "find", find }, - { "gmatch", gmatch }, - { "gsub", gsub }, - { "split", split }, - { "new", ud_new }, +static const luaL_Reg r_functions[] = { + { "match", algf_match }, + { "find", algf_find }, + { "gmatch", algf_gmatch }, + { "gsub", algf_gsub }, + { "split", algf_split }, + { "new", algf_new }, { "flags", Gnu_get_flags }, { NULL, NULL } }; @@ -312,10 +312,10 @@ REX_API int REX_OPENLIB (lua_State *L) lua_replace (L, LUA_ENVIRONINDEX); lua_pushvalue(L, -1); /* mt.__index = mt */ lua_setfield(L, -2, "__index"); - luaL_register (L, NULL, gnumeta); + luaL_register (L, NULL, r_methods); /* register functions */ - luaL_register (L, REX_LIBNAME, rexlib); + luaL_register (L, REX_LIBNAME, r_functions); lua_pushliteral (L, REX_VERSION" (for GNU regexes)"); lua_setfield (L, -2, "_VERSION"); return 1; diff --git a/src/oniguruma/lonig.c b/src/oniguruma/lonig.c index 08f1b59..0fa13f9 100644 --- a/src/oniguruma/lonig.c +++ b/src/oniguruma/lonig.c @@ -314,23 +314,23 @@ static int LOnig_version (lua_State *L) { return 1; } -static const luaL_Reg regex_meta[] = { - { "exec", ud_exec }, - { "tfind", ud_tfind }, /* old name: match */ - { "find", ud_find }, - { "match", ud_match }, +static const luaL_Reg r_methods[] = { + { "exec", algm_exec }, + { "tfind", algm_tfind }, /* old name: match */ + { "find", algm_find }, + { "match", algm_match }, { "__gc", LOnig_gc }, { "__tostring", LOnig_tostring }, { NULL, NULL } }; -static const luaL_Reg rexlib[] = { - { "match", match }, - { "find", find }, - { "gmatch", gmatch }, - { "gsub", gsub }, - { "split", split }, - { "new", ud_new }, +static const luaL_Reg r_functions[] = { + { "match", algf_match }, + { "find", algf_find }, + { "gmatch", algf_gmatch }, + { "gsub", algf_gsub }, + { "split", algf_split }, + { "new", algf_new }, { "flags", LOnig_get_flags }, { "version", LOnig_version }, { "setdefaultsyntax", LOnig_setdefaultsyntax }, @@ -353,10 +353,10 @@ REX_API int REX_OPENLIB (lua_State *L) { lua_replace (L, LUA_ENVIRONINDEX); lua_pushvalue(L, -1); /* mt.__index = mt */ lua_setfield(L, -2, "__index"); - luaL_register (L, NULL, regex_meta); + luaL_register (L, NULL, r_methods); /* register functions */ - luaL_register (L, REX_LIBNAME, rexlib); + luaL_register (L, REX_LIBNAME, r_functions); lua_pushliteral (L, REX_VERSION" (for Oniguruma)"); lua_setfield (L, -2, "_VERSION"); diff --git a/src/pcre/lpcre.c b/src/pcre/lpcre.c index 266ba94..2e6dc6e 100644 --- a/src/pcre/lpcre.c +++ b/src/pcre/lpcre.c @@ -368,11 +368,11 @@ static const luaL_Reg chartables_meta[] = { { NULL, NULL } }; -static const luaL_Reg regex_meta[] = { - { "exec", ud_exec }, - { "tfind", ud_tfind }, /* old name: match */ - { "find", ud_find }, - { "match", ud_match }, +static const luaL_Reg r_methods[] = { + { "exec", algm_exec }, + { "tfind", algm_tfind }, /* old name: match */ + { "find", algm_find }, + { "match", algm_match }, #if PCRE_MAJOR >= 6 { "dfa_exec", Lpcre_dfa_exec }, #endif @@ -381,13 +381,13 @@ static const luaL_Reg regex_meta[] = { { NULL, NULL } }; -static const luaL_Reg rexlib[] = { - { "match", match }, - { "find", find }, - { "gmatch", gmatch }, - { "gsub", gsub }, - { "split", split }, - { "new", ud_new }, +static const luaL_Reg r_functions[] = { + { "match", algf_match }, + { "find", algf_find }, + { "gmatch", algf_gmatch }, + { "gsub", algf_gsub }, + { "split", algf_split }, + { "new", algf_new }, { "flags", Lpcre_get_flags }, { "version", Lpcre_version }, { "maketables", Lpcre_maketables }, @@ -409,10 +409,10 @@ REX_API int REX_OPENLIB (lua_State *L) { lua_replace (L, LUA_ENVIRONINDEX); lua_pushvalue(L, -1); /* mt.__index = mt */ lua_setfield(L, -2, "__index"); - luaL_register (L, NULL, regex_meta); + luaL_register (L, NULL, r_methods); /* register functions */ - luaL_register (L, REX_LIBNAME, rexlib); + luaL_register (L, REX_LIBNAME, r_functions); lua_pushliteral (L, REX_VERSION" (for PCRE)"); lua_setfield (L, -2, "_VERSION"); diff --git a/src/posix/lposix.c b/src/posix/lposix.c index 86ab3f3..036945c 100644 --- a/src/posix/lposix.c +++ b/src/posix/lposix.c @@ -253,23 +253,23 @@ static int Posix_get_flags (lua_State *L) { return get_flags (L, fps); } -static const luaL_Reg posixmeta[] = { - { "exec", ud_exec }, - { "tfind", ud_tfind }, /* old match */ - { "find", ud_find }, - { "match", ud_match }, +static const luaL_Reg r_methods[] = { + { "exec", algm_exec }, + { "tfind", algm_tfind }, /* old match */ + { "find", algm_find }, + { "match", algm_match }, { "__gc", Posix_gc }, { "__tostring", Posix_tostring }, { NULL, NULL} }; -static const luaL_Reg rexlib[] = { - { "match", match }, - { "find", find }, - { "gmatch", gmatch }, - { "gsub", gsub }, - { "split", split }, - { "new", ud_new }, +static const luaL_Reg r_functions[] = { + { "match", algf_match }, + { "find", algf_find }, + { "gmatch", algf_gmatch }, + { "gsub", algf_gsub }, + { "split", algf_split }, + { "new", algf_new }, { "flags", Posix_get_flags }, { NULL, NULL } }; @@ -283,10 +283,10 @@ REX_API int REX_OPENLIB (lua_State *L) lua_replace (L, LUA_ENVIRONINDEX); lua_pushvalue(L, -1); /* mt.__index = mt */ lua_setfield(L, -2, "__index"); - luaL_register (L, NULL, posixmeta); + luaL_register (L, NULL, r_methods); /* register functions */ - luaL_register (L, REX_LIBNAME, rexlib); + luaL_register (L, REX_LIBNAME, r_functions); lua_pushliteral (L, REX_VERSION" (for POSIX regexes)"); lua_setfield (L, -2, "_VERSION"); return 1; diff --git a/src/tre/ltre.c b/src/tre/ltre.c index 6033a55..121d07e 100644 --- a/src/tre/ltre.c +++ b/src/tre/ltre.c @@ -310,30 +310,30 @@ static int Ltre_version (lua_State *L) { return 1; } -static const luaL_Reg posixmeta[] = { - { "exec", ud_exec }, - { "tfind", ud_tfind }, - { "find", ud_find }, - { "match", ud_match }, +static const luaL_Reg r_methods[] = { + { "exec", algm_exec }, + { "find", algm_find }, + { "match", algm_match }, + { "tfind", algm_tfind }, { "aexec", Ltre_aexec }, { "atfind", Ltre_atfind }, - { "have_backrefs", Ltre_have_backrefs }, { "have_approx", Ltre_have_approx }, + { "have_backrefs", Ltre_have_backrefs }, { "__gc", Ltre_gc }, { "__tostring", Ltre_tostring }, { NULL, NULL} }; -static const luaL_Reg rexlib[] = { - { "match", match }, - { "find", find }, - { "gmatch", gmatch }, - { "gsub", gsub }, - { "split", split }, - { "new", ud_new }, - { "flags", Ltre_get_flags }, - { "config", Ltre_config }, - { "version", Ltre_version }, +static const luaL_Reg r_functions[] = { + { "new", algf_new }, + { "find", algf_find }, + { "gmatch", algf_gmatch }, + { "gsub", algf_gsub }, + { "match", algf_match }, + { "split", algf_split }, + { "config", Ltre_config }, + { "flags", Ltre_get_flags }, + { "version", Ltre_version }, { NULL, NULL } }; @@ -346,11 +346,11 @@ REX_API int REX_OPENLIB (lua_State *L) lua_replace (L, LUA_ENVIRONINDEX); lua_pushvalue(L, -1); /* mt.__index = mt */ lua_setfield(L, -2, "__index"); - luaL_register (L, NULL, posixmeta); + luaL_register (L, NULL, r_methods); add_wide_lib (L, 1); /* register functions */ - luaL_register (L, REX_LIBNAME, rexlib); + luaL_register (L, REX_LIBNAME, r_functions); add_wide_lib (L, 0); lua_pushliteral (L, REX_VERSION" (for TRE regexes)"); lua_setfield (L, -2, "_VERSION"); diff --git a/src/tre/ltre_w.c b/src/tre/ltre_w.c index d3bceb7..3afe30b 100644 --- a/src/tre/ltre_w.c +++ b/src/tre/ltre_w.c @@ -196,22 +196,22 @@ static int split_exec (TPosix *ud, TArgExec *argE, int offset) { } static const luaL_Reg posixmeta[] = { - { "wexec", ud_exec }, - { "wtfind", ud_tfind }, - { "wfind", ud_find }, - { "wmatch", ud_match }, - { "waexec", Ltre_aexec }, - { "watfind", Ltre_atfind }, + { "wexec", algm_exec }, + { "wfind", algm_find }, + { "wmatch", algm_match }, + { "wtfind", algm_tfind }, + { "waexec", Ltre_aexec }, + { "watfind", Ltre_atfind }, { NULL, NULL} }; static const luaL_Reg rexlib[] = { - { "wmatch", match }, - { "wfind", find }, - { "wgmatch", gmatch }, - { "wgsub", gsub }, - { "wsplit", split }, - { "wnew", ud_new }, + { "wnew", algf_new }, + { "wfind", algf_find }, + { "wgmatch", algf_gmatch }, + { "wgsub", algf_gsub }, + { "wmatch", algf_match }, + { "wsplit", algf_split }, { NULL, NULL } }; -- cgit v1.2.1