summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-05-05 22:01:18 +0000
committerKarl Berry <karl@freefriends.org>2014-05-05 22:01:18 +0000
commitd78a5a4de1e73a2151e8ed2635a199d928ccb559 (patch)
treeca490a3efa7d3614793427f850ec1aeb6bf971f1 /Master/texmf-dist/source/latex/l3kernel/l3file.dtx
parentb41cac6cebc8095cf8eaf7e84f8a2d5f63b7be38 (diff)
latex3 (5may14)
git-svn-id: svn://tug.org/texlive/trunk@33859 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3file.dtx')
-rw-r--r--Master/texmf-dist/source/latex/l3kernel/l3file.dtx62
1 files changed, 38 insertions, 24 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
index bd9898475a6..45bb0ec7adf 100644
--- a/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
+++ b/Master/texmf-dist/source/latex/l3kernel/l3file.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3file.dtx Copyright (C) 1990-2013 The LaTeX3 Project
+%% File: l3file.dtx Copyright (C) 1990-2014 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -33,13 +33,14 @@
%%
%% -----------------------------------------------------------------------
%
+%<*driver>
+\documentclass[full]{l3doc}
+%</driver>
%<*driver|package>
-\RequirePackage{l3bootstrap}
-\GetIdInfo$Id: l3file.dtx 4596 2013-10-13 21:24:01Z joseph $
+\GetIdInfo$Id: l3file.dtx 4737 2014-05-05 07:37:48Z joseph $
{L3 File and I/O operations}
%</driver|package>
%<*driver>
-\documentclass[full]{l3doc}
\begin{document}
\DocInput{\jobname.dtx}
\end{document}
@@ -192,7 +193,7 @@
% allocated to \meta{file name} until a \cs{ior_close:N} instruction
% is given or the \TeX{} run ends.
% \end{function}
-%
+%
% \begin{function}[added = 2013-01-12, TF]{\ior_open:Nn, \ior_open:cn}
% \begin{syntax}
% \cs{ior_open:NnTF} \meta{stream} \Arg{file name} \Arg{true code} \Arg{false code}
@@ -416,11 +417,11 @@
% Additional functions may be added to the wrapping by using the
% \meta{set up}, which is executed before the wrapping takes place: this
% may include overriding the substitutions listed.
-%
+%
% Any expandable material in the \meta{text} which is not to be expanded
% on wrapping should be converted to a string using \cs{token_to_str:N},
% \cs{tl_to_str:n}, \cs{tl_to_str:N}, \emph{etc.}
-%
+%
% The result of the wrapping operation is passed as a braced argument to the
% \meta{function}, which will typically be a wrapper around a write
% operation. The output of \cs{iow_wrap:nnnN} (\emph{i.e.}~the argument
@@ -428,7 +429,7 @@
% \enquote{other} (category code~12), with the exception of spaces which
% will have category \enquote{space} (category code~10). This means that the
% output will \emph{not} expand further when written to a file.
-%
+%
% \begin{texnote}
% Internally, \cs{iow_wrap:nnnN} carries out an \texttt{x}-type expansion
% on the \meta{text} to expand it. This is done in such a way that
@@ -551,14 +552,6 @@
%<@@=file>
% \end{macrocode}
%
-% \begin{macrocode}
-%<*package>
-\ProvidesExplPackage
- {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
-\__expl_package_check:
-%</package>
-% \end{macrocode}
-%
% \subsection{File operations}
%
% \begin{variable}{\g_file_current_name_tl}
@@ -738,6 +731,7 @@
% \end{macro}
%
% \begin{macro}{\file_input:n}
+% \begin{macro}[int]{\@@_if_exist:nT}
% \begin{macro}[aux]{\@@_input:n \@@_input:V}
% \begin{macro}[aux]{\@@_input_aux:n, \@@_input_aux:o}
% Loading a file is done in a safe way, checking first that the file
@@ -747,13 +741,22 @@
% \begin{macrocode}
\cs_new_protected:Npn \file_input:n #1
{
+ \@@_if_exist:nT {#1}
+ { \@@_input:V \l_@@_internal_name_tl }
+ }
+% \end{macrocode}
+% This code is spun out as a separate function so it is available
+% for other kernel file operations which have the same logic.
+% \begin{macrocode}
+\cs_new_protected:Npn \@@_if_exist:nT #1#2
+ {
\file_add_path:nN {#1} \l_@@_internal_name_tl
\quark_if_no_value:NTF \l_@@_internal_name_tl
{
\@@_name_sanitize:nn {#1}
{ \__msg_kernel_error:nnx { kernel } { file-not-found } }
}
- { \@@_input:V \l_@@_internal_name_tl }
+ { #2 }
}
\cs_new_protected:Npn \@@_input:n #1
{
@@ -783,6 +786,7 @@
% \end{macro}
% \end{macro}
% \end{macro}
+% \end{macro}
%
% \begin{macro}{\file_path_include:n}
% \begin{macro}{\file_path_remove:n}
@@ -907,7 +911,7 @@
\cs_generate_variant:Nn \ior_new:N { c }
% \end{macrocode}
% \end{macro}
-%
+%
% \begin{macro}{\ior_open:Nn, \ior_open:cn}
% \begin{macro}[aux]{\@@_open_aux:Nn}
% Opening an input stream requires a bit of pre-processing. The file name
@@ -929,7 +933,7 @@
% \end{macrocode}
% \end{macro}
% \end{macro}
-%
+%
% \begin{macro}[TF]{\ior_open:Nn, \ior_open:cn}
% \begin{macro}[aux]{\@@_open_aux:NnTF}
% Much the same idea for opening a read with a conditional, except the
@@ -953,7 +957,7 @@
% \end{macrocode}
% \end{macro}
% \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
@@ -974,7 +978,7 @@
%</initex>
%<*package>
{
- \newread #1
+ \cs:w newread \cs_end: #1
\tl_set:Nx \l_@@_stream_tl { \int_eval:n {#1} }
\@@_open_stream:Nn #1 {#2}
}
@@ -1182,7 +1186,7 @@
%</initex>
%<*package>
{
- \newwrite #1
+ \cs:w newwrite \cs_end: #1
\tl_set:Nx \l_@@_stream_tl { \int_eval:n {#1} }
\@@_open_stream:Nn #1 {#2}
}
@@ -1286,7 +1290,7 @@
%
% \begin{macro}{\iow_newline:}
% Global variable holding the character that forces a new line when
-% something is written to an output stream
+% something is written to an output stream.
% \begin{macrocode}
\cs_new_nopar:Npn \iow_newline: { ^^J }
% \end{macrocode}
@@ -1450,6 +1454,7 @@
% \end{macro}
%
% \begin{macro}{\iow_wrap:nnnN}
+% \begin{macro}[aux]{\@@_wrap_set:Nx}
% The main wrapping function works as follows. First give |\\|,
% \verb*|\ | and other formatting commands the correct definition for
% messages, before fully-expanding the input. In package mode, the
@@ -1484,7 +1489,7 @@
\tl_set:Nx \l_@@_wrap_tl {#1}
%</initex>
%<*package>
- \protected@edef \l_@@_wrap_tl {#1}
+ \@@_wrap_set:Nx \l_@@_wrap_tl {#1}
%</package>
% \end{macrocode}
% This is a bit of a hack to measure the string length of the run on text
@@ -1515,6 +1520,15 @@
#4 \l_@@_wrap_tl
}
% \end{macrocode}
+% As using the generic loader will mean that \cs{protected@edef} is
+% not available, it's not placed directly in the wrap function but is set
+% up as an auxiliary. In the generic loader this can then be redefined.
+% \begin{macrocode}
+%<*package>
+\cs_new_eq:NN \@@_wrap_set:Nx \protected@edef
+%</package>
+% \end{macrocode}
+% \end{macro}
% \end{macro}
%
% \begin{macro}[aux]{\@@_wrap_loop:w}