From: John L. <jr...@us...> - 2007-12-10 05:39:42
|
Update of /cvsroot/wxlua/wxLua/modules/lua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv23281/wxLua/modules/lua/src Modified Files: lapi.c lstrlib.c ltablib.c lua.c Log Message: genwxbind.lua - don't create "returns" variable before use to save a line of code. Applied Lua patches for 5.1.2 8-11 Added wxlua_lreg_createtable(..) to create the LUA_REGISTRYINDEX tables for wxLua Added wxlua_lreg_regtable_key in LUA_REGISTRYINDEX to help the wxLuaDebugData find wxLua's tables faster to give more information Index: lstrlib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lstrlib.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lstrlib.c 25 Apr 2007 02:52:20 -0000 1.3 --- lstrlib.c 10 Dec 2007 05:39:05 -0000 1.4 *************** *** 630,637 **** break; } - default: { - luaL_argerror(L, 3, "string/function/table expected"); - return; - } } if (!lua_toboolean(L, -1)) { /* nil or false? */ --- 630,633 ---- *************** *** 640,644 **** } else if (!lua_isstring(L, -1)) ! luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); luaL_addvalue(b); /* add result to accumulator */ } --- 636,640 ---- } else if (!lua_isstring(L, -1)) ! luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); luaL_addvalue(b); /* add result to accumulator */ } *************** *** 649,652 **** --- 645,649 ---- const char *src = luaL_checklstring(L, 1, &srcl); const char *p = luaL_checkstring(L, 2); + int tr = lua_type(L, 3); int max_s = luaL_optint(L, 4, srcl+1); int anchor = (*p == '^') ? (p++, 1) : 0; *************** *** 654,657 **** --- 651,657 ---- MatchState ms; luaL_Buffer b; + luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || + tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, + "string/function/table expected"); luaL_buffinit(L, &b); ms.L = L; Index: lapi.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lapi.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lapi.c 12 Jun 2006 03:50:37 -0000 1.3 --- lapi.c 10 Dec 2007 05:39:05 -0000 1.4 *************** *** 208,212 **** if (idx == LUA_ENVIRONINDEX) { Closure *func = curr_func(L); ! api_check(L, ttistable(L->top - 1)); func->c.env = hvalue(L->top - 1); luaC_barrier(L, func, L->top - 1); --- 208,212 ---- if (idx == LUA_ENVIRONINDEX) { Closure *func = curr_func(L); ! api_check(L, ttistable(L->top - 1)); func->c.env = hvalue(L->top - 1); luaC_barrier(L, func, L->top - 1); *************** *** 750,754 **** break; } ! luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); L->top--; lua_unlock(L); --- 750,754 ---- break; } ! if (res) luaC_objbarrier(L, gcvalue(o), hvalue(L->top - 1)); L->top--; lua_unlock(L); *************** *** 768,772 **** #define checkresults(L,na,nr) \ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) ! LUA_API void lua_call (lua_State *L, int nargs, int nresults) { --- 768,772 ---- #define checkresults(L,na,nr) \ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) ! LUA_API void lua_call (lua_State *L, int nargs, int nresults) { Index: ltablib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/ltablib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ltablib.c 29 Mar 2006 06:00:00 -0000 1.1 --- ltablib.c 10 Dec 2007 05:39:05 -0000 1.2 *************** *** 119,123 **** int e = aux_getn(L, 1); int pos = luaL_optint(L, 2, e); ! if (e == 0) return 0; /* table is `empty' */ luaL_setn(L, 1, e - 1); /* t.n = n-1 */ lua_rawgeti(L, 1, pos); /* result = t[pos] */ --- 119,124 ---- int e = aux_getn(L, 1); int pos = luaL_optint(L, 2, e); ! if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ ! return 0; /* nothing to remove */ luaL_setn(L, 1, e - 1); /* t.n = n-1 */ lua_rawgeti(L, 1, pos); /* result = t[pos] */ Index: lua.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lua.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lua.c 12 Jun 2006 03:50:38 -0000 1.2 --- lua.c 10 Dec 2007 05:39:05 -0000 1.3 *************** *** 145,149 **** lua_getglobal(L, "require"); lua_pushstring(L, name); ! return report(L, lua_pcall(L, 1, 0, 0)); } --- 145,149 ---- lua_getglobal(L, "require"); lua_pushstring(L, name); ! return report(L, docall(L, 1, 1)); } *************** *** 241,245 **** lua_setglobal(L, "arg"); fname = argv[n]; ! if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) fname = NULL; /* stdin */ status = luaL_loadfile(L, fname); --- 241,245 ---- lua_setglobal(L, "arg"); fname = argv[n]; ! if (strcmp(fname, "-") == 0 && strcmp(argv[n-1], "--") != 0) fname = NULL; /* stdin */ status = luaL_loadfile(L, fname); *************** *** 248,252 **** status = docall(L, narg, 0); else ! lua_pop(L, narg); return report(L, status); } --- 248,252 ---- status = docall(L, narg, 0); else ! lua_pop(L, narg); return report(L, status); } |