summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/libs/lua53/ChangeLog4
-rw-r--r--Build/source/libs/lua53/TLpatches/ChangeLog4
-rw-r--r--Build/source/libs/lua53/TLpatches/patch-01-utf-85
-rw-r--r--Build/source/libs/lua53/TLpatches/patch-02-FreeBSD5
-rw-r--r--Build/source/libs/lua53/TLpatches/patch-03-export11
-rwxr-xr-xBuild/source/libs/lua53/configure24
-rw-r--r--Build/source/libs/lua53/lua53-src/Makefile2
-rw-r--r--Build/source/libs/lua53/lua53-src/README2
-rw-r--r--Build/source/libs/lua53/lua53-src/doc/contents.html37
-rw-r--r--Build/source/libs/lua53/lua53-src/doc/manual.html6
-rw-r--r--Build/source/libs/lua53/lua53-src/doc/readme.html8
-rw-r--r--Build/source/libs/lua53/lua53-src/src/Makefile2
-rw-r--r--Build/source/libs/lua53/lua53-src/src/lapi.c12
-rw-r--r--Build/source/libs/lua53/lua53-src/src/lauxlib.c9
-rw-r--r--Build/source/libs/lua53/lua53-src/src/lcode.c2
-rw-r--r--Build/source/libs/lua53/lua53-src/src/ldebug.c7
-rw-r--r--Build/source/libs/lua53/lua53-src/src/liolib.c2
-rw-r--r--Build/source/libs/lua53/lua53-src/src/liolib.c.orig2
-rw-r--r--Build/source/libs/lua53/lua53-src/src/llex.c31
-rw-r--r--Build/source/libs/lua53/lua53-src/src/lobject.c2
-rw-r--r--Build/source/libs/lua53/lua53-src/src/lparser.c3
-rw-r--r--Build/source/libs/lua53/lua53-src/src/lua.h7
-rw-r--r--Build/source/libs/lua53/lua53-src/src/lundump.c24
-rw-r--r--Build/source/libs/lua53/version.ac2
-rw-r--r--Build/source/texk/web2c/luatexdir/ChangeLog40
-rw-r--r--Build/source/texk/web2c/luatexdir/font/luatexfont.h11
-rw-r--r--Build/source/texk/web2c/luatexdir/font/tounicode.c60
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writefont.c18
-rw-r--r--Build/source/texk/web2c/luatexdir/font/writet3.c182
-rw-r--r--Build/source/texk/web2c/luatexdir/image/pdftoepdf.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writeimg.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/liolibext.c184
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c41
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/ltexlib.c183
-rw-r--r--Build/source/texk/web2c/luatexdir/lua/luatex-api.h9
-rw-r--r--Build/source/texk/web2c/luatexdir/luatex_svnversion.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/luatexcallbackids.h1
-rw-r--r--Build/source/texk/web2c/luatexdir/pdf/pdfgen.c42
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/errors.c20
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.c15
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mlist.c37
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.c4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.c16
45 files changed, 788 insertions, 298 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 &copy; 2015&ndash;2018 Lua.org, PUC-Rio.
+Copyright &copy; 2015&ndash;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 &copy; 2015&ndash;2018 Lua.org, PUC-Rio.
+Copyright &copy; 2015&ndash;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">&sect;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 &copy; 1994&ndash;2017 Lua.org, PUC-Rio.
+Copyright &copy; 1994&ndash;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])
diff --git a/Build/source/texk/web2c/luatexdir/ChangeLog b/Build/source/texk/web2c/luatexdir/ChangeLog
index 92bcb391a3d..441b3e06ff7 100644
--- a/Build/source/texk/web2c/luatexdir/ChangeLog
+++ b/Build/source/texk/web2c/luatexdir/ChangeLog
@@ -1,3 +1,43 @@
+2020-07-26 Luigi Scarso <luigi.scarso@gmail.com>
+ * fixed: \tracinglostchars>=3 is an error (no fatal error)
+
+2020-07-26 Luigi Scarso <luigi.scarso@gmail.com>
+ * New value for \tracinglostchars: \tracinglostchars>=3 is a fatal error
+
+2020-07-12 Luigi Scarso <luigi.scarso@gmail.com>
+ * Original reports:
+ https://tex.stackexchange.com/questions/551313/
+ https://tug.org/pipermail/tex-live/2020-June/045876.html
+
+ This will probably be fixed by DEK in the 2021 tuneup in a different
+ way (so we'll have to remove or alter this change), but the interaction
+ sequence in the reports above causes a segmentation fault in web2c -
+ writing to the closed \write15 stream because we wrongly decrement
+ selector from 16 to 15 in term_input, due to the lack of this check in
+ recursive error() call (K. Berry)
+
+
+2020-07-04 Luigi Scarso <luigi.scarso@gmail.com>
+ * little endian variants for readers. (HH)
+ * The keyword \type {norule} will hide the rule with the above variants while
+ keeping the rule related spacing. (HH)
+
+2020-06-21 Luigi Scarso <luigi.scarso@gmail.com>
+ * pending better is_defined check plus an extra option in a scanner; also the \cs case. (HH)
+ * tex.getmark(what,wherefrom) added (HH)
+
+2020-05-01 Luigi Scarso <luigi.scarso@gmail.com>
+ * added tex.interlinepenalties tex.clubpenalties tex.widowpenalties
+ tex.displaywidowpenalties to complement tex.parshape (HH)
+
+2020-04-28 Luigi Scarso <luigi.scarso@gmail.com>
+ * less strict lastnode testing (HH)
+ * some experimental math delimiter code removed (HH)
+
+2020-04-27 Luigi Scarso <luigi.scarso@gmail.com>
+ * similar treatment for shiftdown as shiftup in operators (no
+ checking) (HH)
+
2020-04-07 Luigi Scarso <luigi.scarso@gmail.com>
* Version 1.13.0.
getstring extra argument to pdfe.getstring (triggers unencoded or flag
diff --git a/Build/source/texk/web2c/luatexdir/font/luatexfont.h b/Build/source/texk/web2c/luatexdir/font/luatexfont.h
index 5eb6a5bd94e..c60fc4a91f9 100644
--- a/Build/source/texk/web2c/luatexdir/font/luatexfont.h
+++ b/Build/source/texk/web2c/luatexdir/font/luatexfont.h
@@ -119,9 +119,10 @@ typedef struct {
/* tounicode.c */
int write_cid_tounicode(PDF, fo_entry *, internal_font_number);
-void glyph_unicode_free(void);
-void def_tounicode(str_number, str_number);
int write_tounicode(PDF, char **, char *);
+int write_raw_tounicode(PDF, internal_font_number, char *);
+void def_tounicode(str_number, str_number);
+void glyph_unicode_free(void);
/* vfpacket.c */
@@ -143,6 +144,7 @@ void writetype0(PDF pdf, fd_entry * fd);
/* writefont.c */
void do_pdf_font(PDF, internal_font_number);
+int do_pdf_preroll_font(PDF, internal_font_number);
fd_entry *lookup_fd_entry(char *);
fd_entry *new_fd_entry(internal_font_number);
void write_fontstuff(PDF);
@@ -194,7 +196,10 @@ internal_font_number copy_font_info(internal_font_number f);
/* writet3.c */
extern FILE *t3_file;
-void writet3(PDF, internal_font_number);
+
+void writet3pk(PDF, internal_font_number);
+void prerollt3user(PDF, internal_font_number);
+void writet3user(PDF, internal_font_number);
extern unsigned char *t3_buffer;
extern int t3_size;
diff --git a/Build/source/texk/web2c/luatexdir/font/tounicode.c b/Build/source/texk/web2c/luatexdir/font/tounicode.c
index 32210600c21..b1e08e7cebd 100644
--- a/Build/source/texk/web2c/luatexdir/font/tounicode.c
+++ b/Build/source/texk/web2c/luatexdir/font/tounicode.c
@@ -305,22 +305,30 @@ static void set_cid_glyph_unicode(long index, glyph_unicode_entry * gp, internal
}
*/
-int write_tounicode(PDF pdf, char **glyph_names, char *name)
+static int do_write_tounicode(PDF pdf, char **glyph_names, char *name, internal_font_number f)
{
- char buf[SMALL_BUF_SIZE], *p;
+ char buf[SMALL_BUF_SIZE], *p, *s;
static char builtin_suffix[] = "-builtin";
short range_size[257];
glyph_unicode_entry gtab[257];
int objnum;
int i, j;
int bfchar_count, bfrange_count, subrange_count;
- assert(strlen(name) + strlen(builtin_suffix) < SMALL_BUF_SIZE);
if (glyph_unicode_tree == NULL) {
pdf->gen_tounicode = 0;
return 0;
}
- strcpy(buf, name);
- if ((p = strrchr(buf, '.')) != NULL && strcmp(p, ".enc") == 0) {
+ if (name == NULL) {
+ strcpy(buf, "no-name");
+ } else {
+ strcpy(buf, name);
+ }
+ if (f) {
+ /*tex
+ Always.
+ */
+ strcat(buf, builtin_suffix);
+ } else if ((p = strrchr(buf, '.')) != NULL && strcmp(p, ".enc") == 0) {
/*tex
Strip |.enc| from encoding name.
*/
@@ -332,6 +340,29 @@ int write_tounicode(PDF pdf, char **glyph_names, char *name)
*/
strcat(buf, builtin_suffix);
}
+ /*tex Set gtab: */
+ if (f) {
+ int done = 0 ;
+ for (i = 0; i < 256; ++i) {
+ if ((s = get_charinfo_tounicode(char_info(f,(int)i))) != NULL) {
+ gtab[i].code = UNI_EXTRA_STRING;
+ gtab[i].unicode_seq = xstrdup(s);
+ done = 1 ;
+ } else {
+ gtab[i].code = UNI_UNDEF;
+ }
+ }
+ if (! done) {
+ return 0;
+ }
+ } else {
+ for (i = 0; i < 256; ++i) {
+ gtab[i].code = UNI_UNDEF;
+ set_glyph_unicode(glyph_names[i], &gtab[i]);
+ }
+ }
+ gtab[256].code = UNI_UNDEF;
+ /* */
objnum = pdf_create_obj(pdf, obj_type_others, 0);
pdf_begin_obj(pdf, objnum, OBJSTM_NEVER);
pdf_begin_dict(pdf);
@@ -359,12 +390,6 @@ int write_tounicode(PDF pdf, char **glyph_names, char *name)
"1 begincodespacerange\n"
"<00> <FF>\n" "endcodespacerange\n",
buf, buf, buf, buf, buf);
- /*tex Set gtab: */
- for (i = 0; i < 256; ++i) {
- gtab[i].code = UNI_UNDEF;
- set_glyph_unicode(glyph_names[i], &gtab[i]);
- }
- gtab[256].code = UNI_UNDEF;
/*tex Set |range_size|: */
for (i = 0; i < 256;) {
if (gtab[i].code == UNI_STRING || gtab[i].code == UNI_EXTRA_STRING) {
@@ -414,8 +439,7 @@ int write_tounicode(PDF pdf, char **glyph_names, char *name)
while (range_size[i] <= 1 && i < 256)
i++;
assert(i < 256);
- pdf_printf(pdf, "<%02X> <%02X> <%s>\n", i, i + range_size[i] - 1,
- utf16be_str(gtab[i].code));
+ pdf_printf(pdf, "<%02X> <%02X> <%s>\n", i, i + range_size[i] - 1, utf16be_str(gtab[i].code));
i += range_size[i];
}
pdf_printf(pdf, "endbfrange\n");
@@ -467,6 +491,16 @@ int write_tounicode(PDF pdf, char **glyph_names, char *name)
return objnum;
}
+int write_tounicode(PDF pdf, char **glyph_names, char *name)
+{
+ return do_write_tounicode(pdf, glyph_names, name, 0);
+}
+
+int write_raw_tounicode(PDF pdf, internal_font_number f, char *name)
+{
+ return do_write_tounicode(pdf, NULL, name, f);
+}
+
int write_cid_tounicode(PDF pdf, fo_entry * fo, internal_font_number f)
{
static int range_size[65537];
diff --git a/Build/source/texk/web2c/luatexdir/font/writefont.c b/Build/source/texk/web2c/luatexdir/font/writefont.c
index b367fa2bf85..13fa8b7543d 100644
--- a/Build/source/texk/web2c/luatexdir/font/writefont.c
+++ b/Build/source/texk/web2c/luatexdir/font/writefont.c
@@ -851,13 +851,27 @@ void do_pdf_font(PDF pdf, internal_font_number f)
create_cid_fontdictionary(pdf, f);
} else {
/*tex By now |font_map(f)|, if any, should have been set via |pdf_init_font|. */
- if ((fm = font_map(f)) == NULL || (fm->ps_name == NULL && fm->ff_name == NULL))
- writet3(pdf, f);
+ if (font_psname(f) != NULL && strstr(font_psname(f),"none"))
+ writet3user(pdf, f);
+ else if ((fm = font_map(f)) == NULL || (fm->ps_name == NULL && fm->ff_name == NULL))
+ writet3pk(pdf, f);
else
create_fontdictionary(pdf, f);
}
}
+int do_pdf_preroll_font(PDF pdf, internal_font_number f)
+{
+ if (!font_has_subset(f)) {
+ return 0;
+ } else if (font_encodingbytes(f) != 2 && font_psname(f) != NULL && strstr(font_psname(f),"none")) {
+ prerollt3user(pdf, f);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
/*tex
The glyph width is included in |glw_entry|, because that width depends on the
diff --git a/Build/source/texk/web2c/luatexdir/font/writet3.c b/Build/source/texk/web2c/luatexdir/font/writet3.c
index 6121c24a1f0..693bb0c6ef9 100644
--- a/Build/source/texk/web2c/luatexdir/font/writet3.c
+++ b/Build/source/texk/web2c/luatexdir/font/writet3.c
@@ -31,14 +31,12 @@ typedef char t3_line_entry;
define_array(t3_line);
FILE *t3_file;
-static boolean t3_image_used;
static int t3_char_procs[256];
-static float t3_char_widths[256];
+static double t3_char_widths[256];
static int t3_glyph_num;
-static float t3_font_scale;
+static double t3_font_scale;
static int t3_b0, t3_b1, t3_b2, t3_b3;
-static boolean is_pk_font;
/*tex Not static because used elsewhere. */
@@ -135,8 +133,6 @@ static boolean writepk(PDF pdf, internal_font_number f)
t3_read_file();
t3_close();
}
- t3_image_used = true;
- is_pk_font = true;
report_start_file(filetype_font,(char *) name);
cd.rastersize = 256;
cd.raster = xtalloc((unsigned long) cd.rastersize, halfword);
@@ -150,7 +146,7 @@ static boolean writepk(PDF pdf, internal_font_number f)
check_preamble = false;
if (!pdf_char_marked(f, cd.charcode))
continue;
- t3_char_widths[cd.charcode] = (float) pk_char_width(pdf, f, get_charwidth(f, cd.charcode), pdf->pk_scale_factor);
+ t3_char_widths[cd.charcode] = (double) pk_char_width(pdf, f, get_charwidth(f, cd.charcode), pdf->pk_scale_factor);
if (cd.cwidth < 1 || cd.cheight < 1) {
cd.xescape = cd.cwidth = round(t3_char_widths[cd.charcode] / 100.0);
cd.cheight = 1;
@@ -206,35 +202,86 @@ static boolean writepk(PDF pdf, internal_font_number f)
return true;
}
-void writet3(PDF pdf, internal_font_number f)
+/*tex
+
+ Mode |0| is traditional pk with map file lookup, while mode |1| listens to
+ the callback. The callback gets a font id and character number and returns an
+ object number of a stream object plus the width that ends up in the widths
+ array. The stream can of course refer to another xform but it has to start
+ with the right sequence for being a character. As there are different
+ situations this is more flexible that hardcoding all kind of variants that
+ will never suit all possible purposes.
+
+ The next ones are a bit strange. We could as well have had one callback that
+ just generates the whole type 3 but I think that the assumption is that
+ \LUATEX\ should do the work. So, instead we have one callback that is invoked
+ with several intentions as indicated by the first argument.
+
+*/
+
+static void writet3(PDF pdf, internal_font_number f, int callback_id)
{
int i;
char s[32];
int wptr, eptr, cptr;
int first_char, last_char;
int pk_font_scale;
+ int tounicode_objnum = 0;
pdffloat pf;
boolean is_notdef;
t3_glyph_num = 0;
- t3_image_used = false;
for (i = 0; i < 256; i++) {
t3_char_procs[i] = 0;
t3_char_widths[i] = 0;
}
- is_pk_font = false;
xfree(t3_buffer);
t3_curbyte = 0;
t3_size = 0;
- if (!writepk(pdf, f))
- return;
- for (i = font_bc(f); i <= font_ec(f); i++)
- if (pdf_char_marked(f, i))
+ for (i = font_bc(f); i <= font_ec(f); i++) {
+ if (pdf_char_marked(f, i)) {
break;
+ }
+ }
first_char = i;
- for (i = font_ec(f); i > first_char; i--)
- if (pdf_char_marked(f, i))
+ for (i = font_ec(f); i > first_char; i--) {
+ if (pdf_char_marked(f, i)) {
break;
+ }
+ }
last_char = i;
+ if (callback_id > 0) {
+ /*tex We assume a user font. */
+ for (i = first_char; i <= last_char; i++) {
+ if (pdf_char_marked(f, i)) {
+ int r = 0;
+ double w = 0;
+ /*tex
+ We pass |2|, the font id, the character index, and we expect
+ back a width in basepoints, an object number of a stream, and
+ an objectnumber of an xobject used where zero means nothing is
+ used.
+ */
+ run_callback(callback_id, "ddd->df", 2, f, i, &r, &w);
+ if (r > 0) {
+ t3_char_procs[i] = r;
+ t3_char_widths[i] = w;
+ }
+ }
+ }
+ t3_font_scale = 0.001;
+ t3_b0 = 0;
+ t3_b1 = 0;
+ t3_b2 = 0;
+ t3_b3 = 0;
+ } else if (writepk(pdf, f)) {
+ /*tex We assume a pk font. */
+ } else {
+ /*tex We just quit. */
+ return;
+ }
+ if (pdf->gen_tounicode > 0) {
+ tounicode_objnum = write_raw_tounicode(pdf, f, font_fullname(f));
+ }
/*tex We create a |Type3| font dictionary: */
pdf_begin_obj(pdf, pdf_font_num(f), OBJSTM_ALWAYS);
pdf_begin_dict(pdf);
@@ -247,22 +294,6 @@ void writet3(PDF pdf, internal_font_number f)
pdf_print(pdf, pdf_font_attr(f));
pdf_out(pdf, '\n');
}
- if (is_pk_font) {
- pk_font_scale = get_pk_font_scale(pdf,f,pdf->pk_scale_factor);
- pdf_add_name(pdf, "FontMatrix");
- pdf_begin_array(pdf);
- setpdffloat(pf, (int64_t) pk_font_scale, 5);
- print_pdffloat(pdf, pf);
- pdf_puts(pdf, " 0 0 ");
- print_pdffloat(pdf, pf);
- pdf_puts(pdf, " 0 0");
- pdf_end_array(pdf);
- } else {
- pdf_add_name(pdf, "FontMatrix");
- pdf_begin_array(pdf);
- pdf_printf(pdf, "%g 0 0 %g 0 0", (double) t3_font_scale, (double) t3_font_scale);
- pdf_end_array(pdf);
- }
pdf_add_name(pdf, font_key[FONTBBOX1_CODE].pdfname);
pdf_begin_array(pdf);
pdf_add_int(pdf, (int) t3_b0);
@@ -271,15 +302,56 @@ void writet3(PDF pdf, internal_font_number f)
pdf_add_int(pdf, (int) t3_b3);
pdf_end_array(pdf);
pdf_add_name(pdf, "Resources");
+ /*tex
+ This is not mandate but we just set them all. They are ignored anyway. In
+ PDF version 2 they are even obsolete but then, unknown entries are again
+ ignored.
+ */
pdf_begin_dict(pdf);
pdf_add_name(pdf, "ProcSet");
pdf_begin_array(pdf);
pdf_add_name(pdf, "PDF");
- if (t3_image_used) {
- pdf_add_name(pdf, "ImageB");
+ pdf_add_name(pdf, "ImageB");
+ if (callback_id) {
+ pdf_add_name(pdf, "ImageC");
+ pdf_add_name(pdf, "ImageI");
+ pdf_add_name(pdf, "Text");
}
pdf_end_array(pdf);
- pdf_end_dict(pdf);
+ /*tex
+ A previous version had two calls that dealt with adding font resources and
+ xform references and a separate one for the font matrix but we now delegate
+ some stupid work to the caller and have all in one: we expect a matrix and
+ a resource string.
+ */
+ if (callback_id > 0) {
+ char *str = NULL;
+ double s = t3_font_scale;
+ run_callback(callback_id, "dd->fR", 3, f, &s, &str);
+ t3_font_scale = s;
+ if (str != NULL) {
+ pdf_out(pdf, ' ');
+ pdf_puts(pdf, str);
+ free(str);
+ }
+ pdf_end_dict(pdf); /*tex The resources. */
+ pdf_add_name(pdf, "FontMatrix");
+ pdf_begin_array(pdf);
+ pdf_printf(pdf, "%g 0 0 %g 0 0", t3_font_scale, t3_font_scale);
+ pdf_end_array(pdf);
+ } else {
+ pdf_end_dict(pdf); /*tex The resources. */
+ pk_font_scale = get_pk_font_scale(pdf,f,pdf->pk_scale_factor);
+ pdf_add_name(pdf, "FontMatrix");
+ pdf_begin_array(pdf);
+ setpdffloat(pf, (int64_t) pk_font_scale, 5);
+ print_pdffloat(pdf, pf);
+ pdf_puts(pdf, " 0 0 ");
+ print_pdffloat(pdf, pf);
+ pdf_puts(pdf, " 0 0");
+ pdf_end_array(pdf);
+ }
+ /*tex Some preparations. */
pdf_dict_add_int(pdf, "FirstChar", first_char);
pdf_dict_add_int(pdf, "LastChar", last_char);
wptr = pdf_create_obj(pdf, obj_type_others, 0);
@@ -288,20 +360,23 @@ void writet3(PDF pdf, internal_font_number f)
pdf_dict_add_ref(pdf, "Widths", (int) wptr);
pdf_dict_add_ref(pdf, "Encoding", (int) eptr);
pdf_dict_add_ref(pdf, "CharProcs", (int) cptr);
+ if (tounicode_objnum) {
+ pdf_dict_add_ref(pdf, "ToUnicode", tounicode_objnum);
+ }
pdf_end_dict(pdf);
pdf_end_obj(pdf);
/*tex The |Widths| array: */
pdf_begin_obj(pdf, wptr, OBJSTM_ALWAYS);
pdf_begin_array(pdf);
- if (is_pk_font) {
+ if (callback_id) {
for (i = first_char; i <= last_char; i++) {
- setpdffloat(pf, (int64_t) t3_char_widths[i], 2);
- print_pdffloat(pdf, pf);
- pdf_out(pdf, ' ');
+ pdf_printf(pdf, " %g", t3_char_widths[i]);
}
} else {
for (i = first_char; i <= last_char; i++) {
- pdf_add_int(pdf, (int) t3_char_widths[i]);
+ setpdffloat(pf, (int64_t) t3_char_widths[i], 2);
+ print_pdffloat(pdf, pf);
+ pdf_out(pdf, ' ');
}
}
pdf_end_array(pdf);
@@ -354,3 +429,30 @@ void writet3(PDF pdf, internal_font_number f)
report_stop_file(filetype_font);
cur_file_name = NULL;
}
+
+void writet3pk(PDF pdf, internal_font_number f)
+{
+ writet3(pdf, f, 0);
+}
+
+void prerollt3user(PDF pdf, internal_font_number f)
+{
+ int callback_id = callback_defined(provide_charproc_data_callback);
+ if (callback_id > 0) {
+ int i;
+ for (i = font_bc(f); i <= font_ec(f); i++) {
+ if (pdf_char_marked(f, i)) {
+ /*tex We pass |true|, the font id and the character index. */
+ run_callback(callback_id, "ddd->", 1, f, i);
+ }
+ }
+ }
+}
+
+void writet3user(PDF pdf, internal_font_number f)
+{
+ int callback_id = callback_defined(provide_charproc_data_callback);
+ if (callback_id) {
+ writet3(pdf, f, callback_id);
+ }
+}
diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c
index a43f1dac4cc..78dab3a37b3 100644
--- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c
+++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.c
@@ -665,7 +665,7 @@ void read_pdf_info(image_dict * idict)
then have to changed drastically anyway.
*/
pdf_major_version_found = ppdoc_version_number(pdfe,&pdf_minor_version_found);
- if ((100 * pdf_major_version_found + pdf_major_version_found) > (100 * img_pdfmajorversion(idict) + img_pdfminorversion(idict))) {
+ if ((100 * pdf_major_version_found + pdf_minor_version_found) > (100 * img_pdfmajorversion(idict) + img_pdfminorversion(idict))) {
const char *msg = "PDF inclusion: found PDF version '%d.%d', but at most version '%d.%d' allowed";
if (img_errorlevel(idict) > 0) {
formatted_error("pdf inclusion",msg, pdf_major_version_found, pdf_minor_version_found, img_pdfmajorversion(idict), img_pdfminorversion(idict));
diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.c b/Build/source/texk/web2c/luatexdir/image/writeimg.c
index 7fe8444bced..f544e6b6814 100644
--- a/Build/source/texk/web2c/luatexdir/image/writeimg.c
+++ b/Build/source/texk/web2c/luatexdir/image/writeimg.c
@@ -130,7 +130,7 @@ static void check_type_by_header(image_dict * idict)
static void check_type_by_extension(image_dict * idict)
{
char *image_suffix;
- if (idict != NULL)
+ if (idict == NULL)
return;
if (img_type(idict) != IMG_TYPE_NONE)
return;
diff --git a/Build/source/texk/web2c/luatexdir/lua/liolibext.c b/Build/source/texk/web2c/luatexdir/lua/liolibext.c
index 2de67f8fe29..ce1e78f6c73 100644
--- a/Build/source/texk/web2c/luatexdir/lua/liolibext.c
+++ b/Build/source/texk/web2c/luatexdir/lua/liolibext.c
@@ -145,6 +145,17 @@ static int readcardinal2(lua_State *L) {
lua_pushinteger(L, 0x100 * a + b);
return 1;
}
+static int readcardinal2_le(lua_State *L) {
+ FILE *f = tofile(L);
+ int b = getc(f);
+ int a = getc(f);
+ if (a == EOF)
+ lua_pushnil(L);
+ else
+ /* (a<<8) | b */
+ lua_pushinteger(L, 0x100 * a + b);
+ return 1;
+}
static int readcardinal2_s(lua_State *L) {
size_t l;
@@ -159,6 +170,19 @@ static int readcardinal2_s(lua_State *L) {
}
return 1;
}
+static int readcardinal2_s_le(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p+1 >= l) {
+ lua_pushnil(L);
+ } else {
+ int b = uchar(s[p++]);
+ int a = uchar(s[p]);
+ lua_pushinteger(L, 0x100 * a + b);
+ }
+ return 1;
+}
static int readcardinal3(lua_State *L) {
FILE *f = tofile(L);
@@ -172,6 +196,18 @@ static int readcardinal3(lua_State *L) {
lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
return 1;
}
+static int readcardinal3_le(lua_State *L) {
+ FILE *f = tofile(L);
+ int c = getc(f);
+ int b = getc(f);
+ int a = getc(f);
+ if (a == EOF)
+ lua_pushnil(L);
+ else
+ /* (a<<16) | (b<<8) | c */
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
+ return 1;
+}
static int readcardinal3_s(lua_State *L) {
size_t l;
@@ -187,6 +223,20 @@ static int readcardinal3_s(lua_State *L) {
}
return 1;
}
+static int readcardinal3_s_le(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p+2 >= l) {
+ lua_pushnil(L);
+ } else {
+ int c = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int a = uchar(s[p]);
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
+ }
+ return 1;
+}
static int readcardinal4(lua_State *L) {
FILE *f = tofile(L);
@@ -201,6 +251,19 @@ static int readcardinal4(lua_State *L) {
lua_pushinteger(L,0x1000000 * a + 0x10000 * b + 0x100 * c + d);
return 1;
}
+static int readcardinal4_le(lua_State *L) {
+ FILE *f = tofile(L);
+ int d = getc(f);
+ int c = getc(f);
+ int b = getc(f);
+ int a = getc(f);
+ if (a == EOF)
+ lua_pushnil(L);
+ else
+ /* (a<<24) | (b<<16) | (c<<8) | d */
+ lua_pushinteger(L,0x1000000 * a + 0x10000 * b + 0x100 * c + d);
+ return 1;
+}
static int readcardinal4_s(lua_State *L) {
size_t l;
@@ -217,6 +280,21 @@ static int readcardinal4_s(lua_State *L) {
}
return 1;
}
+static int readcardinal4_s_le(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p+3 >= l) {
+ lua_pushnil(L);
+ } else {
+ int d = uchar(s[p++]);
+ int c = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int a = uchar(s[p]);
+ lua_pushinteger(L,0x1000000 * a + 0x10000 * b + 0x100 * c + d);
+ }
+ return 1;
+}
static int readcardinaltable(lua_State *L) {
FILE *f = tofile(L);
@@ -391,6 +469,18 @@ static int readinteger2(lua_State *L) {
lua_pushinteger(L, 0x100 * a + b);
return 1;
}
+static int readinteger2_le(lua_State *L) {
+ FILE *f = tofile(L);
+ int b = getc(f);
+ int a = getc(f);
+ if (a == EOF)
+ lua_pushnil(L);
+ else if (a >= 0x80)
+ lua_pushinteger(L, 0x100 * a + b - 0x10000);
+ else
+ lua_pushinteger(L, 0x100 * a + b);
+ return 1;
+}
static int readinteger2_s(lua_State *L) {
size_t l;
@@ -408,6 +498,22 @@ static int readinteger2_s(lua_State *L) {
}
return 1;
}
+static int readinteger2_s_le(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p+1 >= l) {
+ lua_pushnil(L);
+ } else {
+ int b = uchar(s[p++]);
+ int a = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, 0x100 * a + b - 0x10000);
+ else
+ lua_pushinteger(L, 0x100 * a + b);
+ }
+ return 1;
+}
static int readinteger3(lua_State *L) {
FILE *f = tofile(L);
@@ -422,6 +528,19 @@ static int readinteger3(lua_State *L) {
lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
return 1;
}
+static int readinteger3_le(lua_State *L) {
+ FILE *f = tofile(L);
+ int c = getc(f);
+ int b = getc(f);
+ int a = getc(f);
+ if (a == EOF)
+ lua_pushnil(L);
+ else if (a >= 0x80)
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c - 0x1000000);
+ else
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
+ return 1;
+}
static int readinteger3_s(lua_State *L) {
size_t l;
@@ -440,6 +559,23 @@ static int readinteger3_s(lua_State *L) {
}
return 1;
}
+static int readinteger3_s_le(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p+2 >= l) {
+ lua_pushnil(L);
+ } else {
+ int c = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int a = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c - 0x1000000);
+ else
+ lua_pushinteger(L, 0x10000 * a + 0x100 * b + c);
+ }
+ return 1;
+}
static int readinteger4(lua_State *L) {
FILE *f = tofile(L);
@@ -455,6 +591,20 @@ static int readinteger4(lua_State *L) {
lua_pushinteger(L, 0x1000000 * a + 0x10000 * b + 0x100 * c + d);
return 1;
}
+static int readinteger4_le(lua_State *L) {
+ FILE *f = tofile(L);
+ int d = getc(f);
+ int c = getc(f);
+ int b = getc(f);
+ int a = getc(f);
+ if (a == EOF)
+ lua_pushnil(L);
+ else if (a >= 0x80)
+ lua_pushinteger(L, 0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000);
+ else
+ lua_pushinteger(L, 0x1000000 * a + 0x10000 * b + 0x100 * c + d);
+ return 1;
+}
static int readinteger4_s(lua_State *L) {
size_t l;
@@ -474,6 +624,24 @@ static int readinteger4_s(lua_State *L) {
}
return 1;
}
+static int readinteger4_s_le(lua_State *L) {
+ size_t l;
+ const char *s = luaL_checklstring(L, 1, &l);
+ size_t p = luaL_checkinteger(L, 2) - 1;
+ if (p+3 >= l) {
+ lua_pushnil(L);
+ } else {
+ int d = uchar(s[p++]);
+ int c = uchar(s[p++]);
+ int b = uchar(s[p++]);
+ int a = uchar(s[p]);
+ if (a >= 0x80)
+ lua_pushinteger(L, 0x1000000 * a + 0x10000 * b + 0x100 * c + d - 0x100000000);
+ else
+ lua_pushinteger(L, 0x1000000 * a + 0x10000 * b + 0x100 * c + d);
+ }
+ return 1;
+}
static int readintegertable(lua_State *L) {
FILE *f = tofile(L);
@@ -869,11 +1037,19 @@ static const luaL_Reg fiolib[] = {
{ "readcardinal2", readcardinal2 },
{ "readcardinal3", readcardinal3 },
{ "readcardinal4", readcardinal4 },
+ { "readcardinal1le", readcardinal1 },
+ { "readcardinal2le", readcardinal2_le },
+ { "readcardinal3le", readcardinal3_le },
+ { "readcardinal4le", readcardinal4_le },
{ "readcardinaltable", readcardinaltable },
{ "readinteger1", readinteger1 },
{ "readinteger2", readinteger2 },
{ "readinteger3", readinteger3 },
{ "readinteger4", readinteger4 },
+ { "readinteger1le", readinteger1 },
+ { "readinteger2le", readinteger2_le },
+ { "readinteger3le", readinteger3_le },
+ { "readinteger4le", readinteger4_le },
{ "readintegertable", readintegertable },
{ "readfixed2", readfixed2 },
{ "readfixed4", readfixed4 },
@@ -893,11 +1069,19 @@ static const luaL_Reg siolib[] = {
{ "readcardinal2", readcardinal2_s },
{ "readcardinal3", readcardinal3_s },
{ "readcardinal4", readcardinal4_s },
+ { "readcardinal1le", readcardinal1_s },
+ { "readcardinal2le", readcardinal2_s_le },
+ { "readcardinal3le", readcardinal3_s_le },
+ { "readcardinal4le", readcardinal4_s_le },
{ "readcardinaltable", readcardinaltable_s },
{ "readinteger1", readinteger1_s },
{ "readinteger2", readinteger2_s },
{ "readinteger3", readinteger3_s },
{ "readinteger4", readinteger4_s },
+ { "readinteger1le", readinteger1_s },
+ { "readinteger2le", readinteger2_s_le },
+ { "readinteger3le", readinteger3_s_le },
+ { "readinteger4le", readinteger4_s_le },
{ "readintegertable", readintegertable_s },
{ "readfixed2", readfixed2_s },
{ "readfixed4", readfixed4_s },
diff --git a/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c b/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c
index 6af006a53c8..d0047919c7f 100644
--- a/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/lnewtokenlib.c
@@ -614,23 +614,35 @@ static int run_scan_argument(lua_State * L) /* HH */
get_token();
} while ((cur_cmd == spacer_cmd) || (cur_cmd == relax_cmd));
if (cur_cmd == left_brace_cmd) {
+ int exp = 1;
+ if (lua_type(L, 1) == LUA_TBOOLEAN) {
+ exp = lua_toboolean(L, 1);
+ }
back_input();
saved_defref = def_ref;
- (void) scan_toks(false, true);
+ (void) scan_toks(false, exp);
t = def_ref;
def_ref = saved_defref;
tokenlist_to_luastring(L,t);
flush_list(t);
} else if (cur_cmd == call_cmd) {
halfword saved_cur_tok = cur_tok;
+ int exp = 1;
+ if (lua_type(L, 1) == LUA_TBOOLEAN) {
+ exp = lua_toboolean(L, 1);
+ }
cur_tok = right_brace_token + '}';
back_input();
- cur_tok = saved_cur_tok;
- back_input();
+ if (exp) {
+ cur_tok = saved_cur_tok;
+ back_input();
+ } else {
+ expand();
+ }
cur_tok = left_brace_token + '{';
back_input();
saved_defref = def_ref;
- (void) scan_toks(false, true);
+ (void) scan_toks(false, exp);
t = def_ref;
def_ref = saved_defref;
tokenlist_to_luastring(L,t);
@@ -740,6 +752,7 @@ static int run_lookup(lua_State * L)
return 1;
}
+/*
static int lua_tokenlib_is_defined(lua_State * L)
{
const char *s;
@@ -754,6 +767,26 @@ static int lua_tokenlib_is_defined(lua_State * L)
lua_pushnil(L);
return 1;
}
+*/
+
+static int lua_tokenlib_is_defined(lua_State * L)
+{
+ int b = 0;
+ if (lua_type(L, 1) == LUA_TSTRING) {
+ size_t l;
+ const char *s = lua_tolstring(L, 1, &l);
+ if (l > 0) {
+ int cs = string_lookup(s, l);
+ if (lua_toboolean(L, 2)) {
+ b = cs != undefined_control_sequence;
+ } else {
+ b = eq_type(cs) != undefined_cs_cmd;
+ }
+ }
+ }
+ lua_pushboolean(L, b);
+ return 1;
+}
static int run_build(lua_State * L)
{
diff --git a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
index 5187bc89c01..deb77555178 100644
--- a/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
+++ b/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
@@ -149,106 +149,6 @@ static int do_luacprint(lua_State * L, int partial, int deftable)
return 0;
}
-/* the next one writes a raw token (number) */
-
-/*
-
-int luatwrite(lua_State * L)
-{
- int top = lua_gettop(L);
- if (top>0) {
- rope *rn = xmalloc(sizeof(rope)); // overkill
- int i = 1 ;
- luacstrings++; // should be luactokens
- rn->text = NULL;
- rn->tsize = 0;
- rn->partial = 0;
- rn->cattable = DEFAULT_CAT_TABLE;
- rn->next = NULL;
- rn->tok = 0;
- rn->nod = 0;
- if (write_spindle.head == NULL) {
- write_spindle.head = rn;
- } else {
- write_spindle.tail->next = rn;
- }
- write_spindle.tail = rn;
- write_spindle.complete = 0;
- while (1) {
- rn->tok = lua_tointeger(L,i);
- if (i<top) {
- rope *r = xmalloc(sizeof(rope)); // overkill
- r->text = NULL;
- r->tsize = 0;
- r->partial = 0;
- r->cattable = DEFAULT_CAT_TABLE;
- r->next = NULL;
- r->tok = 0;
- r->nod = 0;
- rn->next = r;
- rn = r;
- write_spindle.tail = rn;
- i++;
- } else {
- break;
- }
- }
- }
- return 0;
-}
-
-*/
-
-/* the next one writes a raw node (number) */
-
-/*
-
-int luanwrite(lua_State * L)
-{
- int top = lua_gettop(L);
- if (top>0) {
- rope *rn = xmalloc(sizeof(rope)); // overkill
- int i = 1 ;
- luacstrings++; // should be luactokens
- rn->text = NULL;
- rn->tsize = 0;
- rn->partial = 0;
- rn->cattable = DEFAULT_CAT_TABLE;
- rn->next = NULL;
- rn->tok = 0;
- rn->nod = 0;
- if (write_spindle.head == NULL) {
- write_spindle.head = rn;
- } else {
- write_spindle.tail->next = rn;
- }
- write_spindle.tail = rn;
- write_spindle.complete = 0;
- while (1) {
- rn->nod = lua_tointeger(L,i);
- if (i<top) {
- rope *r = xmalloc(sizeof(rope)); // overkill
- r->text = NULL;
- r->tsize = 0;
- r->partial = 0;
- r->cattable = DEFAULT_CAT_TABLE;
- r->next = NULL;
- r->tok = 0;
- r->nod = 0;
- rn->next = r;
- rn = r;
- write_spindle.tail = rn;
- i++;
- } else {
- break;
- }
- }
- }
- return 0;
-}
-
-*/
-
/* lua.write */
static int luacwrite(lua_State * L)
@@ -1308,6 +1208,39 @@ static int gettoks(lua_State * L)
return 1;
}
+static int getmark(lua_State *L)
+{
+ if (lua_gettop(L) == 0) {
+ lua_pushinteger(L, biggest_used_mark);
+ return 1;
+ } else if (lua_type(L, 1) == LUA_TSTRING) {
+ int num = luaL_optinteger(L, 2, 0);
+ if (num >= 0 && num <= biggest_used_mark) {
+ int ptr = null;
+ const char *s = lua_tostring(L, 1);
+ if (lua_key_eq(s, top)) {
+ ptr = top_marks_array[num];
+ } else if (lua_key_eq(s, first)) {
+ ptr = first_marks_array[num];
+ } else if (lua_key_eq(s, bottom)) {
+ ptr = bot_marks_array[num];
+ } else if (lua_key_eq(s, splitfirst)) {
+ ptr = split_first_marks_array[num];
+ } else if (lua_key_eq(s, splitbottom)) {
+ ptr = split_bot_marks_array[num];
+ }
+ if (ptr) {
+ char *str = tokenlist_to_cstring(ptr, 1, NULL);
+ lua_pushstring(L, str);
+ free(str);
+ return 1;
+ }
+ }
+ }
+ lua_pushnil(L);
+ return 1;
+}
+
static int get_box_id(lua_State * L, int i, boolean report)
{
const char *s;
@@ -2133,16 +2066,16 @@ static int getromannumeral(lua_State * L)
static int get_parshape(lua_State * L)
{
- halfword par_shape_ptr = par_shape_par_ptr;
- if (par_shape_ptr != 0) {
+ halfword ptr = par_shape_par_ptr;
+ if (ptr != null) {
int m = 1;
- int n = vinfo(par_shape_ptr + 1);
+ int n = vinfo(ptr + 1);
lua_createtable(L, n, 0);
while (m <= n) {
lua_createtable(L, 2, 0);
- lua_pushinteger(L, vlink((par_shape_ptr) + (2 * (m - 1)) + 2));
+ lua_pushinteger(L, vlink((ptr) + (2 * (m - 1)) + 2));
lua_rawseti(L, -2, 1);
- lua_pushinteger(L, vlink((par_shape_ptr) + (2 * (m - 1)) + 3));
+ lua_pushinteger(L, vlink((ptr) + (2 * (m - 1)) + 3));
lua_rawseti(L, -2, 2);
lua_rawseti(L, -2, m);
m++;
@@ -2153,6 +2086,38 @@ static int get_parshape(lua_State * L)
return 1;
}
+static int get_etex_parshape(lua_State * L, int code)
+{
+ halfword ptr = null;
+ switch (code) {
+ case inter_line_penalties_loc:
+ ptr = inter_line_penalties_par_ptr;
+ break;
+ case club_penalties_loc:
+ ptr = club_penalties_par_ptr;
+ break;
+ case widow_penalties_loc:
+ ptr = widow_penalties_par_ptr;
+ break;
+ case display_widow_penalties_loc:
+ ptr = display_widow_penalties_par_ptr;
+ break;
+ }
+ if (ptr != null) {
+ int m = 1;
+ int n = vinfo(ptr + 1) + 1;
+ lua_createtable(L, n, 0);
+ while (m <= n) {
+ lua_pushinteger(L, penalty(ptr + m));
+ lua_rawseti(L, -2, m);
+ m++;
+ }
+ } else {
+ lua_pushnil(L);
+ }
+ return 1;
+}
+
static int gettex(lua_State * L)
{
int cur_cs1 = -1;
@@ -2222,6 +2187,9 @@ static int gettex(lua_State * L)
case set_tex_shape_cmd:
retval = get_parshape(L);
break;
+ case set_etex_shape_cmd:
+ retval = get_etex_parshape(L, cur_code);
+ break;
default:
lua_pushnil(L);
break;
@@ -3608,10 +3576,6 @@ static const struct luaL_Reg texlib[] = {
{ "sprint", luacsprint },
{ "tprint", luactprint },
{ "cprint", luaccprint },
- /*
- { "twrite", luatwrite },
- { "nwrite", luanwrite },
- */
{ "error", texerror },
{ "set", settex },
{ "get", gettex },
@@ -3640,6 +3604,7 @@ static const struct luaL_Reg texlib[] = {
{ "settoks", settoks },
{ "scantoks", scantoks },
{ "gettoks", gettoks },
+ { "getmark", getmark },
{ "isbox", isbox },
{ "setbox", setbox },
{ "getbox", getbox },
diff --git a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
index 14650ffdcee..06692cb0202 100644
--- a/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
+++ b/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
@@ -610,6 +610,8 @@ make_lua_key(best_size);\
make_lua_key(bin);\
make_lua_key(bleed);\
make_lua_key(bot);\
+make_lua_key(bottom);\
+make_lua_key(splitbottom);\
make_lua_key(bot_accent);\
make_lua_key(bothflexible);\
make_lua_key(bottom_left);\
@@ -761,6 +763,7 @@ make_lua_key(fin_row);\
make_lua_key(finalhyphendemerits);\
make_lua_key(finalpenalty);\
make_lua_key(first);\
+make_lua_key(splitfirst);\
make_lua_key(fit);\
make_lua_key(fitb);\
make_lua_key(fitbh);\
@@ -1317,6 +1320,8 @@ init_lua_key(best_size);\
init_lua_key(bin);\
init_lua_key(bleed);\
init_lua_key(bot);\
+init_lua_key(bottom);\
+init_lua_key(splitbottom);\
init_lua_key(bot_accent);\
init_lua_key(bothflexible);\
init_lua_key(bottom_left);\
@@ -1467,6 +1472,7 @@ init_lua_key(fin_row);\
init_lua_key(finalhyphendemerits);\
init_lua_key(finalpenalty);\
init_lua_key(first);\
+init_lua_key(splitfirst);\
init_lua_key(fit);\
init_lua_key(fitb);\
init_lua_key(fitbh);\
@@ -2073,6 +2079,8 @@ use_lua_key(best_size);
use_lua_key(bin);
use_lua_key(bleed);
use_lua_key(bot);
+use_lua_key(bottom);
+use_lua_key(splitbottom);
use_lua_key(bot_accent);
use_lua_key(bothflexible);
use_lua_key(bottom_left);
@@ -2224,6 +2232,7 @@ use_lua_key(fin_row);
use_lua_key(finalhyphendemerits);
use_lua_key(finalpenalty);
use_lua_key(first);
+use_lua_key(splitfirst);
use_lua_key(fit);
use_lua_key(fitb);
use_lua_key(fitbh);
diff --git a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
index dbe2c11de1b..3218d05e711 100644
--- a/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
+++ b/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
@@ -1 +1 @@
-#define luatex_svn_revision 7353
+#define luatex_svn_revision 7381
diff --git a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h
index dc2f05ca955..f06d5e0e094 100644
--- a/Build/source/texk/web2c/luatexdir/luatexcallbackids.h
+++ b/Build/source/texk/web2c/luatexdir/luatexcallbackids.h
@@ -76,6 +76,7 @@ typedef enum {
page_order_index_callback,
make_extensible_callback,
process_pdf_image_content_callback,
+ provide_charproc_data_callback,
total_callbacks,
} callback_callback_types;
diff --git a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
index 3d37102b29a..63736787ec5 100644
--- a/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
+++ b/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
@@ -2187,6 +2187,7 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
int outlines = 0;
int threads = 0;
int names_tree = 0;
+ int prerolled = 0;
size_t xref_offset_width;
int luatexversion = luatex_version;
str_number luatexrevision = get_luatexrevision();
@@ -2215,13 +2216,46 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
check_nonexisting_pages(pdf);
check_nonexisting_destinations(pdf);
}
- /*tex Output fonts definition. */
+ /*tex
+ Output fonts definition.
+ */
+ pdf->gen_tounicode = pdf_gen_tounicode;
+ pdf->omit_cidset = pdf_omit_cidset;
+ pdf->omit_charset = pdf_omit_charset;
+ /*tex
+ The first pass over the list will flag the slots that are
+ used so that we can do a preroll for type 3 fonts.
+ */
for (k = 1; k <= max_font_id(); k++) {
if (font_used(k) && (pdf_font_num(k) < 0)) {
i = -pdf_font_num(k);
for (j = font_bc(k); j <= font_ec(k); j++)
if (quick_char_exists(k, j) && pdf_char_marked(k, j))
pdf_mark_char(i, j);
+ }
+ }
+ k = pdf->head_tab[obj_type_font];
+ while (k != 0) {
+ int f = obj_info(pdf, k);
+ if (do_pdf_preroll_font(pdf, f)) {
+ prerolled = 1;
+ }
+ k = obj_link(pdf, k);
+ }
+ /*tex
+ Just in case the user type 3 font has used fonts, we need to
+ do a second pass. We also collect some additional data here.
+ */
+ for (k = 1; k <= max_font_id(); k++) {
+ if (font_used(k) && (pdf_font_num(k) < 0)) {
+ i = -pdf_font_num(k);
+ if (prerolled) {
+ for (j = font_bc(k); j <= font_ec(k); j++)
+ if (quick_char_exists(k, j) && pdf_char_marked(k, j))
+ pdf_mark_char(i, j);
+ } else {
+ /*tex No need to waste time on checking again. */
+ }
if ((pdf_font_attr(i) == 0) && (pdf_font_attr(k) != 0)) {
set_pdf_font_attr(i, pdf_font_attr(k));
} else if ((pdf_font_attr(k) == 0) && (pdf_font_attr(i) != 0)) {
@@ -2231,9 +2265,6 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
}
}
}
- pdf->gen_tounicode = pdf_gen_tounicode;
- pdf->omit_cidset = pdf_omit_cidset;
- pdf->omit_charset = pdf_omit_charset;
k = pdf->head_tab[obj_type_font];
while (k != 0) {
int f = obj_info(pdf, k);
@@ -2241,6 +2272,9 @@ void pdf_finish_file(PDF pdf, int fatal_error) {
k = obj_link(pdf, k);
}
write_fontstuff(pdf);
+ /*tex
+ We're done with the fonts.
+ */
if (total_pages > 0) {
pdf->last_pages = output_pages_tree(pdf);
/*tex Output outlines. */
diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.c b/Build/source/texk/web2c/luatexdir/tex/errors.c
index 0c64927cea2..0c8f564236e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/errors.c
+++ b/Build/source/texk/web2c/luatexdir/tex/errors.c
@@ -441,6 +441,21 @@ void error(void)
/*tex Get user's advice and |return|. */
while (1) {
CONTINUE:
+ /*tex
+ Original reports:
+
+ https://tex.stackexchange.com/questions/551313/
+ https://tug.org/pipermail/tex-live/2020-June/045876.html
+
+ This will probably be fixed by DEK in the 2021 tuneup in a different
+ way (so we'll have to remove or alter this change), but the interaction
+ sequence in the reports above causes a segmentation fault in web2c -
+ writing to the closed \write15 stream because we wrongly decrement
+ selector from 16 to 15 in term_input, due to the lack of this check in
+ recursive error() call.
+ */
+ if (interaction !=error_stop_mode)
+ return;
clear_for_error_prompt();
prompt_input("? ");
if (last == first)
@@ -879,6 +894,8 @@ When \TeX\ wants to typeset a character that doesn't exist, the character node i
not created; thus the output routine can assume that characters exist when it
sees them. The following procedure prints a warning message unless the user has
suppressed it.
+If |tracing_lost_chars_par| (i.e. \.{\\tracinglostchar}) is greater than 2,
+it's considered as an error.
*/
@@ -915,6 +932,9 @@ void char_warning(internal_font_number f, int c)
end_diagnostic(false);
tracing_online_par = old_setting;
}
+ if (tracing_lost_chars_par > 2) {
+ error();
+ }
}
void wrapup_backend(void) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.c b/Build/source/texk/web2c/luatexdir/tex/extensions.c
index d24bee13b3f..60deb747a85 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.c
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.c
@@ -563,8 +563,9 @@ void write_out(halfword p)
int old_setting;
/*tex write stream number */
int j;
- /*tex line to be written, as a C string */
- char *s, *ss;
+ /*tex line to be written, as a Lua string */
+ lstring *ss = NULL;
+ lstring *s = NULL;
int callback_id;
int lua_retval;
expand_macros_in_tokenlist(p);
@@ -579,21 +580,21 @@ void write_out(halfword p)
} else {
tprint_nl("");
}
- s = tokenlist_to_cstring(def_ref, false, NULL);
+ s = tokenlist_to_lstring(def_ref, false);
if (selector < no_print) {
/*tex selector is a file */
callback_id = callback_defined(process_output_buffer_callback);
if (callback_id > 0) {
/*tex fix up the output buffer using callbacks */
- lua_retval = run_callback(callback_id, "S->S", s, &ss);
+ lua_retval = run_callback(callback_id, "L->L", s, &ss);
if ((lua_retval == true) && (ss != NULL)) {
- xfree(s);
+ free_lstring(s);
s = ss;
}
}
}
- tprint(s);
- xfree(s);
+ lprint(s);
+ free_lstring(s);
print_ln();
flush_list(def_ref);
selector = old_setting;
diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.c b/Build/source/texk/web2c/luatexdir/tex/mlist.c
index 43db6adbbb2..c34dee48839 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mlist.c
+++ b/Build/source/texk/web2c/luatexdir/tex/mlist.c
@@ -1248,13 +1248,6 @@ static void stack_glue_into_box(pointer b, scaled min, scaled max) {
int cur_size = 0;
-/*tex A few state variables: */
-
-halfword del_height = 0;
-halfword del_depth = 0;
-halfword del_width = 0;
-halfword del_shift = 0;
-
static pointer get_delim_box(internal_font_number fnt, halfword chr, scaled v, scaled min_overlap, int horizontal, halfword att)
{
int callback_id = callback_defined(make_extensible_callback);
@@ -1549,10 +1542,8 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat,
if (d && ! small_fam(d) && ! large_fam(d) && ! small_char(d) && ! large_char(d)) {
halfword b = new_null_box();
subtype(b) = math_v_delimiter_list;
- height(b) = del_height;
- depth(b) = del_depth;
- width(b) = del_width;
- shift_amount(b) = del_shift;
+ if (! flat)
+ width(b) = null_delimiter_space_par;
node_attr(b) = node_attr(d);
node_attr(d) = null;
flush_node(d);
@@ -1709,12 +1700,6 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat,
}
DONE:
delete_attribute_ref(att);
-
- del_height = height(b);
- del_depth = depth(b);
- del_width = width(b);
- del_shift = shift_amount(b);
-
return b;
}
@@ -3003,10 +2988,7 @@ static void make_fraction(pointer q, int cur_style)
/*tex This also equals |width(z)|. */
width(v) = width(x);
reset_attributes(v, node_attr(q));
- if (thickness(q) == 0) {
- p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));
- couple_nodes(p,z);
- } else {
+ if (thickness(q) && ! fractionnorule(q)) {
y = do_fraction_rule(thickness(q), node_attr(q), math_fraction_rule, cur_size, used_fam);
p = new_kern((math_axis_size(cur_size) - delta) - (height(z) - shift_down));
reset_attributes(p, node_attr(q));
@@ -3014,6 +2996,9 @@ static void make_fraction(pointer q, int cur_style)
couple_nodes(p,z);
p = new_kern((shift_up - depth(x)) - (math_axis_size(cur_size) + delta));
couple_nodes(p,y);
+ } else {
+ p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));
+ couple_nodes(p,z);
}
reset_attributes(p, node_attr(q));
couple_nodes(x,p);
@@ -3321,12 +3306,10 @@ static scaled make_op(pointer q, int cur_style)
shift_down = limit_below_bgap(cur_style) - height(z);
if (shift_down < limit_below_vgap(cur_style))
shift_down = limit_below_vgap(cur_style);
- if (shift_down > 0) {
- p = new_kern(shift_down);
- reset_attributes(p, node_attr(q));
- couple_nodes(y,p);
- couple_nodes(p,z);
- }
+ p = new_kern(shift_down);
+ reset_attributes(p, node_attr(q));
+ couple_nodes(y,p);
+ couple_nodes(p,z);
p = new_kern(limit_below_kern(cur_style));
reset_attributes(p, node_attr(q));
couple_nodes(z,p);
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.c b/Build/source/texk/web2c/luatexdir/tex/scanning.c
index 66f28a18b13..2ecb54bc2f6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.c
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.c
@@ -536,9 +536,7 @@ static boolean short_scan_something_internal(int cmd, int chr, int level, boolea
/*tex assumes identical values */
cur_val_level = cur_chr;
}
- if ((cur_list.tail_field != contrib_head) &&
- !is_char_node(cur_list.tail_field) &&
- (cur_list.mode_field != 0)) {
+ if ((cur_list.tail_field != contrib_head) && (cur_list.mode_field != 0)) {
switch (cur_chr) {
case lastpenalty_code:
if (type(cur_list.tail_field) == penalty_node)
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.c b/Build/source/texk/web2c/luatexdir/tex/texmath.c
index fd04e2a5c11..4d2bf80ecd6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.c
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.c
@@ -1926,6 +1926,8 @@ void math_fraction(void)
while (1) {
if (scan_keyword("exact")) {
options = options | noad_option_exact ;
+ } else if (scan_keyword("norule")) {
+ options = options | noad_option_no_rule ;
} else {
break;
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
index 848f9ea4799..121511bc098 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
@@ -597,6 +597,7 @@ typedef enum {
noad_option_no_sub_script = 0x21 + 0x08,
noad_option_no_super_script = 0x22 + 0x08,
noad_option_no_script = 0x23 + 0x08,
+ noad_option_no_rule = 0x24 + 0x08,
} delimiter_options ;
# define delimiteroptionset(a) ((delimiteroptions(a) & noad_option_set ) == noad_option_set )
@@ -657,6 +658,7 @@ typedef enum {
# define fractionoptionset(a) ((fractionoptions(a) & noad_option_set ) == noad_option_set )
# define fractionexact(a) ((fractionoptions(a) & noad_option_exact ) == noad_option_exact )
# define fractionnoaxis(a) ((fractionoptions(a) & noad_option_no_axis) == noad_option_no_axis)
+# define fractionnorule(a) ((fractionoptions(a) & noad_option_no_rule) == noad_option_no_rule)
/* radical noads */
/* this is like a fraction, but it only stores a |left_delimiter| */
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.c b/Build/source/texk/web2c/luatexdir/tex/textoken.c
index a59e650df42..e28626bbd26 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.c
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.c
@@ -2352,6 +2352,8 @@ void ins_the_toks(void)
*/
+# define immediate_permitted(n,target) ((eq_level(toks_base + n) == cur_level) && (token_ref_count(target) == 0))
+
void combine_the_toks(void)
{
halfword how = cur_chr;
@@ -2395,7 +2397,7 @@ void combine_the_toks(void)
token_link(source) = null;
} else if (append) {
/*tex Append. */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
p = t;
while (token_link(p) != null) {
p = token_link(p);
@@ -2405,13 +2407,12 @@ void combine_the_toks(void)
s = token_link(s);
}
} else {
- token_ref_count(target)--;
append_copied_toks_list(t,s);
set_toks_register(nt,temp_token_head,global);
}
} else {
/* prepend */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
h = null;
p = null ;
while (s != null) {
@@ -2424,7 +2425,6 @@ void combine_the_toks(void)
set_token_link(p,t);
set_token_link(target,h);
} else {
- token_ref_count(target)--;
append_copied_toks_list(s,t);
set_toks_register(nt,temp_token_head,global);
}
@@ -2455,7 +2455,7 @@ void combine_the_toks(void)
t = token_link(target);
if (append) {
/*tex Append. */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
p = t;
while (token_link(p) != null) {
p = token_link(p);
@@ -2465,13 +2465,12 @@ void combine_the_toks(void)
s = token_link(s);
}
} else {
- token_ref_count(target)--;
append_copied_toks_list(t,s);
set_toks_register(nt,temp_token_head,global);
}
} else {
/*tex Prepend. */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
h = null;
p = null;
while (s != null) {
@@ -2484,7 +2483,6 @@ void combine_the_toks(void)
set_token_link(p,t);
set_token_link(target,h);
} else {
- token_ref_count(target)--;
append_copied_toks_list(s,t);
set_toks_register(nt,temp_token_head,global);
}
@@ -2873,6 +2871,8 @@ void conv_toks(void)
warning_index = save_warning_index;
scanner_status = save_scanner_status;
ins_list(token_link(def_ref));
+ token_link(def_ref) = null;
+ free_avail(def_ref);
def_ref = save_def_ref;
restore_cur_string(u);
/*tex No further action. */