Skip to content

Commit 29822f1

Browse files
committed
update to lua 5.3 rc4
1 parent 8737531 commit 29822f1

File tree

8 files changed

+40
-19
lines changed

8 files changed

+40
-19
lines changed

3rd/lua/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# Your platform. See PLATS for possible values.
77
PLAT= none
88

9-
CC= gcc -std=c99
9+
CC= gcc -std=gnu99
1010
CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS)
1111
LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS)
1212
LIBS= -lm $(SYSLIBS) $(MYLIBS)

3rd/lua/README

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Lua 5.3.0 rc3 http://www.lua.org/work/lua-5.3.0-rc3.tar.gz
1+
Lua 5.3.0 rc4 http://www.lua.org/work/lua-5.3.0-rc4.tar.gz
22

33
It will be update to final version when lua 5.3.0 released.

3rd/lua/linit.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: linit.c,v 1.37 2014/12/09 15:00:17 roberto Exp $
2+
** $Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp $
33
** Initialization of libraries for lua.c and other clients
44
** See Copyright Notice in lua.h
55
*/
@@ -8,9 +8,6 @@
88
#define linit_c
99
#define LUA_LIB
1010

11-
#include "lprefix.h"
12-
13-
1411
/*
1512
** If you embed Lua in your program and need to open the standard
1613
** libraries, call luaL_openlibs in your program. If you need a
@@ -27,6 +24,11 @@
2724
** lua_pop(L, 1); // remove _PRELOAD table
2825
*/
2926

27+
#include "lprefix.h"
28+
29+
30+
#include <stddef.h>
31+
3032
#include "lua.h"
3133

3234
#include "lualib.h"

3rd/lua/loadlib.c

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: loadlib.c,v 1.123 2014/11/12 13:31:51 roberto Exp $
2+
** $Id: loadlib.c,v 1.124 2015/01/05 13:51:39 roberto Exp $
33
** Dynamic library loader for Lua
44
** See Copyright Notice in lua.h
55
**
@@ -135,6 +135,18 @@ static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym);
135135

136136
#include <dlfcn.h>
137137

138+
/*
139+
** Macro to covert pointer to void* to pointer to function. This cast
140+
** is undefined according to ISO C, but POSIX assumes that it must work.
141+
** (The '__extension__' in gnu compilers is only to avoid warnings.)
142+
*/
143+
#if defined(__GNUC__)
144+
#define cast_func(p) (__extension__ (lua_CFunction)(p))
145+
#else
146+
#define cast_func(p) ((lua_CFunction)(p))
147+
#endif
148+
149+
138150
static void lsys_unloadlib (void *lib) {
139151
dlclose(lib);
140152
}
@@ -148,7 +160,7 @@ static void *lsys_load (lua_State *L, const char *path, int seeglb) {
148160

149161

150162
static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) {
151-
lua_CFunction f = (lua_CFunction)dlsym(lib, sym);
163+
lua_CFunction f = cast_func(dlsym(lib, sym));
152164
if (f == NULL) lua_pushstring(L, dlerror());
153165
return f;
154166
}

3rd/lua/lobject.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lobject.h,v 2.105 2014/12/19 13:36:32 roberto Exp $
2+
** $Id: lobject.h,v 2.106 2015/01/05 13:52:37 roberto Exp $
33
** Type definitions for Lua objects
44
** See Copyright Notice in lua.h
55
*/
@@ -473,7 +473,7 @@ typedef union TKey {
473473

474474

475475
/* copy a value into a key without messing up field 'next' */
476-
#define setkey(L,key,obj) \
476+
#define setnodekey(L,key,obj) \
477477
{ TKey *k_=(key); const TValue *io_=(obj); \
478478
k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \
479479
(void)L; checkliveness(G(L),io_); }

3rd/lua/lopcodes.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: lopcodes.c,v 1.54 2014/11/02 19:19:04 roberto Exp $
2+
** $Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp $
33
** Opcodes for Lua virtual machine
44
** See Copyright Notice in lua.h
55
*/
@@ -10,6 +10,8 @@
1010
#include "lprefix.h"
1111

1212

13+
#include <stddef.h>
14+
1315
#include "lopcodes.h"
1416

1517

3rd/lua/ltable.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: ltable.c,v 2.99 2014/11/02 19:19:04 roberto Exp $
2+
** $Id: ltable.c,v 2.100 2015/01/05 13:52:37 roberto Exp $
33
** Lua tables (hash)
44
** See Copyright Notice in lua.h
55
*/
@@ -484,7 +484,7 @@ TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) {
484484
mp = f;
485485
}
486486
}
487-
setkey(L, &mp->i_key, key);
487+
setnodekey(L, &mp->i_key, key);
488488
luaC_barrierback(L, t, key);
489489
lua_assert(ttisnil(gval(mp)));
490490
return gval(mp);

3rd/lua/luac.c

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
** $Id: luac.c,v 1.71 2014/11/26 12:08:59 lhf Exp $
2+
** $Id: luac.c,v 1.72 2015/01/06 03:09:13 lhf Exp $
33
** Lua compiler (saves bytecodes to files; also lists bytecodes)
44
** See Copyright Notice in lua.h
55
*/
@@ -50,14 +50,14 @@ static void cannot(const char* what)
5050
static void usage(const char* message)
5151
{
5252
if (*message=='-')
53-
fprintf(stderr,"%s: unrecognized option " LUA_QS "\n",progname,message);
53+
fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message);
5454
else
5555
fprintf(stderr,"%s: %s\n",progname,message);
5656
fprintf(stderr,
5757
"usage: %s [options] [filenames]\n"
5858
"Available options are:\n"
5959
" -l list (use -l -l for full listing)\n"
60-
" -o name output to file " LUA_QL("name") " (default is \"%s\")\n"
60+
" -o name output to file 'name' (default is \"%s\")\n"
6161
" -p parse only\n"
6262
" -s strip debug information\n"
6363
" -v show version information\n"
@@ -92,7 +92,7 @@ static int doargs(int argc, char* argv[])
9292
{
9393
output=argv[++i];
9494
if (output==NULL || *output==0 || (*output=='-' && output[1]!=0))
95-
usage(LUA_QL("-o") " needs argument");
95+
usage("'-o' needs argument");
9696
if (IS("-")) output=NULL;
9797
}
9898
else if (IS("-p")) /* parse only */
@@ -206,7 +206,7 @@ int main(int argc, char* argv[])
206206
}
207207

208208
/*
209-
** $Id: print.c,v 1.74 2014/07/21 01:41:45 lhf Exp $
209+
** $Id: print.c,v 1.76 2015/01/05 16:12:50 lhf Exp $
210210
** print bytecodes
211211
** See Copyright Notice in lua.h
212212
*/
@@ -263,8 +263,13 @@ static void PrintConstant(const Proto* f, int i)
263263
printf(bvalue(o) ? "true" : "false");
264264
break;
265265
case LUA_TNUMFLT:
266-
printf(LUA_NUMBER_FMT,fltvalue(o));
266+
{
267+
char buff[100];
268+
sprintf(buff,LUA_NUMBER_FMT,fltvalue(o));
269+
printf("%s",buff);
270+
if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0");
267271
break;
272+
}
268273
case LUA_TNUMINT:
269274
printf(LUA_INTEGER_FMT,ivalue(o));
270275
break;

0 commit comments

Comments
 (0)