[latex3-commits] [l3svn] r6837 - Rename to \sort_return_same: and \sort_return_swapped:
noreply at latex-project.org
noreply at latex-project.org
Mon Feb 6 18:14:02 CET 2017
Author: bruno
Date: 2017-02-06 18:14:02 +0100 (Mon, 06 Feb 2017)
New Revision: 6837
Modified:
trunk/l3experimental/l3sort/l3sort.dtx
trunk/l3experimental/l3sort/testfiles/m3sort001.luatex.tlg
trunk/l3experimental/l3sort/testfiles/m3sort001.lvt
trunk/l3experimental/l3sort/testfiles/m3sort001.tlg
Log:
Rename to \sort_return_same: and \sort_return_swapped:
Former names were shorter, \sort_ordered: and \sort_reversed:
but as discussed internally the functions are somewhat akin
to \prg_return_true: and \prg_return_false:
Modified: trunk/l3experimental/l3sort/l3sort.dtx
===================================================================
--- trunk/l3experimental/l3sort/l3sort.dtx 2017-01-30 21:31:34 UTC (rev 6836)
+++ trunk/l3experimental/l3sort/l3sort.dtx 2017-02-06 17:14:02 UTC (rev 6837)
@@ -68,7 +68,6 @@
% \maketitle
%
% \begin{documentation}
-% ^^A todo: ask list about ltplain, mkpattern.tex, GFnotation.tex, texinfo.tex, lollipop-plain, etex-mac.tex,
%
% \section{\pkg{l3sort} documentation}
%
@@ -80,24 +79,24 @@
% \clist_sort:Nn \l_foo_clist
% {
% \int_compare:nNnTF { #1 } > { #2 }
-% { \sort_reversed: }
-% { \sort_ordered: }
+% { \sort_return_swapped: }
+% { \sort_return_same: }
% }
% \end{verbatim}
% will result in \cs{l_foo_clist} holding the values
% |{ -2 , 01 , +1 , 3 , 5 }| sorted in non-decreasing order.
%
-% The code defining the comparison should perform
-% \cs{sort_reversed:} if the two items given as |#1|
+% The code defining the comparison should call
+% \cs{sort_return_swapped:} if the two items given as |#1|
% and |#2| are not in the correct order, and otherwise it
-% should call \cs{sort_ordered:} to indicate that
+% should call \cs{sort_return_same:} to indicate that
% the order of this pair of items should not be changed.
%
% For instance, a \meta{comparison code} consisting only
-% of \cs{sort_ordered:} with no test will yield a trivial
+% of \cs{sort_return_same:} with no test will yield a trivial
% sort: the final order is identical to the original order.
% Conversely, using a \meta{comparison code} consisting only
-% of \cs{sort_reversed:} will reverse the list (in a fairly
+% of \cs{sort_return_swapped:} will reverse the list (in a fairly
% inefficient way).
%
% \begin{texnote}
@@ -621,7 +620,7 @@
% In other words, we are building the merger starting with the
% largest values.
% The comparison function is defined to return either
-% \texttt{reversed} or \texttt{ordered}. Of course, this
+% \texttt{swapped} or \texttt{same}. Of course, this
% means the arguments need to be given in the order they
% appear originally in the list.
% \begin{macrocode}
@@ -639,24 +638,24 @@
% \end{macro}
%
%
-% \begin{macro}{\sort_ordered:, \sort_reversed:}
+% \begin{macro}{\sort_return_same:, \sort_return_swapped:}
% \begin{macro}[aux]{\@@_return_mark:N}
% \begin{macro}[aux]{\@@_return_none_error:, \@@_return_two_error:w}
% The marker removes one token. Each comparison should call
-% \cs{sort_ordered:} or \cs{sort_reversed:} exactly
+% \cs{sort_return_same:} or \cs{sort_return_swapped:} exactly
% once. If neither is called, \cs{@@_return_none_error:} is called.
% \begin{macrocode}
-\cs_new_protected:Npn \sort_ordered: #1 \@@_return_mark:N
- { #1 \@@_return_mark:N \@@_return_two_error:w \@@_ordered: }
-\cs_new_protected:Npn \sort_reversed: #1 \@@_return_mark:N
- { #1 \@@_return_mark:N \@@_return_two_error:w \@@_return_reversed: }
+\cs_new_protected:Npn \sort_return_same: #1 \@@_return_mark:N
+ { #1 \@@_return_mark:N \@@_return_two_error:w \@@_return_same: }
+\cs_new_protected:Npn \sort_return_swapped: #1 \@@_return_mark:N
+ { #1 \@@_return_mark:N \@@_return_two_error:w \@@_return_swapped: }
\cs_new_protected:Npn \@@_return_mark:N #1 { }
\cs_new_protected:Npn \@@_return_none_error:
{
\__msg_kernel_error:nnxx { sort } { return-none }
{ \tex_the:D \tex_toks:D \l_@@_A_int }
{ \tex_the:D \tex_toks:D \l_@@_C_int }
- \@@_ordered:
+ \@@_return_same:
}
\cs_new_protected:Npn \@@_return_two_error:w
#1 \@@_return_none_error:
@@ -666,8 +665,8 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\@@_ordered:}
-% If the comparison function returns \texttt{ordered},
+% \begin{macro}[aux]{\@@_return_same:}
+% 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
% we build the merger starting from the right, we copy
@@ -678,7 +677,7 @@
% is already in the correct registers and we are done
% with merging those two blocks.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_ordered:
+\cs_new_protected:Npn \@@_return_same:
{
\tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_C_int
\tex_advance:D \l_@@_B_int - \c_one
@@ -692,8 +691,8 @@
% \end{macro}
% \end{macro}
%
-% \begin{macro}[aux]{\@@_return_reversed:}
-% If the comparison function returns \texttt{reversed},
+% \begin{macro}[aux]{\@@_return_swapped:}
+% 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$.
% Then shift the pointers $A$ and $B$ to the left, and
@@ -703,7 +702,7 @@
% the second block, indexed by $C$, are copied
% to the merger by \cs{@@_merge_blocks_end:}.
% \begin{macrocode}
-\cs_new_protected:Npn \@@_return_reversed:
+\cs_new_protected:Npn \@@_return_swapped:
{
\tex_toks:D \l_@@_B_int \tex_toks:D \l_@@_A_int
\tex_advance:D \l_@@_B_int - \c_one
@@ -1128,21 +1127,31 @@
{
When~sorting~a~list,~the~code~to~compare~items~#1~and~#2~
did~not~call~
- \iow_char:N\\sort_ordered: ~nor~
- \iow_char:N\\sort_reversed: .~
+ \iow_char:N\\sort_return_same: ~nor~
+ \iow_char:N\\sort_return_swapped: .~
Exactly~one~of~these~should~be~called.
}
\__msg_kernel_new:nnnn { sort } { return-two }
{ The~comparison~code~returned~multiple~times. }
{
When~sorting~a~list,~the~code~to~compare~items~called~
- \iow_char:N\\sort_ordered: ~or~
- \iow_char:N\\sort_reversed: ~multiple~times.~
+ \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 = 2017-02-06]{\sort_ordered:, \sort_reversed:}
+% These functions were renamed for consistency.
% \begin{macrocode}
+\cs_new_eq:NN \sort_ordered: \sort_return_same:
+\cs_new_eq:NN \sort_reversed: \sort_return_swapped:
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
%</initex|package>
% \end{macrocode}
%
Modified: trunk/l3experimental/l3sort/testfiles/m3sort001.luatex.tlg
===================================================================
--- trunk/l3experimental/l3sort/testfiles/m3sort001.luatex.tlg 2017-01-30 21:31:34 UTC (rev 6836)
+++ trunk/l3experimental/l3sort/testfiles/m3sort001.luatex.tlg 2017-02-06 17:14:02 UTC (rev 6837)
@@ -112,8 +112,8 @@
!...............................................
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
-| When sorting a list, the code to compare items called \sort_ordered: or
-| \sort_reversed: multiple times. Exactly one of these should be called.
+| When sorting a list, the code to compare items called \sort_return_same: or
+| \sort_return_swapped: multiple times. Exactly one of these should be called.
|...............................................
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -128,7 +128,8 @@
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
| When sorting a list, the code to compare items c and b did not call
-| \sort_ordered: nor \sort_reversed:. Exactly one of these should be called.
+| \sort_return_same: nor \sort_return_swapped:. Exactly one of these should be
+| called.
|...............................................
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -143,7 +144,8 @@
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
| When sorting a list, the code to compare items c and a did not call
-| \sort_ordered: nor \sort_reversed:. Exactly one of these should be called.
+| \sort_return_same: nor \sort_return_swapped:. Exactly one of these should be
+| called.
|...............................................
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -157,8 +159,8 @@
!...............................................
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
-| When sorting a list, the code to compare items called \sort_ordered: or
-| \sort_reversed: multiple times. Exactly one of these should be called.
+| When sorting a list, the code to compare items called \sort_return_same: or
+| \sort_return_swapped: multiple times. Exactly one of these should be called.
|...............................................
{c}{a}{b}{d}
============================================================
Modified: trunk/l3experimental/l3sort/testfiles/m3sort001.lvt
===================================================================
--- trunk/l3experimental/l3sort/testfiles/m3sort001.lvt 2017-01-30 21:31:34 UTC (rev 6836)
+++ trunk/l3experimental/l3sort/testfiles/m3sort001.lvt 2017-02-06 17:14:02 UTC (rev 6837)
@@ -23,14 +23,14 @@
\tl_set:Nn \l_tmpa_tl { 8234610203748 }
{
\tl_sort:Nn \l_tmpa_tl
- { \int_compare:nTF { #1 > #2 } \sort_reversed: \sort_ordered: }
+ { \int_compare:nTF { #1 > #2 } \sort_return_swapped: \sort_return_same: }
\TYPE { \l_tmpa_tl }
}
\TYPE { \l_tmpa_tl }
\tl_gset:Nx \g_tmpa_tl { \prg_replicate:nn { 10 } { 8234610203748 } }
{
\tl_gsort:Nn \g_tmpa_tl
- { \int_compare:nTF { #1 > #2 } \sort_reversed: \sort_ordered: }
+ { \int_compare:nTF { #1 > #2 } \sort_return_swapped: \sort_return_same: }
}
\TYPE { \g_tmpa_tl }
}
@@ -46,7 +46,7 @@
\clist_set:Nn \l_tmpa_clist { 8,23,4,61,02,--3,03,7,3,48, }
{
\clist_sort:Nn \l_tmpa_clist
- { \int_compare:nTF { #1 > #2 } \sort_reversed: \sort_ordered: }
+ { \int_compare:nTF { #1 > #2 } \sort_return_swapped: \sort_return_same: }
\TYPE { \l_tmpa_clist }
}
\TYPE { \l_tmpa_clist }
@@ -54,7 +54,7 @@
{ \prg_replicate:nn { 10 } { 8,23,4,61,02,--3,03,7,3,48, } }
{
\clist_gsort:Nn \g_tmpa_clist
- { \int_compare:nTF { #1 > #2 } \sort_reversed: \sort_ordered: }
+ { \int_compare:nTF { #1 > #2 } \sort_return_swapped: \sort_return_same: }
}
\TYPE { \g_tmpa_clist }
}
@@ -74,7 +74,7 @@
\seq_gset_split:Nnn \g_tmpa_seq { , } { 8,23,4,61,02,--3,03,7,3,48 }
{
\seq_gsort:Nn \g_tmpa_seq
- { \int_compare:nTF { #1 > #2 } \sort_reversed: \sort_ordered: }
+ { \int_compare:nTF { #1 > #2 } \sort_return_swapped: \sort_return_same: }
}
\TYPE { \tl_to_str:N \g_tmpa_seq }
}
@@ -102,21 +102,21 @@
\TEST { sort~too~long }
{
- \tl_sort:Nn \l_tmpa_tl { \sort_ordered: }
+ \tl_sort:Nn \l_tmpa_tl { \sort_return_same: }
\int_compare:nF
{ \tl_count:N \l_tmpa_tl = 50000 }
{ \ERROR }
\OMIT
\use:c { newtoks } \l_test_toks
\TIMO
- \clist_sort:Nn \l_tmpa_clist { \sort_ordered: }
+ \clist_sort:Nn \l_tmpa_clist { \sort_return_same: }
\int_compare:nF
{ \clist_count:N \l_tmpa_clist = 50000 }
{ \ERROR }
\OMIT
\use:c { newtoks } \l_test_toks
\TIMO
- \seq_sort:Nn \l_tmpa_seq { \sort_ordered: }
+ \seq_sort:Nn \l_tmpa_seq { \sort_return_same: }
\int_compare:nF
{ \seq_count:N \l_tmpa_seq = 50000 }
{ \ERROR }
@@ -132,15 +132,15 @@
\TYPE { #1 #2 }
\str_if_eq:nnT { #1 #2 } { c a }
{ \use:c { newtoks } \l_test_toks }
- \sort_ordered:
+ \sort_return_same:
}
\TYPE { \l_tmpa_tl }
\tl_sort:Nn \l_tmpa_tl
{
\str_case:nn {#1}
{
- { b } { \sort_reversed: }
- { d } { \sort_reversed: \sort_reversed: }
+ { b } { \sort_return_swapped: }
+ { d } { \sort_return_swapped: \sort_return_swapped: }
}
}
\TYPE { \l_tmpa_tl }
Modified: trunk/l3experimental/l3sort/testfiles/m3sort001.tlg
===================================================================
--- trunk/l3experimental/l3sort/testfiles/m3sort001.tlg 2017-01-30 21:31:34 UTC (rev 6836)
+++ trunk/l3experimental/l3sort/testfiles/m3sort001.tlg 2017-02-06 17:14:02 UTC (rev 6837)
@@ -112,8 +112,8 @@
!...............................................
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
-| When sorting a list, the code to compare items called \sort_ordered: or
-| \sort_reversed: multiple times. Exactly one of these should be called.
+| When sorting a list, the code to compare items called \sort_return_same: or
+| \sort_return_swapped: multiple times. Exactly one of these should be called.
|...............................................
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -128,7 +128,8 @@
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
| When sorting a list, the code to compare items c and b did not call
-| \sort_ordered: nor \sort_reversed:. Exactly one of these should be called.
+| \sort_return_same: nor \sort_return_swapped:. Exactly one of these should be
+| called.
|...............................................
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -143,7 +144,8 @@
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
| When sorting a list, the code to compare items c and a did not call
-| \sort_ordered: nor \sort_reversed:. Exactly one of these should be called.
+| \sort_return_same: nor \sort_return_swapped:. Exactly one of these should be
+| called.
|...............................................
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!
@@ -157,8 +159,8 @@
!...............................................
l. ... }
|'''''''''''''''''''''''''''''''''''''''''''''''
-| When sorting a list, the code to compare items called \sort_ordered: or
-| \sort_reversed: multiple times. Exactly one of these should be called.
+| When sorting a list, the code to compare items called \sort_return_same: or
+| \sort_return_swapped: multiple times. Exactly one of these should be called.
|...............................................
{c}{a}{b}{d}
============================================================
More information about the latex3-commits
mailing list