[latex3-commits] [git/LaTeX3-latex3-latex3] master: Avoid nesting \__draw_point_process:nn calls (4b1620b)

Joseph Wright joseph.wright at morningstar2.co.uk
Sun Feb 10 11:41:56 CET 2019


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

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

commit 4b1620bd5a361894af657655511a9b23f1d18633
Author: Joseph Wright <joseph.wright at morningstar2.co.uk>
Date:   Sun Feb 10 10:41:56 2019 +0000

    Avoid nesting \__draw_point_process:nn calls
    
    This makes the code clearer but also looks forward to using e-type expansion.


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

4b1620bd5a361894af657655511a9b23f1d18633
 l3experimental/l3draw/l3draw-points.dtx |   87 +++++++++++++++++++------------
 1 file changed, 55 insertions(+), 32 deletions(-)

diff --git a/l3experimental/l3draw/l3draw-points.dtx b/l3experimental/l3draw/l3draw-points.dtx
index 8c1c1a0..fe461d6 100644
--- a/l3experimental/l3draw/l3draw-points.dtx
+++ b/l3experimental/l3draw/l3draw-points.dtx
@@ -93,11 +93,17 @@
 % \subsection{Support functions}
 %
 % \begin{macro}[EXP]{\@@_point_process:nn}
-% \begin{macro}[EXP]{\@@_point_process_auxi:nn, \@@_point_process_auxi:fn}
+% \begin{macro}[EXP]{\@@_point_process_auxi:nn}
 % \begin{macro}[EXP]{\@@_point_process_auxii:nw}
 % \begin{macro}[EXP]{\@@_point_process:nnn}
-% \begin{macro}[EXP]{\@@_point_process_auxiii:nnn, \@@_point_process_auxiii:ffn}
+% \begin{macro}[EXP]{\@@_point_process_auxiii:nnn}
 % \begin{macro}[EXP]{\@@_point_process_auxiv:nw}
+% \begin{macro}[EXP]{\@@_point_process:nnnn}
+% \begin{macro}[EXP]{\@@_point_process_auxv:nnnn}
+% \begin{macro}[EXP]{\@@_point_process_auxvi:nw}
+% \begin{macro}[EXP]{\@@_point_process:nnnnn}
+% \begin{macro}[EXP]{\@@_point_process_auxvii:nnnnn}
+% \begin{macro}[EXP]{\@@_point_process_auxviii:nw}
 %   Execute whatever code is passed to extract the $x$ and $y$ co-ordinates.
 %   The first argument here should itself absorb two arguments. There is
 %   also a version to deal with two co-ordinates: common enough to justify a
@@ -105,27 +111,55 @@
 %    \begin{macrocode}
 \cs_new:Npn \@@_point_process:nn #1#2
   {
-    \@@_point_process_auxi:fn
+    \exp_args:Nf \@@_point_process_auxi:nn
       { \@@_point_to_dim:n {#2} }
       {#1}
   }
 \cs_new:Npn \@@_point_process_auxi:nn #1#2
   { \@@_point_process_auxii:nw {#2} #1 \q_stop }
-\cs_generate_variant:Nn \@@_point_process_auxi:nn { f }
 \cs_new:Npn \@@_point_process_auxii:nw #1 #2 , #3 \q_stop
   { #1 {#2} {#3} }
 \cs_new:Npn \@@_point_process:nnn #1#2#3
   {
-    \@@_point_process_auxiii:ffn
+    \exp_args:Nff \@@_point_process_auxiii:nnn
       { \@@_point_to_dim:n {#2} }
       { \@@_point_to_dim:n {#3} }
       {#1}
   }
 \cs_new:Npn \@@_point_process_auxiii:nnn #1#2#3
   { \@@_point_process_auxiv:nw {#3} #1 \q_mark #2 \q_stop }
-\cs_generate_variant:Nn \@@_point_process_auxiii:nnn { ff }
 \cs_new:Npn \@@_point_process_auxiv:nw #1 #2 , #3 \q_mark #4 , #5 \q_stop
   { #1 {#2} {#3} {#4} {#5} }
+\cs_new:Npn \@@_point_process:nnnn #1#2#3#4
+  {
+    \exp_args:Nfff \@@_point_process_auxv:nnnn
+      { \@@_point_to_dim:n {#2} }
+      { \@@_point_to_dim:n {#3} }
+      { \@@_point_to_dim:n {#4} }
+      {#1}
+  }
+\cs_new:Npn \@@_point_process_auxv:nnnn #1#2#3#4
+  { \@@_point_process_auxvi:nw {#4} #1 \q_mark #2 \q_mark #3 \q_stop }
+\cs_new:Npn \@@_point_process_auxvi:nw
+  #1 #2 , #3 \q_mark #4 , #5 \q_mark #6 , #7 \q_stop
+  { #1 {#2} {#3} {#4} {#5} {#6} {#7} }
+\cs_new:Npn \@@_point_process:nnnnn #1#2#3#4#5
+  {
+    \exp_args:Nffff \@@_point_process_auxvii:nnnnn
+      { \@@_point_to_dim:n {#2} }
+      { \@@_point_to_dim:n {#3} }
+      { \@@_point_to_dim:n {#4} }
+      { \@@_point_to_dim:n {#5} }
+      {#1}
+  }
+\cs_new:Npn \@@_point_process_auxvii:nnnnn #1#2#3#4#5
+  {
+    \@@_point_process_auxviii:nw
+      {#5} #1 \q_mark #2 \q_mark #3 \q_mark #4 \q_stop
+  }
+\cs_new:Npn \@@_point_process_auxviii:nw
+  #1 #2 , #3 \q_mark #4 , #5 \q_mark #6 , #7 \q_mark #8 , #9 \q_stop
+  { #1 {#2} {#3} {#4} {#5} {#6} {#7} {#8} {#9} }
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
@@ -235,24 +269,21 @@
 %    \begin{macrocode}
 \cs_new:Npn \draw_point_intersect_lines:nnnn #1#2#3#4
   {
-    \@@_point_process:nnn
-      {
-        \@@_point_process:nnn
-          { \@@_point_intersect_lines:nnnnnnnn } {#3} {#4}
-      }
-      {#1} {#2}
+    \@@_point_process:nnnnn
+      { \@@_point_intersect_lines:nnnnnnnn }
+      {#1} {#2} {#3} {#4}
   }
 %    \end{macrocode}
 %   At this stage we have all of the information we need, fully expanded:
 %   \begin{enumerate}[label = \#\arabic*, font = \ttfamily]
-%     \item $x_{3}$
-%     \item $y_{3}$
-%     \item $x_{4}$
-%     \item $y_{4}$
 %     \item $x_{1}$
 %     \item $y_{1}$
 %     \item $x_{2}$
 %     \item $y_{2}$
+%     \item $x_{3}$
+%     \item $y_{3}$
+%     \item $x_{4}$
+%     \item $y_{4}$
 %   \end{enumerate}
 %   so now just have to do all of the calculation.
 %    \begin{macrocode}
@@ -529,18 +560,14 @@
 %    \begin{macrocode}
 \cs_new:Npn \draw_point_interpolate_arcaxes:nnnnnn #1#2#3#4#5#6
   {
-    \@@_point_process:nnn
-      {
-        \@@_point_process:nn
-          { \@@_point_interpolate_arcaxes_auxi:nnnnnnnnn {#1} {#5} {#6} }
-          {#4}
-      }
-      {#2} {#3}
+    \@@_point_process:nnnn
+      { \@@_point_interpolate_arcaxes_auxi:nnnnnnnnn {#1} {#5} {#6} }
+      {#2} {#3} {#4}
   }
 \cs_new:Npn \@@_point_interpolate_arcaxes_auxi:nnnnnnnnn #1#2#3#4#5#6#7#8#9
   {
     \@@_point_interpolate_arcaxes_auxii:fnnnnnnnn
-      { \fp_eval:n {#1} } {#2} {#3} {#6} {#7} {#8} {#9} {#4} {#5}
+      { \fp_eval:n {#1} } {#2} {#3} {#4} {#5} {#6} {#7} {#8} {#9}
   }
 %    \end{macrocode}
 %   At this stage, the three co-ordinate pairs are fully expanded but somewhat
@@ -623,19 +650,15 @@
 %    \begin{macrocode}
 \cs_new:Npn \draw_point_interpolate_curve:nnnnnn #1#2#3#4#5
   {
-    \@@_point_process:nnn
-      {
-        \@@_point_process:nnn
-          { \@@_point_interpolate_curve_auxi:nnnnnnnnn {#1} }
-          {#4} {#5}
-      }
-      {#2} {#3}
+    \@@_point_process:nnnnn
+      { \@@_point_interpolate_curve_auxi:nnnnnnnnn {#1} }
+      {#2} {#3} {#4} {#5}
   }
 \cs_new:Npn \@@_point_interpolate_curve_auxi:nnnnnnnnn #1#2#3#4#5#6#7#8#9
   {
     \@@_point_interpolate_curve_auxii:fnnnnnnnn
       { \fp_eval:n {#1} }
-      {#6} {#7} {#8} {#9} {#2} {#3} {#4} {#5}
+      {#2} {#3} {#4} {#5} {#6} {#7} {#8} {#9}
   }
 %    \end{macrocode}
 %   At this stage, everything is fully expanded and back in the input order.





More information about the latex3-commits mailing list