-Index: lua-5.1.4/src/Makefile
-===================================================================
---- lua-5.1.4.orig/src/Makefile 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/Makefile 2008-08-24 16:48:20.000000000 +0200
-@@ -25,7 +25,7 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -25,7 +25,7 @@ PLATS= aix ansi bsd freebsd generic linu
LUA_A= liblua.a
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
LUA_A= liblua.a
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
lstrlib.o loadlib.o linit.o
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
lstrlib.o loadlib.o linit.o
+@@ -148,6 +148,7 @@ llex.o: llex.c lua.h luaconf.h ldo.h lob
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 \
ltm.h lzio.h lmem.h ldo.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 \
ltm.h lzio.h lmem.h ldo.h
loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h
lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \
ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h
loadlib.o: loadlib.c lua.h luaconf.h lauxlib.h lualib.h
lobject.o: lobject.c lua.h luaconf.h ldo.h lobject.h llimits.h lstate.h \
ltm.h lzio.h lmem.h lstring.h lgc.h lvm.h
+@@ -179,4 +180,18 @@ lzio.o: lzio.c lua.h luaconf.h llimits.h
print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \
ltm.h lzio.h lmem.h lopcodes.h lundump.h
print.o: print.c ldebug.h lstate.h lua.h luaconf.h lobject.h llimits.h \
ltm.h lzio.h lmem.h lopcodes.h lundump.h
+print.c: lnum.h
+
# (end of Makefile)
+print.c: lnum.h
+
# (end of Makefile)
-Index: lua-5.1.4/src/lapi.c
-===================================================================
---- lua-5.1.4.orig/src/lapi.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lapi.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lapi.c
++++ b/src/lapi.c
@@ -28,7 +28,7 @@
#include "ltm.h"
#include "lundump.h"
@@ -28,7 +28,7 @@
#include "ltm.h"
#include "lundump.h"
+@@ -241,12 +241,13 @@ LUA_API void lua_pushvalue (lua_State *L
LUA_API int lua_type (lua_State *L, int idx) {
StkId o = index2adr(L, idx);
LUA_API int lua_type (lua_State *L, int idx) {
StkId o = index2adr(L, idx);
return (t == LUA_TNONE) ? "no value" : luaT_typenames[t];
}
return (t == LUA_TNONE) ? "no value" : luaT_typenames[t];
}
+@@ -264,6 +265,14 @@ LUA_API int lua_isnumber (lua_State *L,
LUA_API int lua_isstring (lua_State *L, int idx) {
int t = lua_type(L, idx);
return (t == LUA_TSTRING || t == LUA_TNUMBER);
LUA_API int lua_isstring (lua_State *L, int idx) {
int t = lua_type(L, idx);
return (t == LUA_TSTRING || t == LUA_TNUMBER);
+@@ -309,31 +318,66 @@ LUA_API int lua_lessthan (lua_State *L,
LUA_API int lua_toboolean (lua_State *L, int idx) {
const TValue *o = index2adr(L, idx);
return !l_isfalse(o);
LUA_API int lua_toboolean (lua_State *L, int idx) {
const TValue *o = index2adr(L, idx);
return !l_isfalse(o);
+@@ -364,6 +408,7 @@ LUA_API size_t lua_objlen (lua_State *L,
case LUA_TSTRING: return tsvalue(o)->len;
case LUA_TUSERDATA: return uvalue(o)->len;
case LUA_TTABLE: return luaH_getn(hvalue(o));
case LUA_TSTRING: return tsvalue(o)->len;
case LUA_TUSERDATA: return uvalue(o)->len;
case LUA_TTABLE: return luaH_getn(hvalue(o));
case LUA_TNUMBER: {
size_t l;
lua_lock(L); /* `luaV_tostring' may create a new string */
case LUA_TNUMBER: {
size_t l;
lua_lock(L); /* `luaV_tostring' may create a new string */
+@@ -426,6 +471,8 @@ LUA_API void lua_pushnil (lua_State *L)
LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
lua_lock(L);
setnvalue(L->top, n);
LUA_API void lua_pushnumber (lua_State *L, lua_Number n) {
lua_lock(L);
setnvalue(L->top, n);
+@@ -434,12 +481,22 @@ LUA_API void lua_pushnumber (lua_State *
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) {
+@@ -569,7 +626,7 @@ LUA_API void lua_rawgeti (lua_State *L,
lua_lock(L);
o = index2adr(L, idx);
api_check(L, ttistable(o));
lua_lock(L);
o = index2adr(L, idx);
api_check(L, ttistable(o));
api_incr_top(L);
lua_unlock(L);
}
api_incr_top(L);
lua_unlock(L);
}
+@@ -597,6 +654,9 @@ LUA_API int lua_getmetatable (lua_State
case LUA_TUSERDATA:
mt = uvalue(obj)->metatable;
break;
case LUA_TUSERDATA:
mt = uvalue(obj)->metatable;
break;
default:
mt = G(L)->mt[ttype(obj)];
break;
default:
mt = G(L)->mt[ttype(obj)];
break;
+@@ -687,7 +747,7 @@ LUA_API void lua_rawseti (lua_State *L,
api_checknelems(L, 1);
o = index2adr(L, idx);
api_check(L, ttistable(o));
api_checknelems(L, 1);
o = index2adr(L, idx);
api_check(L, ttistable(o));
luaC_barriert(L, hvalue(o), L->top-1);
L->top--;
lua_unlock(L);
luaC_barriert(L, hvalue(o), L->top-1);
L->top--;
lua_unlock(L);
+@@ -721,7 +781,7 @@ LUA_API int lua_setmetatable (lua_State
+@@ -1085,3 +1145,32 @@ LUA_API const char *lua_setupvalue (lua_
+ else lua_pushnumber( L, nvalue_fast(o) );
+ return 1;
+}
+ else lua_pushnumber( L, nvalue_fast(o) );
+ return 1;
+}
-Index: lua-5.1.4/src/lapi.h
-===================================================================
---- lua-5.1.4.orig/src/lapi.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lapi.h 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lapi.h
++++ b/src/lapi.h
@@ -13,4 +13,6 @@
LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o);
@@ -13,4 +13,6 @@
LUAI_FUNC void luaA_pushobject (lua_State *L, const TValue *o);
+int lua_pushvalue_as_number (lua_State *L, int idx);
+
#endif
+int lua_pushvalue_as_number (lua_State *L, int idx);
+
#endif
-Index: lua-5.1.4/src/lauxlib.c
-===================================================================
---- lua-5.1.4.orig/src/lauxlib.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lauxlib.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lauxlib.c
++++ b/src/lauxlib.c
@@ -23,7 +23,7 @@
#include "lua.h"
@@ -23,7 +23,7 @@
#include "lua.h"
#define FREELIST_REF 0 /* free list of references */
#define FREELIST_REF 0 /* free list of references */
+@@ -66,7 +66,7 @@ LUALIB_API int luaL_typerror (lua_State
static void tag_error (lua_State *L, int narg, int tag) {
static void tag_error (lua_State *L, int narg, int tag) {
+@@ -188,8 +188,8 @@ LUALIB_API lua_Number luaL_optnumber (lu
LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
lua_Integer d = lua_tointeger(L, narg);
LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) {
lua_Integer d = lua_tointeger(L, narg);
+@@ -200,6 +200,16 @@ LUALIB_API lua_Integer luaL_optinteger (
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
if (!lua_getmetatable(L, obj)) /* no metatable? */
return 0;
LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) {
if (!lua_getmetatable(L, obj)) /* no metatable? */
return 0;
-Index: lua-5.1.4/src/lauxlib.h
-===================================================================
---- lua-5.1.4.orig/src/lauxlib.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lauxlib.h 2008-08-24 16:48:20.000000000 +0200
-@@ -57,6 +57,12 @@
+--- a/src/lauxlib.h
++++ b/src/lauxlib.h
+@@ -57,6 +57,12 @@ LUALIB_API lua_Number (luaL_optnumber) (
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
lua_Integer def);
LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int numArg);
LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int nArg,
lua_Integer def);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg);
LUALIB_API void (luaL_checktype) (lua_State *L, int narg, int t);
-Index: lua-5.1.4/src/lbaselib.c
-===================================================================
---- lua-5.1.4.orig/src/lbaselib.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lbaselib.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lbaselib.c
++++ b/src/lbaselib.c
@@ -18,7 +18,9 @@
#include "lauxlib.h"
@@ -18,7 +18,9 @@
#include "lauxlib.h"
+@@ -54,20 +56,25 @@ static int luaB_tonumber (lua_State *L)
int base = luaL_optint(L, 2, 10);
if (base == 10) { /* standard conversion */
luaL_checkany(L, 1);
int base = luaL_optint(L, 2, 10);
if (base == 10) { /* standard conversion */
luaL_checkany(L, 1);
lua_pushnumber(L, (lua_Number)n);
return 1;
}
lua_pushnumber(L, (lua_Number)n);
return 1;
}
+@@ -144,7 +151,7 @@ static int luaB_setfenv (lua_State *L) {
luaL_checktype(L, 2, LUA_TTABLE);
getfunc(L, 0);
lua_pushvalue(L, 2);
luaL_checktype(L, 2, LUA_TTABLE);
getfunc(L, 0);
lua_pushvalue(L, 2);
/* change environment of current thread */
lua_pushthread(L);
lua_insert(L, -2);
/* change environment of current thread */
lua_pushthread(L);
lua_insert(L, -2);
+@@ -209,7 +216,7 @@ static int luaB_collectgarbage (lua_Stat
+@@ -631,6 +638,8 @@ static void base_open (lua_State *L) {
luaL_register(L, "_G", base_funcs);
lua_pushliteral(L, LUA_VERSION);
lua_setglobal(L, "_VERSION"); /* set global _VERSION */
luaL_register(L, "_G", base_funcs);
lua_pushliteral(L, LUA_VERSION);
lua_setglobal(L, "_VERSION"); /* set global _VERSION */
/* `ipairs' and `pairs' need auxliliary functions as upvalues */
auxopen(L, "ipairs", luaB_ipairs, ipairsaux);
auxopen(L, "pairs", luaB_pairs, luaB_next);
/* `ipairs' and `pairs' need auxliliary functions as upvalues */
auxopen(L, "ipairs", luaB_ipairs, ipairsaux);
auxopen(L, "pairs", luaB_pairs, luaB_next);
-Index: lua-5.1.4/src/lcode.c
-===================================================================
---- lua-5.1.4.orig/src/lcode.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lcode.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lcode.c
++++ b/src/lcode.c
@@ -22,13 +22,18 @@
#include "lopcodes.h"
#include "lparser.h"
@@ -22,13 +22,18 @@
#include "lopcodes.h"
#include "lparser.h"
+@@ -231,12 +236,16 @@ static int addk (FuncState *fs, TValue *
TValue *idx = luaH_set(L, fs->h, k);
Proto *f = fs->f;
int oldsize = f->sizek;
TValue *idx = luaH_set(L, fs->h, k);
Proto *f = fs->f;
int oldsize = f->sizek;
luaM_growvector(L, f->k, fs->nk, f->sizek, TValue,
MAXARG_Bx, "constant table overflow");
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
luaM_growvector(L, f->k, fs->nk, f->sizek, TValue,
MAXARG_Bx, "constant table overflow");
while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]);
+@@ -261,6 +270,21 @@ int luaK_numberK (FuncState *fs, lua_Num
static int boolK (FuncState *fs, int b) {
TValue o;
setbvalue(&o, b);
static int boolK (FuncState *fs, int b) {
TValue o;
setbvalue(&o, b);
+@@ -359,6 +383,16 @@ static void discharge2reg (FuncState *fs
luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval));
break;
}
luaK_codeABx(fs, OP_LOADK, reg, luaK_numberK(fs, e->u.nval));
break;
}
case VRELOCABLE: {
Instruction *pc = &getcode(fs, e);
SETARG_A(*pc, reg);
case VRELOCABLE: {
Instruction *pc = &getcode(fs, e);
SETARG_A(*pc, reg);
+@@ -444,6 +478,10 @@ void luaK_exp2val (FuncState *fs, expdes
int luaK_exp2RK (FuncState *fs, expdesc *e) {
luaK_exp2val(fs, e);
switch (e->k) {
int luaK_exp2RK (FuncState *fs, expdesc *e) {
luaK_exp2val(fs, e);
switch (e->k) {
case VKNUM:
case VTRUE:
case VFALSE:
case VKNUM:
case VTRUE:
case VFALSE:
+@@ -451,6 +489,10 @@ int luaK_exp2RK (FuncState *fs, expdesc
if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */
e->u.s.info = (e->k == VNIL) ? nilK(fs) :
(e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) :
if (fs->nk <= MAXINDEXRK) { /* constant fit in RK operand? */
e->u.s.info = (e->k == VNIL) ? nilK(fs) :
(e->k == VKNUM) ? luaK_numberK(fs, e->u.nval) :
boolK(fs, (e->k == VTRUE));
e->k = VK;
return RKASK(e->u.s.info);
boolK(fs, (e->k == VTRUE));
e->k = VK;
return RKASK(e->u.s.info);
+@@ -540,7 +582,10 @@ void luaK_goiftrue (FuncState *fs, expde
int pc; /* pc of last jump */
luaK_dischargevars(fs, e);
switch (e->k) {
int pc; /* pc of last jump */
luaK_dischargevars(fs, e);
switch (e->k) {
pc = NO_JUMP; /* always true; do nothing */
break;
}
pc = NO_JUMP; /* always true; do nothing */
break;
}
+@@ -598,7 +643,10 @@ static void codenot (FuncState *fs, expd
+@@ -634,25 +682,70 @@ void luaK_indexed (FuncState *fs, expdes
static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
lua_Number v1, v2, r;
static int constfolding (OpCode op, expdesc *e1, expdesc *e2) {
lua_Number v1, v2, r;
e1->u.nval = r;
return 1;
}
e1->u.nval = r;
return 1;
}
+@@ -696,7 +789,8 @@ static void codecomp (FuncState *fs, OpC
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
expdesc e2;
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) {
expdesc e2;
switch (op) {
case OPR_MINUS: {
if (!isnumeral(e))
switch (op) {
case OPR_MINUS: {
if (!isnumeral(e))
-Index: lua-5.1.4/src/lcode.h
-===================================================================
---- lua-5.1.4.orig/src/lcode.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lcode.h 2008-08-24 16:48:20.000000000 +0200
-@@ -71,6 +71,6 @@
+--- a/src/lcode.h
++++ b/src/lcode.h
+@@ -71,6 +71,6 @@ LUAI_FUNC void luaK_prefix (FuncState *f
LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);
LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);
LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
+LUAI_FUNC int luaK_integerK (FuncState *fs, lua_Integer r);
#endif
+LUAI_FUNC int luaK_integerK (FuncState *fs, lua_Integer r);
#endif
-Index: lua-5.1.4/src/ldebug.c
-===================================================================
---- lua-5.1.4.orig/src/ldebug.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/ldebug.c 2008-08-24 16:48:20.000000000 +0200
-@@ -183,7 +183,7 @@
+--- a/src/ldebug.c
++++ b/src/ldebug.c
+@@ -183,7 +183,7 @@ static void collectvalidlines (lua_State
int *lineinfo = f->l.p->lineinfo;
int i;
for (i=0; i<f->l.p->sizelineinfo; i++)
int *lineinfo = f->l.p->lineinfo;
int i;
for (i=0; i<f->l.p->sizelineinfo; i++)
sethvalue(L, L->top, t);
}
incr_top(L);
sethvalue(L, L->top, t);
}
incr_top(L);
+@@ -566,7 +566,7 @@ static int isinstack (CallInfo *ci, cons
void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
const char *name = NULL;
void luaG_typeerror (lua_State *L, const TValue *o, const char *op) {
const char *name = NULL;
const char *kind = (isinstack(L->ci, o)) ?
getobjname(L, L->ci, cast_int(o - L->base), &name) :
NULL;
const char *kind = (isinstack(L->ci, o)) ?
getobjname(L, L->ci, cast_int(o - L->base), &name) :
NULL;
+@@ -594,8 +594,8 @@ void luaG_aritherror (lua_State *L, cons
int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) {
if (t1[2] == t2[2])
luaG_runerror(L, "attempt to compare two %s values", t1);
else
if (t1[2] == t2[2])
luaG_runerror(L, "attempt to compare two %s values", t1);
else
-Index: lua-5.1.4/src/ldo.c
-===================================================================
---- lua-5.1.4.orig/src/ldo.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/ldo.c 2008-08-24 16:48:20.000000000 +0200
-@@ -219,9 +219,9 @@
+--- a/src/ldo.c
++++ b/src/ldo.c
+@@ -219,9 +219,9 @@ static StkId adjust_varargs (lua_State *
luaC_checkGC(L);
htab = luaH_new(L, nvar, 1); /* create `arg' table */
for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */
luaC_checkGC(L);
htab = luaH_new(L, nvar, 1); /* create `arg' table */
for (i=0; i<nvar; i++) /* put extra arguments into `arg' table */
}
#endif
/* move fixed parameters to final position */
}
#endif
/* move fixed parameters to final position */
-Index: lua-5.1.4/src/ldump.c
-===================================================================
---- lua-5.1.4.orig/src/ldump.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/ldump.c 2008-08-24 16:48:20.000000000 +0200
-@@ -52,6 +52,11 @@
+--- a/src/ldump.c
++++ b/src/ldump.c
+@@ -52,6 +52,11 @@ static void DumpNumber(lua_Number x, Dum
static void DumpVector(const void* b, int n, size_t size, DumpState* D)
{
DumpInt(n,D);
static void DumpVector(const void* b, int n, size_t size, DumpState* D)
{
DumpInt(n,D);
+@@ -93,8 +98,11 @@ static void DumpConstants(const Proto* f
DumpChar(bvalue(o),D);
break;
case LUA_TNUMBER:
DumpChar(bvalue(o),D);
break;
case LUA_TNUMBER:
case LUA_TSTRING:
DumpString(rawtsvalue(o),D);
break;
case LUA_TSTRING:
DumpString(rawtsvalue(o),D);
break;
-Index: lua-5.1.4/src/liolib.c
-===================================================================
---- lua-5.1.4.orig/src/liolib.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/liolib.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/liolib.c
++++ b/src/liolib.c
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
@@ -9,6 +9,7 @@
#include <stdio.h>
#include <stdlib.h>
#define IO_INPUT 1
#define IO_OUTPUT 2
#define IO_INPUT 1
#define IO_OUTPUT 2
+@@ -269,6 +271,13 @@ static int io_lines (lua_State *L) {
** =======================================================
*/
** =======================================================
*/
static int read_number (lua_State *L, FILE *f) {
lua_Number d;
static int read_number (lua_State *L, FILE *f) {
lua_Number d;
+@@ -279,6 +288,43 @@ static int read_number (lua_State *L, FI
else return 0; /* read fails */
}
else return 0; /* read fails */
}
static int test_eof (lua_State *L, FILE *f) {
int c = getc(f);
static int test_eof (lua_State *L, FILE *f) {
int c = getc(f);
+@@ -352,6 +398,14 @@ static int g_read (lua_State *L, FILE *f
case 'n': /* number */
success = read_number(L, f);
break;
case 'n': /* number */
success = read_number(L, f);
break;
case 'l': /* line */
success = read_line(L, f);
break;
case 'l': /* line */
success = read_line(L, f);
break;
+@@ -412,9 +466,10 @@ static int g_write (lua_State *L, FILE *
int status = 1;
for (; nargs--; arg++) {
if (lua_type(L, arg) == LUA_TNUMBER) {
int status = 1;
for (; nargs--; arg++) {
if (lua_type(L, arg) == LUA_TNUMBER) {
+@@ -457,7 +512,7 @@ static int f_setvbuf (lua_State *L) {
static const char *const modenames[] = {"no", "full", "line", NULL};
FILE *f = tofile(L);
int op = luaL_checkoption(L, 2, NULL, modenames);
static const char *const modenames[] = {"no", "full", "line", NULL};
FILE *f = tofile(L);
int op = luaL_checkoption(L, 2, NULL, modenames);
int res = setvbuf(f, NULL, mode[op], sz);
return pushresult(L, res == 0, NULL);
}
int res = setvbuf(f, NULL, mode[op], sz);
return pushresult(L, res == 0, NULL);
}
-Index: lua-5.1.4/src/llex.c
-===================================================================
---- lua-5.1.4.orig/src/llex.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/llex.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/llex.c
++++ b/src/llex.c
@@ -22,6 +22,7 @@
#include "lstring.h"
#include "ltable.h"
@@ -22,6 +22,7 @@
#include "lstring.h"
#include "ltable.h"
+@@ -90,7 +95,11 @@ static const char *txtToken (LexState *l
switch (token) {
case TK_NAME:
case TK_STRING:
switch (token) {
case TK_NAME:
case TK_STRING:
save(ls, '\0');
return luaZ_buffer(ls->buff);
default:
save(ls, '\0');
return luaZ_buffer(ls->buff);
default:
+@@ -173,23 +182,27 @@ static void buffreplace (LexState *ls, c
if (p[n] == from) p[n] = to;
}
if (p[n] == from) p[n] = to;
}
lua_assert(isdigit(ls->current));
do {
save_and_next(ls);
lua_assert(isdigit(ls->current));
do {
save_and_next(ls);
+@@ -200,8 +213,9 @@ static void read_numeral (LexState *ls,
save_and_next(ls);
save(ls, '\0');
buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
save_and_next(ls);
save(ls, '\0');
buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */
+@@ -329,6 +343,7 @@ static void read_string (LexState *ls, i
static int llex (LexState *ls, SemInfo *seminfo) {
luaZ_resetbuffer(ls->buff);
for (;;) {
static int llex (LexState *ls, SemInfo *seminfo) {
luaZ_resetbuffer(ls->buff);
for (;;) {
+@@ -400,8 +415,7 @@ static int llex (LexState *ls, SemInfo *
}
else if (!isdigit(ls->current)) return '.';
else {
}
else if (!isdigit(ls->current)) return '.';
else {
+@@ -414,8 +428,7 @@ static int llex (LexState *ls, SemInfo *
continue;
}
else if (isdigit(ls->current)) {
continue;
}
else if (isdigit(ls->current)) {
}
else if (isalpha(ls->current) || ls->current == '_') {
/* identifier or reserved word */
}
else if (isalpha(ls->current) || ls->current == '_') {
/* identifier or reserved word */
-Index: lua-5.1.4/src/llex.h
-===================================================================
---- lua-5.1.4.orig/src/llex.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/llex.h 2008-08-24 16:48:20.000000000 +0200
-@@ -29,19 +29,22 @@
+--- a/src/llex.h
++++ b/src/llex.h
+@@ -29,19 +29,22 @@ enum RESERVED {
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
/* other terminal symbols */
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE,
/* other terminal symbols */
TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, TK_NUMBER,
TString *ts;
} SemInfo; /* semantics information */
TString *ts;
} SemInfo; /* semantics information */
-Index: lua-5.1.4/src/llimits.h
-===================================================================
---- lua-5.1.4.orig/src/llimits.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/llimits.h 2008-08-24 16:48:20.000000000 +0200
-@@ -49,6 +49,7 @@
+--- a/src/llimits.h
++++ b/src/llimits.h
+@@ -49,6 +49,7 @@ typedef LUAI_USER_ALIGNMENT_T L_Umaxalig
/* result of a `usual argument conversion' over lua_Number */
typedef LUAI_UACNUMBER l_uacNumber;
/* result of a `usual argument conversion' over lua_Number */
typedef LUAI_UACNUMBER l_uacNumber;
/* internal assertions for in-house debugging */
/* internal assertions for in-house debugging */
+@@ -80,7 +81,6 @@ typedef LUAI_UACNUMBER l_uacNumber;
#define cast_int(i) cast(int, (i))
#define cast_int(i) cast(int, (i))
/*
** type for virtual-machine instructions
** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
/*
** type for virtual-machine instructions
** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h)
-Index: lua-5.1.4/src/lmathlib.c
-===================================================================
---- lua-5.1.4.orig/src/lmathlib.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lmathlib.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lmathlib.c
++++ b/src/lmathlib.c
@@ -4,7 +4,6 @@
** See Copyright Notice in lua.h
*/
@@ -4,7 +4,6 @@
** See Copyright Notice in lua.h
*/
+@@ -138,19 +234,20 @@ static int math_rad (lua_State *L) {
static int math_frexp (lua_State *L) {
int e;
static int math_frexp (lua_State *L) {
int e;
int n = lua_gettop(L); /* number of arguments */
lua_Number dmin = luaL_checknumber(L, 1);
int i;
int n = lua_gettop(L); /* number of arguments */
lua_Number dmin = luaL_checknumber(L, 1);
int i;
+@@ -165,6 +262,7 @@ static int math_min (lua_State *L) {
static int math_max (lua_State *L) {
static int math_max (lua_State *L) {
int n = lua_gettop(L); /* number of arguments */
lua_Number dmax = luaL_checknumber(L, 1);
int i;
int n = lua_gettop(L); /* number of arguments */
lua_Number dmax = luaL_checknumber(L, 1);
int i;
+@@ -182,25 +280,20 @@ static int math_random (lua_State *L) {
/* the `%' avoids the (rare) case of r==1, and is needed also because on
some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;
/* the `%' avoids the (rare) case of r==1, and is needed also because on
some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */
lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX;
+@@ -211,6 +304,66 @@ static int math_randomseed (lua_State *L
static const luaL_Reg mathlib[] = {
{"abs", math_abs},
static const luaL_Reg mathlib[] = {
{"abs", math_abs},
+@@ -241,6 +394,18 @@ static const luaL_Reg mathlib[] = {
{"sqrt", math_sqrt},
{"tanh", math_tanh},
{"tan", math_tan},
{"sqrt", math_sqrt},
{"tanh", math_tanh},
{"tan", math_tan},
+@@ -252,8 +417,10 @@ LUALIB_API int luaopen_math (lua_State *
luaL_register(L, LUA_MATHLIBNAME, mathlib);
lua_pushnumber(L, PI);
lua_setfield(L, -2, "pi");
luaL_register(L, LUA_MATHLIBNAME, mathlib);
lua_pushnumber(L, PI);
lua_setfield(L, -2, "pi");
#if defined(LUA_COMPAT_MOD)
lua_getfield(L, -1, "fmod");
lua_setfield(L, -2, "mod");
#if defined(LUA_COMPAT_MOD)
lua_getfield(L, -1, "fmod");
lua_setfield(L, -2, "mod");
-Index: lua-5.1.4/src/lnum.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ lua-5.1.4/src/lnum.c 2008-08-24 16:48:20.000000000 +0200
+--- /dev/null
++++ b/src/lnum.c
@@ -0,0 +1,312 @@
+/*
+** $Id: lnum.c,v ... $
@@ -0,0 +1,312 @@
+/*
+** $Id: lnum.c,v ... $
-Index: lua-5.1.4/src/lnum.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ lua-5.1.4/src/lnum.h 2008-08-24 16:48:20.000000000 +0200
+--- /dev/null
++++ b/src/lnum.h
@@ -0,0 +1,116 @@
+/*
+** $Id: lnum.h,v ... $
@@ -0,0 +1,116 @@
+/*
+** $Id: lnum.h,v ... $
+{ lua_Integer _i; if (tt_integer_valued(o,&_i)) setivalue(o,_i); }
+
+#endif
+{ lua_Integer _i; if (tt_integer_valued(o,&_i)) setivalue(o,_i); }
+
+#endif
-Index: lua-5.1.4/src/lnum_config.h
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ lua-5.1.4/src/lnum_config.h 2008-08-24 16:48:20.000000000 +0200
+--- /dev/null
++++ b/src/lnum_config.h
@@ -0,0 +1,221 @@
+/*
+** $Id: lnum_config.h,v ... $
@@ -0,0 +1,221 @@
+/*
+** $Id: lnum_config.h,v ... $
-Index: lua-5.1.4/src/lobject.c
-===================================================================
---- lua-5.1.4.orig/src/lobject.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lobject.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lobject.c
++++ b/src/lobject.c
@@ -21,7 +21,8 @@
#include "lstate.h"
#include "lstring.h"
@@ -21,7 +21,8 @@
#include "lstate.h"
#include "lstring.h"
const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL};
const TValue luaO_nilobject_ = {{NULL}, LUA_TNIL};
+@@ -70,12 +71,31 @@ int luaO_log2 (unsigned int x) {
int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
int luaO_rawequalObj (const TValue *t1, const TValue *t2) {
case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
case LUA_TLIGHTUSERDATA:
case LUA_TBOOLEAN:
return bvalue(t1) == bvalue(t2); /* boolean true must be 1 !! */
case LUA_TLIGHTUSERDATA:
+@@ -86,21 +106,6 @@ int luaO_rawequalObj (const TValue *t1,
static void pushstr (lua_State *L, const char *str) {
setsvalue2s(L, L->top, luaS_new(L, str));
incr_top(L);
static void pushstr (lua_State *L, const char *str) {
setsvalue2s(L, L->top, luaS_new(L, str));
incr_top(L);
+@@ -131,7 +136,11 @@ const char *luaO_pushvfstring (lua_State
+@@ -212,3 +221,4 @@ void luaO_chunkid (char *out, const char
-Index: lua-5.1.4/src/lobject.h
-===================================================================
---- lua-5.1.4.orig/src/lobject.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lobject.h 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lobject.h
++++ b/src/lobject.h
#define NUM_TAGS (LAST_TAG+1)
#define NUM_TAGS (LAST_TAG+1)
+@@ -59,7 +63,12 @@ typedef struct GCheader {
typedef union {
GCObject *gc;
void *p;
typedef union {
GCObject *gc;
void *p;
+@@ -77,7 +86,11 @@ typedef struct lua_TValue {
/* Macros to test type */
#define ttisnil(o) (ttype(o) == LUA_TNIL)
/* Macros to test type */
#define ttisnil(o) (ttype(o) == LUA_TNIL)
#define ttisstring(o) (ttype(o) == LUA_TSTRING)
#define ttistable(o) (ttype(o) == LUA_TTABLE)
#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION)
#define ttisstring(o) (ttype(o) == LUA_TSTRING)
#define ttistable(o) (ttype(o) == LUA_TTABLE)
#define ttisfunction(o) (ttype(o) == LUA_TFUNCTION)
+@@ -90,7 +103,25 @@ typedef struct lua_TValue {
#define ttype(o) ((o)->tt)
#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc)
#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p)
#define ttype(o) ((o)->tt)
#define gcvalue(o) check_exp(iscollectable(o), (o)->value.gc)
#define pvalue(o) check_exp(ttislightuserdata(o), (o)->value.p)
#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts)
#define tsvalue(o) (&rawtsvalue(o)->tsv)
#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u)
#define rawtsvalue(o) check_exp(ttisstring(o), &(o)->value.gc->ts)
#define tsvalue(o) (&rawtsvalue(o)->tsv)
#define rawuvalue(o) check_exp(ttisuserdata(o), &(o)->value.gc->u)
+@@ -116,8 +147,27 @@ typedef struct lua_TValue {
/* Macros to set values */
#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
/* Macros to set values */
#define setnilvalue(obj) ((obj)->tt=LUA_TNIL)
#define setpvalue(obj,x) \
{ TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
#define setpvalue(obj,x) \
{ TValue *i_o=(obj); i_o->value.p=(x); i_o->tt=LUA_TLIGHTUSERDATA; }
+@@ -155,9 +205,6 @@ typedef struct lua_TValue {
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
checkliveness(G(L),i_o); }
i_o->value.gc=cast(GCObject *, (x)); i_o->tt=LUA_TPROTO; \
checkliveness(G(L),i_o); }
#define setobj(L,obj1,obj2) \
{ const TValue *o2=(obj2); TValue *o1=(obj1); \
o1->value = o2->value; o1->tt=o2->tt; \
#define setobj(L,obj1,obj2) \
{ const TValue *o2=(obj2); TValue *o1=(obj1); \
o1->value = o2->value; o1->tt=o2->tt; \
+@@ -185,8 +232,11 @@ typedef struct lua_TValue {
#define setttype(obj, tt) (ttype(obj) = (tt))
#define setttype(obj, tt) (ttype(obj) = (tt))
+@@ -370,12 +420,10 @@ LUAI_FUNC int luaO_log2 (unsigned int x)
LUAI_FUNC int luaO_int2fb (unsigned int x);
LUAI_FUNC int luaO_fb2int (int x);
LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2);
LUAI_FUNC int luaO_int2fb (unsigned int x);
LUAI_FUNC int luaO_fb2int (int x);
LUAI_FUNC int luaO_rawequalObj (const TValue *t1, const TValue *t2);
-Index: lua-5.1.4/src/loslib.c
-===================================================================
---- lua-5.1.4.orig/src/loslib.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/loslib.c 2008-08-24 16:48:20.000000000 +0200
-@@ -186,15 +186,30 @@
+--- a/src/loslib.c
++++ b/src/loslib.c
+@@ -186,15 +186,30 @@ static int os_time (lua_State *L) {
}
if (t == (time_t)(-1))
lua_pushnil(L);
}
if (t == (time_t)(-1))
lua_pushnil(L);
-Index: lua-5.1.4/src/lparser.c
-===================================================================
---- lua-5.1.4.orig/src/lparser.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lparser.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lparser.c
++++ b/src/lparser.c
@@ -33,7 +33,6 @@
#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m)
@@ -33,7 +33,6 @@
#define luaY_checklimit(fs,v,l,m) if ((v)>(l)) errorlimit(fs,l,m)
/*
** nodes for block list (list of active blocks)
*/
/*
** nodes for block list (list of active blocks)
*/
+@@ -72,7 +71,7 @@ static void errorlimit (FuncState *fs, i
const char *msg = (fs->f->linedefined == 0) ?
luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) :
luaO_pushfstring(fs->L, "function at line %d has more than %d %s",
const char *msg = (fs->f->linedefined == 0) ?
luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) :
luaO_pushfstring(fs->L, "function at line %d has more than %d %s",
luaX_lexerror(fs->ls, msg, 0);
}
luaX_lexerror(fs->ls, msg, 0);
}
+@@ -733,6 +732,18 @@ static void simpleexp (LexState *ls, exp
v->u.nval = ls->t.seminfo.r;
break;
}
v->u.nval = ls->t.seminfo.r;
break;
}
case TK_STRING: {
codestring(ls, v, ls->t.seminfo.ts);
break;
case TK_STRING: {
codestring(ls, v, ls->t.seminfo.ts);
break;
+@@ -1079,7 +1090,7 @@ static void fornum (LexState *ls, TStrin
if (testnext(ls, ','))
exp1(ls); /* optional step */
else { /* default step = 1 */
if (testnext(ls, ','))
exp1(ls); /* optional step */
else { /* default step = 1 */
luaK_reserveregs(fs, 1);
}
forbody(ls, base, line, 1, 1);
luaK_reserveregs(fs, 1);
}
forbody(ls, base, line, 1, 1);
-Index: lua-5.1.4/src/lparser.h
-===================================================================
---- lua-5.1.4.orig/src/lparser.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lparser.h 2008-08-24 16:48:20.000000000 +0200
-@@ -31,7 +31,11 @@
+--- a/src/lparser.h
++++ b/src/lparser.h
+@@ -31,7 +31,11 @@ typedef enum {
VRELOCABLE, /* info = instruction pc */
VNONRELOC, /* info = result register */
VCALL, /* info = instruction pc */
VRELOCABLE, /* info = instruction pc */
VNONRELOC, /* info = result register */
VCALL, /* info = instruction pc */
} expkind;
typedef struct expdesc {
} expkind;
typedef struct expdesc {
+@@ -39,6 +43,7 @@ typedef struct expdesc {
union {
struct { int info, aux; } s;
lua_Number nval;
union {
struct { int info, aux; } s;
lua_Number nval;
} u;
int t; /* patch list of `exit when true' */
int f; /* patch list of `exit when false' */
} u;
int t; /* patch list of `exit when true' */
int f; /* patch list of `exit when false' */
-Index: lua-5.1.4/src/lstrlib.c
-===================================================================
---- lua-5.1.4.orig/src/lstrlib.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lstrlib.c 2008-08-24 16:48:20.000000000 +0200
-@@ -43,8 +43,8 @@
+--- a/src/lstrlib.c
++++ b/src/lstrlib.c
+@@ -43,8 +43,8 @@ static ptrdiff_t posrelat (ptrdiff_t pos
static int str_sub (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
static int str_sub (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
if (start < 1) start = 1;
if (end > (ptrdiff_t)l) end = (ptrdiff_t)l;
if (start <= end)
if (start < 1) start = 1;
if (end > (ptrdiff_t)l) end = (ptrdiff_t)l;
if (start <= end)
+@@ -106,8 +106,8 @@ static int str_rep (lua_State *L) {
static int str_byte (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
static int str_byte (lua_State *L) {
size_t l;
const char *s = luaL_checklstring(L, 1, &l);
int n, i;
if (posi <= 0) posi = 1;
if ((size_t)pose > l) pose = l;
int n, i;
if (posi <= 0) posi = 1;
if ((size_t)pose > l) pose = l;
+@@ -496,7 +496,7 @@ static int str_find_aux (lua_State *L, i
size_t l1, l2;
const char *s = luaL_checklstring(L, 1, &l1);
const char *p = luaL_checklstring(L, 2, &l2);
size_t l1, l2;
const char *s = luaL_checklstring(L, 1, &l1);
const char *p = luaL_checklstring(L, 2, &l2);
if (init < 0) init = 0;
else if ((size_t)(init) > l1) init = (ptrdiff_t)l1;
if (find && (lua_toboolean(L, 4) || /* explicit request? */
if (init < 0) init = 0;
else if ((size_t)(init) > l1) init = (ptrdiff_t)l1;
if (find && (lua_toboolean(L, 4) || /* explicit request? */
+@@ -690,7 +690,7 @@ static int str_gsub (lua_State *L) {
** maximum size of each format specification (such as '%-099.99d')
** (+10 accounts for %99.99x plus margin of error)
*/
** maximum size of each format specification (such as '%-099.99d')
** (+10 accounts for %99.99x plus margin of error)
*/
static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
+@@ -747,9 +747,9 @@ static const char *scanformat (lua_State
static void addintlen (char *form) {
size_t l = strlen(form);
char spec = form[l - 1];
static void addintlen (char *form) {
size_t l = strlen(form);
char spec = form[l - 1];
+@@ -777,12 +777,12 @@ static int str_format (lua_State *L) {
}
case 'd': case 'i': {
addintlen(form);
}
case 'd': case 'i': {
addintlen(form);
break;
}
case 'e': case 'E': case 'f':
break;
}
case 'e': case 'E': case 'f':
-Index: lua-5.1.4/src/ltable.c
-===================================================================
---- lua-5.1.4.orig/src/ltable.c 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/ltable.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/ltable.c
++++ b/src/ltable.c
@@ -33,6 +33,7 @@
#include "lobject.h"
#include "lstate.h"
@@ -33,6 +33,7 @@
#include "lobject.h"
#include "lstate.h"
#define dummynode (&dummynode_)
static const Node dummynode_ = {
#define dummynode (&dummynode_)
static const Node dummynode_ = {
+@@ -80,27 +71,46 @@ static const Node dummynode_ = {
/*
** hash for lua_Numbers
/*
** hash for lua_Numbers
case LUA_TSTRING:
return hashstr(t, rawtsvalue(key));
case LUA_TBOOLEAN:
case LUA_TSTRING:
return hashstr(t, rawtsvalue(key));
case LUA_TBOOLEAN:
+@@ -116,16 +126,20 @@ static Node *mainposition (const Table *
/*
** returns the index for `key' if `key' is an appropriate key to live in
** the array part of the table, -1 otherwise.
/*
** returns the index for `key' if `key' is an appropriate key to live in
** the array part of the table, -1 otherwise.
+@@ -137,8 +151,8 @@ static int arrayindex (const TValue *key
static int findindex (lua_State *L, Table *t, StkId key) {
int i;
if (ttisnil(key)) return -1; /* first iteration */
static int findindex (lua_State *L, Table *t, StkId key) {
int i;
if (ttisnil(key)) return -1; /* first iteration */
return i-1; /* yes; that's the index (corrected to C) */
else {
Node *n = mainposition(t, key);
return i-1; /* yes; that's the index (corrected to C) */
else {
Node *n = mainposition(t, key);
+@@ -163,7 +177,7 @@ int luaH_next (lua_State *L, Table *t, S
int i = findindex(L, t, key); /* find original element */
for (i++; i < t->sizearray; i++) { /* try first array part */
if (!ttisnil(&t->array[i])) { /* a non-nil value? */
int i = findindex(L, t, key); /* find original element */
for (i++; i < t->sizearray; i++) { /* try first array part */
if (!ttisnil(&t->array[i])) { /* a non-nil value? */
setobj2s(L, key+1, &t->array[i]);
return 1;
}
setobj2s(L, key+1, &t->array[i]);
return 1;
}
+@@ -209,8 +223,8 @@ static int computesizes (int nums[], int
static int countint (const TValue *key, int *nums) {
static int countint (const TValue *key, int *nums) {
nums[ceillog2(k)]++; /* count as such */
return 1;
}
nums[ceillog2(k)]++; /* count as such */
return 1;
}
+@@ -308,7 +322,7 @@ static void resize (lua_State *L, Table
/* re-insert elements from vanishing slice */
for (i=nasize; i<oldasize; i++) {
if (!ttisnil(&t->array[i]))
/* re-insert elements from vanishing slice */
for (i=nasize; i<oldasize; i++) {
if (!ttisnil(&t->array[i]))
}
/* shrink array */
luaM_reallocvector(L, t->array, oldasize, nasize, TValue);
}
/* shrink array */
luaM_reallocvector(L, t->array, oldasize, nasize, TValue);
+@@ -409,7 +423,9 @@ static TValue *newkey (lua_State *L, Tab
othern = mainposition(t, key2tval(mp));
if (othern != mp) { /* is colliding node out of its main position? */
/* yes; move colliding node into free position */
othern = mainposition(t, key2tval(mp));
if (othern != mp) { /* is colliding node out of its main position? */
/* yes; move colliding node into free position */
gnext(othern) = n; /* redo the chain with `n' in place of `mp' */
*n = *mp; /* copy colliding node into free pos. (mp->next also goes) */
gnext(mp) = NULL; /* now `mp' is free */
gnext(othern) = n; /* redo the chain with `n' in place of `mp' */
*n = *mp; /* copy colliding node into free pos. (mp->next also goes) */
gnext(mp) = NULL; /* now `mp' is free */
+@@ -432,17 +448,18 @@ static TValue *newkey (lua_State *L, Tab
/*
** search function for integers
*/
/*
** search function for integers
*/
} while (n);
return luaO_nilobject;
}
} while (n);
return luaO_nilobject;
}
+@@ -470,14 +487,12 @@ const TValue *luaH_get (Table *t, const
switch (ttype(key)) {
case LUA_TNIL: return luaO_nilobject;
case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
switch (ttype(key)) {
case LUA_TNIL: return luaO_nilobject;
case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key));
default: {
Node *n = mainposition(t, key);
do { /* check whether `key' is somewhere in the chain */
default: {
Node *n = mainposition(t, key);
do { /* check whether `key' is somewhere in the chain */
+@@ -498,20 +513,25 @@ TValue *luaH_set (lua_State *L, Table *t
return cast(TValue *, p);
else {
if (ttisnil(key)) luaG_runerror(L, "table index is nil");
return cast(TValue *, p);
else {
if (ttisnil(key)) luaG_runerror(L, "table index is nil");
return newkey(L, t, &k);
}
}
return newkey(L, t, &k);
}
}
+@@ -533,20 +553,21 @@ static int unbound_search (Table *t, uns
unsigned int i = j; /* i is zero or a present index */
j++;
/* find `i' and `j' such that i is present and j is not */
unsigned int i = j; /* i is zero or a present index */
j++;
/* find `i' and `j' such that i is present and j is not */
-Index: lua-5.1.4/src/ltable.h
-===================================================================
---- lua-5.1.4.orig/src/ltable.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/ltable.h 2008-08-24 16:48:20.000000000 +0200
+--- a/src/ltable.h
++++ b/src/ltable.h
@@ -18,8 +18,8 @@
#define key2tval(n) (&(n)->i_key.tvk)
@@ -18,8 +18,8 @@
#define key2tval(n) (&(n)->i_key.tvk)
LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key);
LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key);
LUAI_FUNC TValue *luaH_setstr (lua_State *L, Table *t, TString *key);
LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key);
-Index: lua-5.1.4/src/ltm.c
-===================================================================
---- lua-5.1.4.orig/src/ltm.c 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/ltm.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/ltm.c
++++ b/src/ltm.c
@@ -19,7 +19,6 @@
#include "ltm.h"
@@ -19,7 +19,6 @@
#include "ltm.h"
const char *const luaT_typenames[] = {
"nil", "boolean", "userdata", "number",
"string", "table", "function", "userdata", "thread",
const char *const luaT_typenames[] = {
"nil", "boolean", "userdata", "number",
"string", "table", "function", "userdata", "thread",
+@@ -67,6 +66,9 @@ const TValue *luaT_gettmbyobj (lua_State
case LUA_TUSERDATA:
mt = uvalue(o)->metatable;
break;
case LUA_TUSERDATA:
mt = uvalue(o)->metatable;
break;
default:
mt = G(L)->mt[ttype(o)];
}
default:
mt = G(L)->mt[ttype(o)];
}
-Index: lua-5.1.4/src/lua.c
-===================================================================
---- lua-5.1.4.orig/src/lua.c 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/lua.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lua.c
++++ b/src/lua.c
@@ -16,7 +16,7 @@
#include "lauxlib.h"
@@ -16,7 +16,7 @@
#include "lauxlib.h"
static lua_State *globalL = NULL;
static lua_State *globalL = NULL;
+@@ -382,6 +382,15 @@ int main (int argc, char **argv) {
l_message(argv[0], "cannot create state: not enough memory");
return EXIT_FAILURE;
}
l_message(argv[0], "cannot create state: not enough memory");
return EXIT_FAILURE;
}
s.argc = argc;
s.argv = argv;
status = lua_cpcall(L, &pmain, &s);
s.argc = argc;
s.argv = argv;
status = lua_cpcall(L, &pmain, &s);
-Index: lua-5.1.4/src/lua.h
-===================================================================
---- lua-5.1.4.orig/src/lua.h 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/lua.h 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lua.h
++++ b/src/lua.h
@@ -19,7 +19,7 @@
#define LUA_VERSION "Lua 5.1"
#define LUA_RELEASE "Lua 5.1.4"
@@ -19,7 +19,7 @@
#define LUA_VERSION "Lua 5.1"
#define LUA_RELEASE "Lua 5.1.4"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
+@@ -71,6 +71,16 @@ typedef void * (*lua_Alloc) (void *ud, v
*/
#define LUA_TNONE (-1)
*/
#define LUA_TNONE (-1)
#define LUA_TNIL 0
#define LUA_TBOOLEAN 1
#define LUA_TLIGHTUSERDATA 2
#define LUA_TNIL 0
#define LUA_TBOOLEAN 1
#define LUA_TLIGHTUSERDATA 2
+@@ -139,6 +149,8 @@ LUA_API int (lua_isuserdata)
LUA_API int (lua_type) (lua_State *L, int idx);
LUA_API const char *(lua_typename) (lua_State *L, int tp);
LUA_API int (lua_type) (lua_State *L, int idx);
LUA_API const char *(lua_typename) (lua_State *L, int tp);
LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_equal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2);
LUA_API int (lua_lessthan) (lua_State *L, int idx1, int idx2);
+@@ -244,6 +256,19 @@ LUA_API lua_Alloc (lua_getallocf) (lua_S
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
/*
** ===============================================================
/*
** ===============================================================
+@@ -268,7 +293,12 @@ LUA_API void lua_setallocf (lua_State *L
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN)
#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD)
#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE)
#define lua_pushliteral(L, s) \
lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
#define lua_pushliteral(L, s) \
lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
+@@ -386,3 +416,4 @@ struct lua_Debug {
-Index: lua-5.1.4/src/luaconf.h
-===================================================================
---- lua-5.1.4.orig/src/luaconf.h 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/luaconf.h 2008-08-24 16:48:20.000000000 +0200
+--- a/src/luaconf.h
++++ b/src/luaconf.h
@@ -10,7 +10,9 @@
#include <limits.h>
@@ -10,7 +10,9 @@
#include <limits.h>
/*
@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
** CHANGE it if your system requires alignments larger than double. (For
/*
@@ LUAI_USER_ALIGNMENT_T is a type that requires maximum alignment.
** CHANGE it if your system requires alignments larger than double. (For
+@@ -728,28 +652,6 @@ union luai_Cast { double l_d; long l_l;
#define luai_userstateyield(L,n) ((void)L)
#define luai_userstateyield(L,n) ((void)L)
/* =================================================================== */
/*
/* =================================================================== */
/*
-Index: lua-5.1.4/src/lundump.c
-===================================================================
---- lua-5.1.4.orig/src/lundump.c 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/lundump.c 2008-08-24 16:48:20.000000000 +0200
-@@ -73,6 +73,13 @@
+--- a/src/lundump.c
++++ b/src/lundump.c
+@@ -73,6 +73,13 @@ static lua_Number LoadNumber(LoadState*
static TString* LoadString(LoadState* S)
{
size_t size;
static TString* LoadString(LoadState* S)
{
size_t size;
+@@ -119,6 +126,9 @@ static void LoadConstants(LoadState* S,
case LUA_TNUMBER:
setnvalue(o,LoadNumber(S));
break;
case LUA_TNUMBER:
setnvalue(o,LoadNumber(S));
break;
case LUA_TSTRING:
setsvalue2n(S->L,o,LoadString(S));
break;
case LUA_TSTRING:
setsvalue2n(S->L,o,LoadString(S));
break;
+@@ -223,5 +233,22 @@ void luaU_header (char* h)
*h++=(char)sizeof(size_t);
*h++=(char)sizeof(Instruction);
*h++=(char)sizeof(lua_Number);
*h++=(char)sizeof(size_t);
*h++=(char)sizeof(Instruction);
*h++=(char)sizeof(lua_Number);
-Index: lua-5.1.4/src/lvm.c
-===================================================================
---- lua-5.1.4.orig/src/lvm.c 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/lvm.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lvm.c
++++ b/src/lvm.c
@@ -25,22 +25,35 @@
#include "ltable.h"
#include "ltm.h"
@@ -25,22 +25,35 @@
#include "ltable.h"
#include "ltm.h"
+@@ -49,8 +62,7 @@ int luaV_tostring (lua_State *L, StkId o
return 0;
else {
char s[LUAI_MAXNUMBER2STR];
return 0;
else {
char s[LUAI_MAXNUMBER2STR];
setsvalue2s(L, obj, luaS_new(L, s));
return 1;
}
setsvalue2s(L, obj, luaS_new(L, s));
return 1;
}
+@@ -218,59 +230,127 @@ static int l_strcmp (const TString *ls,
return !l_isfalse(L->top);
}
return !l_isfalse(L->top);
}
+@@ -310,30 +390,6 @@ void luaV_concat (lua_State *L, int tota
/*
** some macros for common tasks in `luaV_execute'
*/
/*
** some macros for common tasks in `luaV_execute'
*/
+@@ -357,17 +413,154 @@ static void Arith (lua_State *L, StkId r
#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; }
#define Protect(x) { L->savedpc = pc; {x;}; base = L->base; }
void luaV_execute (lua_State *L, int nexeccalls) {
void luaV_execute (lua_State *L, int nexeccalls) {
+@@ -468,38 +661,45 @@ void luaV_execute (lua_State *L, int nex
continue;
}
case OP_ADD: {
continue;
}
case OP_ADD: {
continue;
}
case OP_NOT: {
continue;
}
case OP_NOT: {
+@@ -511,11 +711,11 @@ void luaV_execute (lua_State *L, int nex
const TValue *rb = RB(i);
switch (ttype(rb)) {
case LUA_TTABLE: {
const TValue *rb = RB(i);
switch (ttype(rb)) {
case LUA_TTABLE: {
break;
}
default: { /* try metamethod */
break;
}
default: { /* try metamethod */
+@@ -648,14 +848,30 @@ void luaV_execute (lua_State *L, int nex
+@@ -664,13 +880,21 @@ void luaV_execute (lua_State *L, int nex
const TValue *plimit = ra+1;
const TValue *pstep = ra+2;
L->savedpc = pc; /* next steps may throw errors */
const TValue *plimit = ra+1;
const TValue *pstep = ra+2;
L->savedpc = pc; /* next steps may throw errors */
dojump(L, pc, GETARG_sBx(i));
continue;
}
dojump(L, pc, GETARG_sBx(i));
continue;
}
+@@ -707,7 +931,7 @@ void luaV_execute (lua_State *L, int nex
luaH_resizearray(L, h, last); /* pre-alloc it at once */
for (; n > 0; n--) {
TValue *val = ra+n;
luaH_resizearray(L, h, last); /* pre-alloc it at once */
for (; n > 0; n--) {
TValue *val = ra+n;
luaC_barriert(L, h, val);
}
continue;
luaC_barriert(L, h, val);
}
continue;
-Index: lua-5.1.4/src/lvm.h
-===================================================================
---- lua-5.1.4.orig/src/lvm.h 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/lvm.h 2008-08-24 16:48:20.000000000 +0200
+--- a/src/lvm.h
++++ b/src/lvm.h
@@ -15,11 +15,9 @@
#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))
@@ -15,11 +15,9 @@
#define tostring(L,o) ((ttype(o) == LUA_TSTRING) || (luaV_tostring(L, o)))
LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r);
LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r);
-Index: lua-5.1.4/src/print.c
-===================================================================
---- lua-5.1.4.orig/src/print.c 2008-08-24 16:46:38.000000000 +0200
-+++ lua-5.1.4/src/print.c 2008-08-24 16:48:20.000000000 +0200
+--- a/src/print.c
++++ b/src/print.c
@@ -14,6 +14,7 @@
#include "lobject.h"
#include "lopcodes.h"
@@ -14,6 +14,7 @@
#include "lobject.h"
#include "lopcodes.h"
#define PrintFunction luaU_print
#define PrintFunction luaU_print
+@@ -59,8 +60,16 @@ static void PrintConstant(const Proto* f
case LUA_TBOOLEAN:
printf(bvalue(o) ? "true" : "false");
break;
case LUA_TBOOLEAN:
printf(bvalue(o) ? "true" : "false");
break;
-Index: lua-5.1.3/src/lua.h
-===================================================================
---- lua-5.1.3.orig/src/lua.h 2008-06-29 11:45:55.000000000 +0200
-+++ lua-5.1.3/src/lua.h 2008-06-29 11:46:28.000000000 +0200
-@@ -79,7 +79,7 @@
+--- a/src/lua.h
++++ b/src/lua.h
+@@ -79,7 +79,7 @@ typedef void * (*lua_Alloc) (void *ud, v
* not acceptable for 5.1, maybe 5.2 onwards?
* 9: greater than existing (5.1) type values.
*/
* not acceptable for 5.1, maybe 5.2 onwards?
* 9: greater than existing (5.1) type values.
*/
-Index: lua-5.1.4/Makefile
-===================================================================
---- lua-5.1.4.orig/Makefile 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/Makefile 2008-08-24 16:48:42.000000000 +0200
-@@ -42,8 +42,8 @@
+--- a/Makefile
++++ b/Makefile
+@@ -42,8 +42,8 @@ PLATS= aix ansi bsd freebsd generic linu
# What to install.
TO_BIN= lua luac
# What to install.
TO_BIN= lua luac
TO_MAN= lua.1 luac.1
# Lua version and release.
TO_MAN= lua.1 luac.1
# Lua version and release.
+@@ -63,6 +63,7 @@ install: dummy
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
ranlib:
cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
ranlib:
-Index: lua-5.1.4/src/ldo.h
-===================================================================
---- lua-5.1.4.orig/src/ldo.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/ldo.h 2008-08-24 16:48:42.000000000 +0200
-@@ -46,7 +46,7 @@
+--- a/src/ldo.h
++++ b/src/ldo.h
+@@ -46,7 +46,7 @@ LUAI_FUNC int luaD_pcall (lua_State *L,
LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult);
LUAI_FUNC void luaD_reallocCI (lua_State *L, int newsize);
LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize);
LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
LUAI_FUNC void luaD_throw (lua_State *L, int errcode);
LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud);
-Index: lua-5.1.4/src/lfunc.h
-===================================================================
---- lua-5.1.4.orig/src/lfunc.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lfunc.h 2008-08-24 16:48:42.000000000 +0200
+--- a/src/lfunc.h
++++ b/src/lfunc.h
@@ -18,7 +18,7 @@
cast(int, sizeof(TValue *)*((n)-1)))
@@ -18,7 +18,7 @@
cast(int, sizeof(TValue *)*((n)-1)))
LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
LUAI_FUNC Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e);
LUAI_FUNC Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e);
LUAI_FUNC UpVal *luaF_newupval (lua_State *L);
-Index: lua-5.1.4/src/lmem.h
-===================================================================
---- lua-5.1.4.orig/src/lmem.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lmem.h 2008-08-24 16:48:42.000000000 +0200
+--- a/src/lmem.h
++++ b/src/lmem.h
@@ -38,9 +38,9 @@
((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
@@ -38,9 +38,9 @@
((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t))))
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
size_t size_elem, int limit,
const char *errormsg);
LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size,
size_t size_elem, int limit,
const char *errormsg);
-Index: lua-5.1.4/src/lstring.h
-===================================================================
---- lua-5.1.4.orig/src/lstring.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lstring.h 2008-08-24 16:48:42.000000000 +0200
+--- a/src/lstring.h
++++ b/src/lstring.h
@@ -25,7 +25,7 @@
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
@@ -25,7 +25,7 @@
LUAI_FUNC void luaS_resize (lua_State *L, int newsize);
-Index: lua-5.1.4/src/lundump.h
-===================================================================
---- lua-5.1.4.orig/src/lundump.h 2008-08-24 16:46:37.000000000 +0200
-+++ lua-5.1.4/src/lundump.h 2008-08-24 16:48:42.000000000 +0200
-@@ -17,7 +17,7 @@
+--- a/src/lundump.h
++++ b/src/lundump.h
+@@ -17,7 +17,7 @@ LUAI_FUNC Proto* luaU_undump (lua_State*
LUAI_FUNC void luaU_header (char* h);
/* dump one chunk; from ldump.c */
LUAI_FUNC void luaU_header (char* h);
/* dump one chunk; from ldump.c */
#ifdef luac_c
/* print one chunk; from print.c */
#ifdef luac_c
/* print one chunk; from print.c */
-Index: lua-5.1.4/src/Makefile
-===================================================================
---- lua-5.1.4.orig/src/Makefile 2008-08-24 16:48:20.000000000 +0200
-+++ lua-5.1.4/src/Makefile 2008-08-24 16:48:42.000000000 +0200
-@@ -23,6 +23,7 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -23,6 +23,7 @@ MYLIBS=
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
LUA_A= liblua.a
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o lnum.o
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o lnum.o
+@@ -33,11 +34,12 @@ LUA_T= lua
LUA_O= lua.o
LUAC_T= luac
LUA_O= lua.o
LUAC_T= luac
+@@ -47,14 +49,23 @@ o: $(ALL_O)
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
clean:
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
clean:
+@@ -96,7 +107,7 @@ generic:
$(MAKE) all MYCFLAGS=
linux:
$(MAKE) all MYCFLAGS=
linux:
-Index: lua-5.1.4/src/ldump.c
-===================================================================
---- lua-5.1.4.orig/src/ldump.c 2008-08-24 16:48:20.000000000 +0200
-+++ lua-5.1.4/src/ldump.c 2008-08-24 16:48:52.000000000 +0200
-@@ -67,12 +67,12 @@
+--- a/src/ldump.c
++++ b/src/ldump.c
+@@ -67,12 +67,12 @@ static void DumpString(const TString* s,
{
if (s==NULL || getstr(s)==NULL)
{
{
if (s==NULL || getstr(s)==NULL)
{
DumpVar(size,D);
DumpBlock(getstr(s),size,D);
}
DumpVar(size,D);
DumpBlock(getstr(s),size,D);
}
-Index: lua-5.1.4/src/lundump.c
-===================================================================
---- lua-5.1.4.orig/src/lundump.c 2008-08-24 16:48:20.000000000 +0200
-+++ lua-5.1.4/src/lundump.c 2008-08-24 16:48:52.000000000 +0200
-@@ -25,6 +25,7 @@
+--- a/src/lundump.c
++++ b/src/lundump.c
+@@ -25,6 +25,7 @@ typedef struct {
ZIO* Z;
Mbuffer* b;
const char* name;
ZIO* Z;
Mbuffer* b;
const char* name;
} LoadState;
#ifdef LUAC_TRUST_BINARIES
} LoadState;
#ifdef LUAC_TRUST_BINARIES
+@@ -40,7 +41,6 @@ static void error(LoadState* S, const ch
#define LoadByte(S) (lu_byte)LoadChar(S)
#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
#define LoadByte(S) (lu_byte)LoadChar(S)
#define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x))
#define LoadVector(S,b,n,size) LoadMem(S,b,n,size)
+@@ -51,6 +51,49 @@ static void LoadBlock(LoadState* S, void
IF (r!=0, "unexpected end");
}
IF (r!=0, "unexpected end");
}
static int LoadChar(LoadState* S)
{
char x;
static int LoadChar(LoadState* S)
{
char x;
+@@ -82,7 +125,7 @@ static lua_Integer LoadInteger(LoadState
static TString* LoadString(LoadState* S)
{
static TString* LoadString(LoadState* S)
{
LoadVar(S,size);
if (size==0)
return NULL;
LoadVar(S,size);
if (size==0)
return NULL;
+@@ -196,6 +239,7 @@ static void LoadHeader(LoadState* S)
char s[LUAC_HEADERSIZE];
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
char s[LUAC_HEADERSIZE];
luaU_header(h);
LoadBlock(S,s,LUAC_HEADERSIZE);
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
IF (memcmp(h,s,LUAC_HEADERSIZE)!=0, "bad header");
}
+@@ -230,7 +274,7 @@ void luaU_header (char* h)
*h++=(char)LUAC_FORMAT;
*h++=(char)*(char*)&x; /* endianness */
*h++=(char)sizeof(int);
*h++=(char)LUAC_FORMAT;
*h++=(char)*(char*)&x; /* endianness */
*h++=(char)sizeof(int);
-diff -ur lua-luci-5.1.3/src/luaconf.h lua-luci-5.1.3-new/src/luaconf.h
---- lua-luci-5.1.3/src/luaconf.h 2008-04-14 13:19:54.000000000 +0200
-+++ lua-luci-5.1.3-new/src/luaconf.h 2008-04-14 13:19:17.000000000 +0200
+--- a/src/luaconf.h
++++ b/src/luaconf.h
@@ -38,7 +38,6 @@
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
@@ -38,7 +38,6 @@
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#endif
#if defined(LUA_USE_MACOSX)
#endif
#if defined(LUA_USE_MACOSX)
-Nur in lua-luci-5.1.3-new/src: luaconf.h.orig.
-diff -ur lua-luci-5.1.3/src/Makefile lua-luci-5.1.3-new/src/Makefile
---- lua-luci-5.1.3/src/Makefile 2008-04-14 13:19:57.000000000 +0200
-+++ lua-luci-5.1.3-new/src/Makefile 2008-04-14 13:19:17.000000000 +0200
-@@ -17,6 +17,7 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -17,6 +17,7 @@ LIBS= -lm $(MYLIBS)
MYCFLAGS=
MYLDFLAGS=
MYLIBS=
MYCFLAGS=
MYLDFLAGS=
MYLIBS=
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
@echo "MYLIBS = $(MYLIBS)"
# convenience targets for popular platforms
@echo "MYLIBS = $(MYLIBS)"
# convenience targets for popular platforms
none:
@echo "Please choose a platform:"
@echo " $(PLATS)"
none:
@echo "Please choose a platform:"
@echo " $(PLATS)"
+@@ -101,16 +102,16 @@ bsd:
$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E"
freebsd:
$(MAKE) all MYCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" MYLIBS="-Wl,-E"
freebsd:
# use this on Mac OS X 10.3-
# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
# use this on Mac OS X 10.3-
# $(MAKE) all MYCFLAGS=-DLUA_USE_MACOSX
-Nur in lua-luci-5.1.3-new/src: Makefile.orig.
---- b/src/luaconf.h 2008-05-06 20:10:46.000000000 +0200
-+++ a/src/luaconf.h 2008-05-06 20:10:27.000000000 +0200
+--- a/src/luaconf.h
++++ b/src/luaconf.h
@@ -95,9 +95,9 @@
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
@@ -95,9 +95,9 @@
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
-Index: lua-5.1.4/src/Makefile
-===================================================================
---- lua-5.1.4.orig/src/Makefile 2008-09-25 12:19:44.000000000 +0200
-+++ lua-5.1.4/src/Makefile 2008-09-25 12:20:03.000000000 +0200
-@@ -12,7 +12,7 @@
+--- a/src/Makefile
++++ b/src/Makefile
+@@ -12,7 +12,7 @@ CFLAGS= -O2 -Wall $(MYCFLAGS)
AR= ar rcu
RANLIB= ranlib
RM= rm -f
AR= ar rcu
RANLIB= ranlib
RM= rm -f
+@@ -29,7 +29,7 @@ CORE_O= lapi.o lcode.o ldebug.o ldo.o ld
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o lnum.o
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o lnum.o
LIB_O= lauxlib.o lbaselib.o ldblib.o liolib.o lmathlib.o loslib.o ltablib.o \
-Index: lua-5.1.4/src/linit.c
-===================================================================
---- lua-5.1.4.orig/src/linit.c 2008-09-25 12:19:02.000000000 +0200
-+++ lua-5.1.4/src/linit.c 2008-09-25 12:19:32.000000000 +0200
-@@ -23,6 +23,7 @@
+--- a/src/linit.c
++++ b/src/linit.c
+@@ -23,6 +23,7 @@ static const luaL_Reg lualibs[] = {
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
{LUA_DBLIBNAME, luaopen_debug},
{LUA_STRLIBNAME, luaopen_string},
{LUA_MATHLIBNAME, luaopen_math},
{LUA_DBLIBNAME, luaopen_debug},
-Index: lua-5.1.4/src/lposix.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ lua-5.1.4/src/lposix.c 2008-09-25 12:16:29.000000000 +0200
+--- /dev/null
++++ b/src/lposix.c
@@ -0,0 +1,1139 @@
+/*
+* lposix.c
@@ -0,0 +1,1139 @@
+/*
+* lposix.c
-Index: lua-5.1.4/src/lualib.h
-===================================================================
---- lua-5.1.4.orig/src/lualib.h 2008-09-25 12:18:14.000000000 +0200
-+++ lua-5.1.4/src/lualib.h 2008-09-25 12:18:53.000000000 +0200
-@@ -39,6 +39,9 @@
+--- a/src/lualib.h
++++ b/src/lualib.h
+@@ -39,6 +39,9 @@ LUALIB_API int (luaopen_debug) (lua_Stat
#define LUA_LOADLIBNAME "package"
LUALIB_API int (luaopen_package) (lua_State *L);
#define LUA_LOADLIBNAME "package"
LUALIB_API int (luaopen_package) (lua_State *L);
/* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L);
/* open all previous libraries */
LUALIB_API void (luaL_openlibs) (lua_State *L);
-Index: lua-5.1.4/src/modemuncher.c
-===================================================================
---- /dev/null 1970-01-01 00:00:00.000000000 +0000
-+++ lua-5.1.4/src/modemuncher.c 2008-09-25 12:16:29.000000000 +0200
+--- /dev/null
++++ b/src/modemuncher.c
@@ -0,0 +1,261 @@
+/*
+ Mode Muncher -- modemuncher.c
@@ -0,0 +1,261 @@
+/*
+ Mode Muncher -- modemuncher.c
lua_unlock(L);
return res;
}
lua_unlock(L);
return res;
}
-@@ -1040,20 +1046,21 @@ LUA_API int lua_next (lua_State *L, int
+@@ -1040,8 +1046,9 @@ LUA_API int lua_next (lua_State *L, int
if (more) {
api_incr_top(L);
}
if (more) {
api_incr_top(L);
}
lua_unlock(L);
return more;
}
lua_unlock(L);
return more;
}
-
-
- LUA_API void lua_concat (lua_State *L, int n) {
- lua_lock(L);
- api_checknelems(L, n);
+@@ -1053,7 +1060,7 @@ LUA_API void lua_concat (lua_State *L, i
if (n >= 2) {
luaC_checkGC(L);
luaV_concat(L, n, cast_int(L->top - L->base) - 1);
if (n >= 2) {
luaC_checkGC(L);
luaV_concat(L, n, cast_int(L->top - L->base) - 1);
}
else if (n == 0) { /* push empty string */
setsvalue2s(L, L->top, luaS_newlstr(L, "", 0));
}
else if (n == 0) { /* push empty string */
setsvalue2s(L, L->top, luaS_newlstr(L, "", 0));
-@@ -1139,6 +1147,7 @@ LUA_API const char *lua_setupvalue (lua_
+@@ -1139,6 +1146,7 @@ LUA_API const char *lua_setupvalue (lua_
if (name) {
L->top--;
setobj(L, val, L->top);
if (name) {
L->top--;
setobj(L, val, L->top);
luaC_barrier(L, clvalue(fi), L->top);
}
lua_unlock(L);
luaC_barrier(L, clvalue(fi), L->top);
}
lua_unlock(L);
-@@ -1160,7 +1169,7 @@ LUA_API const char *lua_setupvalue (lua_
+@@ -1160,7 +1168,7 @@ LUA_API const char *lua_setupvalue (lua_
int lua_pushvalue_as_number (lua_State *L, int idx)
{
const TValue *o = index2adr(L, idx);
int lua_pushvalue_as_number (lua_State *L, int idx)
{
const TValue *o = index2adr(L, idx);
-@@ -543,7 +551,7 @@ static void atomic (lua_State *L) {
+@@ -543,7 +546,7 @@ static void atomic (lua_State *L) {
udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */
marktmu(g); /* mark `preserved' userdata */
udsize += propagateall(g); /* remark, to propagate `preserveness' */
udsize = luaC_separateudata(L, 0); /* separate userdata to be finalized */
marktmu(g); /* mark `preserved' userdata */
udsize += propagateall(g); /* remark, to propagate `preserveness' */
/* flip current white */
g->currentwhite = cast_byte(otherwhite(g));
g->sweepstrgc = 0;
/* flip current white */
g->currentwhite = cast_byte(otherwhite(g));
g->sweepstrgc = 0;
-@@ -685,8 +693,11 @@ void luaC_barrierback (lua_State *L, Tab
+@@ -685,8 +688,11 @@ void luaC_barrierback (lua_State *L, Tab
void luaC_link (lua_State *L, GCObject *o, lu_byte tt) {
global_State *g = G(L);
void luaC_link (lua_State *L, GCObject *o, lu_byte tt) {
global_State *g = G(L);
lua_Number d;
lua_Integer i;
lua_Number d;
lua_Integer i;
-@@ -384,6 +386,7 @@ void luaV_concat (lua_State *L, int tota
+@@ -384,6 +385,7 @@ void luaV_concat (lua_State *L, int tota
size_t l = tsvalue(top-i)->len;
memcpy(buffer+tl, svalue(top-i), l);
tl += l;
size_t l = tsvalue(top-i)->len;
memcpy(buffer+tl, svalue(top-i), l);
tl += l;
}
setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
}
}
setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl));
}
-@@ -420,7 +423,7 @@ void luaV_concat (lua_State *L, int tota
+@@ -420,7 +422,7 @@ void luaV_concat (lua_State *L, int tota
*/
static void Arith (lua_State *L, StkId ra, const TValue *rb,
const TValue *rc, TMS op) {
*/
static void Arith (lua_State *L, StkId ra, const TValue *rb,
const TValue *rc, TMS op) {
const TValue *b, *c;
lua_Number nb,nc;
const TValue *b, *c;
lua_Number nb,nc;
-@@ -663,7 +666,7 @@ void luaV_execute (lua_State *L, int nex
+@@ -663,7 +665,7 @@ void luaV_execute (lua_State *L, int nex
OPCODE_TARGET(LOADNIL) {
TValue *rb = RB(i);
do {
OPCODE_TARGET(LOADNIL) {
TValue *rb = RB(i);
do {
} while (rb >= ra);
continue;
}
} while (rb >= ra);
continue;
}
-@@ -673,7 +676,7 @@ void luaV_execute (lua_State *L, int nex
+@@ -673,7 +675,7 @@ void luaV_execute (lua_State *L, int nex
continue;
}
OPCODE_TARGET(GETGLOBAL) {
continue;
}
OPCODE_TARGET(GETGLOBAL) {
TValue *rb = KBx(i);
sethvalue(L, &g, cl->env);
lua_assert(ttisstring(rb));
TValue *rb = KBx(i);
sethvalue(L, &g, cl->env);
lua_assert(ttisstring(rb));
-@@ -685,7 +688,7 @@ void luaV_execute (lua_State *L, int nex
+@@ -685,7 +687,7 @@ void luaV_execute (lua_State *L, int nex
continue;
}
OPCODE_TARGET(SETGLOBAL) {
continue;
}
OPCODE_TARGET(SETGLOBAL) {
sethvalue(L, &g, cl->env);
lua_assert(ttisstring(KBx(i)));
Protect(luaV_settable(L, &g, KBx(i), ra));
sethvalue(L, &g, cl->env);
lua_assert(ttisstring(KBx(i)));
Protect(luaV_settable(L, &g, KBx(i), ra));
-@@ -895,7 +900,7 @@ void luaV_execute (lua_State *L, int nex
+@@ -895,7 +897,7 @@ void luaV_execute (lua_State *L, int nex
if (--nexeccalls == 0) /* was previous function running `here'? */
return; /* no: return */
else { /* yes: continue its execution */
if (--nexeccalls == 0) /* was previous function running `here'? */
return; /* no: return */
else { /* yes: continue its execution */
lua_assert(isLua(L->ci));
lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL);
goto reentry;
lua_assert(isLua(L->ci));
lua_assert(GET_OPCODE(*((L->ci)->savedpc - 1)) == OP_CALL);
goto reentry;
-@@ -986,6 +991,7 @@ void luaV_execute (lua_State *L, int nex
+@@ -986,6 +988,7 @@ void luaV_execute (lua_State *L, int nex
for (; n > 0; n--) {
TValue *val = ra+n;
setobj2t(L, luaH_setint(L, h, last--), val);
for (; n > 0; n--) {
TValue *val = ra+n;
setobj2t(L, luaH_setint(L, h, last--), val);
luaC_barriert(L, h, val);
}
continue;
luaC_barriert(L, h, val);
}
continue;
-@@ -1030,7 +1036,7 @@ void luaV_execute (lua_State *L, int nex
+@@ -1030,7 +1033,7 @@ void luaV_execute (lua_State *L, int nex
setobjs2s(L, ra + j, ci->base - n + j);
}
else {
setobjs2s(L, ra + j, ci->base - n + j);
}
else {