History

Lua 5.2.2

Lua Team committed 13 years ago

Commit 2e785bd1 parent 46b413e12 files · +51 −36Browse files

Unified · Split

12 files
  1. README +1 −1
  2. doc/contents.html +5 −5
  3. doc/manual.html +3 −3
  4. src/lapi.c +2 −2
  5. src/lauxlib.c +2 −2
  6. src/lbitlib.c +5 −3
  7. src/lgc.c +3 −3
  8. src/liolib.c +17 −9
  9. src/llex.c +2 −2
  10. src/lua.h +6 −1
  11. src/luaconf.h +3 −3
  12. src/lvm.c +2 −2
README+1−1
@@ -1,5 +1,5 @@
11
2−This is Lua 5.2.2, released on 7 Mar 2013.
2+This is Lua 5.2.2, released on 21 Mar 2013.
33
44 For installation instructions, license details, and
55 further information about Lua, see doc/readme.html.
doc/contents.html+5−5
@@ -149,8 +149,8 @@ Freely available under the terms of the · 148 unmodified lines
149149 <A HREF="manual.html#pdf-error">error</A><BR>
150150 <A HREF="manual.html#pdf-getmetatable">getmetatable</A><BR>
151151 <A HREF="manual.html#pdf-ipairs">ipairs</A><BR>
152−<A HREF="manual.html#pdf-loadfile">loadfile</A><BR>
153152 <A HREF="manual.html#pdf-load">load</A><BR>
153+<A HREF="manual.html#pdf-loadfile">loadfile</A><BR>
154154 <A HREF="manual.html#pdf-next">next</A><BR>
155155 <A HREF="manual.html#pdf-pairs">pairs</A><BR>
156156 <A HREF="manual.html#pdf-pcall">pcall</A><BR>
@@ -400,10 +400,10 @@ Freely available under the terms of the · 243 unmodified lines
400400 <A HREF="manual.html#lua_rawequal">lua_rawequal</A><BR>
401401 <A HREF="manual.html#lua_rawget">lua_rawget</A><BR>
402402 <A HREF="manual.html#lua_rawgeti">lua_rawgeti</A><BR>
403+<A HREF="manual.html#lua_rawgetp">lua_rawgetp</A><BR>
403404 <A HREF="manual.html#lua_rawlen">lua_rawlen</A><BR>
404405 <A HREF="manual.html#lua_rawset">lua_rawset</A><BR>
405406 <A HREF="manual.html#lua_rawseti">lua_rawseti</A><BR>
406−<A HREF="manual.html#lua_rawgetp">lua_rawgetp</A><BR>
407407 <A HREF="manual.html#lua_rawsetp">lua_rawsetp</A><BR>
408408 <A HREF="manual.html#lua_register">lua_register</A><BR>
409409 <A HREF="manual.html#lua_remove">lua_remove</A><BR>
@@ -462,8 +462,8 @@ Freely available under the terms of the · 52 unmodified lines
462462 <A HREF="manual.html#luaL_buffinitsize">luaL_buffinitsize</A><BR>
463463 <A HREF="manual.html#luaL_callmeta">luaL_callmeta</A><BR>
464464 <A HREF="manual.html#luaL_checkany">luaL_checkany</A><BR>
465−<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR>
466465 <A HREF="manual.html#luaL_checkint">luaL_checkint</A><BR>
466+<A HREF="manual.html#luaL_checkinteger">luaL_checkinteger</A><BR>
467467 <A HREF="manual.html#luaL_checklong">luaL_checklong</A><BR>
468468 <A HREF="manual.html#luaL_checklstring">luaL_checklstring</A><BR>
469469 <A HREF="manual.html#luaL_checknumber">luaL_checknumber</A><BR>
@@ -494,8 +494,8 @@ Freely available under the terms of the · 24 unmodified lines
494494 <A HREF="manual.html#luaL_newmetatable">luaL_newmetatable</A><BR>
495495 <A HREF="manual.html#luaL_newstate">luaL_newstate</A><BR>
496496 <A HREF="manual.html#luaL_openlibs">luaL_openlibs</A><BR>
497−<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR>
498497 <A HREF="manual.html#luaL_optint">luaL_optint</A><BR>
498+<A HREF="manual.html#luaL_optinteger">luaL_optinteger</A><BR>
499499 <A HREF="manual.html#luaL_optlong">luaL_optlong</A><BR>
500500 <A HREF="manual.html#luaL_optlstring">luaL_optlstring</A><BR>
501501 <A HREF="manual.html#luaL_optnumber">luaL_optnumber</A><BR>
@@ -523,7 +523,7 @@ Freely available under the terms of the · 21 unmodified lines
523523 <HR>
524524 <SMALL CLASS="footer">
525525 Last update:
526−Tue Feb 19 15:14:47 BRT 2013
526+Tue Mar 12 11:22:18 BRT 2013
527527 </SMALL>
528528 <!--
529529 Last change: revised for Lua 5.2.2
doc/manual.html+3−3
@@ -33,7 +33,7 @@ Freely available under the terms of the · 32 unmodified lines
3333 <!-- ====================================================================== -->
3434 <p>
3535
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 $ -->
3737
3838
3939
@@ -8417,7 +8417,7 @@ When <code>pos</code> is an integer between 1 and <code>#list</code>, · 8377 unmodified lines
84178417 it shifts down the elements
84188418 <code>list[pos+1], list[pos+2], &middot;&middot;&middot;, list[#list]</code>
84198419 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,
84218421 or <code>#list + 1</code>;
84228422 in those cases, the function erases the element <code>list[pos]</code>.
84238423
@@ -10497,7 +10497,7 @@ Here is the complete syntax of Lua in extended BNF. · 2073 unmodified lines
1049710497 <HR>
1049810498 <SMALL CLASS="footer">
1049910499 Last update:
10500−Thu Mar 7 15:36:34 BRT 2013
10500+Thu Mar 21 12:58:59 BRT 2013
1050110501 </SMALL>
1050210502 <!--
1050310503 Last change: revised for Lua 5.2.2
src/lapi.c+2−2
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Lua API
44 ** See Copyright Notice in lua.h
55 */
@@ -1106,7 +1106,7 @@ LUA_API int lua_error (lua_State *L) { · 1100 unmodified lines
11061106 lua_lock(L);
11071107 api_checknelems(L, 1);
11081108 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 */
11101110 return 0; /* to avoid warnings */
11111111 }
11121112
src/lauxlib.c+2−2
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Auxiliary functions for building Lua libraries
44 ** See Copyright Notice in lua.h
55 */
@@ -599,7 +599,7 @@ static int skipBOM (LoadF *lf) { · 593 unmodified lines
599599 lf->n = 0;
600600 do {
601601 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;
603603 lf->buff[lf->n++] = c; /* to be read by the parser */
604604 } while (*p != '\0');
605605 lf->n = 0; /* prefix matched; discard it */
src/lbitlib.c+5−3
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Standard library for bitwise operations
44 ** See Copyright Notice in lua.h
55 */
@@ -147,7 +147,9 @@ static int b_rrot (lua_State *L) { · 141 unmodified lines
147147
148148 /*
149149 ** 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.)
151153 */
152154 static int fieldargs (lua_State *L, int farg, int *width) {
153155 int f = luaL_checkint(L, farg);
@@ -155,7 +157,7 @@ static int fieldargs (lua_State *L, int farg, int *width) { · 1 unmodified line
155157 luaL_argcheck(L, 0 <= f, farg, "field cannot be negative");
156158 luaL_argcheck(L, 0 < w, farg + 1, "width must be positive");
157159 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");
159161 *width = w;
160162 return f;
161163 }
src/lgc.c+3−3
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Garbage Collector
44 ** See Copyright Notice in lua.h
55 */
@@ -450,7 +450,7 @@ static lu_mem traversetable (global_State *g, Table *h) { · 444 unmodified lines
450450 else /* not weak */
451451 traversestrongtable(g, h);
452452 return sizeof(Table) + sizeof(TValue) * h->sizearray +
453− sizeof(Node) * sizenode(h);
453+ sizeof(Node) * cast(size_t, sizenode(h));
454454 }
455455
456456
@@ -924,7 +924,7 @@ static void setpause (global_State *g, l_mem estimate) { · 467 unmodified lines
924924 ** object inside the list (instead of to the header), so that the real
925925 ** sweep do not need to skip objects created between "now" and the start
926926 ** of the real sweep.
927−** Returns how many objects it sweeped.
927+** Returns how many objects it swept.
928928 */
929929 static int entersweep (lua_State *L) {
930930 global_State *g = G(L);
src/liolib.c+17−9
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Standard I/O (and system) library
44 ** See Copyright Notice in lua.h
55 */
@@ -29,6 +29,20 @@ · 23 unmodified lines
2929 #include "lualib.h"
3030
3131
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
3246
3347 /*
3448 ** {======================================================
@@ -212,14 +226,8 @@ static int io_open (lua_State *L) { · 177 unmodified lines
212226 const char *filename = luaL_checkstring(L, 1);
213227 const char *mode = luaL_optstring(L, 2, "r");
214228 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");
223231 p->f = fopen(filename, mode);
224232 return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1;
225233 }
src/llex.c+2−2
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Lexical Analyzer
44 ** See Copyright Notice in lua.h
55 */
@@ -313,7 +313,7 @@ static int readhexaesc (LexState *ls) { · 307 unmodified lines
313313 int c[3], i; /* keep input for error message */
314314 int r = 0; /* result accumulator */
315315 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 */
317317 c[i] = next(ls);
318318 if (!lisxdigit(c[i]))
319319 escerror(ls, c, i + 1, "hexadecimal digit expected");
src/lua.h+6−1
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Lua - A Scripting Language
44 ** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
55 ** See Copyright Notice at the end of this file
@@ -119,6 +119,11 @@ typedef LUA_UNSIGNED lua_Unsigned; · 113 unmodified lines
119119 #endif
120120
121121
122+/*
123+** RCS ident string
124+*/
125+extern const char lua_ident[];
126+
122127
123128 /*
124129 ** state manipulation
src/luaconf.h+3−3
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Configuration file for Lua
44 ** See Copyright Notice in lua.h
55 */
@@ -44,7 +44,7 @@ · 38 unmodified lines
4444 #define LUA_USE_POSIX
4545 #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
4646 #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 */
4848 #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
4949 #define LUA_USE_LONGLONG /* assume support for long long */
5050 #endif
@@ -53,7 +53,7 @@ · 2 unmodified lines
5353 #define LUA_USE_POSIX
5454 #define LUA_USE_DLOPEN /* does not need -ldl */
5555 #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 */
5757 #define LUA_USE_AFORMAT /* assume 'printf' handles 'aA' specifiers */
5858 #define LUA_USE_LONGLONG /* assume support for long long */
5959 #endif
src/lvm.c+2−2
@@ -1,5 +1,5 @@
11 /*
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 $
33 ** Lua virtual machine
44 ** See Copyright Notice in lua.h
55 */
@@ -83,7 +83,7 @@ static void traceexec (lua_State *L) { · 77 unmodified lines
8383 if (counthook)
8484 L->hookcount = 1; /* undo decrement to zero */
8585 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 */
8787 ci->func = L->top - 1; /* protect stack below results */
8888 luaD_throw(L, LUA_YIELD);
8989 }