[latex3-commits] [git/LaTeX3-latex3-latex3] scan-quark: An auxiliary to define quark-recursion functions (f4eb48d6a)

Phelype Oleinik phe.h.o1 at gmail.com
Tue Mar 10 13:35:16 CET 2020


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

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

commit f4eb48d6a873f2ea7774b94e4795c7c88ec18f39
Author: Phelype Oleinik <phe.h.o1 at gmail.com>
Date:   Tue Mar 10 09:35:16 2020 -0300

    An auxiliary to define quark-recursion functions
    
    This commit starts on the work of replacing public quarks in the kernel by private ones (#593), so that public quarks don't interfere in kernel functions.


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

f4eb48d6a873f2ea7774b94e4795c7c88ec18f39
 l3kernel/l3quark.dtx | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 58 insertions(+)

diff --git a/l3kernel/l3quark.dtx b/l3kernel/l3quark.dtx
index 25d382e2f..fe37c251c 100644
--- a/l3kernel/l3quark.dtx
+++ b/l3kernel/l3quark.dtx
@@ -464,6 +464,64 @@
 % \end{macro}
 % \end{macro}
 %
+% \begin{macro}{
+%     \__kernel_quark_new_recursion_tail_stop:n,
+%     \__kernel_quark_new_recursion_tail_stop_do:n,
+%   }
+% \begin{macro}{
+%     \@@_new_recursion_tail_auxi:nnNNn,
+%     \@@_new_recursion_tail_auxii:NNNNNN,
+%   }
+%   Basically the same as above, but generic so that it is possible to
+%   define \cs[no-index]{quark_if_recursion_tail...} functions on-the-fly,
+%   for each module which needs them.
+%
+%   \cs{__kernel_quark_new_recursion_tail_stop:n}|{ __mod }| defines the
+%   top-level \cs[no-index]{__mod_quark_if_recursion_tail_stop:n}, and
+%   the auxiliaries \cs[no-index]{__mod_quark_if_recursion_tail:w} and
+%   \cs[no-index]{__mod_use_none_delimit_by_q_recursion_stop:w}.
+%
+%   \cs{__kernel_quark_new_recursion_tail_stop_do:n}|{ __mod }| defines the
+%   top-level \cs[no-index]{__mod_quark_if_recursion_tail_stop_do:nn}, and
+%   the auxiliaries \cs[no-index]{__mod_quark_if_recursion_tail:w} and
+%   \cs[no-index]{__mod_use_i_delimit_by_q_recursion_stop:nw}.
+%
+%   In either case, the corresponding \cs[no-index]{q__mod_recursion_tail}
+%   and \cs[no-index]{q__mod_recursion_stop} have to be manually defined.
+%    \begin{macrocode}
+\cs_new_protected:Npn \__kernel_quark_new_recursion_tail_stop:n #1
+  {
+    \@@_new_recursion_tail_auxi:nnNNn {#1} { stop:n }
+      \use_none_delimit_by_q_recursion_stop:w \use_none:n { }
+  }
+\cs_new_protected:Npn \__kernel_quark_new_recursion_tail_stop_do:n #1
+  {
+    \@@_new_recursion_tail_auxi:nnNNn {#1} { stop_do:nn }
+      \use_i_delimit_by_q_recursion_stop:nw \use:n { \use_none:n }
+  }
+\cs_new_protected:Npn \@@_new_recursion_tail_auxi:nnNNn #1 #2 #3
+  {
+    \use:x
+      {
+        \@@_new_recursion_tail_auxii:NNNNNNn
+          \exp_not:c { #1_quark_if_recursion_tail_#2 }
+          \exp_not:c { #1_quark_if_recursion_tail:w }
+          \exp_not:c { q #1 _recursion_tail }
+          \exp_not:c { q #1 _recursion_stop }
+          \exp_not:c { #1_\cs_to_str:N #3 }
+      }
+  }
+\cs_new_protected:Npn \@@_new_recursion_tail_auxii:NNNNNNn #1 #2 #3 #4 #5 #6 #7
+  {
+    \cs_new:Npn #1  ##1
+      { \tl_if_empty:oTF { #2 {} ##1 {} ?! #3 ??! } {#5} {#7} }
+    \cs_gset:Npn #2  ##1 #3 ##2 ? ##3 ?! { ##1 ##2 }
+    \use:e { \cs_gset:Npn \exp_not:N #5 ##1 #6 {##2} \exp_not:N #4 { #6{##1} } }
+  }
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}{\quark_if_recursion_tail_break:NN}
 % \begin{macro}{\quark_if_recursion_tail_break:nN}
 %   Analogues of the \cs[index=quark_if_recursion_tail_stop:n]





More information about the latex3-commits mailing list.