[latex3-commits] [l3svn] r6795 - When asked to sort too-long list, do nothing

noreply at latex-project.org noreply at latex-project.org
Thu Dec 15 06:45:53 CET 2016


Author: bruno
Date: 2016-12-15 06:45:53 +0100 (Thu, 15 Dec 2016)
New Revision: 6795

Modified:
   trunk/l3experimental/l3sort/l3sort.dtx
   trunk/l3experimental/l3sort/testfiles/m3sort001.lvt
Log:
When asked to sort too-long list, do nothing

Previously, as many items as possible were sorted and other
items were deleted.


Modified: trunk/l3experimental/l3sort/l3sort.dtx
===================================================================
--- trunk/l3experimental/l3sort/l3sort.dtx	2016-12-15 05:40:58 UTC (rev 6794)
+++ trunk/l3experimental/l3sort/l3sort.dtx	2016-12-15 05:45:53 UTC (rev 6795)
@@ -441,13 +441,13 @@
 \cs_new_protected:Npn \seq_sort:Nn
   {
     \@@_main:NNNnNn \tl_set:Nn
-      \seq_map_inline:Nn \seq_map_break:
+      \seq_map_inline:Nn \seq_map_break:n
       { \s__seq \@@_toks:NN \exp_not:N \__seq_item:n }
   }
 \cs_new_protected:Npn \seq_gsort:Nn
   {
     \@@_main:NNNnNn \tl_gset:Nn
-      \seq_map_inline:Nn \seq_map_break:
+      \seq_map_inline:Nn \seq_map_break:n
       { \s__seq \@@_toks:NN \exp_not:N \__seq_item:n }
   }
 %    \end{macrocode}
@@ -463,13 +463,13 @@
 \cs_new_protected:Npn \tl_sort:Nn
   {
     \@@_main:NNNnNn \tl_set:Nn
-      \tl_map_inline:Nn \tl_map_break:
+      \tl_map_inline:Nn \tl_map_break:n
       { \@@_toks:NN \prg_do_nothing: \prg_do_nothing: }
   }
 \cs_new_protected:Npn \tl_gsort:Nn
   {
     \@@_main:NNNnNn \tl_gset:Nn
-      \tl_map_inline:Nn \tl_map_break:
+      \tl_map_inline:Nn \tl_map_break:n
       { \@@_toks:NN \prg_do_nothing: \prg_do_nothing: }
   }
 %    \end{macrocode}
@@ -498,7 +498,7 @@
     \clist_if_empty:NF #2
       {
         \@@_main:NNNnNn #1
-          \clist_map_inline:Nn \clist_map_break:
+          \clist_map_inline:Nn \clist_map_break:n
           {
             \exp_last_unbraced:Nf \use_none:n
               { \@@_toks:NN \exp_args:No \__clist_wrap_item:n }
@@ -1031,7 +1031,7 @@
 %
 % \subsection{Messages}
 %
-% \begin{macro}{\@@_too_long_error:NNw}
+% \begin{macro}[aux]{\@@_too_long_error:NNw, \@@_too_long_error_aux:w}
 %   When there are too many items in a sequence, this is an error, and
 %   we clean up properly the mapping over items in the list: break using
 %   the type-specific breaking function |#1|.
@@ -1043,8 +1043,10 @@
       { \token_to_str:N #2 }
       { \int_eval:n { \l_@@_true_max_int - \l_@@_min_int } }
       { \int_eval:n { \l_@@_top_int - \l_@@_min_int } }
-    #1
+    #1 \@@_too_long_error_aux:w
   }
+\cs_new_protected:Npn \@@_too_long_error_aux:w #1 \use:x #2
+  { \group_end: }
 \__msg_kernel_new:nnnn { sort } { too-large }
   { The~list~#1~is~too~long~to~be~sorted~by~TeX. }
   {

Modified: trunk/l3experimental/l3sort/testfiles/m3sort001.lvt
===================================================================
--- trunk/l3experimental/l3sort/testfiles/m3sort001.lvt	2016-12-15 05:40:58 UTC (rev 6794)
+++ trunk/l3experimental/l3sort/testfiles/m3sort001.lvt	2016-12-15 05:45:53 UTC (rev 6795)
@@ -97,8 +97,6 @@
     < 300
   }
   { \use:c { newtoks } \l_test_toks }
-\int_const:Nn \l_test_expected_count_int
-  { \c_max_register_int * 3 / 4 - 300 }
 \TIMO
 
 
@@ -106,21 +104,21 @@
   {
     \tl_sort:Nn \l_tmpa_tl { \sort_return_unchanged: }
     \int_compare:nF
-      { \tl_count:N \l_tmpa_tl = \l_test_expected_count_int }
+      { \tl_count:N \l_tmpa_tl = 50000 }
       { \ERROR }
     \OMIT
     \use:c { newtoks } \l_test_toks
     \TIMO
     \clist_sort:Nn \l_tmpa_clist { \sort_return_unchanged: }
     \int_compare:nF
-      { \clist_count:N \l_tmpa_clist = \l_test_expected_count_int - 1 }
+      { \clist_count:N \l_tmpa_clist = 50000 }
       { \ERROR }
     \OMIT
     \use:c { newtoks } \l_test_toks
     \TIMO
     \seq_sort:Nn \l_tmpa_seq { \sort_return_unchanged: }
     \int_compare:nF
-      { \seq_count:N \l_tmpa_seq = \l_test_expected_count_int - 2 }
+      { \seq_count:N \l_tmpa_seq = 50000 }
       { \ERROR }
   }
 



More information about the latex3-commits mailing list