Unified · Split
| @@ -38,7 +38,7 @@ Freely available under the terms of the · 37 unmodified lines | ||
| 38 | 38 | <!-- ====================================================================== --> |
| 39 | 39 | <p> |
| 40 | 40 | |
| 41 | −<!-- $Id: manual.of,v 1.85 2011/07/05 19:15:00 roberto Exp $ --> | |
| 41 | +<!-- $Id: manual.of,v 1.86 2011/07/08 20:00:45 roberto Exp $ --> | |
| 42 | 42 | |
| 43 | 43 | |
| 44 | 44 | |
| @@ -2962,8 +2962,8 @@ This is considered good programming practice. · 2917 unmodified lines | ||
| 2962 | 2962 | |
| 2963 | 2963 | <hr><h3><a name="lua_callk"><code>lua_callk</code></a></h3><p> |
| 2964 | 2964 | <span class="apii">[-(nargs + 1), +nresults, <em>e</em>]</span> |
| 2965 | −<pre>void lua_callk (lua_State *L, int nargs, int nresults, | |
| 2966 | − int ctx, lua_CFunction k);</pre> | |
| 2965 | +<pre>void lua_callk (lua_State *L, int nargs, int nresults, int ctx, | |
| 2966 | + lua_CFunction k);</pre> | |
| 2967 | 2967 | |
| 2968 | 2968 | <p> |
| 2969 | 2969 | This function behaves exactly like <a href="#lua_call"><code>lua_call</code></a>, |
| @@ -3857,7 +3857,7 @@ It is generated by the garbage collector.) · 887 unmodified lines | ||
| 3857 | 3857 | <hr><h3><a name="lua_pcallk"><code>lua_pcallk</code></a></h3><p> |
| 3858 | 3858 | <span class="apii">[-(nargs + 1), +(nresults|1), <em>-</em>]</span> |
| 3859 | 3859 | <pre>int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, |
| 3860 | − int ctx, lua_CFunction k);</pre> | |
| 3860 | + int ctx, lua_CFunction k);</pre> | |
| 3861 | 3861 | |
| 3862 | 3862 | <p> |
| 3863 | 3863 | This function behaves exactly like <a href="#lua_pcall"><code>lua_pcall</code></a>, |
| @@ -4839,8 +4839,7 @@ the function calling <code>lua_yield</code>. · 975 unmodified lines | ||
| 4839 | 4839 | |
| 4840 | 4840 | <hr><h3><a name="lua_yieldk"><code>lua_yieldk</code></a></h3><p> |
| 4841 | 4841 | <span class="apii">[-?, +?, <em>-</em>]</span> |
| 4842 | −<pre>int lua_yieldk (lua_State *L, int nresults, int ctx, | |
| 4843 | − lua_CFunction k);</pre> | |
| 4842 | +<pre>int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k);</pre> | |
| 4844 | 4843 | |
| 4845 | 4844 | <p> |
| 4846 | 4845 | Yields a coroutine. |
| @@ -5362,7 +5361,7 @@ will return identical ids for those upvalue indices. · 515 unmodified lines | ||
| 5362 | 5361 | |
| 5363 | 5362 | <hr><h3><a name="lua_upvaluejoin"><code>lua_upvaluejoin</code></a></h3> |
| 5364 | 5363 | <pre>void lua_upvaluejoin (lua_State *L, int fidx1, int n1, |
| 5365 | − int fidx2, int n2);</pre> | |
| 5364 | + int fidx2, int n2);</pre> | |
| 5366 | 5365 | |
| 5367 | 5366 | <p> |
| 5368 | 5367 | Make the <code>n1</code>-th upvalue of the Lua closure at index <code>fidx1</code> |
| @@ -5926,8 +5925,7 @@ process-related functions in the standard library · 557 unmodified lines | ||
| 5926 | 5925 | |
| 5927 | 5926 | <hr><h3><a name="luaL_fileresult"><code>luaL_fileresult</code></a></h3><p> |
| 5928 | 5927 | <span class="apii">[-0, +(1|3), <em>m</em>]</span> |
| 5929 | −<pre>int luaL_fileresult (lua_State *L, int stat, | |
| 5930 | − const char *fname);</pre> | |
| 5928 | +<pre>int luaL_fileresult (lua_State *L, int stat, const char *fname);</pre> | |
| 5931 | 5929 | |
| 5932 | 5930 | <p> |
| 5933 | 5931 | This function produces the return values for |
| @@ -6394,7 +6392,7 @@ in which both <code>name</code> and <code>func</code> are <code>NULL</code>. · 460 unmodified lines | ||
| 6394 | 6392 | <hr><h3><a name="luaL_requiref"><code>luaL_requiref</code></a></h3><p> |
| 6395 | 6393 | <span class="apii">[-0, +1, <em>e</em>]</span> |
| 6396 | 6394 | <pre>void luaL_requiref (lua_State *L, const char *modname, |
| 6397 | − lua_CFunction openf, int glb);</pre> | |
| 6395 | + lua_CFunction openf, int glb);</pre> | |
| 6398 | 6396 | |
| 6399 | 6397 | <p> |
| 6400 | 6398 | Calls function <code>openf</code> with string <code>modname</code> as an argument |
| @@ -6486,8 +6484,8 @@ and uses the result of the call as its result. · 85 unmodified lines | ||
| 6486 | 6484 | |
| 6487 | 6485 | <hr><h3><a name="luaL_traceback"><code>luaL_traceback</code></a></h3><p> |
| 6488 | 6486 | <span class="apii">[-0, +1, <em>m</em>]</span> |
| 6489 | −<pre>void luaL_traceback (lua_State *L, lua_State *L1, | |
| 6490 | − const char *msg, int level);</pre> | |
| 6487 | +<pre>void luaL_traceback (lua_State *L, lua_State *L1, const char *msg, | |
| 6488 | + int level);</pre> | |
| 6491 | 6489 | |
| 6492 | 6490 | <p> |
| 6493 | 6491 | Creates and pushes a traceback of the stack <code>L1</code>. |
| @@ -10204,7 +10202,7 @@ Here is the complete syntax of Lua in extended BNF. · 3710 unmodified lines | ||
| 10204 | 10202 | <HR> |
| 10205 | 10203 | <SMALL CLASS="footer"> |
| 10206 | 10204 | Last update: |
| 10207 | −Tue Jul 5 19:16:15 BRT 2011 | |
| 10205 | +Fri Jul 8 17:11:02 BRT 2011 | |
| 10208 | 10206 | </SMALL> |
| 10209 | 10207 | <!-- |
| 10210 | 10208 | Last change: revised for Lua 5.2.0 (beta) |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: llex.c,v 2.50 2011/07/05 19:13:45 roberto Exp $ | |
| 2 | +** $Id: llex.c,v 2.53 2011/07/08 20:01:38 roberto Exp $ | |
| 3 | 3 | ** Lexical Analyzer |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -286,45 +286,51 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { · 280 unmodified lines | ||
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
| 289 | +static void escerror (LexState *ls, int *c, int n, const char *msg) { | |
| 290 | + int i; | |
| 291 | + luaZ_resetbuffer(ls->buff); /* prepare error message */ | |
| 292 | + save(ls, '\\'); | |
| 293 | + for (i = 0; i < n && c[i] != EOZ; i++) | |
| 294 | + save(ls, c[i]); | |
| 295 | + lexerror(ls, msg, TK_STRING); | |
| 296 | +} | |
| 297 | + | |
| 298 | + | |
| 289 | 299 | static int readhexaesc (LexState *ls) { |
| 290 | − int c1 = next(ls); | |
| 291 | − int c2 = EOZ; | |
| 292 | − if (lisxdigit(c1)) { | |
| 293 | − c2 = next(ls); | |
| 294 | − if (lisxdigit(c2)) | |
| 295 | − return (luaO_hexavalue(c1) << 4) + luaO_hexavalue(c2); | |
| 300 | + int c[3]; /* keep input for error message */ | |
| 301 | + int i = 2; /* at least 'x?' will go to error message */ | |
| 302 | + c[0] = 'x'; | |
| 303 | + c[1] = next(ls); /* first hexa digit */ | |
| 304 | + if (lisxdigit(c[1])) { | |
| 305 | + c[i++] = next(ls); /* second hexa digit */ | |
| 306 | + if (lisxdigit(c[2])) | |
| 307 | + return (luaO_hexavalue(c[1]) << 4) + luaO_hexavalue(c[2]); | |
| 296 | 308 | /* else go through to error */ |
| 297 | 309 | } |
| 298 | − luaZ_resetbuffer(ls->buff); /* prepare error message */ | |
| 299 | − save(ls, '\\'); save(ls, 'x'); | |
| 300 | − if (c1 != EOZ) save(ls, c1); | |
| 301 | − if (c2 != EOZ) save(ls, c2); | |
| 302 | − lexerror(ls, "hexadecimal digit expected", TK_STRING); | |
| 310 | + escerror(ls, c, i, "hexadecimal digit expected"); | |
| 303 | 311 | return 0; /* to avoid warnings */ |
| 304 | 312 | } |
| 305 | 313 | |
| 306 | 314 | |
| 307 | 315 | static int readdecesc (LexState *ls) { |
| 308 | − int c1 = ls->current; /* first char must be a digit */ | |
| 309 | − int c2 = next(ls); /* read second char */ | |
| 310 | − int c = c1 - '0'; /* partial result */ | |
| 311 | − if (lisdigit(c2)) { | |
| 312 | − int c3 = next(ls); /* read third char */ | |
| 313 | − c = 10*c + c2 - '0'; /* update result */ | |
| 314 | − if (lisdigit(c3)) { | |
| 315 | − c = 10*c + c3 - '0'; /* update result */ | |
| 316 | − if (c > UCHAR_MAX) { | |
| 317 | − luaZ_resetbuffer(ls->buff); /* prepare error message */ | |
| 318 | − save(ls, '\\'); | |
| 319 | − save(ls, c1); save(ls, c2); save(ls, c3); | |
| 320 | − lexerror(ls, "decimal escape too large", TK_STRING); | |
| 321 | − } | |
| 322 | − return c; | |
| 316 | + int c[3], r; | |
| 317 | + int i = 2; /* at least two chars will be read */ | |
| 318 | + c[0] = ls->current; /* first char must be a digit */ | |
| 319 | + c[1] = next(ls); /* read second char */ | |
| 320 | + r = c[0] - '0'; /* partial result */ | |
| 321 | + if (lisdigit(c[1])) { | |
| 322 | + c[i++] = next(ls); /* read third char */ | |
| 323 | + r = 10*r + c[1] - '0'; /* update result */ | |
| 324 | + if (lisdigit(c[2])) { | |
| 325 | + r = 10*r + c[2] - '0'; /* update result */ | |
| 326 | + if (r > UCHAR_MAX) | |
| 327 | + escerror(ls, c, i, "decimal escape too large"); | |
| 328 | + return r; | |
| 323 | 329 | } |
| 324 | 330 | } |
| 325 | 331 | /* else, has read one character that was not a digit */ |
| 326 | 332 | zungetc(ls->z); /* return it to input stream */ |
| 327 | − return c; | |
| 333 | + return r; | |
| 328 | 334 | } |
| 329 | 335 | |
| 330 | 336 | |
| @@ -353,9 +359,10 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) { · 22 unmodified lines | ||
| 353 | 359 | case 'x': c = readhexaesc(ls); break; |
| 354 | 360 | case '\n': |
| 355 | 361 | case '\r': save(ls, '\n'); inclinenumber(ls); continue; |
| 362 | + case '\\': case '\"': case '\'': c = ls->current; break; | |
| 356 | 363 | case EOZ: continue; /* will raise an error next loop */ |
| 357 | 364 | case 'z': { /* zap following span of spaces */ |
| 358 | − next(ls); /* skip the '*' */ | |
| 365 | + next(ls); /* skip the 'z' */ | |
| 359 | 366 | while (lisspace(ls->current)) { |
| 360 | 367 | if (currIsNewline(ls)) inclinenumber(ls); |
| 361 | 368 | else next(ls); |
| @@ -364,9 +371,9 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) { · 2 unmodified lines | ||
| 364 | 371 | } |
| 365 | 372 | default: { |
| 366 | 373 | if (!lisdigit(ls->current)) |
| 367 | − c = ls->current; /* handles \\, \", and \' */ | |
| 368 | − else /* digital escape \ddd */ | |
| 369 | − c = readdecesc(ls); | |
| 374 | + escerror(ls, &ls->current, 1, "invalid escape sequence"); | |
| 375 | + /* digital escape \ddd */ | |
| 376 | + c = readdecesc(ls); | |
| 370 | 377 | break; |
| 371 | 378 | } |
| 372 | 379 | } |
| @@ -0,0 +1,9 @@ | ||
| 1 | +// lua.hpp | |
| 2 | +// Lua header files for C++ | |
| 3 | +// <<extern "C">> not supplied automatically because Lua also compiles as C++ | |
| 4 | + | |
| 5 | +extern "C" { | |
| 6 | +#include "lua.h" | |
| 7 | +#include "lualib.h" | |
| 8 | +#include "lauxlib.h" | |
| 9 | +} | |
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /* |
| 2 | −** $Id: luaconf.h,v 1.160 2011/06/28 17:14:12 roberto Exp $ | |
| 2 | +** $Id: luaconf.h,v 1.161 2011/07/08 20:07:11 roberto Exp $ | |
| 3 | 3 | ** Configuration file for Lua |
| 4 | 4 | ** See Copyright Notice in lua.h |
| 5 | 5 | */ |
| @@ -499,12 +499,12 @@ · 493 unmodified lines | ||
| 499 | 499 | ** doubles with conventional endianess (12345678 or 87654321), in CPUs |
| 500 | 500 | ** that do not produce signaling NaN values (all NaNs are quiet). |
| 501 | 501 | */ |
| 502 | −#if defined(LUA_CORE) /* { */ | |
| 503 | − | |
| 504 | −#if defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ | |
| 502 | +#if defined(LUA_CORE) && \ | |
| 503 | + defined(LUA_NUMBER_DOUBLE) && !defined(LUA_ANSI) /* { */ | |
| 505 | 504 | |
| 506 | 505 | /* little-endian architectures that satisfy those conditions */ |
| 507 | −#if defined(__i386__) || defined(__i386) || defined(__X86__) | |
| 506 | +#if defined(__i386__) || defined(__i386) || defined(__X86__) || \ | |
| 507 | + defined(_M_IX86) | |
| 508 | 508 | |
| 509 | 509 | #define LUA_NANTRICKLE |
| 510 | 510 | |
| @@ -512,8 +512,6 @@ · 1 unmodified line | ||
| 512 | 512 | |
| 513 | 513 | #endif /* } */ |
| 514 | 514 | |
| 515 | −#endif /* } */ | |
| 516 | − | |
| 517 | 515 | |
| 518 | 516 | |
| 519 | 517 | |