diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/l3kernel/l3sort.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/l3kernel/l3sort.dtx | 80 |
1 files changed, 43 insertions, 37 deletions
diff --git a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx index bb2d6f966e5..a3e71fbdf6f 100644 --- a/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx +++ b/Master/texmf-dist/source/latex/l3kernel/l3sort.dtx @@ -1,6 +1,6 @@ % \iffalse % -%% File l3sort.dtx (C) Copyright 2012-2018 The LaTeX3 Project +%% File l3sort.dtx (C) Copyright 2012-2019 The LaTeX3 Project % % It may be distributed and/or modified under the conditions of the % LaTeX Project Public License (LPPL), either version 1.3c of this @@ -41,7 +41,7 @@ % }^^A % } % -% \date{Released 2018-12-12} +% \date{Released 2019-01-01} % % \maketitle % @@ -551,49 +551,67 @@ { \tex_the:D \tex_toks:D \exp_after:wN \l_@@_A_int \exp_after:wN } \exp_after:wN { \tex_the:D \tex_toks:D \l_@@_C_int } \prg_do_nothing: - \@@_return_mark:N - \@@_return_mark:N + \@@_return_mark:w + \@@_return_mark:w + \q_mark \@@_return_none_error: } % \end{macrocode} % \end{macro} % % \begin{macro}{\sort_return_same:, \sort_return_swapped:} -% \begin{macro}{\@@_return_mark:N} -% \begin{macro}{\@@_return_none_error:, \@@_return_two_error:w} -% The marker removes one token. 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. +% \begin{macro}{\@@_return_mark:w} +% \begin{macro}{\@@_return_none_error:, \@@_return_two_error:} +% 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 +% \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, +% \cs{@@_return_two_error:} ends up before any \cs{@@_return_mark:w}, +% so that it produces an error. % \begin{macrocode} -\cs_new_protected:Npn \sort_return_same: #1 \@@_return_mark:N +\cs_new_protected:Npn \sort_return_same: + #1 \@@_return_mark:w #2 \q_mark { #1 - \@@_return_mark:N - \@@_return_two_error:w \@@_return_same: + #2 + \@@_return_two_error: + \@@_return_mark:w + \q_mark + \@@_return_same:w } -\cs_new_protected:Npn \sort_return_swapped: #1 \@@_return_mark:N +\cs_new_protected:Npn \sort_return_swapped: + #1 \@@_return_mark:w #2 \q_mark { #1 - \@@_return_mark:N - \@@_return_two_error:w \@@_return_swapped: + #2 + \@@_return_two_error: + \@@_return_mark:w + \q_mark + \@@_return_swapped:w } -\cs_new_protected:Npn \@@_return_mark:N #1 { } +\cs_new_protected:Npn \@@_return_mark:w #1 \q_mark { } \cs_new_protected:Npn \@@_return_none_error: { \__kernel_msg_error:nnxx { kernel } { return-none } { \tex_the:D \tex_toks:D \l_@@_A_int } { \tex_the:D \tex_toks:D \l_@@_C_int } - \@@_return_same: + \@@_return_same:w \@@_return_none_error: + } +\cs_new_protected:Npn \@@_return_two_error: + { + \__kernel_msg_error:nnxx { kernel } { return-two } + { \tex_the:D \tex_toks:D \l_@@_A_int } + { \tex_the:D \tex_toks:D \l_@@_C_int } } -\cs_new_protected:Npn \@@_return_two_error:w - #1 \@@_return_none_error: - { \__kernel_msg_error:nn { kernel } { return-two } } % \end{macrocode} % \end{macro} % \end{macro} % \end{macro} % -% \begin{macro}{\@@_return_same:} +% \begin{macro}{\@@_return_same:w} % If the comparison function returns \texttt{same}, % then the second argument fed to \cs{@@_compare:nn} % should remain to the right of the other one. Since @@ -605,7 +623,7 @@ % is already in the correct registers and we are done % with merging those two blocks. % \begin{macrocode} -\cs_new_protected:Npn \@@_return_same: +\cs_new_protected:Npn \@@_return_same:w #1 \@@_return_none_error: { \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int \int_decr:N \l_@@_B_int @@ -618,7 +636,7 @@ % \end{macrocode} % \end{macro} % -% \begin{macro}{\@@_return_swapped:} +% \begin{macro}{\@@_return_swapped:w} % If the comparison function returns \texttt{swapped}, % then the next item to add to the merger is the first % argument, contents of the \tn{toks} register $A$. @@ -629,7 +647,7 @@ % the second block, indexed by $C$, are copied % to the merger by \cs{@@_merge_blocks_end:}. % \begin{macrocode} -\cs_new_protected:Npn \@@_return_swapped: +\cs_new_protected:Npn \@@_return_swapped:w #1 \@@_return_none_error: { \tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_A_int \int_decr:N \l_@@_B_int @@ -1067,25 +1085,13 @@ \__kernel_msg_new:nnnn { kernel } { return-two } { The~comparison~code~returned~multiple~times. } { - When~sorting~a~list,~the~code~to~compare~items~called~ + When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~called~ \iow_char:N\\sort_return_same: ~or~ \iow_char:N\\sort_return_swapped: ~multiple~times.~ Exactly~one~of~these~should~be~called. } % \end{macrocode} % -% \subsection{Deprecated functions} -% -% \begin{macro}[deprecated = 2018-12-31]{\sort_ordered:, \sort_reversed:} -% These functions were renamed for consistency. -% \begin{macrocode} -\__kernel_patch_deprecation:nnNNpn { 2018-12-31 } { \sort_return_same: } -\cs_new_protected:Npn \sort_ordered: { \sort_return_same: } -\__kernel_patch_deprecation:nnNNpn { 2018-12-31 } { \sort_return_swapped: } -\cs_new_protected:Npn \sort_reversed: { \sort_return_swapped: } -% \end{macrocode} -% \end{macro} -% % \begin{macrocode} %</initex|package> % \end{macrocode} |