[latex3-commits] [git/LaTeX3-latex3-latex2e] filecontents: extending filecontents with an optional argument (58149908)

Frank Mittelbach frank.mittelbach at latex-project.org
Wed Sep 11 16:15:36 CEST 2019


Repository : https://github.com/latex3/latex2e
On branch  : filecontents
Link       : https://github.com/latex3/latex2e/commit/58149908a73b9399cee752a4c69bf84118ae6775

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

commit 58149908a73b9399cee752a4c69bf84118ae6775
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Wed Sep 11 16:15:36 2019 +0200

    extending filecontents with an optional argument


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

58149908a73b9399cee752a4c69bf84118ae6775
 base/changes.txt                                   |   6 +
 base/doc/ltnews30.tex                              |  28 +++-
 base/ltclass.dtx                                   | 170 +++++++++++++++++----
 base/testfiles/github-robust-0123.luatex.tlg       |   2 -
 base/testfiles/github-robust-0123.lvt              |  20 +--
 base/testfiles/github-robust-0123.tlg              |   2 -
 base/testfiles/github-robust-0123.xetex.tlg        |   2 -
 base/testfiles/tlb-filecontents-001.lvt            |  71 +++++++++
 .../tlb-filecontents-001.tlg}                      |   0
 9 files changed, 248 insertions(+), 53 deletions(-)

diff --git a/base/changes.txt b/base/changes.txt
index f5caf8e6..481604d4 100644
--- a/base/changes.txt
+++ b/base/changes.txt
@@ -4,6 +4,12 @@ completeness or accuracy and it contains some references to files that
 are not part of the distribution.
 =======================================================================
 
+2019-09-11  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
+
+	* ltclass.dtx (subsection{Providing shipment}):
+	Support optional argument for filecontents to allow overwrite
+	and nosearch
+
 2019-08-30  Frank Mittelbach  <Frank.Mittelbach at latex-project.org>
 
 	* lterror.dtx (subsection{Tracing}):
diff --git a/base/doc/ltnews30.tex b/base/doc/ltnews30.tex
index 7e43b39d..8b72252e 100644
--- a/base/doc/ltnews30.tex
+++ b/base/doc/ltnews30.tex
@@ -40,6 +40,7 @@
 \providecommand\acro[1]{\textsc{#1}}
 \providecommand\meta[1]{$\langle$\textit{#1}$\rangle$}
 \providecommand\option[1]{\texttt{#1}}
+\providecommand\env[1]{\texttt{#1}}
 
 
 \providecommand\XeTeX{\hologo{XeTeX}}
@@ -170,7 +171,31 @@ sequence of bytes and this is not supported in command names.
 
 \section{Improving file name handling in \pdfTeX{}}
 
-A related change is that file names used as part of \cs{input},  \cs{includegraphics}, etc.\ can now contain Unicode characters as well as spaces. In this case even characters that can't be typeset because of missing font support can be used.
+A related change is that file names used as part of \cs{input},
+\cs{includegraphics}, etc.\ can now contain Unicode characters as well
+as spaces. In this case even characters that can't be typeset because
+of missing font support can be used.
+
+
+\section{Improve the \env{filecontents} environment}
+
+The \env{filecontents} environment now supports an optional argument
+in which you can specify that it is allowed to \option{overwrite} an
+already existing file, by default nothing is written if the file
+exists anywhere in the search tree.  The environment will refuse to
+write to \cs{jobname}\texttt{.tex} to avoid clobbering its own input
+file. However, if you use a different extension on your input file you
+could still overwrite it (there is no way to test for that).
+
+With the option \option{nosearch} only the current directory is
+examined not the \TeX{} tree. This is useful if you want to write a
+local copy of an standard system file.
+Finally, \option{nopreamble} prevents writing a preamble to the file
+(which is the same as using the star form of the environment.
+
+The environment ins now allowed anywhere in the document which means
+it provides everything (and more) of what the \pkg{filecontents}
+package provided in the past.
 
 
 
@@ -203,7 +228,6 @@ redefines a number of basic math construct they become fragile again
 once the package is loaded. This area will be addressed in a follow up
 release.
 
-
 \githubissue{123}
 
 
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index 9573614c..0576acb5 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -33,7 +33,7 @@
 %<*driver>
 % \fi
 \ProvidesFile{ltclass.dtx}
-             [2019/08/27 v1.3b LaTeX Kernel (Class & Package Interface)]
+             [2019/09/11 v1.3c LaTeX Kernel (Class & Package Interface)]
 % \iffalse
 \documentclass{ltxdoc}
 \GetFileInfo{ltclass.dtx}
@@ -155,11 +155,27 @@
 % verbatim to the file name given as the first argument, together with
 % some comments about how it was produced.
 %
-% The environment is allowed only before |\documentclass| to ensure
-% that all packages or options necessary for this particular run are
-% present when needed.  The begin and end tags should each be on a
-% line by itself.  There is also a star-form; this does not write
-% extra comments into the file.
+% The package can also be called with an optional argument which is
+% used to alter some of its behavior: option
+% \texttt{overwrite} will allow for overwriting existing files,
+% option \texttt{nosearch} will only check the current directory
+% when looking if the file exists. This can be useful if you want to
+% generate a local (modified) copy of some file that is already in the
+% search tree of \TeX{}. Finally, you can use \texttt{nopremable} to
+% prevent it from writing the standard blurb at the top of the file
+% (this is actually the same as using the star form of the environment).
+%
+% The environment is now allowed anywhere in the document, but to ensure
+% that all packages or options necessary are available when the
+% document is run, it is normally best to place it at the top of your
+% file (before \cs{documentclass}).
+% A possible use case for using it inside the document body is if you
+% want to reuse some text several times in the document you could then
+% write it and later use \cs{input} to retrieve it where needed.
+% 
+%
+% The begin and end tags should each be on a
+% line by itself. 
 %
 % \subsection{Option processing}
 %
@@ -1708,11 +1724,65 @@
 % \changes{v1.3a}{2019/07/01}{Support UTF8 and spaces in
 %                             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}
 %
 %</2ekernel>
 %<*2ekernel|latexrelease>
 %<latexrelease>\IncludeInRelease{2019/10/01}%
-%<latexrelease>                 {\filec at ntents}{Spaces in file names}%
+%<latexrelease>                 {\filec at ntents}{Spaces in file names + optional arg}%
+%
+
+
+%    \end{macrocode}
+%    We use |@tempswa| to mean no preamble writing and reuse |@filesw|
+%    to indicate no overwriting:
+%    \begin{macrocode}
+\def\filecontents{\@tempswatrue\@fileswtrue
+  \@ifnextchar[\filec at ntents@opt\filec at ntents
+}
+\@namedef{filecontents*}{\@tempswafalse\@fileswtrue
+  \@ifnextchar[\filec at ntents@opt\filec at ntents
+}
+%    \end{macrocode}
+%    To handle the optional argument we execute for each option the
+%    command \cs{filec at ntents@OPTION} if it exist or complain about
+%    unknown option.
+%    \begin{macrocode}
+\def\filec at ntents@opt[#1]{%
+  \@for\@tempa:=#1\do{%
+    \ifcsname filec at ntents@\@tempa\endcsname
+      \csname filec at ntents@\@tempa\endcsname
+    \else
+    \@latex at error{Unknown filecontents option #1}%
+       {Valid options are overwrite, nosearch, nopreamble}%
+    \fi}%
+  \filec at ntents
+}
+%    \end{macrocode}
+%    Option \texttt{overwrite} changes the
+%    overwriting switch
+%    \begin{macrocode}
+\let\filec at ntents@overwrite\@fileswfalse
+%    \end{macrocode}
+%    and option \texttt{nopreamble} the preamble switch (which is
+%    equivalent to using the star form of the environment).
+%    \begin{macrocode}
+\let\filec at ntents@nopreamble\@tempswafalse
+%    \end{macrocode}
+%    Option \texttt{nosearch} only checks the current directory not
+%    the how \TeX{} tree for the existence of the file to write.
+%    \begin{macrocode}
+\def\filec at ntents@nosearch{%
+  \let\filec at ntents@checkdir\@currdir
+  \def\filec at ntents@where{in current directory}}
+%    \end{macrocode}
+%    By default we search the whole tree:
+%    \begin{macrocode}
+\let\filec at ntents@checkdir\@empty
+\def\filec at ntents@where{exists on the system}
+%    \end{macrocode}
+%    
+%    \begin{macrocode}
 \begingroup%
 \@tempcnta=1
 \loop
@@ -1727,15 +1797,10 @@
 %    \end{macrocode}
 %
 %    \begin{macrocode}
-\gdef\filecontents{\@tempswatrue\filec at ntents}%
-\gdef\filecontents*{\@tempswafalse\filec at ntents}%
-%    \end{macrocode}
-%
-%    \begin{macrocode}
 \gdef\filec at ntents#1{%
-   \set at curr@file{#1}%
-   \edef\q at curr@file{\expandafter\quote at name\expandafter{\@curr at file}}%
-   \openin\@inputcheck\q at curr@file \space %
+  \set at curr@file{\filec at ntents@checkdir#1}%
+  \edef\q at curr@file{\expandafter\quote at name\expandafter{\@curr at file}}%
+  \openin\@inputcheck\q at curr@file \space %
   \ifeof\@inputcheck%
     \@latex at warning@no at line%
         {Writing file `\@currdir\@curr at file'}%
@@ -1753,13 +1818,54 @@
 % \changes{v1.0y}{1997/10/10}
 %         {Use \cs{@gobbletwo}}
 %    \begin{macrocode}
-    \closein\@inputcheck%
-    \@latex at warning@no at line%
-            {File `\@curr at file' already exists on the system.\MessageBreak%
+    \if at filesw%
+      \@latex at warning@no at line%
+          {File `\@curr at file' already \filec at ntents@where.\MessageBreak%
              Not generating it from this source}%
-    \let\write\@gobbletwo%
-    \let\closeout\@gobble%
+      \let\write\@gobbletwo%
+      \let\closeout\@gobble%
+    \else%
+%    \end{macrocode}
+%    If we are overwriting, we try to make sure that the user is not
+%    by mistake overwriting the input file (\cs{jobname}). Of course,
+%    this only works for input files ending in \texttt{.tex}. If a
+%    different extension is used there is no way to see that we are
+%    overwriting outselves!
+%    \begin{macrocode}
+      \edef\reserved at a{#1}%
+      \edef\reserved at a{\detokenize\expandafter{\reserved at a}}%
+      \edef\reserved at b{\detokenize\expandafter{\jobname}}%
+      \ifx\reserved at a\reserved at b%
+        \@fileswtrue%
+      \else%
+        \edef\reserved at b{\reserved at b\detokenize{.tex}}%
+        \ifx\reserved at a\reserved at b
+          \@fileswtrue%
+        \fi%
+      \fi%
+%    \end{macrocode}
+%    We allocate a write channel but we open it only if it is
+%    (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%
+      \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%
+        Data is written to screen instead.}%
+      \else%
+        \@latex at warning@no at line%
+           {Writing or overwriting file `\@currdir\@curr at file'}%
+        \immediate\openout\reserved at c#1\relax%
+      \fi%
+    \fi%
   \fi%
+%    \end{macrocode}
+%    Closing the \cs{@inputcheck} is done here ot avoid having to do
+%    this in each branch.
+%    \begin{macrocode}
+  \closein\@inputcheck%
   \if at tempswa%
 %    \end{macrocode}
 %
@@ -1850,7 +1956,15 @@
 %</2ekernel|latexrelease>
 %<latexrelease>\EndIncludeInRelease
 %<latexrelease>\IncludeInRelease{0000/00/00}%
-%<latexrelease>                 {\filec at ntents}{Spaces in file names}%
+%<latexrelease>                 {\filec at ntents}{Spaces in file names + optional arg}%
+%<latexrelease>
+%<latexrelease>\let\filec at ntents@opt        \@undefined
+%<latexrelease>\let\filec at ntents@overwrite  \@undefined
+%<latexrelease>\let\filec at ntents@nopreamble \@undefined
+%<latexrelease>\let\filec at ntents@nosearch   \@undefined
+%<latexrelease>\let\filec at ntents@checkdir   \@undefined
+%<latexrelease>\let\filec at ntents@where      \@undefined
+%<latexrelease>
 %<latexrelease>\begingroup%
 %<latexrelease>\@tempcnta=1
 %<latexrelease>\loop
@@ -1950,12 +2064,16 @@
   \T\I{Tab}{Spac}|
   \immediate\write\@unused{}}
 \global\let\endfilecontents*\endfilecontents
-\@onlypreamble\filecontents
-\@onlypreamble\endfilecontents
-\@onlypreamble\filecontents*
-\@onlypreamble\endfilecontents*
+%    \end{macrocode}
+%    We no longer prevent the code to be used after begin document (no
+%    rollback needed for this change).
+%    \begin{macrocode}
+%\@onlypreamble\filecontents
+%\@onlypreamble\endfilecontents
+%\@onlypreamble\filecontents*
+%\@onlypreamble\endfilecontents*
 \endgroup
-\@onlypreamble\filec at ntents
+%\@onlypreamble\filec at ntents
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
diff --git a/base/testfiles/github-robust-0123.luatex.tlg b/base/testfiles/github-robust-0123.luatex.tlg
index 7a872c1d..db8eb043 100644
--- a/base/testfiles/github-robust-0123.luatex.tlg
+++ b/base/testfiles/github-robust-0123.luatex.tlg
@@ -87,8 +87,6 @@ l. ......dafter\show\csname Downarrow\space\endcsname
 ---------------------------------------
 \extrafloats{5} -> \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 65535 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 65535 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 65535 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 65535 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 65535 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 65535 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 65535 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 65535 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 65535 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 65535 }\endgroup 
 ---------------------------------------
-\filecontents -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
----------------------------------------
 \hglue -> \afterassignment \unhbox \voidb at x \count@ \spacefactor \vrule width\z@ \nobreak \hskip \skip@ \spacefactor \count@ \skip@ =
 ---------------------------------------
 \hideoutput -> \tracingoutput \z@ \showboxbreadth \m at ne \showboxdepth \m at ne \tracingonline \m at ne 
diff --git a/base/testfiles/github-robust-0123.lvt b/base/testfiles/github-robust-0123.lvt
index f8c69450..8dcc89dd 100644
--- a/base/testfiles/github-robust-0123.lvt
+++ b/base/testfiles/github-robust-0123.lvt
@@ -112,6 +112,7 @@
 %\test{\endenumerate}
 %\test{\endeqnarray}
 %\test{\endequation}
+%\test{\filecontents}
 %\test{\endfilecontents}
 %\test{\endflushleft}
 %\test{\endflushright}
@@ -127,25 +128,7 @@
 %\test{\endtabular}
 %\test{\endtrivlist}
 %\test{\endverbatim}
-%\test{\expandafter}
-%\test{\fi}
 %\test{\height}    -- not defined 
-%\test{\ifcase}
-%\test{\ifcsname}
-%\test{\ifdim}
-%\test{\ifeof}
-%\test{\iffalse}
-%\test{\ifhmode}
-%\test{\ifinner}
-%\test{\ifmmode}
-%\test{\ifnum}
-%\test{\ifodd}
-%\test{\iftrue}
-%\test{\ifvbox}
-%\test{\ifvmode}
-%\test{\ifvoid}
-%\test{\ifx}
-%\test{\if}
 %\test{\loop}
 %\test{\newbox}
 %\test{\newcount\foo}
@@ -232,7 +215,6 @@
 \test{\documentstyle}
 \test{\document}
 \test{\extrafloats{5}}
-\test{\filecontents}
 \test{\hglue}
 \test{\hideoutput}
 \test{\includeonly{foo}}
diff --git a/base/testfiles/github-robust-0123.tlg b/base/testfiles/github-robust-0123.tlg
index 659452e1..65105166 100644
--- a/base/testfiles/github-robust-0123.tlg
+++ b/base/testfiles/github-robust-0123.tlg
@@ -87,8 +87,6 @@ l. ......fter\show\csname Downarrow\space\endcsname
 ---------------------------------------
 \extrafloats{5} -> \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup 
 ---------------------------------------
-\filecontents -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
----------------------------------------
 \hglue -> \afterassignment \unhbox \voidb at x \count@ \spacefactor \vrule width\z@ \nobreak \hskip \skip@ \spacefactor \count@ \skip@ =
 ---------------------------------------
 \hideoutput -> \tracingoutput \z@ \showboxbreadth \m at ne \showboxdepth \m at ne \tracingonline \m at ne 
diff --git a/base/testfiles/github-robust-0123.xetex.tlg b/base/testfiles/github-robust-0123.xetex.tlg
index 06d714fd..3ce660e7 100644
--- a/base/testfiles/github-robust-0123.xetex.tlg
+++ b/base/testfiles/github-robust-0123.xetex.tlg
@@ -87,8 +87,6 @@ l. ......fter\show\csname Downarrow\space\endcsname
 ---------------------------------------
 \extrafloats{5} -> \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup \count@ \numexpr \float at count -1\relax \errmessage {No room for a new \dimen }\global \e at alloc@chardef \float at count \count@ \global \e at alloc@chardef \bx at 32767 \float at count \begingroup \let \@elt \relax \xdef \@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ {\@elt \bx at A \@elt \bx at B \@elt \bx at C \@elt \bx at D \@elt \bx at E \@elt \bx at F \@elt \bx at G \@elt \bx at H \@elt \bx at I \@elt \bx at J \@elt \bx at K \@elt \bx at L \@elt \bx at M \@elt \bx at N \@elt \bx at O \@elt \bx at P \@elt \bx at Q \@elt \bx at R \@elt \bx at S \@elt \bx at T \@elt \bx at U \@elt \bx at V \@elt \bx at W \@elt \bx at X \@elt \bx at Y \@elt \bx at Z \@elt \bx at AA \@elt \bx at BB \@elt \bx at CC \@elt \bx at DD \@elt \bx at EE \@elt \bx at FF \@elt \bx at GG \@elt \bx at HH \@elt \bx at II \@elt \bx at JJ \@elt \bx at KK \@elt \bx at LL \@elt \bx at MM \@elt \bx at NN \@elt \bx at OO \@elt \bx at PP \@elt \bx at QQ \@elt \bx at RR \@elt \bx at SS \@elt \bx at TT \@elt \bx at UU \@elt \bx at VV \@elt \bx at WW \@elt \bx at XX \@elt \bx at YY \@elt \bx at ZZ \@elt \bx at 32767 }\endgroup 
 ---------------------------------------
-\filecontents -> \GenericError {               }{LaTeX Error: Can be used only in preamble}{See the LaTeX manual or LaTeX Companion for explanation.}{Your command was ignored.\MessageBreak Type  I <command> <return>  to replace it with another command,\MessageBreak or  <return>  to continue without it.}
----------------------------------------
 \hglue -> \afterassignment \unhbox \voidb at x \count@ \spacefactor \vrule width\z@ \nobreak \hskip \skip@ \spacefactor \count@ \skip@ =
 ---------------------------------------
 \hideoutput -> \tracingoutput \z@ \showboxbreadth \m at ne \showboxdepth \m at ne \tracingonline \m at ne 
diff --git a/base/testfiles/tlb-filecontents-001.lvt b/base/testfiles/tlb-filecontents-001.lvt
new file mode 100644
index 00000000..b1d7aff7
--- /dev/null
+++ b/base/testfiles/tlb-filecontents-001.lvt
@@ -0,0 +1,71 @@
+\documentclass{article}
+
+% not really tested: nosearch to overwrite a system file locally
+
+\input{test2e}
+
+\typeout{We are somewhere in the past: \the\year/\the\month/\the\day}
+
+
+% need the option as the test is run several times
+ 
+\begin{filecontents}[overwrite]{\jobname.txt}   
+ \typeout{1st write: should get written!}   
+\end{filecontents}
+
+\input{\jobname.txt}
+
+\begin{filecontents}{\jobname.txt} 
+ \typeout{2nd write: This should not show up}
+\end{filecontents}
+
+\input{\jobname.txt}
+
+\begin{filecontents}[overwrite]{\jobname.txt} 
+ \typeout{3nd write: This should get written again with preamble}
+\end{filecontents}
+
+\begingroup            
+  \catcode`\%=\active
+  \obeylines
+  \def %#1^^M{\typeout{\string#1}}
+  \input{\jobname.txt}
+\endgroup
+
+
+
+\OMIT
+\begin{document}
+\TIMO
+
+\begin{filecontents}[nopreamble,overwrite]{\jobname.txt} 
+ \typeout{4th write: no preamble this time}
+\end{filecontents}
+
+\begingroup            % should show 4th write again without preamble
+  \catcode`\%=\active
+  \obeylines
+  \def %#1^^M{\typeout{\string#1}}
+  \input{\jobname.txt}
+\endgroup
+
+% first time the test runs it generates the file (since it doesn't exist)
+% on the second run it refuses to write
+
+\begin{filecontents}[nosearch]{\jobname.tex} 
+ \typeout{5th write: to \jobname.tex}
+\end{filecontents}
+
+  \input{\jobname.tex}
+
+% here it should now complain and write to terminal:
+
+\begin{filecontents}[overwrite,nosearch]{\jobname.tex} 
+ \typeout{6th write: overwrite to \jobname.tex}
+\end{filecontents}
+
+% and thus this should still show the 5th write
+  \input{\jobname.tex}
+
+\end{document}
+
diff --git a/base/testfiles-disabled/tlb2215.tlg b/base/testfiles/tlb-filecontents-001.tlg
similarity index 100%
copy from base/testfiles-disabled/tlb2215.tlg
copy to base/testfiles/tlb-filecontents-001.tlg





More information about the latex3-commits mailing list