Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/mit/lua/dist/src resolve import conflicts
details: https://anonhg.NetBSD.org/src/rev/78277a783cff
branches: trunk
changeset: 353263:78277a783cff
user: mbalmer <mbalmer%NetBSD.org@localhost>
date: Wed Apr 26 12:49:34 2017 +0000
description:
resolve import conflicts
diffstat:
external/mit/lua/dist/src/lapi.c | 2 +-
external/mit/lua/dist/src/lapi.h | 2 +-
external/mit/lua/dist/src/lauxlib.c | 48 ++++---
external/mit/lua/dist/src/lauxlib.h | 14 +-
external/mit/lua/dist/src/lbaselib.c | 6 +-
external/mit/lua/dist/src/lbitlib.c | 2 +-
external/mit/lua/dist/src/lcode.c | 20 +-
external/mit/lua/dist/src/lcode.h | 2 +-
external/mit/lua/dist/src/lcorolib.c | 2 +-
external/mit/lua/dist/src/lctype.c | 2 +-
external/mit/lua/dist/src/lctype.h | 2 +-
external/mit/lua/dist/src/ldblib.c | 2 +-
external/mit/lua/dist/src/ldebug.c | 47 +++++--
external/mit/lua/dist/src/ldebug.h | 2 +-
external/mit/lua/dist/src/ldo.c | 228 +++++++++++++++++-----------------
external/mit/lua/dist/src/ldo.h | 2 +-
external/mit/lua/dist/src/ldump.c | 2 +-
external/mit/lua/dist/src/lfunc.c | 2 +-
external/mit/lua/dist/src/lfunc.h | 2 +-
external/mit/lua/dist/src/lgc.c | 10 +-
external/mit/lua/dist/src/lgc.h | 2 +-
external/mit/lua/dist/src/linit.c | 8 +-
external/mit/lua/dist/src/liolib.c | 19 +-
external/mit/lua/dist/src/llex.c | 2 +-
external/mit/lua/dist/src/llex.h | 2 +-
external/mit/lua/dist/src/llimits.h | 2 +-
external/mit/lua/dist/src/lmathlib.c | 19 +-
external/mit/lua/dist/src/lmem.c | 2 +-
external/mit/lua/dist/src/lmem.h | 2 +-
external/mit/lua/dist/src/loadlib.c | 171 +++++++++++++------------
external/mit/lua/dist/src/lobject.c | 8 +-
external/mit/lua/dist/src/lobject.h | 6 +-
external/mit/lua/dist/src/lopcodes.c | 2 +-
external/mit/lua/dist/src/lopcodes.h | 6 +-
external/mit/lua/dist/src/loslib.c | 31 ++--
external/mit/lua/dist/src/lparser.c | 9 +-
external/mit/lua/dist/src/lparser.h | 2 +-
external/mit/lua/dist/src/lprefix.h | 2 +-
external/mit/lua/dist/src/lstate.c | 2 +-
external/mit/lua/dist/src/lstate.h | 13 +-
external/mit/lua/dist/src/lstring.c | 2 +-
external/mit/lua/dist/src/lstring.h | 2 +-
external/mit/lua/dist/src/lstrlib.c | 22 +-
external/mit/lua/dist/src/ltable.c | 48 +++---
external/mit/lua/dist/src/ltable.h | 16 +-
external/mit/lua/dist/src/ltablib.c | 2 +-
external/mit/lua/dist/src/ltm.c | 6 +-
external/mit/lua/dist/src/ltm.h | 2 +-
external/mit/lua/dist/src/lua.c | 15 +-
external/mit/lua/dist/src/lua.h | 17 +-
external/mit/lua/dist/src/luac.c | 2 +-
external/mit/lua/dist/src/luaconf.h | 36 +++-
external/mit/lua/dist/src/lualib.h | 7 +-
external/mit/lua/dist/src/lundump.c | 2 +-
external/mit/lua/dist/src/lundump.h | 2 +-
external/mit/lua/dist/src/lutf8lib.c | 6 +-
external/mit/lua/dist/src/lvm.c | 2 +-
external/mit/lua/dist/src/lvm.h | 6 +-
external/mit/lua/dist/src/lzio.c | 2 +-
external/mit/lua/dist/src/lzio.h | 2 +-
60 files changed, 499 insertions(+), 409 deletions(-)
diffs (truncated from 2256 to 300 lines):
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lapi.c
--- a/external/mit/lua/dist/src/lapi.c Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lapi.c Wed Apr 26 12:49:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lapi.c,v 1.7 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lapi.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $ */
/*
** Id: lapi.c,v 2.259 2016/02/29 14:27:14 roberto Exp
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lapi.h
--- a/external/mit/lua/dist/src/lapi.h Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lapi.h Wed Apr 26 12:49:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lapi.h,v 1.6 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lapi.h,v 1.7 2017/04/26 12:49:34 mbalmer Exp $ */
/*
** Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lauxlib.c
--- a/external/mit/lua/dist/src/lauxlib.c Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lauxlib.c Wed Apr 26 12:49:34 2017 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lauxlib.c,v 1.7 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lauxlib.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $ */
/*
-** Id: lauxlib.c,v 1.286 2016/01/08 15:33:09 roberto Exp
+** Id: lauxlib.c,v 1.289 2016/12/20 18:37:00 roberto Exp
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -75,12 +75,11 @@
/*
** Search for a name for a function in all loaded modules
-** (registry._LOADED).
*/
static int pushglobalfuncname (lua_State *L, lua_Debug *ar) {
int top = lua_gettop(L);
lua_getinfo(L, "f", ar); /* push function */
- lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED");
+ lua_getfield(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
if (findfield(L, top + 1, 2)) {
const char *name = lua_tostring(L, -1);
if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */
@@ -823,13 +822,17 @@
LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) {
- if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */
+ if (luaL_callmeta(L, idx, "__tostring")) { /* metafield? */
+ if (!lua_isstring(L, -1))
+ luaL_error(L, "'__tostring' must return a string");
+ }
+ else {
switch (lua_type(L, idx)) {
case LUA_TNUMBER: {
if (lua_isinteger(L, idx))
- lua_pushfstring(L, "%I", lua_tointeger(L, idx));
+ lua_pushfstring(L, "%I", (LUAI_UACINT)lua_tointeger(L, idx));
else
- lua_pushfstring(L, "%f", lua_tonumber(L, idx));
+ lua_pushfstring(L, "%f", (LUAI_UACNUMBER)lua_tonumber(L, idx));
break;
}
case LUA_TSTRING:
@@ -841,10 +844,15 @@
case LUA_TNIL:
lua_pushliteral(L, "nil");
break;
- default:
- lua_pushfstring(L, "%s: %p", luaL_typename(L, idx),
- lua_topointer(L, idx));
+ default: {
+ int tt = luaL_getmetafield(L, idx, "__name"); /* try name */
+ const char *kind = (tt == LUA_TSTRING) ? lua_tostring(L, -1) :
+ luaL_typename(L, idx);
+ lua_pushfstring(L, "%s: %p", kind, lua_topointer(L, idx));
+ if (tt != LUA_TNIL)
+ lua_remove(L, -2); /* remove '__name' */
break;
+ }
}
}
return lua_tolstring(L, -1, len);
@@ -896,23 +904,23 @@
/*
** Find or create a module table with a given name. The function
-** first looks at the _LOADED table and, if that fails, try a
+** first looks at the LOADED table and, if that fails, try a
** global variable with that name. In any case, leaves on the stack
** the module table.
*/
LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname,
int sizehint) {
- luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); /* get _LOADED table */
- if (lua_getfield(L, -1, modname) != LUA_TTABLE) { /* no _LOADED[modname]? */
+ luaL_findtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE, 1);
+ if (lua_getfield(L, -1, modname) != LUA_TTABLE) { /* no LOADED[modname]? */
lua_pop(L, 1); /* remove previous result */
/* try global variable (and create one if it does not exist) */
lua_pushglobaltable(L);
if (luaL_findtable(L, 0, modname, sizehint) != NULL)
luaL_error(L, "name conflict for module '%s'", modname);
lua_pushvalue(L, -1);
- lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */
+ lua_setfield(L, -3, modname); /* LOADED[modname] = new table */
}
- lua_remove(L, -2); /* remove _LOADED table */
+ lua_remove(L, -2); /* remove LOADED table */
}
@@ -976,17 +984,17 @@
*/
LUALIB_API void luaL_requiref (lua_State *L, const char *modname,
lua_CFunction openf, int glb) {
- luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED");
- lua_getfield(L, -1, modname); /* _LOADED[modname] */
+ luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_LOADED_TABLE);
+ lua_getfield(L, -1, modname); /* LOADED[modname] */
if (!lua_toboolean(L, -1)) { /* package not already loaded? */
lua_pop(L, 1); /* remove field */
lua_pushcfunction(L, openf);
lua_pushstring(L, modname); /* argument to open function */
lua_call(L, 1, 1); /* call 'openf' to open module */
lua_pushvalue(L, -1); /* make copy of module (call result) */
- lua_setfield(L, -3, modname); /* _LOADED[modname] = module */
+ lua_setfield(L, -3, modname); /* LOADED[modname] = module */
}
- lua_remove(L, -2); /* remove _LOADED table */
+ lua_remove(L, -2); /* remove LOADED table */
if (glb) {
lua_pushvalue(L, -1); /* copy of module */
lua_setglobal(L, modname); /* _G[modname] = module */
@@ -1046,6 +1054,6 @@
luaL_error(L, "multiple Lua VMs detected");
else if (*v != ver)
luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f",
- ver, *v);
+ (LUAI_UACNUMBER)ver, (LUAI_UACNUMBER)*v);
}
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lauxlib.h
--- a/external/mit/lua/dist/src/lauxlib.h Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lauxlib.h Wed Apr 26 12:49:34 2017 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lauxlib.h,v 1.5 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lauxlib.h,v 1.6 2017/04/26 12:49:34 mbalmer Exp $ */
/*
-** Id: lauxlib.h,v 1.129 2015/11/23 11:29:43 roberto Exp
+** Id: lauxlib.h,v 1.131 2016/12/06 14:54:31 roberto Exp
** Auxiliary functions for building Lua libraries
** See Copyright Notice in lua.h
*/
@@ -20,10 +20,18 @@
-/* extra error code for 'luaL_load' */
+/* extra error code for 'luaL_loadfilex' */
#define LUA_ERRFILE (LUA_ERRERR+1)
+/* key, in the registry, for table of loaded modules */
+#define LUA_LOADED_TABLE "_LOADED"
+
+
+/* key, in the registry, for table of preloaded loaders */
+#define LUA_PRELOAD_TABLE "_PRELOAD"
+
+
typedef struct luaL_Reg {
const char *name;
lua_CFunction func;
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lbaselib.c
--- a/external/mit/lua/dist/src/lbaselib.c Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lbaselib.c Wed Apr 26 12:49:34 2017 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lbaselib.c,v 1.7 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lbaselib.c,v 1.8 2017/04/26 12:49:34 mbalmer Exp $ */
/*
-** Id: lbaselib.c,v 1.313 2016/04/11 19:18:40 roberto Exp
+** Id: lbaselib.c,v 1.314 2016/09/05 19:06:34 roberto Exp
** Basic library
** See Copyright Notice in lua.h
*/
@@ -212,8 +212,8 @@
static int pairsmeta (lua_State *L, const char *method, int iszero,
lua_CFunction iter) {
+ luaL_checkany(L, 1);
if (luaL_getmetafield(L, 1, method) == LUA_TNIL) { /* no metamethod? */
- luaL_checktype(L, 1, LUA_TTABLE); /* argument must be a table */
lua_pushcfunction(L, iter); /* will return generator, */
lua_pushvalue(L, 1); /* state, */
if (iszero) lua_pushinteger(L, 0); /* and initial value */
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lbitlib.c
--- a/external/mit/lua/dist/src/lbitlib.c Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lbitlib.c Wed Apr 26 12:49:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lbitlib.c,v 1.4 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lbitlib.c,v 1.5 2017/04/26 12:49:34 mbalmer Exp $ */
/*
** Id: lbitlib.c,v 1.30 2015/11/11 19:08:09 roberto Exp
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lcode.c
--- a/external/mit/lua/dist/src/lcode.c Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lcode.c Wed Apr 26 12:49:34 2017 +0000
@@ -1,7 +1,7 @@
-/* $NetBSD: lcode.c,v 1.8 2016/09/08 20:57:20 salazar Exp $ */
+/* $NetBSD: lcode.c,v 1.9 2017/04/26 12:49:34 mbalmer Exp $ */
/*
-** Id: lcode.c,v 2.109 2016/05/13 19:09:21 roberto Exp
+** Id: lcode.c,v 2.112 2016/12/22 13:08:50 roberto Exp
** Code generator for Lua
** See Copyright Notice in lua.h
*/
@@ -44,7 +44,7 @@
** If expression is a numeric constant, fills 'v' with its value
** and returns 1. Otherwise, returns 0.
*/
-static int tonumeral(expdesc *e, TValue *v) {
+static int tonumeral(const expdesc *e, TValue *v) {
if (hasjumps(e))
return 0; /* not a numeral */
switch (e->k) {
@@ -92,7 +92,7 @@
/*
** Gets the destination address of a jump instruction. Used to traverse
** a list of jumps.
-*/
+*/
static int getjump (FuncState *fs, int pc) {
int offset = GETARG_sBx(fs->f->code[pc]);
if (offset == NO_JUMP) /* point to itself represents end of list */
@@ -765,7 +765,7 @@
** (that is, it is either in a register or in 'k' with an index
** in the range of R/K indices).
** Returns R/K index.
-*/
+*/
int luaK_exp2RK (FuncState *fs, expdesc *e) {
luaK_exp2val(fs, e);
switch (e->k) { /* move constants to 'k' */
@@ -1000,7 +1000,8 @@
** Try to "constant-fold" an operation; return 1 iff successful.
** (In this case, 'e1' has the final result.)
*/
-static int constfolding (FuncState *fs, int op, expdesc *e1, expdesc *e2) {
+static int constfolding (FuncState *fs, int op, expdesc *e1,
+ const expdesc *e2) {
TValue v1, v2, res;
if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2))
return 0; /* non-numeric operands or not safe to fold */
@@ -1043,6 +1044,9 @@
** (everything but logical operators 'and'/'or' and comparison
** operators).
** Expression to produce final result will be encoded in 'e1'.
+** Because 'luaK_exp2RK' can free registers, its calls must be
+** in "stack order" (that is, first on 'e2', which may have more
+** recent registers to be released).
*/
static void codebinexpval (FuncState *fs, OpCode op,
expdesc *e1, expdesc *e2, int line) {
@@ -1089,9 +1093,9 @@
** Aplly prefix operation 'op' to expression 'e'.
*/
void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) {
- static expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; /* fake 2nd operand */
+ static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP};
switch (op) {
- case OPR_MINUS: case OPR_BNOT:
+ case OPR_MINUS: case OPR_BNOT: /* use 'ef' as fake 2nd operand */
if (constfolding(fs, op + LUA_OPUNM, e, &ef))
break;
/* FALLTHROUGH */
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lcode.h
--- a/external/mit/lua/dist/src/lcode.h Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lcode.h Wed Apr 26 12:49:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lcode.h,v 1.5 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lcode.h,v 1.6 2017/04/26 12:49:34 mbalmer Exp $ */
/*
** Id: lcode.h,v 1.64 2016/01/05 16:22:37 roberto Exp
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lcorolib.c
--- a/external/mit/lua/dist/src/lcorolib.c Wed Apr 26 12:36:53 2017 +0000
+++ b/external/mit/lua/dist/src/lcorolib.c Wed Apr 26 12:49:34 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lcorolib.c,v 1.4 2016/09/08 02:21:31 salazar Exp $ */
+/* $NetBSD: lcorolib.c,v 1.5 2017/04/26 12:49:34 mbalmer Exp $ */
/*
** Id: lcorolib.c,v 1.10 2016/04/11 19:19:55 roberto Exp
diff -r b26620e21aa1 -r 78277a783cff external/mit/lua/dist/src/lctype.c
Home |
Main Index |
Thread Index |
Old Index