update to lua 5.3 rc4

This commit is contained in:
Cloud Wu
2015-01-07 15:38:34 +08:00
parent 8737531fbe
commit 29822f14bd
8 changed files with 40 additions and 19 deletions

View File

@@ -6,7 +6,7 @@
# Your platform. See PLATS for possible values. # Your platform. See PLATS for possible values.
PLAT= none PLAT= none
CC= gcc -std=c99 CC= gcc -std=gnu99
CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
LIBS= -lm $(SYSLIBS) $(MYLIBS) LIBS= -lm $(SYSLIBS) $(MYLIBS)

View File

@@ -1,3 +1,3 @@
Lua 5.3.0 rc3 http://www.lua.org/work/lua-5.3.0-rc3.tar.gz Lua 5.3.0 rc4 http://www.lua.org/work/lua-5.3.0-rc4.tar.gz
It will be update to final version when lua 5.3.0 released. It will be update to final version when lua 5.3.0 released.

View File

@@ -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 ** Initialization of libraries for lua.c and other clients
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -8,9 +8,6 @@
#define linit_c #define linit_c
#define LUA_LIB #define LUA_LIB
#include "lprefix.h"
/* /*
** If you embed Lua in your program and need to open the standard ** If you embed Lua in your program and need to open the standard
** libraries, call luaL_openlibs in your program. If you need a ** libraries, call luaL_openlibs in your program. If you need a
@@ -27,6 +24,11 @@
** lua_pop(L, 1); // remove _PRELOAD table ** lua_pop(L, 1); // remove _PRELOAD table
*/ */
#include "lprefix.h"
#include <stddef.h>
#include "lua.h" #include "lua.h"
#include "lualib.h" #include "lualib.h"

View File

@@ -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 ** Dynamic library loader for Lua
** See Copyright Notice in lua.h ** 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> #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) { static void lsys_unloadlib (void *lib) {
dlclose(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) { 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()); if (f == NULL) lua_pushstring(L, dlerror());
return f; return f;
} }

View File

@@ -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 ** Type definitions for Lua objects
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -473,7 +473,7 @@ typedef union TKey {
/* copy a value into a key without messing up field 'next' */ /* 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); \ { TKey *k_=(key); const TValue *io_=(obj); \
k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \
(void)L; checkliveness(G(L),io_); } (void)L; checkliveness(G(L),io_); }

View File

@@ -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 ** Opcodes for Lua virtual machine
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -10,6 +10,8 @@
#include "lprefix.h" #include "lprefix.h"
#include <stddef.h>
#include "lopcodes.h" #include "lopcodes.h"

View File

@@ -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) ** Lua tables (hash)
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -484,7 +484,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
mp = f; mp = f;
} }
} }
setkey(L, &mp->i_key, key); setnodekey(L, &mp->i_key, key);
luaC_barrierback(L, t, key); luaC_barrierback(L, t, key);
lua_assert(ttisnil(gval(mp))); lua_assert(ttisnil(gval(mp)));
return gval(mp); return gval(mp);

View File

@@ -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) ** Lua compiler (saves bytecodes to files; also lists bytecodes)
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -50,14 +50,14 @@ static void cannot(const char* what)
static void usage(const char* message) static void usage(const char* message)
{ {
if (*message=='-') if (*message=='-')
fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message); fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message);
else else
fprintf(stderr,"%s: %s\n",progname,message); fprintf(stderr,"%s: %s\n",progname,message);
fprintf(stderr, fprintf(stderr,
"usage: %s [options] [filenames]\n" "usage: %s [options] [filenames]\n"
"Available options are:\n" "Available options are:\n"
" -l list (use -l -l for full listing)\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" " -p parse only\n"
" -s strip debug information\n" " -s strip debug information\n"
" -v show version information\n" " -v show version information\n"
@@ -92,7 +92,7 @@ static int doargs(int argc, char* argv[])
{ {
output=argv[++i]; output=argv[++i];
if (output==NULL || *output==0 || (*output=='-' && output[1]!=0)) if (output==NULL || *output==0 || (*output=='-' && output[1]!=0))
usage(LUA_QL("-o") " needs argument"); usage("'-o' needs argument");
if (IS("-")) output=NULL; if (IS("-")) output=NULL;
} }
else if (IS("-p")) /* parse only */ 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 ** print bytecodes
** See Copyright Notice in lua.h ** See Copyright Notice in lua.h
*/ */
@@ -263,8 +263,13 @@ static void PrintConstant(const Proto* f, int i)
printf(bvalue(o) ? "true" : "false"); printf(bvalue(o) ? "true" : "false");
break; break;
case LUA_TNUMFLT: 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; break;
}
case LUA_TNUMINT: case LUA_TNUMINT:
printf(LUA_INTEGER_FMT,ivalue(o)); printf(LUA_INTEGER_FMT,ivalue(o));
break; break;