diff options
author | Luigi Scarso <luigi.scarso@gmail.com> | 2020-10-04 19:39:39 +0000 |
---|---|---|
committer | Luigi Scarso <luigi.scarso@gmail.com> | 2020-10-04 19:39:39 +0000 |
commit | 897efa4b7afe155a5913e31e318891bba54dd1bb (patch) | |
tree | c696b26e7512932f476d9fde7536194a585457cf /Build/source/libs | |
parent | b485704ecdb46ae6bc0997142320038f924469d1 (diff) |
sync with upstream luatex; Lua 5.3.6
git-svn-id: svn://tug.org/texlive/trunk@56535 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs')
24 files changed, 138 insertions, 75 deletions
diff --git a/Build/source/libs/lua53/ChangeLog b/Build/source/libs/lua53/ChangeLog index 8a52e5203b8..8b1840ca62c 100644 --- a/Build/source/libs/lua53/ChangeLog +++ b/Build/source/libs/lua53/ChangeLog @@ -1,3 +1,7 @@ +2020-10-04 Luigi Scarso <luigi.scarso@gmail.com> + + * Adapted for Lua 5.3.6 (thanks to K.Berry and A.Kakuto) + 2018-09-09 Karl Berry <karl@tug.org> * luaerror.test: LC_ALL=LANGUAGE=C. diff --git a/Build/source/libs/lua53/TLpatches/ChangeLog b/Build/source/libs/lua53/TLpatches/ChangeLog index dd2bcb2f07b..c0a302c75a9 100644 --- a/Build/source/libs/lua53/TLpatches/ChangeLog +++ b/Build/source/libs/lua53/TLpatches/ChangeLog @@ -1,6 +1,8 @@ -2018-07-21 Luigi Scarso <luigi.scarso@gmail.com> +2020-10-04 Luigi Scarso <luigi.scarso@gmail.com> Adapted for lua 5.3.5 +2018-07-21 Luigi Scarso <luigi.scarso@gmail.com> + Adapted for lua 5.3.5 2017-10-24 Luigi Scarso <luigi.scarso@gmail.com> Adapted for lua 5.3.4 diff --git a/Build/source/libs/lua53/TLpatches/patch-01-utf-8 b/Build/source/libs/lua53/TLpatches/patch-01-utf-8 index 0f7cb898128..69f07417699 100644 --- a/Build/source/libs/lua53/TLpatches/patch-01-utf-8 +++ b/Build/source/libs/lua53/TLpatches/patch-01-utf-8 @@ -1,6 +1,6 @@ diff -u lctype.h.orig lctype.h ---- lctype.h.orig 2018-07-21 09:57:36.061692228 +0200 -+++ lctype.h 2018-07-21 10:03:29.625677730 +0200 +--- lctype.h.orig 2020-10-04 12:05:56.139893521 +0200 ++++ lctype.h 2020-10-04 12:21:33.348948021 +0200 @@ -7,6 +7,8 @@ #ifndef lctype_h #define lctype_h @@ -24,3 +24,4 @@ diff -u lctype.h.orig lctype.h #define lisdigit(c) testprop(c, MASK(DIGITBIT)) #define lisspace(c) testprop(c, MASK(SPACEBIT)) #define lisprint(c) testprop(c, MASK(PRINTBIT)) + diff --git a/Build/source/libs/lua53/TLpatches/patch-02-FreeBSD b/Build/source/libs/lua53/TLpatches/patch-02-FreeBSD index ad85a5988d8..c197854cbd4 100644 --- a/Build/source/libs/lua53/TLpatches/patch-02-FreeBSD +++ b/Build/source/libs/lua53/TLpatches/patch-02-FreeBSD @@ -1,6 +1,6 @@ diff -u liolib.c.orig liolib.c ---- liolib.c.orig 2017-04-19 19:29:57.000000000 +0200 -+++ liolib.c 2018-07-21 10:04:50.965674394 +0200 +--- liolib.c.orig 2020-10-04 12:06:03.579772529 +0200 ++++ liolib.c 2020-10-04 12:12:12.061843306 +0200 @@ -16,6 +16,9 @@ #include <stdio.h> #include <stdlib.h> @@ -10,3 +10,4 @@ diff -u liolib.c.orig liolib.c +#endif #include "lua.h" + diff --git a/Build/source/libs/lua53/TLpatches/patch-03-export b/Build/source/libs/lua53/TLpatches/patch-03-export index 9bc2a4627fc..1da523bc755 100644 --- a/Build/source/libs/lua53/TLpatches/patch-03-export +++ b/Build/source/libs/lua53/TLpatches/patch-03-export @@ -1,6 +1,6 @@ diff -u lopcodes.h.orig lopcodes.h ---- lopcodes.h.orig 2018-07-21 09:59:37.349687255 +0200 -+++ lopcodes.h 2018-07-21 10:07:04.413668921 +0200 +--- lopcodes.h.orig 2020-10-04 12:06:08.639690280 +0200 ++++ lopcodes.h 2020-10-04 12:10:02.143921798 +0200 @@ -278,7 +278,7 @@ OpArgK /* argument is a constant or register/constant */ }; @@ -22,14 +22,15 @@ diff -u lopcodes.h.orig lopcodes.h diff -u lundump.h.orig lundump.h ---- lundump.h.orig 2018-07-21 10:00:01.545686262 +0200 -+++ lundump.h 2018-07-21 10:08:12.341666136 +0200 +--- lundump.h.orig 2020-10-04 12:06:14.335597724 +0200 ++++ lundump.h 2020-10-04 12:07:11.218675336 +0200 @@ -26,7 +26,7 @@ LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, const char* name); /* dump one chunk; from ldump.c */ -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, -+LUA_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, ++LUAI_API int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip); #endif + diff --git a/Build/source/libs/lua53/configure b/Build/source/libs/lua53/configure index f491f16500e..fc184f2cfe4 100755 --- a/Build/source/libs/lua53/configure +++ b/Build/source/libs/lua53/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for lua53 (TeX Live) 5.3.5. +# Generated by GNU Autoconf 2.69 for lua53 (TeX Live) 5.3.6. # # Report bugs to <tex-k@tug.org>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='lua53 (TeX Live)' PACKAGE_TARNAME='lua53--tex-live-' -PACKAGE_VERSION='5.3.5' -PACKAGE_STRING='lua53 (TeX Live) 5.3.5' +PACKAGE_VERSION='5.3.6' +PACKAGE_STRING='lua53 (TeX Live) 5.3.6' PACKAGE_BUGREPORT='tex-k@tug.org' PACKAGE_URL='' @@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures lua53 (TeX Live) 5.3.5 to adapt to many kinds of systems. +\`configure' configures lua53 (TeX Live) 5.3.6 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1398,7 +1398,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of lua53 (TeX Live) 5.3.5:";; + short | recursive ) echo "Configuration of lua53 (TeX Live) 5.3.6:";; esac cat <<\_ACEOF @@ -1515,7 +1515,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -lua53 (TeX Live) configure 5.3.5 +lua53 (TeX Live) configure 5.3.6 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1976,7 +1976,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by lua53 (TeX Live) $as_me 5.3.5, which was +It was created by lua53 (TeX Live) $as_me 5.3.6, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3900,7 +3900,7 @@ fi # Define the identity of the package. PACKAGE='lua53--tex-live-' - VERSION='5.3.5' + VERSION='5.3.6' cat >>confdefs.h <<_ACEOF @@ -5108,10 +5108,10 @@ $as_echo "no, using $LN_S" >&6; } fi -LUA53VERSION=5.3.5 +LUA53VERSION=5.3.6 -LUA53_LT_VERSINFO=8:5:3 +LUA53_LT_VERSINFO=8:6:3 case `pwd` in @@ -14545,7 +14545,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by lua53 (TeX Live) $as_me 5.3.5, which was +This file was extended by lua53 (TeX Live) $as_me 5.3.6, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -14611,7 +14611,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -lua53 (TeX Live) config.status 5.3.5 +lua53 (TeX Live) config.status 5.3.6 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/lua53/lua53-src/Makefile b/Build/source/libs/lua53/lua53-src/Makefile index 119110d2f01..a2820e04fe2 100644 --- a/Build/source/libs/lua53/lua53-src/Makefile +++ b/Build/source/libs/lua53/lua53-src/Makefile @@ -46,7 +46,7 @@ TO_MAN= lua.1 luac.1 # Lua version and release. V= 5.3 -R= $V.4 +R= $V.6 # Targets start here. all: $(PLAT) diff --git a/Build/source/libs/lua53/lua53-src/README b/Build/source/libs/lua53/lua53-src/README index ed424defe02..f8bdb6f41d0 100644 --- a/Build/source/libs/lua53/lua53-src/README +++ b/Build/source/libs/lua53/lua53-src/README @@ -1,5 +1,5 @@ -This is Lua 5.3.5, released on 26 Jun 2018. +This is Lua 5.3.6, released on 14 Sep 2020. For installation instructions, license details, and further information about Lua, see doc/readme.html. diff --git a/Build/source/libs/lua53/lua53-src/doc/contents.html b/Build/source/libs/lua53/lua53-src/doc/contents.html index c4eb2677906..3a357b1ed65 100644 --- a/Build/source/libs/lua53/lua53-src/doc/contents.html +++ b/Build/source/libs/lua53/lua53-src/doc/contents.html @@ -32,7 +32,7 @@ For a complete introduction to Lua programming, see the book <P> <SMALL> -Copyright © 2015–2018 Lua.org, PUC-Rio. +Copyright © 2015–2020 Lua.org, PUC-Rio. Freely available under the terms of the <A HREF="http://www.lua.org/license.html">Lua license</A>. </SMALL> @@ -318,6 +318,37 @@ Freely available under the terms of the <A HREF="manual.html#pdf-utf8.len">utf8.len</A><BR> <A HREF="manual.html#pdf-utf8.offset">utf8.offset</A><BR> +<H3><A NAME="metamethods">metamethods</A></H3> +<P> +<A HREF="manual.html#2.4">__add</A><BR> +<A HREF="manual.html#2.4">__band</A><BR> +<A HREF="manual.html#2.4">__bnot</A><BR> +<A HREF="manual.html#2.4">__bor</A><BR> +<A HREF="manual.html#2.4">__bxor</A><BR> +<A HREF="manual.html#2.4">__call</A><BR> +<A HREF="manual.html#2.4">__concat</A><BR> +<A HREF="manual.html#2.4">__div</A><BR> +<A HREF="manual.html#2.4">__eq</A><BR> +<A HREF="manual.html#2.5.1">__gc</A><BR> +<A HREF="manual.html#2.4">__idiv</A><BR> +<A HREF="manual.html#2.4">__index</A><BR> +<A HREF="manual.html#2.4">__le</A><BR> +<A HREF="manual.html#2.4">__len</A><BR> +<A HREF="manual.html#2.4">__lt</A><BR> +<A HREF="manual.html#pdf-getmetatable">__metatable</A><BR> +<A HREF="manual.html#2.4">__mod</A><BR> +<A HREF="manual.html#2.5.2">__mode</A><BR> +<A HREF="manual.html#2.4">__mul</A><BR> +<A HREF="manual.html#luaL_newmetatable">__name</A><BR> +<A HREF="manual.html#2.4">__newindex</A><BR> +<A HREF="manual.html#pdf-pairs">__pairs</A><BR> +<A HREF="manual.html#2.4">__pow</A><BR> +<A HREF="manual.html#2.4">__shl</A><BR> +<A HREF="manual.html#2.4">__shr</A><BR> +<A HREF="manual.html#2.4">__sub</A><BR> +<A HREF="manual.html#pdf-tostring">__tostring</A><BR> +<A HREF="manual.html#2.4">__unm</A><BR> + <H3><A NAME="env">environment<BR>variables</A></H3> <P> <A HREF="manual.html#pdf-LUA_CPATH">LUA_CPATH</A><BR> @@ -609,10 +640,10 @@ Freely available under the terms of the <P CLASS="footer"> Last update: -Mon Jun 18 22:56:06 -03 2018 +Tue Aug 25 13:45:14 UTC 2020 </P> <!-- -Last change: revised for Lua 5.3.5 +Last change: revised for Lua 5.3.6 --> </BODY> diff --git a/Build/source/libs/lua53/lua53-src/doc/manual.html b/Build/source/libs/lua53/lua53-src/doc/manual.html index 89a642a45d9..57c778744b7 100644 --- a/Build/source/libs/lua53/lua53-src/doc/manual.html +++ b/Build/source/libs/lua53/lua53-src/doc/manual.html @@ -19,7 +19,7 @@ by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes <P> <SMALL> -Copyright © 2015–2018 Lua.org, PUC-Rio. +Copyright © 2015–2020 Lua.org, PUC-Rio. Freely available under the terms of the <a href="http://www.lua.org/license.html">Lua license</a>. </SMALL> @@ -10972,10 +10972,10 @@ and LiteralString, see <a href="#3.1">§3.1</a>.) <P CLASS="footer"> Last update: -Tue Jun 26 13:16:37 -03 2018 +Tue Jul 14 10:32:39 UTC 2020 </P> <!-- -Last change: revised for Lua 5.3.5 +Last change: revised for Lua 5.3.6 --> </body></html> diff --git a/Build/source/libs/lua53/lua53-src/doc/readme.html b/Build/source/libs/lua53/lua53-src/doc/readme.html index b118f7b02d1..50716f42d0c 100644 --- a/Build/source/libs/lua53/lua53-src/doc/readme.html +++ b/Build/source/libs/lua53/lua53-src/doc/readme.html @@ -107,7 +107,7 @@ Here are the details. <OL> <LI> Open a terminal window and move to -the top-level directory, which is named <TT>lua-5.3.5</TT>. +the top-level directory, which is named <TT>lua-5.3.6</TT>. The <TT>Makefile</TT> there controls both the build process and the installation process. <P> <LI> @@ -328,7 +328,7 @@ For details, see <A HREF="http://www.lua.org/license.html">this</A>. <BLOCKQUOTE STYLE="padding-bottom: 0em"> -Copyright © 1994–2017 Lua.org, PUC-Rio. +Copyright © 1994–2020 Lua.org, PUC-Rio. <P> Permission is hereby granted, free of charge, to any person obtaining a copy @@ -355,10 +355,10 @@ THE SOFTWARE. <P CLASS="footer"> Last update: -Mon Jun 18 22:57:33 -03 2018 +Tue Jul 14 10:33:01 UTC 2020 </P> <!-- -Last change: revised for Lua 5.3.5 +Last change: revised for Lua 5.3.6 --> </BODY> diff --git a/Build/source/libs/lua53/lua53-src/src/Makefile b/Build/source/libs/lua53/lua53-src/src/Makefile index 64c78f775ba..a13afb99627 100644 --- a/Build/source/libs/lua53/lua53-src/src/Makefile +++ b/Build/source/libs/lua53/lua53-src/src/Makefile @@ -102,7 +102,7 @@ c89: freebsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -DLUA_USE_READLINE -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" + $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX -I/usr/include/edit" SYSLIBS="-Wl,-E -ledit" CC="cc" generic: $(ALL) diff --git a/Build/source/libs/lua53/lua53-src/src/lapi.c b/Build/source/libs/lua53/lua53-src/src/lapi.c index 02b7fab7ead..711895b395b 100644 --- a/Build/source/libs/lua53/lua53-src/src/lapi.c +++ b/Build/source/libs/lua53/lua53-src/src/lapi.c @@ -1254,13 +1254,12 @@ LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { } -static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { +static UpVal **getupvalref (lua_State *L, int fidx, int n) { LClosure *f; StkId fi = index2addr(L, fidx); api_check(L, ttisLclosure(fi), "Lua function expected"); f = clLvalue(fi); api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); - if (pf) *pf = f; return &f->upvals[n - 1]; /* get its upvalue pointer */ } @@ -1269,7 +1268,7 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { StkId fi = index2addr(L, fidx); switch (ttype(fi)) { case LUA_TLCL: { /* lua closure */ - return *getupvalref(L, fidx, n, NULL); + return *getupvalref(L, fidx, n); } case LUA_TCCL: { /* C closure */ CClosure *f = clCvalue(fi); @@ -1286,9 +1285,10 @@ LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, int fidx2, int n2) { - LClosure *f1; - UpVal **up1 = getupvalref(L, fidx1, n1, &f1); - UpVal **up2 = getupvalref(L, fidx2, n2, NULL); + UpVal **up1 = getupvalref(L, fidx1, n1); + UpVal **up2 = getupvalref(L, fidx2, n2); + if (*up1 == *up2) + return; luaC_upvdeccount(L, *up1); *up1 = *up2; (*up1)->refcount++; diff --git a/Build/source/libs/lua53/lua53-src/src/lauxlib.c b/Build/source/libs/lua53/lua53-src/src/lauxlib.c index 8bdada50a7e..ac68bd32da9 100644 --- a/Build/source/libs/lua53/lua53-src/src/lauxlib.c +++ b/Build/source/libs/lua53/lua53-src/src/lauxlib.c @@ -1011,8 +1011,13 @@ static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { free(ptr); return NULL; } - else - return realloc(ptr, nsize); + else { /* cannot fail when shrinking a block */ + void *newptr = realloc(ptr, nsize); + if (newptr == NULL && ptr != NULL && nsize <= osize) + return ptr; /* keep the original block */ + else /* no fail or not shrinking */ + return newptr; /* use the new block */ + } } diff --git a/Build/source/libs/lua53/lua53-src/src/lcode.c b/Build/source/libs/lua53/lua53-src/src/lcode.c index 12619f54a02..dc7271d6141 100644 --- a/Build/source/libs/lua53/lua53-src/src/lcode.c +++ b/Build/source/libs/lua53/lua53-src/src/lcode.c @@ -1061,7 +1061,7 @@ static void codecomp (FuncState *fs, BinOpr opr, expdesc *e1, expdesc *e2) { /* -** Aplly prefix operation 'op' to expression 'e'. +** Apply prefix operation 'op' to expression 'e'. */ void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { static const expdesc ef = {VKINT, {0}, NO_JUMP, NO_JUMP}; diff --git a/Build/source/libs/lua53/lua53-src/src/ldebug.c b/Build/source/libs/lua53/lua53-src/src/ldebug.c index e1389296e9e..bb0e1d4aced 100644 --- a/Build/source/libs/lua53/lua53-src/src/ldebug.c +++ b/Build/source/libs/lua53/lua53-src/src/ldebug.c @@ -133,10 +133,11 @@ static const char *upvalname (Proto *p, int uv) { static const char *findvararg (CallInfo *ci, int n, StkId *pos) { int nparams = clLvalue(ci->func)->p->numparams; - if (n >= cast_int(ci->u.l.base - ci->func) - nparams) + int nvararg = cast_int(ci->u.l.base - ci->func) - nparams; + if (n <= -nvararg) return NULL; /* no such vararg */ else { - *pos = ci->func + nparams + n; + *pos = ci->func + nparams - n; return "(*vararg)"; /* generic name for any vararg */ } } @@ -148,7 +149,7 @@ static const char *findlocal (lua_State *L, CallInfo *ci, int n, StkId base; if (isLua(ci)) { if (n < 0) /* access to vararg values? */ - return findvararg(ci, -n, pos); + return findvararg(ci, n, pos); else { base = ci->u.l.base; name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); diff --git a/Build/source/libs/lua53/lua53-src/src/liolib.c b/Build/source/libs/lua53/lua53-src/src/liolib.c index 76f372acbe8..62b18f075b7 100644 --- a/Build/source/libs/lua53/lua53-src/src/liolib.c +++ b/Build/source/libs/lua53/lua53-src/src/liolib.c @@ -280,6 +280,8 @@ static int io_popen (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); LStream *p = newprefile(L); + luaL_argcheck(L, ((mode[0] == 'r' || mode[0] == 'w') && mode[1] == '\0'), + 2, "invalid mode"); p->f = l_popen(L, filename, mode); p->closef = &io_pclose; return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; diff --git a/Build/source/libs/lua53/lua53-src/src/liolib.c.orig b/Build/source/libs/lua53/lua53-src/src/liolib.c.orig index 8a9e75cd089..027d4bd0db4 100644 --- a/Build/source/libs/lua53/lua53-src/src/liolib.c.orig +++ b/Build/source/libs/lua53/lua53-src/src/liolib.c.orig @@ -277,6 +277,8 @@ static int io_popen (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); LStream *p = newprefile(L); + luaL_argcheck(L, ((mode[0] == 'r' || mode[0] == 'w') && mode[1] == '\0'), + 2, "invalid mode"); p->f = l_popen(L, filename, mode); p->closef = &io_pclose; return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; diff --git a/Build/source/libs/lua53/lua53-src/src/llex.c b/Build/source/libs/lua53/lua53-src/src/llex.c index 66fd411ba9d..b6d9a465fe4 100644 --- a/Build/source/libs/lua53/lua53-src/src/llex.c +++ b/Build/source/libs/lua53/lua53-src/src/llex.c @@ -244,12 +244,12 @@ static int read_numeral (LexState *ls, SemInfo *seminfo) { /* -** skip a sequence '[=*[' or ']=*]'; if sequence is well formed, return -** its number of '='s; otherwise, return a negative number (-1 iff there -** are no '='s after initial bracket) +** reads a sequence '[=*[' or ']=*]', leaving the last bracket. +** If sequence is well formed, return its number of '='s + 2; otherwise, +** return 1 if there is no '='s or 0 otherwise (an unfinished '[==...'). */ -static int skip_sep (LexState *ls) { - int count = 0; +static size_t skip_sep (LexState *ls) { + size_t count = 0; int s = ls->current; lua_assert(s == '[' || s == ']'); save_and_next(ls); @@ -257,11 +257,14 @@ static int skip_sep (LexState *ls) { save_and_next(ls); count++; } - return (ls->current == s) ? count : (-count) - 1; + return (ls->current == s) ? count + 2 + : (count == 0) ? 1 + : 0; + } -static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { +static void read_long_string (LexState *ls, SemInfo *seminfo, size_t sep) { int line = ls->linenumber; /* initial line (for error message) */ save_and_next(ls); /* skip 2nd '[' */ if (currIsNewline(ls)) /* string starts with a newline? */ @@ -295,8 +298,8 @@ static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { } } endloop: if (seminfo) - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), - luaZ_bufflen(ls->buff) - 2*(2 + sep)); + seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + sep, + luaZ_bufflen(ls->buff) - 2 * sep); } @@ -444,9 +447,9 @@ static int llex (LexState *ls, SemInfo *seminfo) { /* else is a comment */ next(ls); if (ls->current == '[') { /* long comment? */ - int sep = skip_sep(ls); + size_t sep = skip_sep(ls); luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ - if (sep >= 0) { + if (sep >= 2) { read_long_string(ls, NULL, sep); /* skip long comment */ luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ break; @@ -458,12 +461,12 @@ static int llex (LexState *ls, SemInfo *seminfo) { break; } case '[': { /* long string or simply '[' */ - int sep = skip_sep(ls); - if (sep >= 0) { + size_t sep = skip_sep(ls); + if (sep >= 2) { read_long_string(ls, seminfo, sep); return TK_STRING; } - else if (sep != -1) /* '[=...' missing second bracket */ + else if (sep == 0) /* '[=...' missing second bracket */ lexerror(ls, "invalid long string delimiter", TK_STRING); return '['; } diff --git a/Build/source/libs/lua53/lua53-src/src/lobject.c b/Build/source/libs/lua53/lua53-src/src/lobject.c index 2218c8cdd77..355bf58d637 100644 --- a/Build/source/libs/lua53/lua53-src/src/lobject.c +++ b/Build/source/libs/lua53/lua53-src/src/lobject.c @@ -266,7 +266,7 @@ static const char *l_str2dloc (const char *s, lua_Number *result, int mode) { ** - 'n'/'N' means 'inf' or 'nan' (which should be rejected) ** - '.' just optimizes the search for the common case (nothing special) ** This function accepts both the current locale or a dot as the radix -** mark. If the convertion fails, it may mean number has a dot but +** mark. If the conversion fails, it may mean number has a dot but ** locale accepts something else. In that case, the code copies 's' ** to a buffer (because 's' is read-only), changes the dot to the ** current locale radix mark, and tries to convert again. diff --git a/Build/source/libs/lua53/lua53-src/src/lparser.c b/Build/source/libs/lua53/lua53-src/src/lparser.c index cc54de43c63..2f41e00b803 100644 --- a/Build/source/libs/lua53/lua53-src/src/lparser.c +++ b/Build/source/libs/lua53/lua53-src/src/lparser.c @@ -544,6 +544,7 @@ static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { fs->bl = NULL; f = fs->f; f->source = ls->source; + luaC_objbarrier(ls->L, f, f->source); f->maxstacksize = 2; /* registers 0/1 are always valid */ enterblock(fs, bl, 0); } @@ -1616,6 +1617,7 @@ static void mainfunc (LexState *ls, FuncState *fs) { fs->f->is_vararg = 1; /* main function is always declared vararg */ init_exp(&v, VLOCAL, 0); /* create and... */ newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ + luaC_objbarrier(ls->L, fs->f, ls->envn); luaX_next(ls); /* read first token */ statlist(ls); /* parse main body */ check(ls, TK_EOS); @@ -1634,6 +1636,7 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, sethvalue(L, L->top, lexstate.h); /* anchor it */ luaD_inctop(L); funcstate.f = cl->p = luaF_newproto(L); + luaC_objbarrier(L, cl, cl->p); funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ lexstate.buff = buff; diff --git a/Build/source/libs/lua53/lua53-src/src/lua.h b/Build/source/libs/lua53/lua53-src/src/lua.h index c236e360957..9394c5ef8fd 100644 --- a/Build/source/libs/lua53/lua53-src/src/lua.h +++ b/Build/source/libs/lua53/lua53-src/src/lua.h @@ -1,5 +1,4 @@ /* -** $Id: lua.h,v 1.332.1.2 2018/06/13 16:58:17 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 +18,11 @@ #define LUA_VERSION_MAJOR "5" #define LUA_VERSION_MINOR "3" #define LUA_VERSION_NUM 503 -#define LUA_VERSION_RELEASE "5" +#define LUA_VERSION_RELEASE "6" #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-2018 Lua.org, PUC-Rio" +#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2020 Lua.org, PUC-Rio" #define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" @@ -460,7 +459,7 @@ struct lua_Debug { /****************************************************************************** -* Copyright (C) 1994-2018 Lua.org, PUC-Rio. +* Copyright (C) 1994-2020 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 diff --git a/Build/source/libs/lua53/lua53-src/src/lundump.c b/Build/source/libs/lua53/lua53-src/src/lundump.c index 7a67d75aaa0..edf9eb8d008 100644 --- a/Build/source/libs/lua53/lua53-src/src/lundump.c +++ b/Build/source/libs/lua53/lua53-src/src/lundump.c @@ -85,8 +85,10 @@ static lua_Integer LoadInteger (LoadState *S) { } -static TString *LoadString (LoadState *S) { +static TString *LoadString (LoadState *S, Proto *p) { + lua_State *L = S->L; size_t size = LoadByte(S); + TString *ts; if (size == 0xFF) LoadVar(S, size); if (size == 0) @@ -94,13 +96,17 @@ static TString *LoadString (LoadState *S) { else if (--size <= LUAI_MAXSHORTLEN) { /* short string? */ char buff[LUAI_MAXSHORTLEN]; LoadVector(S, buff, size); - return luaS_newlstr(S->L, buff, size); + ts = luaS_newlstr(L, buff, size); } else { /* long string */ - TString *ts = luaS_createlngstrobj(S->L, size); + ts = luaS_createlngstrobj(L, size); + setsvalue2s(L, L->top, ts); /* anchor it ('loadVector' can GC) */ + luaD_inctop(L); LoadVector(S, getstr(ts), size); /* load directly in final place */ - return ts; + L->top--; /* pop string */ } + luaC_objbarrier(L, p, ts); + return ts; } @@ -140,7 +146,7 @@ static void LoadConstants (LoadState *S, Proto *f) { break; case LUA_TSHRSTR: case LUA_TLNGSTR: - setsvalue2n(S->L, o, LoadString(S)); + setsvalue2n(S->L, o, LoadString(S, f)); break; default: lua_assert(0); @@ -158,6 +164,7 @@ static void LoadProtos (LoadState *S, Proto *f) { f->p[i] = NULL; for (i = 0; i < n; i++) { f->p[i] = luaF_newproto(S->L); + luaC_objbarrier(S->L, f, f->p[i]); LoadFunction(S, f->p[i], f->source); } } @@ -189,18 +196,18 @@ static void LoadDebug (LoadState *S, Proto *f) { for (i = 0; i < n; i++) f->locvars[i].varname = NULL; for (i = 0; i < n; i++) { - f->locvars[i].varname = LoadString(S); + f->locvars[i].varname = LoadString(S, f); f->locvars[i].startpc = LoadInt(S); f->locvars[i].endpc = LoadInt(S); } n = LoadInt(S); for (i = 0; i < n; i++) - f->upvalues[i].name = LoadString(S); + f->upvalues[i].name = LoadString(S, f); } static void LoadFunction (LoadState *S, Proto *f, TString *psource) { - f->source = LoadString(S); + f->source = LoadString(S, f); if (f->source == NULL) /* no source in dump? */ f->source = psource; /* reuse parent's source */ f->linedefined = LoadInt(S); @@ -271,6 +278,7 @@ LClosure *luaU_undump(lua_State *L, ZIO *Z, const char *name) { setclLvalue(L, L->top, cl); luaD_inctop(L); cl->p = luaF_newproto(L); + luaC_objbarrier(L, cl, cl->p); LoadFunction(&S, cl->p, NULL); lua_assert(cl->nupvalues == cl->p->sizeupvalues); luai_verifycode(L, buff, cl->p); diff --git a/Build/source/libs/lua53/version.ac b/Build/source/libs/lua53/version.ac index 28471aa30ed..8f8ce37b44e 100644 --- a/Build/source/libs/lua53/version.ac +++ b/Build/source/libs/lua53/version.ac @@ -8,4 +8,4 @@ dnl dnl -------------------------------------------------------- dnl dnl m4-include this file to define the current lua53 version -m4_define([lua53_version], [5.3.5]) +m4_define([lua53_version], [5.3.6]) |