summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3file.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3file.dtx43
1 files changed, 36 insertions, 7 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
index b057b04dc80..0b6a3b58842 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
@@ -37,7 +37,7 @@
\documentclass[full]{l3doc}
%</driver>
%<*driver|package>
-\GetIdInfo$Id: l3file.dtx 5627 2015-06-07 09:26:26Z bruno $
+\GetIdInfo$Id: l3file.dtx 5688 2015-07-27 16:57:49Z bruno $
{L3 File and I/O operations}
%</driver|package>
%<*driver>
@@ -593,7 +593,8 @@
% \begin{variable}{\g_file_current_name_tl}
% The name of the current file should be available at all times.
% For the format the file name needs to be picked up at the start of the
-% file. In package mode the current file name is collected from \LaTeXe{}.
+% file. In \LaTeXe{} package mode the current file name is collected from
+% \tn{@currname}.
% \begin{macrocode}
\tl_new:N \g_file_current_name_tl
%<*initex>
@@ -604,7 +605,8 @@
}
%</initex>
%<*package>
-\tl_gset_eq:NN \g_file_current_name_tl \@currname
+\cs_if_exist:NT \@currname
+ { \tl_gset_eq:NN \g_file_current_name_tl \@currname }
%</package>
% \end{macrocode}
% \end{variable}
@@ -1044,6 +1046,22 @@
% \end{macro}
% \end{macro}
%
+% \begin{macro}[int]{\@@_new:N}
+% In package mode, streams are reserved using \tn{newread} before they
+% can be managed by \pkg{ior}. To prevent \pkg{ior} from being
+% affected by redefinitions of \tn{newread} (such as done by the
+% third-party package \pkg{morewrites}), this macro is saved here
+% under a private name. The complicated code ensures that
+% \cs{@@_new:N} is not \tn{outer} despite plain \TeX{}'s \tn{newread}
+% being \tn{outer}.
+% \begin{macrocode}
+%<*package>
+\exp_args:NNNo \exp_args:NNo \cs_new_protected_nopar:Npn \@@_new:N
+ { \cs:w newread \cs_end: }
+%</package>
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}[int]{\@@_open:Nn, \@@_open:No}
% \begin{macro}[aux]{\@@_open_stream:Nn}
% The stream allocation itself uses the fact that there is a list of all of
@@ -1051,8 +1069,8 @@
% the top of the list. In package mode, life gets more complex as it's
% important to keep things in sync. That is done using a two-part approach:
% any streams that have already been taken up by \pkg{ior} but are now free
-% are tracked, so we first try those. If that fails, ask \LaTeXe{} for a new
-% stream and use that number (after a bit of conversion).
+% are tracked, so we first try those. If that fails, ask plain \TeX{} or \LaTeXe{}
+% for a new stream and use that number (after a bit of conversion).
% \begin{macrocode}
\cs_new_protected:Npn \@@_open:Nn #1#2
{
@@ -1064,7 +1082,7 @@
%</initex>
%<*package>
{
- \cs:w newread \cs_end: #1
+ \@@_new:N #1
\tl_set:Nx \l_@@_stream_tl { \int_eval:n {#1} }
\@@_open_stream:Nn #1 {#2}
}
@@ -1265,6 +1283,17 @@
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}[int]{\@@_new:N}
+% As for read streams, copy \tn{newwrite} in package mode, making sure
+% that it is not \tn{outer}.
+% \begin{macrocode}
+%<*package>
+\exp_args:NNNo \exp_args:NNo \cs_new_protected_nopar:Npn \@@_new:N
+ { \cs:w newwrite \cs_end: }
+%</package>
+% \end{macrocode}
+% \end{macro}
+%
% \begin{macro}{\iow_open:Nn, \iow_open:cn}
% \begin{macro}[int]{\@@_open:Nn}
% \begin{macro}[aux]{\@@_open_stream:Nn}
@@ -1284,7 +1313,7 @@
%</initex>
%<*package>
{
- \cs:w newwrite \cs_end: #1
+ \@@_new:N #1
\tl_set:Nx \l_@@_stream_tl { \int_eval:n {#1} }
\@@_open_stream:Nn #1 {#2}
}