diff options
author | Karl Berry <karl@freefriends.org> | 2013-07-28 21:53:53 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-07-28 21:53:53 +0000 |
commit | 476ef285597d50560f829ffd64532d75d937d06a (patch) | |
tree | 5c652f3fb3c6e7458bb762f660a005e2f77c3f80 /Master/texmf-dist/source/latex/l3kernel/l3seq.dtx | |
parent | 9cad0f5f2f5f3df83a79cca1d848bf3a5feef241 (diff) |
latex3 (28jul13)
git-svn-id: svn://tug.org/texlive/trunk@31299 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3seq.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3seq.dtx | 327 |
1 files changed, 182 insertions, 145 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx b/Master/texmf-dist/source/latex/l3kernel/l3seq.dtx index 82c08c35f60..a697739d8da 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{l3bootstrap} -\GetIdInfo$Id: l3seq.dtx 4500 2013-05-26 11:18:19Z bruno $ +\GetIdInfo$Id: l3seq.dtx 4581 2013-07-28 08:38:50Z joseph $ {L3 Sequences and stacks} %</driver|package> %<*driver> @@ -719,9 +719,14 @@ % % \section{Internal sequence functions} % +% \begin{variable}{\s__seq} +% This scan mark (equal to \cs{scan_stop:}) marks the beginning of a +% sequence variable. +% \end{variable} +% % \begin{function}[EXP]{\__seq_item:n} % \begin{syntax} -% \cs{__seq_item:n} \meta{item} +% \cs{__seq_item:n} \Arg{item} % \end{syntax} % The internal token used to begin each sequence entry. If expanded % outside of a mapping or manipulation function, an error will be @@ -770,15 +775,19 @@ %</package> % \end{macrocode} % -% A sequence is a control sequence whose top-level expansion is of -% the form \enquote{\cs{@@_item:n} \marg{item_1} -% \ldots \cs{@@_item:n} \marg{item_n}}. An earlier implementation -% used the structure \enquote{\cs{seq_elt:w} \meta{item_1} -% \cs{seq_elt_end:} \ldots \cs{seq_elt:w} \meta{item_n} -% \cs{seq_elt_end:}}. This allows rapid searching using a delimited -% function, but is not suitable for items containing |{|, |}| and |#| -% tokens, and also leads to the loss of surrounding braces -% around items. +% A sequence is a control sequence whose top-level expansion is of the +% form \enquote{\cs{s_@@} \cs{@@_item:n} \marg{item_1} \ldots +% \cs{@@_item:n} \marg{item_n} \cs{s_obj_end}}, with a leading scan +% mark, $n$~items of the same form, and a trailing scan mark. An +% earlier implementation used the structure \enquote{\cs{seq_elt:w} +% \meta{item_1} \cs{seq_elt_end:} \ldots \cs{seq_elt:w} \meta{item_n} +% \cs{seq_elt_end:}}. This allowed rapid searching using a delimited +% function, but was not suitable for items containing |{|, |}| and |#| +% tokens, and also lead to the loss of surrounding braces around items. +% +% \begin{variable}{\s_@@} +% The variable is defined in the \pkg{l3quark} module, loaded later. +% \end{variable} % % \begin{macro}[int]{\@@_item:n} % The delimiter is always defined, but when used incorrectly simply @@ -802,9 +811,9 @@ % \end{variable} % % \begin{variable}{\c_empty_seq} -% Simply copy the empty token list. +% A sequence with no item, following the structure mentioned above. % \begin{macrocode} -\cs_new_eq:NN \c_empty_seq \c_empty_tl +\tl_const:Nn \c_empty_seq { \s_@@ \s_obj_end } % \end{macrocode} % \end{variable} % @@ -812,10 +821,14 @@ % % \begin{macro}{\seq_new:N,\seq_new:c} % \UnitTested -% Internally, sequences are just token lists. +% Sequences are initialized to \cs{c_empty_seq}. % \begin{macrocode} -\cs_new_eq:NN \seq_new:N \tl_new:N -\cs_new_eq:NN \seq_new:c \tl_new:c +\cs_new_protected:Npn \seq_new:N #1 + { + \__chk_if_free_cs:N #1 + \cs_gset_eq:NN #1 \c_empty_seq + } +\cs_generate_variant:Nn \seq_new:N { c } % \end{macrocode} % \end{macro} % @@ -823,12 +836,14 @@ % \UnitTested % \begin{macro}{\seq_gclear:N, \seq_gclear:c} % \UnitTested -% Clearing sequences is just the same as clearing token lists. +% Clearing a sequence is similar to setting it equal to the empty one. % \begin{macrocode} -\cs_new_eq:NN \seq_clear:N \tl_clear:N -\cs_new_eq:NN \seq_clear:c \tl_clear:c -\cs_new_eq:NN \seq_gclear:N \tl_gclear:N -\cs_new_eq:NN \seq_gclear:c \tl_gclear:c +\cs_new_protected:Npn \seq_clear:N #1 + { \seq_set_eq:NN #1 \c_empty_seq } +\cs_generate_variant:Nn \seq_clear:N { c } +\cs_new_protected:Npn \seq_gclear:N #1 + { \seq_gset_eq:NN #1 \c_empty_seq } +\cs_generate_variant:Nn \seq_gclear:N { c } % \end{macrocode} % \end{macro} % \end{macro} @@ -837,12 +852,14 @@ % \UnitTested % \begin{macro}{\seq_gclear_new:N, \seq_gclear_new:c} % \UnitTested -% Once again a copy from the token list functions. +% Once again we copy code from the token list functions. % \begin{macrocode} -\cs_new_eq:NN \seq_clear_new:N \tl_clear_new:N -\cs_new_eq:NN \seq_clear_new:c \tl_clear_new:c -\cs_new_eq:NN \seq_gclear_new:N \tl_gclear_new:N -\cs_new_eq:NN \seq_gclear_new:c \tl_gclear_new:c +\cs_new_protected:Npn \seq_clear_new:N #1 + { \seq_if_exist:NTF #1 { \seq_clear:N #1 } { \seq_new:N #1 } } +\cs_generate_variant:Nn \seq_clear_new:N { c } +\cs_new_protected:Npn \seq_gclear_new:N #1 + { \seq_if_exist:NTF #1 { \seq_gclear:N #1 } { \seq_new:N #1 } } +\cs_generate_variant:Nn \seq_gclear_new:N { c } % \end{macrocode} % \end{macro} % \end{macro} @@ -852,7 +869,7 @@ % \begin{macro} % {\seq_gset_eq:NN, \seq_gset_eq:cN, \seq_gset_eq:Nc, \seq_gset_eq:cc} % \UnitTested -% Once again, these are simple copies from the token list functions. +% Copying a sequence is the same as copying the underlying token list. % \begin{macrocode} \cs_new_eq:NN \seq_set_eq:NN \tl_set_eq:NN \cs_new_eq:NN \seq_set_eq:Nc \tl_set_eq:Nc @@ -877,8 +894,10 @@ % \@@_set_split_auxi:w, \@@_set_split_auxii:w, % \@@_set_split_end: % } -% The goal is to split a given token list at a marker, -% strip spaces from each item, and remove one set of +% When the separator is empty, everything is very simple, just map +% \cs{@@_wrap_item:n} through the items of the last argument. +% For non-trivial separators, the goal is to split a given token list +% at the 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_@@_internal_a_tl} @@ -900,10 +919,13 @@ { \@@_set_split:NNnn \tl_set:Nx } \cs_new_protected_nopar:Npn \seq_gset_split:Nnn { \@@_set_split:NNnn \tl_gset:Nx } -\cs_new_protected:Npn \@@_set_split:NNnn #1 #2 #3 #4 +\cs_new_protected:Npn \@@_set_split:NNnn #1#2#3#4 { \tl_if_empty:nTF {#3} - { #1 #2 { \tl_map_function:nN {#4} \@@_wrap_item:n } } + { + \tl_set:Nn \l_@@_internal_a_tl + { \tl_map_function:nN {#4} \@@_wrap_item:n } + } { \tl_set:Nn \l_@@_internal_a_tl { @@ -917,8 +939,8 @@ \@@_set_split_auxi:w \prg_do_nothing: } \tl_set:Nx \l_@@_internal_a_tl { \l_@@_internal_a_tl } - #1 #2 { \l_@@_internal_a_tl } } + #1 #2 { \s_@@ \l_@@_internal_a_tl \s_obj_end } } \cs_new:Npn \@@_set_split_auxi:w #1 \@@_set_split_end: { @@ -939,15 +961,25 @@ % \UnitTested % \begin{macro}{\seq_gconcat:NNN, \seq_gconcat:ccc} % \UnitTested -% Concatenating sequences is easy. +% \begin{macro}[aux,EXP]{\@@_concat:NN, \@@_concat:w} +% When concatenating sequences, one must take care of the trailing +% \cs{s_obj_end} and leading \cs{s_@@}. The second argument of +% \cs{@@_concat:NN} is \cs{s_@@}, and \cs{@@_concat:w} removes +% \cs{s_obj_end} by a delimited approach. The result starts with +% \cs{s_@@} (of the first sequence), which stops \texttt{f}-expansion. % \begin{macrocode} -\cs_new_eq:NN \seq_concat:NNN \tl_concat:NNN -\cs_new_eq:NN \seq_gconcat:NNN \tl_gconcat:NNN -\cs_new_eq:NN \seq_concat:ccc \tl_concat:ccc -\cs_new_eq:NN \seq_gconcat:ccc \tl_gconcat:ccc +\cs_new_protected:Npn \seq_concat:NNN #1#2#3 + { \tl_set:Nf #1 { \exp_last_unbraced:NNo \@@_concat:NN #2 #3 } } +\cs_new_protected:Npn \seq_gconcat:NNN #1#2#3 + { \tl_gset:Nf #1 { \exp_last_unbraced:NNo \@@_concat:NN #2 #3 } } +\cs_new:Npn \@@_concat:NN #1#2 { \exp_after:wN \@@_concat:w #1 } +\cs_new:Npn \@@_concat:w #1 \s_obj_end {#1} +\cs_generate_variant:Nn \seq_concat:NNN { ccc } +\cs_generate_variant:Nn \seq_gconcat:NNN { ccc } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}[pTF]{\seq_if_exist:N, \seq_if_exist:c} % Copies of the \texttt{cs} functions defined in \pkg{l3basics}. @@ -967,51 +999,85 @@ % } % \UnitTested % \begin{macro}{ -% \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 +% \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 % } -% \UnitTested -% The code here is just a wrapper for adding to token lists. +% \begin{macro}[aux,EXP]{\@@_put_left_aux:w} +% When adding to the left of a sequence, remove \cs{s_@@}. This is +% done by \cs{@@_put_left_aux:w}, which also stops +% \texttt{f}-expansion. % \begin{macrocode} \cs_new_protected:Npn \seq_put_left:Nn #1#2 - { \tl_put_left:Nn #1 { \@@_item:n {#2} } } -\cs_new_protected:Npn \seq_put_right:Nn #1#2 - { \tl_put_right:Nn #1 { \@@_item:n {#2} } } + { + \tl_set:Nx #1 + { + \exp_not:n { \s_@@ \@@_item:n {#2} } + \exp_not:f { \exp_after:wN \@@_put_left_aux:w #1 } + } + } +\cs_new_protected:Npn \seq_gput_left:Nn #1#2 + { + \tl_gset:Nx #1 + { + \exp_not:n { \s_@@ \@@_item:n {#2} } + \exp_not:f { \exp_after:wN \@@_put_left_aux:w #1 } + } + } +\cs_new:Npn \@@_put_left_aux:w \s_@@ { \exp_stop_f: } \cs_generate_variant:Nn \seq_put_left:Nn { NV , Nv , No , Nx } \cs_generate_variant:Nn \seq_put_left:Nn { c , cV , cv , co , cx } -\cs_generate_variant:Nn \seq_put_right:Nn { NV , Nv , No , Nx } -\cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx } +\cs_generate_variant:Nn \seq_gput_left:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}{ -% \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 +% \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 % } +% \UnitTested % \begin{macro}{ % \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 % } -% The same for global addition. +% \begin{macro}[aux,EXP]{\@@_put_right_aux:w} +% When adding to the right of a sequence, remove \cs{s_obj_end}. This +% is done by \cs{@@_put_right_aux:w}, which takes its result through +% \cs{exp_not:n}. % \begin{macrocode} -\cs_new_protected:Npn \seq_gput_left:Nn #1#2 - { \tl_gput_left:Nn #1 { \@@_item:n {#2} } } +\cs_new_protected:Npn \seq_put_right:Nn #1#2 + { + \tl_set:Nx #1 + { + \exp_after:wN \@@_put_right_aux:w #1 + \exp_not:n { \@@_item:n {#2} \s_obj_end } + } + } \cs_new_protected:Npn \seq_gput_right:Nn #1#2 - { \tl_gput_right:Nn #1 { \@@_item:n {#2} } } -\cs_generate_variant:Nn \seq_gput_left:Nn { NV , Nv , No , Nx } -\cs_generate_variant:Nn \seq_gput_left:Nn { c , cV , cv , co , cx } + { + \tl_gset:Nx #1 + { + \exp_after:wN \@@_put_right_aux:w #1 + \exp_not:n { \@@_item:n {#2} \s_obj_end } + } + } +\cs_new:Npn \@@_put_right_aux:w #1 \s_obj_end { \exp_not:n {#1} } \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_generate_variant:Nn \seq_put_right:Nn { NV , Nv , No , Nx } +\cs_generate_variant:Nn \seq_put_right:Nn { c , cV , cv , co , cx } % \end{macrocode} % \end{macro} % \end{macro} +% \end{macro} % % \subsection{Modifying sequences} % @@ -1113,12 +1179,20 @@ % % \begin{macro}[pTF]{\seq_if_empty:N, \seq_if_empty:c} % \UnitTested -% Simple copies from the token list variable material. +% Similar to token lists, we compare with the empty sequence. % \begin{macrocode} -\prg_new_eq_conditional:NNn \seq_if_empty:N \tl_if_empty:N - { p , T , F , TF } -\prg_new_eq_conditional:NNn \seq_if_empty:c \tl_if_empty:c - { p , T , F , TF } +\prg_new_conditional:Npnn \seq_if_empty:N #1 { p , T , F , TF } + { + \if_meaning:w #1 \c_empty_seq + \prg_return_true: + \else: + \prg_return_false: + \fi: + } +\cs_generate_variant:Nn \seq_if_empty_p:N { c } +\cs_generate_variant:Nn \seq_if_empty:NT { c } +\cs_generate_variant:Nn \seq_if_empty:NF { c } +\cs_generate_variant:Nn \seq_if_empty:NTF { c } % \end{macrocode} % \end{macro} % @@ -1197,22 +1271,21 @@ % % \begin{macro}{\seq_get_left:NN, \seq_get_left:cN} % \UnitTested -% \begin{macro}[aux]{\@@_get_left:NnwN} +% \begin{macro}[aux]{\@@_get_left:wnw} % Getting an item from the left of a sequence is pretty easy: just -% trim off the first item after removing the \cs{@@_item:n} at -% the start. We first append a \cs{q_no_value} item to cover the case -% of an empty sequence +% trim off the first item after \cs{@@_item:n} at the start. We +% append a \cs{q_no_value} item to cover the case of an empty sequence % \begin{macrocode} \cs_new_protected:Npn \seq_get_left:NN #1#2 { \tl_set:Nx #2 { - \exp_after:wN \@@_get_left:Nnw + \exp_after:wN \@@_get_left:wnw #1 \@@_item:n { \q_no_value } \q_stop } } -\cs_new:Npn \@@_get_left:Nnw \@@_item:n #1#2 \q_stop - { \exp_not:n {#1} } +\cs_new:Npn \@@_get_left:wnw #1 \@@_item:n #2#3 \q_stop + { \exp_not:n {#2} } \cs_generate_variant:Nn \seq_get_left:NN { c } % \end{macrocode} % \end{macro} @@ -1222,7 +1295,7 @@ % \UnitTested % \begin{macro}{\seq_gpop_left:NN, \seq_gpop_left:cN} % \UnitTested -% \begin{macro}[aux]{\@@_pop_left:NNN, \@@_pop_left:NnwNNN} +% \begin{macro}[aux]{\@@_pop_left:NNN, \@@_pop_left:wnwNNN} % The approach to popping an item is pretty similar to that to get % an item, with the only difference being that the sequence itself has % to be redefined. This makes it more sensible to use an auxiliary @@ -1233,11 +1306,12 @@ \cs_new_protected_nopar:Npn \seq_gpop_left:NN { \@@_pop:NNNN \@@_pop_left:NNN \tl_gset:Nn } \cs_new_protected:Npn \@@_pop_left:NNN #1#2#3 - { \exp_after:wN \@@_pop_left:NnwNNN #2 \q_stop #1#2#3 } -\cs_new_protected:Npn \@@_pop_left:NnwNNN \@@_item:n #1#2 \q_stop #3#4#5 + { \exp_after:wN \@@_pop_left:wnwNNN #2 \q_stop #1#2#3 } +\cs_new_protected:Npn \@@_pop_left:wnwNNN + #1 \@@_item:n #2#3 \q_stop #4#5#6 { - #3 #4 {#2} - \tl_set:Nn #5 {#1} + #4 #5 { #1 #3 } + \tl_set:Nn #6 {#2} } \cs_generate_variant:Nn \seq_pop_left:NN { c } \cs_generate_variant:Nn \seq_gpop_left:NN { c } @@ -1248,7 +1322,7 @@ % % \begin{macro}{\seq_get_right:NN, \seq_get_right:cN} % \UnitTested -% \begin{macro}[aux]{\@@_get_right_loop:nn} +% \begin{macro}[aux]{\@@_get_right_setup:wN, \@@_get_right_loop:nn} % First prepend \cs{q_no_value}, then take two arguments at a time. % Apart from the right-hand end of the sequence, this be a brace group % followed by \cs{@@_item:n}. The \cs{use_none:nn} removes both of @@ -1258,9 +1332,11 @@ % \cs{use_none:n} to get rid of a trailing \cs{@@_get_right_loop:nn}. % \begin{macrocode} \cs_new_protected:Npn \seq_get_right:NN #1#2 + { \exp_after:wN \@@_get_right_setup:wN #1 #2 } +\cs_new_protected:Npn \@@_get_right_setup:wN \s_@@ #1 \s_obj_end #2 { - \exp_after:wN \@@_get_right_loop:nn - \exp_after:wN \q_no_value + \@@_get_right_loop:nn + \q_no_value #1 { ?? @@ -1283,6 +1359,7 @@ % \begin{macro}{\seq_gpop_right:NN, \seq_gpop_right:cN} % \UnitTested % \begin{macro}[aux]{\@@_pop_right_aux:NNN, \@@_pop_right_loop:nn} +% \begin{macro}[aux, EXP]{\@@_pop_right_setup:w} % The approach to popping from the right is a bit more involved, but does % use some of the same ideas as getting from the right. What is needed is a % \enquote{flexible length} way to set a token list variable. This is @@ -1307,18 +1384,18 @@ \cs_set_eq:NN \seq_tmp:w \@@_item:n \cs_set_eq:NN \@@_item:n \scan_stop: #1 #2 - { \if_false: } \fi: - \exp_after:wN \exp_after:wN - \exp_after:wN \@@_pop_right_loop:nn - \exp_after:wN \use_none:n + { \if_false: } \fi: \s_@@ + \exp_after:wN \@@_pop_right_setup:w #2 { - \if_false: { \fi: } + \s_obj_end \if_false: { \fi: } \tex_afterassignment:D \use_none:n \tl_set:Nx #3 } \cs_set_eq:NN \@@_item:n \seq_tmp:w } +\cs_new:Npn \@@_pop_right_setup:w \s_@@ #1 \s_obj_end + { \exp_after:wN \@@_pop_right_loop:nn \use_none:n #1 } \cs_new:Npn \@@_pop_right_loop:nn #1#2 { #2 { \exp_not:n {#1} } @@ -1330,6 +1407,7 @@ % \end{macro} % \end{macro} % \end{macro} +% \end{macro} % % \begin{macro}[TF]{\seq_get_left:NN, \seq_get_left:cN} % \begin{macro}[TF]{\seq_get_right:NN, \seq_get_right:cN} @@ -1402,7 +1480,7 @@ % % \begin{macro}{\seq_map_function:NN, \seq_map_function:cN} % \UnitTested -% \begin{macro}[aux]{\@@_map_function:NNn} +% \begin{macro}[aux,rEXP]{\@@_map_function:wN,\@@_map_function:NNn} % The idea here is to apply the code of |#2| to each item in the % sequence without altering the definition of \cs{@@_item:n}. This % is done as by noting that every odd token in the sequence must be @@ -1411,9 +1489,10 @@ % loop without needing to do a (relatively-expensive) quark test. % \begin{macrocode} \cs_new:Npn \seq_map_function:NN #1#2 + { \exp_after:wN \@@_map_function:wN #1 #2 } +\cs_new:Npn \@@_map_function:wN \s_@@ #1 \s_obj_end #2 { - \exp_after:wN \@@_map_function:NNn \exp_after:wN #2 #1 - { ? \seq_map_break: } { } + \@@_map_function:NNn #2 #1 { ? \seq_map_break: } { } \__prg_break_point:Nn \seq_map_break: { } } \cs_new:Npn \@@_map_function:NNn #1#2#3 @@ -1501,7 +1580,7 @@ \cs_generate_variant:Nn \seq_map_variable:NNn { c , cc } % \end{macrocode} % \end{macro} -% +% % \begin{macro}{\seq_count:N, \seq_count:c} % \begin{macro}[aux]{\@@_count:n} % Counting the items in a sequence is done using the same approach as for @@ -1526,25 +1605,29 @@ % % \begin{macro}[EXP]{\seq_use:Nnnn, \seq_use:cnnn} % \begin{macro}[EXP, aux] -% {\@@_use:NnNnn, \@@_use:nwwwwnwn, \@@_use:nwwn} +% {\@@_use:wnwnn, \@@_use_setup:w, \@@_use:nwwwwnwn, \@@_use:nwwn} % \begin{macro}[EXP]{\seq_use:Nn, \seq_use:cn} % See \cs{clist_use:Nnnn} for a general explanation. The main % difference is that we use \cs{@@_item:n} as a delimiter rather than -% commas. We also need to add \cs{@@_item:n} at various places. +% commas. We also need to add \cs{@@_item:n} at various places, and +% \cs{s_@@} and \cs{s_obj_end}. % \begin{macrocode} \cs_new:Npn \seq_use:Nnnn #1#2#3#4 { \seq_if_exist:NTF #1 { - \int_case:nnn { \seq_count:N #1 } + \int_case:nnF { \seq_count:N #1 } { { 0 } { } - { 1 } { \exp_after:wN \@@_use:NnNnn #1 \@@_item:n { } { } } - { 2 } { \exp_after:wN \@@_use:NnNnn #1 {#2} } + { 1 } + { + \exp_after:wN \@@_use:wnwnn #1 + \@@_item:n { } \s_obj_end { } + } + { 2 } { \exp_after:wN \@@_use:wnwnn #1 {#2} } } { - \exp_after:wN \@@_use:nwwwwnwn - \exp_after:wN { \exp_after:wN } #1 \@@_item:n + \exp_after:wN \@@_use_setup:w #1 \@@_item:n \q_mark { \@@_use:nwwwwnwn {#3} } \q_mark { \@@_use:nwwn {#4} } \q_stop { } @@ -1553,8 +1636,11 @@ { \__msg_kernel_expandable_error:nnn { kernel } { bad-variable } {#1} } } \cs_generate_variant:Nn \seq_use:Nnnn { c } -\cs_new:Npn \@@_use:NnNnn \@@_item:n #1 \@@_item:n #2#3 - { \exp_not:n { #1 #3 #2 } } +\cs_new:Npn \@@_use:wnwnn + #1 \@@_item:n #2#3 \@@_item:n #4#5 \s_obj_end #6 + { \exp_not:n { #2 #6 #4 } } +\cs_new:Npn \@@_use_setup:w \s_@@ #1 \s_obj_end + { \@@_use:nwwwwnwn { } #1 } \cs_new:Npn \@@_use:nwwwwnwn #1 \@@_item:n #2 \@@_item:n #3 \@@_item:n #4#5 \q_mark #6#7 \q_stop #8 @@ -1675,55 +1761,6 @@ % \end{macrocode} % \end{variable} % -% \subsection{Deprecated interfaces} -% -% A few functions which are no longer documented: these were moved -% here on or before 2011-04-20, and will be removed entirely by -% 2011-07-20. -% -% \begin{macro}{\seq_top:NN, \seq_top:cN} -% These are old stack functions. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \seq_top:NN \seq_get_left:NN -\cs_new_eq:NN \seq_top:cN \seq_get_left:cN -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% \begin{macro}{\seq_display:N, \seq_display:c} -% An older name for \cs{seq_show:N}. -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \seq_display:N \seq_show:N -\cs_new_eq:NN \seq_display:c \seq_show:c -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% Deprecated 2012-05-13 for removal by 2012-11-30. -% -% \begin{macro}{\seq_length:N, \seq_length:c} -% \begin{macrocode} -%<*deprecated> -\cs_new_eq:NN \seq_length:N \seq_count:N -\cs_new_eq:NN \seq_length:c \seq_count:c -%</deprecated> -% \end{macrocode} -% \end{macro} -% -% Deprecated 2012-05-23 for removal by 2012-08-30. -% -% \begin{macro}{\seq_use:N, \seq_use:c} -% A simple short cut for a mapping. -% \begin{macrocode} -%<*deprecated> -\cs_new:Npn \seq_use:N #1 { \seq_use:Nn #1 { } } -\cs_generate_variant:Nn \seq_use:N { c } -%</deprecated> -% \end{macrocode} -% \end{macro} -% % \begin{macrocode} %</initex|package> % \end{macrocode} |