History

Lua 4.0.1

Lua Team committed 24 years ago

Commit c2bb7181 parent e22497f11 files · +141 −21Browse files

Unified · Split

11 files
  1. DIFFS +97 −0
  2. UPDATE +19 −0
  3. include/lua.h +2 −2
  4. src/lapi.c +2 −2
  5. src/ldo.c +7 −4
  6. src/lgc.c +2 −2
  7. src/lgc.h +2 −1
  8. src/lib/lbaselib.c +4 −4
  9. src/lparser.c +2 −2
  10. src/lstring.c +2 −2
  11. src/lvm.c +2 −2
DIFFS+97−0
@@ -0,0 +1,97 @@
1diff -r lua-4.0/include/lua.h lua/include/lua.h
22c2
3< ** $Id: lua.h,v 1.79 2000/10/31 12:44:07 roberto Exp $
4---
5> ** $Id: lua.h,v 1.79a 2000/10/31 12:44:07 roberto Exp $
625c25
7< #define LUA_VERSION "Lua 4.0"
8---
9> #define LUA_VERSION "Lua 4.0.1"
10diff -r lua-4.0/src/lapi.c lua/src/lapi.c
112c2
12< ** $Id: lapi.c,v 1.110 2000/10/30 12:50:09 roberto Exp $
13---
14> ** $Id: lapi.c,v 1.110a 2000/10/30 12:50:09 roberto Exp $
15488c488
16< TString *ts = luaS_newudata(L, size, NULL);
17---
18> TString *ts = luaS_newudata(L, (size==0) ? 1 : size, NULL);
19diff -r lua-4.0/src/ldo.c lua/src/ldo.c
202c2
21< ** $Id: ldo.c,v 1.109 2000/10/30 12:38:50 roberto Exp $
22---
23> ** $Id: ldo.c,v 1.109a 2000/10/30 12:38:50 roberto Exp $
24247c247,249
25< luaC_checkGC(L);
26---
27> /* before parsing, give a (good) chance to GC */
28> if (L->nblocks/8 >= L->GCthreshold/10)
29> luaC_collectgarbage(L);
30277,278c279,280
31< filename = lua_tostring(L, -1); /* filename = '@'..filename */
32< lua_pop(L, 1); /* OK: there is no GC during parser */
33---
34> c = lua_gettop(L);
35> filename = lua_tostring(L, c); /* filename = '@'..filename */
36280a283
37> lua_remove(L, c); /* remove `filename' from the stack */
38diff -r lua-4.0/src/lgc.c lua/src/lgc.c
392c2
40< ** $Id: lgc.c,v 1.72 2000/10/26 12:47:05 roberto Exp $
41---
42> ** $Id: lgc.c,v 1.72+ 2000/10/26 12:47:05 roberto Exp $
43339c339
44< static void luaC_collectgarbage (lua_State *L) {
45---
46> void luaC_collectgarbage (lua_State *L) {
47diff -r lua-4.0/src/lgc.h lua/src/lgc.h
482c2
49< ** $Id: lgc.h,v 1.8 2000/10/02 14:47:43 roberto Exp $
50---
51> ** $Id: lgc.h,v 1.9 2001/02/02 16:23:20 roberto Exp $
5214a15
53> void luaC_collectgarbage (lua_State *L);
54diff -r lua-4.0/src/lib/lbaselib.c lua/src/lib/lbaselib.c
552c2
56< ** $Id: lbaselib.c,v 1.17 2000/11/06 13:45:18 roberto Exp $
57---
58> ** $Id: lbaselib.c,v 1.17a 2000/11/06 13:45:18 roberto Exp $
59168c168
60< lua_rawget(L, -2);
61---
62> lua_rawget(L, 1);
63176c176
64< lua_rawset(L, -3);
65---
66> lua_rawset(L, 1);
67260c260
68< if (*s == '\27') /* binary files start with ESC... */
69---
70> if (*s == '\33') /* binary files start with ESC... */
71diff -r lua-4.0/src/lparser.c lua/src/lparser.c
722c2
73< ** $Id: lparser.c,v 1.116 2000/10/27 11:39:52 roberto Exp $
74---
75> ** $Id: lparser.c,v 1.117 2000/11/29 11:57:42 roberto Exp $
761000c1000
77< if (!block_follow(ls->t.token))
78---
79> if (!block_follow(ls->t.token) && ls->t.token != ';')
80diff -r lua-4.0/src/lstring.c lua/src/lstring.c
812c2
82< ** $Id: lstring.c,v 1.45 2000/10/30 17:49:19 roberto Exp $
83---
84> ** $Id: lstring.c,v 1.45a 2000/10/30 17:49:19 roberto Exp $
85122c122
86< ts->u.d.value = (udata == NULL) ? uts+1 : udata;
87---
88> ts->u.d.value = (s > 0) ? uts+1 : udata;
89diff -r lua-4.0/src/lvm.c lua/src/lvm.c
902c2
91< ** $Id: lvm.c,v 1.146 2000/10/26 12:47:05 roberto Exp $
92---
93> ** $Id: lvm.c,v 1.146a 2000/10/26 12:47:05 roberto Exp $
9482c82
95< luaD_lineHook(L, base-2, newline, linehook);
96---
97> luaD_lineHook(L, base-1, newline, linehook);
UPDATE+19−0
@@ -0,0 +1,19 @@
1This is an update of Lua 4.0 that includes the following bug fixes and
2improvements:
3
4lua/src/lapi.c
5lua/src/lstring.c
6 Fixed a bug in lua_pushuserdata(L, NULL)
7lua/src/ldo.c
8lua/src/lgc.c
9lua/src/lgc.h
10 Give a good chance for GC before parsing
11lua/src/lparser.c
12 Fixed a bug (did not accept `;' after a `return')
13lua/src/lvm.c
14 Fixed a bug (linehook off by 1)
15lua/src/lib/lbaselib.c
16 Fixed a bug in rawget and rawset (seg. fault if given extra arguments)
17 Fixed a bug in dostring (identification of precompiled chunks)
18
19To use simply open this tarball over the original Lua 4.0 source.
include/lua.h+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lua.h,v 1.79 2000/10/31 12:44:07 roberto Exp $2** $Id: lua.h,v 1.79a 2000/10/31 12:44:07 roberto Exp $
3** Lua - An Extensible Extension Language3** Lua - An Extensible Extension Language
4** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil4** TeCGraf: Grupo de Tecnologia em Computacao Grafica, PUC-Rio, Brazil
5** e-mail: lua@tecgraf.puc-rio.br5** e-mail: lua@tecgraf.puc-rio.br
@@ -22,7 +22,7 @@ · 16 unmodified lines
22#endif22#endif
23 23
24 24
25#define LUA_VERSION "Lua 4.0"25#define LUA_VERSION "Lua 4.0.1"
26#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio"26#define LUA_COPYRIGHT "Copyright (C) 1994-2000 TeCGraf, PUC-Rio"
27#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"27#define LUA_AUTHORS "W. Celes, R. Ierusalimschy & L. H. de Figueiredo"
28 28
src/lapi.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lapi.c,v 1.110 2000/10/30 12:50:09 roberto Exp $2** $Id: lapi.c,v 1.110a 2000/10/30 12:50:09 roberto Exp $
3** Lua API3** Lua API
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -485,7 +485,7 @@ LUA_API void lua_concat (lua_State *L, int n) { · 479 unmodified lines
485 485
486 486
487LUA_API void *lua_newuserdata (lua_State *L, size_t size) {487LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
488 TString *ts = luaS_newudata(L, size, NULL);488 TString *ts = luaS_newudata(L, (size==0) ? 1 : size, NULL);
489 tsvalue(L->top) = ts;489 tsvalue(L->top) = ts;
490 ttype(L->top) = LUA_TUSERDATA;490 ttype(L->top) = LUA_TUSERDATA;
491 api_incr_top(L);491 api_incr_top(L);
src/ldo.c+7−4
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: ldo.c,v 1.109 2000/10/30 12:38:50 roberto Exp $2** $Id: ldo.c,v 1.109a 2000/10/30 12:38:50 roberto Exp $
3** Stack and Call structure of Lua3** Stack and Call structure of Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -244,7 +244,9 @@ static int protectedparser (lua_State *L, ZIO *z, int bin) { · 238 unmodified lines
244 unsigned long old_blocks;244 unsigned long old_blocks;
245 int status;245 int status;
246 p.z = z; p.bin = bin;246 p.z = z; p.bin = bin;
247 luaC_checkGC(L);247 /* before parsing, give a (good) chance to GC */
248 if (L->nblocks/8 >= L->GCthreshold/10)
249 luaC_collectgarbage(L);
248 old_blocks = L->nblocks;250 old_blocks = L->nblocks;
249 status = luaD_runprotected(L, f_parser, &p);251 status = luaD_runprotected(L, f_parser, &p);
250 if (status == 0) {252 if (status == 0) {
@@ -274,10 +276,11 @@ static int parse_file (lua_State *L, const char *filename) { · 23 unmodified lines
274 lua_pushstring(L, "@");276 lua_pushstring(L, "@");
275 lua_pushstring(L, (filename == NULL) ? "(stdin)" : filename);277 lua_pushstring(L, (filename == NULL) ? "(stdin)" : filename);
276 lua_concat(L, 2);278 lua_concat(L, 2);
277 filename = lua_tostring(L, -1); /* filename = '@'..filename */279 c = lua_gettop(L);
278 lua_pop(L, 1); /* OK: there is no GC during parser */280 filename = lua_tostring(L, c); /* filename = '@'..filename */
279 luaZ_Fopen(&z, f, filename);281 luaZ_Fopen(&z, f, filename);
280 status = protectedparser(L, &z, bin);282 status = protectedparser(L, &z, bin);
283 lua_remove(L, c); /* remove `filename' from the stack */
281 if (f != stdin)284 if (f != stdin)
282 fclose(f);285 fclose(f);
283 return status;286 return status;
src/lgc.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lgc.c,v 1.72 2000/10/26 12:47:05 roberto Exp $2** $Id: lgc.c,v 1.72+ 2000/10/26 12:47:05 roberto Exp $
3** Garbage Collector3** Garbage Collector
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -336,7 +336,7 @@ void luaC_collect (lua_State *L, int all) { · 330 unmodified lines
336}336}
337 337
338 338
339static void luaC_collectgarbage (lua_State *L) {339void luaC_collectgarbage (lua_State *L) {
340 markall(L);340 markall(L);
341 invalidaterefs(L); /* check unlocked references */341 invalidaterefs(L); /* check unlocked references */
342 luaC_collect(L, 0);342 luaC_collect(L, 0);
src/lgc.h+2−1
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lgc.h,v 1.8 2000/10/02 14:47:43 roberto Exp $2** $Id: lgc.h,v 1.9 2001/02/02 16:23:20 roberto Exp $
3** Garbage Collector3** Garbage Collector
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -12,6 +12,7 @@ · 6 unmodified lines
12 12
13 13
14void luaC_collect (lua_State *L, int all);14void luaC_collect (lua_State *L, int all);
15void luaC_collectgarbage (lua_State *L);
15void luaC_checkGC (lua_State *L);16void luaC_checkGC (lua_State *L);
16 17
17 18
src/lib/lbaselib.c+4−4
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lbaselib.c,v 1.17 2000/11/06 13:45:18 roberto Exp $2** $Id: lbaselib.c,v 1.17a 2000/11/06 13:45:18 roberto Exp $
3** Basic library3** Basic library
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -165,7 +165,7 @@ static int luaB_globals (lua_State *L) { · 159 unmodified lines
165static int luaB_rawget (lua_State *L) {165static int luaB_rawget (lua_State *L) {
166 luaL_checktype(L, 1, LUA_TTABLE);166 luaL_checktype(L, 1, LUA_TTABLE);
167 luaL_checkany(L, 2);167 luaL_checkany(L, 2);
168 lua_rawget(L, -2);168 lua_rawget(L, 1);
169 return 1;169 return 1;
170}170}
171 171
@@ -173,7 +173,7 @@ static int luaB_rawset (lua_State *L) { · 1 unmodified line
173 luaL_checktype(L, 1, LUA_TTABLE);173 luaL_checktype(L, 1, LUA_TTABLE);
174 luaL_checkany(L, 2);174 luaL_checkany(L, 2);
175 luaL_checkany(L, 3);175 luaL_checkany(L, 3);
176 lua_rawset(L, -3);176 lua_rawset(L, 1);
177 return 1;177 return 1;
178}178}
179 179
@@ -257,7 +257,7 @@ static int luaB_dostring (lua_State *L) { · 77 unmodified lines
257 int oldtop = lua_gettop(L);257 int oldtop = lua_gettop(L);
258 size_t l;258 size_t l;
259 const char *s = luaL_check_lstr(L, 1, &l);259 const char *s = luaL_check_lstr(L, 1, &l);
260 if (*s == '\27') /* binary files start with ESC... */260 if (*s == '\33') /* binary files start with ESC... */
261 lua_error(L, "`dostring' cannot run pre-compiled code");261 lua_error(L, "`dostring' cannot run pre-compiled code");
262 return passresults(L, lua_dobuffer(L, s, l, luaL_opt_string(L, 2, s)), oldtop);262 return passresults(L, lua_dobuffer(L, s, l, luaL_opt_string(L, 2, s)), oldtop);
263}263}
src/lparser.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lparser.c,v 1.116 2000/10/27 11:39:52 roberto Exp $2** $Id: lparser.c,v 1.117 2000/11/29 11:57:42 roberto Exp $
3** LL(1) Parser and code generator for Lua3** LL(1) Parser and code generator for Lua
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -997,7 +997,7 @@ static void retstat (LexState *ls) { · 991 unmodified lines
997 /* stat -> RETURN explist */997 /* stat -> RETURN explist */
998 FuncState *fs = ls->fs;998 FuncState *fs = ls->fs;
999 next(ls); /* skip RETURN */999 next(ls); /* skip RETURN */
1000 if (!block_follow(ls->t.token))1000 if (!block_follow(ls->t.token) && ls->t.token != ';')
1001 explist1(ls); /* optional return values */1001 explist1(ls); /* optional return values */
1002 luaK_code1(fs, OP_RETURN, ls->fs->nactloc);1002 luaK_code1(fs, OP_RETURN, ls->fs->nactloc);
1003 fs->stacklevel = fs->nactloc; /* removes all temp values */1003 fs->stacklevel = fs->nactloc; /* removes all temp values */
src/lstring.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lstring.c,v 1.45 2000/10/30 17:49:19 roberto Exp $2** $Id: lstring.c,v 1.45a 2000/10/30 17:49:19 roberto Exp $
3** String table (keeps all strings handled by Lua)3** String table (keeps all strings handled by Lua)
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -119,7 +119,7 @@ TString *luaS_newudata (lua_State *L, size_t s, void *udata) { · 113 unmodified lines
119 ts->nexthash = NULL;119 ts->nexthash = NULL;
120 ts->len = s;120 ts->len = s;
121 ts->u.d.tag = 0;121 ts->u.d.tag = 0;
122 ts->u.d.value = (udata == NULL) ? uts+1 : udata;122 ts->u.d.value = (s > 0) ? uts+1 : udata;
123 L->nblocks += sizestring(s);123 L->nblocks += sizestring(s);
124 /* insert it on table */124 /* insert it on table */
125 newentry(L, &L->udt, ts, IntPoint(ts->u.d.value) & (L->udt.size-1));125 newentry(L, &L->udt, ts, IntPoint(ts->u.d.value) & (L->udt.size-1));
src/lvm.c+2−2
@@ -1,5 +1,5 @@
1/*1/*
2** $Id: lvm.c,v 1.146 2000/10/26 12:47:05 roberto Exp $2** $Id: lvm.c,v 1.146a 2000/10/26 12:47:05 roberto Exp $
3** Lua virtual machine3** Lua virtual machine
4** See Copyright Notice in lua.h4** See Copyright Notice in lua.h
5*/5*/
@@ -79,7 +79,7 @@ static void traceexec (lua_State *L, StkId base, StkId top, lua_Hook linehook) { · 73 unmodified lines
79 if (newline != ci->line || pc <= ci->lastpc) {79 if (newline != ci->line || pc <= ci->lastpc) {
80 ci->line = newline;80 ci->line = newline;
81 L->top = top;81 L->top = top;
82 luaD_lineHook(L, base-2, newline, linehook);82 luaD_lineHook(L, base-1, newline, linehook);
83 }83 }
84 ci->lastpc = pc;84 ci->lastpc = pc;
85}85}