diff options
author | Lua Team <team@lua.org> | 2011-07-05 12:00:00 +0000 |
---|---|---|
committer | repogen <> | 2011-07-05 12:00:00 +0000 |
commit | 76e52968cfea8eccaffae99512879d664796e6a6 (patch) | |
tree | 6105722d5a672f6bc2280bfd54f4e7b9531431cb | |
parent | cc3a4be74122bb2c002798696730bca68d36fcc9 (diff) | |
download | lua-github-76e52968cfea8eccaffae99512879d664796e6a6.tar.gz |
Lua 5.2.0-beta-rc65.2.0-beta-rc6
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | doc/manual.html | 85 | ||||
-rw-r--r-- | src/lbaselib.c | 21 | ||||
-rw-r--r-- | src/llex.c | 6 | ||||
-rw-r--r-- | src/lmathlib.c | 11 | ||||
-rw-r--r-- | src/loadlib.c | 17 | ||||
-rw-r--r-- | src/lobject.h | 8 | ||||
-rw-r--r-- | src/ltablib.c | 14 | ||||
-rw-r--r-- | src/lua.hpp | 9 |
9 files changed, 66 insertions, 107 deletions
@@ -1,5 +1,5 @@ -This is Lua 5.2 (beta), released on 04 Jul 2011. +This is Lua 5.2 (beta), released on 05 Jul 2011. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/doc/manual.html b/doc/manual.html index 5f1ec32d..00b73095 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -38,7 +38,7 @@ Freely available under the terms of the <!-- ====================================================================== --> <p> -<!-- $Id: manual.of,v 1.84 2011/07/04 15:58:56 roberto Exp $ --> +<!-- $Id: manual.of,v 1.85 2011/07/05 19:15:00 roberto Exp $ --> @@ -1167,7 +1167,7 @@ and can contain the following C-like escape sequences: and '<code>\'</code>' (apostrophe [single quote]). A backslash followed by a real newline results in a newline in the string. -The escape sequence '<code>\*</code>' skips the following span +The escape sequence '<code>\z</code>' skips the following span of white-space characters, including line breaks; it is particularly useful to break and indent a long string @@ -2603,12 +2603,12 @@ defined as constants in <code>lua.h</code>. The following constants are defined: <ul> -<li><b>LUA_RIDX_MAINTHREAD: </b> At this index the registry has +<li><b><a name="pdf-LUA_RIDX_MAINTHREAD"><code>LUA_RIDX_MAINTHREAD</code></a>: </b> At this index the registry has the main thread of the state. (The main thread is the one created together with the state.) </li> -<li><b>LUA_RIDX_GLOBALS: </b> At this index the registry has +<li><b><a name="pdf-LUA_RIDX_GLOBALS"><code>LUA_RIDX_GLOBALS</code></a>: </b> At this index the registry has the global environment. This is the C equivalent to the <a href="#pdf-_G"><code>_G</code></a> global variable. </li> @@ -6656,22 +6656,22 @@ It performs different functions according to its first argument, <code>opt</code <ul> -<li><b>"collect": </b> +<li><b>"<code>collect</code>": </b> performs a full garbage-collection cycle. This is the default option. </li> -<li><b>"stop": </b> +<li><b>"<code>stop</code>": </b> stops automatic invocation of the garbage collector. The collector will run only when explcitly invoked, until a call to restart it. </li> -<li><b>"restart": </b> +<li><b>"<code>restart</code>": </b> restarts automatic invocation the garbage collector. </li> -<li><b>"count": </b> +<li><b>"<code>count</code>": </b> returns the total memory in use by Lua (in Kbytes) and a second value with the total memory in bytes modulo 1024. The first value has a fractional part, @@ -6685,7 +6685,7 @@ so the following equality is always true: with a non floating-point type for numbers.) </li> -<li><b>"step": </b> +<li><b>"<code>step</code>": </b> performs a garbage-collection step. The step "size" is controlled by <code>arg</code> (larger values mean more steps) in a non-specified way. @@ -6694,19 +6694,19 @@ you must experimentally tune the value of <code>arg</code>. Returns <b>true</b> if the step finished a collection cycle. </li> -<li><b>"setpause": </b> +<li><b>"<code>setpause</code>": </b> sets <code>arg</code> as the new value for the <em>pause</em> of the collector (see <a href="#2.5">§2.5</a>). Returns the previous value for <em>pause</em>. </li> -<li><b>"setstepmul": </b> +<li><b>"<code>setstepmul</code>": </b> sets <code>arg</code> as the new value for the <em>step multiplier</em> of the collector (see <a href="#2.5">§2.5</a>). Returns the previous value for <em>step</em>. </li> -<li><b>"isrunning": </b> +<li><b>"<code>isrunning</code>": </b> returns a boolean that tells whether the collector is running (i.e., not stopped). </li> @@ -7649,7 +7649,7 @@ its default value is 1 and can be negative. A value of <b>true</b> as a fourth, optional argument <code>plain</code> turns off the pattern matching facilities, so the function does a plain "find substring" operation, -with no characters in <code>pattern</code> being considered "magic". +with no characters in <code>pattern</code> being considered magic. Note that if <code>plain</code> is given, then <code>init</code> must be given as well. @@ -7671,21 +7671,18 @@ Returns a formatted version of its variable number of arguments following the description given in its first argument (which must be a string). The format string follows the same rules as the C function <code>sprintf</code>. The only differences are that the options/modifiers -<code>*</code>, <code>l</code>, <code>L</code>, <code>n</code>, <code>p</code>, -and <code>h</code> are not supported +<code>*</code>, <code>h</code>, <code>L</code>, <code>l</code>, <code>n</code>, +and <code>p</code> are not supported and that there is an extra option, <code>q</code>. -The <code>q</code> option formats a string in a form suitable to be safely read -back by the Lua interpreter: -the string is written between double quotes, -and all double quotes, newlines, embedded zeros, -and backslashes in the string -are correctly escaped when written. +The <code>q</code> option formats a string between double quotes, +using escape sequences when necessary to ensure that +it can safely be read back by the Lua interpreter. For instance, the call <pre> string.format('%q', 'a string with "quotes" and \n new line') </pre><p> -will produce the string: +may produce the string: <pre> "a string with \"quotes\" and \ @@ -7702,8 +7699,8 @@ Options <code>c</code>, <code>d</code>, expect an integer as argument; the range of that integer may be limited by the underlying C implementation. -Option <code>q</code> expects a string -and <code>s</code> expects a string without embedded zeros. +Option <code>q</code> expects a string; +option <code>s</code> expects a string without embedded zeros. If the argument to option <code>s</code> is not a string, it is converted to one following the same rules of <a href="#pdf-tostring"><code>tostring</code></a>. @@ -8885,12 +8882,12 @@ or, in case of errors, <b>nil</b> plus an error message. The <code>mode</code> string can be any of the following: <ul> -<li><b>"r": </b> read mode (the default);</li> -<li><b>"w": </b> write mode;</li> -<li><b>"a": </b> append mode;</li> -<li><b>"r+": </b> update mode, all previous data is preserved;</li> -<li><b>"w+": </b> update mode, all previous data is erased;</li> -<li><b>"a+": </b> append update mode, previous data is preserved, +<li><b>"<code>r</code>": </b> read mode (the default);</li> +<li><b>"<code>w</code>": </b> write mode;</li> +<li><b>"<code>a</code>": </b> append mode;</li> +<li><b>"<code>r+</code>": </b> update mode, all previous data is preserved;</li> +<li><b>"<code>w+</code>": </b> update mode, all previous data is erased;</li> +<li><b>"<code>a+</code>": </b> append update mode, previous data is preserved, writing is only allowed at the end of file.</li> </ul><p> The <code>mode</code> string can also have a '<code>b</code>' at the end, @@ -9045,23 +9042,23 @@ The available formats are <ul> -<li><b>"*n": </b> +<li><b>"<code>*n</code>": </b> reads a number; this is the only format that returns a number instead of a string. </li> -<li><b>"*a": </b> +<li><b>"<code>*a</code>": </b> reads the whole file, starting at the current position. On end of file, it returns the empty string. </li> -<li><b>"*l": </b> +<li><b>"<code>*l</code>": </b> reads the next line skipping the end of line, returning <b>nil</b> on end of file. This is the default format. </li> -<li><b>"*L": </b> +<li><b>"<code>*L</code>": </b> reads the next line keeping the end of line (if present), returning <b>nil</b> on end of file. </li> @@ -9089,9 +9086,9 @@ to the position given by <code>offset</code> plus a base specified by the string <code>whence</code>, as follows: <ul> -<li><b>"set": </b> base is position 0 (beginning of the file);</li> -<li><b>"cur": </b> base is current position;</li> -<li><b>"end": </b> base is end of file;</li> +<li><b>"<code>set</code>": </b> base is position 0 (beginning of the file);</li> +<li><b>"<code>cur</code>": </b> base is current position;</li> +<li><b>"<code>end</code>": </b> base is end of file;</li> </ul><p> In case of success, function <code>seek</code> returns the final file position, measured in bytes from the beginning of the file. @@ -9122,17 +9119,17 @@ There are three available modes: <ul> -<li><b>"no": </b> +<li><b>"<code>no</code>": </b> no buffering; the result of any output operation appears immediately. </li> -<li><b>"full": </b> +<li><b>"<code>full</code>": </b> full buffering; output operation is performed only when the buffer is full (or when you explicitly <code>flush</code> the file (see <a href="#pdf-io.flush"><code>io.flush</code></a>)). </li> -<li><b>"line": </b> +<li><b>"<code>line</code>": </b> line buffering; output is buffered until a newline is output or there is any input from some special files (such as a terminal device). @@ -9615,9 +9612,9 @@ The string mask may have the following characters, with the given meaning: <ul> -<li><b><code>"c"</code>: </b> the hook is called every time Lua calls a function;</li> -<li><b><code>"r"</code>: </b> the hook is called every time Lua returns from a function;</li> -<li><b><code>"l"</code>: </b> the hook is called every time Lua enters a new line of code.</li> +<li><b>'<code>c</code>': </b> the hook is called every time Lua calls a function;</li> +<li><b>'<code>r</code>': </b> the hook is called every time Lua returns from a function;</li> +<li><b>'<code>l</code>': </b> the hook is called every time Lua enters a new line of code.</li> </ul><p> With a <code>count</code> different from zero, the hook is called after every <code>count</code> instructions. @@ -10207,7 +10204,7 @@ Here is the complete syntax of Lua in extended BNF. <HR> <SMALL CLASS="footer"> Last update: -Mon Jul 4 16:21:50 BRT 2011 +Tue Jul 5 19:16:15 BRT 2011 </SMALL> <!-- Last change: revised for Lua 5.2.0 (beta) diff --git a/src/lbaselib.c b/src/lbaselib.c index 8172f131..e4daf5d4 100644 --- a/src/lbaselib.c +++ b/src/lbaselib.c @@ -1,5 +1,5 @@ /* -** $Id: lbaselib.c,v 1.263 2011/07/02 15:56:43 roberto Exp $ +** $Id: lbaselib.c,v 1.264 2011/07/05 12:49:35 roberto Exp $ ** Basic library ** See Copyright Notice in lua.h */ @@ -120,11 +120,6 @@ static int luaB_setmetatable (lua_State *L) { } -static int luaB_removed (lua_State *L) { - return luaL_error(L, "removed function"); -} - - static int luaB_rawequal (lua_State *L) { luaL_checkany(L, 1); luaL_checkany(L, 2); @@ -355,14 +350,6 @@ static int luaB_load (lua_State *L) { return load_aux(L, status); } - -#if defined(LUA_COMPAT_LOADSTRING) -#define luaB_loadstring luaB_load -#else -#define luaB_loadstring luaB_removed -#endif - - /* }====================================================== */ @@ -454,12 +441,13 @@ static const luaL_Reg base_funcs[] = { {"collectgarbage", luaB_collectgarbage}, {"dofile", luaB_dofile}, {"error", luaB_error}, - {"getfenv", luaB_removed}, {"getmetatable", luaB_getmetatable}, {"ipairs", luaB_ipairs}, {"loadfile", luaB_loadfile}, {"load", luaB_load}, - {"loadstring", luaB_loadstring}, +#if defined(LUA_COMPAT_LOADSTRING) + {"loadstring", luaB_load}, +#endif {"next", luaB_next}, {"pairs", luaB_pairs}, {"pcall", luaB_pcall}, @@ -469,7 +457,6 @@ static const luaL_Reg base_funcs[] = { {"rawget", luaB_rawget}, {"rawset", luaB_rawset}, {"select", luaB_select}, - {"setfenv", luaB_removed}, {"setmetatable", luaB_setmetatable}, {"tonumber", luaB_tonumber}, {"tostring", luaB_tostring}, @@ -1,5 +1,5 @@ /* -** $Id: llex.c,v 2.49 2011/06/23 14:54:48 roberto Exp $ +** $Id: llex.c,v 2.50 2011/07/05 19:13:45 roberto Exp $ ** Lexical Analyzer ** See Copyright Notice in lua.h */ @@ -354,7 +354,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) { case '\n': case '\r': save(ls, '\n'); inclinenumber(ls); continue; case EOZ: continue; /* will raise an error next loop */ - case '*': { /* skip following span of spaces */ + case 'z': { /* zap following span of spaces */ next(ls); /* skip the '*' */ while (lisspace(ls->current)) { if (currIsNewline(ls)) inclinenumber(ls); @@ -364,7 +364,7 @@ static void read_string (LexState *ls, int del, SemInfo *seminfo) { } default: { if (!lisdigit(ls->current)) - c = ls->current; /* handles \\, \", \', and \? */ + c = ls->current; /* handles \\, \", and \' */ else /* digital escape \ddd */ c = readdecesc(ls); break; diff --git a/src/lmathlib.c b/src/lmathlib.c index 1127fd51..b17237f0 100644 --- a/src/lmathlib.c +++ b/src/lmathlib.c @@ -1,5 +1,5 @@ /* -** $Id: lmathlib.c,v 1.79 2010/11/18 18:38:27 roberto Exp $ +** $Id: lmathlib.c,v 1.80 2011/07/05 12:49:35 roberto Exp $ ** Standard mathematical library ** See Copyright Notice in lua.h */ @@ -134,15 +134,12 @@ static int math_log (lua_State *L) { return 1; } +#if defined(LUA_COMPAT_LOG10) static int math_log10 (lua_State *L) { -#if !defined(LUA_COMPAT_LOG10) - return luaL_error(L, "function " LUA_QL("log10") - " is deprecated; use log(x, 10) instead"); -#else lua_pushnumber(L, l_tg(log10)(luaL_checknumber(L, 1))); return 1; -#endif } +#endif static int math_exp (lua_State *L) { lua_pushnumber(L, l_tg(exp)(luaL_checknumber(L, 1))); @@ -252,7 +249,9 @@ static const luaL_Reg mathlib[] = { {"fmod", math_fmod}, {"frexp", math_frexp}, {"ldexp", math_ldexp}, +#if defined(LUA_COMPAT_LOG10) {"log10", math_log10}, +#endif {"log", math_log}, {"max", math_max}, {"min", math_min}, diff --git a/src/loadlib.c b/src/loadlib.c index 32c6ed25..0313d8e4 100644 --- a/src/loadlib.c +++ b/src/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.99 2011/06/28 17:13:28 roberto Exp $ +** $Id: loadlib.c,v 1.100 2011/07/05 12:49:35 roberto Exp $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** @@ -569,17 +569,6 @@ static int ll_seeall (lua_State *L) { return 0; } - -#else - -static int ll_seeall (lua_State *L) { - return luaL_error(L, "deprecated function"); -} - -static int ll_module (lua_State *L) { - return luaL_error(L, "deprecated function"); -} - #endif /* }====================================================== */ @@ -610,13 +599,17 @@ static void setpath (lua_State *L, const char *fieldname, const char *envname1, static const luaL_Reg pk_funcs[] = { {"loadlib", ll_loadlib}, {"searchpath", ll_searchpath}, +#if defined(LUA_COMPAT_MODULE) {"seeall", ll_seeall}, +#endif {NULL, NULL} }; static const luaL_Reg ll_funcs[] = { +#if defined(LUA_COMPAT_MODULE) {"module", ll_module}, +#endif {"require", ll_require}, {NULL, NULL} }; diff --git a/src/lobject.h b/src/lobject.h index 7f7a6830..d69d6153 100644 --- a/src/lobject.h +++ b/src/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.60 2011/06/13 14:13:06 roberto Exp $ +** $Id: lobject.h,v 2.61 2011/07/04 20:29:02 roberto Exp $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -275,14 +275,17 @@ typedef struct lua_TValue TValue; #endif #undef TValuefields +#undef NILCONSTANT #if defined(LUA_NANTRICKLE) /* little endian */ #define TValuefields \ union { struct { Value v_; int tt_; } i; double d_; } u +#define NILCONSTANT {{{NULL}, tag2tt(LUA_TNIL)}} #else /* big endian */ #define TValuefields \ union { struct { int tt_; Value v_; } i; double d_; } u +#define NILCONSTANT {{tag2tt(LUA_TNIL), {NULL}}} #endif #undef numfield @@ -294,9 +297,6 @@ typedef struct lua_TValue TValue; #define tag2tt(t) (NNMARK | (t)) -#undef NILCONSTANT -#define NILCONSTANT {{{NULL}, tag2tt(LUA_TNIL)}} - #undef val_ #define val_(o) ((o)->u.i.v_) #undef num_ diff --git a/src/ltablib.c b/src/ltablib.c index 6898442e..06353c7b 100644 --- a/src/ltablib.c +++ b/src/ltablib.c @@ -1,5 +1,5 @@ /* -** $Id: ltablib.c,v 1.60 2011/07/02 16:01:44 roberto Exp $ +** $Id: ltablib.c,v 1.61 2011/07/05 12:49:35 roberto Exp $ ** Library for Table Manipulation ** See Copyright Notice in lua.h */ @@ -20,11 +20,6 @@ (luaL_checktype(L, n, LUA_TTABLE), luaL_len(L, n)) -static int removedfunc (lua_State *L) { - return luaL_error(L, "removed function"); -} - - #if defined(LUA_COMPAT_MAXN) static int maxn (lua_State *L) { lua_Number max = 0; @@ -40,8 +35,6 @@ static int maxn (lua_State *L) { lua_pushnumber(L, max); return 1; } -#else -#define maxn removedfunc #endif @@ -267,10 +260,9 @@ static int sort (lua_State *L) { static const luaL_Reg tab_funcs[] = { {"concat", tconcat}, - {"foreach", removedfunc}, - {"foreachi", removedfunc}, - {"getn", removedfunc}, +#if defined(LUA_COMPAT_MAXN) {"maxn", maxn}, +#endif {"insert", tinsert}, {"pack", pack}, {"unpack", unpack}, diff --git a/src/lua.hpp b/src/lua.hpp deleted file mode 100644 index ec417f59..00000000 --- a/src/lua.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// lua.hpp -// Lua header files for C++ -// <<extern "C">> not supplied automatically because Lua also compiles as C++ - -extern "C" { -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" -} |