Update bundled Lua to 5.2.4
parent
4f61d12e94
commit
095a644b3c
|
@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1
|
|||
|
||||
# Lua version and release.
|
||||
V= 5.2
|
||||
R= $V.3
|
||||
R= $V.4
|
||||
|
||||
# Targets start here.
|
||||
all: $(PLAT)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
This is Lua 5.2.3, released on 11 Nov 2013.
|
||||
This is Lua 5.2.4, released on 25 Feb 2015.
|
||||
|
||||
For installation instructions, license details, and
|
||||
further information about Lua, see doc/readme.html.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: ldblib.c,v 1.132.1.1 2013/04/12 18:48:47 roberto Exp $
|
||||
** $Id: ldblib.c,v 1.132.1.2 2015/02/19 17:16:55 roberto Exp $
|
||||
** Interface from Lua to its debug API
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -21,6 +21,11 @@
|
|||
#define HOOKKEY "_HKEY"
|
||||
|
||||
|
||||
static void checkstack (lua_State *L, lua_State *L1, int n) {
|
||||
if (L != L1 && !lua_checkstack(L1, n))
|
||||
luaL_error(L, "stack overflow");
|
||||
}
|
||||
|
||||
|
||||
static int db_getregistry (lua_State *L) {
|
||||
lua_pushvalue(L, LUA_REGISTRYINDEX);
|
||||
|
@ -114,6 +119,7 @@ static int db_getinfo (lua_State *L) {
|
|||
int arg;
|
||||
lua_State *L1 = getthread(L, &arg);
|
||||
const char *options = luaL_optstring(L, arg+2, "flnStu");
|
||||
checkstack(L, L1, 3);
|
||||
if (lua_isnumber(L, arg+1)) {
|
||||
if (!lua_getstack(L1, (int)lua_tointeger(L, arg+1), &ar)) {
|
||||
lua_pushnil(L); /* level out of range */
|
||||
|
@ -173,6 +179,7 @@ static int db_getlocal (lua_State *L) {
|
|||
else { /* stack-level argument */
|
||||
if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */
|
||||
return luaL_argerror(L, arg+1, "level out of range");
|
||||
checkstack(L, L1, 1);
|
||||
name = lua_getlocal(L1, &ar, nvar);
|
||||
if (name) {
|
||||
lua_xmove(L1, L, 1); /* push local value */
|
||||
|
@ -196,6 +203,7 @@ static int db_setlocal (lua_State *L) {
|
|||
return luaL_argerror(L, arg+1, "level out of range");
|
||||
luaL_checkany(L, arg+3);
|
||||
lua_settop(L, arg+3);
|
||||
checkstack(L, L1, 1);
|
||||
lua_xmove(L, L1, 1);
|
||||
lua_pushstring(L, lua_setlocal(L1, &ar, luaL_checkint(L, arg+2)));
|
||||
return 1;
|
||||
|
@ -313,6 +321,7 @@ static int db_sethook (lua_State *L) {
|
|||
lua_pushvalue(L, -1);
|
||||
lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */
|
||||
}
|
||||
checkstack(L, L1, 1);
|
||||
lua_pushthread(L1); lua_xmove(L1, L, 1);
|
||||
lua_pushvalue(L, arg+1);
|
||||
lua_rawset(L, -3); /* set new hook */
|
||||
|
@ -331,6 +340,7 @@ static int db_gethook (lua_State *L) {
|
|||
lua_pushliteral(L, "external hook");
|
||||
else {
|
||||
gethooktable(L);
|
||||
checkstack(L, L1, 1);
|
||||
lua_pushthread(L1); lua_xmove(L1, L, 1);
|
||||
lua_rawget(L, -2); /* get hook */
|
||||
lua_remove(L, -2); /* remove hook table */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: ldebug.c,v 2.90.1.3 2013/05/16 16:04:15 roberto Exp $
|
||||
** $Id: ldebug.c,v 2.90.1.4 2015/02/19 17:05:13 roberto Exp $
|
||||
** Debug Interface
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -47,6 +47,16 @@ static int currentline (CallInfo *ci) {
|
|||
}
|
||||
|
||||
|
||||
static void swapextra (lua_State *L) {
|
||||
if (L->status == LUA_YIELD) {
|
||||
CallInfo *ci = L->ci; /* get function that yielded */
|
||||
StkId temp = ci->func; /* exchange its 'func' and 'extra' values */
|
||||
ci->func = restorestack(L, ci->extra);
|
||||
ci->extra = savestack(L, temp);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
** this function can be called asynchronous (e.g. during a signal)
|
||||
*/
|
||||
|
@ -144,6 +154,7 @@ static const char *findlocal (lua_State *L, CallInfo *ci, int n,
|
|||
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
|
||||
const char *name;
|
||||
lua_lock(L);
|
||||
swapextra(L);
|
||||
if (ar == NULL) { /* information about non-active function? */
|
||||
if (!isLfunction(L->top - 1)) /* not a Lua function? */
|
||||
name = NULL;
|
||||
|
@ -158,6 +169,7 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
|
|||
api_incr_top(L);
|
||||
}
|
||||
}
|
||||
swapextra(L);
|
||||
lua_unlock(L);
|
||||
return name;
|
||||
}
|
||||
|
@ -165,11 +177,14 @@ LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) {
|
|||
|
||||
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) {
|
||||
StkId pos = 0; /* to avoid warnings */
|
||||
const char *name = findlocal(L, ar->i_ci, n, &pos);
|
||||
const char *name;
|
||||
lua_lock(L);
|
||||
swapextra(L);
|
||||
name = findlocal(L, ar->i_ci, n, &pos);
|
||||
if (name)
|
||||
setobjs2s(L, pos, L->top - 1);
|
||||
L->top--; /* pop value */
|
||||
swapextra(L);
|
||||
lua_unlock(L);
|
||||
return name;
|
||||
}
|
||||
|
@ -269,6 +284,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
|
|||
CallInfo *ci;
|
||||
StkId func;
|
||||
lua_lock(L);
|
||||
swapextra(L);
|
||||
if (*what == '>') {
|
||||
ci = NULL;
|
||||
func = L->top - 1;
|
||||
|
@ -287,6 +303,7 @@ LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) {
|
|||
setobjs2s(L, L->top, func);
|
||||
api_incr_top(L);
|
||||
}
|
||||
swapextra(L);
|
||||
if (strchr(what, 'L'))
|
||||
collectvalidlines(L, cl);
|
||||
lua_unlock(L);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lgc.c,v 2.140.1.2 2013/04/26 18:22:05 roberto Exp $
|
||||
** $Id: lgc.c,v 2.140.1.3 2014/09/01 16:55:08 roberto Exp $
|
||||
** Garbage Collector
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -403,7 +403,7 @@ static int traverseephemeron (global_State *g, Table *h) {
|
|||
reallymarkobject(g, gcvalue(gval(n))); /* mark it now */
|
||||
}
|
||||
}
|
||||
if (prop)
|
||||
if (g->gcstate != GCSatomic || prop)
|
||||
linktable(h, &g->ephemeron); /* have to propagate again */
|
||||
else if (hasclears) /* does table have white keys? */
|
||||
linktable(h, &g->allweak); /* may have to clean white keys */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: llex.c,v 2.63.1.2 2013/08/30 15:49:41 roberto Exp $
|
||||
** $Id: llex.c,v 2.63.1.3 2015/02/09 17:56:34 roberto Exp $
|
||||
** Lexical Analyzer
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -152,7 +152,7 @@ static void inclinenumber (LexState *ls) {
|
|||
if (currIsNewline(ls) && ls->current != old)
|
||||
next(ls); /* skip `\n\r' or `\r\n' */
|
||||
if (++ls->linenumber >= MAX_INT)
|
||||
luaX_syntaxerror(ls, "chunk has too many lines");
|
||||
lexerror(ls, "chunk has too many lines", 0);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lobject.h,v 2.71.1.1 2013/04/12 18:48:47 roberto Exp $
|
||||
** $Id: lobject.h,v 2.71.1.2 2014/05/07 14:14:58 roberto Exp $
|
||||
** Type definitions for Lua objects
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -561,12 +561,12 @@ typedef struct Table {
|
|||
CommonHeader;
|
||||
lu_byte flags; /* 1<<p means tagmethod(p) is not present */
|
||||
lu_byte lsizenode; /* log2 of size of `node' array */
|
||||
struct Table *metatable;
|
||||
int sizearray; /* size of `array' array */
|
||||
TValue *array; /* array part */
|
||||
Node *node;
|
||||
Node *lastfree; /* any free position is before this position */
|
||||
struct Table *metatable;
|
||||
GCObject *gclist;
|
||||
int sizearray; /* size of `array' array */
|
||||
} Table;
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lopcodes.h,v 1.142.1.1 2013/04/12 18:48:47 roberto Exp $
|
||||
** $Id: lopcodes.h,v 1.142.1.2 2014/10/20 18:32:09 roberto Exp $
|
||||
** Opcodes for Lua virtual machine
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -196,7 +196,7 @@ OP_LEN,/* A B R(A) := length of R(B) */
|
|||
|
||||
OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */
|
||||
|
||||
OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A) + 1 */
|
||||
OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */
|
||||
OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */
|
||||
OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */
|
||||
OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/*
|
||||
** $Id: ltablib.c,v 1.65.1.1 2013/04/12 18:48:47 roberto Exp $
|
||||
** $Id: ltablib.c,v 1.65.1.2 2014/05/07 16:32:55 roberto Exp $
|
||||
** Library for Table Manipulation
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
||||
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#define ltablib_c
|
||||
|
@ -134,13 +135,14 @@ static int pack (lua_State *L) {
|
|||
|
||||
|
||||
static int unpack (lua_State *L) {
|
||||
int i, e, n;
|
||||
int i, e;
|
||||
unsigned int n;
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
i = luaL_optint(L, 2, 1);
|
||||
e = luaL_opt(L, luaL_checkint, 3, luaL_len(L, 1));
|
||||
if (i > e) return 0; /* empty range */
|
||||
n = e - i + 1; /* number of elements */
|
||||
if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
|
||||
n = (unsigned int)e - (unsigned int)i; /* number of elements minus 1 */
|
||||
if (n > (INT_MAX - 10) || !lua_checkstack(L, ++n))
|
||||
return luaL_error(L, "too many results to unpack");
|
||||
lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
|
||||
while (i++ < e) /* push arg[i + 1...e] */
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: lua.h,v 1.285.1.2 2013/11/11 12:09:16 roberto Exp $
|
||||
** $Id: lua.h,v 1.285.1.4 2015/02/21 14:04:50 roberto Exp $
|
||||
** Lua - A Scripting Language
|
||||
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
|
||||
** See Copyright Notice at the end of this file
|
||||
|
@ -19,11 +19,11 @@
|
|||
#define LUA_VERSION_MAJOR "5"
|
||||
#define LUA_VERSION_MINOR "2"
|
||||
#define LUA_VERSION_NUM 502
|
||||
#define LUA_VERSION_RELEASE "3"
|
||||
#define LUA_VERSION_RELEASE "4"
|
||||
|
||||
#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR
|
||||
#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE
|
||||
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2013 Lua.org, PUC-Rio"
|
||||
#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2015 Lua.org, PUC-Rio"
|
||||
#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes"
|
||||
|
||||
|
||||
|
@ -418,7 +418,7 @@ struct lua_Debug {
|
|||
|
||||
|
||||
/******************************************************************************
|
||||
* Copyright (C) 1994-2013 Lua.org, PUC-Rio.
|
||||
* Copyright (C) 1994-2015 Lua.org, PUC-Rio.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files (the
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
** $Id: luaconf.h,v 1.176.1.1 2013/04/12 18:48:47 roberto Exp $
|
||||
** $Id: luaconf.h,v 1.176.1.2 2013/11/21 17:26:16 roberto Exp $
|
||||
** Configuration file for Lua
|
||||
** See Copyright Notice in lua.h
|
||||
*/
|
||||
|
@ -326,7 +326,7 @@
|
|||
|
||||
|
||||
/*
|
||||
@@ LUA_INT32 is an signed integer with exactly 32 bits.
|
||||
@@ LUA_INT32 is a signed integer with exactly 32 bits.
|
||||
@@ LUAI_UMEM is an unsigned integer big enough to count the total
|
||||
@* memory used by Lua.
|
||||
@@ LUAI_MEM is a signed integer big enough to count the total memory
|
||||
|
@ -350,7 +350,7 @@
|
|||
/*
|
||||
@@ LUAI_MAXSTACK limits the size of the Lua stack.
|
||||
** CHANGE it if you need a different limit. This limit is arbitrary;
|
||||
** its only purpose is to stop Lua to consume unlimited stack
|
||||
** its only purpose is to stop Lua from consuming unlimited stack
|
||||
** space (and to reserve some numbers for pseudo-indices).
|
||||
*/
|
||||
#if LUAI_BITSINT >= 32
|
||||
|
|
Loading…
Reference in New Issue