[latex3-commits] [git/LaTeX3-latex3-latex3] master: Use new int_step variants to shorten some code (b45330a)

Bruno Le Floch bruno at le-floch.fr
Mon Apr 23 05:15:18 CEST 2018


Repository : https://github.com/latex3/latex3
On branch  : master
Link       : https://github.com/latex3/latex3/commit/b45330a3eb998f00cf04dee127131b75e8df3674

>---------------------------------------------------------------

commit b45330a3eb998f00cf04dee127131b75e8df3674
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Sun Apr 22 23:15:18 2018 -0400

    Use new int_step variants to shorten some code
    
    Almost all uses of int_step loops had a step of 1; adding these variants was
    probably right.


>---------------------------------------------------------------

b45330a3eb998f00cf04dee127131b75e8df3674
 l3experimental/l3str/testfiles/m3str-convert002.lvt |    2 +-
 l3experimental/xgalley/l3galley.dtx                 |   18 +++++++-----------
 l3kernel/l3file.dtx                                 |    8 +++-----
 l3kernel/l3final.dtx                                |    6 +++---
 l3kernel/l3intarray.dtx                             |    3 +--
 l3kernel/l3regex.dtx                                |   14 ++++++--------
 l3kernel/l3sort.dtx                                 |    4 ++--
 l3kernel/l3token.dtx                                |    6 +++---
 l3kernel/testfiles/m3fp-func001.lvt                 |    2 +-
 l3kernel/testfiles/m3fp-trig001.lvt                 |   18 +++++++++---------
 l3kernel/testfiles/m3intarray001.lvt                |    2 +-
 l3kernel/testfiles/m3prg004.lvt                     |    4 ++--
 l3kernel/testfiles/m3regex001.lvt                   |    4 ++--
 l3kernel/testfiles/m3tl-build001.lvt                |    2 +-
 l3trial/l3auxdata/l3auxdata.dtx                     |   10 +++++-----
 l3trial/l3bigint/testfiles/m3bigint001.lvt          |    2 +-
 16 files changed, 48 insertions(+), 57 deletions(-)

diff --git a/l3experimental/l3str/testfiles/m3str-convert002.lvt b/l3experimental/l3str/testfiles/m3str-convert002.lvt
index e3c7e5d..57eb7e9 100644
--- a/l3experimental/l3str/testfiles/m3str-convert002.lvt
+++ b/l3experimental/l3str/testfiles/m3str-convert002.lvt
@@ -35,7 +35,7 @@
     \tl_new:c { l_bytes_#1_tl }
     \tl_set:cx { l_bytes_#1_tl }
       {
-        \int_step_function:nnnN {#1} { 1 } { #1 + 15 }
+        \int_step_function:nnN {#1} { #1 + 15 }
           \__str_output_byte:n
       }
   }
diff --git a/l3experimental/xgalley/l3galley.dtx b/l3experimental/xgalley/l3galley.dtx
index a2f2411..3cb63d4 100644
--- a/l3experimental/xgalley/l3galley.dtx
+++ b/l3experimental/xgalley/l3galley.dtx
@@ -2333,10 +2333,9 @@
   {
     \etex_interlinepenalties:D
       \etex_interlinepenalties:D 0 \exp_stop_f:
-      \int_step_function:nnnN { 1 } { 1 } {#1}
+      \int_step_function:nN {#1}
         \@@_set_interline_penalty_auxi:n
-      \int_step_function:nnnN { #1 + 1 } { 1 }
-        { \etex_interlinepenalties:D 0 - 1 }
+      \int_step_function:nnN { #1 + 1 } { \etex_interlinepenalties:D 0 - 1 }
         \@@_set_interline_penalty_auxii:n
       \int_eval:n {#2} \exp_stop_f:
   }
@@ -2385,9 +2384,9 @@
 \cs_new_protected:Npn \@@_calc_interline_penalties:nn #1#2
   {
     \etex_interlinepenalties:D #1 ~
-      \int_step_function:nnnN { 1 } { 1 } {#2}
+      \int_step_function:nN {#2}
         \@@_calc_interline_penalties_auxi:n
-      \int_step_function:nnnN { #2 + 1 } { 1 } { #1 - 1 }
+      \int_step_function:nnN { #2 + 1 } { #1 - 1 }
         \@@_calc_interline_penalties_auxii:n
       \etex_interlinepenalties:D \etex_interlinepenalties:D 0 \exp_stop_f:
   }
@@ -2446,8 +2445,7 @@
   {
     \clist_set:Nx #1
       {
-        \int_step_function:nnnN { 1 } { 1 }
-          { \etex_clubpenalties:D 0 - 1 }
+        \int_step_function:nN { \etex_clubpenalties:D 0 - 1 }
           \@@_save_display_club_penalties:n
       }
   }
@@ -2457,8 +2455,7 @@
   {
     \clist_set:Nx #1
       {
-        \int_step_function:nnnN { 1 } { 1 }
-          { \etex_displaywidowpenalties:D 0 - 1 }
+        \int_step_function:nN { \etex_displaywidowpenalties:D 0 - 1 }
           \@@_save_display_widow_penalties:n
       }
   }
@@ -2471,8 +2468,7 @@
   {
     \clist_set:Nx #1
       {
-        \int_step_function:nnnN { 1 } { 1 }
-          { \etex_widowpenalties:D 0 - 1 }
+        \int_step_function:nN { \etex_widowpenalties:D 0 - 1 }
           \@@_save_widow_penalties:n
       }
   }
diff --git a/l3kernel/l3file.dtx b/l3kernel/l3file.dtx
index 950a7b8..24731d0 100644
--- a/l3kernel/l3file.dtx
+++ b/l3kernel/l3file.dtx
@@ -710,9 +710,8 @@
 %    \begin{macrocode}
 \prop_new:N \g_@@_streams_prop
 %<*package>
-\int_step_inline:nnnn
+\int_step_inline:nnn
   { 0 }
-  { 1 }
   {
     \cs_if_exist:NTF \normalend
       { \tex_count:D 38 ~ }
@@ -1040,7 +1039,7 @@
 \exp_args:Nnx \use:n
   { \seq_gset_split:Nnn \g_@@_streams_seq { } }
   {
-    \int_step_function:nnnN { 0 } { 1 } { \c_term_iow }
+    \int_step_function:nnN { 0 } { \c_term_iow }
       \prg_do_nothing:
   }
 \int_compare:nNnF \c_term_iow < { 18 }
@@ -1062,9 +1061,8 @@
 %    \begin{macrocode}
 \prop_new:N \g_@@_streams_prop
 %<*package>
-\int_step_inline:nnnn
+\int_step_inline:nnn
   { 0 }
-  { 1 }
   {
     \cs_if_exist:NTF \normalend
       { \tex_count:D 39 ~ }
diff --git a/l3kernel/l3final.dtx b/l3kernel/l3final.dtx
index 19ae76c..7acbb0b 100644
--- a/l3kernel/l3final.dtx
+++ b/l3kernel/l3final.dtx
@@ -75,10 +75,10 @@
 % All the characters in the range $0$--$31$ \emph{except} tab (|^^I|), nl
 % (|^^J|), ff (|^^L|) and cr (|^^M|).
 %    \begin{macrocode}
-\int_step_inline:nnnn { 0 } { 1 } { `\^^H }
+\int_step_inline:nnn { 0 } { `\^^H }
   { \char_set_catcode_invalid:n {#1} }
 \char_set_catcode_invalid:n { `\^^K }
-\int_step_inline:nnnn { `\^^N } { 1 } { 31 }
+\int_step_inline:nnn { `\^^N } { 31 }
   { \char_set_catcode_invalid:n {#1} }
 %    \end{macrocode}
 % The same is true for the top of the $7$-bit range.
@@ -276,7 +276,7 @@
               = "[latinmodern-math.otf]/OT:mode=base;script=math;+ssty=0;"~at~7pt \scan_stop:
             \tex_font:D \exp_not:c { TU/lmm/m/n/5 }
               = "[latinmodern-math.otf]/OT:mode=base;script=math;+ssty=1;"~at~5pt \scan_stop:
-            \exp_not:N \int_step_inline:nnnn { 0 } { 1 } { 3 }
+            \exp_not:N \int_step_inline:nnn { 0 } { 3 }
               {
                 \tex_textfont:D         ##1 = \exp_not:c { TU/lmm/m/n/10 }
                 \tex_scriptfont:D       ##1 = \exp_not:c { TU/lmm/m/n/7 }
diff --git a/l3kernel/l3intarray.dtx b/l3kernel/l3intarray.dtx
index d5aa932..8126ba4 100644
--- a/l3kernel/l3intarray.dtx
+++ b/l3kernel/l3intarray.dtx
@@ -168,8 +168,7 @@
     \tex_hyphenchar:D #1 = \int_eval:n {#2} \scan_stop:
     \int_compare:nNnT { \tex_hyphenchar:D #1 } > 0
       { \tex_fontdimen:D \tex_hyphenchar:D #1 #1 = \c_zero_dim }
-    \int_step_inline:nnnn { 1 } { 1 } { 8 }
-      { \tex_fontdimen:D ##1 #1 = \c_zero_dim }
+    \int_step_inline:nn { 8 } { \tex_fontdimen:D ##1 #1 = \c_zero_dim }
   }
 %    \end{macrocode}
 % \end{macro}
diff --git a/l3kernel/l3regex.dtx b/l3kernel/l3regex.dtx
index 93c7bc3..07a45db 100644
--- a/l3kernel/l3regex.dtx
+++ b/l3kernel/l3regex.dtx
@@ -4592,8 +4592,8 @@
 \cs_new_protected:Npn \@@_match_init:
   {
     \bool_gset_false:N \g_@@_success_bool
-    \int_step_inline:nnnn
-      \l_@@_min_state_int { 1 } { \l_@@_max_state_int - 1 }
+    \int_step_inline:nnn
+      \l_@@_min_state_int { \l_@@_max_state_int - 1 }
       { \__kernel_intarray_gset:Nnn \g_@@_state_active_intarray {##1} { 1 } }
     \int_set_eq:NN \l_@@_min_active_int \l_@@_max_state_int
     \int_zero:N \l_@@_step_int
@@ -4692,9 +4692,8 @@
     \use:x
       {
         \int_set_eq:NN \l_@@_max_active_int \l_@@_min_active_int
-        \int_step_function:nnnN
+        \int_step_function:nnN
           { \l_@@_min_active_int }
-          { 1 }
           { \l_@@_max_active_int - 1 }
           \@@_match_one_active:n
       }
@@ -5980,8 +5979,8 @@
       \flag_clear:n { @@_end }
       \seq_set_from_function:NnN \l_@@_internal_seq
         {
-          \int_step_function:nnnN { \l_@@_min_submatch_int }
-            { 1 } { \l_@@_submatch_int - 1 }
+          \int_step_function:nnN { \l_@@_min_submatch_int }
+            { \l_@@_submatch_int - 1 }
         }
         \@@_extract_seq_aux:n
       \int_compare:nNnF
@@ -6587,9 +6586,8 @@
   {
     \cs_new_protected:Npn \@@_trace_states:n #1
       {
-        \int_step_inline:nnnn
+        \int_step_inline:nnn
           \l_@@_min_state_int
-          { 1 }
           { \l_@@_max_state_int - 1 }
           {
             \@@_trace:nnx { regex } {#1}
diff --git a/l3kernel/l3sort.dtx b/l3kernel/l3sort.dtx
index 809d213..9fcea10 100644
--- a/l3kernel/l3sort.dtx
+++ b/l3kernel/l3sort.dtx
@@ -434,8 +434,8 @@
       \@@_main:NNNn #1 #2 #4 {#5}
       \seq_gset_from_inline_x:Nnn \g_@@_internal_seq
         {
-          \int_step_function:nnnN
-            { \l_@@_min_int } { 1 } { \l_@@_top_int - 1 }
+          \int_step_function:nnN
+            { \l_@@_min_int } { \l_@@_top_int - 1 }
         }
         { \tex_the:D \tex_toks:D ##1 }
     \group_end:
diff --git a/l3kernel/l3token.dtx b/l3kernel/l3token.dtx
index f355f70..439bd6b 100644
--- a/l3kernel/l3token.dtx
+++ b/l3kernel/l3token.dtx
@@ -1534,15 +1534,15 @@
             }
         }
 %<*package>
-      \int_step_function:nnnN { 0 }  { 1 } { 11 }  \@@_tmp:n
+      \int_step_function:nnN { 0 } { 11 }  \@@_tmp:n
       \group_begin:
         \tl_replace_once:Nnn \l_@@_tmp_tl { ^^@ } { \ERROR }
         \@@_tmp:n { 12 }
       \group_end:
-      \int_step_function:nnnN { 13 } { 1 } { 255 } \@@_tmp:n
+      \int_step_function:nnN { 13 } { 255 } \@@_tmp:n
 %</package>
 %<*initex>
-      \int_step_function:nnnN { 0 }  { 1 } { 255 }  \@@_tmp:n
+      \int_step_function:nnN { 0 } { 255 }  \@@_tmp:n
 %</initex>
       \cs_new:Npn \@@_generate_aux:nnw #1#2#3 \exp_end:
         {
diff --git a/l3kernel/testfiles/m3fp-func001.lvt b/l3kernel/testfiles/m3fp-func001.lvt
index b72904a..3ce4c9b 100644
--- a/l3kernel/testfiles/m3fp-func001.lvt
+++ b/l3kernel/testfiles/m3fp-func001.lvt
@@ -62,7 +62,7 @@
     \fp_to_tl:n
       {
         \veclenii:w
-          ( 0 \int_step_function:nnnN { 10 } { 1 } { 20 } , )
+          ( 0 \int_step_function:nnN { 10 } { 20 } , )
       }
     \NEWLINE
   }
diff --git a/l3kernel/testfiles/m3fp-trig001.lvt b/l3kernel/testfiles/m3fp-trig001.lvt
index 0f6ab97..7b5d404 100644
--- a/l3kernel/testfiles/m3fp-trig001.lvt
+++ b/l3kernel/testfiles/m3fp-trig001.lvt
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2012,2013 LaTeX3 Project
+% Copyright (C) 2012,2013,2018 LaTeX3 Project
 %
 
 \documentclass{minimal}
@@ -246,8 +246,8 @@
 \TIMO
 \TESTEXP { Sine~[0,pi] }
   {
-    \int_step_function:nnnN { 0 }{1}{303} \test:n
-    \int_step_function:nnnN {304}{1}{314} \test:n
+    \int_step_function:nnN { 0 } {303} \test:n
+    \int_step_function:nnN {304} {314} \test:n
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -256,7 +256,7 @@
 \TIMO
 \TESTEXP { Sine~[-10,10] }
   {
-    \int_step_function:nnnN {-100}{1}{100} \test:n
+    \int_step_function:nnN {-100} {100} \test:n
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -286,7 +286,7 @@
 \TIMO
 \TESTEXP { Cos~check~quadrants~[-10,10] }
   {
-    \int_step_function:nnnN {-10}{1}{10} \test:n
+    \int_step_function:nnN {-10} {10} \test:n
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -295,7 +295,7 @@
 \TIMO
 \TESTEXP { Tan~check~quadrants~[-10,10] }
   {
-    \int_step_function:nnnN {-10}{1}{10} \test:n
+    \int_step_function:nnN {-10} {10} \test:n
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -304,7 +304,7 @@
 \TIMO
 \TESTEXP { Cot~check~quadrants~[-10,10] }
   {
-    \int_step_function:nnnN {-10}{1}{10} \test:n
+    \int_step_function:nnN {-10} {10} \test:n
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -313,7 +313,7 @@
 \TIMO
 \TESTEXP { Sec~check~quadrants~[-10,10] }
   {
-    \int_step_function:nnnN {-10}{1}{10} \test:n
+    \int_step_function:nnN {-10} {10} \test:n
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -322,7 +322,7 @@
 \TIMO
 \TESTEXP { Csc~check~quadrants~[-10,10] }
   {
-    \int_step_function:nnnN {-10}{1}{10} \test:n
+    \int_step_function:nnN {-10} {10} \test:n
   }
 
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/l3kernel/testfiles/m3intarray001.lvt b/l3kernel/testfiles/m3intarray001.lvt
index 1600d0c..a1cb632 100644
--- a/l3kernel/testfiles/m3intarray001.lvt
+++ b/l3kernel/testfiles/m3intarray001.lvt
@@ -70,7 +70,7 @@
 \TEST { Any~stray~non-zero? }
   {
     \intarray_new:Nn \g_testd_intarray { 25 }
-    \int_step_inline:nnnn { 1 } { 1 } { \intarray_count:N \g_testd_intarray }
+    \int_step_inline:nn { \intarray_count:N \g_testd_intarray }
       { \int_compare:nNnF { \intarray_item:Nn \g_testd_intarray {#1} } = 0 { \TYPE {#1} } }
   }
 
diff --git a/l3kernel/testfiles/m3prg004.lvt b/l3kernel/testfiles/m3prg004.lvt
index a90d2ac..3b53641 100644
--- a/l3kernel/testfiles/m3prg004.lvt
+++ b/l3kernel/testfiles/m3prg004.lvt
@@ -100,7 +100,7 @@
         \seq_map_inline:Nn \l_test_seq
           {
             \tl_map_inline:nn { a b c }
-              { \int_step_inline:nnnn { 1 } { 1 } { 1 } { \tl_map_break: } }
+              { \int_step_inline:nn { 1 } { \tl_map_break: } }
           }
       }
   }
@@ -108,7 +108,7 @@
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 \TEST { map_variable~and~catcode~6~tokens }
   {
-    \int_step_variable:nnnNn { 1 } { 1 } { 2 } \l_tmpa_tl
+    \int_step_variable:nNn { 2 } \l_tmpa_tl
       {
         \tl_map_variable:nNn { a b } \l_tmpb_tl
           {
diff --git a/l3kernel/testfiles/m3regex001.lvt b/l3kernel/testfiles/m3regex001.lvt
index b5c46ca..03e0a99 100644
--- a/l3kernel/testfiles/m3regex001.lvt
+++ b/l3kernel/testfiles/m3regex001.lvt
@@ -1,5 +1,5 @@
 %
-% Copyright (C) 2011,2013-2014,2017 LaTeX3 Project
+% Copyright (C) 2011,2013-2014,2017-2018 LaTeX3 Project
 \documentclass{minimal}
 \input{regression-test}
 
@@ -81,7 +81,7 @@
 \tl_new:N \g_ascii_chars_str
 \cs_set:Npn \test_tmp:n #1 { \char_generate:nn {#1} { 12 } }
 \tl_gset:Nx \g_ascii_chars_str
-  { \int_step_function:nnnN { 0 } { 1 } { 127 } \test_tmp:n }
+  { \int_step_function:nnN { 0 } { 127 } \test_tmp:n }
 \tl_greplace_once:Nnn \g_ascii_chars_str { ' } { ' ^^J }
 \tl_greplace_once:Nnn \g_ascii_chars_str { ` } { ^^J ` }
 % We add a couple line-breaks to avoid over-long lines
diff --git a/l3kernel/testfiles/m3tl-build001.lvt b/l3kernel/testfiles/m3tl-build001.lvt
index 86a25dc..0da4636 100644
--- a/l3kernel/testfiles/m3tl-build001.lvt
+++ b/l3kernel/testfiles/m3tl-build001.lvt
@@ -27,7 +27,7 @@
       \tl_build_end:N \l_tmpa_tl
       \TYPE { \tl_to_str:N \l_tmpa_tl }
       \tl_build_gbegin:N \g_tmpb_tl
-      \int_step_inline:nnnn { 1 } { 1 } { 154 }
+      \int_step_inline:nn { 154 }
         {
           \tl_build_gput_right:Nn \g_tmpb_tl { #1 : }
           \tl_build_gput_left:Nn \g_tmpb_tl { #1 ~ }
diff --git a/l3trial/l3auxdata/l3auxdata.dtx b/l3trial/l3auxdata/l3auxdata.dtx
index e08f9e9..23f0ff9 100644
--- a/l3trial/l3auxdata/l3auxdata.dtx
+++ b/l3trial/l3auxdata/l3auxdata.dtx
@@ -617,7 +617,7 @@ Don't~ look~ here:~ check~ your~ console~ output!
 
 \auxread {blob1} { \typeout{#1} }
 
-\int_step_inline:nnnn {1}{1}{10000}
+\int_step_inline:nn {10000}
  {
   \auxwrite {blob1} { 1-#1 }
  }
@@ -1051,7 +1051,7 @@ Don't~ look~ here:~ check~ your~ console~ output!
 %<debug>    \typeout{=================}
     \int_set:Nn \l_@@_files_int { \@@_iow_count_avail: }
 %<debug>    \typeout{Have~\int_use:N \l_@@_files_int\space write~registers.}
-    \int_step_inline:nnnn {1}{1}{\l_@@_files_int}
+    \int_step_inline:nn {\l_@@_files_int}
       {
         \exp_args:Nc \iow_new:N {g_@@_write_##1_stream}
         %% TODO: reuse other streams opened by this package
@@ -1077,13 +1077,13 @@ Don't~ look~ here:~ check~ your~ console~ output!
 %<debug>        \typeout{Need~to~write~\seq_count:c {g_@@_cctags_ ##1 _seq}~tag(s);~will~take~\int_use:N \l_@@_groups_int\space iteration(s).}
 
         % iterate that many times:
-        \int_step_inline:nnnn {1}{1}{\l_@@_groups_int}
+        \int_step_inline:nn {\l_@@_groups_int}
           {
             \group_begin:
             ##2 % setup catcodes
 
             % setup each stream for corresponding tags:
-            \int_step_inline:nnnn {1}{1}{\l_@@_files_int}
+            \int_step_inline:nn {\l_@@_files_int}
               {
                 \seq_gpop_left:cNT {g_@@_cctags_ ##1 _seq} \l_@@_tag_tl
                   {
@@ -1112,7 +1112,7 @@ Don't~ look~ here:~ check~ your~ console~ output!
             \file_input:n { \jobname.aux.##1 }
 
             % finish up:
-            \int_step_inline:nnnn {1}{1}{\l_@@_files_int}
+            \int_step_inline:nn {\l_@@_files_int}
               { \iow_close:c {g_@@_write_ ########1 _stream} }
 
             \group_end:
diff --git a/l3trial/l3bigint/testfiles/m3bigint001.lvt b/l3trial/l3bigint/testfiles/m3bigint001.lvt
index 96718fa..4d47ba8 100644
--- a/l3trial/l3bigint/testfiles/m3bigint001.lvt
+++ b/l3trial/l3bigint/testfiles/m3bigint001.lvt
@@ -287,7 +287,7 @@
 
 % \TESTEXP { count~divisors }
 %   {
-%     \int_step_function:nnnN { 0 } { 1 } { 30 } \test:n
+%     \int_step_function:nnN { 0 } { 30 } \test:n
 %     \test:n {-1}
 %     \test:n {-36}
 %   }





More information about the latex3-commits mailing list