[latex3-commits] [git/LaTeX3-latex3-latex2e] develop: filecontents support for additional luatex write streams issue #238 (81b61173)

David Carlisle d.p.carlisle at gmail.com
Sun Jan 5 12:41:54 CET 2020


Repository : https://github.com/latex3/latex2e
On branch  : develop
Link       : https://github.com/latex3/latex2e/commit/81b61173e5d40a9e20980ff047650434edecbf84

>---------------------------------------------------------------

commit 81b61173e5d40a9e20980ff047650434edecbf84
Author: David Carlisle <d.p.carlisle at gmail.com>
Date:   Sun Jan 5 11:41:54 2020 +0000

    filecontents support for additional luatex write streams issue #238
    
    No rollback added as doesn't affect non-error cases in existing documents
    and current version only added in the last release, which has rollback.


>---------------------------------------------------------------

81b61173e5d40a9e20980ff047650434edecbf84
 base/changes.txt                                       |  5 +++++
 base/ltclass.dtx                                       | 16 ++++++++++------
 .../testfiles/github-0238.luatex.tlg                   |  3 ++-
 base/testfiles/github-0238.lvt                         | 18 ++++++++++++++++++
 base/testfiles/github-0238.tlg                         |  8 ++++++++
 5 files changed, 43 insertions(+), 7 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index 29f2443f..31f547f5 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -4,6 +4,11 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 =======================================================================
 
+2020-01-05  David Carlisle  <David.Carlisle at latex-project.org>
+
+	* base/ltclass.dtx: Support more write streams for
+          filecontents in LuaTeX (gh/238)
+
 2019-12-24  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* lttextcomp.dtx: Implement text companion symbols in the kernel
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index ead3b97f..e14fb1ef 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -1,6 +1,6 @@
 % \iffalse meta-comment
 %
-% Copyright (C) 1993-2019
+% Copyright (C) 1993-2020
 % The LaTeX3 Project and any individual authors listed elsewhere
 % in this file.
 %
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2019/11/29 v1.3e LaTeX Kernel (Class & Package Interface)]
+             [2020/01/05 v1.3f LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -1781,6 +1781,7 @@
 %                             filecontents environment file name}
 % \changes{v1.3b}{2019/08/27}{Make various commands robust}
 % \changes{v1.3c}{2019/09/11}{Support optional argument for filecontents}
+% \changes{v1.3f}{2020/01/05}{Support more write streams in LuaTeX gh/238}
 %
 %</2ekernel>
 %<*2ekernel|latexrelease>
@@ -1855,6 +1856,11 @@
 \gdef\filec at ntents#1{%
   \set at curr@file{\filec at ntents@checkdir#1}%
   \edef\q at curr@file{\expandafter\quote at name\expandafter{\@curr at file}}%
+%    \end{macrocode}
+%
+% Lua\TeX\ has more writes (and 18 is safe here).
+%    \begin{macrocode}
+  \chardef\reserved at c\ifx\directlua\@undefined 15 \else 127 \fi%
   \openin\@inputcheck\q at curr@file \space %
   \ifeof\@inputcheck%
     \@latex at warning@no at line%
@@ -1864,8 +1870,7 @@
 % \changes{v1.0y}{1997/10/10}
 %         {\cs{reserved at c} not \cs{verbatim at out} to save a csname}
 %    \begin{macrocode}
-    \chardef\reserved at c15 %
-    \ch at ck7\reserved at c\write%
+    \ch at ck7\reserved at c\write\relax%
     \immediate\openout\reserved at c\q at curr@file\relax%
   \else%
 %    \end{macrocode}
@@ -1903,8 +1908,7 @@
 %    (hopefully) safe. If not opened that means we are going to write
 %    on the terminal.      
 %    \begin{macrocode}
-      \chardef\reserved at c15 %
-      \ch at ck7\reserved at c\write%
+      \ch at ck7\reserved at c\write\relax%
       \if at filesw%  % Foul ... trying to overwrite \jobname!
       \@latex at error{Trying to overwrite `\jobname.tex'}{You can't %
         write to the file you a reading from!\MessageBreak%
diff --git a/required/tools/testfiles/tlb-xr-001.tlg b/base/testfiles/github-0238.luatex.tlg
similarity index 51%
copy from required/tools/testfiles/tlb-xr-001.tlg
copy to base/testfiles/github-0238.luatex.tlg
index 44599e9a..48ae6210 100644
--- a/required/tools/testfiles/tlb-xr-001.tlg
+++ b/base/testfiles/github-0238.luatex.tlg
@@ -1,3 +1,4 @@
 This is a generated file for the LaTeX2e validation system.
 Don't change this file in any respect.
-Package xr Info: IMPORTING LABELS FROM ar2.aux on input line ....
+LaTeX Warning: Writing or overwriting file `./github-0238-0.vrb'.
+\openout127 = github-0238-0.vrb
diff --git a/base/testfiles/github-0238.lvt b/base/testfiles/github-0238.lvt
new file mode 100644
index 00000000..ae578702
--- /dev/null
+++ b/base/testfiles/github-0238.lvt
@@ -0,0 +1,18 @@
+
+\documentclass{article}
+
+\input{test2e}
+
+\newwrite\zz\newwrite\zz\newwrite\zz\newwrite\zz\newwrite\zz
+\newwrite\zz\newwrite\zz\newwrite\zz\newwrite\zz\newwrite\zz
+\newwrite\zz\newwrite\zz\newwrite\zz\newwrite\zz\newwrite\zz
+
+
+\START
+% should error in engines with only 16 write channels
+
+\begin{filecontents*}[force]{\jobname-0.vrb}
+content
+\end{filecontents*}
+
+\END
diff --git a/base/testfiles/github-0238.tlg b/base/testfiles/github-0238.tlg
new file mode 100644
index 00000000..833582f5
--- /dev/null
+++ b/base/testfiles/github-0238.tlg
@@ -0,0 +1,8 @@
+This is a generated file for the LaTeX2e validation system.
+Don't change this file in any respect.
+! No room for a new \write .
+\ch at ck ...\else \errmessage {No room for a new #3}
+                                                  \fi 
+l. ...\begin{filecontents*}[force]{\jobname-0.vrb}
+(That was another \errmessage.)
+LaTeX Warning: Writing or overwriting file `./github-0238-0.vrb'.





More information about the latex3-commits mailing list