[latex3-commits] [git/LaTeX3-latex3-latex2e] utf8andspace: This should fix the tlb2140 issue (and the other two) (0f518af)

Frank Mittelbach frank.mittelbach at latex-project.org
Mon Feb 11 11:59:27 CET 2019


Repository : https://github.com/latex3/latex2e
On branch  : utf8andspace
Link       : https://github.com/latex3/latex2e/commit/0f518af40f938dc808f026369f2a2652538255b8

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

commit 0f518af40f938dc808f026369f2a2652538255b8
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date:   Mon Feb 11 11:59:27 2019 +0100

    This should fix the tlb2140 issue (and the other two)


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

0f518af40f938dc808f026369f2a2652538255b8
 base/utf8andspace.tex |   80 ++++++++++++++++++-------------------------------
 1 file changed, 29 insertions(+), 51 deletions(-)

diff --git a/base/utf8andspace.tex b/base/utf8andspace.tex
index 6c9365f..7d5772d 100644
--- a/base/utf8andspace.tex
+++ b/base/utf8andspace.tex
@@ -68,30 +68,8 @@
 \long\def\UTF at fourharmless@octets#1#2#3#4{\string#2\string#3\string#4\string}
 
 
-% the next one isn't quite safe as \@curr at file bight get changed by
-% another test (see 25 year old bug fixed this morning, but that can
-% be mended
 
-\long\def \IfFileExists#1#2#3{%
-  \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
-  \ifeof\@inputcheck
-    \ifx\input at path\@undefined
-      \def\reserved at a{#3}%
-    \else
-      \def\reserved at a{\@iffileonpath\q at curr@file{#2}{#3}}%
-    \fi
-  \else
-    \closein\@inputcheck
-    \edef\@filef at und{\q at curr@file\space }%
-    \def\reserved at a{#2}%
-  \fi
-  \reserved at a}
-
-\long\def \InputIfFileExists#1#2{%
-  \IfFileExists{#1}%
-    {#2\@addtofilelist{#1}\@@input \@filef at und}}
+%-------------------------------------------------------------------------
 
 \def\set at curr@file#1{%
   \begingroup
@@ -100,6 +78,24 @@
   \endgroup
 }
 
+
+%-------------------------------------------------------------------------
+
+% pass quoted file name as normal argument to allow recursive use
+
+\let\IfFileExists@\IfFileExists
+
+\def\IfFileExists#1{%
+  \set at curr@file{#1}%
+  \edef\q at curr@file{\expandafter\quote at name\expandafter{\@curr at file}}%
+  \expandafter\IfFileExists@\expandafter{\q at curr@file}}
+
+
+
+\long\def \InputIfFileExists#1#2{%
+  \IfFileExists{#1}%
+    {#2\@addtofilelist{#1}\@@input \@filef at und}}
+
 \def\@iinput#1{%
   \InputIfFileExists{#1}{}%
   {\filename at parse\@curr at file
@@ -109,35 +105,17 @@
    \reserved at a}}
 
 
-\def\@include#1 {%
-  \clearpage
-  \set at curr@file{#1}%
-  \if at filesw
-    \immediate\write\@mainaux{\string\@input{\@curr at file.aux}}%
-  \fi
-  \@tempswatrue
-  \if at partsw
-    \@tempswafalse
-    \@for\reserved at a:=\@partlist\do
-      {\ifx\reserved at a\@curr at file\@tempswatrue\fi}%
-  \fi
-  \if at tempswa
-    \let\@auxout\@partaux
-    \if at filesw
-      \immediate\openout\@partaux \@curr at file.aux
-      \immediate\write\@partaux{\relax}%
-    \fi
-    \@input@{\@curr at file.tex}%
-    \clearpage
-    \@writeckpt{\@curr at file}%
-    \if at filesw
-      \immediate\closeout\@partaux
-    \fi
+%-------------------------------------------------------------------------
+
+\def\include#1{\relax
+  \ifnum\@auxout=\@partaux
+    \@latex at error{\string\include\space cannot be nested}\@eha
   \else
-    \deadcycles\z@
-    \@nameuse{cp@\@curr at file}%
-  \fi
-  \let\@auxout\@mainaux}
+  \set at curr@file{#1 }%
+  \expandafter\@include\@curr at file
+  \fi}
+
+
 
 % that zapspace ... hmmm
 





More information about the latex3-commits mailing list