From f4eb27d3314d15838f674a3872000159d029f88b Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Tue, 22 May 2007 17:46:23 +0000
Subject: update expl3

git-svn-id: svn://tug.org/texlive/trunk@4335 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/source/latex/expl3/l3io.dtx | 179 ++++++++++++++++++--------
 1 file changed, 127 insertions(+), 52 deletions(-)

(limited to 'Master/texmf-dist/source/latex/expl3/l3io.dtx')

diff --git a/Master/texmf-dist/source/latex/expl3/l3io.dtx b/Master/texmf-dist/source/latex/expl3/l3io.dtx
index ae155f4d2b3..04efa42b8d7 100644
--- a/Master/texmf-dist/source/latex/expl3/l3io.dtx
+++ b/Master/texmf-dist/source/latex/expl3/l3io.dtx
@@ -1,15 +1,50 @@
 % \iffalse
-%% File: l3io.dtx Copyright (C) 1990-1998 LaTeX3 project
-%
+%% File: l3io.dtx Copyright (C) 1990-2006 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
+%% license or (at your option) any later version.  The latest version
+%% of this license is in the file
+%%
+%%    http://www.latex-project.org/lppl.txt
+%%
+%% This file is part of the ``expl3 bundle'' (The Work in LPPL)
+%% and all files in that bundle must be distributed together.
+%%
+%% The released version of this bundle is available from CTAN.
+%%
+%% -----------------------------------------------------------------------
+%%
+%% The development version of the bundle can be found at
+%%
+%%    http://www.latex-project.org/cgi-bin/cvsweb.cgi/
+%%
+%% for those people who are interested.
+%%
+%%%%%%%%%%%
+%% NOTE: %%
+%%%%%%%%%%%
+%%
+%%   Snapshots taken from the repository represent work in progress and may
+%%   not work or may contain conflicting material!  We therefore ask
+%%   people _not_ to put them into distributions, archives, etc. without
+%%   prior consultation with the LaTeX Project Team.
+%%
+%% -----------------------------------------------------------------------
+%
+%<package>\RequirePackage{l3names}
 %<*dtx>
-          \ProvidesFile{l3io.dtx}
+%\fi
+\def\GetIdInfo$Id: #1.dtx #2 #3-#4-#5 #6 #7$#8{%
+  \def\fileversion{#2}%
+  \def\filedate{#3/#4/#5}%
+  \ProvidesFile{#1.dtx}[#3/#4/#5 v#2 #8]%
+}
+%\iffalse
 %</dtx>
-%<package>\NeedsTeXFormat{LaTeX2e}
-%<package>\ProvidesPackage{l3io}
-%<driver> \ProvidesFile{l3io.drv}
-% \fi
-%         \ProvidesFile{l3io.dtx}
-          [1998/04/20 v1.0c L3 Experimental i/o module]
+%\fi
+\GetIdInfo$Id: l3io.dtx 573 2006-08-21 20:59:37Z morten $
+          {L3 Experimental i/o module}
 %
 % \iffalse
 %<*driver>
@@ -233,13 +268,6 @@
 % prompting.
 % \end{variable}
 %
-% \begin{variable}{\g_iow_newline_code}
-% Global variable holding the character number of the character that
-% denotes a new line when something is written to an output stream.
-% \begin{texnote}
-% A.k.a \tn{newlinechar}.
-% \end{texnote}
-% \end{variable}
 %
 % \subsection{Internal functions}
 %
@@ -264,14 +292,15 @@
 % \end{texnote}
 % \end{function}
 %
+% \StopEventually{}
 %
-% \section{Lowlevel i/o-commands}
+% \subsection{The Implementation}
 %
 %    We start by ensuring that the required packages are loaded.
 %    \begin{macrocode}
 %<package&check>\RequirePackage{l3chk}\par
 %<package>\RequirePackage{l3toks}\par
-%<*package>
+%<*initex|package>
 %    \end{macrocode}
 %
 % This section is primarily concerned with input and output streams.
@@ -279,7 +308,7 @@
 % (for write) as module names. e.g.\ |\c_ior_test_stream| is an input stream
 % variable called `test'.
 %
-% \subsection{Output streams}
+% \subsubsection{Output streams}
 %
 % \begin{macro}{\iow_new:N}
 % \begin{macro}{\iow_new:c}
@@ -287,8 +316,11 @@
 %    As we currently do not distribute a new allocation module we nick
 %    the |\newwrite| function.
 %    \begin{macrocode}
-\def_new:Npn \iow_new:N {}
-\let:NN \iow_new:N \newwrite
+%<*initex>
+\alloc_setup_type:nnn {iow} \c_zero \c_sixteen
+\def_new:Npn \iow_new:N #1 {\alloc_reg:NnNN g {iow} \tex_chardef:D #1}
+%</initex>
+%<package>\let:NN \iow_new:N \newwrite
 \def_new:Npn \iow_new:c {\exp_args:Nc \iow_new:N}
 %    \end{macrocode}
 % \end{macro}
@@ -301,7 +333,7 @@
 %    are provided. The streams are opened immediately.
 %
 %    From some bad experiences on the mainframe, I learned that it is
-%    better to force the close before opening a dataset for writing. 
+%    better to force the close before opening a dataset for writing.
 %    We have to check whether this is also necessary in case of
 %    |\tex_openin:D|.
 %    \begin{macrocode}
@@ -337,7 +369,7 @@
 % \end{macro}
 % \end{macro}
 %
-% \subsubsection{Immediate writing}
+% \paragraph{Immediate writing}
 %
 % \begin{macro}{\iow_expanded:Nn}
 %    An abbreviation for an often used operation, which immediately
@@ -353,8 +385,8 @@
 %    If the first argument is no output stream at all, we get an
 %    internal error.
 %    \begin{macrocode}
-\def_new:Npn \iow_unexpanded:Nn #1#2{\toks_gset:Nn \g_tmpa_toks {#2}
-   \iow_expanded:Nn #1{\toks_use:N \g_tmpa_toks}}
+\def_new:Npn \iow_unexpanded:Nn #1#2{
+   \iow_expanded:Nn #1{\exp_not:n{#2}}}
 %    \end{macrocode}
 % \end{macro}
 %
@@ -391,7 +423,7 @@
 \def_new:Npn \iow_unexpanded_if_avail:Nn #1{
 %    \end{macrocode}
 %    In this routine we have to check whether or not the output stream
-%    that was requested is defined at all. 
+%    that was requested is defined at all.
 %    So we check if the name is still free.
 %    \begin{macrocode}
   \cs_free:NTF #1\use_none:n {\iow_unexpanded:Nn #1}}
@@ -422,10 +454,10 @@
 %
 %    \begin{macrocode}
 \def_new:Npn \iow_long_expanded_aux:w #1#2#3{
-   \group_begin:\g_iow_newline_code`\ #1#2{#3}\group_end:}
-\def_new:Npn \iow_long_expanded:Nn {\iow_long_expanded_aux:w 
+   \group_begin:\tex_newlinechar:D`\ #1#2{#3}\group_end:}
+\def_new:Npn \iow_long_expanded:Nn {\iow_long_expanded_aux:w
                                     \iow_expanded:Nn}
-\def_new:Npn \iow_long_unexpanded:Nn {\iow_long_expanded_aux:w 
+\def_new:Npn \iow_long_unexpanded:Nn {\iow_long_expanded_aux:w
                                       \iow_unexpanded:Nn}
 %    \end{macrocode}
 % \end{macro}
@@ -433,7 +465,10 @@
 % \end{macro}
 %
 %
-% \subsubsection{Deferred writing}
+% \paragraph{Deferred writing}
+% 
+% With \eTeX\ available deferred writing is easy. The comments below
+% are old.
 %
 % Deferred writing to output streams is a bit more complicated because
 % there seems to be no nice hack for writing unexpanded. The only
@@ -459,24 +494,35 @@
 %    Now the harder part:
 %    \begin{macrocode}
 \def_new:Npn \iow_deferred_unexpanded:Nn #1#2{
-  \tlp_set:Nn \l_tmpa_tlp {#2}
-  \tlp_set:Nx \l_tmpb_tlp 
-              {\iow_deferred_expanded:Nn #1{\tlp_to_str:N \l_tmpa_tlp}}
-  \l_tmpb_tlp}
+  \iow_deferred_expanded:Nn{\exp_not:n{#2}}
+}
+%% Old implementation:
+%\def_new:Npn \iow_deferred_unexpanded:Nn #1#2{
+%  \tlp_set:Nn \l_tmpa_tlp {#2}
+%  \tlp_set:Nx \l_tmpb_tlp
+%              {\iow_deferred_expanded:Nn #1{\tlp_to_str:N \l_tmpa_tlp}}
+%  \l_tmpb_tlp}
 %    \end{macrocode}
 % \end{macro}
 %
 % Long forms of these functions are not possible since the deferred
-% writing will restore the value of |\g_iow_newline_code| before it will have
+% writing will restore the value of |\tex_newlinechar:D| before it will have
 % a chance to act. But on the other hand it is nevertheless possible
-% to make all deferred writes long by setting the |\g_iow_newline_code|
+% to make all deferred writes long by setting the |\tex_newlinechar:D|
 % inside the output routine just before the |\tex_shipout:D|. The only
 % disadvantage of this method is the fact that messages to the
 % terminal during this time will also then break at spaces. But we
 % should consider this.
 %
-% \subsubsection{Special characters for writing}
+% \paragraph{Special characters for writing}
 %
+% \begin{macro}{\iow_newline:}
+%    Global variable holding the character that forces a new line when
+%    something is written to an output stream. 
+%    \begin{macrocode}
+\def_new:Npn \iow_newline: {^^J}
+%    \end{macrocode}
+% \end{macro}
 %
 % \begin{macro}{\c_iow_comment_char}
 % \begin{macro}{\c_iow_lbrace_char}
@@ -485,44 +531,46 @@
 %   achieve this by defining global constants to expand into a version of
 %   these characters with |\tex_catcode:D|${}=12$.
 %    \begin{macrocode}
-\tex_catcode:D `\%= 12 \scan_stop:
-\tlp_new:Nn \c_iow_comment_char {%}
-\tex_catcode:D `\%= 14 \scan_stop:
+\tlp_new:Nx \c_iow_comment_char {\cs_to_str:N\%}
 %    \end{macrocode}
 %    To avoid another allocation function which is probably only
 %    necessary here we use the |\def:Npx| command directly.
 %    \begin{macrocode}
-\tlp_new:Nn \c_iow_lbrace_char{}
-\tlp_new:Nn \c_iow_rbrace_char{}
-\def:Npx\c_iow_lbrace_char {\token_to_string:N{}
-\def:Npx\c_iow_rbrace_char {\token_to_string:N}}
+\tlp_new:Nx \c_iow_lbrace_char{\cs_to_str:N\{}
+\tlp_new:Nx \c_iow_rbrace_char{\cs_to_str:N\}}
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 % \end{macro}
 %
 %
-% \subsection{Input streams}
+% \subsubsection{Input streams}
 %
 % \begin{macro}{\ior_new:N}
 %    Allocation of new input streams is done by this function.
 %    As we currently do not distribute a new allocation module we nick
 %    the |\newwread| function.
 %    \begin{macrocode}
-\def_new:Npn \ior_new:N {}
-\let:NN \ior_new:N \newread
+%<*initex>
+\alloc_setup_type:nnn {ior} \c_zero \c_sixteen
+\def_new:Npn \ior_new:N #1 {\alloc_reg:NnNN g {ior} \tex_chardef:D #1}
+%</initex>
+%<package>\let:NN \ior_new:N \newread
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\ior_open:Nn}
+% \begin{macro}{\ior_close:Nn}
 %    Processing of input-streams (via |\tex_openin:D| and |closein|) is
 %    always `immediate' as far as \TeX{} is concerned. An extra
 %    |\tex_immediate:D| is silently ignored.
 %    \begin{macrocode}
+\let:NN \ior_close:N \tex_closein:D
 \def_new:Npn \ior_open:Nn #1#2{\ior_close:N #1\scan_stop:
                                \tex_openin:D#1#2\scan_stop:}
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 % \begin{macro}{\ior_eof:NTF}
 %    |\ior_eof:NTF | \m{stream} \m{true case} \m{false case}.  To
@@ -530,19 +578,22 @@
 %    conditional is provided:
 %    \begin{macrocode}
 \def_new:Npn \ior_eof:NTF #1{\if_eof:w#1
-     \exp_after:NN\use_choice_i:nn \else:
-     \exp_after:NN\use_choice_ii:nn \fi:}
+     \exp_after:NN\use_arg_i:nn \else:
+     \exp_after:NN\use_arg_ii:nn \fi:}
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{\ior_eof:NF}
+% \begin{macro}{\if_eof:w}
 %    |\ior_eof:NF | \m{stream}  \m{false case}.  Do something if
 %    if there is still something to read from this file:
 %    \begin{macrocode}
+\let:NN \if_eof:w \tex_ifeof:D
 \def_new:Npn \ior_eof:NF #1{\if_eof:w#1
-        \exp_after:NN \use_none:nn \fi: \use:n}
+        \exp_after:NN \use_none:nn \fi: \use_arg_i:n}
 %    \end{macrocode}
 % \end{macro}
+% \end{macro}
 %
 %
 % \begin{macro}{\ior_to:NN}
@@ -567,11 +618,35 @@
 %
 %    Show token usage:
 %    \begin{macrocode}
-%</package>
+%</initex|package>
 %<*showmemory>
 \showMemUsage
 %</showmemory>
 %    \end{macrocode}
 %
+% \endinput
+%
+% $Log$
+% Revision 1.16  2006/03/20 18:26:36  braams
+% Updated the copyright notice (2006) and demoted all implementation
+% sections to subsections and so on to clean up the toc for source3.tex
+%
+% Revision 1.15  2005/12/27 09:51:27  morten
+% Changed the use of RCS information
+%
+% Revision 1.14  2005/11/07 17:59:48  morten
+% Fixed definition of \iow_newline: (moved it to the right place)
+%
+% Revision 1.13  2005/04/29 22:29:23  braams
+% Replaced the undefined \g_iow_newline_code with \tex_newlinechar:D
+% and added the definition for \iow_newline:
+%
+% Revision 1.12  2005/04/06 22:35:37  braams
+% Now we have register allocation fitted
+%
+% Revision 1.11  2005/03/16 22:36:24  braams
+% Added the tweaks necessary to be able to load with initex
+%
+% Revision 1.10  2005/03/11 21:39:10  braams
+% Fixed the use of RCS information; added \StopEventually
 %
-
-- 
cgit v1.2.3

