Update of /cvsroot/wxlua/wxLua/modules/lua/src In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13456/wxLua/modules/lua/src Modified Files: Makefile lapi.c lapi.h lauxlib.c lauxlib.h lbaselib.c lcode.c lcode.h ldo.c lgc.c liolib.c llex.c llex.h lopcodes.h loslib.c lparser.c lparser.h lstate.c lstrlib.c lua.c lua.h luac.c luaconf.h lvm.c print.c Log Message: update lua to 5.1.1 update wxLua bindings to changes in wxWidgets CVS HEAD 2.7.0 Index: Makefile =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** Makefile 13 May 2006 21:05:36 -0000 1.4 --- Makefile 12 Jun 2006 03:50:37 -0000 1.5 *************** *** 84,88 **** aix: ! $(MAKE) all CC="xlc" CFLAGS="-O2" MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" ansi: --- 84,88 ---- aix: ! $(MAKE) all CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-ldl" MYLDFLAGS="-brtl -bexpall" ansi: *************** *** 125,137 **** lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ ! lzio.h lmem.h lopcodes.h lparser.h ltable.h ldebug.h lstate.h ltm.h \ ! ldo.h lgc.h ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ ! llex.h lzio.h lmem.h lopcodes.h lparser.h ltable.h ldebug.h lstate.h \ ! ltm.h ldo.h lfunc.h lstring.h lgc.h lvm.h ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ ! lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h ltable.h \ ! lstring.h lundump.h lvm.h ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ lzio.h lmem.h lundump.h --- 125,137 ---- lbaselib.o: lbaselib.c lua.h luaconf.h lauxlib.h lualib.h lcode.o: lcode.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ ! lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h lgc.h \ ! ltable.h ldblib.o: ldblib.c lua.h luaconf.h lauxlib.h lualib.h ldebug.o: ldebug.c lua.h luaconf.h lapi.h lobject.h llimits.h lcode.h \ ! llex.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ ! lfunc.h lstring.h lgc.h ltable.h lvm.h ldo.o: ldo.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h ltm.h \ ! lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lparser.h lstring.h \ ! ltable.h lundump.h lvm.h ldump.o: ldump.c lua.h luaconf.h lobject.h llimits.h lstate.h ltm.h \ lzio.h lmem.h lundump.h *************** *** 143,147 **** liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ ! lzio.h lmem.h llex.h lparser.h ltable.h lstring.h lgc.h lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ --- 143,147 ---- liolib.o: liolib.c lua.h luaconf.h lauxlib.h lualib.h llex.o: llex.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h ltm.h \ ! lzio.h lmem.h llex.h lparser.h lstring.h lgc.h ltable.h lmathlib.o: lmathlib.c lua.h luaconf.h lauxlib.h lualib.h lmem.o: lmem.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ *************** *** 154,159 **** loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ ! lzio.h lmem.h lopcodes.h lparser.h ltable.h ldebug.h lstate.h ltm.h \ ! ldo.h lfunc.h lstring.h lgc.h lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h --- 154,159 ---- loslib.o: loslib.c lua.h luaconf.h lauxlib.h lualib.h lparser.o: lparser.c lua.h luaconf.h lcode.h llex.h lobject.h llimits.h \ ! lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h ldo.h \ ! lfunc.h lstring.h lgc.h ltable.h lstate.o: lstate.c lua.h luaconf.h ldebug.h lstate.h lobject.h llimits.h \ ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h llex.h lstring.h ltable.h Index: lauxlib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lauxlib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lauxlib.c 29 Mar 2006 06:00:00 -0000 1.1 --- lauxlib.c 12 Jun 2006 03:50:37 -0000 1.2 *************** *** 124,128 **** LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { void *p = lua_touserdata(L, ud); ! if (p != NULL) { /* value is a userdata? */ /* lua 5.1 bug fix */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ --- 124,128 ---- LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { void *p = lua_touserdata(L, ud); ! if (p != NULL) { /* value is a userdata? */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get correct metatable */ Index: lauxlib.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lauxlib.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lauxlib.h 29 Mar 2006 06:00:00 -0000 1.1 --- lauxlib.h 12 Jun 2006 03:50:37 -0000 1.2 *************** *** 109,115 **** #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) ! #define luaL_dofile(L, fn) (luaL_loadfile(L, fn) || lua_pcall(L, 0, 0, 0)) ! #define luaL_dostring(L, s) (luaL_loadstring(L, s) || lua_pcall(L, 0, 0, 0)) #define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) --- 109,117 ---- #define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) ! #define luaL_dofile(L, fn) \ ! (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) ! #define luaL_dostring(L, s) \ ! (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) #define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) Index: lopcodes.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lopcodes.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lopcodes.h 29 Mar 2006 05:48:11 -0000 1.2 --- lopcodes.h 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 198,203 **** OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ ! OP_TFORLOOP,/* A C R(A+3), ... ,R(A+3+C) := R(A)(R(A+1), R(A+2)); ! if R(A+3) ~= nil then { pc++; R(A+2)=R(A+3); } */ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ --- 198,203 ---- OP_FORPREP,/* A sBx R(A)-=R(A+2); pc+=sBx */ ! OP_TFORLOOP,/* A C R(A+3), ... ,R(A+2+C) := R(A)(R(A+1), R(A+2)); ! if R(A+3) ~= nil then R(A+2)=R(A+3) else pc++ */ OP_SETLIST,/* A B C R(A)[(C-1)*FPF+i] := R(A+i), 1 <= i <= B */ Index: print.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/print.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** print.c 29 Mar 2006 06:00:00 -0000 1.1 --- print.c 12 Jun 2006 03:50:38 -0000 1.2 *************** *** 21,31 **** #define VOID(p) ((const void*)(p)) ! static void PrintString(const Proto* f, int n) { ! const char* s=svalue(&f->k[n]); putchar('"'); ! for (; *s; s++) { ! switch (*s) { case '"': printf("\\\""); break; --- 21,34 ---- #define VOID(p) ((const void*)(p)) ! static void PrintString(const TString* ts) { ! const char* s=getstr(ts); ! int n=ts->tsv.len; ! int i; putchar('"'); ! for (i=0; i<n; i++) { ! int c=s[i]; ! switch (c) { case '"': printf("\\\""); break; *************** *** 37,44 **** case '\t': printf("\\t"); break; case '\v': printf("\\v"); break; ! default: if (isprint((unsigned char)*s)) ! printf("%c",*s); else ! printf("\\%03u",(unsigned char)*s); } } --- 40,47 ---- case '\t': printf("\\t"); break; case '\v': printf("\\v"); break; ! default: if (isprint((unsigned char)c)) ! putchar(c); else ! printf("\\%03u",(unsigned char)c); } } *************** *** 61,65 **** break; case LUA_TSTRING: ! PrintString(f,i); break; default: /* cannot happen */ --- 64,68 ---- break; case LUA_TSTRING: ! PrintString(rawtsvalue(o)); break; default: /* cannot happen */ Index: lgc.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lgc.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lgc.c 29 Mar 2006 05:48:11 -0000 1.2 --- lgc.c 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 321,326 **** ! static void propagateall (global_State *g) { ! while (g->gray) propagatemark(g); } --- 321,328 ---- ! static size_t propagateall (global_State *g) { ! size_t m = 0; ! while (g->gray) m += propagatemark(g); ! return m; } *************** *** 541,545 **** udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ marktmu(g); /* mark `preserved' userdata */ ! propagateall(g); /* remark, to propagate `preserveness' */ cleartable(g->weak); /* remove collected objects from weak tables */ /* flip current white */ --- 543,547 ---- udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */ marktmu(g); /* mark `preserved' userdata */ ! udsize += propagateall(g); /* remark, to propagate `preserveness' */ cleartable(g->weak); /* remove collected objects from weak tables */ /* flip current white */ *************** *** 591,594 **** --- 593,598 ---- if (g->tmudata) { GCTM(L); + if (g->estimate > GCFINALIZECOST) + g->estimate -= GCFINALIZECOST; return GCFINALIZECOST; } Index: lstate.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lstate.c,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** lstate.c 13 May 2006 21:05:36 -0000 1.4 --- lstate.c 12 Jun 2006 03:50:37 -0000 1.5 *************** *** 254,258 **** LUA_API void lua_close (lua_State *L) { L = G(L)->mainthread; /* only the main thread can be closed */ - luai_userstateclose(L); lua_lock(L); luaF_close(L, L->stack); /* close all upvalues for this thread */ --- 254,257 ---- *************** *** 265,268 **** --- 264,268 ---- } while (luaD_rawrunprotected(L, callallgcTM, NULL) != 0); lua_assert(G(L)->tmudata == NULL); + luai_userstateclose(L); close_state(L); } Index: liolib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/liolib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** liolib.c 29 Mar 2006 06:00:00 -0000 1.1 --- liolib.c 12 Jun 2006 03:50:37 -0000 1.2 *************** *** 100,104 **** FILE **p = topfile(L); int ok = lua_pclose(L, *p); ! if (ok) *p = NULL; return pushresult(L, ok, NULL); } --- 100,104 ---- FILE **p = topfile(L); int ok = lua_pclose(L, *p); ! *p = NULL; return pushresult(L, ok, NULL); } *************** *** 108,112 **** FILE **p = topfile(L); int ok = (fclose(*p) == 0); ! if (ok) *p = NULL; return pushresult(L, ok, NULL); } --- 108,112 ---- FILE **p = topfile(L); int ok = (fclose(*p) == 0); ! *p = NULL; return pushresult(L, ok, NULL); } Index: lua.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lua.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lua.h 29 Mar 2006 06:00:00 -0000 1.1 --- lua.h 12 Jun 2006 03:50:38 -0000 1.2 *************** *** 18,21 **** --- 18,22 ---- #define LUA_VERSION "Lua 5.1" + #define LUA_RELEASE "Lua 5.1.1" #define LUA_VERSION_NUM 501 #define LUA_COPYRIGHT "Copyright (C) 1994-2006 Lua.org, PUC-Rio" Index: llex.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/llex.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** llex.h 29 Mar 2006 05:48:11 -0000 1.2 --- llex.h 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 69,75 **** LUAI_FUNC void luaX_init (lua_State *L); ! LUAI_FUNC void luaX_setinput (lua_State *L, LexState *LS, ZIO *z, TString *source); ! LUAI_FUNC TString *luaX_newstring (LexState *LS, const char *str, size_t l); LUAI_FUNC void luaX_next (LexState *ls); LUAI_FUNC void luaX_lookahead (LexState *ls); --- 69,75 ---- LUAI_FUNC void luaX_init (lua_State *L); ! LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source); ! LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); LUAI_FUNC void luaX_next (LexState *ls); LUAI_FUNC void luaX_lookahead (LexState *ls); Index: loslib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/loslib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** loslib.c 29 Mar 2006 06:00:00 -0000 1.1 --- loslib.c 12 Jun 2006 03:50:37 -0000 1.2 *************** *** 29,36 **** else { lua_pushnil(L); ! if (filename) ! lua_pushfstring(L, "%s: %s", filename, strerror(en)); ! else ! lua_pushfstring(L, "%s", strerror(en)); lua_pushinteger(L, en); return 3; --- 29,33 ---- else { lua_pushnil(L); ! lua_pushfstring(L, "%s: %s", filename, strerror(en)); lua_pushinteger(L, en); return 3; *************** *** 127,132 **** static int os_date (lua_State *L) { const char *s = luaL_optstring(L, 1, "%c"); ! time_t t = lua_isnoneornil(L, 2) ? time(NULL) : ! (time_t)luaL_checknumber(L, 2); struct tm *stm; if (*s == '!') { /* UTC? */ --- 124,128 ---- static int os_date (lua_State *L) { const char *s = luaL_optstring(L, 1, "%c"); ! time_t t = luaL_opt(L, (time_t)luaL_checknumber, 2, time(NULL)); struct tm *stm; if (*s == '!') { /* UTC? */ *************** *** 200,206 **** static const char *const catnames[] = {"all", "collate", "ctype", "monetary", "numeric", "time", NULL}; ! const char *l = lua_tostring(L, 1); int op = luaL_checkoption(L, 2, "all", catnames); - luaL_argcheck(L, l || lua_isnoneornil(L, 1), 1, "string expected"); lua_pushstring(L, setlocale(cat[op], l)); return 1; --- 196,201 ---- static const char *const catnames[] = {"all", "collate", "ctype", "monetary", "numeric", "time", NULL}; ! const char *l = luaL_optstring(L, 1, NULL); int op = luaL_checkoption(L, 2, "all", catnames); lua_pushstring(L, setlocale(cat[op], l)); return 1; Index: llex.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/llex.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** llex.c 29 Mar 2006 05:48:11 -0000 1.2 --- llex.c 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 21,24 **** --- 21,25 ---- #include "lstate.h" #include "lstring.h" + #include "ltable.h" #include "lzio.h" Index: lua.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lua.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lua.c 29 Mar 2006 06:00:00 -0000 1.1 --- lua.c 12 Jun 2006 03:50:38 -0000 1.2 *************** *** 108,112 **** static void print_version (void) { ! l_message(NULL, LUA_VERSION " " LUA_COPYRIGHT); } --- 108,112 ---- static void print_version (void) { ! l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); } *************** *** 253,256 **** --- 253,260 ---- + /* check that argument has no extra characters at the end */ + #define notail(x) {if ((x)[2] != '\0') return -1;} + + static int collectargs (char **argv, int *pi, int *pv, int *pe) { int i; *************** *** 259,267 **** return i; switch (argv[i][1]) { /* option */ ! case '-': return (argv[i+1] != NULL ? i+1 : 0); ! case '\0': return i; ! case 'i': *pi = 1; /* go through */ ! case 'v': *pv = 1; break; ! case 'e': *pe = 1; /* go through */ case 'l': if (argv[i][2] == '\0') { --- 263,280 ---- return i; switch (argv[i][1]) { /* option */ ! case '-': ! notail(argv[i]); ! return (argv[i+1] != NULL ? i+1 : 0); ! case '\0': ! return i; ! case 'i': ! notail(argv[i]); ! *pi = 1; /* go through */ ! case 'v': ! notail(argv[i]); ! *pv = 1; ! break; ! case 'e': ! *pe = 1; /* go through */ case 'l': if (argv[i][2] == '\0') { *************** *** 307,316 **** static int handle_luainit (lua_State *L) { ! const char *init = getenv("LUA_INIT"); if (init == NULL) return 0; /* status OK */ else if (init[0] == '@') return dofile(L, init+1); else ! return dostring(L, init, "=LUA_INIT"); } --- 320,329 ---- static int handle_luainit (lua_State *L) { ! const char *init = getenv(LUA_INIT); if (init == NULL) return 0; /* status OK */ else if (init[0] == '@') return dofile(L, init+1); else ! return dostring(L, init, "=" LUA_INIT); } Index: luaconf.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/luaconf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** luaconf.h 29 Mar 2006 06:00:00 -0000 1.1 --- luaconf.h 12 Jun 2006 03:50:38 -0000 1.2 *************** *** 61,64 **** --- 61,76 ---- /* + @@ LUA_PATH and LUA_CPATH are the names of the environment variables that + @* Lua check to set its paths. + @@ LUA_INIT is the name of the environment variable that Lua + @* checks for initialization code. + ** CHANGE them if you want different names. + */ + #define LUA_PATH "LUA_PATH" + #define LUA_CPATH "LUA_CPATH" + #define LUA_INIT "LUA_INIT" + + + /* @@ LUA_PATH_DEFAULT is the default path that Lua uses to look for @* Lua libraries. *************** *** 544,547 **** --- 556,570 ---- #if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) && !defined(__SSE2__) && \ (defined(__i386) || defined (_M_IX86) || defined(__i386__)) + + /* On a Microsoft compiler, use assembler */ + #if defined(_MSC_VER) + + #define lua_number2int(i,d) __asm fld d __asm fistp i + #define lua_number2integer(i,n) lua_number2int(i, n) + + /* the next trick should work on any Pentium, but sometimes clashes + with a DirectX idiosyncrasy */ + #else + union luai_Cast { double l_d; long l_l; }; #define lua_number2int(i,d) \ *************** *** 549,552 **** --- 572,578 ---- #define lua_number2integer(i,n) lua_number2int(i, n) + #endif + + /* this option always works, but may be slow */ #else Index: lcode.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lcode.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lcode.h 29 Mar 2006 05:48:11 -0000 1.2 --- lcode.h 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 33,37 **** } BinOpr; - #define binopistest(op) ((op) >= OPR_NE) typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; --- 33,36 ---- Index: lcode.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lcode.c,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** lcode.c 29 Mar 2006 05:56:08 -0000 1.3 --- lcode.c 12 Jun 2006 03:50:37 -0000 1.4 *************** *** 732,736 **** lua_assert(e1->t == NO_JUMP); /* list must be closed */ luaK_dischargevars(fs, e2); ! luaK_concat(fs, &e2->f, e1->f); /* fixed 5.1 bug */ *e1 = *e2; break; --- 732,736 ---- lua_assert(e1->t == NO_JUMP); /* list must be closed */ luaK_dischargevars(fs, e2); ! luaK_concat(fs, &e2->f, e1->f); *e1 = *e2; break; *************** *** 739,743 **** lua_assert(e1->f == NO_JUMP); /* list must be closed */ luaK_dischargevars(fs, e2); ! luaK_concat(fs, &e2->t, e1->t); /* fixed 5.1 bug */ *e1 = *e2; break; --- 739,743 ---- lua_assert(e1->f == NO_JUMP); /* list must be closed */ luaK_dischargevars(fs, e2); ! luaK_concat(fs, &e2->t, e1->t); *e1 = *e2; break; *************** *** 749,753 **** freeexp(fs, e1); SETARG_B(getcode(fs, e2), e1->u.s.info); ! e1->k = e2->k; e1->u.s.info = e2->u.s.info; } else { --- 749,753 ---- freeexp(fs, e1); SETARG_B(getcode(fs, e2), e1->u.s.info); ! e1->k = VRELOCABLE; e1->u.s.info = e2->u.s.info; } else { Index: ldo.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/ldo.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** ldo.c 29 Mar 2006 05:48:11 -0000 1.2 --- ldo.c 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 384,388 **** StkId firstArg = cast(StkId, ud); CallInfo *ci = L->ci; ! if (L->status != LUA_YIELD) { /* start coroutine */ lua_assert(ci == L->base_ci && firstArg > L->base); if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) --- 384,388 ---- StkId firstArg = cast(StkId, ud); CallInfo *ci = L->ci; ! if (L->status == 0) { /* start coroutine? */ lua_assert(ci == L->base_ci && firstArg > L->base); if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA) *************** *** 390,393 **** --- 390,395 ---- } else { /* resuming from previous yield */ + lua_assert(L->status == LUA_YIELD); + L->status = 0; if (!f_isLua(ci)) { /* `common' yield? */ /* finish interrupted execution of `OP_CALL' */ *************** *** 400,404 **** L->base = L->ci->base; } - L->status = 0; luaV_execute(L, cast_int(L->ci - L->base_ci)); } --- 402,405 ---- Index: lparser.h =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lparser.h,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lparser.h 29 Mar 2006 05:48:11 -0000 1.2 --- lparser.h 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 10,14 **** #include "llimits.h" #include "lobject.h" - #include "ltable.h" #include "lzio.h" --- 10,13 ---- Index: lstrlib.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lstrlib.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** lstrlib.c 29 Mar 2006 06:00:00 -0000 1.1 --- lstrlib.c 12 Jun 2006 03:50:38 -0000 1.2 *************** *** 704,707 **** --- 704,711 ---- break; } + case '\r': { + luaL_addlstring(b, "\\r", 2); + break; + } case '\0': { luaL_addlstring(b, "\\000", 4); *************** *** 806,810 **** } default: { /* also treat cases `pnLlh' */ ! return luaL_error(L, "invalid option to " LUA_QL("format")); } } --- 810,815 ---- } default: { /* also treat cases `pnLlh' */ ! return luaL_error(L, "invalid option " LUA_QL("%%%c") " to " ! LUA_QL("format"), *(strfrmt - 1)); } } Index: lparser.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lparser.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lparser.c 29 Mar 2006 05:48:11 -0000 1.2 --- lparser.c 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 24,28 **** #include "lstate.h" #include "lstring.h" ! --- 24,28 ---- #include "lstate.h" #include "lstring.h" ! #include "ltable.h" *************** *** 300,304 **** if (bl->upval) luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); ! lua_assert(!bl->isbreakable || !bl->upval); /* loops have no body */ lua_assert(bl->nactvar == fs->nactvar); fs->freereg = fs->nactvar; /* free registers */ --- 300,305 ---- if (bl->upval) luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0); ! /* a block either controls scope or breaks (never both) */ ! lua_assert(!bl->isbreakable || !bl->upval); lua_assert(bl->nactvar == fs->nactvar); fs->freereg = fs->nactvar; /* free registers */ *************** *** 445,448 **** --- 446,450 ---- int reg = ls->fs->freereg; expdesc key, val; + int rkkey; if (ls->t.token == TK_NAME) { luaY_checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); *************** *** 453,460 **** cc->nh++; checknext(ls, '='); ! luaK_exp2RK(fs, &key); expr(ls, &val); ! luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, luaK_exp2RK(fs, &key), ! luaK_exp2RK(fs, &val)); fs->freereg = reg; /* free registers */ } --- 455,461 ---- cc->nh++; checknext(ls, '='); ! rkkey = luaK_exp2RK(fs, &key); expr(ls, &val); ! luaK_codeABC(fs, OP_SETTABLE, cc->t->u.s.info, rkkey, luaK_exp2RK(fs, &val)); fs->freereg = reg; /* free registers */ } Index: luac.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/luac.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** luac.c 29 Mar 2006 06:00:00 -0000 1.1 --- luac.c 12 Jun 2006 03:50:38 -0000 1.2 *************** *** 71,74 **** --- 71,75 ---- { int i; + int version=0; if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; for (i=1; i<argc; i++) *************** *** 79,82 **** --- 80,84 ---- { ++i; + if (version) ++version; break; } *************** *** 96,103 **** stripping=1; else if (IS("-v")) /* show version */ ! { ! printf("%s %s\n",LUA_VERSION,LUA_COPYRIGHT); ! if (argc==2) exit(EXIT_SUCCESS); ! } else /* unknown option */ usage(argv[i]); --- 98,102 ---- stripping=1; else if (IS("-v")) /* show version */ ! ++version; else /* unknown option */ usage(argv[i]); *************** *** 108,111 **** --- 107,115 ---- argv[--i]=Output; } + if (version) + { + printf("%s %s\n",LUA_RELEASE,LUA_COPYRIGHT); + if (version==argc-1) exit(EXIT_SUCCESS); + } return i; } *************** *** 113,117 **** #define toproto(L,i) (clvalue(L->top+(i))->l.p) ! static Proto* combine(lua_State* L, int n) { if (n==1) --- 117,121 ---- #define toproto(L,i) (clvalue(L->top+(i))->l.p) ! static const Proto* combine(lua_State* L, int n) { if (n==1) *************** *** 157,161 **** int argc=s->argc; char** argv=s->argv; ! Proto* f; int i; if (!lua_checkstack(L,argc)) fatal("too many input files"); --- 161,165 ---- int argc=s->argc; char** argv=s->argv; ! const Proto* f; int i; if (!lua_checkstack(L,argc)) fatal("too many input files"); Index: lapi.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lapi.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lapi.c 29 Mar 2006 05:48:11 -0000 1.2 --- lapi.c 12 Jun 2006 03:50:37 -0000 1.3 *************** *** 33,37 **** const char lua_ident[] = ! "$Lua: " LUA_VERSION " " LUA_COPYRIGHT " $\n" "$Authors: " LUA_AUTHORS " $\n" "$URL: www.lua.org $\n"; --- 33,37 ---- const char lua_ident[] = ! "$Lua: " LUA_RELEASE " " LUA_COPYRIGHT " $\n" "$Authors: " LUA_AUTHORS " $\n" "$URL: www.lua.org $\n"; *************** *** 200,203 **** --- 200,206 ---- StkId o; lua_lock(L); + /* explicit test for incompatible code */ + if (idx == LUA_ENVIRONINDEX && L->ci == L->base_ci) + luaG_runerror(L, "no calling environment"); api_checknelems(L, 1); o = index2adr(L, idx); Index: lvm.c =================================================================== RCS file: /cvsroot/wxlua/wxLua/modules/lua/src/lvm.c,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** lvm.c 29 Mar 2006 05:48:11 -0000 1.2 --- lvm.c 12 Jun 2006 03:50:38 -0000 1.3 *************** *** 377,380 **** --- 377,381 ---- const Instruction *pc; reentry: /* entry point */ + lua_assert(isLua(L->ci)); pc = L->savedpc; cl = &clvalue(L->ci->func)->l; |