Aegisub/contrib/lua50/DIFFS

295 lines
9.3 KiB
Plaintext

diff -r lua-5.0.2/COPYRIGHT lua-5.0.3/COPYRIGHT
12c12
< Copyright (C) 2003-2004 Tecgraf, PUC-Rio.
---
> Copyright (C) 2003-2006 Tecgraf, PUC-Rio.
diff -r lua-5.0.2/include/lua.h lua-5.0.3/include/lua.h
2c2
< ** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $
---
> ** $Id: lua.h,v 1.175c 2003/03/18 12:31:39 roberto Exp $
17,18c17,18
< #define LUA_VERSION "Lua 5.0.2"
< #define LUA_COPYRIGHT "Copyright (C) 1994-2004 Tecgraf, PUC-Rio"
---
> #define LUA_VERSION "Lua 5.0.3"
> #define LUA_COPYRIGHT "Copyright (C) 1994-2006 Tecgraf, PUC-Rio"
368c368
< * Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved.
---
> * Copyright (C) 1994-2006 Tecgraf, PUC-Rio. All rights reserved.
diff -r lua-5.0.2/src/lapi.c lua-5.0.3/src/lapi.c
2c2
< ** $Id: lapi.c,v 1.235 2003/04/07 14:36:08 roberto Exp $
---
> ** $Id: lapi.c,v 1.235a 2003/04/07 14:36:08 roberto Exp $
882c882
< if (n > f->c.nupvalues) return NULL;
---
> if (!(1 <= n && n <= f->c.nupvalues)) return NULL;
888c888
< if (n > p->sizeupvalues) return NULL;
---
> if (!(1 <= n && n <= p->sizeupvalues)) return NULL;
diff -r lua-5.0.2/src/lcode.c lua-5.0.3/src/lcode.c
2c2
< ** $Id: lcode.c,v 1.117 2003/04/03 13:35:34 roberto Exp $
---
> ** $Id: lcode.c,v 1.117a 2003/04/03 13:35:34 roberto Exp $
105c105,108
< if (GET_OPCODE(i) != OP_TEST || GETARG_C(i) != cond) return 1;
---
> if (GET_OPCODE(i) != OP_TEST ||
> GETARG_A(i) != NO_REG ||
> GETARG_C(i) != cond)
> return 1;
117,118c120,130
< static void luaK_patchlistaux (FuncState *fs, int list,
< int ttarget, int treg, int ftarget, int freg, int dtarget) {
---
> static void removevalues (FuncState *fs, int list) {
> for (; list != NO_JUMP; list = luaK_getjump(fs, list)) {
> Instruction *i = getjumpcontrol(fs, list);
> if (GET_OPCODE(*i) == OP_TEST)
> patchtestreg(i, NO_REG);
> }
> }
>
>
> static void luaK_patchlistaux (FuncState *fs, int list, int vtarget, int reg,
> int dtarget) {
122,136c134,136
< if (GET_OPCODE(*i) != OP_TEST) {
< lua_assert(dtarget != NO_JUMP);
< luaK_fixjump(fs, list, dtarget); /* jump to default target */
< }
< else {
< if (GETARG_C(*i)) {
< lua_assert(ttarget != NO_JUMP);
< patchtestreg(i, treg);
< luaK_fixjump(fs, list, ttarget);
< }
< else {
< lua_assert(ftarget != NO_JUMP);
< patchtestreg(i, freg);
< luaK_fixjump(fs, list, ftarget);
< }
---
> if (GET_OPCODE(*i) == OP_TEST && GETARG_A(*i) == NO_REG) {
> patchtestreg(i, reg);
> luaK_fixjump(fs, list, vtarget);
137a138,139
> else
> luaK_fixjump(fs, list, dtarget); /* jump to default target */
144c146
< luaK_patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc, NO_REG, fs->pc);
---
> luaK_patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc);
154c156
< luaK_patchlistaux(fs, list, target, NO_REG, target, NO_REG, target);
---
> luaK_patchlistaux(fs, list, target, NO_REG, target);
357,358c359,360
< luaK_patchlistaux(fs, e->f, p_f, NO_REG, final, reg, p_f);
< luaK_patchlistaux(fs, e->t, final, reg, p_t, NO_REG, p_t);
---
> luaK_patchlistaux(fs, e->f, final, reg, p_f);
> luaK_patchlistaux(fs, e->t, final, reg, p_t);
476c478
< return luaK_condjump(fs, OP_TEST, NO_REG, GETARG_B(ie), !cond);
---
> return luaK_condjump(fs, OP_TEST, GETARG_B(ie), GETARG_B(ie), !cond);
566a569,570
> removevalues(fs, e->f);
> removevalues(fs, e->t);
diff -r lua-5.0.2/src/lfunc.c lua-5.0.3/src/lfunc.c
2c2
< ** $Id: lfunc.c,v 1.67 2003/03/18 12:50:04 roberto Exp $
---
> ** $Id: lfunc.c,v 1.67a 2003/03/18 12:50:04 roberto Exp $
19,26d18
<
<
< #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \
< cast(int, sizeof(TObject)*((n)-1)))
<
< #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \
< cast(int, sizeof(TObject *)*((n)-1)))
<
diff -r lua-5.0.2/src/lfunc.h lua-5.0.3/src/lfunc.h
2c2
< ** $Id: lfunc.h,v 1.21 2003/03/18 12:50:04 roberto Exp $
---
> ** $Id: lfunc.h,v 1.21a 2003/03/18 12:50:04 roberto Exp $
11a12,18
>
>
> #define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \
> cast(int, sizeof(TObject)*((n)-1)))
>
> #define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \
> cast(int, sizeof(TObject *)*((n)-1)))
diff -r lua-5.0.2/src/lgc.c lua-5.0.3/src/lgc.c
2c2
< ** $Id: lgc.c,v 1.171a 2003/04/03 13:35:34 roberto Exp $
---
> ** $Id: lgc.c,v 1.171b 2003/04/03 13:35:34 roberto Exp $
221,224c221,222
< if (!u->marked) {
< markobject(st, &u->value);
< u->marked = 1;
< }
---
> markobject(st, u->v);
> u->marked = 1;
261c259,260
< static void propagatemarks (GCState *st) {
---
> static lu_mem propagatemarks (GCState *st) {
> lu_mem mf = 0;
267a267,268
> mf += sizeof(Table) + sizeof(TObject) * h->sizearray +
> sizeof(Node) * sizenode(h);
273a275,276
> mf += (cl->c.isC) ? sizeCclosure(cl->c.nupvalues) :
> sizeLclosure(cl->l.nupvalues);
279a283,284
> mf += sizeof(lua_State) + sizeof(TObject) * th->stacksize +
> sizeof(CallInfo) * th->size_ci;
285a291
> /* do not need 'mf' for this case (cannot happen inside a udata) */
290a297
> return mf;
371c378
< if (curr->gch.marked > limit) {
---
> if ((curr->gch.marked & ~(KEYWEAK | VALUEWEAK)) > limit) {
473c480
< propagatemarks(&st); /* remark, to propagate `preserveness' */
---
> deadmem += propagatemarks(&st); /* remark, to propagate `preserveness' */
diff -r lua-5.0.2/src/lib/lbaselib.c lua-5.0.3/src/lib/lbaselib.c
2c2
< ** $Id: lbaselib.c,v 1.130b 2003/04/03 13:35:34 roberto Exp $
---
> ** $Id: lbaselib.c,v 1.130c 2003/04/03 13:35:34 roberto Exp $
175a176
> lua_settop(L, 2);
183a185
> lua_settop(L, 3);
diff -r lua-5.0.2/src/lib/liolib.c lua-5.0.3/src/lib/liolib.c
2c2
< ** $Id: liolib.c,v 2.39a 2003/03/19 21:16:12 roberto Exp $
---
> ** $Id: liolib.c,v 2.39b 2003/03/19 21:16:12 roberto Exp $
22a23,28
> typedef struct FileHandle {
> FILE *f;
> int ispipe;
> } FileHandle;
>
>
89,92c95,98
< static FILE **topfile (lua_State *L, int findex) {
< FILE **f = (FILE **)luaL_checkudata(L, findex, FILEHANDLE);
< if (f == NULL) luaL_argerror(L, findex, "bad file");
< return f;
---
> static FileHandle *topfile (lua_State *L, int findex) {
> FileHandle *fh = (FileHandle *)luaL_checkudata(L, findex, FILEHANDLE);
> if (fh == NULL) luaL_argerror(L, findex, "bad file");
> return fh;
97,99c103,105
< FILE **f = (FILE **)luaL_checkudata(L, 1, FILEHANDLE);
< if (f == NULL) lua_pushnil(L);
< else if (*f == NULL)
---
> FileHandle *fh = (FileHandle *)luaL_checkudata(L, 1, FILEHANDLE);
> if (fh == NULL) lua_pushnil(L);
> else if (fh->f == NULL)
107,109c113,117
< static FILE *tofile (lua_State *L, int findex) {
< FILE **f = topfile(L, findex);
< if (*f == NULL)
---
> #define tofile(L,i) (tofileh(L,i)->f)
>
> static FileHandle *tofileh (lua_State *L, int findex) {
> FileHandle *fh = topfile(L, findex);
> if (fh->f == NULL)
111c119
< return *f;
---
> return fh;
115a124,125
> #define newfile(L) (&(newfileh(L)->f))
>
121,123c131,134
< static FILE **newfile (lua_State *L) {
< FILE **pf = (FILE **)lua_newuserdata(L, sizeof(FILE *));
< *pf = NULL; /* file handle is currently `closed' */
---
> static FileHandle *newfileh (lua_State *L) {
> FileHandle *fh = (FileHandle *)lua_newuserdata(L, sizeof(FileHandle));
> fh->f = NULL; /* file handle is currently `closed' */
> fh->ispipe = 0;
126c137
< return pf;
---
> return fh;
148c159,160
< FILE *f = tofile(L, 1);
---
> FileHandle *fh = tofileh(L, 1);
> FILE *f = fh->f;
152,154c164,165
< int ok = (pclose(f) != -1) || (fclose(f) == 0);
< if (ok)
< *(FILE **)lua_touserdata(L, 1) = NULL; /* mark file as closed */
---
> int ok = fh->ispipe ? (pclose(f) != -1) : (fclose(f) == 0);
> fh->f = NULL; /* mark file as closed */
170,171c181,182
< FILE **f = topfile(L, 1);
< if (*f != NULL) /* ignore closed files */
---
> FileHandle *fh = topfile(L, 1);
> if (fh->f != NULL) /* ignore closed files */
179,180c190,191
< FILE **f = topfile(L, 1);
< if (*f == NULL)
---
> FileHandle *fh = topfile(L, 1);
> if (fh->f == NULL)
205,207c216,219
< FILE **pf = newfile(L);
< *pf = popen(filename, mode);
< return (*pf == NULL) ? pushresult(L, 0, filename) : 1;
---
> FileHandle *fh = newfileh(L);
> fh->f = popen(filename, mode);
> fh->ispipe = 1;
> return (fh->f == NULL) ? pushresult(L, 0, filename) : 1;
diff -r lua-5.0.2/src/lvm.c lua-5.0.3/src/lvm.c
2c2
< ** $Id: lvm.c,v 1.284b 2003/04/03 13:35:34 roberto Exp $
---
> ** $Id: lvm.c,v 1.284c 2003/04/03 13:35:34 roberto Exp $
324,325c324
< lu_mem tl = cast(lu_mem, tsvalue(top-1)->tsv.len) +
< cast(lu_mem, tsvalue(top-2)->tsv.len);
---
> size_t tl = tsvalue(top-1)->tsv.len;
328,330c327,331
< while (n < total && tostring(L, top-n-1)) { /* collect total length */
< tl += tsvalue(top-n-1)->tsv.len;
< n++;
---
> /* collect total length */
> for (n = 1; n < total && tostring(L, top-n-1); n++) {
> size_t l = tsvalue(top-n-1)->tsv.len;
> if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
> tl += l;
332d332
< if (tl > MAX_SIZET) luaG_runerror(L, "string size overflow");