diff options
author | Norbert Preining <norbert@preining.info> | 2020-05-12 03:03:03 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-05-12 03:03:03 +0000 |
commit | 675bcc9067ccef91624a9eca025506a4ce1d37b3 (patch) | |
tree | 03c68d83f091c038ad751310955938e407b46ff4 /macros/latex/contrib/l3kernel/l3sort.dtx | |
parent | fd95e879442e050790f06552eb074eeb7c5b4cab (diff) |
CTAN sync 202005120303
Diffstat (limited to 'macros/latex/contrib/l3kernel/l3sort.dtx')
-rw-r--r-- | macros/latex/contrib/l3kernel/l3sort.dtx | 78 |
1 files changed, 43 insertions, 35 deletions
diff --git a/macros/latex/contrib/l3kernel/l3sort.dtx b/macros/latex/contrib/l3kernel/l3sort.dtx index 2dbb5b6931..6b41acfe3e 100644 --- a/macros/latex/contrib/l3kernel/l3sort.dtx +++ b/macros/latex/contrib/l3kernel/l3sort.dtx @@ -43,7 +43,7 @@ % }^^A % } % -% \date{Released 2020-05-05} +% \date{Released 2020-05-11} % % \maketitle % @@ -199,6 +199,14 @@ % \end{variable} % \end{variable} % +% \begin{variable}{\s_@@_mark,\s_@@_stop} +% Internal scan marks. +% \begin{macrocode} +\scan_new:N \s_@@_mark +\scan_new:N \s_@@_stop +% \end{macrocode} +% \end{variable} +% % \subsection{Finding available \tn{toks} registers} % % \begin{macro}{\@@_shrink_range:} @@ -555,7 +563,7 @@ \prg_do_nothing: \@@_return_mark:w \@@_return_mark:w - \q_mark + \s_@@_mark \@@_return_none_error: } % \end{macrocode} @@ -567,7 +575,7 @@ % Each comparison should call \cs{sort_return_same:} or % \cs{sort_return_swapped:} exactly once. If neither is called, % \cs{@@_return_none_error:} is called, since the \texttt{return_mark} -% removes tokens until \cs{q_mark}. If one is called, the +% removes tokens until \cs{s_@@_mark}. If one is called, the % \texttt{return_mark} auxiliary removes everything except % \cs{@@_return_same:w} (or its \texttt{swapped} analogue) followed by % \cs{@@_return_none_error:}. Finally if two or more are called, @@ -575,26 +583,26 @@ % so that it produces an error. % \begin{macrocode} \cs_new_protected:Npn \sort_return_same: - #1 \@@_return_mark:w #2 \q_mark + #1 \@@_return_mark:w #2 \s_@@_mark { #1 #2 \@@_return_two_error: \@@_return_mark:w - \q_mark + \s_@@_mark \@@_return_same:w } \cs_new_protected:Npn \sort_return_swapped: - #1 \@@_return_mark:w #2 \q_mark + #1 \@@_return_mark:w #2 \s_@@_mark { #1 #2 \@@_return_two_error: \@@_return_mark:w - \q_mark + \s_@@_mark \@@_return_swapped:w } -\cs_new_protected:Npn \@@_return_mark:w #1 \q_mark { } +\cs_new_protected:Npn \@@_return_mark:w #1 \s_@@_mark { } \cs_new_protected:Npn \@@_return_none_error: { \__kernel_msg_error:nnxx { kernel } { return-none } @@ -707,7 +715,7 @@ % \tl_if_blank:nF {#1} % { % \__sort:nnNnn { } { } #2 -% #1 \q_recursion_tail \q_recursion_stop +% #1 \q__sort_recursion_tail \q__sort_recursion_stop % } % } % \cs_new:Npn \__sort:nnNnn #1#2#3#4#5 @@ -742,7 +750,7 @@ % ~~~~~~\meta{extra arguments}\\ % ~~|}|\\ % \cs{@@_loop:wNn}~\ldots{}~\meta{prepared tokens}\\ -% ~~\meta{end-loop}~|{}|~\cs{q_stop} +% ~~\meta{end-loop}~|{}|~\cs{s_@@_stop} % \end{quote} % In this example, which matches the structure of % \cs{@@_quick_split_i:NnnnnNn} and a few other functions below, the @@ -782,13 +790,13 @@ % % The third speed up is to avoid |\use:ff| using a continuation-passing % style: \cs{@@_quick_split:NnNn} expects a list followed by -% \cs{q_mark} \Arg{code}, and expands to \meta{code} \meta{sorted list}. +% \cs{s_@@_mark} \Arg{code}, and expands to \meta{code} \meta{sorted list}. % Sorting the two parts of the list around the pivot is done with % \begin{quote} % \ttfamily -% \cs{@@_quick_split:NnNn} |#2| \ldots{} \cs{q_mark}\\ +% \cs{@@_quick_split:NnNn} |#2| \ldots{} \cs{s_@@_mark}\\ % ~~|{|\\ -% ~~~~\cs{@@_quick_split:NnNn} |#1| \ldots{} \cs{q_mark} \Arg{code}\\ +% ~~~~\cs{@@_quick_split:NnNn} |#1| \ldots{} \cs{s_@@_mark} \Arg{code}\\ % ~~~~\Arg{pivot}\\ % ~~|}| % \end{quote} @@ -823,7 +831,7 @@ % argument of the third \cs{use:n}, hence must remain in memory, and so % on. The memory consumption grows quadratically with the number of % nested \cs{use:n}. In practice, this means that we must read -% everything until a trailing \cs{q_stop} once in a while, otherwise +% everything until a trailing \cs{s_@@_stop} once in a while, otherwise % sorting lists of more than a few thousand items would exhaust a % typical \TeX{}'s memory. % @@ -846,8 +854,8 @@ % \texttt{prepare_end} auxiliary finds the prepared token list % as~|#4|. The scene is then set up for \cs{@@_quick_split:NnNn}, % which sorts the prepared list and perform the post action placed -% after \cs{q_mark}, namely removing the trailing \cs{s_stop} and -% \cs{q_stop} and leaving \cs{exp_stop_f:} to stop +% after \cs{s_@@_mark}, namely removing the trailing \cs{s_@@_stop} and +% \cs{s_@@_stop} and leaving \cs{exp_stop_f:} to stop % \texttt{f}-expansion. % \begin{macrocode} \cs_new:Npn \tl_sort:nN #1#2 @@ -859,7 +867,7 @@ \@@_quick_prepare:Nnnn #2 { } { } #1 { \prg_break_point: \@@_quick_prepare_end:NNNnw } - \q_stop + \s_@@_stop } } } @@ -868,13 +876,13 @@ \prg_break: #4 \prg_break_point: \@@_quick_prepare:Nnnn #1 { #2 #3 } { #1 {#4} } } -\cs_new:Npn \@@_quick_prepare_end:NNNnw #1#2#3#4#5 \q_stop +\cs_new:Npn \@@_quick_prepare_end:NNNnw #1#2#3#4#5 \s_@@_stop { \@@_quick_split:NnNn #4 \@@_quick_end:nnTFNn { } - \q_mark { \@@_quick_cleanup:w \exp_stop_f: } - \s_stop \q_stop + \s_@@_mark { \@@_quick_cleanup:w \exp_stop_f: } + \s_@@_mark \s_@@_stop } -\cs_new:Npn \@@_quick_cleanup:w #1 \s_stop \q_stop {#1} +\cs_new:Npn \@@_quick_cleanup:w #1 \s_@@_mark \s_@@_stop {#1} % \end{macrocode} % \end{macro} % \end{macro} @@ -961,9 +969,9 @@ % auxiliaries here) and another copy~|#6| of the fake item. All those % are discarded except the function~|#5|. This function receives % lists~|#1| and~|#2| of items less than or greater than the -% pivot~|#3|, then a continuation code~|#5| just after \cs{q_mark}. +% pivot~|#3|, then a continuation code~|#5| just after \cs{s_@@_mark}. % To avoid a memory problem described earlier, all of the ending -% functions read~|#6| until \cs{q_stop} and place~|#6| back into the +% functions read~|#6| until \cs{s_@@_stop} and place~|#6| back into the % input stream. When the lists |#1| and~|#2| are empty, the % \texttt{single} auxiliary simply places the continuation~|#5| before % the pivot~|{#3}|. When |#2|~is empty, |#1|~is sorted and placed @@ -976,30 +984,30 @@ % continuations are done in such a way to place the pivot in between. % \begin{macrocode} \cs_new:Npn \@@_quick_end:nnTFNn #1#2#3#4#5#6 {#5} -\cs_new:Npn \@@_quick_single_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop - { #5 {#3} #6 \q_stop } -\cs_new:Npn \@@_quick_only_i_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop +\cs_new:Npn \@@_quick_single_end:nnnwnw #1#2#3#4 \s_@@_mark #5#6 \s_@@_stop + { #5 {#3} #6 \s_@@_stop } +\cs_new:Npn \@@_quick_only_i_end:nnnwnw #1#2#3#4 \s_@@_mark #5#6 \s_@@_stop { \@@_quick_split:NnNn #1 - \@@_quick_end:nnTFNn { } \q_mark {#5} + \@@_quick_end:nnTFNn { } \s_@@_mark {#5} {#3} - #6 \q_stop + #6 \s_@@_stop } -\cs_new:Npn \@@_quick_only_ii_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop +\cs_new:Npn \@@_quick_only_ii_end:nnnwnw #1#2#3#4 \s_@@_mark #5#6 \s_@@_stop { \@@_quick_split:NnNn #2 - \@@_quick_end:nnTFNn { } \q_mark { #5 {#3} } - #6 \q_stop + \@@_quick_end:nnTFNn { } \s_@@_mark { #5 {#3} } + #6 \s_@@_stop } -\cs_new:Npn \@@_quick_split_end:nnnwnw #1#2#3#4 \q_mark #5#6 \q_stop +\cs_new:Npn \@@_quick_split_end:nnnwnw #1#2#3#4 \s_@@_mark #5#6 \s_@@_stop { - \@@_quick_split:NnNn #2 \@@_quick_end:nnTFNn { } \q_mark + \@@_quick_split:NnNn #2 \@@_quick_end:nnTFNn { } \s_@@_mark { \@@_quick_split:NnNn #1 - \@@_quick_end:nnTFNn { } \q_mark {#5} + \@@_quick_end:nnTFNn { } \s_@@_mark {#5} {#3} } - #6 \q_stop + #6 \s_@@_stop } % \end{macrocode} % \end{macro} |