From 5479a75db25693dcc50ec70d8e4116040735200f Mon Sep 17 00:00:00 2001 From: Lyb <1576988680@qq.com> Date: Sat, 20 Mar 2021 19:46:23 +0800 Subject: [PATCH] add components/language/lua/origin.patch. --- components/language/lua/origin.patch | 90 ++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 components/language/lua/origin.patch diff --git a/components/language/lua/origin.patch b/components/language/lua/origin.patch new file mode 100644 index 0000000..eb8d875 --- /dev/null +++ b/components/language/lua/origin.patch @@ -0,0 +1,90 @@ +diff --git a/lua-5.4.2/lauxlib.h b/lua-5.4.2_modify/lauxlib.h +index 59fef6a..cb9d628 100644 +--- a/lua-5.4.2/lauxlib.h ++++ b/lua-5.4.2_modify/lauxlib.h +@@ -230,6 +230,11 @@ typedef struct luaL_Stream { + ** =================================================================== + */ + ++#define lua_writestring(s,l) (printf(s, l)) ++#define lua_writeline() (printf("\n")) ++#define lua_writestringerror(s,p) (printf(s, p)) ++ ++ + /* print a string */ + #if !defined(lua_writestring) + #define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) +diff --git a/lua-5.4.2/liolib.c b/lua-5.4.2_modify/liolib.c +index 60ab1bf..585fade 100644 +--- a/lua-5.4.2/liolib.c ++++ b/lua-5.4.2_modify/liolib.c +@@ -740,7 +740,7 @@ static const luaL_Reg iolib[] = { + {"output", io_output}, + {"popen", io_popen}, + {"read", io_read}, +- {"tmpfile", io_tmpfile}, ++ // {"tmpfile", io_tmpfile}, + {"type", io_type}, + {"write", io_write}, + {NULL, NULL} +diff --git a/lua-5.4.2/lua.c b/lua-5.4.2_modify/lua.c +index b5b884b..e6c6ced 100644 +--- a/lua-5.4.2/lua.c ++++ b/lua-5.4.2_modify/lua.c +@@ -55,7 +55,6 @@ static void lstop (lua_State *L, lua_Debug *ar) { + */ + static void laction (int i) { + int flag = LUA_MASKCALL | LUA_MASKRET | LUA_MASKLINE | LUA_MASKCOUNT; +- signal(i, SIG_DFL); /* if another SIGINT happens, terminate process */ + lua_sethook(globalL, lstop, flag, 1); + } + +@@ -135,9 +134,7 @@ static int docall (lua_State *L, int narg, int nres) { + lua_pushcfunction(L, msghandler); /* push message handler */ + lua_insert(L, base); /* put it under function and args */ + globalL = L; /* to be available to 'laction' */ +- signal(SIGINT, laction); /* set C-signal handler */ + status = lua_pcall(L, narg, nres, base); +- signal(SIGINT, SIG_DFL); /* reset C-signal handler */ + lua_remove(L, base); /* remove message handler from the stack */ + return status; + } +@@ -620,8 +617,13 @@ static int pmain (lua_State *L) { + } + + +-int main (int argc, char **argv) { ++int LuaMain(int argc, char **argv) ++{ + int status, result; ++ if ((argc != 2) || (argv[0] == NULL) || (argv[1] == NULL)) { ++ print_version(); ++ return 0; ++ } + lua_State *L = luaL_newstate(); /* create state */ + if (L == NULL) { + l_message(argv[0], "cannot create state: not enough memory"); +diff --git a/lua-5.4.2/lua.h b/lua-5.4.2_modify/lua.h +index c9d64d7..c617d9e 100644 +--- a/lua-5.4.2/lua.h ++++ b/lua-5.4.2_modify/lua.h +@@ -513,5 +513,6 @@ struct lua_Debug { + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + ******************************************************************************/ + ++int LuaMain(int argc, char **argv); + + #endif +diff --git a/lua-5.4.2/luaconf.h b/lua-5.4.2_modify/luaconf.h +index d9cf18c..e8c1c62 100644 +--- a/lua-5.4.2/luaconf.h ++++ b/lua-5.4.2_modify/luaconf.h +@@ -656,7 +656,7 @@ + ** macro must include the header 'locale.h'.) + */ + #if !defined(lua_getlocaledecpoint) +-#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) ++#define lua_getlocaledecpoint() (46) + #endif + + /* }================================================================== */ -- Gitee