[latex3-commits] [git/LaTeX3-latex3-latex2e] earlier-expl3: Incorporate l3 interfaces for filename stack and backend loading (8c49e6bb)
PhelypeOleinik
tex.phelype at gmail.com
Sat Jun 6 03:30:48 CEST 2020
Repository : https://github.com/latex3/latex2e
On branch : earlier-expl3
Link : https://github.com/latex3/latex2e/commit/8c49e6bbd1614695bf129335f6f911020ee59355
>---------------------------------------------------------------
commit 8c49e6bbd1614695bf129335f6f911020ee59355
Author: PhelypeOleinik <tex.phelype at gmail.com>
Date: Fri Jun 5 22:30:48 2020 -0300
Incorporate l3 interfaces for filename stack and backend loading
This commit complements the commit (c1cbabb2):
"Define 2e interfaces for filename stack and backend loading"
in the latex3 repository that defines these interfaces.
The code in this commit requires that LaTeX2e the version of l3kernel
at least equal to the referenced commit.
>---------------------------------------------------------------
8c49e6bbd1614695bf129335f6f911020ee59355
base/ltclass.dtx | 7 +++-
base/ltexpl.dtx | 112 ++++++++++++++++++++++++++++++++++++++-----------------
base/ltfiles.dtx | 1 +
3 files changed, 83 insertions(+), 37 deletions(-)
diff --git a/base/ltclass.dtx b/base/ltclass.dtx
index dd35be9a..b424ae2c 100644
--- a/base/ltclass.dtx
+++ b/base/ltclass.dtx
@@ -554,16 +554,19 @@
% |#4| Rest of the stack.
% \begin{macrocode}
\def\@pushfilename{%
+ \@expl at push@filename@@
\xdef\@currnamestack{%
{\@currname}%
{\@currext}%
{\the\catcode`\@}%
- \@currnamestack}}
+ \@currnamestack}%
+ \@expl at push@filename at aux@@}
\@onlypreamble\@pushfilename
% \end{macrocode}
%
% \begin{macrocode}
-\def\@popfilename{\expandafter\@p at pfilename\@currnamestack\@nil}
+\def\@popfilename{\expandafter\@p at pfilename\@currnamestack\@nil
+ \@expl at pop@filename@@}
\@onlypreamble\@popfilename
% \end{macrocode}
%
diff --git a/base/ltexpl.dtx b/base/ltexpl.dtx
index 5e726298..a77ae471 100644
--- a/base/ltexpl.dtx
+++ b/base/ltexpl.dtx
@@ -77,39 +77,86 @@
% \changes{v1.1}{2020/03/05}
% {Load xparse.ltx if \cs{NewDocumentCommand} is not defined
% by expl3.ltx}
+%
+% First define some blank commands, so that in case something goes wrong while
+% loading \textsf{expl3}, we won't get strange \texttt{Undefined control
+% sequence} errors.
+% \begin{macrocode}
+%<*2ekernel>
+\def\@expl at sys@load at backend@@{}
+\def\@expl at push@filename@@{}
+\def\@expl at push@filename at aux@@{}
+\def\@expl at pop@filename@@{}
+%</2ekernel>
+% \end{macrocode}
+%
+% Now define some basics to support loading \textsf{expl3}. These macros can
+% be defined here safely, because they are redefined later on by the kernel,
+% so we define simpler versions just to suit our needs.
% \begin{macrocode}
+%<*2ekernel>
+\long\def\@gobble#1{}
+\long\def\@firstofone#1{#1}
+\long\def\@firstoftwo#1#2{#1}
+\long\def\@secondoftwo#1#2{#2}
+\long\def\IfFileExists#1{%
+ \openin\@inputcheck"#1" %
+ \ifeof\@inputcheck
+ \expandafter\@secondoftwo
+ \else
+ \closein\@inputcheck
+ \expandafter\@firstoftwo
+ \fi}
+\long\def\@ifnextchar#1#2#3{%
+ \let\reserved at d=#1%
+ \def\reserved at a{#2}%
+ \def\reserved at b{#3}%
+ \futurelet\@let at token\@ifnch}
+\def\@ifnch{%
+ \ifx\@let at token\reserved at d
+ \expandafter\reserved at a
+ \else
+ \expandafter\reserved at b
+ \fi}
+%</2ekernel>
+% \end{macrocode}
\expandafter\ifx\csname tex\string _let:D\endcsname\relax
- \IfFileExists{expl3.ltx}
- {%
- \ifnum0%
- \ifdefined\pdffilesize 1\fi
- \ifdefined\filesize 1\fi
- \ifdefined\luatexversion\ifnum\luatexversion>94 1\fi\fi
- >0 %
- \expandafter\@firstofone
- \else
- \message{Skipping expl3-dependent extensions}
-%<2ekernel> \expandafter\endinput
-%<latexrelease> \expandafter\@gobble
- \fi
- }
- {%
- \message{Skipping expl3-dependent extensions}%
-%<2ekernel> \endinput
-%<latexrelease> \@gobble
- }%
- {%
- \input{expl3.ltx}
- \ifdefined\NewDocumentCommand
- \else
- \IfFileExists{xparse.ltx}
- {\input{xparse.ltx}}
- {}%
- \fi
- }%
+ \expandafter\@firstofone
\else
- \GenericInfo{}{Skipping: expl3 code already part of the format}
+ \GenericInfo{}{Skipping: expl3 code already part of the format}%
+%<2ekernel> \expandafter\endinput
+%<latexrelease> \expandafter\@gobble
\fi
+ {%
+ \IfFileExists{expl3.ltx}
+ {%
+ \ifnum0%
+ \ifdefined\pdffilesize 1\fi
+ \ifdefined\filesize 1\fi
+ \ifdefined\luatexversion\ifnum\luatexversion>94 1\fi\fi
+ >0 %
+ \expandafter\@firstofone
+ \else
+ \message{Skipping expl3-dependent extensions}%
+%<2ekernel> \expandafter\endinput
+%<latexrelease> \expandafter\@gobble
+ \fi
+ }
+ {%
+ \message{Skipping expl3-dependent extensions}%
+%<2ekernel> \endinput
+%<latexrelease> \@gobble
+ }%
+ {%
+ \input expl3.ltx
+ \ifdefined\NewDocumentCommand
+ \else
+ \IfFileExists{xparse.ltx}
+ {\input xparse.ltx }
+ {}%
+ \fi
+ }%
+ }
%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
% \end{macrocode}
@@ -141,7 +188,6 @@
% \end{macrocode}
%
% \begin{macrocode}
-%</2ekernel|latexrelease>
%<latexrelease>\EndIncludeInRelease
%<latexrelease>\IncludeInRelease{0000/00/00}%
%<latexrelease> {\@expl at tl@trim at spaces@apply@@nN}
@@ -150,11 +196,7 @@
%<latexrelease>\let\@expl at tl@trim at spaces@apply@@nN\@undefined
%<latexrelease>
%<latexrelease>\EndIncludeInRelease
-%<*2ekernel>
-% \end{macrocode}
-%
-% \begin{macrocode}
-%</2ekernel>
+%</2ekernel|latexrelease>
% \end{macrocode}
%
% \Finale
diff --git a/base/ltfiles.dtx b/base/ltfiles.dtx
index 8e9611d9..19a45640 100644
--- a/base/ltfiles.dtx
+++ b/base/ltfiles.dtx
@@ -241,6 +241,7 @@
% Cancel the |\begingroup| from |\begin|.
% \begin{macrocode}
\def\document{\endgroup
+ \@expl at sys@load at backend@@
% \end{macrocode}
% If some options on |\documentclass| haven't been used by any
% package we will now give a warning since this is most certainly a
More information about the latex3-commits
mailing list.