Unified · Split
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | |
| 2 | −This is Lua 5.2.2, released on 7 Mar 2013. | |
| 2 | +This is Lua 5.2.2, released on 21 Mar 2013. | |
| 3 | 3 | |
| 4 | 4 | For installation instructions, license details, and |
| 5 | 5 | further information about Lua, see doc/readme.html. |
| @@ -149,8 +149,8 @@ Freely available under the terms of the · 148 unmodified lines | ||
| 149 | 149 | <A HREF="manual.html#pdf-error">error</A><BR> |
| 150 | 150 | <A HREF="manual.html#pdf-getmetatable">getmetatable</A><BR> |
| 151 | 151 | <A HREF="manual.html#pdf-ipairs">ipairs</A><BR> |
| 152 | −<A HREF="manual.html#pdf-loadfile">loadfile</A><BR> | |
| 153 | 152 | <A HREF="manual.html#pdf-load">load</A><BR> |
| 153 | +<A HREF="manual.html#pdf-loadfile">loadfile</A><BR> | |
| 154 | 154 | <A HREF="manual.html#pdf-next">next</A><BR> |
| 155 | 155 | <A HREF="manual.html#pdf-pairs">pairs</A><BR> |
| 156 | 156 | <A HREF="manual.html#pdf-pcall">pcall</A><BR> |
| @@ -400,10 +400,10 @@ Freely available under the terms of the · 243 unmodified lines | ||
| 400 | 400 | <A HREF="manual.html#lua_rawequal">lua_rawequal</A><BR> |
| 401 | 401 | <A HREF="manual.html#lua_rawget">lua_rawget</A><BR> |
| 402 | 402 | <A HREF="manual.html#lua_rawgeti">lua_rawgeti</A><BR> |
| 403 | +<A HREF="manual.html#lua_rawgetp">lua_rawgetp</A><BR> | |
| 403 | 404 | <A HREF="manual.html#lua_rawlen">lua_rawlen</A><BR> |
| 404 | 405 | <A HREF="manual.html#lua_rawset">lua_rawset</A><BR> |
| 405 | 406 | <A HREF="manual.html#lua_rawseti">lua_rawseti</A><BR> |
| 406 | −<A HREF="manual.html#lua_rawgetp">lua_rawgetp</A><BR> | |
| 407 | 407 | <A HREF="manual.html#lua_rawsetp">lua_rawsetp</A><BR> |
| 408 | 408 | <A HREF="manual.html#lua_register">lua_register</A><BR> |
| 409 | 409 | <A HREF="manual.html#lua_remove">lua_remove</A><BR> |
| @@ -462,8 +462,8 @@ Freely available under the terms of the · 52 unmodified lines | ||
| 462 | 462 | <A HREF="manual.html#luaL_buffinitsize">luaL_buffinitsize</A><BR> |
| 463 | 463 | <A HREF="manual.html#luaL_callmeta">luaL_callmeta</A><BR> |
| 464 | 464 | <A HREF="manual.html#luaL_checkany">luaL_checkany</A><BR> |
| 465 | −<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR> | |
| 466 | 465 | <A HREF="manual.html#luaL_checkint">luaL_checkint</A><BR> |
| 466 | +<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR> | |
| 467 | 467 | <A HREF="manual.html#luaL_checklong">luaL_checklong</A><BR> |
| 468 | 468 | <A HREF="manual.html#luaL_checklstring">luaL_checklstring</A><BR> |
| 469 | 469 | <A HREF="manual.html#luaL_checknumber">luaL_checknumber</A><BR> |
| @@ -494,8 +494,8 @@ Freely available under the terms of the · 24 unmodified lines | ||
| 494 | 494 | <A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR> |
| 495 | 495 | <A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR> |
| 496 | 496 | <A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR> |
| 497 | −<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR> | |
| 498 | 497 | <A HREF="manual.html#luaL_optint">luaL_optint</A><BR> |
| 498 | +<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR> | |
| 499 | 499 | <A HREF="manual.html#luaL_optlong">luaL_optlong</A><BR> |
| 500 | 500 | <A HREF="manual.html#luaL_optlstring">luaL_optlstring</A><BR> |
| 501 | 501 | <A HREF="manual.html#luaL_optnumber">luaL_optnumber</A><BR> |
| @@ -523,7 +523,7 @@ Freely available under the terms of the · 21 unmodified lines | ||
| 523 | 523 | <HR> |
| 524 | 524 | <SMALL CLASS="footer"> |
| 525 | 525 | Last update: |
| 526 | −Tue Feb 19 15:14:47 BRT 2013 | |
| 526 | +Tue Mar 12 11:22:18 BRT 2013 | |
| 527 | 527 | </SMALL> |
| 528 | 528 | <!-- |
| 529 | 529 | Last change: revised for Lua 5.2.2 |
| @@ -33,7 +33,7 @@ Freely available under the terms of the · 32 unmodified lines | ||
| 33 | 33 | <!-- ====================================================================== --> |
| 34 | 34 | <p> |
| 35 | 35 | |
| 36 | −<!-- $Id: manual.of,v 1.102 2013/03/07 18:25:28 roberto Exp $ --> | |
| 36 | +<!-- $Id: manual.of,v 1.103 2013/03/14 18:51:56 roberto Exp $ --> | |
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | |
| @@ -8417,7 +8417,7 @@ When <code>pos</code> is an integer between 1 and <code>#list</code>, · 8377 unmodified lines | ||
| 8417 | 8417 | it shifts down the elements |
| 8418 | 8418 | <code>list[pos+1], list[pos+2], ···, list[#list]</code> |
| 8419 | 8419 | and erases element <code>list[#list]</code>; |
| 8420 | −The index <code>pos</code> can also be 0, when <code>#list</code> is 0, | |
| 8420 | +The index <code>pos</code> can also be 0 when <code>#list</code> is 0, | |
| 8421 | 8421 | or <code>#list + 1</code>; |
| 8422 | 8422 | in those cases, the function erases the element <code>list[pos]</code>. |
| 8423 | 8423 | |
| @@ -10497,7 +10497,7 @@ Here is the complete syntax of Lua in extended BNF. · 2073 unmodified lines | ||
| 10497 | 10497 | <HR> |
| 10498 | 10498 | <SMALL CLASS="footer"> |
| 10499 | 10499 | Last update: |
| 10500 | −Thu Mar 7 15:36:34 BRT 2013 | |
| 10500 | +Thu Mar 21 12:58:59 BRT 2013 | |
| 10501 | 10501 | </SMALL> |
| 10502 | 10502 | <!-- |
| 10503 | 10503 | Last change: revised for Lua 5.2.2 |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lapi.c,v 2.170 2012/12/05 19:49:55 roberto Exp $ | |
| 2 | +** $Id: lapi.c,v 2.171 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Lua API |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -1106,7 +1106,7 @@ LUA_API int lua_error (lua_State *L) { · 1100 unmodified lines | ||
| 1106 | 1106 | lua_lock(L); |
| 1107 | 1107 | api_checknelems(L, 1); |
| 1108 | 1108 | luaG_errormsg(L); |
| 1109 | − /* code unreacheable; will unlock when control actually leaves the kernel */ | |
| 1109 | + /* code unreachable; will unlock when control actually leaves the kernel */ | |
| 1110 | 1110 | return 0; /* to avoid warnings */ |
| 1111 | 1111 | } |
| 1112 | 1112 | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lauxlib.c,v 1.247 2012/10/19 15:55:01 roberto Exp $ | |
| 2 | +** $Id: lauxlib.c,v 1.248 2013/03/21 13:54:57 roberto Exp $ | |
| 3 | 3 | ** Auxiliary functions for building Lua libraries |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -599,7 +599,7 @@ static int skipBOM (LoadF *lf) { · 593 unmodified lines | ||
| 599 | 599 | lf->n = 0; |
| 600 | 600 | do { |
| 601 | 601 | c = getc(lf->f); |
| 602 | − if (c == EOF || c != *(unsigned char *)p++) return c; | |
| 602 | + if (c == EOF || c != *(const unsigned char *)p++) return c; | |
| 603 | 603 | lf->buff[lf->n++] = c; /* to be read by the parser */ |
| 604 | 604 | } while (*p != '\0'); |
| 605 | 605 | lf->n = 0; /* prefix matched; discard it */ |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lbitlib.c,v 1.17 2013/02/21 13:44:53 roberto Exp $ | |
| 2 | +** $Id: lbitlib.c,v 1.18 2013/03/19 13:19:12 roberto Exp $ | |
| 3 | 3 | ** Standard library for bitwise operations |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -147,7 +147,9 @@ static int b_rrot (lua_State *L) { · 141 unmodified lines | ||
| 147 | 147 | |
| 148 | 148 | /* |
| 149 | 149 | ** get field and width arguments for field-manipulation functions, |
| 150 | −** checking whether they are valid | |
| 150 | +** checking whether they are valid. | |
| 151 | +** ('luaL_error' called without 'return' to avoid later warnings about | |
| 152 | +** 'width' being used uninitialized.) | |
| 151 | 153 | */ |
| 152 | 154 | static int fieldargs (lua_State *L, int farg, int *width) { |
| 153 | 155 | int f = luaL_checkint(L, farg); |
| @@ -155,7 +157,7 @@ static int fieldargs (lua_State *L, int farg, int *width) { · 1 unmodified line | ||
| 155 | 157 | luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); |
| 156 | 158 | luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); |
| 157 | 159 | if (f + w > LUA_NBITS) |
| 158 | − return luaL_error(L, "trying to access non-existent bits"); | |
| 160 | + luaL_error(L, "trying to access non-existent bits"); | |
| 159 | 161 | *width = w; |
| 160 | 162 | return f; |
| 161 | 163 | } |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lgc.c,v 2.138 2012/10/19 19:00:33 roberto Exp $ | |
| 2 | +** $Id: lgc.c,v 2.140 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Garbage Collector |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -450,7 +450,7 @@ static lu_mem traversetable (global_State *g, Table *h) { · 444 unmodified lines | ||
| 450 | 450 | else /* not weak */ |
| 451 | 451 | traversestrongtable(g, h); |
| 452 | 452 | return sizeof(Table) + sizeof(TValue) * h->sizearray + |
| 453 | − sizeof(Node) * sizenode(h); | |
| 453 | + sizeof(Node) * cast(size_t, sizenode(h)); | |
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | |
| @@ -924,7 +924,7 @@ static void setpause (global_State *g, l_mem estimate) { · 467 unmodified lines | ||
| 924 | 924 | ** object inside the list (instead of to the header), so that the real |
| 925 | 925 | ** sweep do not need to skip objects created between "now" and the start |
| 926 | 926 | ** of the real sweep. |
| 927 | −** Returns how many objects it sweeped. | |
| 927 | +** Returns how many objects it swept. | |
| 928 | 928 | */ |
| 929 | 929 | static int entersweep (lua_State *L) { |
| 930 | 930 | global_State *g = G(L); |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: liolib.c,v 2.108 2011/11/25 12:50:03 roberto Exp $ | |
| 2 | +** $Id: liolib.c,v 2.111 2013/03/21 13:57:27 roberto Exp $ | |
| 3 | 3 | ** Standard I/O (and system) library |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -29,6 +29,20 @@ · 23 unmodified lines | ||
| 29 | 29 | #include "lualib.h" |
| 30 | 30 | |
| 31 | 31 | |
| 32 | +#if !defined(lua_checkmode) | |
| 33 | + | |
| 34 | +/* | |
| 35 | +** Check whether 'mode' matches '[rwa]%+?b?'. | |
| 36 | +** Change this macro to accept other modes for 'fopen' besides | |
| 37 | +** the standard ones. | |
| 38 | +*/ | |
| 39 | +#define lua_checkmode(mode) \ | |
| 40 | + (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && \ | |
| 41 | + (*mode != '+' || ++mode) && /* skip if char is '+' */ \ | |
| 42 | + (*mode != 'b' || ++mode) && /* skip if char is 'b' */ \ | |
| 43 | + (*mode == '\0')) | |
| 44 | + | |
| 45 | +#endif | |
| 32 | 46 | |
| 33 | 47 | /* |
| 34 | 48 | ** {====================================================== |
| @@ -212,14 +226,8 @@ static int io_open (lua_State *L) { · 177 unmodified lines | ||
| 212 | 226 | const char *filename = luaL_checkstring(L, 1); |
| 213 | 227 | const char *mode = luaL_optstring(L, 2, "r"); |
| 214 | 228 | LStream *p = newfile(L); |
| 215 | − int i = 0; | |
| 216 | − /* check whether 'mode' matches '[rwa]%+?b?' */ | |
| 217 | − if (!(mode[i] != '\0' && strchr("rwa", mode[i++]) != NULL && | |
| 218 | − (mode[i] != '+' || ++i) && /* skip if char is '+' */ | |
| 219 | − (mode[i] != 'b' || ++i) && /* skip if char is 'b' */ | |
| 220 | − (mode[i] == '\0'))) | |
| 221 | − return luaL_error(L, "invalid mode " LUA_QS | |
| 222 | − " (should match " LUA_QL("[rwa]%%+?b?") ")", mode); | |
| 229 | + const char *md = mode; /* to traverse/check mode */ | |
| 230 | + luaL_argcheck(L, lua_checkmode(md), 2, "invalid mode"); | |
| 223 | 231 | p->f = fopen(filename, mode); |
| 224 | 232 | return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; |
| 225 | 233 | } |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: llex.c,v 2.62 2012/12/05 19:57:00 roberto Exp $ | |
| 2 | +** $Id: llex.c,v 2.63 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Lexical Analyzer |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -313,7 +313,7 @@ static int readhexaesc (LexState *ls) { · 307 unmodified lines | ||
| 313 | 313 | int c[3], i; /* keep input for error message */ |
| 314 | 314 | int r = 0; /* result accumulator */ |
| 315 | 315 | c[0] = 'x'; /* for error message */ |
| 316 | − for (i = 1; i < 3; i++) { /* read two hexa digits */ | |
| 316 | + for (i = 1; i < 3; i++) { /* read two hexadecimal digits */ | |
| 317 | 317 | c[i] = next(ls); |
| 318 | 318 | if (!lisxdigit(c[i])) |
| 319 | 319 | escerror(ls, c, i + 1, "hexadecimal digit expected"); |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lua.h,v 1.284 2013/02/19 18:39:04 roberto Exp $ | |
| 2 | +** $Id: lua.h,v 1.285 2013/03/15 13:04:22 roberto Exp $ | |
| 3 | 3 | ** Lua - A Scripting Language |
| 4 | 4 | ** Lua.org, PUC-Rio, Brazil (http://www.lua.org) |
| 5 | 5 | ** See Copyright Notice at the end of this file |
| @@ -119,6 +119,11 @@ typedef LUA_UNSIGNED lua_Unsigned; · 113 unmodified lines | ||
| 119 | 119 | #endif |
| 120 | 120 | |
| 121 | 121 | |
| 122 | +/* | |
| 123 | +** RCS ident string | |
| 124 | +*/ | |
| 125 | +extern const char lua_ident[]; | |
| 126 | + | |
| 122 | 127 | |
| 123 | 128 | /* |
| 124 | 129 | ** state manipulation |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: luaconf.h,v 1.175 2013/01/29 16:00:40 roberto Exp $ | |
| 2 | +** $Id: luaconf.h,v 1.176 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Configuration file for Lua |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -44,7 +44,7 @@ · 38 unmodified lines | ||
| 44 | 44 | #define LUA_USE_POSIX |
| 45 | 45 | #define LUA_USE_DLOPEN /* needs an extra library: -ldl */ |
| 46 | 46 | #define LUA_USE_READLINE /* needs some extra libraries */ |
| 47 | −#define LUA_USE_STRTODHEX /* assume 'strtod' handles hexa formats */ | |
| 47 | +#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ | |
| 48 | 48 | #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ |
| 49 | 49 | #define LUA_USE_LONGLONG /* assume support for long long */ |
| 50 | 50 | #endif |
| @@ -53,7 +53,7 @@ · 2 unmodified lines | ||
| 53 | 53 | #define LUA_USE_POSIX |
| 54 | 54 | #define LUA_USE_DLOPEN /* does not need -ldl */ |
| 55 | 55 | #define LUA_USE_READLINE /* needs an extra library: -lreadline */ |
| 56 | −#define LUA_USE_STRTODHEX /* assume 'strtod' handles hexa formats */ | |
| 56 | +#define LUA_USE_STRTODHEX /* assume 'strtod' handles hex formats */ | |
| 57 | 57 | #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */ |
| 58 | 58 | #define LUA_USE_LONGLONG /* assume support for long long */ |
| 59 | 59 | #endif |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: lvm.c,v 2.154 2012/08/16 17:34:28 roberto Exp $ | |
| 2 | +** $Id: lvm.c,v 2.155 2013/03/16 21:10:18 roberto Exp $ | |
| 3 | 3 | ** Lua virtual machine |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -83,7 +83,7 @@ static void traceexec (lua_State *L) { · 77 unmodified lines | ||
| 83 | 83 | if (counthook) |
| 84 | 84 | L->hookcount = 1; /* undo decrement to zero */ |
| 85 | 85 | ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ |
| 86 | − ci->callstatus |= CIST_HOOKYIELD; /* mark that it yieled */ | |
| 86 | + ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ | |
| 87 | 87 | ci->func = L->top - 1; /* protect stack below results */ |
| 88 | 88 | luaD_throw(L, LUA_YIELD); |
| 89 | 89 | } |