diff options
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | doc/manual.html | 29 | ||||
-rw-r--r-- | src/Makefile | 2 | ||||
-rw-r--r-- | src/linit.c | 10 | ||||
-rw-r--r-- | src/loadlib.c | 16 | ||||
-rw-r--r-- | src/lobject.h | 4 | ||||
-rw-r--r-- | src/lopcodes.c | 4 | ||||
-rw-r--r-- | src/ltable.c | 4 | ||||
-rw-r--r-- | src/luac.c | 17 |
9 files changed, 57 insertions, 31 deletions
@@ -1,5 +1,5 @@ -This is Lua 5.3.0, released on 02 Jan 2015. +This is Lua 5.3.0, released on 06 Jan 2015. 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 f082929e..5ed8f069 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -33,7 +33,7 @@ Freely available under the terms of the <!-- ====================================================================== --> <p> -<!-- $Id: manual.of,v 1.143 2015/01/02 13:07:38 roberto Exp $ --> +<!-- $Id: manual.of,v 1.146 2015/01/06 11:23:01 roberto Exp $ --> @@ -429,7 +429,7 @@ You can emulate how Lua queries a metamethod for an object <code>obj</code> with the following code: <pre> - rawget(getmetatable(obj) or {}, event_name) + rawget(getmetatable(obj) or {}, "__" .. event_name) </pre> <p> @@ -761,12 +761,12 @@ When a marked object becomes garbage, it is not collected immediately by the garbage collector. Instead, Lua puts it in a list. After the collection, -Lua goes through that list: +Lua goes through that list. For each object in the list, -it checks the object's <code>__gc</code> metamethod; -if it is a function, -Lua calls it with the object as its single argument. -If the metamethod is not a function, +it checks the object's <code>__gc</code> metamethod: +If it is a function, +Lua calls it with the object as its single argument; +if the metamethod is not a function, Lua simply ignores it. @@ -2218,6 +2218,11 @@ is equivalent to </pre> <p> +The order of the assignments in a constructor is undefined. +(This order would be relevant only when there are repeated keys.) + + +<p> If the last field in the list has the form <code>exp</code> and the expression is a function call or a vararg expression, then all values returned by this expression enter the list consecutively @@ -2785,7 +2790,7 @@ never returning <p> The panic function runs as if it were a message handler (see <a href="#2.3">§2.3</a>); in particular, the error message is at the top of the stack. -However, there is no guarantees about stack space. +However, there is no guarantee about stack space. To push anything on the stack, the panic function must first check the available space (see <a href="#4.2">§4.2</a>). @@ -2861,7 +2866,7 @@ As an illustration, consider the following function: } </pre><p> Now we want to allow -the Lua code being ran by <a href="#lua_pcall"><code>lua_pcall</code></a> to yield. +the Lua code being run by <a href="#lua_pcall"><code>lua_pcall</code></a> to yield. First, we can rewrite our function like here: <pre> @@ -2880,7 +2885,7 @@ the new function <code>k</code> is a which should do all the work that the original function was doing after calling <a href="#lua_pcall"><code>lua_pcall</code></a>. Now, we must inform Lua that it must call <code>k</code> if the Lua code -begin running by <a href="#lua_pcall"><code>lua_pcall</code></a> gets interrupted in some way +being executed by <a href="#lua_pcall"><code>lua_pcall</code></a> gets interrupted in some way (errors or yielding), so we rewrite the code as here, replacing <a href="#lua_pcall"><code>lua_pcall</code></a> by <a href="#lua_pcallk"><code>lua_pcallk</code></a>: @@ -4179,7 +4184,7 @@ error while running a <code>__gc</code> metamethod. <pre>int lua_pcallk (lua_State *L, int nargs, int nresults, - int errfunc, + int msgh, lua_KContext ctx, lua_KFunction k);</pre> @@ -10774,7 +10779,7 @@ and LiteralString, see <a href="#3.1">§3.1</a>.) <HR> <SMALL CLASS="footer"> Last update: -Fri Jan 2 11:29:40 BRST 2015 +Tue Jan 6 10:10:50 BRST 2015 </SMALL> <!-- Last change: revised for Lua 5.3.0 (final) diff --git a/src/Makefile b/src/Makefile index 4be6dc13..2e7a4120 100644 --- a/src/Makefile +++ b/src/Makefile @@ -6,7 +6,7 @@ # Your platform. See PLATS for possible values. PLAT= none -CC= gcc -std=c99 +CC= gcc -std=gnu99 CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LIBS= -lm $(SYSLIBS) $(MYLIBS) diff --git a/src/linit.c b/src/linit.c index ca9d100d..8ce94ccb 100644 --- a/src/linit.c +++ b/src/linit.c @@ -1,5 +1,5 @@ /* -** $Id: linit.c,v 1.37 2014/12/09 15:00:17 roberto Exp $ +** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $ ** Initialization of libraries for lua.c and other clients ** See Copyright Notice in lua.h */ @@ -8,9 +8,6 @@ #define linit_c #define LUA_LIB -#include "lprefix.h" - - /* ** If you embed Lua in your program and need to open the standard ** libraries, call luaL_openlibs in your program. If you need a @@ -27,6 +24,11 @@ ** lua_pop(L, 1); // remove _PRELOAD table */ +#include "lprefix.h" + + +#include <stddef.h> + #include "lua.h" #include "lualib.h" diff --git a/src/loadlib.c b/src/loadlib.c index 1dab9bd0..7f8d9902 100644 --- a/src/loadlib.c +++ b/src/loadlib.c @@ -1,5 +1,5 @@ /* -** $Id: loadlib.c,v 1.123 2014/11/12 13:31:51 roberto Exp $ +** $Id: loadlib.c,v 1.124 2015/01/05 13:51:39 roberto Exp $ ** Dynamic library loader for Lua ** See Copyright Notice in lua.h ** @@ -135,6 +135,18 @@ static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym); #include <dlfcn.h> +/* +** Macro to covert pointer to void* to pointer to function. This cast +** is undefined according to ISO C, but POSIX assumes that it must work. +** (The '__extension__' in gnu compilers is only to avoid warnings.) +*/ +#if defined(__GNUC__) +#define cast_func(p) (__extension__ (lua_CFunction)(p)) +#else +#define cast_func(p) ((lua_CFunction)(p)) +#endif + + static void lsys_unloadlib (void *lib) { dlclose(lib); } @@ -148,7 +160,7 @@ static void *lsys_load (lua_State *L, const char *path, int seeglb) { static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = (lua_CFunction)dlsym(lib, sym); + lua_CFunction f = cast_func(dlsym(lib, sym)); if (f == NULL) lua_pushstring(L, dlerror()); return f; } diff --git a/src/lobject.h b/src/lobject.h index 77b4e470..d7d0ebf3 100644 --- a/src/lobject.h +++ b/src/lobject.h @@ -1,5 +1,5 @@ /* -** $Id: lobject.h,v 2.105 2014/12/19 13:36:32 roberto Exp $ +** $Id: lobject.h,v 2.106 2015/01/05 13:52:37 roberto Exp $ ** Type definitions for Lua objects ** See Copyright Notice in lua.h */ @@ -473,7 +473,7 @@ typedef union TKey { /* copy a value into a key without messing up field 'next' */ -#define setkey(L,key,obj) \ +#define setnodekey(L,key,obj) \ { TKey *k_=(key); const TValue *io_=(obj); \ k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ (void)L; checkliveness(G(L),io_); } diff --git a/src/lopcodes.c b/src/lopcodes.c index 8e2e6da3..a1cbef85 100644 --- a/src/lopcodes.c +++ b/src/lopcodes.c @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.c,v 1.54 2014/11/02 19:19:04 roberto Exp $ +** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $ ** Opcodes for Lua virtual machine ** See Copyright Notice in lua.h */ @@ -10,6 +10,8 @@ #include "lprefix.h" +#include <stddef.h> + #include "lopcodes.h" diff --git a/src/ltable.c b/src/ltable.c index e8ef146c..38be0051 100644 --- a/src/ltable.c +++ b/src/ltable.c @@ -1,5 +1,5 @@ /* -** $Id: ltable.c,v 2.99 2014/11/02 19:19:04 roberto Exp $ +** $Id: ltable.c,v 2.100 2015/01/05 13:52:37 roberto Exp $ ** Lua tables (hash) ** See Copyright Notice in lua.h */ @@ -484,7 +484,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { mp = f; } } - setkey(L, &mp->i_key, key); + setnodekey(L, &mp->i_key, key); luaC_barrierback(L, t, key); lua_assert(ttisnil(gval(mp))); return gval(mp); @@ -1,5 +1,5 @@ /* -** $Id: luac.c,v 1.71 2014/11/26 12:08:59 lhf Exp $ +** $Id: luac.c,v 1.72 2015/01/06 03:09:13 lhf Exp $ ** Lua compiler (saves bytecodes to files; also lists bytecodes) ** See Copyright Notice in lua.h */ @@ -50,14 +50,14 @@ static void cannot(const char* what) static void usage(const char* message) { if (*message=='-') - fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); + fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); else fprintf(stderr,"%s: %s\n",progname,message); fprintf(stderr, "usage: %s [options] [filenames]\n" "Available options are:\n" " -l list (use -l -l for full listing)\n" - " -o name output to file " LUA_QL("name") " (default is \"%s\")\n" + " -o name output to file 'name' (default is \"%s\")\n" " -p parse only\n" " -s strip debug information\n" " -v show version information\n" @@ -92,7 +92,7 @@ static int doargs(int argc, char* argv[]) { output=argv[++i]; if (output==NULL || *output==0 || (*output=='-' && output[1]!=0)) - usage(LUA_QL("-o") " needs argument"); + usage("'-o' needs argument"); if (IS("-")) output=NULL; } else if (IS("-p")) /* parse only */ @@ -206,7 +206,7 @@ int main(int argc, char* argv[]) } /* -** $Id: print.c,v 1.74 2014/07/21 01:41:45 lhf Exp $ +** $Id: print.c,v 1.76 2015/01/05 16:12:50 lhf Exp $ ** print bytecodes ** See Copyright Notice in lua.h */ @@ -263,8 +263,13 @@ static void PrintConstant(const Proto* f, int i) printf(bvalue(o) ? "true" : "false"); break; case LUA_TNUMFLT: - printf(LUA_NUMBER_FMT,fltvalue(o)); + { + char buff[100]; + sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); + printf("%s",buff); + if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); break; + } case LUA_TNUMINT: printf(LUA_INTEGER_FMT,ivalue(o)); break; |