[latex3-commits] [git/LaTeX3-latex3-latex3] scan-quark: Reduce argument juggling when defining new quark conditionals (078f4d740)

Bruno Le Floch bruno at le-floch.fr
Wed May 6 14:07:31 CEST 2020


Repository : https://github.com/latex3/latex3
On branch  : scan-quark
Link       : https://github.com/latex3/latex3/commit/078f4d740e3d582cbcd6cb49cd523733f4c8e552

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

commit 078f4d740e3d582cbcd6cb49cd523733f4c8e552
Author: Bruno Le Floch <bruno at le-floch.fr>
Date:   Wed May 6 14:07:31 2020 +0200

    Reduce argument juggling when defining new quark conditionals


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

078f4d740e3d582cbcd6cb49cd523733f4c8e552
 l3kernel/l3quark.dtx | 48 ++++++++++++++++++------------------------------
 1 file changed, 18 insertions(+), 30 deletions(-)

diff --git a/l3kernel/l3quark.dtx b/l3kernel/l3quark.dtx
index 2f4bde79f..b2a7f44e0 100644
--- a/l3kernel/l3quark.dtx
+++ b/l3kernel/l3quark.dtx
@@ -632,11 +632,11 @@
 %   \@@_new_test_aux:nnNNnnnn, \@@_new_test_choose:nNnnnn}
 %    \begin{macrocode}
 \cs_new_protected:Npn \__kernel_quark_new_test:N #1
-  { \@@_new_test_aux:Nx #1 { __ \@@_get_module_name:N #1 } }
+  { \@@_new_test_aux:Nx #1 { \@@_get_module_name:N #1 } }
 \cs_new_protected:Npn \@@_new_test_aux:Nn #1 #2
   {
     \@@_new_test:Nccn #1
-      { q #2 _recursion_tail } { q #2 _recursion_stop } {#2}
+      { q__#2_recursion_tail } { q__#2_recursion_stop } { __#2 }
   }
 \cs_generate_variant:Nn \@@_new_test_aux:Nn { Nx }
 \cs_new_protected:Npn \@@_new_test:NNNn #1
@@ -650,7 +650,7 @@
   {
     \@@_new_conditional:Nxxn #1
       { \@@_get_quark_name:N #1 }
-      { __ \@@_get_module_name:N #1 }
+      { \@@_get_module_name:N #1 }
   }
 \cs_new_protected:Npn \@@_new_conditional:Nnnn #1
   {
@@ -811,48 +811,36 @@
 %   }
 %   These macros implement the two possibilities for branching quark
 %   conditionals, passing
-%   the right arguments to \cs{@@_new_conditional_aux_do:nn},
-%   which defines some auxiliaries, and then to
-%   \cs{@@_new_conditional_define:nNNNNn} which defines the
+%   the right arguments to \cs{@@_new_conditional_aux_do:NNnnn},
+%   which defines some auxiliaries and defines the
 %   main conditionals.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_new_conditional_n:Nnnn #1 #2 #3
-  {
-    \@@_new_conditional_aux_do:nn {#3} {#2}
-      \@@_new_conditional_define:nNNNNn #1 \use_i:nn
-  }
-\cs_new_protected:Npn \@@_new_conditional_N:Nnnn #1 #2 #3
-  {
-    \@@_new_conditional_aux_do:nn {#3} {#2}
-      \@@_new_conditional_define:nNNNNn #1 \use_ii:nn
-  }
+\cs_new_protected:Npn \@@_new_conditional_n:Nnnn
+  { \@@_new_conditional_aux_do:NNnnn \use_i:nn }
+\cs_new_protected:Npn \@@_new_conditional_N:Nnnn
+  { \@@_new_conditional_aux_do:NNnnn \use_ii:nn }
 %    \end{macrocode}
 % \end{macro}
 %
 % \begin{macro}{
-%     \@@_new_conditional_aux_do:nn,
-%     \@@_conditional_define_aux:NN,
-%     \@@_new_conditional_define:nNNNNn
+%     \@@_new_conditional_aux_do:NNnnn,
+%     \@@_new_conditional_define:NNNNn,
 %   }
 %   Similar to the previous macros, but branching conditionals only require
 %   one auxiliary, so we take a shortcut.
 %    \begin{macrocode}
-\cs_new_protected:Npn \@@_new_conditional_aux_do:nn #1 #2
+\cs_new_protected:Npn \@@_new_conditional_aux_do:NNnnn #1 #2 #3 #4
   {
-    \exp_args:Ncc \@@_conditional_define_aux:NN
-      { #1 _if_quark_ #2 :w } { q #1 _ #2 }
+    \exp_args:Ncc \@@_new_conditional_define:NNNNn
+      { __ #4 _if_quark_ #3 :w } { q__ #4 _ #3 } #2 #1
   }
-\cs_new_protected:Npn \@@_conditional_define_aux:NN #1 #2 #3
+\cs_new_protected:Npn \@@_new_conditional_define:NNNNn #1 #2 #3 #4 #5
   {
     \cs_gset:Npn #1  ##1 #2 ##2 ? ##3 ?! { ##1 ##2 }
-    #3 {##1} #1 #2
-  }
-\cs_new_protected:Npn \@@_new_conditional_define:nNNNNn #1 #2 #3 #4 #5 #6
-  {
-    \exp_args:Nno \use:n { \prg_new_conditional:Npnn #4 #1 {#6} }
+    \exp_args:Nno \use:n { \prg_new_conditional:Npnn #3 ##1 {#5} }
       {
-        #5 { \@@_if_empty_if:o { #2 {} ##1 {} ?! #3 ??! } }
-           { \if_meaning:w #3 ##1 }
+        #4 { \@@_if_empty_if:o { #1 {} ##1 {} ?! #2 ??! } }
+           { \if_meaning:w #2 ##1 }
         \prg_return_true: \else: \prg_return_false: \fi:
       }
   }





More information about the latex3-commits mailing list.