From bfcd7b7305c5465eb33acca86109ca96cb37403a Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 7 Feb 2011 21:57:20 +0100 Subject: lua: Updating to 5.1.4 Updating base code to 5.1.4 Adding -DSYSLINUX build flag Moving #if 0 to ifndef SYSLINUX --- com32/lua/src/lua.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'com32/lua/src/lua.c') diff --git a/com32/lua/src/lua.c b/com32/lua/src/lua.c index 0d2d16c3..daa73c1f 100644 --- a/com32/lua/src/lua.c +++ b/com32/lua/src/lua.c @@ -4,13 +4,19 @@ ** See Copyright Notice in lua.h */ - -//#include +#ifndef SYSLINUX +#include +#else +#define signal(x,y) +#endif #include #include #include +#ifdef SYSLINUX #include +#endif + #define lua_c #include "lua.h" @@ -25,8 +31,7 @@ static lua_State *globalL = NULL; static const char *progname = LUA_PROGNAME; -#if 0 - +#ifndef SYSLINUX static void lstop (lua_State *L, lua_Debug *ar) { (void)ar; /* unused arg. */ lua_sethook(L, NULL, 0, 0); @@ -99,16 +104,15 @@ static int docall (lua_State *L, int narg, int clear) { int base = lua_gettop(L) - narg; /* function index */ lua_pushcfunction(L, traceback); /* push traceback function */ lua_insert(L, base); /* put it under chunk and args */ - /* signal(SIGINT, laction);*/ + signal(SIGINT, laction); status = lua_pcall(L, narg, (clear ? 0 : LUA_MULTRET), base); -/* signal(SIGINT, SIG_DFL);*/ + signal(SIGINT, SIG_DFL); lua_remove(L, base); /* remove traceback function */ /* force a complete garbage collection in case of errors */ if (status != 0) lua_gc(L, LUA_GCCOLLECT, 0); return status; } - static void print_version (void) { l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); } @@ -322,7 +326,11 @@ static int runargs (lua_State *L, char **argv, int n) { static int handle_luainit (lua_State *L) { - const char *init = /*getenv(LUA_INIT)*/ NULL; +#ifndef SYSLINUX + const char *init = getenv(LUA_INIT); +#else + const char *init = NULL; +#endif if (init == NULL) return 0; /* status OK */ else if (init[0] == '@') return dofile(L, init+1); @@ -378,9 +386,9 @@ static int pmain (lua_State *L) { int main (int argc, char **argv) { int status; struct Smain s; - +#ifdef SYSLINUX openconsole(&dev_stdcon_r, &dev_stdcon_w); - +#endif lua_State *L = lua_open(); /* create state */ if (L == NULL) { l_message(argv[0], "cannot create state: not enough memory"); -- cgit v1.2.1