summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLua Team <team@lua.org>2002-07-04 12:00:00 +0000
committerrepogen <>2002-07-04 12:00:00 +0000
commit1981b7c90eb09e956e969cda5c473be4560af573 (patch)
treec392e31135e6e22793bf61e4cd493452f2db4216
parent8cb71cb5548e3138e5d4e4744f52c79d9fafb116 (diff)
downloadlua-github-4.0.1.tar.gz
Lua 4.0.14.0.1
-rw-r--r--DIFFS97
-rw-r--r--UPDATE19
-rw-r--r--include/lua.h4
-rw-r--r--src/lapi.c4
-rw-r--r--src/ldo.c11
-rw-r--r--src/lgc.c4
-rw-r--r--src/lgc.h3
-rw-r--r--src/lib/lbaselib.c8
-rw-r--r--src/lparser.c4
-rw-r--r--src/lstring.c4
-rw-r--r--src/lvm.c4
11 files changed, 141 insertions, 21 deletions
diff --git a/DIFFS b/DIFFS
new file mode 100644
index 00000000..b7c86388
--- /dev/null
+++ b/DIFFS
@@ -0,0 +1,97 @@
+diff -r lua-4.0/include/lua.h lua/include/lua.h
+2c2
+< ** $Id: lua.h,v 1.79 2000/10/31 12:44:07 roberto Exp $
+---
+> ** $Id: lua.h,v 1.79a 2000/10/31 12:44:07 roberto Exp $
+25c25
+< #define LUA_VERSION "Lua 4.0"
+---
+> #define LUA_VERSION "Lua 4.0.1"
+diff -r lua-4.0/src/lapi.c lua/src/lapi.c
+2c2
+< ** $Id: lapi.c,v 1.110 2000/10/30 12:50:09 roberto Exp $
+---
+> ** $Id: lapi.c,v 1.110a 2000/10/30 12:50:09 roberto Exp $
+488c488
+< TString *ts = luaS_newudata(L, size, NULL);
+---
+> TString *ts = luaS_newudata(L, (size==0) ? 1 : size, NULL);
+diff -r lua-4.0/src/ldo.c lua/src/ldo.c
+2c2
+< ** $Id: ldo.c,v 1.109 2000/10/30 12:38:50 roberto Exp $
+---
+> ** $Id: ldo.c,v 1.109a 2000/10/30 12:38:50 roberto Exp $
+247c247,249
+< luaC_checkGC(L);
+---
+> /* before parsing, give a (good) chance to GC */
+> if (L->nblocks/8 >= L->GCthreshold/10)
+> luaC_collectgarbage(L);
+277,278c279,280
+< filename = lua_tostring(L, -1); /* filename = '@'..filename */
+< lua_pop(L, 1); /* OK: there is no GC during parser */
+---
+> c = lua_gettop(L);
+> filename = lua_tostring(L, c); /* filename = '@'..filename */
+280a283
+> lua_remove(L, c); /* remove `filename' from the stack */
+diff -r lua-4.0/src/lgc.c lua/src/lgc.c
+2c2
+< ** $Id: lgc.c,v 1.72 2000/10/26 12:47:05 roberto Exp $
+---
+> ** $Id: lgc.c,v 1.72+ 2000/10/26 12:47:05 roberto Exp $
+339c339
+< static void luaC_collectgarbage (lua_State *L) {
+---
+> void luaC_collectgarbage (lua_State *L) {
+diff -r lua-4.0/src/lgc.h lua/src/lgc.h
+2c2
+< ** $Id: lgc.h,v 1.8 2000/10/02 14:47:43 roberto Exp $
+---
+> ** $Id: lgc.h,v 1.9 2001/02/02 16:23:20 roberto Exp $
+14a15
+> void luaC_collectgarbage (lua_State *L);
+diff -r lua-4.0/src/lib/lbaselib.c lua/src/lib/lbaselib.c
+2c2
+< ** $Id: lbaselib.c,v 1.17 2000/11/06 13:45:18 roberto Exp $
+---
+> ** $Id: lbaselib.c,v 1.17a 2000/11/06 13:45:18 roberto Exp $
+168c168
+< lua_rawget(L, -2);
+---
+> lua_rawget(L, 1);
+176c176
+< lua_rawset(L, -3);
+---
+> lua_rawset(L, 1);
+260c260
+< if (*s == '\27') /* binary files start with ESC... */
+---
+> if (*s == '\33') /* binary files start with ESC... */
+diff -r lua-4.0/src/lparser.c lua/src/lparser.c
+2c2
+< ** $Id: lparser.c,v 1.116 2000/10/27 11:39:52 roberto Exp $
+---
+> ** $Id: lparser.c,v 1.117 2000/11/29 11:57:42 roberto Exp $
+1000c1000
+< if (!block_follow(ls->t.token))
+---
+> if (!block_follow(ls->t.token) && ls->t.token != ';')
+diff -r lua-4.0/src/lstring.c lua/src/lstring.c
+2c2
+< ** $Id: lstring.c,v 1.45 2000/10/30 17:49:19 roberto Exp $
+---
+> ** $Id: lstring.c,v 1.45a 2000/10/30 17:49:19 roberto Exp $
+122c122
+< ts->u.d.value = (udata == NULL) ? uts+1 : udata;
+---
+> ts->u.d.value = (s > 0) ? uts+1 : udata;
+diff -r lua-4.0/src/lvm.c lua/src/lvm.c
+2c2
+< ** $Id: lvm.c,v 1.146 2000/10/26 12:47:05 roberto Exp $
+---
+> ** $Id: lvm.c,v 1.146a 2000/10/26 12:47:05 roberto Exp $
+82c82
+< luaD_lineHook(L, base-2, newline, linehook);
+---
+> luaD_lineHook(L, base-1, newline, linehook);
diff --git a/UPDATE b/UPDATE
new file mode 100644
index 00000000..1be0709d
--- /dev/null
+++ b/UPDATE
@@ -0,0 +1,19 @@
+This is an update of Lua 4.0 that includes the following bug fixes and
+improvements:
+
+lua/src/lapi.c
+lua/src/lstring.c
+ Fixed a bug in lua_pushuserdata(L, NULL)
+lua/src/ldo.c
+lua/src/lgc.c
+lua/src/lgc.h
+ Give a good chance for GC before parsing
+lua/src/lparser.c
+ Fixed a bug (did not accept `;' after a `return')
+lua/src/lvm.c
+ Fixed a bug (linehook off by 1)
+lua/src/lib/lbaselib.c
+ Fixed a bug in rawget and rawset (seg. fault if given extra arguments)
+ Fixed a bug in dostring (identification of precompiled chunks)
+
+To use simply open this tarball over the original Lua 4.0 source.
diff --git a/include/lua.h b/include/lua.h
index 1b271534..660ecd80 100644
--- a/include/lua.h
+++ b/include/lua.h
@@ -1,5 +1,5 @@
/*
-** $Id: lua.h,v 1.79 2000/10/31 12:44:07 roberto Exp $
+** $Id: lua.h,v 1.79a 2000/10/31 12:44:07 roberto Exp $
** Lua - An Extensible Extension Language
** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
** e-mail: lua@tecgraf.puc-rio.br
@@ -22,7 +22,7 @@
#endif
-#define LUA_VERSION "Lua 4.0"
+#define LUA_VERSION "Lua 4.0.1"
#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio"
#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
diff --git a/src/lapi.c b/src/lapi.c
index e8002342..54c2cba4 100644
--- a/src/lapi.c
+++ b/src/lapi.c
@@ -1,5 +1,5 @@
/*
-** $Id: lapi.c,v 1.110 2000/10/30 12:50:09 roberto Exp $
+** $Id: lapi.c,v 1.110a 2000/10/30 12:50:09 roberto Exp $
** Lua API
** See Copyright Notice in lua.h
*/
@@ -485,7 +485,7 @@ LUA_API void lua_concat (lua_State *L, int n) {
LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
- TString *ts = luaS_newudata(L, size, NULL);
+ TString *ts = luaS_newudata(L, (size==0) ? 1 : size, NULL);
tsvalue(L->top) = ts;
ttype(L->top) = LUA_TUSERDATA;
api_incr_top(L);
diff --git a/src/ldo.c b/src/ldo.c
index fbb892a5..8a779bbe 100644
--- a/src/ldo.c
+++ b/src/ldo.c
@@ -1,5 +1,5 @@
/*
-** $Id: ldo.c,v 1.109 2000/10/30 12:38:50 roberto Exp $
+** $Id: ldo.c,v 1.109a 2000/10/30 12:38:50 roberto Exp $
** Stack and Call structure of Lua
** See Copyright Notice in lua.h
*/
@@ -244,7 +244,9 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) {
unsigned long old_blocks;
int status;
p.z = z; p.bin = bin;
- luaC_checkGC(L);
+ /* before parsing, give a (good) chance to GC */
+ if (L->nblocks/8 >= L->GCthreshold/10)
+ luaC_collectgarbage(L);
old_blocks = L->nblocks;
status = luaD_runprotected(L, f_parser, &p);
if (status == 0) {
@@ -274,10 +276,11 @@ static int parse_file (lua_State *L, const char *filename) {
lua_pushstring(L, "@");
lua_pushstring(L, (filename == NULL) ? "(stdin)" : filename);
lua_concat(L, 2);
- filename = lua_tostring(L, -1); /* filename = '@'..filename */
- lua_pop(L, 1); /* OK: there is no GC during parser */
+ c = lua_gettop(L);
+ filename = lua_tostring(L, c); /* filename = '@'..filename */
luaZ_Fopen(&z, f, filename);
status = protectedparser(L, &z, bin);
+ lua_remove(L, c); /* remove `filename' from the stack */
if (f != stdin)
fclose(f);
return status;
diff --git a/src/lgc.c b/src/lgc.c
index 6b916a8b..f1eee9ab 100644
--- a/src/lgc.c
+++ b/src/lgc.c
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.c,v 1.72 2000/10/26 12:47:05 roberto Exp $
+** $Id: lgc.c,v 1.72+ 2000/10/26 12:47:05 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -336,7 +336,7 @@ void luaC_collect (lua_State *L, int all) {
}
-static void luaC_collectgarbage (lua_State *L) {
+void luaC_collectgarbage (lua_State *L) {
markall(L);
invalidaterefs(L); /* check unlocked references */
luaC_collect(L, 0);
diff --git a/src/lgc.h b/src/lgc.h
index 87a14d16..09b66a2b 100644
--- a/src/lgc.h
+++ b/src/lgc.h
@@ -1,5 +1,5 @@
/*
-** $Id: lgc.h,v 1.8 2000/10/02 14:47:43 roberto Exp $
+** $Id: lgc.h,v 1.9 2001/02/02 16:23:20 roberto Exp $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -12,6 +12,7 @@
void luaC_collect (lua_State *L, int all);
+void luaC_collectgarbage (lua_State *L);
void luaC_checkGC (lua_State *L);
diff --git a/src/lib/lbaselib.c b/src/lib/lbaselib.c
index 1ff475f9..29bad6a8 100644
--- a/src/lib/lbaselib.c
+++ b/src/lib/lbaselib.c
@@ -1,5 +1,5 @@
/*
-** $Id: lbaselib.c,v 1.17 2000/11/06 13:45:18 roberto Exp $
+** $Id: lbaselib.c,v 1.17a 2000/11/06 13:45:18 roberto Exp $
** Basic library
** See Copyright Notice in lua.h
*/
@@ -165,7 +165,7 @@ static int luaB_globals (lua_State *L) {
static int luaB_rawget (lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
luaL_checkany(L, 2);
- lua_rawget(L, -2);
+ lua_rawget(L, 1);
return 1;
}
@@ -173,7 +173,7 @@ static int luaB_rawset (lua_State *L) {
luaL_checktype(L, 1, LUA_TTABLE);
luaL_checkany(L, 2);
luaL_checkany(L, 3);
- lua_rawset(L, -3);
+ lua_rawset(L, 1);
return 1;
}
@@ -257,7 +257,7 @@ static int luaB_dostring (lua_State *L) {
int oldtop = lua_gettop(L);
size_t l;
const char *s = luaL_check_lstr(L, 1, &l);
- if (*s == '\27') /* binary files start with ESC... */
+ if (*s == '\33') /* binary files start with ESC... */
lua_error(L, "`dostring' cannot run pre-compiled code");
return passresults(L, lua_dobuffer(L, s, l, luaL_opt_string(L, 2, s)), oldtop);
}
diff --git a/src/lparser.c b/src/lparser.c
index b792c956..67161c86 100644
--- a/src/lparser.c
+++ b/src/lparser.c
@@ -1,5 +1,5 @@
/*
-** $Id: lparser.c,v 1.116 2000/10/27 11:39:52 roberto Exp $
+** $Id: lparser.c,v 1.117 2000/11/29 11:57:42 roberto Exp $
** LL(1) Parser and code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -997,7 +997,7 @@ static void retstat (LexState *ls) {
/* stat -> RETURN explist */
FuncState *fs = ls->fs;
next(ls); /* skip RETURN */
- if (!block_follow(ls->t.token))
+ if (!block_follow(ls->t.token) && ls->t.token != ';')
explist1(ls); /* optional return values */
luaK_code1(fs, OP_RETURN, ls->fs->nactloc);
fs->stacklevel = fs->nactloc; /* removes all temp values */
diff --git a/src/lstring.c b/src/lstring.c
index e4c7e26c..a415a7d3 100644
--- a/src/lstring.c
+++ b/src/lstring.c
@@ -1,5 +1,5 @@
/*
-** $Id: lstring.c,v 1.45 2000/10/30 17:49:19 roberto Exp $
+** $Id: lstring.c,v 1.45a 2000/10/30 17:49:19 roberto Exp $
** String table (keeps all strings handled by Lua)
** See Copyright Notice in lua.h
*/
@@ -119,7 +119,7 @@ TString *luaS_newudata (lua_State *L, size_t s, void *udata) {
ts->nexthash = NULL;
ts->len = s;
ts->u.d.tag = 0;
- ts->u.d.value = (udata == NULL) ? uts+1 : udata;
+ ts->u.d.value = (s > 0) ? uts+1 : udata;
L->nblocks += sizestring(s);
/* insert it on table */
newentry(L, &L->udt, ts, IntPoint(ts->u.d.value) & (L->udt.size-1));
diff --git a/src/lvm.c b/src/lvm.c
index 63e42efb..2a00b6a5 100644
--- a/src/lvm.c
+++ b/src/lvm.c
@@ -1,5 +1,5 @@
/*
-** $Id: lvm.c,v 1.146 2000/10/26 12:47:05 roberto Exp $
+** $Id: lvm.c,v 1.146a 2000/10/26 12:47:05 roberto Exp $
** Lua virtual machine
** See Copyright Notice in lua.h
*/
@@ -79,7 +79,7 @@ static void traceexec (lua_State *L, StkId base, StkId top, lua_Hook linehook) {
if (newline != ci->line || pc <= ci->lastpc) {
ci->line = newline;
L->top = top;
- luaD_lineHook(L, base-2, newline, linehook);
+ luaD_lineHook(L, base-1, newline, linehook);
}
ci->lastpc = pc;
}