summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2024-12-05 21:22:35 +0000
committerKarl Berry <karl@freefriends.org>2024-12-05 21:22:35 +0000
commit8f18b6523ebb388bef832dfde0ff0258075fae9b (patch)
tree2ff1567ca086e5286f8889e5c1768df588c0e599 /Master/texmf-dist/source/latex
parenta3aacbeaf94420c79fb19db16c30e0e0bd1dc0ce (diff)
perltex (5dec24)
git-svn-id: svn://tug.org/texlive/trunk@73044 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r--Master/texmf-dist/source/latex/perltex/perltex.dtx64
-rw-r--r--Master/texmf-dist/source/latex/perltex/perltex.ins4
2 files changed, 54 insertions, 14 deletions
diff --git a/Master/texmf-dist/source/latex/perltex/perltex.dtx b/Master/texmf-dist/source/latex/perltex/perltex.dtx
index ec041818179..0f6c2e52703 100644
--- a/Master/texmf-dist/source/latex/perltex/perltex.dtx
+++ b/Master/texmf-dist/source/latex/perltex/perltex.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-% Copyright (C) 2003-2019 Scott Pakin <scott+pt@pakin.org>
+% Copyright (C) 2003-2024 Scott Pakin <scott+pt@pakin.org>
% --------------------------------------------------------
%
% This file may be distributed and/or modified under the conditions of
@@ -22,7 +22,7 @@
%<package>\NeedsTeXFormat{LaTeX2e}[1999/12/01]
%<package>\ProvidesPackage{perltex}
%<*package>
- [2019/09/14 v2.2 LaTeX macros for use with PerlTeX]
+ [2024/12/03 v2.3 LaTeX macros for use with PerlTeX]
%</package>
%
%<*driver>
@@ -60,7 +60,7 @@
%</driver>
% \fi
%
-% \CheckSum{605}
+% \CheckSum{622}
%
% \CharacterTable
% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
@@ -919,7 +919,7 @@
% \section{License agreement}
% \label{sec:license}
%
-% Copyright \textcopyright{} 2003--2019 Scott Pakin \texttt{<scott+pt@pakin.org>}
+% Copyright \textcopyright{} 2003--2024 Scott Pakin \texttt{<scott+pt@pakin.org>}
%
% \providecommand{\url}[1]{\texttt{##1}}
%
@@ -1887,6 +1887,47 @@
% |\plmac@fromflag| exists. Deferring the read to the end, however,
% enables \PerlTeX{} to support recursive macro invocations.
%
+% \begin{macro}{\plmac@infile}
+% \begin{macro}{\plmac@IfFileExists}
+% \changes{v2.3}{2024/12/03}{Introduce this macro, which implements a
+% non-caching version of \string\cs{IfFileExists}}
+% The Await operations in Figure~\ref{fig:comm-protocol} require testing
+% if a file exists. On the \LaTeX\ side, this normally would be
+% achieved using \LaTeX's \cs{IfFileExists} macro, and this is indeed
+% what \PerlTeX\ did until version~2.2. However, the \mbox{1-Jun-2023}
+% release of \LaTeX3 introduced a performance optimization that lets
+% \cs{IfFileExists} cache prior results. (See
+% \url{https://www.latex-project.org/news/latex2e-news/ltnews37.pdf}.)
+% In other words, once \cs{IfFileExists} determines that a file exists,
+% it will follow the \textsc{true} branch on all subsequent calls
+% without ever re-checking if the file still exists. This semantics
+% breaks the protocol described in Figure~\ref{fig:comm-protocol} by
+% enabling Await to return before the file being waited for actually
+% exists.
+%
+% To work around \LaTeX3's new behavior, we define our own version of
+% \cs{IfFileExists} called \cs{plmac@IfFileExists}, which is derived
+% from \cs{IfFileExists}'s simpler, more straightforward
+% \LaTeXe\ implementation. In particular, file existence is checked
+% explicitly on each invocation.
+% \begin{macrocode}
+\newread\plmac@infile
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand{\plmac@IfFileExists}[3]{%
+ \openin\plmac@infile=#1 %
+ \ifeof\plmac@infile
+ \def\plmac@next{#3}%
+ \else
+ \closein\plmac@infile
+ \def\plmac@next{#2}%
+ \fi
+ \plmac@next
+}
+% \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
% \begin{macro}{\plmac@await@existence}
% \changes{v1.9}{2009/09/13}{Put the
% \texttt{\string\string\string\input\string\string\string\plmac@pipe}
@@ -1895,11 +1936,10 @@
% \begin{macro}{\ifplmac@file@exists}
% \begin{macro}{\plmac@file@existstrue}
% \begin{macro}{\plmac@file@existsfalse}
-% The purpose of the |\plmac@await@existence| macro is to repeatedly
+% The purpose of the \cs{plmac@await@existence} macro is repeatedly to
% check the existence of a given file until the file actually exists.
-% For convenience, we use \LaTeXe's |\IfFileExists| macro to check the
-% file and invoke |\plmac@file@existstrue| or |\plmac@file@existsfalse|,
-% as appropriate.
+% We use \cs{plmac@IfFileExists} (defined above) to check if the file
+% exists and accordingly either continue or exit the loop.
%
% As a performance optimization we |\input| a named pipe. This causes
% the |latex| process to relinquish the CPU until the |perltex| process
@@ -1921,9 +1961,9 @@
\input\plmac@pipe
\end{lrbox}%
\loop
- \IfFileExists{#1}%
- {\plmac@file@existstrue}%
- {\plmac@file@existsfalse}%
+ \plmac@IfFileExists{#1}%
+ {\plmac@file@existstrue}%
+ {\plmac@file@existsfalse}%
\ifplmac@file@exists
\else
\repeat
@@ -2151,7 +2191,7 @@
#
# This is a generated file.
#
-# Copyright (C) 2003-2019 Scott Pakin <scott+pt@pakin.org>
+# Copyright (C) 2003-2024 Scott Pakin <scott+pt@pakin.org>
#
# This file may be distributed and/or modified under the conditions
# of the LaTeX Project Public License, either version 1.3c of this
diff --git a/Master/texmf-dist/source/latex/perltex/perltex.ins b/Master/texmf-dist/source/latex/perltex/perltex.ins
index 0d1ea5f2864..cf00de77201 100644
--- a/Master/texmf-dist/source/latex/perltex/perltex.ins
+++ b/Master/texmf-dist/source/latex/perltex/perltex.ins
@@ -1,5 +1,5 @@
%%
-%% Copyright (C) 2003--2019 Scott Pakin <scott+pt@pakin.org>
+%% Copyright (C) 2003-2024 Scott Pakin <scott+pt@pakin.org>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.3c of this license
@@ -21,7 +21,7 @@
This is a generated file.
-Copyright (C) 2003-2019 Scott Pakin <scott+pt@pakin.org>
+Copyright (C) 2003-2024 Scott Pakin <scott+pt@pakin.org>
This file may be distributed and/or modified under the conditions of
the LaTeX Project Public License, either version 1.3c of this license