diff options
author | Karl Berry <karl@freefriends.org> | 2011-12-11 22:32:04 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2011-12-11 22:32:04 +0000 |
commit | 3cc0c51eddc31f37b82f651016191bf3575f3aac (patch) | |
tree | 85e3f4cfbe245c416571020e0eb1136193596550 /Master/texmf-dist | |
parent | c56f30c6154e55286a21f438d5ed545a5169f13b (diff) |
l3kernel 3036 (11dec11)
git-svn-id: svn://tug.org/texlive/trunk@24822 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
41 files changed, 2066 insertions, 2351 deletions
diff --git a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf Binary files differindex 44463fb28ca..4c0b18a2777 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/expl3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf Binary files differindex 0fef6f68bce..c528d14d5f8 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/interface3.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf Binary files differindex aa3dbe84f59..e807248c0db 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3styleguide.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf Binary files differindex 10737ce65b2..6560e2358ad 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/l3syntax-changes.pdf diff --git a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf Binary files differindex 90890b118b4..e224a9283aa 100644 --- a/Master/texmf-dist/doc/latex/l3kernel/source3.pdf +++ b/Master/texmf-dist/doc/latex/l3kernel/source3.pdf diff --git a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx index e4e3f97ae46..2cd14966976 100644 --- a/Master/texmf-dist/source/latex/l3kernel/expl3.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/expl3.dtx @@ -37,8 +37,8 @@ \RequirePackage{l3names} \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2011/11/19} -\def\ExplFileVersion{2966} +\def\ExplFileDate{2011/12/07} +\def\ExplFileVersion{3036} %</driver|package> %<*driver> \documentclass[full]{l3doc} @@ -290,13 +290,13 @@ % \cs{if_cs_exist:N} which, as might be expected, tests if a command % name exists. % -% As a semi-formalized concept the letter |g| is sometimes used to -% prefix certain parts of the \meta{description} -% to mark the function as \enquote{globally acting}, \emph{e.g.}, -% \cs{int_set:Nn} is -% a local operation while \cs{int_gset:Nn} is a global operation. This -% of course goes hand in hand with when to use |l_| and |g_| -% variable prefixes. +% Where functions for variable manipulation can perform assignments +% either locally or globally, the latter case is indicated by the inclusion of +% a |g| in the second part of the function name. Thus \cs{tl_set:Nn} is a local +% function but \cs{tl_gset:Nn} acts globally. Functions of this type are +% always documented together, and the scope of action may therefore be +% inferred from the presence or absence of a |g|. See the next subsection for +% more detail on variable scope. % % \subsubsection{Variables: scope and type} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx index fe88fa327ee..7bd9da7f78a 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3basics.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2915 2011-10-15 21:21:08Z bruno $ +\GetIdInfo$Id: l3basics.dtx 3023 2011-12-04 07:25:04Z bruno $ {L3 Experimental basic definitions} %</driver|package> %<*driver> @@ -1399,7 +1399,7 @@ % \end{macro} % \end{macro} % -% \subsection {Defining functions} +% \subsection{Defining functions} % % We start by providing functions for the typical definition % functions. First the local ones. @@ -1486,12 +1486,12 @@ % \begin{macro}{\use:x} % \begin{macro}[aux]{\cs_tmp:w} % Fully expands its argument and passes it to the input stream. -% Uses |\cs_tmp:| as a scratch register but does not affect it. +% Uses |\cs_tmp:w| as a scratch register but does not affect it. % \begin{macrocode} \cs_set_protected:Npn \use:x #1 { \group_begin: - \cs_set:Npx \cs_tmp:w {#1} + \cs_set_nopar:Npx \cs_tmp:w {#1} \exp_after:wN \group_end: \cs_tmp:w @@ -2999,6 +2999,27 @@ % \end{macro} % \end{macro} % +% \subsection{Breaking out of mapping functions} +% +% \begin{macro}[EXP]{\prg_break_point:n} +% \begin{macro}[EXP]{\prg_map_break:} +% \begin{macro}[EXP]{\prg_map_break:n} +% In inline mappings, the nesting level must be reset +% at the end of the mapping, even when the user decides +% to break out. This is done by putting the code that +% must be performed as an argument of \cs{prg_break_point:n}. +% The breaking functions are then defined to jump to +% that point and perform the argument of \cs{prg_break_point:n}, +% before the user's code (if any). +% \begin{macrocode} +\cs_new_eq:NN \prg_break_point:n \use:n +\cs_new:Npn \prg_map_break: #1 \prg_break_point:n #2 { #2 } +\cs_new:Npn \prg_map_break:n #1 #2 \prg_break_point:n #3 { #3 #1 } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Deprecated functions} % % Deprecated on 2011-05-27, for removal by 2011-08-31. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx index 85932bfcfce..ad4f1d1eb69 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3bootstrap.dtx @@ -83,7 +83,7 @@ {\def\ExplFileDate{#2}} \protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax {\def\ExplFileDate{#2/#3/#4}} -\GetIdInfo$Id: l3bootstrap.dtx 2798 2011-09-10 15:42:13Z will $ +\GetIdInfo$Id: l3bootstrap.dtx 3006 2011-11-25 13:29:59Z joseph $ {L3 experimental bootstrap code} %</package> %<*driver> @@ -193,7 +193,7 @@ % % \begin{implementation} % -% \section{Bootstrap code} +% \section{\pkg{l3bootstrap} implementation} % % \begin{macrocode} %<*initex|package> diff --git a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx index ff71f36659d..ef3c56615b1 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3box.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3box.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 2960 2011-11-15 08:50:21Z joseph $ +\GetIdInfo$Id: l3box.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental boxes} %</driver|package> %<*driver> @@ -82,57 +82,33 @@ % initially be void. % \end{function} % -% \begin{function}{\box_clear:N, \box_clear:c} +% \begin{function}{\box_clear:N, \box_clear:c, \box_gclear:N, \box_gclear:c} % \begin{syntax} % \cs{box_clear:N} \meta{box} % \end{syntax} % Clears the content of the \meta{box} by setting the box equal to -% \cs{c_void_box} within the current \TeX{} group level. +% \cs{c_void_box}. % \end{function} % -% \begin{function}{\box_gclear:N, \box_gclear:c} -% \begin{syntax} -% \cs{box_gclear:N} \meta{box} -% \end{syntax} -% Clears the content of the \meta{box} by setting the box equal to -% \cs{c_void_box} globally. -% \end{function} -% -% \begin{function}{\box_clear_new:N, \box_clear_new:c} +% \begin{function} +% {\box_clear_new:N, \box_clear_new:c, \box_gclear_new:N, \box_gclear_new:c} % \begin{syntax} % \cs{box_clear_new:N} \meta{box} % \end{syntax} -% If the \meta{box} is not defined, globally creates it. If the \meta{box} -% is defined, -% clears the content of the \meta{box} by setting the box equal to -% \cs{c_void_box} within the current \TeX{} group level. -% \end{function} -% -% \begin{function}{\box_gclear_new:N, \box_gclear_new:c} -% \begin{syntax} -% \cs{box_gclear_new:N} \meta{box} -% \end{syntax} -% If the \meta{box} is not defined, globally creates it. If the \meta{box} -% is defined, -% clears the content of the \meta{box} by setting the box equal to -% \cs{c_void_box} globally. +% Ensures that the \meta{box} exists globally by applying +% \cs{box_new:N} if necessary, then applies \cs{box_(g)clear:N} to leave +% the \meta{box} empty. % \end{function} % % \begin{function} -% {\box_set_eq:NN, \box_set_eq:cN, \box_set_eq:Nc, \box_set_eq:cc} +% { +% \box_set_eq:NN, \box_set_eq:cN, \box_set_eq:Nc, \box_set_eq:cc, +% \box_gset_eq:NN, \box_gset_eq:cN, \box_gset_eq:Nc, \box_gset_eq:cc +% } % \begin{syntax} % \cs{box_set_eq:NN} \meta{box1} \meta{box2} % \end{syntax} -% Sets the content of \meta{box1} equal to that of \meta{box2}. This -% assignment is restricted to the current \TeX{} group level. -% \end{function} -% -% \begin{function} -% {\box_gset_eq:NN, \box_gset_eq:cN, \box_gset_eq:Nc, \box_gset_eq:cc} -% \begin{syntax} -% \cs{box_gset_eq:NN} \meta{box1} \meta{box2} -% \end{syntax} -% Sets the content of \meta{box1} equal to that of \meta{box2} globally. +% Sets the content of \meta{box1} equal to that of \meta{box2}. % \end{function} % % \begin{function} @@ -482,7 +458,7 @@ % \end{syntax} % Writes the contents of \meta{box} to the log file. % \begin{texnote} -% This is the \TeX{} primitive \tn{showbox}. +% This is a wrapper around the \TeX{} primitive \tn{showbox}. % \end{texnote} % \end{function} % @@ -516,38 +492,24 @@ % and then includes this box in the current list for typesetting. % \end{function} % -% \begin{function}{\hbox_set:Nn, \hbox_set:cn} +% \begin{function}{\hbox_set:Nn, \hbox_set:cn, \hbox_gset:Nn, \hbox_gset:cn} % \begin{syntax} % \cs{hbox_set:Nn} \meta{box} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} at natural width and then stores the -% result inside the \meta{box}. The assignment is local. +% result inside the \meta{box}. % \end{function} % -% \begin{function}{\hbox_gset:Nn, \hbox_gset:cn} -% \begin{syntax} -% \cs{hbox_gset:Nn} \meta{box} \Arg{contents} -% \end{syntax} -% Typesets the \meta{contents} at natural width and then stores the -% result inside the \meta{box}. The assignment is global. -% \end{function} -% -% \begin{function}{\hbox_set_to_wd:Nnn, \hbox_set_to_wd:cnn} +% \begin{function} +% { +% \hbox_set_to_wd:Nnn, \hbox_set_to_wd:cnn, +% \hbox_gset_to_wd:Nnn, \hbox_gset_to_wd:cnn +% } % \begin{syntax} % \cs{hbox_set_to_wd:Nnn} \meta{box} \Arg{dimexpr} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} to the width given by the \meta{dimexpr} -% and then stores the result inside the \meta{box}. The assignment is -% local. -% \end{function} -% -% \begin{function}{\hbox_gset_to_wd:Nnn, \hbox_gset_to_wd:cnn} -% \begin{syntax} -% \cs{hbox_gset_to_wd:Nnn} \meta{box} \Arg{dimexpr} \Arg{contents} -% \end{syntax} -% Typesets the \meta{contents} to the width given by the \meta{dimexpr} -% and then stores the result inside the \meta{box}. The assignment is -% global. +% and then stores the result inside the \meta{box}. % \end{function} % % \begin{function}{\hbox_overlap_right:n} @@ -571,28 +533,15 @@ % \begin{function} % { % \hbox_set:Nw, \hbox_set:cw, -% \hbox_set_end: -% } -% \begin{syntax} -% \cs{hbox_set:Nw} \meta{box} \meta{contents} \cs{hbox_set_end:} -% \end{syntax} -% Typesets the \meta{contents} at natural width and then stores the -% result inside the \meta{box}. The assignment is local. In contrast -% to \cs{hbox_set:Nn} this function does not absorb the argument -% when finding the \meta{content}, and so can be used in circumstances -% where the \meta{content} may not be a simple argument. -% \end{function} -% -% \begin{function} -% { +% \hbox_set_end:, % \hbox_gset:Nw, \hbox_gset:cw, % \hbox_gset_end: % } % \begin{syntax} -% \cs{hbox_gset:Nw} \meta{box} \meta{contents} \cs{hbox_gset_end:} +% \cs{hbox_set:Nw} \meta{box} \meta{contents} \cs{hbox_set_end:} % \end{syntax} % Typesets the \meta{contents} at natural width and then stores the -% result inside the \meta{box}. The assignment is global. In contrast +% result inside the \meta{box}. In contrast % to \cs{hbox_set:Nn} this function does not absorb the argument % when finding the \meta{content}, and so can be used in circumstances % where the \meta{content} may not be a simple argument. @@ -673,85 +622,48 @@ % and then includes this box in the current list for typesetting. % \end{function} % -% \begin{function}{\vbox_set:Nn, \vbox_set:cn} +% \begin{function}{\vbox_set:Nn, \vbox_set:cn, \vbox_gset:Nn, \vbox_gset:cn} % \begin{syntax} % \cs{vbox_set:Nn} \meta{box} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. The assignment is local. -% \end{function} -% -% \begin{function}{\vbox_gset:Nn, \vbox_gset:cn} -% \begin{syntax} -% \cs{vbox_gset:Nn} \meta{box} \Arg{contents} -% \end{syntax} -% Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. The assignment is global. +% result inside the \meta{box}. % \end{function} % -% \begin{function}{\vbox_set_top:Nn, \vbox_set_top:cn} +% \begin{function} +% {\vbox_set_top:Nn, \vbox_set_top:cn, \vbox_gset_top:Nn, \vbox_gset_top:cn} % \begin{syntax} % \cs{vbox_set_top:Nn} \meta{box} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} at natural height and then stores the % result inside the \meta{box}. The baseline of the box will tbe equal -% to that of the \emph{first} item added to the box. The assignment is -% local. -% \end{function} -% -% \begin{function}{\vbox_gset_top:Nn, \vbox_gset_top:cn} -% \begin{syntax} -% \cs{vbox_gset_top:Nn} \meta{box} \Arg{contents} -% \end{syntax} -% Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. The baseline of the box will tbe equal -% to that of the \emph{first} item added to the box. The assignment is -% global. +% to that of the \emph{first} item added to the box. % \end{function} % -% \begin{function}{\vbox_set_to_ht:Nnn, \vbox_set_to_ht:cnn} +% \begin{function} +% { +% \vbox_set_to_ht:Nnn, \vbox_set_to_ht:cnn, +% \vbox_gset_to_ht:Nnn, \vbox_gset_to_ht:cnn +% } % \begin{syntax} % \cs{vbox_set_to_ht:Nnn} \meta{box} \Arg{dimexpr} \Arg{contents} % \end{syntax} % Typesets the \meta{contents} to the height given by the % \meta{dimexpr} and then stores the result inside the \meta{box}. -% The assignment is local. -% \end{function} -% -% \begin{function}{\vbox_gset_to_ht:Nnn, \vbox_gset_to_ht:cnn} -% \begin{syntax} -% \cs{vbox_gset_to_ht:Nnn} \meta{box} \Arg{dimexpr} \Arg{contents} -% \end{syntax} -% Typesets the \meta{contents} to the height given by the -% \meta{dimexpr} and then stores the result inside the \meta{box}. -% The assignment is global. % \end{function} % % \begin{function} % { % \vbox_set:Nw, \vbox_set:cw, -% \vbox_set_end: -% } -% \begin{syntax} -% \cs{vbox_begin:Nw} \meta{box} \meta{contents} \cs{vbox_set_end:} -% \end{syntax} -% Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. The assignment is local. In contrast -% to \cs{vbox_set:Nn} this function does not absorb the argument -% when finding the \meta{content}, and so can be used in circumstances -% where the \meta{content} may not be a simple argument. -% \end{function} -% -% \begin{function} -% { +% \vbox_set_end:, % \vbox_gset:Nw, \vbox_gset:cw, % \vbox_gset_end: % } % \begin{syntax} -% \cs{vbox_gset:Nw} \meta{box} \meta{contents} \cs{vbox_gset_end:} +% \cs{vbox_begin:Nw} \meta{box} \meta{contents} \cs{vbox_set_end:} % \end{syntax} % Typesets the \meta{contents} at natural height and then stores the -% result inside the \meta{box}. The assignment is global. In contrast +% result inside the \meta{box}. In contrast % to \cs{vbox_set:Nn} this function does not absorb the argument % when finding the \meta{content}, and so can be used in circumstances % where the \meta{content} may not be a simple argument. @@ -836,6 +748,29 @@ % \end{texnote} % \end{function} % +% \section{Experimental box functions} +% +% \begin{function}[added = 2011-11-21]{\box_show:Nnn, \box_show:cnn} +% \begin{syntax} +% \cs{box_show:Nnn} \meta{box} \meta{int 1} \meta{int 2} +% \end{syntax} +% Display the contents of \meta{box} in the terminal, +% showing the first \meta{int 1} items of the box, +% and descending into \meta{int 1} levels of nesting. +% \begin{texnote} +% This is a wrapper around the \TeX{} primitives \tn{showbox}, +% \tn{showboxbreadth} and \tn{showboxdepth}. +% \end{texnote} +% \end{function} +% +% \begin{function}[added = 2011-11-22]{\box_show_full:N, \box_show_full:c} +% \begin{syntax} +% \cs{box_show_full:N} \meta{box} +% \end{syntax} +% Display the contents of \meta{box} in the terminal, +% showing all items in the box. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -1125,14 +1060,47 @@ % % \subsection{Viewing box contents} % -% \begin{macro}{\box_show:N,\box_show:c} +% \begin{macro}{\box_show:N, \box_show:c} % \testfile* -% Show the contents of a box and write it into the log file. +% Check that the variable exists, then show the contents of the box +% and write it into the log file. The spurious \cs{use:n} gives +% a nicer output. % \begin{macrocode} -\cs_new_eq:NN \box_show:N \tex_showbox:D +\cs_new_protected:Npn \box_show:N #1 + { + \cs_if_exist:NTF #1 + { \tex_showbox:D \use:n {#1} } + { + \msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } + } \cs_generate_variant:Nn \box_show:N { c } % \end{macrocode} -% \end{macro} +% \end{macro} +% +% \begin{macro}{\box_show:Nnn, \box_show:cnn} +% \begin{macro}{\box_show_full:N, \box_show_full:c} +% Show the contents of a box and write it into the log file, +% after setting the parameters \tn{showboxbreadth} and \tn{showboxdepth} +% to the values provided by the user. +% \begin{macrocode} +\cs_new_protected:Npn \box_show:Nnn #1#2#3 + { + \group_begin: + \int_set:Nn \tex_showboxbreadth:D {#2} + \int_set:Nn \tex_showboxdepth:D {#3} + \int_set_eq:NN \tex_tracingonline:D \c_one + \box_show:N #1 + \group_end: + } +\cs_generate_variant:Nn \box_show:Nnn { c } +\cs_new_protected:Npn \box_show_full:N #1 + { \box_show:Nnn #1 { \c_max_int } { \c_max_int } } +\cs_generate_variant:Nn \box_show_full:N { c } +% \end{macrocode} +% \end{macro} +% \end{macro} % % \subsection{Horizontal mode boxes} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx index 340c0af3f11..f1ef8dfe7b8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3clist.dtx @@ -36,7 +36,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3clist.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental comma separated lists} %</driver|package> %<*driver> @@ -100,180 +100,109 @@ % initially contain no items. % \end{function} % -% \begin{function}{\clist_clear:N, \clist_clear:c} +% \begin{function} +% {\clist_clear:N, \clist_clear:c, \clist_gclear:N, \clist_gclear:c} % \begin{syntax} % \cs{clist_clear:N} \meta{comma list} % \end{syntax} -% Clears all items from the \meta{comma list} within the scope of -% the current \TeX{} group. -% \end{function} -% -% \begin{function}{\clist_gclear:N, \clist_gclear:c} -% \begin{syntax} -% \cs{clist_gclear:N} \meta{comma list} -% \end{syntax} -% Clears all entries from the \meta{comma list} globally. -% \end{function} -% -% \begin{function}{\clist_clear_new:N, \clist_clear_new:c} -% \begin{syntax} -% \cs{clist_clear_new:N} \meta{comma list} -% \end{syntax} -% If the \meta{comma list} already exists, clears it within the scope -% of the current \TeX{} group. If the \meta{comma list} is not defined, -% it will be created (using \cs{clist_new:N}). Thus the comma list is -% guaranteed to be available and clear within the current \TeX{} -% group. The \meta{comma list} will exist globally, but the content -% outside of the current \TeX{} group is not specified. -% \end{function} -% -% \begin{function}{\clist_gclear_new:N, \clist_gclear_new:c} -% \begin{syntax} -% \cs{clist_gclear_new:N} \meta{comma list} -% \end{syntax} -% If the \meta{comma list} already exists, clears it globally. If the -% \meta{comma list} is not defined, it will be created (using -% \cs{clist_new:N}). Thus the comma list is guaranteed to be available -% and globally clear. +% Clears all items from the \meta{comma list}. % \end{function} % % \begin{function} -% {\clist_set_eq:NN, \clist_set_eq:cN, \clist_set_eq:Nc, \clist_set_eq:cc} +% { +% \clist_clear_new:N, \clist_clear_new:c, +% \clist_gclear_new:N, \clist_gclear_new:c +% } % \begin{syntax} -% \cs{clist_set_eq:NN} \meta{comma list1} \meta{comma list2} +% \cs{clist_clear_new:N} \meta{comma list} % \end{syntax} -% Sets the content of \meta{comma list1} equal to that of -% \meta{comma list2}. This assignment is restricted to the current -% \TeX{} group level. +% Ensures that the \meta{comma list} exists globally by applying +% \cs{clsit_new:N} if necessary, then applies \cs{clist_(g)clear:N} to leave +% the list empty. % \end{function} % % \begin{function} % { +% \clist_set_eq:NN, \clist_set_eq:cN, +% \clist_set_eq:Nc, \clist_set_eq:cc, % \clist_gset_eq:NN, \clist_gset_eq:cN, % \clist_gset_eq:Nc, \clist_gset_eq:cc % } % \begin{syntax} -% \cs{clist_gset_eq:NN} \meta{comma list1} \meta{comma list2} +% \cs{clist_set_eq:NN} \meta{comma list1} \meta{comma list2} % \end{syntax} % Sets the content of \meta{comma list1} equal to that of -% \meta{comma list2}. This assignment is global and so is not -% limited by the current \TeX{} group level. +% \meta{comma list2}. % \end{function} % -% \begin{function}{\clist_concat:NNN, \clist_concat:ccc} +% \begin{function} +% { +% \clist_concat:NNN, \clist_concat:ccc, +% \clist_gconcat:NNN, \clist_gconcat:ccc +% } % \begin{syntax} % \cs{clist_concat:NNN} \meta{comma list1} \meta{comma list2} \meta{comma list3} % \end{syntax} % Concatenates the content of \meta{comma list2} and \meta{comma list3} % together and saves the result in \meta{comma list1}. The items in % \meta{comma list2} will be placed at the left side of the new comma list. -% This operation is local to the current \TeX{} group and will -% remove any existing content in \meta{comma list1}. -% \end{function} -% -% \begin{function}{\clist_gconcat:NNN, \clist_gconcat:ccc} -% \begin{syntax} -% \cs{clist_gconcat:NNN} \meta{comma list1} \meta{comma list2} \meta{comma list3} -% \end{syntax} -% Concatenates the content of \meta{comma list2} and \meta{comma list3} -% together and saves the result in \meta{comma list1}. The items in -% \meta{comma list2} will be placed at the left side of the new comma list. -% This operation is global and will remove any existing content in -% \meta{comma list1}. % \end{function} % % \section{Adding data to comma lists} % % \begin{function}[added = 2011-09-06] % { -% \clist_set:Nn, \clist_set:NV, -% \clist_set:No, \clist_set:Nx, -% \clist_set:cn, \clist_set:cV, -% \clist_set:co, \clist_set:cx -% } -% \begin{syntax} -% \cs{clist_set:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| -% \end{syntax} -% Sets \meta{comma list} to contain the \meta{items}, -% removing any previous content from the variable. -% Spaces are removed from both sides of each item. -% The assignment is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}[added = 2011-09-06] -% { +% \clist_set:Nn, \clist_set:NV, +% \clist_set:No, \clist_set:Nx, +% \clist_set:cn, \clist_set:cV, +% \clist_set:co, \clist_set:cx, % \clist_gset:Nn, \clist_gset:NV, % \clist_gset:No, \clist_gset:Nx, % \clist_gset:cn, \clist_gset:cV, % \clist_gset:co, \clist_gset:cx % } % \begin{syntax} -% \cs{clist_gset:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| +% \cs{clist_set:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| % \end{syntax} % Sets \meta{comma list} to contain the \meta{items}, % removing any previous content from the variable. % Spaces are removed from both sides of each item. -% The assignment is global. -% \end{function} -% -% \begin{function}[updated = 2011-09-05] -% { -% \clist_put_left:Nn, \clist_put_left:NV, -% \clist_put_left:No, \clist_put_left:Nx, -% \clist_put_left:cn, \clist_put_left:cV, -% \clist_put_left:co, \clist_put_left:cx -% } -% \begin{syntax} -% \cs{clist_put_left:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| -% \end{syntax} -% Appends the \meta{items} to the left of the \meta{comma list}. -% Spaces are removed from both sides of each item. -% The assignment is restricted to the current \TeX{} group. % \end{function} % % \begin{function}[updated = 2011-09-05] % { +% \clist_put_left:Nn, \clist_put_left:NV, +% \clist_put_left:No, \clist_put_left:Nx, +% \clist_put_left:cn, \clist_put_left:cV, +% \clist_put_left:co, \clist_put_left:cx, % \clist_gput_left:Nn, \clist_gput_left:NV, % \clist_gput_left:No, \clist_gput_left:Nx, % \clist_gput_left:cn, \clist_gput_left:cV, % \clist_gput_left:co, \clist_gput_left:cx % } % \begin{syntax} -% \cs{clist_gput_left:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| +% \cs{clist_put_left:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| % \end{syntax} % Appends the \meta{items} to the left of the \meta{comma list}. % Spaces are removed from both sides of each item. -% The assignment is global. -% \end{function} -% -% \begin{function}[updated = 2011-09-05] -% { -% \clist_put_right:Nn, \clist_put_right:NV, -% \clist_put_right:No, \clist_put_right:Nx, -% \clist_put_right:cn, \clist_put_right:cV, -% \clist_put_right:co, \clist_put_right:cx -% } -% \begin{syntax} -% \cs{clist_put_right:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| -% \end{syntax} -% Appends the \meta{items} to the right of the \meta{comma list}. -% Spaces are removed from both sides of each item. -% The assignment is restricted to the current \TeX{} group. % \end{function} % % \begin{function}[updated = 2011-09-05] % { +% \clist_put_right:Nn, \clist_put_right:NV, +% \clist_put_right:No, \clist_put_right:Nx, +% \clist_put_right:cn, \clist_put_right:cV, +% \clist_put_right:co, \clist_put_right:cx, % \clist_gput_right:Nn, \clist_gput_right:NV, % \clist_gput_right:No, \clist_gput_right:Nx, % \clist_gput_right:cn, \clist_gput_right:cV, % \clist_gput_right:co, \clist_gput_right:cx % } % \begin{syntax} -% \cs{clist_gput_right:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| +% \cs{clist_put_right:Nn} \meta{comma list} |{|\meta{item1},\ldots{},\meta{item$_n$}|}| % \end{syntax} -% Appends the \meta{item} to the right of the \meta{comma list}. +% Appends the \meta{items} to the right of the \meta{comma list}. % Spaces are removed from both sides of each item. -% The assignment is global. % \end{function} % % \section{Using comma lists} @@ -293,32 +222,17 @@ % to update comma lists, while retaining the order of the unaffected % entries. % -% \begin{function}{\clist_remove_duplicates:N, \clist_remove_duplicates:c} +% \begin{function} +% { +% \clist_remove_duplicates:N, \clist_remove_duplicates:c, +% \clist_gremove_duplicates:N, \clist_gremove_duplicates:c +% } % \begin{syntax} % \cs{clist_remove_duplicates:N} \meta{comma list} % \end{syntax} % Removes duplicate items from the \meta{comma list}, leaving the % left most copy of each item in the \meta{comma list}. The \meta{item} % comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}. -% The removal is local to the current \TeX{} group. -% \begin{texnote} -% This function iterates through every item in the \meta{comma list} and -% does a comparison with the \meta{items} already checked. It is therefore -% relatively slow with large comma lists. -% Furthermore, it will not work if any of the items in the -% \meta{comma list} contains |{|, |}|, or |#| -% (assuming the usual \TeX{} category codes apply). -% \end{texnote} -% \end{function} -% -% \begin{function}{\clist_gremove_duplicates:N, \clist_gremove_duplicates:c} -% \begin{syntax} -% \cs{clist_gremove_duplicates:N} \meta{comma list} -% \end{syntax} -% Removes duplicate items from the \meta{comma list}, leaving the -% left most copy of each item in the \meta{comma list}. The \meta{item} -% comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}. -% The removal is applied globally. % \begin{texnote} % This function iterates through every item in the \meta{comma list} and % does a comparison with the \meta{items} already checked. It is therefore @@ -329,26 +243,17 @@ % \end{texnote} % \end{function} % -% \begin{function}[updated = 2011-09-06]{\clist_remove_all:Nn, \clist_remove_all:cn} +% \begin{function}[updated = 2011-09-06] +% { +% \clist_remove_all:Nn, \clist_remove_all:cn, +% \clist_gremove_all:Nn, \clist_gremove_all:cn +% } % \begin{syntax} % \cs{clist_remove_all:Nn} \meta{comma list} \Arg{item} % \end{syntax} % Removes every occurrence of \meta{item} from the \meta{comma list}. % The \meta{item} comparison takes place on a token basis, as for -% \cs{tl_if_eq:nn(TF)}. The removal is local to the current \TeX{} group. -% \begin{texnote} -% The \meta{item} may not contain |{|, |}|, or |#| -% (assuming the usual \TeX{} category codes apply). -% \end{texnote} -% \end{function} -% -% \begin{function}[updated = 2011-09-06]{\clist_gremove_all:Nn, \clist_gremove_all:cn} -% \begin{syntax} -% \cs{clist_gremove_all:Nn} \meta{comma list} \Arg{item} -% \end{syntax} -% Removes each occurrence of \meta{item} from the \meta{comma list}. -% The \meta{item} comparison takes place on a token basis, as for -% \cs{tl_if_eq:nn(TF)}. The removal is applied globally. +% \cs{tl_if_eq:nn(TF)}. % \begin{texnote} % The \meta{item} may not contain |{|, |}|, or |#| % (assuming the usual \TeX{} category codes apply). @@ -478,7 +383,7 @@ % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the -% internal macro \cs{clist_break_point:n} before further items are taken +% internal macro \cs{prg_break_point:n} before further items are taken % from the input stream. This will depend on the design of the mapping % function. % \end{texnote} @@ -506,7 +411,7 @@ % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the -% internal macro \cs{clist_break_point:n} before the \meta{tokens} are +% internal macro \cs{prg_break_point:n} before the \meta{tokens} are % inserted into the input stream. % This will depend on the design of the mapping function. % \end{texnote} @@ -562,29 +467,16 @@ % % \begin{function} % { -% \clist_push:Nn, \clist_push:NV, \clist_push:No, \clist_push:Nx, -% \clist_push:cn, \clist_push:cV, \clist_push:co, \clist_push:cx -% } -% \begin{syntax} -% \cs{clist_push:Nn} \meta{comma list} \Arg{items} -% \end{syntax} -% Adds the \Arg{items} to the top of the \meta{comma list}. -% Spaces are removed from both sides of each item. -% The assignment is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function} -% { +% \clist_push:Nn, \clist_push:NV, \clist_push:No, \clist_push:Nx, +% \clist_push:cn, \clist_push:cV, \clist_push:co, \clist_push:cx, % \clist_gpush:Nn, \clist_gpush:NV, \clist_gpush:No, \clist_gpush:Nx, % \clist_gpush:cn, \clist_gpush:cV, \clist_gpush:co, \clist_gpush:cx % } % \begin{syntax} -% \cs{clist_gpush:Nn} \meta{comma list} \Arg{items} +% \cs{clist_push:Nn} \meta{comma list} \Arg{items} % \end{syntax} -% Pushes the \meta{items} onto the end of the top of the -% \meta{comma list}. +% Adds the \Arg{items} to the top of the \meta{comma list}. % Spaces are removed from both sides of each item. -% The assignment is global. % \end{function} % % \section{Viewing comma lists} @@ -596,6 +488,13 @@ % Displays the entries in the \meta{comma list} in the terminal. % \end{function} % +% \begin{function}{\clist_show:n} +% \begin{syntax} +% \cs{clist_show:n} \Arg{tokens} +% \end{syntax} +% Displays the entries in the comma list in the terminal. +% \end{function} +% % \section{Scratch comma lists} % % \begin{variable}[added = 2011-09-06]{\l_tmpa_clist, \l_tmpb_clist} @@ -618,13 +517,13 @@ % on how useful they are found to be. % % \begin{function}[added = 2011-06-25, updated = 2011-09-06, EXP] -% {\clist_length:N, \clist_length:c,\clist_length:n} +% {\clist_length:N, \clist_length:c, \clist_length:n} % \begin{syntax} % \cs{clist_length:N} \meta{comma list} % \end{syntax} % Leaves the number of items in the \meta{comma list} in the input % stream as an \meta{integer denotation}. The total number of items -% in a \meta{comma list} will include those which are empty and duplicates, +% in a \meta{comma list} will include those which are duplicates, % \emph{i.e.}~every item in a \meta{comma list} is unique. % \end{function} % @@ -645,28 +544,31 @@ % % \begin{function}[updated = 2011-08-31] % { -% \clist_set_from_seq:NN, \clist_set_from_seq:cN, -% \clist_set_from_seq:Nc, \clist_set_from_seq:cc +% \clist_set_from_seq:NN, \clist_set_from_seq:cN, +% \clist_set_from_seq:Nc, \clist_set_from_seq:cc, +% \clist_gset_from_seq:NN, \clist_gset_from_seq:cN, +% \clist_gset_from_seq:Nc, \clist_gset_from_seq:cc % } % \begin{syntax} % \cs{clist_set_from_seq:NN} \meta{comma list} \meta{sequence} % \end{syntax} -% Sets the \meta{comma list} within the current \TeX{} group to be equal -% to the content of the \meta{sequence}. +% Sets the \meta{comma list} to be equal to the content of the +% \meta{sequence}. % Items which contain either spaces or commas are surrounded by braces. % \end{function} % -% \begin{function}[updated = 2011-08-31] +% \begin{function}[added = 2011-11-26] % { -% \clist_gset_from_seq:NN, \clist_gset_from_seq:cN, -% \clist_gset_from_seq:Nc, \clist_gset_from_seq:cc +% \clist_const:Nn, \clist_const:Nx, +% \clist_const:cn, \clist_const:cx % } % \begin{syntax} -% \cs{clist_gset_from_seq:NN} \meta{comma list} \meta{sequence} +% \cs{clist_const:Nn} \meta{clist~var} \Arg{comma list} % \end{syntax} -% Sets the \meta{comma list} globally to equal to the content of the -% \meta{sequence}. -% Items which contain either spaces or commas are surrounded by braces. +% Creates a new constant \meta{clist~var} or raises an error +% if the name is already taken. The value of the +% \meta{clist~var} will be set globally to the +% \meta{comma list}. % \end{function} % % \section{Internal comma-list functions} @@ -701,10 +603,11 @@ %</package> % \end{macrocode} % -% \begin{variable}{\l_clist_tmpa_tl} -% Scratch space for various internal uses. +% \begin{variable}{\l_clist_tmpa_clist} +% Scratch space for various internal uses. This comma list variable +% cannot be declared as such because it comes before \cs{clist_new:N} % \begin{macrocode} -\tl_new:N \l_clist_tmpa_tl +\tl_new:N \l_clist_tmpa_clist % \end{macrocode} % \end{variable} % @@ -849,33 +752,32 @@ % \end{macro} % % \begin{macro}[int,rEXP]{\clist_trim_spaces:n} -% \begin{macro}[aux]{\clist_trim_spaces_aux:n,\clist_trim_spaces_aux_ii:nn} -% The argument of \cs{clist_trim_spaces_aux:n} is initially empty, +% \begin{macro}[aux]{\clist_trim_spaces_aux:nn} +% The first argument of \cs{clist_trim_spaces_aux:nn} is initially empty, % and later a comma, namely, as soon as we have added an item to the -% resulting list. The second auxiliary tests for the end of the list, +% resulting list. The auxiliary tests for the end of the list, % and also prevents empty arguments from finding their way into the % output. % \begin{macrocode} \cs_new:Npn \clist_trim_spaces:n #1 { - \clist_trim_spaces_aux:n { } \q_mark #1 , - \q_recursion_tail, \q_recursion_stop - } -\cs_new:Npn \clist_trim_spaces_aux:n #1 - { \clist_trim_spaces_generic:nw - { \clist_trim_spaces_aux_ii:nn {#1} } + { \clist_trim_spaces_aux:nn { } } + \q_mark #1 , + \q_recursion_tail, \q_recursion_stop } -\cs_new:Npn \clist_trim_spaces_aux_ii:nn #1 #2 +\cs_new:Npn \clist_trim_spaces_aux:nn #1 #2 { \quark_if_recursion_tail_stop:n {#2} \tl_if_empty:nTF {#2} { - \clist_trim_spaces_aux:n {#1} \q_mark + \clist_trim_spaces_generic:nw + { \clist_trim_spaces_aux:nn {#1} } \q_mark } { #1 \exp_not:n {#2} - \clist_trim_spaces_aux:n { , } \q_mark + \clist_trim_spaces_generic:nw + { \clist_trim_spaces_aux:nn { , } } \q_mark } } % \end{macrocode} @@ -925,22 +827,18 @@ % \clist_gput_left:co, \clist_gput_left:cx % } % \UnitTested +% \begin{macro}[aux]{\clist_put_left_aux:NNNn} % Comma lists cannot hold empty values: there are therefore a couple % of sanity checks to avoid accumulating commas. % \begin{macrocode} \cs_new_protected_nopar:Npn \clist_put_left:Nn - { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_left:Nx { } , } + { \clist_put_left_aux:NNNn \clist_concat:NNN \clist_set:Nn } \cs_new_protected_nopar:Npn \clist_gput_left:Nn - { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_left:Nx { } , } -\cs_new_protected:Npn \clist_put_aux:NNnnNn #1#2#3#4#5#6 + { \clist_put_left_aux:NNNn \clist_gconcat:NNN \clist_set:Nn } +\cs_new_protected:Npn \clist_put_left_aux:NNNn #1#2#3#4 { - \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#6} } - \clist_if_empty:NTF #5 - { #1 #5 \l_clist_tmpa_tl } - { - \tl_if_empty:NF \l_clist_tmpa_tl - { #2 #5 { #3 \exp_not:o \l_clist_tmpa_tl #4 } } - } + #2 \l_clist_tmpa_clist {#4} + #1 #3 \l_clist_tmpa_clist #3 } \cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx } @@ -949,6 +847,7 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro} % { @@ -966,11 +865,17 @@ % \clist_gput_right:co, \clist_gput_right:cx % } % \UnitTested +% \begin{macro}[aux]{\clist_put_right_aux:NNNn} % \begin{macrocode} \cs_new_protected:Npn \clist_put_right:Nn - { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_right:Nx , { } } + { \clist_put_right_aux:NNNn \clist_concat:NNN \clist_set:Nn } \cs_new_protected_nopar:Npn \clist_gput_right:Nn - { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_right:Nx , { } } + { \clist_put_right_aux:NNNn \clist_gconcat:NNN \clist_gset:Nn } +\cs_new_protected:Npn \clist_put_right_aux:NNNn #1#2#3#4 + { + #2 \l_clist_tmpa_clist {#4} + #1 #3 #3 \l_clist_tmpa_clist + } \cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_right:Nn { NV , No , Nx } @@ -978,6 +883,7 @@ % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Comma lists as stacks} % @@ -1251,24 +1157,26 @@ % % \begin{macro}{\clist_map_function:NN, \clist_map_function:cN} % \UnitTested -% \begin{macro}{\clist_map_function:nN} -% \UnitTested % \begin{macro}[aux]{\clist_map_function_aux:Nw} -% Mapping to comma lists is pretty simple, if not massively efficient. +% If the variable is empty, the mapping is skipped (otherwise, +% that comma-list would be seen as consisting of one empty item). +% Then loop over the comma-list, grabbing one comma-delimited +% item at a time. The end is marked by \cs{q_recursion_tail}. % The auxiliary function \cs{clist_map_function_aux:Nw} is used -% directly in \cs{clist_length:n}. Change with care. +% directly in \cs{clist_map_inline:Nn}. Change with care. % \begin{macrocode} \cs_new_nopar:Npn \clist_map_function:NN #1#2 { \clist_if_empty:NF #1 { \exp_last_unbraced:NNo \clist_map_function_aux:Nw #2 #1 - , \q_recursion_tail , \q_recursion_stop + , \q_recursion_tail , + \prg_break_point:n { } } } \cs_new:Npn \clist_map_function_aux:Nw #1#2 , { - \quark_if_recursion_tail_stop:n {#2} + \quark_if_recursion_tail_break:n {#2} #1 {#2} \clist_map_function_aux:Nw #1 } @@ -1276,42 +1184,71 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % -% \begin{variable}{\g_clist_map_inline_int} -% For the nesting of mappings. +% \begin{macro}{\clist_map_function:nN} +% \UnitTested +% \begin{macro}[aux]{\clist_map_function_n_aux:Nn} +% \begin{macro}{\clist_map_aux_unbrace:Nw} +% The \texttt{n}-type mapping function is a bit more awkward, +% since spaces mustbe trimmed from each item. +% Space trimming is again based on \cs{clist_trim_spaces_generic:nw}. +% The auxiliary \cs{clist_map_function_n_aux:Nn} receives +% as arguments the function, and the result of removing leading +% and trailing spaces from the item which lies until the next comma. +% Empty items are ignored, then one level of braces is removed +% by \cs{clist_map_aux_unbrace:Nw}. % \begin{macrocode} -\int_new:N \g_clist_map_inline_int +\cs_new:Npn \clist_map_function:nN #1#2 + { + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 } + \q_mark #1, \q_recursion_tail, + \prg_break_point:n { } + } +\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2 + { + \quark_if_recursion_tail_break:n {#2} + \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, } + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 } + \q_mark + } +\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} } % \end{macrocode} -% \end{variable} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\clist_map_inline:Nn, \clist_map_inline:cn} % \UnitTested % \begin{macro}{\clist_map_inline:nn} % \UnitTested % Inline mapping is done by creating a suitable function -% \enquote{on the fly}: -% this is done globally to avoid any issues with \TeX{}'s groups. +% \enquote{on the fly}: this is done globally to avoid +% any issues with \TeX{}'s groups. We use a different +% function for each level of nesting. +% +% Since the mapping is non-expandable, we can perform +% the space-trimming needed by the \texttt{n} version +% simply by storing the comma-list in a variable. We +% don't need a different comma-list for each nesting +% level: the comma-list is expanded before the mapping +% starts. % \begin{macrocode} \cs_new_protected:Npn \clist_map_inline:Nn #1#2 { - \int_gincr:N \g_clist_map_inline_int - \cs_gset:cpn { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - ##1 - {#2} - \exp_args:NNc \clist_map_function:NN #1 - { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - \int_gdecr:N \g_clist_map_inline_int + \clist_if_empty:NF #1 + { + \int_gincr:N \g_prg_map_int + \cs_gset:cpn { clist_map_ \int_use:N \g_prg_map_int :n } ##1 {#2} + \exp_last_unbraced:Nco \clist_map_function_aux:Nw + { clist_map_ \int_use:N \g_prg_map_int :n } + #1 , \q_recursion_tail , + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } + } } -\cs_new_protected:Npn \clist_map_inline:nn #1#2 +\cs_new_protected:Npn \clist_map_inline:nn #1 { - \int_gincr:N \g_clist_map_inline_int - \cs_gset:cpn { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - ##1 - {#2} - \exp_args:Nnc \clist_map_function:nN {#1} - { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - \int_gdecr:N \g_clist_map_inline_int + \clist_set:Nn \l_clist_tmpa_clist {#1} + \clist_map_inline:Nn \l_clist_tmpa_clist } \cs_generate_variant:Nn \clist_map_inline:Nn { c } % \end{macrocode} @@ -1322,9 +1259,11 @@ % \UnitTested % \begin{macro}{\clist_map_variable:nNn} % \begin{macro}[aux]{\clist_map_variable_aux:Nnw} -% This is similar to the \cs{clist_map_function:NN} code. -% The \texttt{n} version is done by first trimming all spaces, -% then using the \texttt{N} version. +% As for other comma-list mappings, filter out the case of +% an empty list. Same approach as \cs{clist_map_function:Nn}, +% additionally we store each item in the given variable. +% As for inline mappings, space trimming for the \texttt{n} +% variant is done by storing the comma list in a variable. % \begin{macrocode} \cs_new_protected:Npn \clist_map_variable:NNn #1#2#3 { @@ -1334,19 +1273,20 @@ { \clist_map_variable_aux:Nnw #2 {#3} } #1 , \q_recursion_tail , \q_recursion_stop + \prg_break_point:n { } } } -\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3 , +\cs_new_protected:Npn \clist_map_variable:nNn #1 { - \quark_if_recursion_tail_stop:n {#3} - \tl_set:Nn #1 {#3} - #2 - \clist_map_variable_aux:Nnw #1 {#2} + \clist_set:Nn \l_clist_tmpa_clist {#1} + \clist_map_variable:NNn \l_clist_tmpa_clist } -\cs_new_protected:Npn \clist_map_variable:nNn #1 +\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3, { - \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#1} } - \clist_map_variable:NNn \l_clist_tmpa_tl + \tl_set:Nn #1 {#3} + \quark_if_recursion_tail_stop:N #1 + \use:n {#2} + \clist_map_variable_aux:Nnw #1 {#2} } \cs_generate_variant:Nn \clist_map_variable:NNn { c } % \end{macrocode} @@ -1354,98 +1294,49 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\clist_map_aux_unbrace:Nw} -% Within mappings with explicit \texttt{n}-type comma lists, -% braces must be stripped after space trimming. Here, |#1| -% is the function to map, and |#2| the item to brace-strip. -% \begin{macrocode} -\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\clist_map_function:nN} -% \begin{macro}[aux]{\clist_map_function_n_aux:Nn} -% Space trimming is again based on \cs{clist_trim_spaces_generic:nw}. -% The auxiliary \cs{clist_map_function_n_aux:Nn} receives -% as arguments the function, and the result of removing leading -% and trailing spaces from the item which lies until the next comma. -% Empty items are ignored before brace stripping by -% \cs{clist_map_aux_unbrace:Nw}. -% \begin{macrocode} -\cs_new:Npn \clist_map_function:nN #1#2 - { - \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 } - \q_mark #1, \q_recursion_tail, \q_recursion_stop - } -\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2 - { - \quark_if_recursion_tail_stop:n {#2} - \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, } - \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 } - \q_mark - } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \begin{macro}{\clist_map_break:} -% \UnitTested % \begin{macro}{\clist_map_break:n} -% Both are simple renaming. +% The break statements are simply copies. % \begin{macrocode} -\cs_new_eq:NN \clist_map_break: \use_none_delimit_by_q_recursion_stop:w -\cs_new_eq:NN \clist_map_break:n \use_i_delimit_by_q_recursion_stop:nw +\cs_new_eq:NN \clist_map_break: \prg_map_break: +\cs_new_eq:NN \clist_map_break:n \prg_map_break:n % \end{macrocode} % \end{macro} % \end{macro} % -% \section{Viewing comma lists} +% \subsection{Viewing comma lists} % % \begin{macro}{\clist_show:N, \clist_show:c} -% \UnitTested -% \begin{macro}[aux]{\clist_show_aux:n} -% \begin{macro}[aux]{\clist_show_aux:w} -% The aim of the mapping here is to create a token list containing the -% formatted comma list. The very first item needs the new line and \verb*|> | -% removing, which is achieved using a \texttt{w}-type auxiliary. To avoid -% a low-level \TeX{} error if there is an empty comma list, a simple test is -% used to keep the output \enquote{clean}. +% \begin{macro}{\clist_show:n} +% Apply the general \cs{msg_aux_show:Nnx}. In the case +% of an \texttt{n}-type comma-list, first store it +% in a scratch variable, then show that variable, +% omitting its name from the $4$-th argument. % \begin{macrocode} \cs_new_protected_nopar:Npn \clist_show:N #1 { - \clist_if_empty:NTF #1 - { - \iow_term:x { Comma~list~\token_to_str:N #1~is~empty } - \tl_show:n { } - } - { - \iow_term:x - { - Comma~list~\token_to_str:N #1~ - contains~the~items~(without~outer~braces): - } - \tl_set:Nx \l_clist_show_tl - { \clist_map_function:NN #1 \clist_show_aux:n } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \clist_show_aux:w \l_clist_show_tl } - } + \msg_aux_show:Nnx + #1 + { clist } + { \clist_map_function:NN #1 \msg_aux_show:n } } -\cs_new:Npn \clist_show_aux:n #1 +\cs_new_protected:Npn \clist_show:n #1 { - \iow_newline: > \c_space_tl \c_space_tl - \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + \clist_set:Nn \l_clist_tmpa_clist {#1} + \msg_aux_show:Nnx + \l_clist_tmpa_clist + { clist } + { \clist_map_function:NN \l_clist_tmpa_clist \msg_aux_show:n } } -\cs_new:Npn \clist_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \clist_show:N { c } % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % % \subsection{Scratch comma lists} % % \begin{variable}{\l_tmpa_clist, \l_tmpb_clist} -% \begin{variable}{\g_tmpa_tl, \g_tmpb_tl} +% \begin{variable}{\g_tmpa_clist, \g_tmpb_clist} % Temporary comma list variables. % \begin{macrocode} \clist_new:N \l_tmpa_clist @@ -1460,15 +1351,14 @@ % % \begin{macro}{\clist_length:N, \clist_length:c} % \begin{macro}{\clist_length:n} -% \begin{macro}[aux]{\clist_length_aux:n} +% \begin{macro}[aux]{\clist_length_aux:w} % Counting the items in a comma list is done using the same approach as for % other length functions: turn each entry into a \texttt{+1} then use % integer evaluation to actually do the mathematics. % In the case of an \texttt{n}-type comma-list, we could of course use % \cs{clist_map_function:nN}, but that is very slow, because it carefully -% removes spaces. Instead, we call \cs{clist_map_function_aux:Nw} -% directly, and test for each item whether it is blank (hence should -% be ignored). +% removes spaces. Instead, we loop manually, and skip blank items +% (but not |{}|, hence the extra spaces). % \begin{macrocode} \cs_new:Npn \clist_length:N #1 { @@ -1479,16 +1369,21 @@ } } \cs_new:Npn \clist_length_aux:n #1 { +1 } -\cs_new:Npn \clist_length:n #1 +\cs_new:Npx \clist_length:n #1 { - \int_eval:n + \exp_not:N \int_eval:n { 0 - \clist_map_function_aux:Nw \clist_length_n_aux:n #1 - , \q_recursion_tail , \q_recursion_stop + \exp_not:N \clist_length_n_aux:w \c_space_tl + #1 \exp_not:n { , \q_recursion_tail , \q_recursion_stop } } } -\cs_new:Npn \clist_length_n_aux:n #1 { \tl_if_blank:nF {#1} {+1} } +\cs_new:Npx \clist_length_n_aux:w #1 , + { + \exp_not:n { \exp_args:Nf \quark_if_recursion_tail_stop:n } {#1} + \exp_not:N \tl_if_blank:nF {#1} { + \c_one } + \exp_not:N \clist_length_n_aux:w \c_space_tl + } \cs_generate_variant:Nn \clist_length:N { c } % \end{macrocode} % \end{macro} @@ -1632,6 +1527,21 @@ % \end{macro} % \end{macro} % +% \begin{macro} +% { +% \clist_const:Nn, \clist_const:cn, +% \clist_const:Nx, \clist_const:cx +% } +% Creating and initializing a constant comma list is done in a way +% similar to \cs{clist_set:Nn} and \cs{clist_gset:Nn}, being careful +% to strip spaces. +% \begin{macrocode} +\cs_new_protected:Npn \clist_const:Nn #1#2 + { \tl_const:Nx #1 { \clist_trim_spaces:n {#2} } } +\cs_generate_variant:Nn \clist_const:Nn { c , Nx , cx } +% \end{macrocode} +% \end{macro} +% % \subsection{Deprecated interfaces} % % Deprecated on 2011-05-27, for removal by 2011-08-31. diff --git a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx index c3f26a6d337..d45b8147384 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3doc.dtx @@ -78,7 +78,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % %<*driver|class> -\GetIdInfo$Id: l3doc.dtx 2866 2011-10-01 05:16:55Z bruno $ +\GetIdInfo$Id: l3doc.dtx 2990 2011-11-23 02:32:59Z bruno $ {L3 Experimental documentation class} %</driver|class> % @@ -497,6 +497,7 @@ Do not distribute a modified version of this file. \bool_new:N \l_doc_long_name_bool \bool_new:N \g_doc_implementation_bool \dim_new:N \l_doc_trial_width_dim +\tl_new:N \l_doc_macro_tl \int_new:N \l_doc_macro_int \int_new:N \g_doc_nested_macro_int \prop_new:N \g_doc_missing_tests_prop @@ -1346,6 +1347,7 @@ Do not distribute a modified version of this file. % \end{macrocode} % After changing the catcodes, parse the arguments: % \begin{macrocode} +\clist_new:N \l_doc_macro_input_clist \cs_new_nopar:Npn \doc_macro_aux:n #1 { \group_end: \clist_set:Nn \l_doc_macro_input_clist {#1} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx index 7aada65f41b..a183e194f1b 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3expan.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3expan.dtx 3031 2011-12-07 05:27:05Z bruno $ {L3 Experimental argument expansion} %</driver|package> %<*driver> @@ -411,7 +411,7 @@ % \exp_args:Nccx % } % \begin{syntax} -% \cs{exp_args:NNnx} \meta{token1} \meta{token2} \meta{tokens1} \Arg{tokens2} +% \cs{exp_args:NNnx} \meta{token1} \meta{token2} \Arg{tokens1} \Arg{tokens2} % \end{syntax} % These functions absorb four arguments and expand the second, third % and fourth as detailed by their argument specifier. The first @@ -427,6 +427,7 @@ % \exp_last_unbraced:NV, % \exp_last_unbraced:No, % \exp_last_unbraced:Nv, +% \exp_last_unbraced:Nco, % \exp_last_unbraced:NcV, % \exp_last_unbraced:NNV, % \exp_last_unbraced:NNo, @@ -445,6 +446,22 @@ % last argument not surrounded by the usual braces. % Of these, the \texttt{:Nno}, \texttt{:Noo}, and \texttt{:Nfo} % variants need special (slower) processing. +% \begin{texnote} +% As an optimization, the last argument is unbraced by some +% of those functions before expansion. This can cause problems +% if the argument is empty: for instance, +% \cs{exp_last_unbraced:Nf} \cs{mypkg_foo:w} |{ }| \cs{q_stop} +% leads to an infinite loop, as the quark is \texttt{f}-expanded. +% \end{texnote} +% \end{function} +% +% \begin{function}{\exp_last_unbraced:Nx} +% \begin{syntax} +% \cs{exp_last_unbraced:Nx} \meta{function} \Arg{tokens} +% \end{syntax} +% This functions fully expands the \meta{tokens} and leaves +% the result in the input stream after reinsertion of \meta{function}. +% This function is not expandable. % \end{function} % % \begin{function}[EXP]{\exp_last_two_unbraced:Noo} @@ -858,7 +875,7 @@ { \fi: \fi: - \msg_expandable_error:n { Erroneous ~ variable ~ #2 used! } + \msg_expandable_kernel_error:nnn { kernel } { bad-var } {#2} \c_zero } % \end{macrocode} @@ -1088,6 +1105,7 @@ % \begin{macro}[aux]{\::o_unbraced} % \begin{macro}[aux]{\::V_unbraced} % \begin{macro}[aux]{\::v_unbraced} +% \begin{macro}[aux]{\::x_unbraced} % There are a few places where the last argument needs to be available % unbraced. First some helper macros. % \begin{macrocode} @@ -1109,25 +1127,33 @@ \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#2} } {#1} } +\cs_new_protected:Npn \::x_unbraced \::: #1#2 + { + \cs_set_nopar:Npx \l_exp_tl { \exp_not:n {#1} #2 } + \l_exp_tl + } % \end{macrocode} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} -%\end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\exp_last_unbraced:NV} % \begin{macro}{\exp_last_unbraced:Nv} % \begin{macro}{\exp_last_unbraced:Nf} % \begin{macro}{\exp_last_unbraced:No} +% \begin{macro}{\exp_last_unbraced:Nco} % \begin{macro}{\exp_last_unbraced:NcV} % \begin{macro}{\exp_last_unbraced:NNV} % \begin{macro}{\exp_last_unbraced:NNo} +% \begin{macro}{\exp_last_unbraced:NNNV} +% \begin{macro}{\exp_last_unbraced:NNNo} % \begin{macro}{\exp_last_unbraced:Nno} % \begin{macro}{\exp_last_unbraced:Noo} % \begin{macro}{\exp_last_unbraced:Nfo} -% \begin{macro}{\exp_last_unbraced:NNNV} -% \begin{macro}{\exp_last_unbraced:NNNo} +% \begin{macro}{\exp_last_unbraced:Nx} % Now the business end: most of these are hand-tuned for speed, but the % general system is in place. % \begin{macrocode} @@ -1138,6 +1164,8 @@ \cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 } \cs_new:Npn \exp_last_unbraced:Nf #1#2 { \exp_after:wN #1 \tex_romannumeral:D -`0 #2 } +\cs_new:Npn \exp_last_unbraced:Nco #1#2#3 + { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: #3 } \cs_new:Npn \exp_last_unbraced:NcV #1#2#3 { \exp_after:wN #1 @@ -1152,9 +1180,6 @@ } \cs_new:Npn \exp_last_unbraced:NNo #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 #3 } -\cs_new_nopar:Npn \exp_last_unbraced:Nno { \::n \::o_unbraced \::: } -\cs_new_nopar:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: } -\cs_new_nopar:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: } \cs_new:Npn \exp_last_unbraced:NNNV #1#2#3#4 { \exp_after:wN #1 @@ -1164,6 +1189,10 @@ } \cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 } +\cs_new_nopar:Npn \exp_last_unbraced:Nno { \::n \::o_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: } +\cs_new_protected_nopar:Npn \exp_last_unbraced:Nx { \::x_unbraced \::: } % \end{macrocode} % \end{macro} % \end{macro} @@ -1177,6 +1206,8 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\exp_last_two_unbraced:Noo} % If |#2| is a single token then this can be implemented as @@ -1332,7 +1363,7 @@ % \end{macro} % \end{macro} % \end{macro} -% +% % \begin{macro}[aux]{\cs_generate_variant_aux:N} % \begin{macro}[aux]{\cs_generate_variant_aux:w} % The idea here is to pick up protected parent functions, using the diff --git a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx index 85d3a91c533..7e22c24e8b5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3fp.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3fp.dtx 2857 2011-09-26 19:46:31Z joseph $ +\GetIdInfo$Id: l3fp.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental floating-point operations} %</driver|package> %<*driver> @@ -125,76 +125,44 @@ % \meta{value}. % \end{function} % -% \begin{function}{\fp_set_eq:NN, \fp_set_eq:cN, \fp_set_eq:Nc, \fp_set_eq:cc} -% \begin{syntax} -% \cs{fp_set_eq:NN} \meta{fp var1} \meta{fp var2} -% \end{syntax} -% Sets the value of \meta{floating point variable1} equal to that of -% \meta{floating point variable2}. This assignment is restricted to the -% current \TeX{} group level. -% \end{function} -% % \begin{function} -% {\fp_gset_eq:NN, \fp_gset_eq:cN, \fp_gset_eq:Nc, \fp_gset_eq:cc} +% { +% \fp_set_eq:NN, \fp_set_eq:cN, \fp_set_eq:Nc, \fp_set_eq:cc, +% \fp_gset_eq:NN, \fp_gset_eq:cN, \fp_gset_eq:Nc, \fp_gset_eq:cc +% } % \begin{syntax} -% \cs{fp_gset_eq:NN} \meta{fp var1} \meta{fp var2} +% \cs{fp_set_eq:NN} \meta{fp var1} \meta{fp var2} % \end{syntax} % Sets the value of \meta{floating point variable1} equal to that of -% \meta{floating point variable2}. This assignment is global and so is -% not limited by the current \TeX{} group level. +% \meta{floating point variable2}. % \end{function} % -% \begin{function}{\fp_zero:N, \fp_zero:c} +% \begin{function}{\fp_zero:N, \fp_zero:c, \fp_gzero:N, \fp_gzero:c} % \begin{syntax} % \cs{fp_zero:N} \meta{floating point variable} % \end{syntax} -% Sets the \meta{floating point variable} to |+0.000000000e0| within -% the current scope. -% \end{function} -% -% \begin{function}{\fp_gzero:N, \fp_gzero:c} -% \begin{syntax} -% \cs{fp_gzero:N} \meta{floating point variable} -% \end{syntax} -% Sets the \meta{floating point variable} to |+0.000000000e0| globally. +% Sets the \meta{floating point variable} to |+0.000000000e0|. % \end{function} % -% \begin{function}{\fp_set:Nn, \fp_set:cn} +% \begin{function}{\fp_set:Nn, \fp_set:cn, \fp_gset:Nn, \fp_gset:cn} % \begin{syntax} % \cs{fp_set:Nn} \meta{floating point variable} \Arg{value} % \end{syntax} -% Sets the \meta{floating point variable} variable to \meta{value} -% within the scope of the current \TeX{} group. +% Sets the \meta{floating point variable} variable to \meta{value}. % \end{function} % -% \begin{function}{\fp_gset:Nn, \fp_gset:cn} -% \begin{syntax} -% \cs{fp_gset:Nn} \meta{floating point variable} \Arg{value} -% \end{syntax} -% Sets the \meta{floating point variable} variable to \meta{value} -% globally. -% \end{function} -% -% \begin{function}{\fp_set_from_dim:Nn, \fp_set_from_dim:cn} +% \begin{function} +% { +% \fp_set_from_dim:Nn, \fp_set_from_dim:cn, +% \fp_gset_from_dim:Nn, \fp_gset_from_dim:cn +% } % \begin{syntax} % \cs{fp_set_from_dim:Nn} \meta{floating point variable} \Arg{dimexpr} % \end{syntax} % Sets the \meta{floating point variable} to the distance represented % by the \meta{dimension expression} in the units points. This means % that distances given in other units are first converted to points -% before being assigned to the \meta{floating point variable}. The -% assignment is local. -% \end{function} -% -% \begin{function}{\fp_gset_from_dim:Nn, \fp_gset_from_dim:cn} -% \begin{syntax} -% \cs{fp_gset_from_dim:Nn} \meta{floating point variable} \Arg{dimexpr} -% \end{syntax} -% Sets the \meta{floating point variable} to the distance represented -% by the \meta{dimension expression} in the units points. This means -% that distances given in other units are first converted to points -% before being assigned to the \meta{floating point variable}. The -% assignment is global. +% before being assigned to the \meta{floating point variable}. % \end{function} % % \begin{function}[rEXP]{\fp_use:N, \fp_use:c} @@ -283,40 +251,28 @@ % or significant figures using the usual method in which exact halves % are rounded up. % -% \begin{function}{\fp_round_figures:Nn, \fp_round_figures:cn} +% \begin{function} +% { +% \fp_round_figures:Nn, \fp_round_figures:cn, +% \fp_ground_figures:Nn, \fp_ground_figures:cn +% } % \begin{syntax} % \cs{fp_round_figures:Nn} \meta{floating point variable} \Arg{target} % \end{syntax} % Rounds the \meta{floating point variable} to the \meta{target} number -% of significant figures (an integer expression). The rounding is -% carried out locally. +% of significant figures (an integer expression). % \end{function} % -% \begin{function}{\fp_ground_figures:Nn, \fp_ground_figures:cn} -% \begin{syntax} -% \cs{fp_ground_figures:Nn} \meta{floating point variable} \Arg{target} -% \end{syntax} -% Rounds the \meta{floating point variable} to the \meta{target} number -% of significant figures (an integer expression). The rounding is -% carried out globally. -% \end{function} -% -% \begin{function}{\fp_round_places:Nn, \fp_round_places:cn} +% \begin{function} +% { +% \fp_round_places:Nn, \fp_round_places:cn, +% \fp_ground_places:Nn, \fp_ground_places:cn +% } % \begin{syntax} % \cs{fp_round_places:Nn} \meta{floating point variable} \Arg{target} % \end{syntax} % Rounds the \meta{floating point variable} to the \meta{target} number -% of decimal places (an integer expression). The rounding is -% carried out locally. -% \end{function} -% -% \begin{function}{\fp_ground_places:Nn, \fp_ground_places:cn} -% \begin{syntax} -% \cs{fp_ground_places:Nn} \meta{floating point variable} \Arg{target} -% \end{syntax} -% Rounds the \meta{floating point variable} to the \meta{target} number -% of decimal places (an integer expression). The rounding is -% carried out globally. +% of decimal places (an integer expression). % \end{function} % % \section{Floating-point conditionals} @@ -385,36 +341,18 @@ % The unary operations alter the value stored within an \texttt{fp} % variable. % -% \begin{function}{\fp_abs:N, \fp_abs:c} +% \begin{function}{\fp_abs:N, \fp_abs:c, \fp_gabs:N, \fp_gabs:c} % \begin{syntax} % \cs{fp_abs:N} \meta{floating point variable} % \end{syntax} -% Converts the \meta{floating point variable} to its absolute value, -% assigning the result within the current \TeX\ group. +% Converts the \meta{floating point variable} to its absolute value. % \end{function} % -% \begin{function}{\fp_gabs:N, \fp_gabs:c} -% \begin{syntax} -% \cs{fp_gabs:N} \meta{floating point variable} -% \end{syntax} -% Converts the \meta{floating point variable} to its absolute value, -% assigning the result globally. -% \end{function} -% -% \begin{function}{\fp_neg:N, \fp_neg:c} +% \begin{function}{\fp_neg:N, \fp_neg:c, \fp_gneg:N, \fp_gneg:c} % \begin{syntax} % \cs{fp_neg:N} \meta{floating point variable} % \end{syntax} -% Reverse the sign of the \meta{floating point variable}, assigning the -% result within the current \TeX\ group. -% \end{function} -% -% \begin{function}{\fp_gneg:N, \fp_gneg:c} -% \begin{syntax} -% \cs{fp_gneg:N} \meta{floating point variable} -% \end{syntax} -% Reverse the sign of the \meta{floating point variable}, assigning the -% result globally. +% Reverse the sign of the \meta{floating point variable}. % \end{function} % % \section{Floating-point arithmetic} @@ -428,77 +366,40 @@ % sets \cs{l_my_fp} to the result of $1.234 - 5.678$ % (\emph{i.e.}~$-4.444$). % -% \begin{function}{\fp_add:Nn, \fp_add:cn} +% \begin{function}{\fp_add:Nn, \fp_add:cn, \fp_gadd:Nn, \fp_gadd:cn} % \begin{syntax} % \cs{fp_add:Nn} \meta{floating point} \Arg{value} % \end{syntax} -% Adds the \meta{value} to the \meta{floating point}, making the -% assignment within the current \TeX{} group level. +% Adds the \meta{value} to the \meta{floating point}. % \end{function} % -% \begin{function}{\fp_gadd:Nn, \fp_gadd:cn} -% \begin{syntax} -% \cs{fp_gadd:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Adds the \meta{value} to the \meta{floating point}, making the -% assignment globally. -% \end{function} -% -% \begin{function}{\fp_sub:Nn, \fp_sub:cn} +% \begin{function}{\fp_sub:Nn, \fp_sub:cn, \fp_gsub:Nn, \fp_gsub:cn} % \begin{syntax} % \cs{fp_sub:Nn} \meta{floating point} \Arg{value} % \end{syntax} -% Subtracts the \meta{value} from the \meta{floating point}, making the -% assignment within the current \TeX{} group level. -% \end{function} -% -% \begin{function}{\fp_gsub:Nn, \fp_gsub:cn} -% \begin{syntax} -% \cs{fp_gsub:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Subtracts the \meta{value} from the \meta{floating point}, making the -% assignment globally. +% Subtracts the \meta{value} from the \meta{floating point}. % \end{function} % -% \begin{function}{\fp_mul:Nn, \fp_mul:cn} +% \begin{function}{\fp_mul:Nn, \fp_mul:cn, \fp_gmul:Nn, \fp_gmul:cn} % \begin{syntax} % \cs{fp_mul:Nn} \meta{floating point} \Arg{value} % \end{syntax} -% Multiples the \meta{floating point} by the \meta{value}, making the -% assignment within the current \TeX{} group level. +% Multiples the \meta{floating point} by the \meta{value}. % \end{function} % -% \begin{function}{\fp_gmul:Nn, \fp_gmul:cn} -% \begin{syntax} -% \cs{fp_gmul:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Multiples the \meta{floating point} by the \meta{value}, making the -% assignment globally. -% \end{function} -% -% \begin{function}{\fp_div:Nn, \fp_div:cn} +% \begin{function}{\fp_div:Nn, \fp_div:cn, \fp_gdiv:Nn, \fp_gdiv:cn} % \begin{syntax} % \cs{fp_div:Nn} \meta{floating point} \Arg{value} % \end{syntax} % Divides the \meta{floating point} by the \meta{value}, making the % assignment within the current \TeX{} group level. If the \meta{value} % is zero, the \meta{floating point} will be set to -% \cs{c_undefined_fp}. The assignment is local. -% \end{function} -% -% \begin{function}{\fp_gdiv:Nn, \fp_gdiv:cn} -% \begin{syntax} -% \cs{fp_gdiv:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Divides the \meta{floating point} by the \meta{value}, making the -% assignment globally. If the \meta{value} is zero, the -% \meta{floating point} will be set to \cs{c_undefined_fp}. -% The assignment is global. +% \cs{c_undefined_fp}. % \end{function} % % \section{Floating-point power operations} % -% \begin{function}{\fp_pow:Nn, \fp_pow:cn} +% \begin{function}{\fp_pow:Nn, \fp_pow:cn, \fp_gpow:Nn, \fp_gpow:cn} % \begin{syntax} % \cs{fp_pow:Nn} \meta{floating point} \Arg{value} % \end{syntax} @@ -508,54 +409,24 @@ % \meta{floating point} is positive, then the \meta{value} may be any % real value. Mathematically invalid operations such as $0^{0}$ % will give set the \meta{floating point} to to \cs{c_undefined_fp}. -% The assignment is local. -% \end{function} -% -% \begin{function}{\fp_gpow:Nn, \fp_gpow:cn} -% \begin{syntax} -% \cs{fp_gpow:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Raises the \meta{floating point} to the given \meta{value}. If the -% \meta{floating point} is negative, then the \meta{value} should be -% either a positive real number or a negative integer. If the -% \meta{floating point} is positive, then the \meta{value} may be any -% real value. Mathematically invalid operations such as $0^{0}$ -% will give set the \meta{floating point} to to \cs{c_undefined_fp}. -% The assignment is global. % \end{function} % % \section{Exponential and logarithm functions} % -% \begin{function}{\fp_exp:Nn, \fp_exp:cn} +% \begin{function}{\fp_exp:Nn, \fp_exp:cn, \fp_gexp:Nn, \fp_gexp:cn} % \begin{syntax} % \cs{fp_exp:Nn} \meta{floating point} \Arg{value} % \end{syntax} % Calculates the exponential of the \meta{value} and assigns this -% to the \meta{floating point}. The assignment is local. +% to the \meta{floating point}. % \end{function} % -% \begin{function}{\fp_gexp:Nn, \fp_gexp:cn} -% \begin{syntax} -% \cs{fp_gexp:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Calculates the exponential of the \meta{value} and assigns this -% to the \meta{floating point}. The assignment is global. -% \end{function} -% -% \begin{function}{\fp_ln:Nn, \fp_ln:cn} +% \begin{function}{\fp_ln:Nn, \fp_ln:cn, \fp_gln:Nn, \fp_gln:cn} % \begin{syntax} % \cs{fp_ln:Nn} \meta{floating point} \Arg{value} % \end{syntax} % Calculates the natural logarithm of the \meta{value} and assigns -% this to the \meta{floating point}. The assignment is local. -% \end{function} -% -% \begin{function}{\fp_gln:Nn, \fp_gln:cn} -% \begin{syntax} -% \cs{fp_gln:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Calculates the natural logarithm of the \meta{value} and assigns -% this to the \meta{floating point}. The assignment is global. +% this to the \meta{floating point}. % \end{function} % % \section{Trigonometric functions} @@ -564,58 +435,28 @@ % input value of $100\,000\,000$, as there are issues with range % reduction and very large input values. % -% \begin{function}{\fp_sin:Nn, \fp_sin:cn} +% \begin{function}{\fp_sin:Nn, \fp_sin:cn, \fp_gsin:Nn, \fp_gsin:cn} % \begin{syntax} % \cs{fp_sin:Nn} \meta{floating point} \Arg{value} % \end{syntax} % Assigns the sine of the \meta{value} to the \meta{floating point}. -% The \meta{value} should be given in radians. The assignment is -% local. +% The \meta{value} should be given in radians. % \end{function} % -% \begin{function}{\fp_gsin:Nn, \fp_gsin:cn} -% \begin{syntax} -% \cs{fp_gsin:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Assigns the sine of the \meta{value} to the \meta{floating point}. -% The \meta{value} should be given in radians. The assignment is -% global. -% \end{function} -% -% \begin{function}{\fp_cos:Nn, \fp_cos:cn} +% \begin{function}{\fp_cos:Nn, \fp_cos:cn, \fp_gcos:Nn, \fp_gcos:cn} % \begin{syntax} % \cs{fp_cos:Nn} \meta{floating point} \Arg{value} % \end{syntax} % Assigns the cosine of the \meta{value} to the \meta{floating point}. -% The \meta{value} should be given in radians. The assignment is -% local. -% \end{function} -% -% \begin{function}{\fp_gcos:Nn, \fp_gcos:cn} -% \begin{syntax} -% \cs{fp_gcos:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Assigns the cosine of the \meta{value} to the \meta{floating point}. -% The \meta{value} should be given in radians. The assignment is -% global. +% The \meta{value} should be given in radians. % \end{function} % -% \begin{function}{\fp_tan:Nn, \fp_tan:cn} +% \begin{function}{\fp_tan:Nn, \fp_tan:cn, \fp_gtan:Nn, \fp_gtan:cn} % \begin{syntax} % \cs{fp_tan:Nn} \meta{floating point} \Arg{value} % \end{syntax} % Assigns the tangent of the \meta{value} to the \meta{floating point}. -% The \meta{value} should be given in radians. The assignment is -% local. -% \end{function} -% -% \begin{function}{\fp_gtan:Nn, \fp_gtan:cn} -% \begin{syntax} -% \cs{fp_gtan:Nn} \meta{floating point} \Arg{value} -% \end{syntax} -% Assigns the tangent of the \meta{value} to the \meta{floating point}. -% The \meta{value} should be given in radians. The assignment is -% global. +% The \meta{value} should be given in radians. % \end{function} % % \section{Constant floating point values} @@ -663,7 +504,7 @@ % accuracy for cases likely to be relevant in typesetting situations. % A good overview of the challenges in this area can be found in % J.-M.~Muller, \emph{Elementary functions: algorithms and -% implementation}, 2nd edition, Birkh{\"a}uer Boston, New York, USA, +% implementation}, 2nd edition, Birkh{\"{a}}uer Boston, New York, USA, % 2006. % % The internal representation of numbers is tuned to the needs of the diff --git a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx index 2ecf43cd1b6..7f51f1d50f5 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3int.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3int.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2928 2011-10-22 12:32:44Z bruno $ +\GetIdInfo$Id: l3int.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental integers} %</driver|package> %<*driver> @@ -178,125 +178,67 @@ % globally to the \meta{integer expression}. % \end{function} % -% \begin{function}{\int_zero:N, \int_zero:c} +% \begin{function}{\int_zero:N, \int_zero:c, \int_gzero:N, \int_gzero:c} % \begin{syntax} % \cs{int_zero:N} \meta{integer} % \end{syntax} -% Sets \meta{integer} to $0$ within the scope of the current \TeX{} group. -% \end{function} -% -% \begin{function}{\int_gzero:N, \int_gzero:c} -% \begin{syntax} -% \cs{int_gzero:N} \meta{integer} -% \end{syntax} -% Sets \meta{integer} to $0$ globally, \emph{i.e.}~not -% restricted by the current \TeX{} group level. +% Sets \meta{integer} to $0$. % \end{function} % % \begin{function} -% {\int_set_eq:NN, \int_set_eq:cN, \int_set_eq:Nc, \int_set_eq:cc} +% { +% \int_set_eq:NN, \int_set_eq:cN, \int_set_eq:Nc, \int_set_eq:cc, +% \int_gset_eq:NN, \int_gset_eq:cN, \int_gset_eq:Nc, \int_gset_eq:cc +% } % \begin{syntax} % \cs{int_set_eq:NN} \meta{integer1} \meta{integer2} % \end{syntax} % Sets the content of \meta{integer1} equal to that of -% \meta{integer2}. This assignment is restricted to the current -% \TeX{} group level. -% \end{function} -% -% \begin{function} -% {\int_gset_eq:NN, \int_gset_eq:cN, \int_gset_eq:Nc, \int_gset_eq:cc} -% \begin{syntax} -% \cs{int_gset_eq:NN} \meta{integer1} \meta{integer2} -% \end{syntax} -% Sets the content of \meta{integer1} equal to that of \meta{integer2}. -% This assignment is global and so is not limited by the current -% \TeX{} group level. +% \meta{integer2}. % \end{function} % % \section{Setting and incrementing integers} % -% \begin{function}[updated = 2011-10-22]{\int_add:Nn, \int_add:cn} +% \begin{function}[updated = 2011-10-22] +% {\int_add:Nn, \int_add:cn, \int_gadd:Nn, \int_gadd:cn} % \begin{syntax} % \cs{int_add:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} % Adds the result of the \meta{integer expression} to the current -% content of the \meta{integer}. This assignment is local. +% content of the \meta{integer}. % \end{function} % -% \begin{function}{\int_gadd:Nn, \int_gadd:cn} -% \begin{syntax} -% \cs{int_gadd:Nn} \meta{integer} \Arg{integer expression} -% \end{syntax} -% Adds the result of the \meta{integer expression} to the current -% content of the \meta{integer}. This assignment is global. -% \end{function} -% -% \begin{function}{\int_decr:N, \int_decr:c} +% \begin{function}{\int_decr:N, \int_decr:c, \int_gdecr:N, \int_gdecr:c} % \begin{syntax} % \cs{int_decr:N} \meta{integer} % \end{syntax} -% Decreases the value stored in \meta{integer} by $1$ within -% the scope of the current \TeX{} group. -% \end{function} -% -% \begin{function}{\int_gdecr:N, \int_gdecr:c} -% \begin{syntax} -% \cs{int_incr:N} \meta{integer} -% \end{syntax} -% Decreases the value stored in \meta{integer} by $1$ globally -% (\emph{i.e.}~not limited by the current group level). -% \end{function} -% -% \begin{function}{\int_incr:N, \int_incr:c} -% \begin{syntax} -% \cs{int_incr:N} \meta{integer} -% \end{syntax} -% Increases the value stored in \meta{integer} by $1$ within -% the scope of the current \TeX{} group. +% Decreases the value stored in \meta{integer} by $1$. % \end{function} % -% \begin{function}{\int_gincr:N, \int_gincr:c} +% \begin{function}{\int_incr:N, \int_incr:c, \int_gincr:N, \int_gincr:c} % \begin{syntax} % \cs{int_incr:N} \meta{integer} % \end{syntax} -% Increases the value stored in \meta{integer} by $1$ globally -% (\emph{i.e.}~not limited by the current group level). +% Increases the value stored in \meta{integer} by $1$. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\int_set:Nn, \int_set:cn} +% \begin{function}[updated = 2011-10-22] +% {\int_set:Nn, \int_set:cn, \int_gset:Nn, \int_gset:cn} % \begin{syntax} % \cs{int_set:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} % Sets \meta{integer} to the value of \meta{integer expression}, % which must evaluate to an integer (as described for -% \cs{int_eval:n}). This assignment is restricted to the -% current \TeX{} group. -% \end{function} -% -% \begin{function}{\int_gset:Nn, \int_gset:cn} -% \begin{syntax} -% \cs{int_gset:Nn} \meta{integer} \Arg{integer expression} -% \end{syntax} -% Sets \meta{integer} to the value of \meta{integer expression}, -% which must evaluate to an integer (as described for -% \cs{int_eval:n}). This assignment is global and is not limited -% to the current \TeX{} group level. +% \cs{int_eval:n}). % \end{function} % -% \begin{function}[updated = 2011-10-22]{\int_sub:Nn, \int_sub:cn} +% \begin{function}[updated = 2011-10-22] +% {\int_sub:Nn, \int_sub:cn, \int_gsub:Nn, \int_gsub:cn} % \begin{syntax} % \cs{int_sub:Nn} \meta{integer} \Arg{integer expression} % \end{syntax} % Subtracts the result of the \meta{integer expression} to the -% current content of the \meta{integer}. This assignment is local. -% \end{function} -% -% \begin{function}{\int_gsub:Nn, \int_gsub:cn} -% \begin{syntax} -% \cs{int_gsub:Nn} \meta{integer} \Arg{integer expression} -% \end{syntax} -% Subtracts the result of the \meta{integer expression} to the -% current content of the \meta{integer}. This assignment is global. +% current content of the \meta{integer}. % \end{function} % % \section{Using integers} @@ -663,6 +605,14 @@ % Displays the value of the \meta{integer} on the terminal. % \end{function} % +% \begin{function}[added = 2011-11-22]{\int_show:n} +% \begin{syntax} +% \cs{int_show:n} \meta{integer expression} +% \end{syntax} +% Displays the result of evaluating the \meta{integer expression} +% on the terminal. +% \end{function} +% % \section{Constant integers} % % \begin{variable} @@ -1997,6 +1947,14 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\int_show:n} +% \UnitTested +% \begin{macrocode} +\cs_new_protected:Npn \int_show:n #1 + { \tex_showthe:D \int_eval:w #1 \int_eval_end: } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant integers} % % \begin{variable}{\c_minus_one} @@ -2085,14 +2043,6 @@ % \end{variable} % \end{variable} % -% \subsection{Registers for earlier modules} -% -% Needed from other modules: -% \begin{macrocode} -\int_new:N \g_seq_nesting_depth_int -\int_new:N \g_tl_inline_level_int -% \end{macrocode} -% % \subsection{Deprecated functions} % % Deprecated on 2011-05-27, for removal by 2011-08-31. @@ -2102,9 +2052,11 @@ % \begin{macro}{\int_convert_to_base_ten:nn} % Some simple renames. % \begin{macrocode} +%<*deprecated> \cs_new_eq:NN \int_convert_from_base_ten:nn \int_to_base:nn \cs_new_eq:NN \int_convert_to_symbols:nnn \int_to_symbols:nnn \cs_new_eq:NN \int_convert_to_base_ten:nn \int_from_base:nn +%</deprecated> % \end{macrocode} % \end{macro} % \end{macro} @@ -2116,6 +2068,7 @@ % \UnitTested % This is rather too tied to \LaTeXe{}. % \begin{macrocode} +%<*deprecated> \cs_new_nopar:Npn \int_to_symbol:n { \scan_align_safe_stop: @@ -2153,6 +2106,7 @@ { 9 } { \textdaggerdbl \textdaggerdbl } } } +%</deprecated> % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx index b31b0a3f8c3..991e02e6af8 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3io.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3io.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3io.dtx 3005 2011-11-25 13:19:47Z bruno $ {L3 Experimental input-output operations} %</driver|package> %<*driver> @@ -759,53 +759,28 @@ % \end{macro} % \end{macro} % +% % \begin{macro}{\ior_list_streams:} -% \begin{macro}{\iow_list_streams:} -% \begin{macro}[aux]{\iow_show_aux:nn} -% \begin{macro}[aux]{\ior_show_aux:nn} -% Show the property lists, but with some \enquote{pretty printing}. +% Show the property lists, but with some \enquote{pretty printing}. +% See the \pkg{l3msg} module. If there are no open read streams, +% issue the message \texttt{show-no-stream}, and show an empty +% token list. If there are open read streams, format them with +% \cs{msg_aux_show_unbraced:nn}, and with the message +% \texttt{show-open-streams}. % \begin{macrocode} \cs_new_protected_nopar:Npn \ior_list_streams: - { - \prop_if_empty:NTF \g_ior_streams_prop - { - \iow_term:x { No~input~streams~are~open } - \tl_show:n { } - } - { - \iow_term:x { The~following~input~streams~are~in~use: } - \tl_set:Nx \l_prop_show_tl - { \prop_map_function:NN \g_ior_streams_prop \ior_show_aux:nn } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } - } - } -\cs_new:Npn \ior_show_aux:nn #1#2 - { - \iow_newline: > \c_space_tl \c_space_tl - #1 \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} - } + { \ior_list_streams_aux:Nn \g_ior_streams_prop { ior } } \cs_new_protected_nopar:Npn \iow_list_streams: + { \ior_list_streams_aux:Nn \g_iow_streams_prop { iow } } +\cs_new_protected:Npn \ior_list_streams_aux:Nn #1#2 { - \prop_if_empty:NTF \g_iow_streams_prop - { - \iow_term:x { No~output~streams~are~open } - \tl_show:n { } - } - { - \iow_term:x { The~following~output~streams~are~in~use: } - \tl_set:Nx \l_prop_show_tl - { \prop_map_function:NN \g_iow_streams_prop \iow_show_aux:nn } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } - } + \msg_aux_use:nn { LaTeX / #2 } + { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } + \msg_aux_show:x + { \prop_map_function:NN #1 \msg_aux_show_unbraced:nn } } -\cs_new_eq:NN \iow_show_aux:nn \ior_show_aux:nn % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} -% \end{macro} % % Text for the error messages. % \begin{macrocode} @@ -1194,9 +1169,7 @@ % \begin{macrocode} \cs_new_protected_nopar:Npn \iow_wrap_special:w #1 ~ #2 ~ #3 ~ % { - \cs_if_exist:cTF { iow_wrap_#1: } - { \use:c { iow_wrap_#1: } } - { \msg_expandable_error:n {#1} } + \use:c { iow_wrap_#1: } \str_if_eq:xxTF { #2~#3 } { ~ \c_iow_wrap_marker_tl } { \iow_wrap_special:w } { \iow_wrap_loop:w #2 ~ #3 ~ } diff --git a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx index 12110fb86c2..430a018ca85 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3luatex.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3luatex.dtx 2798 2011-09-10 15:42:13Z will $ +\GetIdInfo$Id: l3luatex.dtx 2995 2011-11-23 16:15:19Z bruno $ {L3 Experimental LuaTeX-specific functions} %</driver|package> %<*driver> @@ -230,14 +230,24 @@ %</package> % \end{macrocode} % +% An error message. +% \begin{macrocode} +\msg_kernel_new:nnnn { luatex } { bad-engine } + { LuaTeX~engine~not~in~use!~Ignoring~#1. } + { + The~feature~you~are~using~is~only~available\ + with~the~luaTeX~engine.~LaTeX3~ignored~`#1#2'. + } +% \end{macrocode} +% % \begin{macro}{\lua_now:n, \lua_now:x} % \begin{macro}{\lua_shipout_x:n, \lua_shipout_x:x} % \begin{macro}{\lua_shipout:n, \lua_shipout:x} % When \LuaTeX{} is in use, this is all a question of primitives with new % names. On the other hand, for \pdfTeX{} and \XeTeX{} the argument should % be removed from the input stream before issuing an error. This is -% expandable, using \cs{msg_expandable_error:n} as for \texttt{V}-type -% expansion. +% expandable, using \cs{msg_expandable_kernel_error:nnn} +% as done for \texttt{V}-type expansion in \pkg{l3expan}. % \begin{macrocode} \luatex_if_engine:TF { @@ -247,13 +257,13 @@ { \cs_new:Npn \lua_now:x #1 { - \msg_expandable_error:n - { LuaTeX~ engine~ not~ in~ use!~ Ignoring~ \lua_now:x. } + \msg_expandable_kernel_error:nnn + { luatex } { bad-engine } { \lua_now:x } } \cs_new_protected:Npn \lua_shipout_x:n #1 { - \msg_expandable_error:n - { LuaTeX~ engine~ not~ in~ use!~ Ignoring~ \lua_shipout_x:n. } + \msg_expandable_kernel_error:nnn + { luatex } { bad-engine } { \lua_shipout_x:n } } } \cs_new:Npn \lua_now:n #1 @@ -313,7 +323,13 @@ } } \luatex_if_engine:F - { \cs_set_protected_nopar:Npn \cctab_new:N #1 { \lua_wrong_engine: } } + { + \cs_set_protected_nopar:Npn \cctab_new:N #1 + { + \msg_kernel_error:nnx { luatex } { bad-engine } + { \exp_not:N \cctab_new:N } + } + } %<*package> \luatex_if_engine:T { @@ -354,8 +370,16 @@ } \luatex_if_engine:F { - \cs_set_protected_nopar:Npn \cctab_begin:N #1 { \lua_wrong_engine: } - \cs_set_protected_nopar:Npn \cctab_end: { \lua_wrong_engine: } + \cs_set_protected_nopar:Npn \cctab_begin:N #1 + { + \msg_kernel_error:nnxx { luatex } { bad-engine } + { \exp_not:N \cctab_begin:N } {#1} + } + \cs_set_protected_nopar:Npn \cctab_end: + { + \msg_kernel_error:nnx { luatex } { bad-engine } + { \exp_not:N \cctab_end: } + } } %<*package> \luatex_if_engine:T @@ -383,7 +407,13 @@ \group_end: } \luatex_if_engine:F - { \cs_set_protected_nopar:Npn \cctab_gset:Nn #1#2 { \lua_wrong_engine: } } + { + \cs_set_protected_nopar:Npn \cctab_gset:Nn #1#2 + { + \msg_kernel_error:nnxx { luatex } { bad-engine } + { \exp_not:N \cctab_gset:Nn } { #1 {#2} } + } + } % \end{macrocode} % \end{macro} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx index 0e1eb8e072e..36d9e6d9d48 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3msg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3msg.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental messages} %</driver|package> %<*driver> @@ -115,7 +115,7 @@ % line. An error will be raised if the \meta{message} already exists. % \end{function} % -% \begin{function}{\msg_set:nnnn, \msg_set:nnn} +% \begin{function}{\msg_set:nnnn, \msg_set:nnn, \msg_gset:nnnn, \msg_gset:nnn} % \begin{syntax} % \cs{msg_set:nnnn} \Arg{module} \Arg{message} \Arg{text} \Arg{more text} % \end{syntax} @@ -633,11 +633,29 @@ % \section{Expandable errors} % % In a few places, the \LaTeX3 kernel needs to produce errors in an -% expansion only context. This must be handled very differently from -% normal error messages, as none of the tools to print to the terminal -% or the log file are expandable. +% expansion only context. This must be handled internally very +% differently from normal error messages, as none of the tools +% to print to the terminal or the log file are expandable. +% However, the interface is similar. % -% \begin{function}[added = 2011-08-11, updated = 2011-08-13] +% \begin{function}[EXP, added = 2011-11-23] +% { +% \msg_expandable_kernel_error:nnnnnn, +% \msg_expandable_kernel_error:nnnnn, +% \msg_expandable_kernel_error:nnnn, +% \msg_expandable_kernel_error:nnn, +% \msg_expandable_kernel_error:nn +% } +% \begin{syntax} +% \cs{msg_expandable_kernel_error:nnnnnn} \Arg{module} \Arg{message} +% ~~\Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \end{syntax} +% Issues an error, passing \meta{arg one} to \meta{arg four} +% to the text-creating functions. The resulting string must +% be shorter than a line, otherwise it will be cropped. +% \end{function} +% +% \begin{function}[EXP, added = 2011-08-11, updated = 2011-08-13] % {\msg_expandable_error:n} % \begin{syntax} % \cs{msg_expandable_error:n} \Arg{error message} @@ -653,6 +671,36 @@ % \end{texnote} % \end{function} % +% \section{Internal \pkg{l3msg} functions} +% +% The following functions are used in several kernel modules. +% +% \begin{function}{\msg_aux_use:nn, \msg_aux_use:nnxxxx} +% \begin{syntax} +% \cs{msg_aux_use:nnxx} \Arg{module} \Arg{message} +% ~~\Arg{arg one} \Arg{arg two} \Arg{arg three} \Arg{arg four} +% \end{syntax} +% Prints the \meta{message} from \meta{module} in the terminal, +% without formatting. +% \end{function} +% +% \begin{function}{\msg_aux_show:x} +% \begin{syntax} +% \cs{msg_aux_show:x} \Arg{formatted string} +% \end{syntax} +% Shows the \meta{formatted string} on the terminal. +% The \meta{formatted string} must start with |^^J>|, +% failure to do so causes low-level \TeX{} errors. +% \end{function} +% +% \begin{function}{\msg_aux_show:Nnx} +% \begin{syntax} +% \cs{msg_aux_show:Nnx} \meta{variable} \Arg{module} \Arg{token list} +% \end{syntax} +% Auxiliary common to \pkg{l3clist}, \pkg{l3prop} and \pkg{seq}, +% which displays an appropriate message and the contents of the variable. +% \end{function} +% % \end{documentation} % % \begin{implementation} @@ -678,7 +726,7 @@ % \end{macrocode} % \end{variable} % -%\section{Creating messages} +% \subsection{Creating messages} % % Messages are created and used separately, so there two parts to % the code here. First, a mechanism for creating message text. @@ -702,7 +750,7 @@ { \cs_if_exist:cT { \c_msg_text_prefix_tl #1 / #2 } { - \msg_kernel_error:nn { msg } { message-already-defined } + \msg_kernel_error:nnxx { msg } { message-already-defined } {#1} {#2} } \msg_gset:nnnn {#1} {#2} @@ -857,7 +905,6 @@ \group_end: } % \end{macrocode} -% \begin{macrocode} % Depending on the availability of more information there is a choice of % how to set up the further help. The extra help text has to be set % before the message itself can be issued. Everything is done using @@ -1044,7 +1091,7 @@ % \end{macro} % \end{macro} % -%\begin{macro} +% \begin{macro} % { % \msg_fatal:nnxxxx , % \msg_fatal:nnxxx , @@ -1329,7 +1376,7 @@ \cs_new_protected_nopar:Npn \msg_redirect_name:nnn #1#2#3 { \prop_put:Nnn \l_msg_redirect_names_prop { // #1 / #2 / } {#3} } % \end{macrocode} -%\end{macro} +% \end{macro} % % \subsection{Kernel-specific functions} % @@ -1513,9 +1560,8 @@ { Message~'#2'~for~module~'#1'~already~defined. } { \c_msg_coding_error_text_tl - LaTeX~was~asked~to~define~a~new~message~called~'#2' - by~the~module~'#1'~module:\\ - this~message~already~exists. + LaTeX~was~asked~to~define~a~new~message~called~'#2'\ + by~the~module~'#1':~this~message~already~exists. \c_msg_return_text_tl } \msg_kernel_new:nnnn { msg } { message-unknown } @@ -1591,34 +1637,54 @@ } % \end{macrocode} % -% \begin{macro}{\msg_kernel_bug:x} -% \begin{variable}{\c_msg_kernel_bug_text_tl, \c_msg_kernel_bug_more_text_tl} -% The \LaTeX{} coding bug error gets re-visited here. +% Some errors only appear in expandable settings, +% hence don't need a \enquote{more-text} argument. % \begin{macrocode} -\cs_set_protected:Npn \msg_kernel_bug:x #1 +\msg_kernel_new:nnn { seq } { misused } + { A~sequence~was~misused. } +\msg_kernel_new:nnn { kernel } { bad-var } + { Erroneous~variable~#1 used! } +\msg_kernel_new:nnn { prg } { zero-step } + { Zero~step~size~for~stepwise~function~#1. } +% \end{macrocode} +% +% Messages used by the \enquote{\texttt{show}} functions. +% \begin{macrocode} +\msg_kernel_new:nnn { seq } { show } { - \msg_interrupt:xxx { \c_msg_kernel_bug_text_tl } - { - #1 - \msg_see_documentation_text:n { LaTeX3 } - } - { \c_msg_kernel_bug_more_text_tl } + Sequence~\token_to_str:N #1~ + \seq_if_empty:NTF #1 + { is~empty } + { contains~the~items~(without~outer~braces): } } -\tl_const:Nn \c_msg_kernel_bug_text_tl - { This~is~a~LaTeX~bug:~check~coding! } -\tl_const:Nn \c_msg_kernel_bug_more_text_tl +\msg_kernel_new:nnn { prop } { show } { - There~is~a~coding~bug~somewhere~around~here. \\ - This~probably~needs~examining~by~an~expert. - \c_msg_return_text_tl + Property~list~\token_to_str:N #1~ + \prop_if_empty:NTF #1 + { is~empty } + { contains~the~pairs~(without~outer~braces): } } +\msg_kernel_new:nnn { clist } { show } + { + Comma~list~ + \str_if_eq:nnF {#1} { \l_clist_tmpa_clist } { \token_to_str:N #1~} + \clist_if_empty:NTF #1 + { is~empty } + { contains~the~items~(without~outer~braces): } + } +\msg_kernel_new:nnn { ior } { show-no-stream } + { No~input~streams~are~open } +\msg_kernel_new:nnn { ior } { show-open-streams } + { The~following~input~streams~are~in~use: } +\msg_kernel_new:nnn { iow } { show-no-stream } + { No~output~streams~are~open } +\msg_kernel_new:nnn { iow } { show-open-streams } + { The~following~output~streams~are~in~use: } % \end{macrocode} -% \end{variable} -% \end{macro} % % \subsection{Expandable errors} % -% \begin{macro}{\msg_expandable_error:n} +% \begin{macro}[int]{\msg_expandable_error:n} % In expansion only context, we cannot use the normal means of % reporting errors. Instead, we feed \TeX{} an undefined control % sequence, \cs{LaTeX3 error:}. It is thus interrupted, and shows @@ -1655,15 +1721,165 @@ \exp_after:wN \exp_after:wN \exp_after:wN \c_zero } - \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } - \exp_not:N \q_stop + \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } ^ } - \cs_new:Npn \msg_expandable_error_aux:w #1 ^ #2 \q_stop { #1 } + \cs_new:Npn \msg_expandable_error_aux:w #1 ^ #2 ^ { #1 } } \group_end: % \end{macrocode} % \end{macro} % +% \begin{macro} +% { +% \msg_expandable_kernel_error:nnnnnn, +% \msg_expandable_kernel_error:nnnnn, +% \msg_expandable_kernel_error:nnnn, +% \msg_expandable_kernel_error:nnn, +% \msg_expandable_kernel_error:nn +% } +% The command built from the csname +% |\c_msg_text_prefix_tl LaTeX / #1 / #2| +% takes four arguments and builds the error text, which is fed to +% \cs{msg_expandable_error:n}. +% \begin{macrocode} +\cs_new:Npn \msg_expandable_kernel_error:nnnnnn #1#2#3#4#5#6 + { + \exp_args:Nf \msg_expandable_error:n + { + \exp_args:NNc \exp_after:wN \exp_stop_f: + { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + } + } +\cs_new:Npn \msg_expandable_kernel_error:nnnnn #1#2#3#4#5 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} {#3} {#4} {#5} { } + } +\cs_new:Npn \msg_expandable_kernel_error:nnnn #1#2#3#4 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} {#3} {#4} { } { } + } +\cs_new:Npn \msg_expandable_kernel_error:nnn #1#2#3 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} {#3} { } { } { } + } +\cs_new:Npn \msg_expandable_kernel_error:nn #1#2 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} { } { } { } { } + } +% \end{macrocode} +% \end{macro} +% +% \subsection{Showing variables} +% +% Functions defined in this section are used for diagnostic functions +% in \pkg{l3clist}, \pkg{l3io}, \pkg{l3prop}, \pkg{l3seq}, \pkg{xtemplate} +% +% \begin{variable}{\l_msg_show_tl} +% Used to store the material for the diagnostic functions +% of various modules. +% \begin{macrocode} +\tl_new:N \l_msg_show_tl +% \end{macrocode} +% \end{variable} +% +% \begin{macro}[aux]{\msg_aux_use:nn} +% \begin{macro}[aux]{\msg_aux_use:nnxxxx} +% Print the text of a message to the terminal, without formatting. +% \begin{macrocode} +\cs_new_protected:Npn \msg_aux_use:nn #1#2 + { \msg_aux_use:nnxxxx {#1} {#2} { } { } { } { } } +\cs_new_protected:Npn \msg_aux_use:nnxxxx #1#2#3#4#5#6 + { + \iow_term:x + { + \use:c { \c_msg_text_prefix_tl #1 / #2 } + {#3} {#4} {#5} {#6} + } + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}[int]{\msg_aux_show:Nnx} +% \begin{macro}[aux]{\msg_aux_show:x} +% \begin{macro}[aux,EXP]{\msg_aux_show:w} +% The arguments of \cs{msg_aux_show:Nnx} are +% \begin{itemize} +% \item The \meta{variable} to be shown. +% \item The \texttt{TF} emptyness conditional for that type of variables. +% \item The type of the variable. +% \item A mapping of the form \cs{seq_map_function:NN} \meta{variable} +% \cs{msg_aux_show:n}, which produces the formatted string. +% \end{itemize} +% We remove a new line and \verb*|> | from the first item using +% a \texttt{w}-type auxiliary, and the fact that \texttt{f}-expansion +% removes a space. To avoid a low-level \TeX{} error if there is +% an empty argument, a simple test is used to keep the output +% \enquote{clean}. The odd \cs{exp_after:wN} and trailing +% \cs{prg_do_nothing:} improve the output slightly. +% \begin{macrocode} +\cs_new_protected:Npn \msg_aux_show:Nnx #1#2#3 + { + \cs_if_exist:NTF #1 + { + \msg_aux_use:nnxxxx { LaTeX / #2 } { show } {#1} { } { } { } + \msg_aux_show:x {#3} + } + { + \msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } + } +\cs_new_protected:Npn \msg_aux_show:x #1 + { + \tl_set:Nx \l_msg_show_tl {#1} + \tl_if_empty:NT \l_msg_show_tl + { \tl_set:Nx \l_msg_show_tl { > } } + \exp_args:Nf \etex_showtokens:D + { + \exp_after:wN \exp_after:wN + \exp_after:wN \msg_aux_show:w + \exp_after:wN \l_msg_show_tl + \exp_after:wN + } + \prg_do_nothing: + } +\cs_new:Npn \msg_aux_show:w #1 > { } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}[aux,EXP]{\msg_aux_show:n} +% \begin{macro}[aux,EXP]{\msg_aux_show:nn} +% \begin{macro}[aux,EXP]{\msg_aux_show_unbraced:nn} +% Each item in the variable is formatted using one of +% the following functions. +% \begin{macrocode} +\cs_new:Npn \msg_aux_show:n #1 + { + \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } + } +\cs_new:Npn \msg_aux_show:nn #1#2 + { + \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } + \c_space_tl \c_space_tl => \c_space_tl \c_space_tl { \exp_not:n {#2} } + } +\cs_new:Npn \msg_aux_show_unbraced:nn #1#2 + { + \iow_newline: > \c_space_tl \c_space_tl \exp_not:n {#1} + \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} + } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Deprecated functions} % % Deprecated on 2011-05-27, for removal by 2011-08-31. @@ -1722,6 +1938,32 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\msg_kernel_bug:x} +% \begin{variable}{\c_msg_kernel_bug_text_tl, \c_msg_kernel_bug_more_text_tl} +% \begin{macrocode} +%<*deprecated> +\cs_set_protected:Npn \msg_kernel_bug:x #1 + { + \msg_interrupt:xxx { \c_msg_kernel_bug_text_tl } + { + #1 + \msg_see_documentation_text:n { LaTeX3 } + } + { \c_msg_kernel_bug_more_text_tl } + } +\tl_const:Nn \c_msg_kernel_bug_text_tl + { This~is~a~LaTeX~bug:~check~coding! } +\tl_const:Nn \c_msg_kernel_bug_more_text_tl + { + There~is~a~coding~bug~somewhere~around~here. \\ + This~probably~needs~examining~by~an~expert. + \c_msg_return_text_tl + } +%</deprecated> +% \end{macrocode} +% \end{variable} +% \end{macro} +% % \begin{macrocode} %</initex|package> % \end{macrocode} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx index 51cbb0a2671..79585b9c36c 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prg.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2915 2011-10-15 21:21:08Z bruno $ +\GetIdInfo$Id: l3prg.dtx 3014 2011-11-27 06:55:43Z bruno $ {L3 Experimental control structures} %</driver|package> %<*driver> @@ -761,6 +761,29 @@ % branches according to the result. % \end{function} % +% \begin{function}[EXP]{\prg_break_point:n} +% \begin{syntax} +% \cs{prg_break_point:n} \meta{tokens} +% \end{syntax} +% Used to mark the end of a recursion or mapping: the functions +% \cs{prg_map_break:} and \cs{prg_map_break:n} use this to break out +% of the loop. After the loop ends, the \meta{tokens} are inserted into +% the input stream. This occurs even if the the break functions are +% \emph{not} applied: \cs{prg_break_point:n} is functionally-equivalent +% in these cases to \cs{use:n}. +% \end{function} +% +% \begin{function}[EXP]{\prg_map_break:, \prg_map_break:n} +% \begin{syntax} +% \cs{prg_map_break:n} \Arg{user code} +% \ldots{} +% \cs{prg_break_point:n} \Arg{ending code} +% \end{syntax} +% Breaks a recursion in mapping contexts, inserting +% in the input stream the \meta{user code} after the +% \meta{ending code} for the loop. +% \end{function} +% % \section{Experimental programmings functions} % % \begin{function}{\prg_quicksort:n} @@ -1664,50 +1687,45 @@ % \end{macro} % % \begin{macro}{\prg_stepwise_function:nnnN} -% \begin{macro}[aux] -% {\prg_stepwise_function_incr:nnnN, \prg_stepwise_function_decr:nnnN} -% Repeating a function by steps fist needs a check on the direction +% \begin{macro}[aux]{\prg_stepwise_aux:nnnN} +% \begin{macro}[aux]{\prg_stepwise_aux:NnnnN} +% Repeating a function by steps first needs a check on the direction % of the steps. After that, do the function for the start value -% then step and loop around. +% then step and loop around. It would be more symmetrical to test +% for a step size of zero before checking the sign, but we optimize +% for the most frequent case (positive step). % \begin{macrocode} \cs_new:Npn \prg_stepwise_function:nnnN #1#2#3#4 { - \int_compare:nNnTF {#2} = \c_zero - { \msg_expandable_error:n { Zero~step~size~for~stepwise~function. } } - { - \int_compare:nNnTF {#2} > \c_zero - { \exp_args:Nf \prg_stepwise_function_incr:nnnN } - { \exp_args:Nf \prg_stepwise_function_decr:nnnN } - { \int_eval:n {#1} } {#2} {#3} #4 - } + \prg_stepwise_aux:nnnN {#1} {#2} {#3} #4 + \prg_break_point:n { } } -\cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4 +\cs_new:Npn \prg_stepwise_aux:nnnN #1#2#3#4 { - \int_compare:nNnF {#1} > {#3} + \int_compare:nNnTF {#2} > \c_zero + { \exp_args:NNf \prg_stepwise_aux:NnnnN > } { - #4 {#1} - \exp_args:Nf \prg_stepwise_function_incr:nnnN - { \int_eval:n { #1 + #2 } } {#2} {#3} #4 + \int_compare:nNnTF {#2} = \c_zero + { + \msg_expandable_kernel_error:nnn { prg } { zero-step } {#4} + \prg_map_break: + } + { \exp_args:NNf \prg_stepwise_aux:NnnnN < } } + { \int_eval:n {#1} } {#2} {#3} #4 } -\cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4 +\cs_new:Npn \prg_stepwise_aux:NnnnN #1#2#3#4#5 { - \int_compare:nNnF {#1} < {#3} + \int_compare:nNnF {#2} #1 {#4} { - #4 {#1} - \exp_args:Nf \prg_stepwise_function_decr:nnnN - { \int_eval:n { #1 + #2 } } {#2} {#3} #4 + #5 {#2} + \exp_args:NNf \prg_stepwise_aux:NnnnN + #1 { \int_eval:n { #2 + #3 } } {#3} {#4} #5 } } % \end{macrocode} % \end{macro} % \end{macro} -% -% \begin{macro}[aux]{\g_prg_stepwise_level_int} -% For nesting, the usual approach of using a counter. -% \begin{macrocode} -\int_new:N \g_prg_stepwise_level_int -% \end{macrocode} % \end{macro} % % \begin{macro}{\prg_stepwise_inline:nnnn} @@ -1722,13 +1740,13 @@ { \exp_args:NNc \prg_stepwise_aux:NNnnnn \cs_gset_nopar:Npn - { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n } + { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } } \cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2#3#4#5 { \exp_args:NNc \prg_stepwise_aux:NNnnnn \cs_gset_nopar:Npx - { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n } + { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } {#1}{#2}{#3} { \tl_set:Nn \exp_not:N #4 {##1} @@ -1738,9 +1756,9 @@ \cs_new_protected:Npn \prg_stepwise_aux:NNnnnn #1#2#3#4#5#6 { #1 #2 ##1 {#6} - \int_gincr:N \g_prg_stepwise_level_int - \prg_stepwise_function:nnnN {#3}{#4}{#5} #2 - \int_gdecr:N \g_prg_stepwise_level_int + \int_gincr:N \g_prg_map_int + \prg_stepwise_aux:nnnN {#3} {#4} {#5} #2 + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } } % \end{macrocode} % \end{macro} @@ -1909,6 +1927,22 @@ % \end{macro} % \end{macro} % +% \begin{variable}{\g_prg_map_int} +% A nesting counter for mapping. +% \begin{macrocode} +\int_new:N \g_prg_map_int +% \end{macrocode} +% \end{variable} +% +% \begin{macro}{\prg_break_point:n} +% \begin{macro}{\prg_map_break:} +% \begin{macro}{\prg_map_break:n} +% These are all defined in \pkg{l3basics}, as they are needed +% \enquote{early}. This is just a reminder that that is the case! +% \end{macro} +% \end{macro} +% \end{macro} +% % \subsection{Experimental programmings functions} % % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx index a7e2b28cee8..2cec56bc55e 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3prop.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 2839 2011-09-17 20:18:23Z bruno $ +\GetIdInfo$Id: l3prop.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental property lists} %</driver|package> %<*driver> @@ -94,94 +94,54 @@ % initially contain no entries. % \end{function} % -% \begin{function}{\prop_clear:N, \prop_clear:c} +% \begin{function} +% {\prop_clear:N, \prop_clear:c, \prop_gclear:N, \prop_gclear:c} % \begin{syntax} % \cs{prop_clear:N} \meta{property list} % \end{syntax} -% Clears all entries from the \meta{property list} within the scope of -% the current \TeX{} group. -% \end{function} -% -% \begin{function}{\prop_gclear:N, \prop_gclear:c} -% \begin{syntax} -% \cs{prop_gclear:N} \meta{property list} -% \end{syntax} -% Clears all entries from the \meta{property list} globally. +% Clears all entries from the \meta{property list}. % \end{function} % -% \begin{function}{\prop_clear_new:N, \prop_clear_new:c} +% \begin{function} +% { +% \prop_clear_new:N, \prop_clear_new:c, +% \prop_gclear_new:N, \prop_gclear_new:c +% } % \begin{syntax} % \cs{prop_clear_new:N} \meta{property list} % \end{syntax} -% If the \meta{property list} already exists, clears it within the scope -% of the current \TeX{} group. If the \meta{property list} is not defined, -% it will be created (using \cs{prop_new:N}). Thus the property list is -% guaranteed to be available and clear within the current \TeX{} -% group. The \meta{property list} will exist globally, but the content -% outside of the current \TeX{} group is not specified. -% \end{function} -% -% \begin{function}{\prop_gclear_new:N, \prop_gclear_new:c} -% \begin{syntax} -% \cs{prop_gclear_new:N} \meta{property list} -% \end{syntax} -% If the \meta{property list} already exists, clears it globally. If the -% \meta{property list} is not defined, it will be created (using -% \cs{prop_new:N}). Thus the property list is guaranteed to be available -% and globally clear. +% Ensures that the \meta{property list} exists globally by applying +% \cs{prop_new:N} if necessary, then applies \cs{prop_(g)clear:N} to leave +% the list empty. % \end{function} % % \begin{function} -% {\prop_set_eq:NN, \prop_set_eq:cN, \prop_set_eq:Nc, \prop_set_eq:cc} +% { +% \prop_set_eq:NN, \prop_set_eq:cN, \prop_set_eq:Nc, \prop_set_eq:cc, +% \prop_gset_eq:NN, \prop_gset_eq:cN, \prop_gset_eq:Nc, \prop_gset_eq:cc +% } % \begin{syntax} % \cs{prop_set_eq:NN} \meta{property list1} \meta{property list2} % \end{syntax} % Sets the content of \meta{property list1} equal to that of -% \meta{property list2}. This assignment is restricted to the current -% \TeX{} group level. -% \end{function} -% -% \begin{function} -% {\prop_gset_eq:NN, \prop_gset_eq:cN, \prop_gset_eq:Nc, \prop_gset_eq:cc} -% \begin{syntax} -% \cs{prop_gset_eq:NN} \meta{property list1} \meta{property list2} -% \end{syntax} -% Sets the content of \meta{property list1} equal to that of -% \meta{property list2}. This assignment is global and so is not -% limited by the current \TeX{} group level. +% \meta{property list2}. % \end{function} % % \section{Adding entries to property lists} % % \begin{function} % { -% \prop_put:Nnn, \prop_put:NnV, \prop_put:Nno, \prop_put:Nnx, -% \prop_put:NVn, \prop_put:NVV, \prop_put:Non, \prop_put:Noo, -% \prop_put:cnn, \prop_put:cnV, \prop_put:cno, \prop_put:cnx, -% \prop_put:cVn, \prop_put:cVV, \prop_put:con, \prop_put:coo -% } -% \begin{syntax} -% \cs{prop_put:Nnn} \meta{property list} \Arg{key} \Arg{value} -% \end{syntax} -% Adds an entry to the \meta{property list} which may be accessed -% using the \meta{key} and which has \meta{value}. Both the \meta{key} -% and \meta{value} may contain any \meta{balanced text}. The \meta{key} -% is stored after processing with \cs{tl_to_str:n}, meaning that -% category codes are ignored. If the \meta{key} is already present -% in the \meta{property list}, the existing entry is overwritten -% by the new \meta{value}. The assignment is restricted to the current -% \TeX{} group. -% \end{function} -% -% \begin{function} -% { +% \prop_put:Nnn, \prop_put:NnV, \prop_put:Nno, \prop_put:Nnx, +% \prop_put:NVn, \prop_put:NVV, \prop_put:Non, \prop_put:Noo, +% \prop_put:cnn, \prop_put:cnV, \prop_put:cno, \prop_put:cnx, +% \prop_put:cVn, \prop_put:cVV, \prop_put:con, \prop_put:coo, % \prop_gput:Nnn, \prop_gput:NnV, \prop_gput:Nno, \prop_gput:Nnx, % \prop_gput:NVn, \prop_gput:NVV, \prop_gput:Non, \prop_gput:Noo, % \prop_gput:cnn, \prop_gput:cnV, \prop_gput:cno, \prop_gput:cnx, % \prop_gput:cVn, \prop_gput:cVV, \prop_gput:con, \prop_gput:coo % } % \begin{syntax} -% \cs{prop_gput:Nnn} \meta{property list} \Arg{key} \Arg{value} +% \cs{prop_put:Nnn} \meta{property list} \Arg{key} \Arg{value} % \end{syntax} % Adds an entry to the \meta{property list} which may be accessed % using the \meta{key} and which has \meta{value}. Both the \meta{key} @@ -189,10 +149,14 @@ % is stored after processing with \cs{tl_to_str:n}, meaning that % category codes are ignored. If the \meta{key} is already present % in the \meta{property list}, the existing entry is overwritten -% by the new \meta{value}. The assignment is global. +% by the new \meta{value}. % \end{function} % -% \begin{function}{\prop_put_if_new:Nnn, \prop_put_if_new:cnn} +% \begin{function} +% { +% \prop_put_if_new:Nnn, \prop_put_if_new:cnn, +% \prop_gput_if_new:Nnn, \prop_gput_if_new:cnn +% } % \begin{syntax} % \cs{prop_put_if_new:Nnn} \meta{property list} \Arg{key} \Arg{value} % \end{syntax} @@ -201,20 +165,7 @@ % \meta{property list} then a new entry is added. Both the \meta{key} % and \meta{value} may contain any \meta{balanced text}. The \meta{key} % is stored after processing with \cs{tl_to_str:n}, meaning that -% category codes are ignored. The assignment is restricted to the current -% \TeX{} group. -% \end{function} -% -% \begin{function}{\prop_gput_if_new:Nnn, \prop_gput_if_new:cnn} -% \begin{syntax} -% \cs{prop_gput_if_new:Nnn} \meta{property list} \Arg{key} \Arg{value} -% \end{syntax} -% If the \meta{key} is present in the \meta{property list} then -% no action is taken. If the \meta{key} is not present in the -% \meta{property list} then a new entry is added. Both the \meta{key} -% and \meta{value} may contain any \meta{balanced text}. The \meta{key} -% is stored after processing with \cs{tl_to_str:n}, meaning that -% category codes are ignored. The assignment is global. +% category codes are ignored. % \end{function} % % \section{Recovering values from property lists} @@ -267,7 +218,11 @@ %% % \section{Modifying property lists} % -% \begin{function}{\prop_del:Nn, \prop_del:NV, \prop_del:cn, \prop_del:cV} +% \begin{function} +% { +% \prop_del:Nn, \prop_del:NV, \prop_del:cn, \prop_del:cV, +% \prop_gdel:Nn, \prop_gdel:NV, \prop_gdel:cn, \prop_gdel:cV +% } % \begin{syntax} % \cs{prop_del:Nn} \meta{property list} \Arg{key} % \end{syntax} @@ -278,18 +233,6 @@ % deleting it. The deletion is restricted to the current \TeX{} group. % \end{function} % -% \begin{function}{\prop_gdel:Nn, \prop_gdel:NV, \prop_gdel:cn, \prop_gdel:cV} -% \begin{syntax} -% \cs{prop_gdel:Nn} \meta{property list} \Arg{key} -% \end{syntax} -% Deletes the entry listed under \meta{key} from the -% \meta{property list} which may be accessed. If the \meta{key} is -% not found in the \meta{property list} no change occurs, -% \emph{i.e}~there is no need to test for the existence of a key before -% deleting it. The deletion is not restricted to the current \TeX{} -% group: it is global. -% \end{function} -% % \section{Property list conditionals} % % \begin{function}[EXP,pTF]{\prop_if_empty:N, \prop_if_empty:c} @@ -365,7 +308,7 @@ % \end{syntax} % Applies \meta{function} to every \meta{entry} stored in the % \meta{property list}. The \meta{function} will receive two argument for -% each iteration.: the \meta{key} and associated \meta{value}. +% each iteration: the \meta{key} and associated \meta{value}. % The order in which \meta{entries} are returned is not defined and % should not be relied upon. % \end{function} @@ -600,10 +543,10 @@ % \begin{macrocode} \cs_new_protected:Npn \prop_clear_new:N #1 { \cs_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } } -\cs_generate_variant:Nn \prop_clear_new:N {c} +\cs_generate_variant:Nn \prop_clear_new:N { c } \cs_new_protected:Npn \prop_gclear_new:N #1 { \cs_if_exist:NTF #1 { \prop_gclear:N #1 } { \prop_new:N #1 } } -\cs_new_eq:NN \prop_gclear_new:c \prop_gclear:c +\cs_generate_variant:Nn \prop_gclear_new:N { c } % \end{macrocode} % \end{macro} % \end{macro} @@ -643,7 +586,7 @@ % after the key. % % If the key is present in the property list, then \meta{extra argument} -% is simply \cs{q_prop}, and \cs{prop_splot_aux:nnnn} will gobble this +% is simply \cs{q_prop}, and \cs{prop_split_aux:nnnn} will gobble this % and the false branch (|#4|), leaving the correct code on the input % stream. More precisely, it leaves the user code (true branch), followed % by three groups, \Arg{extract1} \Arg{value} \Arg{extract2}. @@ -657,7 +600,7 @@ % the three brace groups that just follow. Then \cs{use_ii:nn} removes % the true branch, leaving the false branch, with no trailing material. % \begin{macrocode} -\cs_set_protected:Npn \prop_split:NnTF #1#2 +\cs_new_protected:Npn \prop_split:NnTF #1#2 { \exp_args:NNo \prop_split_aux:NnTF #1 { \tl_to_str:n {#2} } } \cs_new_protected:Npn \prop_split_aux:NnTF #1#2 { @@ -688,7 +631,7 @@ % the value corresponding to the \meta{key}, and \meta{extract2} (the part % after the \meta{key}) is missing the leading \cs{q_prop}. % \begin{macrocode} -\cs_set_protected:Npn \prop_split:Nnn #1#2#3 +\cs_new_protected:Npn \prop_split:Nnn #1#2#3 { \prop_split:NnTF #1 {#2} {#3} @@ -875,7 +818,7 @@ % \prop_if_in:Nn, \prop_if_in:NV, \prop_if_in:No, % \prop_if_in:cn, \prop_if_in:cV, \prop_if_in:co % } -% \begin{macro}[aux]{\prop_if_in_aux:nwn,\prop_if_in_aux:Nw} +% \begin{macro}[aux]{\prop_if_in_aux:nwn,\prop_if_in_aux:N} % Testing expandably if a key is in a property list % requires to go through the key--value pairs one by one. % This is rather slow, and a faster test would be @@ -909,21 +852,23 @@ \exp_last_unbraced:Noo \prop_if_in_aux:nwn { \tl_to_str:n {#2} } #1 \tl_to_str:n {#2} \q_prop { } - \q_recursion_tail \q_recursion_stop + \q_recursion_tail + \prg_break_point:n { } } \cs_new:Npn \prop_if_in_aux:nwn #1 \q_prop #2 \q_prop #3 { \str_if_eq:xxTF {#1} {#2} - { \prop_if_in_aux:Nw } + { \prop_if_in_aux:N } { \prop_if_in_aux:nwn {#1} } } -\cs_new:Npn \prop_if_in_aux:Nw #1 #2 \q_recursion_stop +\cs_new:Npn \prop_if_in_aux:N #1 { \if_meaning:w \q_prop #1 \prg_return_true: \else: \prg_return_false: \fi: + \prop_map_break: } \cs_generate_variant:Nn \prop_if_in_p:Nn { NV , No } \cs_generate_variant:Nn \prop_if_in_p:Nn { c , cV , co } @@ -985,7 +930,8 @@ \cs_new_nopar:Npn \prop_map_function:NN #1#2 { \exp_last_unbraced:NNo \prop_map_function_aux:Nwn #2 - #1 \q_recursion_tail \q_prop { } \q_recursion_stop + #1 \q_recursion_tail \q_prop { } + \prg_break_point:n { } } \cs_new:Npn \prop_map_function_aux:Nwn #1 \q_prop #2 \q_prop #3 { @@ -1001,94 +947,51 @@ % \end{macro} % \end{macro} % -% \begin{variable}{\g_prop_map_inline_int} -% A nesting counter for mapping. -% \begin{macrocode} -\int_new:N \g_prop_map_inline_int -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\prop_map_inline:Nn, \prop_map_inline:cn} % Mapping in line requires a nesting level counter. % \begin{macrocode} \cs_new_protected:Npn \prop_map_inline:Nn #1#2 { - \int_gincr:N \g_prop_map_inline_int - \cs_gset:cpn { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } + \int_gincr:N \g_prg_map_int + \cs_gset:cpn { prop_map_inline_ \int_use:N \g_prg_map_int :nn } ##1##2 {#2} - \prop_map_function:Nc #1 - { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } - \int_gdecr:N \g_prop_map_inline_int + \exp_last_unbraced:Nco \prop_map_function_aux:Nwn + { prop_map_inline_ \int_use:N \g_prg_map_int :nn } + #1 + \q_recursion_tail \q_prop { } + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } } \cs_generate_variant:Nn \prop_map_inline:Nn { c } % \end{macrocode} % \end{macro} % % \begin{macro}{\prop_map_break:} -% Breaking the map function simply means removing everything up to -% the \cs{q_stop} marker. -% \begin{macrocode} -\cs_new_eq:NN \prop_map_break: \use_none_delimit_by_q_recursion_stop:w -% \end{macrocode} -% \end{macro} -% % \begin{macro}{\prop_map_break:n} -% The same idea for using one set of tokens. +% The break statements are simply copies. % \begin{macrocode} -\cs_new_eq:NN \prop_map_break:n \use_i_delimit_by_q_recursion_stop:nw +\cs_new_eq:NN \prop_map_break: \prg_map_break: +\cs_new_eq:NN \prop_map_break:n \prg_map_break:n % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{Viewing property lists} % -% \begin{variable}{\l_prop_show_tl} -% Used to store the material for display. -% \begin{macrocode} -\tl_new:N \l_prop_show_tl -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\prop_show:N, \prop_show:c} -% \begin{macro}[aux]{\prop_show_aux:n} -% \begin{macro}[aux]{\prop_show_aux:w} -% The aim of the mapping here is to create a token list containing the -% formatted property list. The very first item needs the new line and -% \verb*|> | removing, which is achieved using a \texttt{w}-type auxiliary. -% To avoid a low-level \TeX{} error if there is an empty property list, a -% simple test is used to keep the output \enquote{clean}. +% Apply the general \cs{msg_aux_show:Nnx}. Contrarily +% to sequences and comma lists, we use \cs{msg_aux_show:nn} +% to format both the key and the value for each pair. % \begin{macrocode} \cs_new_protected_nopar:Npn \prop_show:N #1 { - \prop_if_empty:NTF #1 - { - \iow_term:x { Property~list~\token_to_str:N #1~is~empty } - \tl_show:n { } - } - { - \iow_term:x - { - Property~list~\token_to_str:N #1~ - contains~the~pairs~(without~outer~braces): - } - \tl_set:Nx \l_prop_show_tl - { \prop_map_function:NN #1 \prop_show_aux:nn } - \tl_show:n \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } - } - } -\cs_new:Npn \prop_show_aux:nn #1#2 - { - \iow_newline: > \c_space_tl \c_space_tl - \iow_char:N \{ #1 \iow_char:N \} - \c_space_tl \c_space_tl => \c_space_tl \c_space_tl - \iow_char:N \{ \exp_not:n {#2} \iow_char:N \} + \msg_aux_show:Nnx + #1 + { prop } + { \prop_map_function:NN #1 \msg_aux_show:nn } } -\cs_new:Npn \prop_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \prop_show:N { c } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Experimental functions} % @@ -1139,7 +1042,8 @@ \cs_new:Npn \prop_map_tokens:Nn #1#2 { \exp_last_unbraced:Nno \prop_map_tokens_aux:nwn {#2} #1 - \q_recursion_tail \q_prop { } \q_recursion_stop + \q_recursion_tail \q_prop { } + \prg_break_point:n { } } \cs_new:Npn \prop_map_tokens_aux:nwn #1 \q_prop #2 \q_prop #3 { diff --git a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx index 6f87a8a08f5..1709da93420 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3quark.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3quark.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3quark.dtx 3014 2011-11-27 06:55:43Z bruno $ {L3 Experimental quarks} %</driver|package> %<*driver> @@ -182,7 +182,7 @@ % % \begin{function}{\quark_if_recursion_tail_stop:N} % \begin{syntax} -% \cs{quark_if_recursion_tail_stop:N} \Arg{token} +% \cs{quark_if_recursion_tail_stop:N} \meta{token} % \end{syntax} % Tests if \meta{token} contains only the marker % \cs{q_recursion_tail}, and if so terminates the recursion this is @@ -205,7 +205,7 @@ % % \begin{function}{\quark_if_recursion_tail_stop_do:Nn} % \begin{syntax} -% \cs{quark_if_recursion_tail_stop_do:Nn} \Arg{token} \Arg{insertion} +% \cs{quark_if_recursion_tail_stop_do:Nn} \meta{token} \Arg{insertion} % \end{syntax} % Tests if \meta{token} contains only the marker % \cs{q_recursion_tail}, and if so terminates the recursion this is @@ -230,6 +230,19 @@ % ended. % \end{function} % +% \begin{function} +% { +% \quark_if_recursion_tail_break:N, +% \quark_if_recursion_tail_break:n +% } +% \begin{syntax} +% \cs{quark_if_recursion_tail_break:n} \Arg{token list} +% \end{syntax} +% Tests if \meta{token list} contains only \cs{q_recursion_tail}, +% and if so terminates the recursion using \cs{prg_map_break:}. +% The recursion end should be marked by \cs{prg_break_point:n}. +% \end{function} +% % \section{Internal quark functions} % % \begin{function}{\use_none_delimit_by_q_recursion_stop:w} @@ -318,13 +331,13 @@ % \begin{macrocode} \cs_new:Npn \quark_if_recursion_tail_stop:N #1 { - \if_meaning:w #1 \q_recursion_tail + \if_meaning:w \q_recursion_tail #1 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: } \cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1 { - \if_meaning:w #1 \q_recursion_tail + \if_meaning:w \q_recursion_tail #1 \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw \else: \exp_after:wN \use_none:n @@ -340,7 +353,6 @@ % \begin{macro} % {\quark_if_recursion_tail_stop_do:nn,\quark_if_recursion_tail_stop_do:on} % \UnitTested -% \begin{macro}[aux]{\quark_if_recursion_tail_aux:w} % The same idea applies when testing multiple tokens, but here we just % compare the token list to \cs{q_recursion_tail} as a string. % \begin{macrocode} @@ -365,6 +377,27 @@ % \end{macrocode} % \end{macro} % \end{macro} +% +% \begin{macro}{\quark_if_recursion_tail_break:N} +% \begin{macro}{\quark_if_recursion_tail_break:n} +% Analogs of the \cs{quark_if_recursion_tail_stop\ldots{}} functions. +% Break the mapping using \cs{prg_map_break:}. +% \begin{macrocode} +\cs_new:Npn \quark_if_recursion_tail_break:N #1 + { + \if_meaning:w \q_recursion_tail #1 + \exp_after:wN \prg_map_break: + \fi: + } +\cs_new:Npn \quark_if_recursion_tail_break:n #1 + { + \if_int_compare:w \pdftex_strcmp:D + { \exp_not:N \q_recursion_tail } { \exp_not:n {#1} } = \c_zero + \exp_after:wN \prg_map_break: + \fi: + } +% \end{macrocode} +% \end{macro} % \end{macro} % % \begin{macro}[pTF]{\quark_if_nil:N} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 6739c5e3ce0..df4beb9ae68 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3seq.dtx 3033 2011-12-07 10:12:21Z joseph $ {L3 Experimental sequences and stacks} %</driver|package> %<*driver> @@ -86,83 +86,62 @@ % initially contain no items. % \end{function} % -% \begin{function}{\seq_clear:N, \seq_clear:c} +% \begin{function}{\seq_clear:N, \seq_clear:c, \seq_gclear:N, \seq_gclear:c} % \begin{syntax} % \cs{seq_clear:N} \meta{sequence} % \end{syntax} -% Clears all items from the \meta{sequence} within the scope of -% the current \TeX{} group. +% Clears all items from the \meta{sequence}. % \end{function} % -% \begin{function}{\seq_gclear:N, \seq_gclear:c} -% \begin{syntax} -% \cs{seq_gclear:N} \meta{sequence} -% \end{syntax} -% Clears all entries from the \meta{sequence} globally. -% \end{function} -% -% \begin{function}{\seq_clear_new:N, \seq_clear_new:c} +% \begin{function} +% {\seq_clear_new:N, \seq_clear_new:c, \seq_gclear_new:N, \seq_gclear_new:c} % \begin{syntax} % \cs{seq_clear_new:N} \meta{sequence} % \end{syntax} -% If the \meta{sequence} already exists, clears it within the scope -% of the current \TeX{} group. If the \meta{sequence} is not defined, -% it will be created (using \cs{seq_new:N}). Thus the sequence is -% guaranteed to be available and clear within the current \TeX{} -% group. The \meta{sequence} will exist globally, but the content -% outside of the current \TeX{} group is not specified. -% \end{function} -% -% \begin{function}{\seq_gclear_new:N, \seq_gclear_new:c} -% \begin{syntax} -% \cs{seq_gclear_new:N} \meta{sequence} -% \end{syntax} -% If the \meta{sequence} already exists, clears it globally. If the -% \meta{sequence} is not defined, it will be created (using -% \cs{seq_new:N}). Thus the sequence is guaranteed to be available -% and globally clear. +% Ensures that the \meta{sequence} exists globally by applying +% \cs{seq_new:N} if necessary, then applies \cs{seq_(g)clear:N} to leave +% the \meta{sequence} empty. % \end{function} % % \begin{function} -% {\seq_set_eq:NN, \seq_set_eq:cN, \seq_set_eq:Nc, \seq_set_eq:cc} +% { +% \seq_set_eq:NN, \seq_set_eq:cN, \seq_set_eq:Nc, \seq_set_eq:cc, +% \seq_gset_eq:NN, \seq_gset_eq:cN, \seq_gset_eq:Nc, \seq_gset_eq:cc +% } % \begin{syntax} % \cs{seq_set_eq:NN} \meta{sequence1} \meta{sequence2} % \end{syntax} % Sets the content of \meta{sequence1} equal to that of -% \meta{sequence2}. This assignment is restricted to the current -% \TeX{} group level. +% \meta{sequence2}. % \end{function} % -% \begin{function} -% {\seq_gset_eq:NN, \seq_gset_eq:cN, \seq_gset_eq:Nc, \seq_gset_eq:cc} +% \begin{function}[added = 2011-08-15, updated = 2011-12-07] +% {\seq_set_split:Nnn, \seq_gset_split:Nnn} % \begin{syntax} -% \cs{seq_gset_eq:NN} \meta{sequence1} \meta{sequence2} +% \cs{seq_set_split:Nnn} \meta{sequence} \Arg{delimiter} \Arg{token list} % \end{syntax} -% Sets the content of \meta{sequence1} equal to that of -% \meta{sequence2}. This assignment is global and so is not -% limited by the current \TeX{} group level. +% Splits the \meta{token list} into \meta{items} separated +% by \meta{delimiter}, and assigns the result to the \meta{sequence}. +% Spaces on both sides of each \meta{item} are ignored, +% then one set of outer braces is removed (if any); +% this space trimming behaviour is identical to that of +% \pkg{l3clist} functions. Empty \meta{items} are preserved by +% \cs{seq_set_split:Nnn}, and can be removed afterwards using +% \cs{seq_remove_all:Nn} \meta{sequence} \Arg{}. +% The \meta{delimiter} may not contain |{|, |}| or |#| +% (assuming \TeX{}'s normal category code r\'egime). +% If the \meta{delimiter} is empty, the \meta{token list} is split +% into \meta{items} as a \meta{token list}. % \end{function} % -% \begin{function}{\seq_concat:NNN, \seq_concat:ccc} +% \begin{function} +% {\seq_concat:NNN, \seq_concat:ccc, \seq_gconcat:NNN, \seq_gconcat:ccc} % \begin{syntax} % \cs{seq_concat:NNN} \meta{sequence1} \meta{sequence2} \meta{sequence3} % \end{syntax} % Concatenates the content of \meta{sequence2} and \meta{sequence3} % together and saves the result in \meta{sequence1}. The items in % \meta{sequence2} will be placed at the left side of the new sequence. -% This operation is local to the current \TeX{} group and will -% remove any existing content in \meta{sequence1}. -% \end{function} -% -% \begin{function}{\seq_gconcat:NNN, \seq_gconcat:ccc} -% \begin{syntax} -% \cs{seq_gconcat:NNN} \meta{sequence1} \meta{sequence2} \meta{sequence3} -% \end{syntax} -% Concatenates the content of \meta{sequence2} and \meta{sequence3} -% together and saves the result in \meta{sequence1}. The items in -% \meta{sequence2} will be placed at the left side of the new sequence. -% This operation is global and will remove any existing content in -% \meta{sequence1}. % \end{function} % % \section{Appending data to sequences} @@ -171,52 +150,32 @@ % \seq_put_left:Nn, \seq_put_left:NV, \seq_put_left:Nv, % \seq_put_left:No, \seq_put_left:Nx, % \seq_put_left:cn, \seq_put_left:cV, \seq_put_left:cv, -% \seq_put_left:co, \seq_put_left:cx -% } -% \begin{syntax} -% \cs{seq_put_left:Nn} \meta{sequence} \Arg{item} -% \end{syntax} -% Appends the \meta{item} to the left of the \meta{sequence}. -% The assignment is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}{ +% \seq_put_left:co, \seq_put_left:cx, % \seq_gput_left:Nn, \seq_gput_left:NV, \seq_gput_left:Nv, % \seq_gput_left:No, \seq_gput_left:Nx, % \seq_gput_left:cn, \seq_gput_left:cV, \seq_gput_left:cv, % \seq_gput_left:co, \seq_gput_left:cx % } % \begin{syntax} -% \cs{seq_gput_left:Nn} \meta{sequence} \Arg{item} +% \cs{seq_put_left:Nn} \meta{sequence} \Arg{item} % \end{syntax} % Appends the \meta{item} to the left of the \meta{sequence}. -% The assignment is global. % \end{function} % % \begin{function}{ % \seq_put_right:Nn, \seq_put_right:NV, \seq_put_right:Nv, % \seq_put_right:No, \seq_put_right:Nx, % \seq_put_right:cn, \seq_put_right:cV, \seq_put_right:cv, -% \seq_put_right:co, \seq_put_right:cx -% } -% \begin{syntax} -% \cs{seq_put_right:Nn} \meta{sequence} \Arg{item} -% \end{syntax} -% Appends the \meta{item} to the right of the \meta{sequence}. -% The assignment is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}{ +% \seq_put_right:co, \seq_put_right:cx, % \seq_gput_right:Nn, \seq_gput_right:NV, \seq_gput_right:Nv, % \seq_gput_right:No, \seq_gput_right:Nx, % \seq_gput_right:cn, \seq_gput_right:cV, \seq_gput_right:cv, % \seq_gput_right:co, \seq_gput_right:cx % } % \begin{syntax} -% \cs{seq_gput_right:Nn} \meta{sequence} \Arg{item} +% \cs{seq_put_right:Nn} \meta{sequence} \Arg{item} % \end{syntax} % Appends the \meta{item} to the right of the \meta{sequence}. -% The assignment is global. % \end{function} % % \section{Recovering items from sequences} @@ -301,29 +260,17 @@ % to update sequences, while retaining the order of the unaffected % entries. % -% \begin{function}{\seq_remove_duplicates:N, \seq_remove_duplicates:c} +% \begin{function} +% { +% \seq_remove_duplicates:N, \seq_remove_duplicates:c, +% \seq_gremove_duplicates:N, \seq_gremove_duplicates:c +% } % \begin{syntax} % \cs{seq_remove_duplicates:N} \meta{sequence} % \end{syntax} % Removes duplicate items from the \meta{sequence}, leaving the % left most copy of each item in the \meta{sequence}. The \meta{item} % comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}. -% The removal is local to the current \TeX{} group. -% \begin{texnote} -% This function iterates through every item in the \meta{sequence} and -% does a comparison with the \meta{items} already checked. It is therefore -% relatively slow with large sequences. -% \end{texnote} -% \end{function} -% -% \begin{function}{\seq_gremove_duplicates:N, \seq_gremove_duplicates:c} -% \begin{syntax} -% \cs{seq_gremove_duplicates:N} \meta{sequence} -% \end{syntax} -% Removes duplicate items from the \meta{sequence}, leaving the -% left most copy of each item in the \meta{sequence}. The \meta{item} -% comparison takes place on a token basis, as for \cs{tl_if_eq:nn(TF)}. -% The removal is applied globally. % \begin{texnote} % This function iterates through every item in the \meta{sequence} and % does a comparison with the \meta{items} already checked. It is therefore @@ -331,22 +278,17 @@ % \end{texnote} % \end{function} % -% \begin{function}{\seq_remove_all:Nn, \seq_remove_all:cn} +% \begin{function} +% { +% \seq_remove_all:Nn , \seq_remove_all:cn, +% \seq_gremove_all:Nn, \seq_gremove_all:cn +% } % \begin{syntax} % \cs{seq_remove_all:Nn} \meta{sequence} \Arg{item} % \end{syntax} % Removes every occurrence of \meta{item} from the \meta{sequence}. % The \meta{item} comparison takes place on a token basis, as for -% \cs{tl_if_eq:nn(TF)}. The removal is local to the current \TeX{} group. -% \end{function} -% -% \begin{function}{\seq_gremove_all:Nn, \seq_gremove_all:cn} -% \begin{syntax} -% \cs{seq_gremove_all:Nn} \meta{sequence} \Arg{item} -% \end{syntax} -% Removes each occurrence of \meta{item} from the \meta{sequence}. -% The \meta{item} comparison takes place on a token basis, as for -% \cs{tl_if_eq:nn(TF)}. The removal is applied globally. +% \cs{tl_if_eq:nn(TF)}. % \end{function} % % \section{Sequence conditionals} @@ -430,7 +372,7 @@ % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the -% internal macro \cs{seq_break_point:n} before further items are taken +% internal macro \cs{prg_break_point:n} before further items are taken % from the input stream. This will depend on the design of the mapping % function. % \end{texnote} @@ -458,7 +400,7 @@ % level \TeX{} errors. % \begin{texnote} % When the mapping is broken, additional tokens may be inserted by the -% internal macro \cs{seq_break_point:n} before the \meta{tokens} are +% internal macro \cs{prg_break_point:n} before the \meta{tokens} are % inserted into the input stream. % This will depend on the design of the mapping function. % \end{texnote} @@ -505,27 +447,16 @@ % \begin{function} % { % \seq_push:Nn, \seq_push:NV, \seq_push:Nv, \seq_push:No, \seq_push:Nx, -% \seq_push:cn, \seq_push:cV, \seq_push:cv, \seq_push:co, \seq_push:cx -% } -% \begin{syntax} -% \cs{seq_push:Nn} \meta{sequence} \Arg{item} -% \end{syntax} -% Adds the \Arg{item} to the top of the \meta{sequence}. -% The assignment is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function} -% { +% \seq_push:cn, \seq_push:cV, \seq_push:cv, \seq_push:co, \seq_push:cx, % \seq_gpush:Nn, \seq_gpush:NV, \seq_gpush:Nv, % \seq_gpush:No, \seq_gpush:Nx, % \seq_gpush:cn, \seq_gpush:cV, \seq_gpush:cv, % \seq_gpush:co, \seq_gpush:cx % } % \begin{syntax} -% \cs{seq_gpush:Nn} \meta{sequence} \Arg{item} +% \cs{seq_push:Nn} \meta{sequence} \Arg{item} % \end{syntax} -% Pushes the \meta{item} onto the end of the top of the -% \meta{sequence}. The assignment is global. +% Adds the \Arg{item} to the top of the \meta{sequence}. % \end{function} % % \section{Viewing sequences} @@ -677,53 +608,30 @@ % % \begin{function} % { -% \seq_set_from_clist:NN, \seq_set_from_clist:cN, -% \seq_set_from_clist:Nc, \seq_set_from_clist:cc, -% \seq_set_from_clist:Nn, \seq_set_from_clist:cn -% } -% \begin{syntax} -% \cs{seq_set_from_clist:NN} \meta{sequence} \meta{comma-list} -% \end{syntax} -% Sets the \meta{sequence} within the current \TeX{} group to be equal -% to the content of the \meta{comma-list}. -% \end{function} -% -% \begin{function} -% { +% \seq_set_from_clist:NN, \seq_set_from_clist:cN, +% \seq_set_from_clist:Nc, \seq_set_from_clist:cc, +% \seq_set_from_clist:Nn, \seq_set_from_clist:cn, % \seq_gset_from_clist:NN, \seq_gset_from_clist:cN, % \seq_gset_from_clist:Nc, \seq_gset_from_clist:cc, % \seq_gset_from_clist:Nn, \seq_gset_from_clist:cn % } % \begin{syntax} -% \cs{seq_gset_from_clist:NN} \meta{sequence} \meta{comma-list} +% \cs{seq_set_from_clist:NN} \meta{sequence} \meta{comma-list} % \end{syntax} -% Sets the \meta{sequence} globally to equal to the content of the -% \meta{comma-list}. +% Sets the \meta{sequence} within the current \TeX{} group to be equal +% to the content of the \meta{comma-list}. % \end{function} % -% \begin{function}[added = 2011-08-12]{\seq_set_reverse:N,\seq_gset_reverse:N} +% \begin{function}[added = 2011-11-22, updated = 2011-11-24] +% {\seq_reverse:N, \seq_greverse:N} % \begin{syntax} -% \cs{seq_set_reverse:N} \meta{sequence} +% \cs{seq_reverse:N} \meta{sequence} % \end{syntax} % Reverses the order of items in the \meta{sequence}, and % assigns the result to \meta{sequence}, locally or globally % according to the variant chosen. % \end{function} % -% \begin{function}[added = 2011-08-15] -% {\seq_set_split:Nnn,\seq_gset_split:Nnn} -% \begin{syntax} -% \cs{seq_set_split:Nnn} \meta{sequence} \Arg{delimiter} \Arg{token list} -% \end{syntax} -% This function splits the \meta{token list} into \meta{items} -% separated by \meta{delimiter}, ignoring all explicit space -% characters from both sides of each \meta{item}, then removing -% one set of outer braces if any. The result is assigned to -% \meta{sequence}, locally or globally according to the function -% chosen. The \meta{delimiter} may not contain |{|, |}| or |#| -% (assuming \TeX{}'s normal category code r\'egime). -% \end{function} -% % \section{Internal sequence functions} % % \begin{function}{\seq_if_empty_err_break:N} @@ -731,7 +639,7 @@ % \cs{seq_if_empty_err_break:N} \meta{sequence} % \end{syntax} % Tests if the \meta{sequence} is empty, and if so issues an error -% message before skipping over any tokens up to \cs{seq_break_point:n}. +% message before skipping over any tokens up to \cs{prg_break_point:n}. % This function is used to avoid more serious errors which would % otherwise occur if some internal functions were applied to an % empty \meta{sequence}. @@ -769,7 +677,7 @@ % \cs{seq_break:} % \end{syntax} % Used to terminate sequence functions by gobbling all tokens -% up to \cs{seq_break_point:n}. This function is a copy of +% up to \cs{prg_break_point:n}. This function is a copy of % \cs{seq_map_break:}, but is used in situations which are % not mappings. % \end{function} @@ -779,24 +687,12 @@ % \cs{seq_break:n} \Arg{tokens} % \end{syntax} % Used to terminate sequence functions by gobbling all tokens -% up to \cs{seq_break_point:n}, then inserting the \meta{tokens} +% up to \cs{prg_break_point:n}, then inserting the \meta{tokens} % before continuing reading the input stream. This function is a copy % of \cs{seq_map_break:n}, but is used in situations which are % not mappings. % \end{function} % -% \begin{function}[EXP]{\seq_break_point:n} -% \begin{syntax} -% \cs{seq_break_point:n} \meta{tokens} -% \end{syntax} -% Used to mark the end of a recursion or mapping: the functions -% \cs{seq_map_break:} and \cs{seq_map_break:n} use this to break out -% of the loop. After the loop ends, the \meta{tokens} are inserted into -% the input stream. This occurs even if the the break functions are -% \emph{not} applied: \cs{seq_break_point:n} is functionally-equivalent -% in these cases to \cs{use:n}. -% \end{function} -% % \end{documentation} % % \begin{implementation} @@ -834,7 +730,7 @@ % \begin{macrocode} \cs_new:Npn \seq_item:n { - \msg_expandable_error:n { A~sequence~was~used~incorrectly. } + \msg_expandable_kernel_error:nn { seq } { misused } \use_none:n } % \end{macrocode} @@ -905,6 +801,70 @@ % \end{macrocode} % \end{macro} % \end{macro} +% +% +% \begin{macro}{\seq_set_split:Nnn,\seq_gset_split:Nnn} +% \begin{macro}[aux]{\seq_set_split_aux:NNnn} +% \begin{macro}[aux] +% { +% \seq_set_split_aux_i:w, \seq_set_split_aux_ii:w, +% \seq_set_split_aux_end: +% } +% The goal is to split a given token list at a marker, +% strip spaces from each item, and remove one set of +% outer braces if after removing leading and trailing +% spaces the item is enclosed within braces. After +% \cs{tl_replace_all:Nnn}, the token list \cs{l_seq_tmpa_tl} +% is a repetition of the pattern +% \cs{seq_set_split_aux_i:w} \cs{prg_do_nothing:} +% \meta{item with spaces} \cs{seq_set_split_aux_end:}. +% Then, \texttt{x}-expansion causes \cs{seq_set_split_aux_i:w} +% to trim spaces, and leaves its result as +% \cs{seq_set_split_aux_ii:w} \meta{trimmed item} +% \cs{seq_set_split_aux_end:}. This is then converted +% to the \pkg{l3seq} internal structure by another +% \texttt{x}-expansion. In the first step, we insert +% \cs{prg_do_nothing:} to avoid losing braces too early: +% that would cause space trimming to act within those +% lost braces. The second step is solely there to strip +% braces which are outermost after space trimming. +% \begin{macrocode} +\cs_new_protected_nopar:Npn \seq_set_split:Nnn + { \seq_set_split_aux:NNnn \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gset_split:Nnn + { \seq_set_split_aux:NNnn \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_set_split_aux:NNnn #1 #2 #3 #4 + { + \tl_if_empty:nTF {#3} + { #1 #2 { \tl_map_function:nN {#4} \seq_wrap_item:n } } + { + \tl_set:Nn \l_seq_tmpa_tl + { + \seq_set_split_aux_i:w \prg_do_nothing: + #4 + \seq_set_split_aux_end: + } + \tl_replace_all:Nnn \l_seq_tmpa_tl { #3 } + { + \seq_set_split_aux_end: + \seq_set_split_aux_i:w \prg_do_nothing: + } + \tl_set:Nx \l_seq_tmpa_tl { \l_seq_tmpa_tl } + #1 #2 { \l_seq_tmpa_tl } + } + } +\cs_new:Npn \seq_set_split_aux_i:w #1 \seq_set_split_aux_end: + { + \exp_not:N \seq_set_split_aux_ii:w + \exp_args:No \tl_trim_spaces:n {#1} + \exp_not:N \seq_set_split_aux_end: + } +\cs_new:Npn \seq_set_split_aux_ii:w #1 \seq_set_split_aux_end: + { \seq_wrap_item:n {#1} } +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} % % \begin{macro}{\seq_concat:NNN, \seq_concat:ccc} % \UnitTested @@ -980,6 +940,14 @@ % % \subsection{Modifying sequences} % +% \begin{macro}[aux]{\seq_wrap_item:n} +% This function converts its argument to a proper sequence item +% in an \texttt{x}-expansion context. +% \begin{macrocode} +\cs_new:Npn \seq_wrap_item:n #1 { \exp_not:n { \seq_item:n {#1} } } +% \end{macrocode} +% \end{macro} +% % \begin{variable}{\l_seq_remove_seq} % An internal sequence for the removal routines. % \begin{macrocode} @@ -1053,7 +1021,7 @@ \tl_if_eq:NNT \l_seq_tmpa_tl \l_seq_tmpb_tl { \use_none:nn } } - \exp_not:n { \seq_item:n {##1} } + \seq_wrap_item:n {##1} } \tl_set:Nn \l_seq_tmpa_tl {#3} #1 #2 {#2} @@ -1089,7 +1057,7 @@ % argument with the test sequence. If the two items are equal, the % mapping is terminated and \cs{prg_return_true:} is inserted. On the % other hand, if there is no match then the loop will break returning -% \cs{prg_return_false:}. In either case, \cs{seq_break_point:n} +% \cs{prg_return_false:}. In either case, \cs{prg_break_point:n} % ensures that the group ends before the logical value is returned. % Everything is inside a group so that \cs{seq_item:n} is preserved % in nested situations. @@ -1108,7 +1076,7 @@ } #1 \seq_break:n { \prg_return_false: } - \seq_break_point:n { \group_end: } + \prg_break_point:n { \group_end: } } \cs_new_nopar:Npn \seq_if_in_aux: { \seq_break:n { \prg_return_true: } } \cs_generate_variant:Nn \seq_if_in:NnT { NV , Nv , No , Nx } @@ -1134,7 +1102,7 @@ { \seq_if_empty_err_break:N #1 \exp_after:wN \seq_get_left_aux:NnwN #1 \q_stop #2 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected:Npn \seq_get_left_aux:NnwN \seq_item:n #1#2 \q_stop #3 { \tl_set:Nn #3 {#1} } @@ -1162,7 +1130,7 @@ { \seq_if_empty_err_break:N #2 \exp_after:wN \seq_pop_left_aux:NnwNNN #2 \q_stop #1#2#3 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected:Npn \seq_pop_left_aux:NnwNNN \seq_item:n #1#2 \q_stop #3#4#5 { @@ -1194,7 +1162,7 @@ { \seq_if_empty_err_break:N #1 \seq_get_right_aux:NN #1#2 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected_nopar:Npn \seq_get_right_aux:NN #1#2 { @@ -1246,11 +1214,11 @@ { \seq_if_empty_err_break:N #2 \seq_pop_right_aux_ii:NNN #1 #2 #3 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected_nopar:Npn \seq_pop_right_aux_ii:NNN #1#2#3 { - \seq_push_item_def:n { \exp_not:n { \seq_item:n {##1} } } + \seq_push_item_def:n { \seq_wrap_item:n {##1} } #1 #2 { \if_false: } \fi: \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn \exp_after:wN \use_none:n #2 @@ -1273,37 +1241,26 @@ % % \subsection{Mapping to sequences} % -% \begin{macro}[int]{\seq_break:} -% \begin{macro}[int]{\seq_break:n} -% To break a function, the special token \cs{seq_break_point:n} is -% used to find the end of the code. Any ending code is then inserted -% before the return value of \cs{seq_map_break:n} is inserted. -% \begin{macrocode} -\cs_new:Npn \seq_break: #1 \seq_break_point:n #2 {#2} -\cs_new:Npn \seq_break:n #1#2 \seq_break_point:n #3 { #3 #1 } -% \end{macrocode} -% \end{macro} -% \end{macro} -% % \begin{macro}{\seq_map_break:} % \UnitTested % \begin{macro}{\seq_map_break:n} % \UnitTested +% \begin{macro}[int]{\seq_break:} +% \begin{macro}[int]{\seq_break:n} +% To break a function, the special token \cs{prg_break_point:n} is +% used to find the end of the code. Any ending code is then inserted +% before the return value of \cs{seq_map_break:n} is inserted. % Semantically-logical copies of the break functions for use inside % mappings. % \begin{macrocode} -\cs_new_eq:NN \seq_map_break: \seq_break: -\cs_new_eq:NN \seq_map_break:n \seq_break:n +\cs_new_eq:NN \seq_break: \prg_map_break: +\cs_new_eq:NN \seq_break:n \prg_map_break:n +\cs_new_eq:NN \seq_map_break: \prg_map_break: +\cs_new_eq:NN \seq_map_break:n \prg_map_break:n % \end{macrocode} % \end{macro} % \end{macro} -% -% \begin{macro}[int]{\seq_break_point:n} -% Normally, the marker token will not be executed, but if it is then -% the end code is simply inserted. -% \begin{macrocode} -\cs_new_eq:NN \seq_break_point:n \use:n -% \end{macrocode} +% \end{macro} % \end{macro} % % \begin{macro}[int]{\seq_if_empty_err_break:N} @@ -1334,7 +1291,7 @@ { \exp_after:wN \seq_map_function_aux:NNn \exp_after:wN #2 #1 { ? \seq_map_break: } { } - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new:Npn \seq_map_function_aux:NNn #1#2#3 { @@ -1347,10 +1304,6 @@ % \end{macro} % \end{macro} % -% \begin{variable}{\g_seq_nesting_depth_int} -% A counter to keep track of nested functions: defined in \pkg{l3int}. -% \end{variable} -% % \begin{macro}[int]{\seq_push_item_def:n, \seq_push_item_def:x} % \begin{macro}[aux]{\seq_push_item_def_aux:} % \begin{macro}[int]{\seq_pop_item_def:} @@ -1370,15 +1323,15 @@ } \cs_new_protected:Npn \seq_push_item_def_aux: { - \cs_gset_eq:cN { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + \cs_gset_eq:cN { seq_item_ \int_use:N \g_prg_map_int :n } \seq_item:n - \int_gincr:N \g_seq_nesting_depth_int + \int_gincr:N \g_prg_map_int } \cs_new_protected_nopar:Npn \seq_pop_item_def: { - \int_gdecr:N \g_seq_nesting_depth_int + \int_gdecr:N \g_prg_map_int \cs_gset_eq:Nc \seq_item:n - { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + { seq_item_ \int_use:N \g_prg_map_int :n } } % \end{macrocode} % \end{macro} @@ -1395,7 +1348,7 @@ { \seq_push_item_def:n {#2} #1 - \seq_break_point:n { \seq_pop_item_def: } + \prg_break_point:n { \seq_pop_item_def: } } \cs_generate_variant:Nn \seq_map_inline:Nn { c } % \end{macrocode} @@ -1419,7 +1372,7 @@ \exp_not:n {#3} } #1 - \seq_break_point:n { \seq_pop_item_def: } + \prg_break_point:n { \seq_pop_item_def: } } \cs_generate_variant:Nn \seq_map_variable:NNn { Nc } \cs_generate_variant:Nn \seq_map_variable:NNn { c , cc } @@ -1488,53 +1441,20 @@ % % \subsection{Viewing sequences} % -% \begin{variable}{\l_seq_show_tl} -% Used to store the material for display. -% \begin{macrocode} -\tl_new:N \l_seq_show_tl -% \end{macrocode} -% \end{variable} -% % \begin{macro}{\seq_show:N, \seq_show:c} % \UnitTested -% \begin{macro}[aux]{\seq_show_aux:n} -% \begin{macro}[aux]{\seq_show_aux:w} -% The aim of the mapping here is to create a token list containing the -% formatted sequence. The very first item needs the new line and \verb*|> | -% removing, which is achieved using a \texttt{w}-type auxiliary. To avoid -% a low-level \TeX{} error if there is an empty sequence, a simple test is -% used to keep the output \enquote{clean}. +% Apply the general \cs{msg_aux_show:Nnx}. % \begin{macrocode} \cs_new_protected_nopar:Npn \seq_show:N #1 { - \seq_if_empty:NTF #1 - { - \iow_term:x { Sequence~\token_to_str:N #1~is~empty } - \tl_show:n { } - } - { - \iow_term:x - { - Sequence~\token_to_str:N #1~ - contains~the~items~(without~outer~braces): - } - \tl_set:Nx \l_seq_show_tl - { \seq_map_function:NN #1 \seq_show_aux:n } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \seq_show_aux:w \l_seq_show_tl } - } - } -\cs_new:Npn \seq_show_aux:n #1 - { - \iow_newline: > \c_space_tl \c_space_tl - \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + \msg_aux_show:Nnx + #1 + { seq } + { \seq_map_function:NN #1 \msg_aux_show:n } } -\cs_new:Npn \seq_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \seq_show:N { c } % \end{macrocode} % \end{macro} -% \end{macro} -% \end{macro} % % \subsection{Experimental functions} % @@ -1562,14 +1482,14 @@ \exp_after:wN \seq_get_left_aux:Nw #1 \q_stop #2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_get_right:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \seq_get_right_aux:NN #1#2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \cs_generate_variant:Nn \seq_get_left:NNT { c } \cs_generate_variant:Nn \seq_get_left:NNF { c } @@ -1592,28 +1512,28 @@ \seq_if_empty_break_return_false:N #1 \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_set:Nn #1#2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_gpop_left:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_gset:Nn #1#2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_pop_right:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \seq_pop_right_aux_ii:NNN \tl_set:Nx #1 #2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_gpop_right:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \seq_pop_right_aux_ii:NNN \tl_gset:Nx #1 #2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \cs_generate_variant:Nn \seq_pop_left:NNT { c } \cs_generate_variant:Nn \seq_pop_left:NNF { c } @@ -1657,7 +1577,7 @@ % \begin{macro}[aux]{\seq_item_aux:nnn} % The idea here is to find the offset of the item from the left, then use % a loop to grab the correct item. If the resulting offset is too large, -% then the stop code |{ ? \seq_break } { }| will be used by the auxiliary, +% then the stop code |{ ? \seq_break: } { }| will be used by the auxiliary, % terminating the loop and returning nothing at all. % \begin{macrocode} \cs_new_nopar:Npn \seq_item:Nn #1#2 @@ -1674,14 +1594,14 @@ #1 { ? \seq_break: } { } - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_nopar:Npn \seq_item_aux:nnn #1#2#3 { \use_none:n #2 \int_compare:nNnTF {#1} = \c_zero { \seq_break:n {#3} } - { \exp_args:Nf \seq_item_aux:nnn { #1 - 1 } } + { \exp_args:Nf \seq_item_aux:nnn { \int_eval:n { #1 - 1 } } } } \cs_generate_variant:Nn \seq_item:Nn { c } % \end{macrocode} @@ -1720,7 +1640,7 @@ \exp_after:wN #1 #2 { ? \seq_break: } { } - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_nopar:Npn \seq_mapthread_function_aux:NN #1#2 { @@ -1756,7 +1676,6 @@ % \seq_gset_from_clist:Nc, \seq_gset_from_clist:cc, % \seq_gset_from_clist:Nn, \seq_gset_from_clist:cn % } -% \begin{macro}[aux]{\seq_wrap_item:n} % Setting a sequence from a comma-separated list is done using a simple % mapping. % \begin{macrocode} @@ -1780,7 +1699,6 @@ \tl_gset:Nx #1 { \clist_map_function:nN {#2} \seq_wrap_item:n } } -\cs_new:Npn \seq_wrap_item:n #1 { \exp_not:n { \seq_item:n {#1} } } \cs_generate_variant:Nn \seq_set_from_clist:NN { Nc } \cs_generate_variant:Nn \seq_set_from_clist:NN { c , cc } \cs_generate_variant:Nn \seq_set_from_clist:Nn { c } @@ -1790,92 +1708,62 @@ % \end{macrocode} % \end{macro} % \end{macro} -% \end{macro} % -% \begin{macro}{\seq_set_reverse:N,\seq_gset_reverse:N} -% Define \cs{seq_item:n} to place its argument after a marker, -% \cs{prg_do_nothing:}. Then x-expand the sequence. +% \begin{macro} +% {\seq_reverse:N, \seq_reverse:c, \seq_greverse:N, \seq_greverse:c} +% \begin{macro}[aux]{\seq_reverse_aux:NN} +% \begin{macro}[aux]{\seq_reverse_aux_item:nwn} +% Previously, \cs{seq_reverse:N} was coded by collecting the items +% in reverse order after an \cs{exp_stop_f:} marker. +% \begin{verbatim} +% \cs_new_protected:Npn \seq_reverse:N #1 +% { +% \cs_set_eq:NN \seq_item:n \seq_reverse_aux_item:nw +% \tl_set:Nf #2 { #2 \exp_stop_f: } +% } +% \cs_new:Npn \seq_reverse_aux_item:nw #1 #2 \exp_stop_f: +% { +% #2 \exp_stop_f: +% \seq_item:n {#1} +% } +% \end{verbatim} +% At first, this seems optimal, since we can forget about each item +% as soon as it is placed after \cs{exp_stop_f:}. Unfortunately, +% \TeX{}'s usual tail recursion does not take place in this case: +% since the following \cs{seq_reverse_aux_item:nw} only reads +% tokens until \cs{exp_stop_f:}, and never reads the +% |\seq_item:n {#1}| left by the previous call, \TeX{} cannot +% remove that previous call from the stack, and in particular +% must retain the various macro paramters in memory, until the +% end of the replacement text is reached. The stack is thus +% only flushed after all the \cs{seq_reverse_aux_item:nw} are +% expanded. Keeping track of the arguments of all those calls +% uses up a memory quadratic in the length of the sequence. +% \TeX{} can then not cope with more than a few thousand items. +% +% Instead, we collect the items in the argument +% of \cs{exp_not:n}. The previous calls are cleanly removed +% from the stack, and the memory consumption becomes linear. % \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_tmp:w - { \msg_expandable_error:n { There~is~a~bug~in~LaTeX3! } } -\cs_new_protected_nopar:Npn \seq_set_reverse:N +\cs_new_protected_nopar:Npn \seq_tmp:w { } +\cs_new_protected_nopar:Npn \seq_reverse:N { \seq_reverse_aux:NN \tl_set:Nx } -\cs_new_protected_nopar:Npn \seq_gset_reverse:N +\cs_new_protected_nopar:Npn \seq_greverse:N { \seq_reverse_aux:NN \tl_gset:Nx } \cs_new_protected_nopar:Npn \seq_reverse_aux:NN #1 #2 { \cs_set_eq:NN \seq_tmp:w \seq_item:n - \cs_set_eq:NN \seq_item:n \seq_reverse_aux_item:w - #1 #2 { #2 \prg_do_nothing: } + \cs_set_eq:NN \seq_item:n \seq_reverse_aux_item:nwn + #1 #2 { #2 \exp_not:n { } } \cs_set_eq:NN \seq_item:n \seq_tmp:w } -\cs_new:Npn \seq_reverse_aux_item:w #1 #2 \prg_do_nothing: +\cs_new:Npn \seq_reverse_aux_item:nwn #1 #2 \exp_not:n #3 { #2 - \prg_do_nothing: - \exp_not:n { \seq_item:n {#1} } + \exp_not:n { \seq_item:n {#1} #3 } } -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\seq_set_split:Nnn,\seq_gset_split:Nnn} -% \begin{macro}[aux]{\seq_set_split_aux:NNnn} -% \begin{macro}[aux] -% { -% \seq_set_split_aux_i:w, \seq_set_split_aux_ii:w, -% \seq_set_split_aux_end: -% } -% The goal is to split a given token list at a marker, -% strip spaces from each item, and remove one set of -% outer braces if after removing leading and trailing -% spaces the item is enclosed within braces. After -% \cs{tl_replace_all:Nnn}, the token list \cs{l_seq_tmpa_tl} -% is a repetition of the pattern -% \cs{seq_set_split_aux_i:w} \cs{prg_do_nothing:} -% \meta{item with spaces} \cs{seq_set_split_aux_end:}. -% Then, \texttt{x}-expansion causes \cs{seq_set_split_aux_i:w} -% to trim spaces, and leaves its result as -% \cs{seq_set_split_aux_ii:w} \meta{trimmed item} -% \cs{seq_set_split_aux_end:}. This is then converted -% to the \pkg{l3seq} internal structure by another -% \texttt{x}-expansion. In the first step, we insert -% \cs{prg_do_nothing:} to avoid losing braces too early: -% that would cause space trimming to act within those -% lost braces. The second step is solely there to strip -% braces which are outermost after space trimming. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \seq_set_split:Nnn - { \seq_set_split_aux:NNnn \tl_set:Nx } -\cs_new_protected_nopar:Npn \seq_gset_split:Nnn - { \seq_set_split_aux:NNnn \tl_gset:Nx } -\cs_new_protected_nopar:Npn \seq_set_split_aux:NNnn #1 #2 #3 #4 - { - \tl_if_empty:nTF {#4} - { #1 #2 { } } - { - \tl_set:Nn \l_seq_tmpa_tl - { - \seq_set_split_aux_i:w \prg_do_nothing: - #4 - \seq_set_split_aux_end: - } - \tl_replace_all:Nnn \l_seq_tmpa_tl { #3 } - { - \seq_set_split_aux_end: - \seq_set_split_aux_i:w \prg_do_nothing: - } - \tl_set:Nx \l_seq_tmpa_tl { \l_seq_tmpa_tl } - #1 #2 { \l_seq_tmpa_tl } - } - } -\cs_new:Npn \seq_set_split_aux_i:w #1 \seq_set_split_aux_end: - { - \exp_not:N \seq_set_split_aux_ii:w - \exp_args:No \tl_trim_spaces:n {#1} - \exp_not:N \seq_set_split_aux_end: - } -\cs_new:Npn \seq_set_split_aux_ii:w #1 \seq_set_split_aux_end: - { \exp_not:n { \seq_item:n {#1} } } +\cs_generate_variant:Nn \seq_reverse:N { c } +\cs_generate_variant:Nn \seq_greverse:N { c } % \end{macrocode} % \end{macro} % \end{macro} diff --git a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx index dec6cbac2d1..3c5f7951b21 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3skip.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 2959 2011-11-14 21:47:18Z joseph $ +\GetIdInfo$Id: l3skip.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental dimensions and skips} %</driver|package> %<*driver> @@ -88,131 +88,72 @@ % will initially be equal to $0$\,pt. % \end{function} % -% \begin{function}{\dim_zero:N, \dim_zero:c} +% \begin{function}{\dim_zero:N, \dim_zero:c, \dim_gzero:N, \dim_gzero:c} % \begin{syntax} % \cs{dim_zero:N} \meta{dimension} % \end{syntax} -% Sets \meta{dimension} to $0$\,pt within the scope of the current -% \TeX{} group. -% \end{function} -% -% \begin{function}{\dim_gzero:N, \dim_gzero:c} -% \begin{syntax} -% \cs{dim_gzero:N} \meta{dimension} -% \end{syntax} -% Sets \meta{dimension} to $0$\,pt globally, \emph{i.e.}~not -% restricted by the current \TeX{} group level. +% Sets \meta{dimension} to $0$\,pt. % \end{function} % % \section{Setting \texttt{dim} variables} % -% \begin{function}[updated = 2011-10-22]{\dim_add:Nn, \dim_add:cn} +% \begin{function}[updated = 2011-10-22] +% {\dim_add:Nn, \dim_add:cn, \dim_gadd:Nn, \dim_gadd:cn} % \begin{syntax} % \cs{dim_add:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} % Adds the result of the \meta{dimension expression} to the current -% content of the \meta{dimension}. This assignment is local. -% \end{function} -% -% \begin{function}{\dim_gadd:Nn, \dim_gadd:cn} -% \begin{syntax} -% \cs{dim_gadd:Nn} \meta{dimension} \Arg{dimension expression} -% \end{syntax} -% Adds the result of the \meta{dimension expression} to the -% current content of the \meta{dimension}. This assignment is global. +% content of the \meta{dimension}. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\dim_set:Nn, \dim_set:cn} +% \begin{function}[updated = 2011-10-22] +% {\dim_set:Nn, \dim_set:cn, \dim_gset:Nn, \dim_gset:cn} % \begin{syntax} % \cs{dim_set:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} % Sets \meta{dimension} to the value of \meta{dimension expression}, which -% must evaluate to a length with units. This assignment is -% restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}{\dim_gset:Nn, \dim_gset:cn} -% \begin{syntax} -% \cs{dim_gset:Nn} \meta{dimension} \Arg{dimension expression} -% \end{syntax} -% Sets \meta{dimension} to the value of \meta{dimension expression}, which -% must evaluate to a length with units and may include a rubber -% component (for example |1 cm plus 0.5 cm|. This assignment is -% global and is not limited to the current \TeX{} group level. +% must evaluate to a length with units. % \end{function} % % \begin{function} -% {\dim_set_eq:NN, \dim_set_eq:cN, \dim_set_eq:Nc, \dim_set_eq:cc} +% { +% \dim_set_eq:NN, \dim_set_eq:cN, \dim_set_eq:Nc, \dim_set_eq:cc, +% \dim_gset_eq:NN, \dim_gset_eq:cN, \dim_gset_eq:Nc, \dim_gset_eq:cc +% } % \begin{syntax} % \cs{dim_set_eq:NN} \meta{dimension1} \meta{dimension2} % \end{syntax} % Sets the content of \meta{dimension1} equal to that of -% \meta{dimension2}. This assignment is restricted to the current -% \TeX{} group level. +% \meta{dimension2}. % \end{function} % -% \begin{function} -% {\dim_gset_eq:NN, \dim_gset_eq:cN, \dim_gset_eq:Nc, \dim_gset_eq:cc} -% \begin{syntax} -% \cs{dim_gset_eq:NN} \meta{dimension1} \meta{dimension2} -% \end{syntax} -% Sets the content of \meta{dimension1} equal to that of \meta{dimension2}. -% This assignment is global and so is not limited by the current -% \TeX{} group level. -% \end{function} -% -% \begin{function}[updated = 2011-10-22]{\dim_set_max:Nn, \dim_set_max:cn} +% \begin{function}[updated = 2011-10-22] +% {\dim_set_max:Nn, \dim_set_max:cn, \dim_gset_max:Nn, \dim_gset_max:cn} % \begin{syntax} % \cs{dim_set_max:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} % Compares the current value of the \meta{dimension} with that of the % \meta{dimension expression}, and sets the \meta{dimension} to the -% larger of these two value. This assignment is local to the current -% \TeX{} group. +% larger of these two value. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\dim_gset_max:Nn, \dim_gset_max:cn} -% \begin{syntax} -% \cs{dim_gset_max:Nn} \meta{dimension} \Arg{dimension expression} -% \end{syntax} -% Compares the current value of the \meta{dimension} with that of the -% \meta{dimension expression}, and sets the \meta{dimension} to the -% larger of these two value. This assignment is global. -% \end{function} -% -% \begin{function}[updated = 2011-10-22]{\dim_set_min:Nn, \dim_set_min:cn} +% \begin{function}[updated = 2011-10-22] +% {\dim_set_min:Nn, \dim_set_min:cn, \dim_gset_min:Nn, \dim_gset_min:cn} % \begin{syntax} % \cs{dim_set_min:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} % Compares the current value of the \meta{dimension} with that of the % \meta{dimension expression}, and sets the \meta{dimension} to the -% smaller of these two value. This assignment is local to the current -% \TeX{} group. -% \end{function} -% -% \begin{function}[updated = 2011-10-22]{\dim_gset_min:Nn, \dim_gset_min:cn} -% \begin{syntax} -% \cs{dim_gset_min:Nn} \meta{dimension} \Arg{dimension expression} -% \end{syntax} -% Compares the current value of the \meta{dimension} with that of the -% \meta{dimension expression}, and sets the \meta{dimension} to the -% smaller of these two value. This assignment is global. +% smaller of these two value. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\dim_sub:Nn, \dim_sub:cn} +% \begin{function}[updated = 2011-10-22] +% {\dim_sub:Nn, \dim_sub:cn, \dim_gsub:Nn, \dim_gsub:cn} % \begin{syntax} % \cs{dim_sub:Nn} \meta{dimension} \Arg{dimension expression} % \end{syntax} % Subtracts the result of the \meta{dimension expression} to the -% current content of the \meta{dimension}. This assignment is local. -% \end{function} -% -% \begin{function}{\dim_gsub:Nn, \dim_gsub:cn} -% \begin{syntax} -% \cs{dim_gsub:Nn} \meta{dimension} \Arg{dimension expression} -% \end{syntax} -% Subtracts the result of the \meta{dimension expression} to the -% current content of the \meta{dimension}. This assignment is global. +% current content of the \meta{dimension}. % \end{function} % % \section{Utilities for dimension calculations} @@ -428,6 +369,14 @@ % Displays the value of the \meta{dimension} on the terminal. % \end{function} % +% \begin{function}[added = 2011-11-22]{\dim_show:n} +% \begin{syntax} +% \cs{dim_show:n} \meta{dimension expression} +% \end{syntax} +% Displays the result of evaluating the \meta{dimension expression} +% on the terminal. +% \end{function} +% % \section{Constant dimensions} % % \begin{variable}{\c_max_dim} @@ -466,94 +415,53 @@ % will initially be equal to $0$\,pt. % \end{function} % -% \begin{function}{\skip_zero:N, \skip_zero:c} +% \begin{function}{\skip_zero:N, \skip_zero:c, \skip_gzero:N, \skip_gzero:c} % \begin{syntax} % \cs{skip_zero:N} \meta{skip} % \end{syntax} -% Sets \meta{skip} to $0$\,pt within the scope of the current -% \TeX{} group. -% \end{function} -% -% \begin{function}{\skip_gzero:N, \skip_gzero:c} -% \begin{syntax} -% \cs{skip_gzero:N} \meta{skip} -% \end{syntax} -% Sets \meta{skip} to $0$\,pt globally, \emph{i.e.}~not -% restricted by the current \TeX{} group level. +% Sets \meta{skip} to $0$\,pt. % \end{function} + % % \section{Setting \texttt{skip} variables} % -% \begin{function}[updated = 2011-10-22]{\skip_add:Nn, \skip_add:cn} +% \begin{function}[updated = 2011-10-22] +% {\skip_add:Nn, \skip_add:cn, \skip_gadd:Nn, \skip_gadd:cn} % \begin{syntax} % \cs{skip_add:Nn} \meta{skip} \Arg{skip expression} % \end{syntax} % Adds the result of the \meta{skip expression} to the current -% content of the \meta{skip}. This assignment is local. -% \end{function} -% -% \begin{function}{\skip_gadd:Nn, \skip_gadd:cn} -% \begin{syntax} -% \cs{skip_gadd:Nn} \meta{skip} \Arg{skip expression} -% \end{syntax} -% Adds the result of the \meta{skip expression} to the -% current content of the \meta{skip}. This assignment is global. +% content of the \meta{skip}. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\skip_set:Nn, \skip_set:cn} +% \begin{function}[updated = 2011-10-22] +% {\skip_set:Nn, \skip_set:cn, \skip_gset:Nn, \skip_gset:cn} % \begin{syntax} % \cs{skip_set:Nn} \meta{skip} \Arg{skip expression} % \end{syntax} % Sets \meta{skip} to the value of \meta{skip expression}, which % must evaluate to a length with units and may include a rubber -% component (for example |1 cm plus 0.5 cm|. This assignment is -% restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}{\skip_gset:Nn, \skip_gset:cn} -% \begin{syntax} -% \cs{skip_gset:Nn} \meta{skip} \Arg{skip expression} -% \end{syntax} -% Sets \meta{skip} to the value of \meta{skip expression}, which -% must evaluate to a length with units and may include a rubber -% component (for example |1 cm plus 0.5 cm|. This assignment is -% global and is not limited to the current \TeX{} group level. +% component (for example |1 cm plus 0.5 cm|. % \end{function} % % \begin{function} -% {\skip_set_eq:NN, \skip_set_eq:cN, \skip_set_eq:Nc, \skip_set_eq:cc} +% { +% \skip_set_eq:NN, \skip_set_eq:cN, \skip_set_eq:Nc, \skip_set_eq:cc, +% \skip_gset_eq:NN, \skip_gset_eq:cN, \skip_gset_eq:Nc, \skip_gset_eq:cc +% } % \begin{syntax} % \cs{skip_set_eq:NN} \meta{skip1} \meta{skip2} % \end{syntax} -% Sets the content of \meta{skip1} equal to that of -% \meta{skip2}. This assignment is restricted to the current -% \TeX{} group level. -% \end{function} -% -% \begin{function} -% {\skip_gset_eq:NN, \skip_gset_eq:cN, \skip_gset_eq:Nc, \skip_gset_eq:cc} -% \begin{syntax} -% \cs{skip_gset_eq:NN} \meta{skip1} \meta{skip2} -% \end{syntax} % Sets the content of \meta{skip1} equal to that of \meta{skip2}. -% This assignment is global and so is not limited by the current -% \TeX{} group level. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\skip_sub:Nn, \skip_sub:cn} +% \begin{function}[updated = 2011-10-22] +% {\skip_sub:Nn, \skip_sub:cn, \skip_gsub:Nn, \skip_gsub:cn} % \begin{syntax} % \cs{skip_sub:Nn} \meta{skip} \Arg{skip expression} % \end{syntax} % Subtracts the result of the \meta{skip expression} to the -% current content of the \meta{skip}. This assignment is local. -% \end{function} -% -% \begin{function}{\skip_gsub:Nn, \skip_gsub:cn} -% \begin{syntax} -% \cs{skip_gsub:Nn} \meta{skip} \Arg{skip expression} -% \end{syntax} -% Subtracts the result of the \meta{skip expression} to the -% current content of the \meta{skip}. This assignment is global. +% current content of the \meta{skip}. % \end{function} % % \section{Skip expression conditionals} @@ -622,6 +530,14 @@ % Displays the value of the \meta{skip} on the terminal. % \end{function} % +% \begin{function}[added = 2011-11-22]{\skip_show:n} +% \begin{syntax} +% \cs{skip_show:n} \meta{skip expression} +% \end{syntax} +% Displays the result of evaluating the \meta{skip expression} +% on the terminal. +% \end{function} +% % \section{Constant skips} % % \begin{variable}{\c_max_skip} @@ -660,100 +576,56 @@ % will initially be equal to $0$\,mu. % \end{function} % -% \begin{function}{\muskip_zero:N, \muskip_zero:c} +% \begin{function} +% {\muskip_zero:N, \muskip_zero:c, \muskip_gzero:N, \muskip_gzero:c} % \begin{syntax} % \cs{skip_zero:N} \meta{muskip} % \end{syntax} -% Sets \meta{muskip} to $0$\,mu within the scope of the current -% \TeX{} group. -% \end{function} -% -% \begin{function}{\muskip_gzero:N, \muskip_gzero:c} -% \begin{syntax} -% \cs{muskip_gzero:N} \meta{muskip} -% \end{syntax} -% Sets \meta{muskip} to $0$\,mu globally, \emph{i.e.}~not -% restricted by the current \TeX{} group level. +% Sets \meta{muskip} to $0$\,mu. % \end{function} % % \section{Setting \texttt{muskip} variables} % -% \begin{function}[updated = 2011-10-22]{\muskip_add:Nn, \muskip_add:cn} +% \begin{function}[updated = 2011-10-22] +% {\muskip_add:Nn, \muskip_add:cn, \muskip_gadd:Nn, \muskip_gadd:cn} % \begin{syntax} % \cs{muskip_add:Nn} \meta{muskip} \Arg{muskip expression} % \end{syntax} % Adds the result of the \meta{muskip expression} to the current -% content of the \meta{muskip}. This assignment is local. -% \end{function} -% -% \begin{function}{\muskip_gadd:Nn, \muskip_gadd:cn} -% \begin{syntax} -% \cs{muskip_gadd:Nn} \meta{muskip} \Arg{muskip expression} -% \end{syntax} -% Adds the result of the \meta{muskip expression} to the -% current content of the \meta{muskip}. This assignment is global. +% content of the \meta{muskip}. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\muskip_set:Nn, \muskip_set:cn} +% \begin{function}[updated = 2011-10-22] +% {\muskip_set:Nn, \muskip_set:cn, \muskip_gset:Nn, \muskip_gset:cn} % \begin{syntax} % \cs{muskip_set:Nn} \meta{muskip} \Arg{muskip expression} % \end{syntax} % Sets \meta{muskip} to the value of \meta{muskip expression}, which % must evaluate to a math length with units and may include a rubber -% component (for example |1 mu plus 0.5 mu|. This assignment is -% restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}{\muskip_gset:Nn, \muskip_gset:cn} -% \begin{syntax} -% \cs{muskip_gset:Nn} \meta{muskip} \Arg{muskip expression} -% \end{syntax} -% Sets \meta{muskip} to the value of \meta{muskip expression}, which -% must evaluate to a math length with units and may include a rubber -% component (for example |1 mu plus 0.5 mu|. This assignment is -% global and is not limited to the current \TeX{} group level. +% component (for example |1 mu plus 0.5 mu|. % \end{function} % % \begin{function} % { -% \muskip_set_eq:NN, \muskip_set_eq:cN, -% \muskip_set_eq:Nc, \muskip_set_eq:cc +% \muskip_set_eq:NN, \muskip_set_eq:cN, +% \muskip_set_eq:Nc, \muskip_set_eq:cc, +% \muskip_gset_eq:NN, \muskip_gset_eq:cN, +% \muskip_gset_eq:Nc, \muskip_gset_eq:cc % } % \begin{syntax} % \cs{muskip_set_eq:NN} \meta{muskip1} \meta{muskip2} % \end{syntax} % Sets the content of \meta{muskip1} equal to that of -% \meta{muskip2}. This assignment is restricted to the current -% \TeX{} group level. -% \end{function} -% -% \begin{function} -% { -% \muskip_gset_eq:NN, \muskip_gset_eq:cN, -% \muskip_gset_eq:Nc, \muskip_gset_eq:cc -% } -% \begin{syntax} -% \cs{muskip_gset_eq:NN} \meta{muskip1} \meta{muskip2} -% \end{syntax} -% Sets the content of \meta{muskip1} equal to that of \meta{muskip2}. -% This assignment is global and so is not limited by the current -% \TeX{} group level. +% \meta{muskip2}. % \end{function} % -% \begin{function}[updated = 2011-10-22]{\muskip_sub:Nn, \muskip_sub:cn} +% \begin{function}[updated = 2011-10-22] +% {\muskip_sub:Nn, \muskip_sub:cn, \muskip_gsub:Nn, \muskip_gsub:cn} % \begin{syntax} % \cs{muskip_sub:Nn} \meta{muskip} \Arg{muskip expression} % \end{syntax} % Subtracts the result of the \meta{muskip expression} to the -% current content of the \meta{skip}. This assignment is local. -% \end{function} -% -% \begin{function}{\muskip_gsub:Nn, \muskip_gsub:cn} -% \begin{syntax} -% \cs{muskip_gsub:Nn} \meta{muskip} \Arg{muskip expression} -% \end{syntax} -% Subtracts the result of the \meta{muskip expression} to the -% current content of the \meta{muskip}. This assignment is global. +% current content of the \meta{skip}. % \end{function} % % \section{Using \texttt{muskip} expressions and variables} @@ -822,6 +694,14 @@ % Displays the value of the \meta{muskip} on the terminal. % \end{function} % +% \begin{function}[added = 2011-11-22]{\muskip_show:n} +% \begin{syntax} +% \cs{muskip_show:n} \meta{muskip expression} +% \end{syntax} +% Displays the result of evaluating the \meta{muskip expression} +% on the terminal. +% \end{function} +% % \section{Internal functions} % % \begin{function}{\if_dim:w} @@ -1339,6 +1219,14 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\dim_show:n} +% Diagnostics. +% \begin{macrocode} +\cs_new_protected:Npn \dim_show:n #1 + { \tex_showthe:D \dim_eval:w #1 \dim_eval_end: } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant dimensions} % % \begin{variable}{\c_zero_dim} @@ -1542,6 +1430,14 @@ % \end{macrocode} % \end{macro} % +% \begin{macro}{\skip_show:n} +% Diagnostics. +% \begin{macrocode} +\cs_new_protected:Npn \skip_show:n #1 + { \tex_showthe:D \etex_glueexpr:D #1 \scan_stop: } +% \end{macrocode} +% \end{macro} +% % \subsection{Constant skips} % % \begin{macro}{\c_zero_skip} @@ -1684,7 +1580,15 @@ \cs_new_eq:NN \muskip_show:N \kernel_register_show:N \cs_generate_variant:Nn \muskip_show:N { c } % \end{macrocode} -% \end{macro} +% \end{macro} +% +% \begin{macro}{\muskip_show:n} +% Diagnostics. +% \begin{macrocode} +\cs_new_protected:Npn \muskip_show:n #1 + { \tex_showthe:D \etex_muexpr:D #1 \scan_stop: } +% \end{macrocode} +% \end{macro} % % \subsection{Experimental skip functions} % diff --git a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx index 59ca4930274..1b029fc3611 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3tl.dtx @@ -35,7 +35,7 @@ % %<*driver|package> \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2929 2011-10-22 13:00:20Z bruno $ +\GetIdInfo$Id: l3tl.dtx 3034 2011-12-07 11:40:25Z bruno $ {L3 Experimental token lists} %</driver|package> %<*driver> @@ -124,7 +124,7 @@ % \meta{token list}. % \end{function} % -% \begin{function}{\tl_clear:N, \tl_clear:c} +% \begin{function}{\tl_clear:N, \tl_clear:c, \tl_gclear:N, \tl_gclear:c} % \begin{syntax} % \cs{tl_clear:N} \meta{tl~var} % \end{syntax} @@ -132,52 +132,26 @@ % the current \TeX{} group. % \end{function} % -% \begin{function}{\tl_gclear:N, \tl_gclear:c} -% \begin{syntax} -% \cs{tl_gclear:N} \meta{tl~var} -% \end{syntax} -% Clears all entries from the \meta{tl~var} globally. -% \end{function} -% -% \begin{function}{\tl_clear_new:N, \tl_clear_new:c} +% \begin{function} +% {\tl_clear_new:N, \tl_clear_new:c, \tl_gclear_new:N, \tl_gclear_new:c} % \begin{syntax} % \cs{tl_clear_new:N} \meta{tl~var} % \end{syntax} -% If the \meta{tl~var} already exists, clears it within the scope -% of the current \TeX{} group. If the \meta{tl~var} is not defined, -% it will be created (using \cs{tl_new:N}). Thus the sequence is -% guaranteed to be available and clear within the current \TeX{} -% group. The \meta{tl~var} will exist globally, but the content -% outside of the current \TeX{} group is not specified. -% \end{function} -% -% \begin{function}{\tl_gclear_new:N, \tl_gclear_new:c} -% \begin{syntax} -% \cs{tl_gclear_new:N} \meta{tl~var} -% \end{syntax} -% If the \meta{tl~var} already exists, clears it globally. If the -% \meta{tl~var} is not defined, it will be created (using -% \cs{tl_new:N}). Thus the sequence is guaranteed to be available -% and globally clear. -% \end{function} -% -% \begin{function}{\tl_set_eq:NN, \tl_set_eq:cN, \tl_set_eq:Nc, \tl_set_eq:cc} -% \begin{syntax} -% \cs{tl_set_eq:NN} \meta{tl~var1} \meta{tl~var2} -% \end{syntax} -% Sets the content of \meta{tl~var1} equal to that of -% \meta{tl~var2}. This assignment is restricted to the current -% \TeX{} group level. +% Ensures that the \meta{tl~var} exists globally by applying +% \cs{tl_new:N} if necessary, then applies \cs{tl_(g)clear:N} to leave +% the \meta{tl~var} empty. % \end{function} % % \begin{function} -% {\tl_gset_eq:NN, \tl_gset_eq:cN, \tl_gset_eq:Nc, \tl_gset_eq:cc} +% { +% \tl_set_eq:NN, \tl_set_eq:cN, \tl_set_eq:Nc, \tl_set_eq:cc, +% \tl_gset_eq:NN, \tl_gset_eq:cN, \tl_gset_eq:Nc, \tl_gset_eq:cc +% } % \begin{syntax} -% \cs{tl_gset_eq:NN} \meta{tl~var1} \meta{tl~var2} +% \cs{tl_set_eq:NN} \meta{tl~var1} \meta{tl~var2} % \end{syntax} % Sets the content of \meta{tl~var1} equal to that of -% \meta{tl~var2}. This assignment is global and so is not -% limited by the current \TeX{} group level. +% \meta{tl~var2}. % \end{function} % % \section{Adding data to token list variables} @@ -185,113 +159,71 @@ % \begin{function} % { % \tl_set:Nn, \tl_set:NV, \tl_set:Nv, \tl_set:No, \tl_set:Nf, \tl_set:Nx, -% \tl_set:cn, \tl_set:NV, \tl_set:Nv, \tl_set:co, \tl_set:cf, \tl_set:cx -% } -% \begin{syntax} -% \cs{tl_set:Nn} \meta{tl~var} \Arg{tokens} -% \end{syntax} -% Sets \meta{tl~var} to contain \meta{tokens}, -% removing any previous content from the variable. This assignment -% is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function} -% { +% \tl_set:cn, \tl_set:NV, \tl_set:Nv, \tl_set:co, \tl_set:cf, \tl_set:cx, % \tl_gset:Nn, \tl_gset:NV, \tl_gset:Nv, % \tl_gset:No, \tl_gset:Nf, \tl_gset:Nx, % \tl_gset:cn, \tl_gset:cV, \tl_gset:cv, % \tl_gset:co, \tl_gset:cf, \tl_gset:cx % } -% \begin{syntax} -% \cs{tl_gset:Nn} \meta{tl~var} \Arg{tokens} -% \end{syntax} -% Sets \meta{tl~var} to contain \meta{tokens}, -% removing any previous content from the variable. This assignment -% is global and is not limited to the current \TeX{} group level. -% \end{function} -% -% \begin{function} -% { -% \tl_put_left:Nn, \tl_put_left:NV, \tl_put_left:No, \tl_put_left:Nx, -% \tl_put_left:cn, \tl_put_left:cV, \tl_put_left:co, \tl_put_left:cx -% } % \begin{syntax} -% \cs{tl_put_left:Nn} \meta{tl~var} \Arg{tokens} +% \cs{tl_set:Nn} \meta{tl~var} \Arg{tokens} % \end{syntax} -% Appends \meta{tokens} to the left side of the current content of -% \meta{tl~var}. This modification is restricted to the -% current \TeX{} group level. +% Sets \meta{tl~var} to contain \meta{tokens}, +% removing any previous content from the variable. % \end{function} % % \begin{function} % { +% \tl_put_left:Nn, \tl_put_left:NV, \tl_put_left:No, \tl_put_left:Nx, +% \tl_put_left:cn, \tl_put_left:cV, \tl_put_left:co, \tl_put_left:cx, % \tl_gput_left:Nn, \tl_gput_left:NV, \tl_gput_left:No, \tl_gput_left:Nx, % \tl_gput_left:cn, \tl_gput_left:cV, \tl_gput_left:co, \tl_gput_left:cx + % } % \begin{syntax} -% \cs{tl_gput_left:Nn} \meta{tl~var} \Arg{tokens} +% \cs{tl_put_left:Nn} \meta{tl~var} \Arg{tokens} % \end{syntax} -% Globally appends \meta{tokens} to the left side of the current -% content of \meta{tl~var}. This modification is not -% limited by \TeX{} grouping. +% Appends \meta{tokens} to the left side of the current content of +% \meta{tl~var}. % \end{function} % % \begin{function} % { % \tl_put_right:Nn, \tl_put_right:NV, \tl_put_right:No, \tl_put_right:Nx, -% \tl_put_right:cn, \tl_put_right:cV, \tl_put_right:co, \tl_put_right:cx -% } -% \begin{syntax} -% \cs{tl_put_right:Nn} \meta{tl~var} \Arg{tokens} -% \end{syntax} -% Appends \meta{tokens} to the right side of the current content of -% \meta{tl~var}. This modification is restricted to the -% current \TeX{} group level. -% \end{function} -% -% \begin{function} -% { +% \tl_put_right:cn, \tl_put_right:cV, \tl_put_right:co, \tl_put_right:cx, % \tl_gput_right:Nn, \tl_gput_right:NV, \tl_gput_right:No, % \tl_gput_right:Nx, % \tl_gput_right:cn, \tl_gput_right:cV, \tl_gput_right:co, % \tl_gput_right:cx % } % \begin{syntax} -% \cs{tl_gput_right:Nn} \meta{tl~var} \Arg{tokens} +% \cs{tl_put_right:Nn} \meta{tl~var} \Arg{tokens} % \end{syntax} -% Globally appends \meta{tokens} to the right side of the current -% content of \meta{tl~var}. This modification is not -% limited by \TeX{} grouping. +% Appends \meta{tokens} to the right side of the current content of +% \meta{tl~var}. % \end{function} % % \section{Modifying token list variables} % % \begin{function}[updated = 2011-08-11] -% {\tl_replace_once:Nnn, \tl_replace_once:cnn} +% { +% \tl_replace_once:Nnn, \tl_replace_once:cnn, +% \tl_greplace_once:Nnn, \tl_greplace_once:cnn +% } % \begin{syntax} % \cs{tl_replace_once:Nnn} \meta{tl~var} \Arg{old tokens} \Arg{new tokens} % \end{syntax} % Replaces the first (leftmost) occurrence of \meta{old tokens} in the % \meta{tl~var} with \meta{new tokens}. \meta{Old tokens} % cannot contain |{|, |}| or |#| -% (assuming normal \TeX{} category codes). The assignment is -% restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}[updated = 2011-08-11] -% {\tl_greplace_once:Nnn, \tl_greplace_once:cnn} -% \begin{syntax} -% \cs{tl_greplace_once:Nnn} \meta{tl~var} \Arg{old tokens} \Arg{new tokens} -% \end{syntax} -% Replaces the first (leftmost) occurrence of \meta{old tokens} in the -% \meta{tl~var} with \meta{new tokens}. \meta{Old tokens} -% cannot contain |{|, |}| or |#| -% (assuming normal \TeX{} category codes). The assignment is -% applied globally. +% (assuming normal \TeX{} category codes). % \end{function} % % \begin{function}[updated = 2011-08-11] -% {\tl_replace_all:Nnn, \tl_replace_all:cnn} +% { +% \tl_replace_all:Nnn, \tl_replace_all:cnn, +% \tl_greplace_all:Nnn, \tl_greplace_all:cnn +% } % \begin{syntax} % \cs{tl_replace_all:Nnn} \meta{tl~var} \Arg{old tokens} \Arg{new tokens} % \end{syntax} @@ -306,43 +238,23 @@ % \end{function} % % \begin{function}[updated = 2011-08-11] -% {\tl_greplace_all:Nnn, \tl_greplace_all:cnn} -% \begin{syntax} -% \cs{tl_greplace_all:Nnn} \meta{tl~var} \Arg{old tokens} \Arg{new tokens} -% \end{syntax} -% Replaces all occurrences of \meta{old tokens} in the -% \meta{tl~var} with \meta{new tokens}. \meta{Old tokens} -% cannot contain |{|, |}| or |#| -% (assuming normal \TeX{} category codes). As this function -% operates from left to right, the pattern \meta{old tokens} -% may remain after the replacement (see \cs{tl_remove_all:Nn} -% for an example). The assignment is applied globally. -% \end{function} -% -% \begin{function}[updated = 2011-08-11] -% {\tl_remove_once:Nn, \tl_remove_once:cn} +% { +% \tl_remove_once:Nn, \tl_remove_once:cn, +% \tl_gremove_once:Nn, \tl_gremove_once:cn +% } % \begin{syntax} % \cs{tl_remove_once:Nn} \meta{tl~var} \Arg{tokens} % \end{syntax} % Removes the first (leftmost) occurrence of \meta{tokens} from the % \meta{tl~var}. \meta{Tokens} cannot contain |{|, |}| or -% |#| (assuming normal \TeX{} category codes). The assignment is -% restricted to the current \TeX{} group. +% |#| (assuming normal \TeX{} category codes). % \end{function} % % \begin{function}[updated = 2011-08-11] -% {\tl_gremove_once:Nn, \tl_gremove_once:cn} -% \begin{syntax} -% \cs{tl_gremove_once:Nn} \meta{tl~var} \Arg{tokens} -% \end{syntax} -% Removes the first (leftmost) occurrence of \meta{tokens} from the -% \meta{tl~var}. \meta{Tokens} cannot contain |{|, |}| or -% |#| (assuming normal \TeX{} category codes). The assignment is -% applied globally. -% \end{function} -% -% \begin{function}[updated = 2011-08-11] -% {\tl_remove_all:Nn, \tl_remove_all:cn} +% { +% \tl_remove_all:Nn, \tl_remove_all:cn, +% \tl_gremove_all:Nn, \tl_gremove_all:cn +% } % \begin{syntax} % \cs{tl_remove_all:Nn} \meta{tl~var} \Arg{tokens} % \end{syntax} @@ -356,58 +268,28 @@ % \cs{tl_remove_all:Nn} \cs{l_tmpa_tl} |{bc}| % \end{quote} % will result in \cs{l_tmpa_tl} containing \texttt{abcd}. -% The assignment is restricted to the current \TeX{} group. -% \end{function} -% -% \begin{function}[updated = 2011-08-11] -% {\tl_gremove_all:Nn, \tl_gremove_all:cn} -% \begin{syntax} -% \cs{tl_gremove_all:Nn} \meta{tl~var} \Arg{tokens} -% \end{syntax} -% Removes all occurrences of \meta{tokens} from the -% \meta{tl~var}. \meta{Tokens} cannot contain |{|, |}| or -% |#| (assuming normal \TeX{} category codes). As this function -% operates from left to right, the pattern \meta{tokens} -% may remain after the removal (see \cs{tl_remove_all:Nn} -% for an example). The assignment is -% applied globally. % \end{function} % % \section{Reassigning token list category codes} % -% \begin{function}[updated = 2011-08-11] +% \begin{function}[updated = 2011-11-20] % { -% \tl_set_rescan:Nnn, \tl_set_rescan:Nno, \tl_set_rescan:Nnx, -% \tl_set_rescan:cnn, \tl_set_rescan:cno, \tl_set_rescan:cnx, +% \tl_set_rescan:Nnn, \tl_set_rescan:Nno, \tl_set_rescan:Nnx, +% \tl_set_rescan:cnn, \tl_set_rescan:cno, \tl_set_rescan:cnx, +% \tl_gset_rescan:Nnn, \tl_gset_rescan:Nno, \tl_gset_rescan:Nnx, +% \tl_gset_rescan:cnn, \tl_gset_rescan:cno, \tl_gset_rescan:cnx % } % \begin{syntax} % \cs{tl_set_rescan:Nnn} \meta{tl~var} \Arg{setup} \Arg{tokens} % \end{syntax} % Sets \meta{tl~var} to contain \meta{tokens}, -% applying the category code r\'egime specified in the +% applying the category code r{\'e}gime specified in the % \meta{setup} before carrying out the assignment. This allows the % \meta{tl~var} to contain material with category codes -% other than those that apply when \meta{tokens} are absorbed. The -% assignment is local to the current \TeX{} group. See also +% other than those that apply when \meta{tokens} are absorbed. See also % \cs{tl_rescan:nn}. % \end{function} % -% \begin{function}[updated = 2011-08-11] -% { -% \tl_gset_rescan:Nnn, \tl_gset_rescan:Nno, \tl_gset_rescan:Nnx, -% \tl_gset_rescan:cnn, \tl_gset_rescan:cno, \tl_gset_rescan:cnx, -% } -% \begin{syntax} -% \cs{tl_gset_rescan:Nnn} \meta{tl~var} \Arg{setup} \Arg{tokens} -% \end{syntax} -% Sets \meta{tl~var} to contain \meta{tokens}, -% applying the category code r\'egime specified in the -% \meta{setup} before carrying out the assignment. This allows the -% \meta{tl~var} to contain material with category codes -% other than those that apply when \meta{tokens} are absorbed. The -% assignment is global. See also \cs{tl_rescan:nn}. -% \end{function} -% % \begin{function}[updated = 2011-08-11]{\tl_rescan:nn} % \begin{syntax} % \cs{tl_rescan:nn} \Arg{setup} \Arg{tokens} @@ -728,7 +610,8 @@ % See also \cs{tl_reverse:N}. % \end{function} % -% \begin{function}[updated = 2011-08-13]{\tl_reverse:N, \tl_reverse:c} +% \begin{function}[updated = 2011-11-22] +% {\tl_reverse:N, \tl_reverse:c, \tl_greverse:N, \tl_greverse:c} % \begin{syntax} % \cs{tl_reverse:N} \Arg{tl~var} % \end{syntax} @@ -738,8 +621,7 @@ % This process will preserve unprotected spaces within the % \meta{token list variable}. Braced token groups are copied without % reversing the order of tokens, but keep the outer set of braces. -% The reversal is local to the current -% \TeX{} group. See also \cs{tl_reverse:n}. +% See also \cs{tl_reverse:n}. % \end{function} % % \begin{function}[added = 2011-08-13, EXP]{\tl_reverse_items:n} @@ -773,21 +655,18 @@ % \end{texnote} % \end{function} % -% \begin{function}[added = 2011-07-09]{\tl_trim_spaces:N, \tl_trim_spaces:c} +% \begin{function}[added = 2011-07-09] +% { +% \tl_trim_spaces:N, \tl_trim_spaces:c, +% \tl_gtrim_spaces:N, \tl_gtrim_spaces:c +% } % \begin{syntax} % \cs{tl_trim_spaces:N} \meta{tl~var} % \end{syntax} % Removes any leading and trailing explicit space characters -% from the content of the \meta{tl~var} within the current \TeX{} group. -% \end{function} -% -% \begin{function}[added = 2011-07-09]{\tl_gtrim_spaces:N, \tl_gtrim_spaces:c} -% \begin{syntax} -% \cs{tl_gtrim_spaces:N} \meta{tl~var} -% \end{syntax} -% Removes any leading and trailing explicit space characters -% from the content of the \meta{tl~var} globally. +% from the content of the \meta{tl~var}. % \end{function} + % % \section{The first token from a token list} % @@ -1076,6 +955,19 @@ % \end{texnote} % \end{function} % +% \begin{function}[added = 2011-11-21, EXP] +% {\tl_item:nn, \tl_item:Nn, \tl_item:cn} +% \begin{syntax} +% \cs{tl_item:nn} \Arg{token list} \Arg{integer expression} +% \end{syntax} +% Indexing items in the \meta{token list} from $0$ on the left, this +% function will evaluate the \meta{integer expression} and leave the +% appropriate item from the \meta{token list} in the input stream. +% If the \meta{integer expression} is negative, indexing occurs from +% the right of the sequence, starting at $-1$ for the right-most item. +% If the index is out of bounds, then thr function expands to nothing. +% \end{function} +% % \section{Internal functions} % % \begin{variable}{\q_tl_act_mark,\q_tl_act_stop} @@ -1138,6 +1030,14 @@ % \end{macrocode} % \end{macro} % +% \begin{variable}{\c_empty_tl} +% Never full. We need to define that constant early +% for \cs{tl_new:N} to work properly. +% \begin{macrocode} +\tl_const:Nn \c_empty_tl { } +% \end{macrocode} +% \end{variable} +% % \begin{macro}{\tl_clear:N, \tl_clear:c} % \begin{macro}{\tl_gclear:N, \tl_gclear:c} % Clearing a token list variable means setting it to an empty value. @@ -1336,13 +1236,13 @@ % % \begin{macro} % { -% \tl_set_rescan:Nnn, \tl_set_rescan:Nno, -% \tl_set_rescan:cnn, \tl_set_rescan:cno +% \tl_set_rescan:Nnn, \tl_set_rescan:Nno, \tl_set_rescan:Nnx, +% \tl_set_rescan:cnn, \tl_set_rescan:cno, \tl_set_rescan:cnx % } % \begin{macro} % { -% \tl_gset_rescan:Nnn, \tl_gset_rescan:Nno, -% \tl_gset_rescan:cnn, \tl_gset_rescan:cno +% \tl_gset_rescan:Nnn, \tl_gset_rescan:Nno, \tl_gset_rescan:Nnx, +% \tl_gset_rescan:cnn, \tl_gset_rescan:cno, \tl_gset_rescan:cnx % } % \begin{macro}[aux]{\tl_set_rescan_aux:NNnn} % \begin{macro}[aux]{\tl_rescan_aux:w} @@ -1385,9 +1285,9 @@ \c_tl_rescan_marker_tl { \tl_set:Nn \exp_not:N \l_tl_rescan_tl {##1} } } -\cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno } -\cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno } -\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno , Nnx } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno , cnx } +\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno , Nnx } \cs_generate_variant:Nn \tl_gset_rescan:Nnn { c , cno } % \end{macrocode} % \end{macro} @@ -1395,34 +1295,6 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\tl_set_rescan:Nnx, \tl_set_rescan:cnx} -% \begin{macro}{\tl_gset_rescan:Nnx, \tl_gset_rescan:cnx} -% \begin{macro}[aux]{\tl_set_rescan_aux:NNnx} -% With \texttt{x}-type expansion the \tn{everyeof} method -% does apply and the code is simple. -% \begin{macrocode} -\cs_new_protected_nopar:Npn \tl_set_rescan:Nnx - { \tl_set_rescan_aux:NNnx \tl_set:Nn } -\cs_new_protected_nopar:Npn \tl_gset_rescan:Nnx - { \tl_set_rescan_aux:NNnx \tl_gset:Nn } -\cs_new_protected_nopar:Npn \tl_set_rescan_aux:NNnx #1#2#3#4 - { - \group_begin: - \etex_everyeof:D { \exp_not:N } - \tex_endlinechar:D \c_minus_one - \tex_newlinechar:D \c_minus_one - #3 - \tl_set:Nx \l_tl_rescan_tl { \etex_scantokens:D {#4} } - \exp_args:NNNo \group_end: - #1 #2 \l_tl_rescan_tl - } -\cs_generate_variant:Nn \tl_set_rescan:Nnx { c } -\cs_generate_variant:Nn \tl_gset_rescan:Nnx { c } -% \end{macrocode} -% \end{macro} -% \end{macro} -% \end{macro} -% % \begin{macro}{\tl_rescan:nn} % The same idea is also applied to in line token lists. % \begin{macrocode} @@ -1783,21 +1655,22 @@ % % \begin{macro}{\tl_map_function:nN} % \begin{macro}{\tl_map_function:NN, \tl_map_function:cN} -% \begin{macro}[aux]{\tl_map_function_aux:NN} +% \begin{macro}[aux]{\tl_map_function_aux:Nn} % Expandable loop macro for token lists. These have the advantage of not % needing to test if the argument is empty, because if it is, the stop % marker will be read immediately and the loop terminated. % \begin{macrocode} \cs_new:Npn \tl_map_function:nN #1#2 - { \tl_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop } -\cs_new_nopar:Npn \tl_map_function:NN #1#2 { - \exp_after:wN \tl_map_function_aux:Nn - \exp_after:wN #2 #1 \q_recursion_tail \q_recursion_stop + \tl_map_function_aux:Nn #2 #1 + \q_recursion_tail + \prg_break_point:n { } } +\cs_new_nopar:Npn \tl_map_function:NN + { \exp_args:No \tl_map_function:nN } \cs_new:Npn \tl_map_function_aux:Nn #1#2 { - \quark_if_recursion_tail_stop:n {#2} + \quark_if_recursion_tail_break:n {#2} #1 {#2} \tl_map_function_aux:Nn #1 } \cs_generate_variant:Nn \tl_map_function:NN { c } @@ -1808,57 +1681,49 @@ % % \begin{macro}{\tl_map_inline:nn} % \begin{macro}{\tl_map_inline:Nn, \tl_map_inline:cn} -% \begin{macro}[aux]{\tl_map_inline_aux:n} -% \begin{variable}{\g_tl_inline_level_int} % The inline functions are straight forward by now. We use a little -% trick with the counter \cs{g_tl_inline_level_int} to make -% them nestable. We can also make use of \cs{tl_map_function:Nn} -% from before. (\cs{g_tl_inline_level_int} is defined in \pkg{l3int} -% for order-of-loading reasons.) +% trick with the counter \cs{g_prg_map_int} to make +% them nestable. We can also make use of \cs{tl_map_function_aux:Nn} +% from before. % \begin{macrocode} \cs_new_protected:Npn \tl_map_inline:nn #1#2 { - \int_gincr:N \g_tl_inline_level_int - \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } + \int_gincr:N \g_prg_map_int + \cs_gset:cpn { tl_map_inline_ \int_use:N \g_prg_map_int :n } ##1 {#2} \exp_args:Nc \tl_map_function_aux:Nn - { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } - #1 \q_recursion_tail \q_recursion_stop - \int_gdecr:N \g_tl_inline_level_int - } -\cs_new_protected:Npn \tl_map_inline:Nn #1#2 - { - \int_gincr:N \g_tl_inline_level_int - \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } - ##1 {#2} - \exp_last_unbraced:NcV \tl_map_function_aux:Nn - { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } - #1 \q_recursion_tail\q_recursion_stop - \int_gdecr:N \g_tl_inline_level_int + { tl_map_inline_ \int_use:N \g_prg_map_int :n } + #1 \q_recursion_tail + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } } +\cs_new_protected:Npn \tl_map_inline:Nn + { \exp_args:No \tl_map_inline:nn } \cs_generate_variant:Nn \tl_map_inline:Nn { c } % \end{macrocode} -% \end{variable} -% \end{macro} % \end{macro} % \end{macro} % % \begin{macro}{\tl_map_variable:nNn} % \begin{macro}{\tl_map_variable:NNn, \tl_map_variable:cNn} -% \begin{macro}[aux]{\tl_map_variable_aux:NnN} +% \begin{macro}[aux]{\tl_map_variable_aux:Nnn} % \cs{tl_map_variable:nNn} \meta{token list} \meta{temp} \meta{action} % assigns % \meta{temp} to each element and executes \meta{action}. % \begin{macrocode} \cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 - { \tl_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop } + { + \tl_map_variable_aux:Nnn #2 {#3} #1 + \q_recursion_tail + \prg_break_point:n { } + } \cs_new_protected_nopar:Npn \tl_map_variable:NNn { \exp_args:No \tl_map_variable:nNn } \cs_new_protected:Npn \tl_map_variable_aux:Nnn #1#2#3 { \tl_set:Nn #1 {#3} - \quark_if_recursion_tail_stop:N #1 - #2 \tl_map_variable_aux:Nnn #1 {#2} + \quark_if_recursion_tail_break:N #1 + \use:n {#2} + \tl_map_variable_aux:Nnn #1 {#2} } \cs_generate_variant:Nn \tl_map_variable:NNn { c } % \end{macrocode} @@ -1867,11 +1732,14 @@ % \end{macro} % % \begin{macro}{\tl_map_break:} -% The break statement. +% \begin{macro}{\tl_map_break:n} +% The break statements are simply copies. % \begin{macrocode} -\cs_new_eq:NN \tl_map_break: \use_none_delimit_by_q_recursion_stop:w +\cs_new_eq:NN \tl_map_break: \prg_map_break: +\cs_new_eq:NN \tl_map_break:n \prg_map_break:n % \end{macrocode} % \end{macro} +% \end{macro} % % \subsection{Using token lists} % @@ -1896,15 +1764,12 @@ % error here. No such luck for ones equal to \cs{scan_stop:} so % instead a test is made and if there is an issue an error is forced. % \begin{macrocode} -\cs_new_eq:NN \tl_use:N \prg_do_nothing: -\cs_new_nopar:Npn \tl_use:c #1 +\cs_new_nopar:Npn \tl_use:N #1 { - \if_cs_exist:w #1 \cs_end: - \cs:w #1 \exp_after:wN \cs_end: - \else: - \msg_expandable_error:n { Undefined~variable~name~'#1'! } - \fi: + \cs_if_exist:NTF #1 {#1} + { \msg_expandable_kernel_error:nnn { kernel } { bad-var } {#1} } } +\cs_generate_variant:Nn \tl_use:N { c } % \end{macrocode} % \end{macro} % @@ -1929,7 +1794,7 @@ \int_eval:n { 0 \tl_map_function:NN #1 \tl_length_aux:n } } -\cs_new:Npn \tl_length_aux:n #1 { + 1 } +\cs_new:Npn \tl_length_aux:n #1 { + \c_one } \cs_generate_variant:Nn \tl_length:n { V , o } \cs_generate_variant:Nn \tl_length:N { c } % \end{macrocode} @@ -1938,21 +1803,30 @@ % \end{macro} % % \begin{macro}{\tl_reverse_items:n} -% \begin{macro}[aux]{\tl_reverse_items_aux:nN} +% \begin{macro}[aux]{\tl_reverse_items_aux:nwNwn} +% \begin{macro}[aux]{\tl_reverse_items_aux:wn} % Reversal of a token list is done by taking one item at a time % and putting it after \cs{q_recursion_stop}. % \begin{macrocode} \cs_new:Npn \tl_reverse_items:n #1 - { \tl_reverse_items_aux:nw #1 \q_recursion_tail \q_recursion_stop } -\cs_new:Npn \tl_reverse_items_aux:nw #1 #2 \q_recursion_stop { - \quark_if_recursion_tail_stop_do:nn {#1} { \use_none:n } - \tl_reverse_items_aux:nw #2 \q_recursion_stop - {#1} + \tl_reverse_items_aux:nwNwn #1 ? + \q_mark \tl_reverse_items_aux:nwNwn + \q_mark \tl_reverse_items_aux:wn + \q_stop { } } +\cs_new:Npn \tl_reverse_items_aux:nwNwn #1 #2 \q_mark #3 #4 \q_stop #5 + { + #3 #2 + \q_mark \tl_reverse_items_aux:nwNwn + \q_mark \tl_reverse_items_aux:wn + \q_stop { {#1} #5 } + } +\cs_new:Npn \tl_reverse_items_aux:wn #1 \q_stop #2 { \use_none:nn #2 } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{\tl_trim_spaces:n} % \begin{macro} @@ -2260,23 +2134,19 @@ % then this test will be \meta{true}. It is \meta{false} if the token % list is empty, if the first token is an implicit space token, % such as \cs{c_space_token}, or any token other than an explicit space. +% The slightly convoluted approach with \tn{romannumeral} ensures that +% each expansion step gives a balanced token list. % \begin{macrocode} \prg_new_conditional:Npnn \tl_if_head_space:n #1 { p , T , F , TF } { - \if_int_compare:w - \pdftex_strcmp:D - { } - { \tl_if_head_space_aux:w \prg_do_nothing: #1 ? ~ } - = \c_zero - \prg_return_true: - \else: - \prg_return_false: - \fi: + \tex_romannumeral:D \if_false: { \fi: + \tl_if_head_space_aux:w ? #1 ? ~ } } -\cs_new:Npn \tl_if_head_space_aux:w #1 ~ % +\cs_new:Npn \tl_if_head_space_aux:w #1 ~ { - \exp_not:o {#1} - \if_false: { \fi: } + \tl_if_empty:oTF { \use_none:n #1 } + { \exp_after:wN \c_zero \exp_after:wN \prg_return_true: } + { \exp_after:wN \c_zero \exp_after:wN \prg_return_false: } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } % \end{macrocode} @@ -2325,13 +2195,6 @@ % \end{macrocode} % \end{variable} % -% \begin{variable}{\c_empty_tl} -% Never full. -% \begin{macrocode} -\tl_const:Nn \c_empty_tl { } -% \end{macrocode} -% \end{variable} -% % \begin{variable}{\c_space_tl} % A space as a token list (as opposed to as a character). % \begin{macrocode} @@ -2584,13 +2447,16 @@ % \end{macro} % \end{macro} % -% \begin{macro}{\tl_reverse:N, \tl_reverse:c} -% This reverses the list, leaving |{}| in front, which in turn -% is removed by the \tn{unexpanded} primitive. +% \begin{macro}{\tl_reverse:N, \tl_reverse:c, \tl_greverse:N, \tl_greverse:c} +% This reverses the list, leaving \cs{exp_stop_f:} in front, +% which stops the \texttt{f}-expansion. % \begin{macrocode} \cs_new_protected_nopar:Npn \tl_reverse:N #1 - { \tl_set:No #1 { \etex_unexpanded:D \tl_reverse:o { #1 { } } } } -\cs_generate_variant:Nn \tl_reverse:N { c } + { \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } +\cs_new_protected_nopar:Npn \tl_greverse:N #1 + { \tl_gset:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } +\cs_generate_variant:Nn \tl_reverse:N { c } +\cs_generate_variant:Nn \tl_greverse:N { c } % \end{macrocode} % \end{macro} % @@ -2685,6 +2551,41 @@ % \end{macro} % \end{macro} % +% \begin{macro}{\tl_item:nn, \tl_item:Nn, \tl_item:cn} +% \begin{macro}[aux]{\tl_item_aux:nn} +% The idea here is to find the offset of the item from the left, then use +% a loop to grab the correct item. If the resulting offset is too large, +% then \cs{quark_if_recursion_tail_stop:n} terminates the loop, and returns +% nothing at all. +% \begin{macrocode} +\cs_new:Npn \tl_item:nn #1#2 + { + \exp_args:Nf \tl_item_aux:nn + { + \int_eval:n + { + \int_compare:nNnT {#2} < \c_zero + { \tl_length:n {#1} + } + #2 + } + } + #1 + \q_recursion_tail + \prg_break_point:n { } + } +\cs_new_nopar:Npn \tl_item_aux:nn #1#2 + { + \quark_if_recursion_tail_break:n {#2} + \int_compare:nNnTF {#1} = \c_zero + { \tl_map_break:n {#2} } + { \exp_args:Nf \tl_item_aux:nn { \int_eval:n { #1 - 1 } } } + } +\cs_new_nopar:Npn \tl_item:Nn { \exp_args:No \tl_item:nn } +\cs_generate_variant:Nn \tl_item:Nn { c } +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \subsection{Deprecated functions} % % \begin{macro}{\tl_new:Nn, \tl_new:cn, \tl_new:Nx} diff --git a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty index e1ef050b2bb..b54a9d1255f 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/expl3.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/expl3.sty @@ -48,8 +48,8 @@ \RequirePackage{l3names} \def\ExplFileName{expl3} \def\ExplFileDescription{L3 Experimental code bundle wrapper} -\def\ExplFileDate{2011/11/19} -\def\ExplFileVersion{2966} +\def\ExplFileDate{2011/12/07} +\def\ExplFileVersion{3036} \RequirePackage{etex} \reserveinserts{32} \RequirePackage{calc} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty index 745f2e3421a..c9e56e990e1 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3basics.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3basics.dtx 2915 2011-10-15 21:21:08Z bruno $ +\GetIdInfo$Id: l3basics.dtx 3023 2011-12-04 07:25:04Z bruno $ {L3 Experimental basic definitions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -122,7 +122,7 @@ \cs_set_protected:Npn \use:x #1 { \group_begin: - \cs_set:Npx \cs_tmp:w {#1} + \cs_set_nopar:Npx \cs_tmp:w {#1} \exp_after:wN \group_end: \cs_tmp:w @@ -749,6 +749,9 @@ \if_int_compare:w \pdftex_strcmp:D {#1} {#2} = \c_zero \prg_return_true: \else: \prg_return_false: \fi: } +\cs_new_eq:NN \prg_break_point:n \use:n +\cs_new:Npn \prg_map_break: #1 \prg_break_point:n #2 { #2 } +\cs_new:Npn \prg_map_break:n #1 #2 \prg_break_point:n #3 { #3 #1 } \cs_new_eq:NN \c_luatex_is_engine_bool \luatex_if_engine_p: \cs_new_eq:NN \c_pdftex_is_engine_bool \pdftex_if_engine_p: \cs_new_eq:NN \c_xetex_is_engine_bool \xetex_if_engine_p: diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty index e00b99f0852..9c0033a0958 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3bootstrap.sty @@ -94,7 +94,7 @@ {\def\ExplFileDate{#2}} \protected\def\GetIdInfoAuxSVN#1\relax#2-#3-#4\relax#5Z\relax {\def\ExplFileDate{#2/#3/#4}} -\GetIdInfo$Id: l3bootstrap.dtx 2798 2011-09-10 15:42:13Z will $ +\GetIdInfo$Id: l3bootstrap.dtx 3006 2011-11-25 13:29:59Z joseph $ {L3 experimental bootstrap code} \ProvidesPackage{l3bootstrap} [% diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty index 817e1982e4f..acf0671deb3 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3box.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3box.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3box.dtx 2960 2011-11-15 08:50:21Z joseph $ +\GetIdInfo$Id: l3box.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental boxes} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -146,8 +146,29 @@ \cs_new_eq:NN \c_empty_box \voidb@x \cs_new_eq:NN \l_tmpa_box \@tempboxa \box_new:N \l_tmpb_box -\cs_new_eq:NN \box_show:N \tex_showbox:D +\cs_new_protected:Npn \box_show:N #1 + { + \cs_if_exist:NTF #1 + { \tex_showbox:D \use:n {#1} } + { + \msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } + } \cs_generate_variant:Nn \box_show:N { c } +\cs_new_protected:Npn \box_show:Nnn #1#2#3 + { + \group_begin: + \int_set:Nn \tex_showboxbreadth:D {#2} + \int_set:Nn \tex_showboxdepth:D {#3} + \int_set_eq:NN \tex_tracingonline:D \c_one + \box_show:N #1 + \group_end: + } +\cs_generate_variant:Nn \box_show:Nnn { c } +\cs_new_protected:Npn \box_show_full:N #1 + { \box_show:Nnn #1 { \c_max_int } { \c_max_int } } +\cs_generate_variant:Nn \box_show_full:N { c } \cs_new_protected:Npn \hbox:n { \tex_hbox:D \scan_stop: } \cs_new_protected:Npn \hbox_set:Nn #1#2 { \tex_setbox:D #1 \tex_hbox:D {#2} } \cs_new_protected:Npn \hbox_gset:Nn { \tex_global:D \hbox_set:Nn } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty index ded66383b4a..3dd557d6b8a 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3clist.sty @@ -47,12 +47,12 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3clist.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3clist.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental comma separated lists} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: -\tl_new:N \l_clist_tmpa_tl +\tl_new:N \l_clist_tmpa_clist \cs_new_protected:Npn \clist_tmp:w { } \cs_new_eq:NN \clist_new:N \tl_new:N \cs_new_eq:NN \clist_new:c \tl_new:c @@ -109,24 +109,23 @@ \cs_new:Npn \clist_trim_spaces_generic_aux_ii:nn #1 #2 { #2 {#1} } \cs_new:Npn \clist_trim_spaces:n #1 { - \clist_trim_spaces_aux:n { } \q_mark #1 , - \q_recursion_tail, \q_recursion_stop - } -\cs_new:Npn \clist_trim_spaces_aux:n #1 - { \clist_trim_spaces_generic:nw - { \clist_trim_spaces_aux_ii:nn {#1} } + { \clist_trim_spaces_aux:nn { } } + \q_mark #1 , + \q_recursion_tail, \q_recursion_stop } -\cs_new:Npn \clist_trim_spaces_aux_ii:nn #1 #2 +\cs_new:Npn \clist_trim_spaces_aux:nn #1 #2 { \quark_if_recursion_tail_stop:n {#2} \tl_if_empty:nTF {#2} { - \clist_trim_spaces_aux:n {#1} \q_mark + \clist_trim_spaces_generic:nw + { \clist_trim_spaces_aux:nn {#1} } \q_mark } { #1 \exp_not:n {#2} - \clist_trim_spaces_aux:n { , } \q_mark + \clist_trim_spaces_generic:nw + { \clist_trim_spaces_aux:nn { , } } \q_mark } } \cs_new_protected:Npn \clist_set:Nn #1#2 @@ -136,27 +135,27 @@ \cs_generate_variant:Nn \clist_set:Nn { NV , No , Nx , c , cV , co , cx } \cs_generate_variant:Nn \clist_gset:Nn { NV , No , Nx , c , cV , co , cx } \cs_new_protected_nopar:Npn \clist_put_left:Nn - { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_left:Nx { } , } + { \clist_put_left_aux:NNNn \clist_concat:NNN \clist_set:Nn } \cs_new_protected_nopar:Npn \clist_gput_left:Nn - { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_left:Nx { } , } -\cs_new_protected:Npn \clist_put_aux:NNnnNn #1#2#3#4#5#6 + { \clist_put_left_aux:NNNn \clist_gconcat:NNN \clist_set:Nn } +\cs_new_protected:Npn \clist_put_left_aux:NNNn #1#2#3#4 { - \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#6} } - \clist_if_empty:NTF #5 - { #1 #5 \l_clist_tmpa_tl } - { - \tl_if_empty:NF \l_clist_tmpa_tl - { #2 #5 { #3 \exp_not:o \l_clist_tmpa_tl #4 } } - } + #2 \l_clist_tmpa_clist {#4} + #1 #3 \l_clist_tmpa_clist #3 } \cs_generate_variant:Nn \clist_put_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_left:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_left:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_gput_left:Nn { c , cV , co , cx } \cs_new_protected:Npn \clist_put_right:Nn - { \clist_put_aux:NNnnNn \tl_set_eq:NN \tl_put_right:Nx , { } } + { \clist_put_right_aux:NNNn \clist_concat:NNN \clist_set:Nn } \cs_new_protected_nopar:Npn \clist_gput_right:Nn - { \clist_put_aux:NNnnNn \tl_gset_eq:NN \tl_gput_right:Nx , { } } + { \clist_put_right_aux:NNNn \clist_gconcat:NNN \clist_gset:Nn } +\cs_new_protected:Npn \clist_put_right_aux:NNNn #1#2#3#4 + { + #2 \l_clist_tmpa_clist {#4} + #1 #3 #3 \l_clist_tmpa_clist + } \cs_generate_variant:Nn \clist_put_right:Nn { NV , No , Nx } \cs_generate_variant:Nn \clist_put_right:Nn { c , cV , co , cx } \cs_generate_variant:Nn \clist_gput_right:Nn { NV , No , Nx } @@ -287,36 +286,47 @@ \clist_if_empty:NF #1 { \exp_last_unbraced:NNo \clist_map_function_aux:Nw #2 #1 - , \q_recursion_tail , \q_recursion_stop + , \q_recursion_tail , + \prg_break_point:n { } } } \cs_new:Npn \clist_map_function_aux:Nw #1#2 , { - \quark_if_recursion_tail_stop:n {#2} + \quark_if_recursion_tail_break:n {#2} #1 {#2} \clist_map_function_aux:Nw #1 } \cs_generate_variant:Nn \clist_map_function:NN { c } -\int_new:N \g_clist_map_inline_int +\cs_new:Npn \clist_map_function:nN #1#2 + { + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 } + \q_mark #1, \q_recursion_tail, + \prg_break_point:n { } + } +\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2 + { + \quark_if_recursion_tail_break:n {#2} + \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, } + \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 } + \q_mark + } +\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} } \cs_new_protected:Npn \clist_map_inline:Nn #1#2 { - \int_gincr:N \g_clist_map_inline_int - \cs_gset:cpn { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - ##1 - {#2} - \exp_args:NNc \clist_map_function:NN #1 - { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - \int_gdecr:N \g_clist_map_inline_int + \clist_if_empty:NF #1 + { + \int_gincr:N \g_prg_map_int + \cs_gset:cpn { clist_map_ \int_use:N \g_prg_map_int :n } ##1 {#2} + \exp_last_unbraced:Nco \clist_map_function_aux:Nw + { clist_map_ \int_use:N \g_prg_map_int :n } + #1 , \q_recursion_tail , + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } + } } -\cs_new_protected:Npn \clist_map_inline:nn #1#2 +\cs_new_protected:Npn \clist_map_inline:nn #1 { - \int_gincr:N \g_clist_map_inline_int - \cs_gset:cpn { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - ##1 - {#2} - \exp_args:Nnc \clist_map_function:nN {#1} - { clist_map_inline_ \int_use:N \g_clist_map_inline_int :n } - \int_gdecr:N \g_clist_map_inline_int + \clist_set:Nn \l_clist_tmpa_clist {#1} + \clist_map_inline:Nn \l_clist_tmpa_clist } \cs_generate_variant:Nn \clist_map_inline:Nn { c } \cs_new_protected:Npn \clist_map_variable:NNn #1#2#3 @@ -327,61 +337,39 @@ { \clist_map_variable_aux:Nnw #2 {#3} } #1 , \q_recursion_tail , \q_recursion_stop + \prg_break_point:n { } } } -\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3 , - { - \quark_if_recursion_tail_stop:n {#3} - \tl_set:Nn #1 {#3} - #2 - \clist_map_variable_aux:Nnw #1 {#2} - } \cs_new_protected:Npn \clist_map_variable:nNn #1 { - \tl_set:Nx \l_clist_tmpa_tl { \clist_trim_spaces:n {#1} } - \clist_map_variable:NNn \l_clist_tmpa_tl - } -\cs_generate_variant:Nn \clist_map_variable:NNn { c } -\cs_new:Npn \clist_map_aux_unbrace:Nw #1 #2, { #1 {#2} } -\cs_new:Npn \clist_map_function:nN #1#2 - { - \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #2 } - \q_mark #1, \q_recursion_tail, \q_recursion_stop + \clist_set:Nn \l_clist_tmpa_clist {#1} + \clist_map_variable:NNn \l_clist_tmpa_clist } -\cs_new:Npn \clist_map_function_n_aux:Nn #1 #2 +\cs_new_protected:Npn \clist_map_variable_aux:Nnw #1#2#3, { - \quark_if_recursion_tail_stop:n {#2} - \tl_if_empty:nF {#2} { \clist_map_aux_unbrace:Nw #1 #2, } - \clist_trim_spaces_generic:nw { \clist_map_function_n_aux:Nn #1 } - \q_mark + \tl_set:Nn #1 {#3} + \quark_if_recursion_tail_stop:N #1 + \use:n {#2} + \clist_map_variable_aux:Nnw #1 {#2} } -\cs_new_eq:NN \clist_map_break: \use_none_delimit_by_q_recursion_stop:w -\cs_new_eq:NN \clist_map_break:n \use_i_delimit_by_q_recursion_stop:nw +\cs_generate_variant:Nn \clist_map_variable:NNn { c } +\cs_new_eq:NN \clist_map_break: \prg_map_break: +\cs_new_eq:NN \clist_map_break:n \prg_map_break:n \cs_new_protected_nopar:Npn \clist_show:N #1 { - \clist_if_empty:NTF #1 - { - \iow_term:x { Comma~list~\token_to_str:N #1~is~empty } - \tl_show:n { } - } - { - \iow_term:x - { - Comma~list~\token_to_str:N #1~ - contains~the~items~(without~outer~braces): - } - \tl_set:Nx \l_clist_show_tl - { \clist_map_function:NN #1 \clist_show_aux:n } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \clist_show_aux:w \l_clist_show_tl } - } + \msg_aux_show:Nnx + #1 + { clist } + { \clist_map_function:NN #1 \msg_aux_show:n } } -\cs_new:Npn \clist_show_aux:n #1 +\cs_new_protected:Npn \clist_show:n #1 { - \iow_newline: > \c_space_tl \c_space_tl - \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + \clist_set:Nn \l_clist_tmpa_clist {#1} + \msg_aux_show:Nnx + \l_clist_tmpa_clist + { clist } + { \clist_map_function:NN \l_clist_tmpa_clist \msg_aux_show:n } } -\cs_new:Npn \clist_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \clist_show:N { c } \clist_new:N \l_tmpa_clist \clist_new:N \l_tmpb_clist @@ -396,16 +384,21 @@ } } \cs_new:Npn \clist_length_aux:n #1 { +1 } -\cs_new:Npn \clist_length:n #1 +\cs_new:Npx \clist_length:n #1 { - \int_eval:n + \exp_not:N \int_eval:n { 0 - \clist_map_function_aux:Nw \clist_length_n_aux:n #1 - , \q_recursion_tail , \q_recursion_stop + \exp_not:N \clist_length_n_aux:w \c_space_tl + #1 \exp_not:n { , \q_recursion_tail , \q_recursion_stop } } } -\cs_new:Npn \clist_length_n_aux:n #1 { \tl_if_blank:nF {#1} {+1} } +\cs_new:Npx \clist_length_n_aux:w #1 , + { + \exp_not:n { \exp_args:Nf \quark_if_recursion_tail_stop:n } {#1} + \exp_not:N \tl_if_blank:nF {#1} { + \c_one } + \exp_not:N \clist_length_n_aux:w \c_space_tl + } \cs_generate_variant:Nn \clist_length:N { c } \cs_new:Npn \clist_item:Nn #1#2 { @@ -492,6 +485,9 @@ \cs_generate_variant:Nn \clist_set_from_seq:NN { c , cc } \cs_generate_variant:Nn \clist_gset_from_seq:NN { Nc } \cs_generate_variant:Nn \clist_gset_from_seq:NN { c , cc } +\cs_new_protected:Npn \clist_const:Nn #1#2 + { \tl_const:Nx #1 { \clist_trim_spaces:n {#2} } } +\cs_generate_variant:Nn \clist_const:Nn { c , Nx , cx } \cs_new_protected:Npn \clist_trim_spaces:N #1 { \clist_set:No #1 {#1} } \cs_new_protected:Npn \clist_gtrim_spaces:N #1 { \clist_gset:No #1 {#1} } \cs_generate_variant:Nn \clist_trim_spaces:N { c } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls index d86ed4560e9..a79e13d795e 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls +++ b/Master/texmf-dist/tex/latex/l3kernel/l3doc.cls @@ -52,7 +52,7 @@ \let \filedateOld \ExplFileDate \let \fileversionOld \ExplFileVersion \let \filedescriptionOld \ExplFileDescription -\GetIdInfo$Id: l3doc.dtx 2866 2011-10-01 05:16:55Z bruno $ +\GetIdInfo$Id: l3doc.dtx 2990 2011-11-23 02:32:59Z bruno $ {L3 Experimental documentation class} \ProvidesExplClass {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -73,6 +73,7 @@ \bool_new:N \l_doc_long_name_bool \bool_new:N \g_doc_implementation_bool \dim_new:N \l_doc_trial_width_dim +\tl_new:N \l_doc_macro_tl \int_new:N \l_doc_macro_int \int_new:N \g_doc_nested_macro_int \prop_new:N \g_doc_missing_tests_prop @@ -659,6 +660,7 @@ { unknown .code:n = { \use:c{doc_macro_opt_#1:} } } +\clist_new:N \l_doc_macro_input_clist \cs_new_nopar:Npn \doc_macro_aux:n #1 { \group_end: \clist_set:Nn \l_doc_macro_input_clist {#1} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty index def2204767c..303e369e694 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3expan.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3expan.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3expan.dtx 3031 2011-12-07 05:27:05Z bruno $ {L3 Experimental argument expansion} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -102,7 +102,7 @@ { \fi: \fi: - \msg_expandable_error:n { Erroneous ~ variable ~ #2 used! } + \msg_expandable_kernel_error:nnn { kernel } { bad-var } {#2} \c_zero } \cs_new:Npn \exp_args:No #1#2 { \exp_after:wN #1 \exp_after:wN {#2} } @@ -245,6 +245,11 @@ \exp_after:wN \exp_arg_last_unbraced:nn \exp_after:wN { \tex_romannumeral:D \exp_eval_register:c {#2} } {#1} } +\cs_new_protected:Npn \::x_unbraced \::: #1#2 + { + \cs_set_nopar:Npx \l_exp_tl { \exp_not:n {#1} #2 } + \l_exp_tl + } \cs_new:Npn \exp_last_unbraced:NV #1#2 { \exp_after:wN #1 \tex_romannumeral:D \exp_eval_register:N #2 } \cs_new:Npn \exp_last_unbraced:Nv #1#2 @@ -252,6 +257,8 @@ \cs_new:Npn \exp_last_unbraced:No #1#2 { \exp_after:wN #1 #2 } \cs_new:Npn \exp_last_unbraced:Nf #1#2 { \exp_after:wN #1 \tex_romannumeral:D -`0 #2 } +\cs_new:Npn \exp_last_unbraced:Nco #1#2#3 + { \exp_after:wN #1 \cs:w #2 \exp_after:wN \cs_end: #3 } \cs_new:Npn \exp_last_unbraced:NcV #1#2#3 { \exp_after:wN #1 @@ -266,9 +273,6 @@ } \cs_new:Npn \exp_last_unbraced:NNo #1#2#3 { \exp_after:wN #1 \exp_after:wN #2 #3 } -\cs_new_nopar:Npn \exp_last_unbraced:Nno { \::n \::o_unbraced \::: } -\cs_new_nopar:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: } -\cs_new_nopar:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: } \cs_new:Npn \exp_last_unbraced:NNNV #1#2#3#4 { \exp_after:wN #1 @@ -278,6 +282,10 @@ } \cs_new:Npn \exp_last_unbraced:NNNo #1#2#3#4 { \exp_after:wN #1 \exp_after:wN #2 \exp_after:wN #3 #4 } +\cs_new_nopar:Npn \exp_last_unbraced:Nno { \::n \::o_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:Noo { \::o \::o_unbraced \::: } +\cs_new_nopar:Npn \exp_last_unbraced:Nfo { \::f \::o_unbraced \::: } +\cs_new_protected_nopar:Npn \exp_last_unbraced:Nx { \::x_unbraced \::: } \cs_new:Npn \exp_last_two_unbraced:Noo #1#2#3 { \exp_after:wN \exp_last_two_unbraced_aux:noN \exp_after:wN {#3} {#2} #1 } \cs_new:Npn \exp_last_two_unbraced_aux:noN #1#2#3 diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty index 6304b6d449c..3eb68b0727d 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3fp.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3fp.dtx 2857 2011-09-26 19:46:31Z joseph $ +\GetIdInfo$Id: l3fp.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental floating-point operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty index 831fb50ae02..b5f57e66b05 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3int.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3int.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3int.dtx 2928 2011-10-22 12:32:44Z bruno $ +\GetIdInfo$Id: l3int.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental integers} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -679,6 +679,8 @@ \cs_new_nopar:Npn \int_from_roman_clean_up:w #1 Q { + 0 Q -1 } \cs_new_eq:NN \int_show:N \kernel_register_show:N \cs_new_eq:NN \int_show:c \kernel_register_show:c +\cs_new_protected:Npn \int_show:n #1 + { \tex_showthe:D \int_eval:w #1 \int_eval_end: } \int_const:Nn \c_one { 1 } \int_const:Nn \c_two { 2 } \int_const:Nn \c_three { 3 } @@ -703,48 +705,6 @@ \int_new:N \l_tmpc_int \int_new:N \g_tmpa_int \int_new:N \g_tmpb_int -\int_new:N \g_seq_nesting_depth_int -\int_new:N \g_tl_inline_level_int -\cs_new_eq:NN \int_convert_from_base_ten:nn \int_to_base:nn -\cs_new_eq:NN \int_convert_to_symbols:nnn \int_to_symbols:nnn -\cs_new_eq:NN \int_convert_to_base_ten:nn \int_from_base:nn -\cs_new_nopar:Npn \int_to_symbol:n - { - \scan_align_safe_stop: - \mode_if_math:TF - { \int_to_symbol_math:n } - { \int_to_symbol_text:n } - } -\cs_new:Npn \int_to_symbol_math:n #1 - { - \int_to_symbols:nnn {#1} { 9 } - { - { 1 } { * } - { 2 } { \dagger } - { 3 } { \ddagger } - { 4 } { \mathsection } - { 5 } { \mathparagraph } - { 6 } { \| } - { 7 } { ** } - { 8 } { \dagger \dagger } - { 9 } { \ddagger \ddagger } - } - } -\cs_new:Npn \int_to_symbol_text:n #1 - { - \int_to_symbols:nnn {#1} { 9 } - { - { 1 } { \textasteriskcentered } - { 2 } { \textdagger } - { 3 } { \textdaggerdbl } - { 4 } { \textsection } - { 5 } { \textparagraph } - { 6 } { \textbardbl } - { 7 } { \textasteriskcentered \textasteriskcentered } - { 8 } { \textdagger \textdagger } - { 9 } { \textdaggerdbl \textdaggerdbl } - } - } %% %% %% End of file `l3int.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3io.sty b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty index 4073a35bfa8..c074dbf0ea2 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3io.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3io.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3io.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3io.dtx 3005 2011-11-25 13:19:47Z bruno $ {L3 Experimental input-output operations} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -229,41 +229,16 @@ \cs_generate_variant:Nn \ior_close:N { c } \cs_generate_variant:Nn \iow_close:N { c } \cs_new_protected_nopar:Npn \ior_list_streams: - { - \prop_if_empty:NTF \g_ior_streams_prop - { - \iow_term:x { No~input~streams~are~open } - \tl_show:n { } - } - { - \iow_term:x { The~following~input~streams~are~in~use: } - \tl_set:Nx \l_prop_show_tl - { \prop_map_function:NN \g_ior_streams_prop \ior_show_aux:nn } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } - } - } -\cs_new:Npn \ior_show_aux:nn #1#2 - { - \iow_newline: > \c_space_tl \c_space_tl - #1 \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} - } + { \ior_list_streams_aux:Nn \g_ior_streams_prop { ior } } \cs_new_protected_nopar:Npn \iow_list_streams: + { \ior_list_streams_aux:Nn \g_iow_streams_prop { iow } } +\cs_new_protected:Npn \ior_list_streams_aux:Nn #1#2 { - \prop_if_empty:NTF \g_iow_streams_prop - { - \iow_term:x { No~output~streams~are~open } - \tl_show:n { } - } - { - \iow_term:x { The~following~output~streams~are~in~use: } - \tl_set:Nx \l_prop_show_tl - { \prop_map_function:NN \g_iow_streams_prop \iow_show_aux:nn } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } - } + \msg_aux_use:nn { LaTeX / #2 } + { \prop_if_empty:NTF #1 { show-no-stream } { show-open-streams } } + \msg_aux_show:x + { \prop_map_function:NN #1 \msg_aux_show_unbraced:nn } } -\cs_new_eq:NN \iow_show_aux:nn \ior_show_aux:nn \msg_kernel_new:nnnn { iow } { streams-exhausted } { Output~streams~exhausted } { @@ -421,9 +396,7 @@ } \cs_new_protected_nopar:Npn \iow_wrap_special:w #1 ~ #2 ~ #3 ~ % { - \cs_if_exist:cTF { iow_wrap_#1: } - { \use:c { iow_wrap_#1: } } - { \msg_expandable_error:n {#1} } + \use:c { iow_wrap_#1: } \str_if_eq:xxTF { #2~#3 } { ~ \c_iow_wrap_marker_tl } { \iow_wrap_special:w } { \iow_wrap_loop:w #2 ~ #3 ~ } diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty index cbecb20c036..7494acf9185 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3luatex.sty @@ -46,11 +46,17 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3luatex.dtx 2798 2011-09-10 15:42:13Z will $ +\GetIdInfo$Id: l3luatex.dtx 2995 2011-11-23 16:15:19Z bruno $ {L3 Experimental LuaTeX-specific functions} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: +\msg_kernel_new:nnnn { luatex } { bad-engine } + { LuaTeX~engine~not~in~use!~Ignoring~#1. } + { + The~feature~you~are~using~is~only~available\ + with~the~luaTeX~engine.~LaTeX3~ignored~`#1#2'. + } \luatex_if_engine:TF { \cs_new_eq:NN \lua_now:x \luatex_directlua:D @@ -59,13 +65,13 @@ { \cs_new:Npn \lua_now:x #1 { - \msg_expandable_error:n - { LuaTeX~ engine~ not~ in~ use!~ Ignoring~ \lua_now:x. } + \msg_expandable_kernel_error:nnn + { luatex } { bad-engine } { \lua_now:x } } \cs_new_protected:Npn \lua_shipout_x:n #1 { - \msg_expandable_error:n - { LuaTeX~ engine~ not~ in~ use!~ Ignoring~ \lua_shipout_x:n. } + \msg_expandable_kernel_error:nnn + { luatex } { bad-engine } { \lua_shipout_x:n } } } \cs_new:Npn \lua_now:n #1 @@ -97,7 +103,13 @@ } } \luatex_if_engine:F - { \cs_set_protected_nopar:Npn \cctab_new:N #1 { \lua_wrong_engine: } } + { + \cs_set_protected_nopar:Npn \cctab_new:N #1 + { + \msg_kernel_error:nnx { luatex } { bad-engine } + { \exp_not:N \cctab_new:N } + } + } \luatex_if_engine:T { \cs_set_protected_nopar:Npn \cctab_new:N #1 @@ -126,8 +138,16 @@ } \luatex_if_engine:F { - \cs_set_protected_nopar:Npn \cctab_begin:N #1 { \lua_wrong_engine: } - \cs_set_protected_nopar:Npn \cctab_end: { \lua_wrong_engine: } + \cs_set_protected_nopar:Npn \cctab_begin:N #1 + { + \msg_kernel_error:nnxx { luatex } { bad-engine } + { \exp_not:N \cctab_begin:N } {#1} + } + \cs_set_protected_nopar:Npn \cctab_end: + { + \msg_kernel_error:nnx { luatex } { bad-engine } + { \exp_not:N \cctab_end: } + } } \luatex_if_engine:T { @@ -143,7 +163,13 @@ \group_end: } \luatex_if_engine:F - { \cs_set_protected_nopar:Npn \cctab_gset:Nn #1#2 { \lua_wrong_engine: } } + { + \cs_set_protected_nopar:Npn \cctab_gset:Nn #1#2 + { + \msg_kernel_error:nnxx { luatex } { bad-engine } + { \exp_not:N \cctab_gset:Nn } { #1 {#2} } + } + } \luatex_if_engine:T { \cctab_new:N \c_code_cctab diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty index f524af018c6..d4991bc760c 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3msg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3msg.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3msg.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental messages} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -58,7 +58,7 @@ { \cs_if_exist:cT { \c_msg_text_prefix_tl #1 / #2 } { - \msg_kernel_error:nn { msg } { message-already-defined } + \msg_kernel_error:nnxx { msg } { message-already-defined } {#1} {#2} } \msg_gset:nnnn {#1} {#2} @@ -484,9 +484,8 @@ { Message~'#2'~for~module~'#1'~already~defined. } { \c_msg_coding_error_text_tl - LaTeX~was~asked~to~define~a~new~message~called~'#2' - by~the~module~'#1'~module:\\ - this~message~already~exists. + LaTeX~was~asked~to~define~a~new~message~called~'#2'\ + by~the~module~'#1':~this~message~already~exists. \c_msg_return_text_tl } \msg_kernel_new:nnnn { msg } { message-unknown } @@ -556,23 +555,42 @@ LaTeX~has~been~asked~to~replace~an~empty~pattern~by~'#1':~that~% would~lead~to~an~infinite~loop! } -\cs_set_protected:Npn \msg_kernel_bug:x #1 - { - \msg_interrupt:xxx { \c_msg_kernel_bug_text_tl } - { - #1 - \msg_see_documentation_text:n { LaTeX3 } - } - { \c_msg_kernel_bug_more_text_tl } - } -\tl_const:Nn \c_msg_kernel_bug_text_tl - { This~is~a~LaTeX~bug:~check~coding! } -\tl_const:Nn \c_msg_kernel_bug_more_text_tl - { - There~is~a~coding~bug~somewhere~around~here. \\ - This~probably~needs~examining~by~an~expert. - \c_msg_return_text_tl - } +\msg_kernel_new:nnn { seq } { misused } + { A~sequence~was~misused. } +\msg_kernel_new:nnn { kernel } { bad-var } + { Erroneous~variable~#1 used! } +\msg_kernel_new:nnn { prg } { zero-step } + { Zero~step~size~for~stepwise~function~#1. } +\msg_kernel_new:nnn { seq } { show } + { + Sequence~\token_to_str:N #1~ + \seq_if_empty:NTF #1 + { is~empty } + { contains~the~items~(without~outer~braces): } + } +\msg_kernel_new:nnn { prop } { show } + { + Property~list~\token_to_str:N #1~ + \prop_if_empty:NTF #1 + { is~empty } + { contains~the~pairs~(without~outer~braces): } + } +\msg_kernel_new:nnn { clist } { show } + { + Comma~list~ + \str_if_eq:nnF {#1} { \l_clist_tmpa_clist } { \token_to_str:N #1~} + \clist_if_empty:NTF #1 + { is~empty } + { contains~the~items~(without~outer~braces): } + } +\msg_kernel_new:nnn { ior } { show-no-stream } + { No~input~streams~are~open } +\msg_kernel_new:nnn { ior } { show-open-streams } + { The~following~input~streams~are~in~use: } +\msg_kernel_new:nnn { iow } { show-no-stream } + { No~output~streams~are~open } +\msg_kernel_new:nnn { iow } { show-open-streams } + { The~following~output~streams~are~in~use: } \group_begin: \char_set_catcode_math_superscript:N \^ \char_set_lccode:nn {`^} {`\ } @@ -591,12 +609,92 @@ \exp_after:wN \exp_after:wN \exp_after:wN \c_zero } - \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } - \exp_not:N \q_stop + \exp_not:N \use:n { \exp_not:c { LaTeX3~error: } ^ #1 } ^ } - \cs_new:Npn \msg_expandable_error_aux:w #1 ^ #2 \q_stop { #1 } + \cs_new:Npn \msg_expandable_error_aux:w #1 ^ #2 ^ { #1 } } \group_end: +\cs_new:Npn \msg_expandable_kernel_error:nnnnnn #1#2#3#4#5#6 + { + \exp_args:Nf \msg_expandable_error:n + { + \exp_args:NNc \exp_after:wN \exp_stop_f: + { \c_msg_text_prefix_tl LaTeX / #1 / #2 } + {#3} {#4} {#5} {#6} + } + } +\cs_new:Npn \msg_expandable_kernel_error:nnnnn #1#2#3#4#5 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} {#3} {#4} {#5} { } + } +\cs_new:Npn \msg_expandable_kernel_error:nnnn #1#2#3#4 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} {#3} {#4} { } { } + } +\cs_new:Npn \msg_expandable_kernel_error:nnn #1#2#3 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} {#3} { } { } { } + } +\cs_new:Npn \msg_expandable_kernel_error:nn #1#2 + { + \msg_expandable_kernel_error:nnnnnn + {#1} {#2} { } { } { } { } + } +\tl_new:N \l_msg_show_tl +\cs_new_protected:Npn \msg_aux_use:nn #1#2 + { \msg_aux_use:nnxxxx {#1} {#2} { } { } { } { } } +\cs_new_protected:Npn \msg_aux_use:nnxxxx #1#2#3#4#5#6 + { + \iow_term:x + { + \use:c { \c_msg_text_prefix_tl #1 / #2 } + {#3} {#4} {#5} {#6} + } + } +\cs_new_protected:Npn \msg_aux_show:Nnx #1#2#3 + { + \cs_if_exist:NTF #1 + { + \msg_aux_use:nnxxxx { LaTeX / #2 } { show } {#1} { } { } { } + \msg_aux_show:x {#3} + } + { + \msg_kernel_error:nnx { kernel } { variable-not-defined } + { \token_to_str:N #1 } + } + } +\cs_new_protected:Npn \msg_aux_show:x #1 + { + \tl_set:Nx \l_msg_show_tl {#1} + \tl_if_empty:NT \l_msg_show_tl + { \tl_set:Nx \l_msg_show_tl { > } } + \exp_args:Nf \etex_showtokens:D + { + \exp_after:wN \exp_after:wN + \exp_after:wN \msg_aux_show:w + \exp_after:wN \l_msg_show_tl + \exp_after:wN + } + \prg_do_nothing: + } +\cs_new:Npn \msg_aux_show:w #1 > { } +\cs_new:Npn \msg_aux_show:n #1 + { + \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } + } +\cs_new:Npn \msg_aux_show:nn #1#2 + { + \iow_newline: > \c_space_tl \c_space_tl { \exp_not:n {#1} } + \c_space_tl \c_space_tl => \c_space_tl \c_space_tl { \exp_not:n {#2} } + } +\cs_new:Npn \msg_aux_show_unbraced:nn #1#2 + { + \iow_newline: > \c_space_tl \c_space_tl \exp_not:n {#1} + \c_space_tl \c_space_tl => \c_space_tl \c_space_tl \exp_not:n {#2} + } %% %% %% End of file `l3msg.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty index 45e1aa17ddb..e86d4214429 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prg.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prg.dtx 2915 2011-10-15 21:21:08Z bruno $ +\GetIdInfo$Id: l3prg.dtx 3014 2011-11-27 06:55:43Z bruno $ {L3 Experimental control structures} %% \ProvidesExplPackage @@ -377,45 +377,43 @@ \cs_new:cpn { prg_replicate_first_9:n } #1 { \c_zero #1#1#1#1#1#1#1#1#1 } \cs_new:Npn \prg_stepwise_function:nnnN #1#2#3#4 { - \int_compare:nNnTF {#2} = \c_zero - { \msg_expandable_error:n { Zero~step~size~for~stepwise~function. } } - { - \int_compare:nNnTF {#2} > \c_zero - { \exp_args:Nf \prg_stepwise_function_incr:nnnN } - { \exp_args:Nf \prg_stepwise_function_decr:nnnN } - { \int_eval:n {#1} } {#2} {#3} #4 - } + \prg_stepwise_aux:nnnN {#1} {#2} {#3} #4 + \prg_break_point:n { } } -\cs_new:Npn \prg_stepwise_function_incr:nnnN #1#2#3#4 +\cs_new:Npn \prg_stepwise_aux:nnnN #1#2#3#4 { - \int_compare:nNnF {#1} > {#3} + \int_compare:nNnTF {#2} > \c_zero + { \exp_args:NNf \prg_stepwise_aux:NnnnN > } { - #4 {#1} - \exp_args:Nf \prg_stepwise_function_incr:nnnN - { \int_eval:n { #1 + #2 } } {#2} {#3} #4 + \int_compare:nNnTF {#2} = \c_zero + { + \msg_expandable_kernel_error:nnn { prg } { zero-step } {#4} + \prg_map_break: + } + { \exp_args:NNf \prg_stepwise_aux:NnnnN < } } + { \int_eval:n {#1} } {#2} {#3} #4 } -\cs_new:Npn \prg_stepwise_function_decr:nnnN #1#2#3#4 +\cs_new:Npn \prg_stepwise_aux:NnnnN #1#2#3#4#5 { - \int_compare:nNnF {#1} < {#3} + \int_compare:nNnF {#2} #1 {#4} { - #4 {#1} - \exp_args:Nf \prg_stepwise_function_decr:nnnN - { \int_eval:n { #1 + #2 } } {#2} {#3} #4 + #5 {#2} + \exp_args:NNf \prg_stepwise_aux:NnnnN + #1 { \int_eval:n { #2 + #3 } } {#3} {#4} #5 } } -\int_new:N \g_prg_stepwise_level_int \cs_new_protected:Npn \prg_stepwise_inline:nnnn { \exp_args:NNc \prg_stepwise_aux:NNnnnn \cs_gset_nopar:Npn - { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n } + { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } } \cs_new_protected:Npn \prg_stepwise_variable:nnnNn #1#2#3#4#5 { \exp_args:NNc \prg_stepwise_aux:NNnnnn \cs_gset_nopar:Npx - { g_prg_stepwise_ \int_use:N \g_prg_stepwise_level_int :n } + { g_prg_stepwise_ \int_use:N \g_prg_map_int :n } {#1}{#2}{#3} { \tl_set:Nn \exp_not:N #4 {##1} @@ -425,9 +423,9 @@ \cs_new_protected:Npn \prg_stepwise_aux:NNnnnn #1#2#3#4#5#6 { #1 #2 ##1 {#6} - \int_gincr:N \g_prg_stepwise_level_int - \prg_stepwise_function:nnnN {#3}{#4}{#5} #2 - \int_gdecr:N \g_prg_stepwise_level_int + \int_gincr:N \g_prg_map_int + \prg_stepwise_aux:nnnN {#3} {#4} {#5} #2 + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } } \prg_new_conditional:Npnn \mode_if_vertical: { p , T , F , TF } { \if_mode_vertical: \prg_return_true: \else: \prg_return_false: \fi: } @@ -474,6 +472,7 @@ { \prg_variable_get_type_aux:w #2#3 \q_stop } } } +\int_new:N \g_prg_map_int \cs_new_protected_nopar:Npn \prg_define_quicksort:nnn #1#2#3 { \cs_set:cpx{#1_quicksort:n}##1{ \exp_not:c{#1_quicksort_start_partition:w} ##1 diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty index eebc40c2520..c3878515e49 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3prop.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3prop.dtx 2839 2011-09-17 20:18:23Z bruno $ +\GetIdInfo$Id: l3prop.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental property lists} %% \ProvidesExplPackage @@ -62,10 +62,10 @@ \cs_new_protected:Npn \prop_gclear:c #1 { \cs_gset_eq:cN {#1} \c_empty_prop } \cs_new_protected:Npn \prop_clear_new:N #1 { \cs_if_exist:NTF #1 { \prop_clear:N #1 } { \prop_new:N #1 } } -\cs_generate_variant:Nn \prop_clear_new:N {c} +\cs_generate_variant:Nn \prop_clear_new:N { c } \cs_new_protected:Npn \prop_gclear_new:N #1 { \cs_if_exist:NTF #1 { \prop_gclear:N #1 } { \prop_new:N #1 } } -\cs_new_eq:NN \prop_gclear_new:c \prop_gclear:c +\cs_generate_variant:Nn \prop_gclear_new:N { c } \cs_new_eq:NN \prop_set_eq:NN \tl_set_eq:NN \cs_new_eq:NN \prop_set_eq:Nc \tl_set_eq:Nc \cs_new_eq:NN \prop_set_eq:cN \tl_set_eq:cN @@ -74,7 +74,7 @@ \cs_new_eq:NN \prop_gset_eq:Nc \tl_gset_eq:Nc \cs_new_eq:NN \prop_gset_eq:cN \tl_gset_eq:cN \cs_new_eq:NN \prop_gset_eq:cc \tl_gset_eq:cc -\cs_set_protected:Npn \prop_split:NnTF #1#2 +\cs_new_protected:Npn \prop_split:NnTF #1#2 { \exp_args:NNo \prop_split_aux:NnTF #1 { \tl_to_str:n {#2} } } \cs_new_protected:Npn \prop_split_aux:NnTF #1#2 { @@ -86,7 +86,7 @@ } \cs_new:Npn \prop_split_aux:nnnn #1#2#3#4 { #3 #2 } \cs_new_protected:Npn \prop_split_aux:w { } -\cs_set_protected:Npn \prop_split:Nnn #1#2#3 +\cs_new_protected:Npn \prop_split:Nnn #1#2#3 { \prop_split:NnTF #1 {#2} {#3} @@ -187,21 +187,23 @@ \exp_last_unbraced:Noo \prop_if_in_aux:nwn { \tl_to_str:n {#2} } #1 \tl_to_str:n {#2} \q_prop { } - \q_recursion_tail \q_recursion_stop + \q_recursion_tail + \prg_break_point:n { } } \cs_new:Npn \prop_if_in_aux:nwn #1 \q_prop #2 \q_prop #3 { \str_if_eq:xxTF {#1} {#2} - { \prop_if_in_aux:Nw } + { \prop_if_in_aux:N } { \prop_if_in_aux:nwn {#1} } } -\cs_new:Npn \prop_if_in_aux:Nw #1 #2 \q_recursion_stop +\cs_new:Npn \prop_if_in_aux:N #1 { \if_meaning:w \q_prop #1 \prg_return_true: \else: \prg_return_false: \fi: + \prop_map_break: } \cs_generate_variant:Nn \prop_if_in_p:Nn { NV , No } \cs_generate_variant:Nn \prop_if_in_p:Nn { c , cV , co } @@ -231,7 +233,8 @@ \cs_new_nopar:Npn \prop_map_function:NN #1#2 { \exp_last_unbraced:NNo \prop_map_function_aux:Nwn #2 - #1 \q_recursion_tail \q_prop { } \q_recursion_stop + #1 \q_recursion_tail \q_prop { } + \prg_break_point:n { } } \cs_new:Npn \prop_map_function_aux:Nwn #1 \q_prop #2 \q_prop #3 { @@ -243,47 +246,27 @@ } \cs_generate_variant:Nn \prop_map_function:NN { Nc } \cs_generate_variant:Nn \prop_map_function:NN { c , cc } -\int_new:N \g_prop_map_inline_int \cs_new_protected:Npn \prop_map_inline:Nn #1#2 { - \int_gincr:N \g_prop_map_inline_int - \cs_gset:cpn { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } + \int_gincr:N \g_prg_map_int + \cs_gset:cpn { prop_map_inline_ \int_use:N \g_prg_map_int :nn } ##1##2 {#2} - \prop_map_function:Nc #1 - { prop_map_inline_ \int_use:N \g_prop_map_inline_int :nn } - \int_gdecr:N \g_prop_map_inline_int + \exp_last_unbraced:Nco \prop_map_function_aux:Nwn + { prop_map_inline_ \int_use:N \g_prg_map_int :nn } + #1 + \q_recursion_tail \q_prop { } + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } } \cs_generate_variant:Nn \prop_map_inline:Nn { c } -\cs_new_eq:NN \prop_map_break: \use_none_delimit_by_q_recursion_stop:w -\cs_new_eq:NN \prop_map_break:n \use_i_delimit_by_q_recursion_stop:nw -\tl_new:N \l_prop_show_tl +\cs_new_eq:NN \prop_map_break: \prg_map_break: +\cs_new_eq:NN \prop_map_break:n \prg_map_break:n \cs_new_protected_nopar:Npn \prop_show:N #1 { - \prop_if_empty:NTF #1 - { - \iow_term:x { Property~list~\token_to_str:N #1~is~empty } - \tl_show:n { } - } - { - \iow_term:x - { - Property~list~\token_to_str:N #1~ - contains~the~pairs~(without~outer~braces): - } - \tl_set:Nx \l_prop_show_tl - { \prop_map_function:NN #1 \prop_show_aux:nn } - \tl_show:n \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \prop_show_aux:w \l_prop_show_tl } - } - } -\cs_new:Npn \prop_show_aux:nn #1#2 - { - \iow_newline: > \c_space_tl \c_space_tl - \iow_char:N \{ #1 \iow_char:N \} - \c_space_tl \c_space_tl => \c_space_tl \c_space_tl - \iow_char:N \{ \exp_not:n {#2} \iow_char:N \} + \msg_aux_show:Nnx + #1 + { prop } + { \prop_map_function:NN #1 \msg_aux_show:nn } } -\cs_new:Npn \prop_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \prop_show:N { c } \prg_new_protected_conditional:Npnn \prop_pop:NnN #1#2#3 { T , F , TF } { @@ -312,7 +295,8 @@ \cs_new:Npn \prop_map_tokens:Nn #1#2 { \exp_last_unbraced:Nno \prop_map_tokens_aux:nwn {#2} #1 - \q_recursion_tail \q_prop { } \q_recursion_stop + \q_recursion_tail \q_prop { } + \prg_break_point:n { } } \cs_new:Npn \prop_map_tokens_aux:nwn #1 \q_prop #2 \q_prop #3 { diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty index 3ff98eab3dc..31102e00c73 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3quark.sty @@ -46,7 +46,7 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3quark.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3quark.dtx 3014 2011-11-27 06:55:43Z bruno $ {L3 Experimental quarks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} @@ -60,13 +60,13 @@ \quark_new:N \q_recursion_stop \cs_new:Npn \quark_if_recursion_tail_stop:N #1 { - \if_meaning:w #1 \q_recursion_tail + \if_meaning:w \q_recursion_tail #1 \exp_after:wN \use_none_delimit_by_q_recursion_stop:w \fi: } \cs_new:Npn \quark_if_recursion_tail_stop_do:Nn #1 { - \if_meaning:w #1 \q_recursion_tail + \if_meaning:w \q_recursion_tail #1 \exp_after:wN \use_i_delimit_by_q_recursion_stop:nw \else: \exp_after:wN \use_none:n @@ -90,6 +90,19 @@ } \cs_generate_variant:Nn \quark_if_recursion_tail_stop:n { o } \cs_generate_variant:Nn \quark_if_recursion_tail_stop_do:nn { o } +\cs_new:Npn \quark_if_recursion_tail_break:N #1 + { + \if_meaning:w \q_recursion_tail #1 + \exp_after:wN \prg_map_break: + \fi: + } +\cs_new:Npn \quark_if_recursion_tail_break:n #1 + { + \if_int_compare:w \pdftex_strcmp:D + { \exp_not:N \q_recursion_tail } { \exp_not:n {#1} } = \c_zero + \exp_after:wN \prg_map_break: + \fi: + } \prg_new_conditional:Nnn \quark_if_nil:N { p, T , F , TF } { \if_meaning:w \q_nil #1 diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty index 0489e8e2378..adfb1684b43 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3seq.sty @@ -46,14 +46,14 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3seq.dtx 2896 2011-10-09 20:36:50Z joseph $ +\GetIdInfo$Id: l3seq.dtx 3033 2011-12-07 10:12:21Z joseph $ {L3 Experimental sequences and stacks} \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: \cs_new:Npn \seq_item:n { - \msg_expandable_error:n { A~sequence~was~used~incorrectly. } + \msg_expandable_kernel_error:nn { seq } { misused } \use_none:n } \tl_new:N \l_seq_tmpa_tl @@ -76,6 +76,38 @@ \cs_new_eq:NN \seq_gset_eq:Nc \tl_gset_eq:Nc \cs_new_eq:NN \seq_gset_eq:cN \tl_gset_eq:cN \cs_new_eq:NN \seq_gset_eq:cc \tl_gset_eq:cc +\cs_new_protected_nopar:Npn \seq_set_split:Nnn + { \seq_set_split_aux:NNnn \tl_set:Nx } +\cs_new_protected_nopar:Npn \seq_gset_split:Nnn + { \seq_set_split_aux:NNnn \tl_gset:Nx } +\cs_new_protected_nopar:Npn \seq_set_split_aux:NNnn #1 #2 #3 #4 + { + \tl_if_empty:nTF {#3} + { #1 #2 { \tl_map_function:nN {#4} \seq_wrap_item:n } } + { + \tl_set:Nn \l_seq_tmpa_tl + { + \seq_set_split_aux_i:w \prg_do_nothing: + #4 + \seq_set_split_aux_end: + } + \tl_replace_all:Nnn \l_seq_tmpa_tl { #3 } + { + \seq_set_split_aux_end: + \seq_set_split_aux_i:w \prg_do_nothing: + } + \tl_set:Nx \l_seq_tmpa_tl { \l_seq_tmpa_tl } + #1 #2 { \l_seq_tmpa_tl } + } + } +\cs_new:Npn \seq_set_split_aux_i:w #1 \seq_set_split_aux_end: + { + \exp_not:N \seq_set_split_aux_ii:w + \exp_args:No \tl_trim_spaces:n {#1} + \exp_not:N \seq_set_split_aux_end: + } +\cs_new:Npn \seq_set_split_aux_ii:w #1 \seq_set_split_aux_end: + { \seq_wrap_item:n {#1} } \cs_new_protected_nopar:Npn \seq_concat:NNN #1#2#3 { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } } \cs_new_protected_nopar:Npn \seq_gconcat:NNN #1#2#3 @@ -98,6 +130,7 @@ \cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx } \cs_generate_variant:Nn \seq_gput_right:Nn { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_gput_right:Nn { c , cV , cv , co , cx } +\cs_new:Npn \seq_wrap_item:n #1 { \exp_not:n { \seq_item:n {#1} } } \seq_new:N \l_seq_remove_seq \cs_new_protected:Npn \seq_remove_duplicates:N { \seq_remove_duplicates_aux:NN \seq_set_eq:NN } @@ -133,7 +166,7 @@ \tl_if_eq:NNT \l_seq_tmpa_tl \l_seq_tmpb_tl { \use_none:nn } } - \exp_not:n { \seq_item:n {##1} } + \seq_wrap_item:n {##1} } \tl_set:Nn \l_seq_tmpa_tl {#3} #1 #2 {#2} @@ -159,7 +192,7 @@ } #1 \seq_break:n { \prg_return_false: } - \seq_break_point:n { \group_end: } + \prg_break_point:n { \group_end: } } \cs_new_nopar:Npn \seq_if_in_aux: { \seq_break:n { \prg_return_true: } } \cs_generate_variant:Nn \seq_if_in:NnT { NV , Nv , No , Nx } @@ -172,7 +205,7 @@ { \seq_if_empty_err_break:N #1 \exp_after:wN \seq_get_left_aux:NnwN #1 \q_stop #2 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected:Npn \seq_get_left_aux:NnwN \seq_item:n #1#2 \q_stop #3 { \tl_set:Nn #3 {#1} } @@ -185,7 +218,7 @@ { \seq_if_empty_err_break:N #2 \exp_after:wN \seq_pop_left_aux:NnwNNN #2 \q_stop #1#2#3 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected:Npn \seq_pop_left_aux:NnwNNN \seq_item:n #1#2 \q_stop #3#4#5 { @@ -198,7 +231,7 @@ { \seq_if_empty_err_break:N #1 \seq_get_right_aux:NN #1#2 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected_nopar:Npn \seq_get_right_aux:NN #1#2 { @@ -226,11 +259,11 @@ { \seq_if_empty_err_break:N #2 \seq_pop_right_aux_ii:NNN #1 #2 #3 - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_protected_nopar:Npn \seq_pop_right_aux_ii:NNN #1#2#3 { - \seq_push_item_def:n { \exp_not:n { \seq_item:n {##1} } } + \seq_push_item_def:n { \seq_wrap_item:n {##1} } #1 #2 { \if_false: } \fi: \exp_after:wN \exp_after:wN \exp_after:wN \seq_get_right_loop:nn \exp_after:wN \use_none:n #2 @@ -246,11 +279,10 @@ } \cs_generate_variant:Nn \seq_pop_right:NN { c } \cs_generate_variant:Nn \seq_gpop_right:NN { c } -\cs_new:Npn \seq_break: #1 \seq_break_point:n #2 {#2} -\cs_new:Npn \seq_break:n #1#2 \seq_break_point:n #3 { #3 #1 } -\cs_new_eq:NN \seq_map_break: \seq_break: -\cs_new_eq:NN \seq_map_break:n \seq_break:n -\cs_new_eq:NN \seq_break_point:n \use:n +\cs_new_eq:NN \seq_break: \prg_map_break: +\cs_new_eq:NN \seq_break:n \prg_map_break:n +\cs_new_eq:NN \seq_map_break: \prg_map_break: +\cs_new_eq:NN \seq_map_break:n \prg_map_break:n \cs_new_protected_nopar:Npn \seq_if_empty_err_break:N #1 { \if_meaning:w #1 \c_empty_tl @@ -262,7 +294,7 @@ { \exp_after:wN \seq_map_function_aux:NNn \exp_after:wN #2 #1 { ? \seq_map_break: } { } - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new:Npn \seq_map_function_aux:NNn #1#2#3 { @@ -283,21 +315,21 @@ } \cs_new_protected:Npn \seq_push_item_def_aux: { - \cs_gset_eq:cN { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + \cs_gset_eq:cN { seq_item_ \int_use:N \g_prg_map_int :n } \seq_item:n - \int_gincr:N \g_seq_nesting_depth_int + \int_gincr:N \g_prg_map_int } \cs_new_protected_nopar:Npn \seq_pop_item_def: { - \int_gdecr:N \g_seq_nesting_depth_int + \int_gdecr:N \g_prg_map_int \cs_gset_eq:Nc \seq_item:n - { seq_item_ \int_use:N \g_seq_nesting_depth_int :n } + { seq_item_ \int_use:N \g_prg_map_int :n } } \cs_new_protected:Npn \seq_map_inline:Nn #1#2 { \seq_push_item_def:n {#2} #1 - \seq_break_point:n { \seq_pop_item_def: } + \prg_break_point:n { \seq_pop_item_def: } } \cs_generate_variant:Nn \seq_map_inline:Nn { c } \cs_new_protected:Npn \seq_map_variable:NNn #1#2#3 @@ -308,7 +340,7 @@ \exp_not:n {#3} } #1 - \seq_break_point:n { \seq_pop_item_def: } + \prg_break_point:n { \seq_pop_item_def: } } \cs_generate_variant:Nn \seq_map_variable:NNn { Nc } \cs_generate_variant:Nn \seq_map_variable:NNn { c , cc } @@ -338,32 +370,13 @@ \cs_new_eq:NN \seq_pop:cN \seq_pop_left:cN \cs_new_eq:NN \seq_gpop:NN \seq_gpop_left:NN \cs_new_eq:NN \seq_gpop:cN \seq_gpop_left:cN -\tl_new:N \l_seq_show_tl \cs_new_protected_nopar:Npn \seq_show:N #1 { - \seq_if_empty:NTF #1 - { - \iow_term:x { Sequence~\token_to_str:N #1~is~empty } - \tl_show:n { } - } - { - \iow_term:x - { - Sequence~\token_to_str:N #1~ - contains~the~items~(without~outer~braces): - } - \tl_set:Nx \l_seq_show_tl - { \seq_map_function:NN #1 \seq_show_aux:n } - \etex_showtokens:D \exp_after:wN \exp_after:wN \exp_after:wN - { \exp_after:wN \seq_show_aux:w \l_seq_show_tl } - } - } -\cs_new:Npn \seq_show_aux:n #1 - { - \iow_newline: > \c_space_tl \c_space_tl - \iow_char:N \{ \exp_not:n {#1} \iow_char:N \} + \msg_aux_show:Nnx + #1 + { seq } + { \seq_map_function:NN #1 \msg_aux_show:n } } -\cs_new:Npn \seq_show_aux:w #1 > ~ { } \cs_generate_variant:Nn \seq_show:N { c } \cs_new_nopar:Npn \seq_if_empty_break_return_false:N #1 { @@ -378,14 +391,14 @@ \exp_after:wN \seq_get_left_aux:Nw #1 \q_stop #2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_get_right:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \seq_get_right_aux:NN #1#2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \cs_generate_variant:Nn \seq_get_left:NNT { c } \cs_generate_variant:Nn \seq_get_left:NNF { c } @@ -398,28 +411,28 @@ \seq_if_empty_break_return_false:N #1 \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_set:Nn #1#2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_gpop_left:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \exp_after:wN \seq_pop_left_aux:NnwNNN #1 \q_stop \tl_gset:Nn #1#2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_pop_right:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \seq_pop_right_aux_ii:NNN \tl_set:Nx #1 #2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \prg_new_protected_conditional:Npnn \seq_gpop_right:NN #1#2 { T , F , TF } { \seq_if_empty_break_return_false:N #1 \seq_pop_right_aux_ii:NNN \tl_gset:Nx #1 #2 \prg_return_true: \seq_break: - \seq_break_point:n { } + \prg_break_point:n { } } \cs_generate_variant:Nn \seq_pop_left:NNT { c } \cs_generate_variant:Nn \seq_pop_left:NNF { c } @@ -457,14 +470,14 @@ #1 { ? \seq_break: } { } - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_nopar:Npn \seq_item_aux:nnn #1#2#3 { \use_none:n #2 \int_compare:nNnTF {#1} = \c_zero { \seq_break:n {#3} } - { \exp_args:Nf \seq_item_aux:nnn { #1 - 1 } } + { \exp_args:Nf \seq_item_aux:nnn { \int_eval:n { #1 - 1 } } } } \cs_generate_variant:Nn \seq_item:Nn { c } \cs_new_nopar:Npn \seq_use:N #1 { \seq_map_function:NN #1 \use:n } @@ -476,7 +489,7 @@ \exp_after:wN #1 #2 { ? \seq_break: } { } - \seq_break_point:n { } + \prg_break_point:n { } } \cs_new_nopar:Npn \seq_mapthread_function_aux:NN #1#2 { @@ -515,64 +528,31 @@ \tl_gset:Nx #1 { \clist_map_function:nN {#2} \seq_wrap_item:n } } -\cs_new:Npn \seq_wrap_item:n #1 { \exp_not:n { \seq_item:n {#1} } } \cs_generate_variant:Nn \seq_set_from_clist:NN { Nc } \cs_generate_variant:Nn \seq_set_from_clist:NN { c , cc } \cs_generate_variant:Nn \seq_set_from_clist:Nn { c } \cs_generate_variant:Nn \seq_gset_from_clist:NN { Nc } \cs_generate_variant:Nn \seq_gset_from_clist:NN { c , cc } \cs_generate_variant:Nn \seq_gset_from_clist:Nn { c } -\cs_new_protected_nopar:Npn \seq_tmp:w - { \msg_expandable_error:n { There~is~a~bug~in~LaTeX3! } } -\cs_new_protected_nopar:Npn \seq_set_reverse:N +\cs_new_protected_nopar:Npn \seq_tmp:w { } +\cs_new_protected_nopar:Npn \seq_reverse:N { \seq_reverse_aux:NN \tl_set:Nx } -\cs_new_protected_nopar:Npn \seq_gset_reverse:N +\cs_new_protected_nopar:Npn \seq_greverse:N { \seq_reverse_aux:NN \tl_gset:Nx } \cs_new_protected_nopar:Npn \seq_reverse_aux:NN #1 #2 { \cs_set_eq:NN \seq_tmp:w \seq_item:n - \cs_set_eq:NN \seq_item:n \seq_reverse_aux_item:w - #1 #2 { #2 \prg_do_nothing: } + \cs_set_eq:NN \seq_item:n \seq_reverse_aux_item:nwn + #1 #2 { #2 \exp_not:n { } } \cs_set_eq:NN \seq_item:n \seq_tmp:w } -\cs_new:Npn \seq_reverse_aux_item:w #1 #2 \prg_do_nothing: +\cs_new:Npn \seq_reverse_aux_item:nwn #1 #2 \exp_not:n #3 { #2 - \prg_do_nothing: - \exp_not:n { \seq_item:n {#1} } - } -\cs_new_protected_nopar:Npn \seq_set_split:Nnn - { \seq_set_split_aux:NNnn \tl_set:Nx } -\cs_new_protected_nopar:Npn \seq_gset_split:Nnn - { \seq_set_split_aux:NNnn \tl_gset:Nx } -\cs_new_protected_nopar:Npn \seq_set_split_aux:NNnn #1 #2 #3 #4 - { - \tl_if_empty:nTF {#4} - { #1 #2 { } } - { - \tl_set:Nn \l_seq_tmpa_tl - { - \seq_set_split_aux_i:w \prg_do_nothing: - #4 - \seq_set_split_aux_end: - } - \tl_replace_all:Nnn \l_seq_tmpa_tl { #3 } - { - \seq_set_split_aux_end: - \seq_set_split_aux_i:w \prg_do_nothing: - } - \tl_set:Nx \l_seq_tmpa_tl { \l_seq_tmpa_tl } - #1 #2 { \l_seq_tmpa_tl } - } - } -\cs_new:Npn \seq_set_split_aux_i:w #1 \seq_set_split_aux_end: - { - \exp_not:N \seq_set_split_aux_ii:w - \exp_args:No \tl_trim_spaces:n {#1} - \exp_not:N \seq_set_split_aux_end: + \exp_not:n { \seq_item:n {#1} #3 } } -\cs_new:Npn \seq_set_split_aux_ii:w #1 \seq_set_split_aux_end: - { \exp_not:n { \seq_item:n {#1} } } +\cs_generate_variant:Nn \seq_reverse:N { c } +\cs_generate_variant:Nn \seq_greverse:N { c } %% %% %% End of file `l3seq.sty'. diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty index 605733e8580..40bcb9caad3 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3skip.sty @@ -46,8 +46,9 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3skip.dtx 2959 2011-11-14 21:47:18Z joseph $ +\GetIdInfo$Id: l3skip.dtx 3029 2011-12-06 22:47:30Z joseph $ {L3 Experimental dimensions and skips} + \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: @@ -224,6 +225,8 @@ \cs_generate_variant:Nn \dim_use:N { c } \cs_new_eq:NN \dim_show:N \kernel_register_show:N \cs_generate_variant:Nn \dim_show:N { c } +\cs_new_protected:Npn \dim_show:n #1 + { \tex_showthe:D \dim_eval:w #1 \dim_eval_end: } \cs_new_eq:NN \c_zero_dim \z@ \cs_new_eq:NN \c_max_dim \maxdimen \dim_new:N \l_tmpa_dim @@ -296,6 +299,8 @@ \cs_generate_variant:Nn \skip_vertical:N { c } \cs_new_eq:NN \skip_show:N \kernel_register_show:N \cs_generate_variant:Nn \skip_show:N { c } +\cs_new_protected:Npn \skip_show:n #1 + { \tex_showthe:D \etex_glueexpr:D #1 \scan_stop: } \cs_new_eq:NN \c_zero_skip \c_zero_dim \cs_new_eq:NN \c_max_skip \c_max_dim \skip_new:N \l_tmpa_skip @@ -341,6 +346,8 @@ \cs_generate_variant:Nn \muskip_use:N { c } \cs_new_eq:NN \muskip_show:N \kernel_register_show:N \cs_generate_variant:Nn \muskip_show:N { c } +\cs_new_protected:Npn \muskip_show:n #1 + { \tex_showthe:D \etex_muexpr:D #1 \scan_stop: } \cs_new:Npn \skip_split_finite_else_action:nnNN #1#2#3#4 { \skip_if_infinite_glue:nTF {#1} diff --git a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty index cd04f11ddb4..f22f7bd8d66 100644 --- a/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty +++ b/Master/texmf-dist/tex/latex/l3kernel/l3tl.sty @@ -46,8 +46,10 @@ %% %% ----------------------------------------------------------------------- \RequirePackage{l3names} -\GetIdInfo$Id: l3tl.dtx 2929 2011-10-22 13:00:20Z bruno $ +\GetIdInfo$Id: l3tl.dtx 3034 2011-12-07 11:40:25Z bruno $ {L3 Experimental token lists} + + \ProvidesExplPackage {\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription} \package_check_loaded_expl: @@ -69,6 +71,7 @@ } \cs_generate_variant:Nn \tl_const:Nn { c } \cs_generate_variant:Nn \tl_const:Nx { c } +\tl_const:Nn \c_empty_tl { } \cs_new_protected_nopar:Npn \tl_clear:N #1 { \tl_set_eq:NN #1 \c_empty_tl } \cs_new_protected_nopar:Npn \tl_gclear:N #1 @@ -188,27 +191,10 @@ \c_tl_rescan_marker_tl { \tl_set:Nn \exp_not:N \l_tl_rescan_tl {##1} } } -\cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno } -\cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno } -\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { Nno , Nnx } +\cs_generate_variant:Nn \tl_set_rescan:Nnn { c , cno , cnx } +\cs_generate_variant:Nn \tl_gset_rescan:Nnn { Nno , Nnx } \cs_generate_variant:Nn \tl_gset_rescan:Nnn { c , cno } -\cs_new_protected_nopar:Npn \tl_set_rescan:Nnx - { \tl_set_rescan_aux:NNnx \tl_set:Nn } -\cs_new_protected_nopar:Npn \tl_gset_rescan:Nnx - { \tl_set_rescan_aux:NNnx \tl_gset:Nn } -\cs_new_protected_nopar:Npn \tl_set_rescan_aux:NNnx #1#2#3#4 - { - \group_begin: - \etex_everyeof:D { \exp_not:N } - \tex_endlinechar:D \c_minus_one - \tex_newlinechar:D \c_minus_one - #3 - \tl_set:Nx \l_tl_rescan_tl { \etex_scantokens:D {#4} } - \exp_args:NNNo \group_end: - #1 #2 \l_tl_rescan_tl - } -\cs_generate_variant:Nn \tl_set_rescan:Nnx { c } -\cs_generate_variant:Nn \tl_gset_rescan:Nnx { c } \cs_new_protected:Npn \tl_rescan:nn #1#2 { \group_begin: @@ -371,63 +357,59 @@ \cs_generate_variant:Nn \tl_if_in:nnF { V , o , no } \cs_generate_variant:Nn \tl_if_in:nnTF { V , o , no } \cs_new:Npn \tl_map_function:nN #1#2 - { \tl_map_function_aux:Nn #2 #1 \q_recursion_tail \q_recursion_stop } -\cs_new_nopar:Npn \tl_map_function:NN #1#2 { - \exp_after:wN \tl_map_function_aux:Nn - \exp_after:wN #2 #1 \q_recursion_tail \q_recursion_stop + \tl_map_function_aux:Nn #2 #1 + \q_recursion_tail + \prg_break_point:n { } } +\cs_new_nopar:Npn \tl_map_function:NN + { \exp_args:No \tl_map_function:nN } \cs_new:Npn \tl_map_function_aux:Nn #1#2 { - \quark_if_recursion_tail_stop:n {#2} + \quark_if_recursion_tail_break:n {#2} #1 {#2} \tl_map_function_aux:Nn #1 } \cs_generate_variant:Nn \tl_map_function:NN { c } \cs_new_protected:Npn \tl_map_inline:nn #1#2 { - \int_gincr:N \g_tl_inline_level_int - \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } + \int_gincr:N \g_prg_map_int + \cs_gset:cpn { tl_map_inline_ \int_use:N \g_prg_map_int :n } ##1 {#2} \exp_args:Nc \tl_map_function_aux:Nn - { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } - #1 \q_recursion_tail \q_recursion_stop - \int_gdecr:N \g_tl_inline_level_int - } -\cs_new_protected:Npn \tl_map_inline:Nn #1#2 - { - \int_gincr:N \g_tl_inline_level_int - \cs_gset:cpn { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } - ##1 {#2} - \exp_last_unbraced:NcV \tl_map_function_aux:Nn - { tl_map_inline_ \int_use:N \g_tl_inline_level_int :n } - #1 \q_recursion_tail\q_recursion_stop - \int_gdecr:N \g_tl_inline_level_int + { tl_map_inline_ \int_use:N \g_prg_map_int :n } + #1 \q_recursion_tail + \prg_break_point:n { \int_gdecr:N \g_prg_map_int } } +\cs_new_protected:Npn \tl_map_inline:Nn + { \exp_args:No \tl_map_inline:nn } \cs_generate_variant:Nn \tl_map_inline:Nn { c } \cs_new_protected:Npn \tl_map_variable:nNn #1#2#3 - { \tl_map_variable_aux:Nnn #2 {#3} #1 \q_recursion_tail \q_recursion_stop } + { + \tl_map_variable_aux:Nnn #2 {#3} #1 + \q_recursion_tail + \prg_break_point:n { } + } \cs_new_protected_nopar:Npn \tl_map_variable:NNn { \exp_args:No \tl_map_variable:nNn } \cs_new_protected:Npn \tl_map_variable_aux:Nnn #1#2#3 { \tl_set:Nn #1 {#3} - \quark_if_recursion_tail_stop:N #1 - #2 \tl_map_variable_aux:Nnn #1 {#2} + \quark_if_recursion_tail_break:N #1 + \use:n {#2} + \tl_map_variable_aux:Nnn #1 {#2} } \cs_generate_variant:Nn \tl_map_variable:NNn { c } -\cs_new_eq:NN \tl_map_break: \use_none_delimit_by_q_recursion_stop:w +\cs_new_eq:NN \tl_map_break: \prg_map_break: +\cs_new_eq:NN \tl_map_break:n \prg_map_break:n \cs_new_eq:NN \tl_to_str:n \etex_detokenize:D \cs_new_nopar:Npn \tl_to_str:N #1 { \etex_detokenize:D \exp_after:wN {#1} } \cs_generate_variant:Nn \tl_to_str:N { c } -\cs_new_eq:NN \tl_use:N \prg_do_nothing: -\cs_new_nopar:Npn \tl_use:c #1 +\cs_new_nopar:Npn \tl_use:N #1 { - \if_cs_exist:w #1 \cs_end: - \cs:w #1 \exp_after:wN \cs_end: - \else: - \msg_expandable_error:n { Undefined~variable~name~'#1'! } - \fi: + \cs_if_exist:NTF #1 {#1} + { \msg_expandable_kernel_error:nnn { kernel } { bad-var } {#1} } } +\cs_generate_variant:Nn \tl_use:N { c } \cs_new:Npn \tl_length:n #1 { \int_eval:n @@ -438,17 +420,24 @@ \int_eval:n { 0 \tl_map_function:NN #1 \tl_length_aux:n } } -\cs_new:Npn \tl_length_aux:n #1 { + 1 } +\cs_new:Npn \tl_length_aux:n #1 { + \c_one } \cs_generate_variant:Nn \tl_length:n { V , o } \cs_generate_variant:Nn \tl_length:N { c } \cs_new:Npn \tl_reverse_items:n #1 - { \tl_reverse_items_aux:nw #1 \q_recursion_tail \q_recursion_stop } -\cs_new:Npn \tl_reverse_items_aux:nw #1 #2 \q_recursion_stop { - \quark_if_recursion_tail_stop_do:nn {#1} { \use_none:n } - \tl_reverse_items_aux:nw #2 \q_recursion_stop - {#1} + \tl_reverse_items_aux:nwNwn #1 ? + \q_mark \tl_reverse_items_aux:nwNwn + \q_mark \tl_reverse_items_aux:wn + \q_stop { } + } +\cs_new:Npn \tl_reverse_items_aux:nwNwn #1 #2 \q_mark #3 #4 \q_stop #5 + { + #3 #2 + \q_mark \tl_reverse_items_aux:nwNwn + \q_mark \tl_reverse_items_aux:wn + \q_stop { {#1} #5 } } +\cs_new:Npn \tl_reverse_items_aux:wn #1 \q_stop #2 { \use_none:nn #2 } \cs_set:Npn \tl_tmp:w #1 { \cs_new:Npn \tl_trim_spaces:n ##1 @@ -603,27 +592,20 @@ } \prg_new_conditional:Npnn \tl_if_head_space:n #1 { p , T , F , TF } { - \if_int_compare:w - \pdftex_strcmp:D - { } - { \tl_if_head_space_aux:w \prg_do_nothing: #1 ? ~ } - = \c_zero - \prg_return_true: - \else: - \prg_return_false: - \fi: + \tex_romannumeral:D \if_false: { \fi: + \tl_if_head_space_aux:w ? #1 ? ~ } } -\cs_new:Npn \tl_if_head_space_aux:w #1 ~ % +\cs_new:Npn \tl_if_head_space_aux:w #1 ~ { - \exp_not:o {#1} - \if_false: { \fi: } + \tl_if_empty:oTF { \use_none:n #1 } + { \exp_after:wN \c_zero \exp_after:wN \prg_return_true: } + { \exp_after:wN \c_zero \exp_after:wN \prg_return_false: } \exp_after:wN \use_none:n \exp_after:wN { \if_false: } \fi: } \cs_new_protected:Npn \tl_show:N #1 { \cs_show:N #1 } \cs_generate_variant:Nn \tl_show:N { c } \cs_new_eq:NN \tl_show:n \etex_showtokens:D \tl_const:Nx \c_job_name_tl { \tex_jobname:D } -\tl_const:Nn \c_empty_tl { } \tl_const:Nn \c_space_tl { ~ } \tl_new:N \g_tmpa_tl \tl_new:N \g_tmpb_tl @@ -733,8 +715,11 @@ { \tl_act_reverse_output:n { {#2} } } \cs_generate_variant:Nn \tl_reverse:n { o , V } \cs_new_protected_nopar:Npn \tl_reverse:N #1 - { \tl_set:No #1 { \etex_unexpanded:D \tl_reverse:o { #1 { } } } } -\cs_generate_variant:Nn \tl_reverse:N { c } + { \tl_set:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } +\cs_new_protected_nopar:Npn \tl_greverse:N #1 + { \tl_gset:Nf #1 { \tl_reverse:o { #1 \exp_stop_f: } } } +\cs_generate_variant:Nn \tl_reverse:N { c } +\cs_generate_variant:Nn \tl_greverse:N { c } \cs_new:Npn \tl_length_tokens:n #1 { \int_eval:n @@ -786,6 +771,30 @@ \exp_after:wN \tl_act_output:n \exp_after:wN { \exp_after:wN { \tex_romannumeral:D \tl_act_case_aux:nn {#1} {#2} } } } +\cs_new:Npn \tl_item:nn #1#2 + { + \exp_args:Nf \tl_item_aux:nn + { + \int_eval:n + { + \int_compare:nNnT {#2} < \c_zero + { \tl_length:n {#1} + } + #2 + } + } + #1 + \q_recursion_tail + \prg_break_point:n { } + } +\cs_new_nopar:Npn \tl_item_aux:nn #1#2 + { + \quark_if_recursion_tail_break:n {#2} + \int_compare:nNnTF {#1} = \c_zero + { \tl_map_break:n {#2} } + { \exp_args:Nf \tl_item_aux:nn { \int_eval:n { #1 - 1 } } } + } +\cs_new_nopar:Npn \tl_item:Nn { \exp_args:No \tl_item:nn } +\cs_generate_variant:Nn \tl_item:Nn { c } %% %% %% End of file `l3tl.sty'. |