[latex3-commits] [git/LaTeX3-latex3-latex3] morechk: seq, clist use: make check conditional on debug (ef36de5)

Will Robertson wspr81 at gmail.com
Mon Jan 14 08:16:54 CET 2019


Repository : https://github.com/latex3/latex3
On branch  : morechk
Link       : https://github.com/latex3/latex3/commit/ef36de575c03a8c07fb3e369c9249b2f5c70e4e5

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

commit ef36de575c03a8c07fb3e369c9249b2f5c70e4e5
Author: Will Robertson <wspr81 at gmail.com>
Date:   Mon Jan 14 15:14:42 2019 +0800

    seq, clist use: make check conditional on debug


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

ef36de575c03a8c07fb3e369c9249b2f5c70e4e5
 l3kernel/l3clist.dtx |   52 +++++++++++++++++++++++++++++++++++---------------
 l3kernel/l3seq.dtx   |   50 +++++++++++++++++++++++++++++++++---------------
 2 files changed, 72 insertions(+), 30 deletions(-)

diff --git a/l3kernel/l3clist.dtx b/l3kernel/l3clist.dtx
index c069b5c..0c4aede 100644
--- a/l3kernel/l3clist.dtx
+++ b/l3kernel/l3clist.dtx
@@ -518,7 +518,7 @@
 %
 % \section{Using the content of comma lists directly}
 %
-% \begin{function}[EXP, added = 2013-05-26]{\clist_use:Nnnn, \clist_use:cnnn}
+% \begin{function}[EXP, added = 2013-05-26, updated = 2019-01-14]{\clist_use:Nnnn, \clist_use:cnnn}
 %   \begin{syntax}
 %     \cs{clist_use:Nnnn} \meta{clist~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two}
 %   \end{syntax}
@@ -530,7 +530,8 @@
 %   the comma list has exactly two items, then they are placed in the input
 %   stream separated by the \meta{separator between two}.  If the comma
 %   list has a single item, it is placed in the input stream, and a comma
-%   list with no items produces no output.  An error is raised if
+%   list with no items produces no output.  When the \texttt{check-declarations}
+%   option is in effect an error is raised if
 %   the variable does not exist or if it is invalid.
 %
 %   For example,
@@ -1817,27 +1818,48 @@
 %   switching to the other \meta{continuation}, \texttt{use_iii}, which
 %   uses the \meta{separator between final two}.
 %    \begin{macrocode}
-\cs_new:Npn \clist_use:Nnnn #1#2#3#4
+\__kernel_if_debug:TF
   {
-    \clist_if_exist:NTF #1
+    \cs_new:Npn \clist_use:Nnnn #1#2#3#4
       {
-        \int_case:nnF { \clist_count:N #1 }
+        \clist_if_exist:NTF #1
           {
-            { 0 } { }
-            { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } }
-            { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} }
+            \int_case:nnF { \clist_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } }
+                { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} }
+              }
+              {
+                \exp_after:wN \@@_use:nwwwwnwn
+                \exp_after:wN { \exp_after:wN } #1 ,
+                \q_mark , { \@@_use:nwwwwnwn {#3} }
+                \q_mark , { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
           }
           {
-            \exp_after:wN \@@_use:nwwwwnwn
-            \exp_after:wN { \exp_after:wN } #1 ,
-            \q_mark , { \@@_use:nwwwwnwn {#3} }
-            \q_mark , { \@@_use:nwwn {#4} }
-            \q_stop { }
+            \__kernel_msg_expandable_error:nnn
+              { kernel } { bad-variable } {#1}
           }
       }
+  }
+  {
+    \cs_new:Npn \clist_use:Nnnn #1#2#3#4
       {
-        \__kernel_msg_expandable_error:nnn
-          { kernel } { bad-variable } {#1}
+            \int_case:nnF { \clist_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:wwn #1 , , { } }
+                { 2 } { \exp_after:wN \@@_use:wwn #1 , {#2} }
+              }
+              {
+                \exp_after:wN \@@_use:nwwwwnwn
+                \exp_after:wN { \exp_after:wN } #1 ,
+                \q_mark , { \@@_use:nwwwwnwn {#3} }
+                \q_mark , { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
       }
   }
 \cs_generate_variant:Nn \clist_use:Nnnn { c }
diff --git a/l3kernel/l3seq.dtx b/l3kernel/l3seq.dtx
index d3d8460..7f47ef4 100644
--- a/l3kernel/l3seq.dtx
+++ b/l3kernel/l3seq.dtx
@@ -590,7 +590,7 @@
 %
 % \section{Using the content of sequences directly}
 %
-% \begin{function}[EXP, added = 2013-05-26]{\seq_use:Nnnn, \seq_use:cnnn}
+% \begin{function}[EXP, added = 2013-05-26, updated = 2019-01-14]{\seq_use:Nnnn, \seq_use:cnnn}
 %   \begin{syntax}
 %     \cs{seq_use:Nnnn} \meta{seq~var} \Arg{separator~between~two} \Arg{separator~between~more~than~two} \Arg{separator~between~final~two}
 %   \end{syntax}
@@ -602,8 +602,8 @@
 %   sequence has exactly two items, then they are placed in the input stream
 %   separated by the \meta{separator between two}.  If the sequence has
 %   a single item, it is placed in the input stream, and an empty sequence
-%   produces no output.  An error is raised if the variable does
-%   not exist or if it is invalid.
+%   produces no output.  When the \texttt{check-declarations} option is in effect
+%   an error is raised if the variable does not exist or if it is invalid.
 %
 %   For example,
 %   \begin{verbatim}
@@ -1900,26 +1900,46 @@
 %   commas.  We also need to add \cs{@@_item:n} at various places, and
 %   \cs{s_@@}.
 %    \begin{macrocode}
-\cs_new:Npn \seq_use:Nnnn #1#2#3#4
+\__kernel_if_debug:TF
   {
-    \seq_if_exist:NTF #1
+    \cs_new:Npn \seq_use:Nnnn #1#2#3#4
       {
-        \int_case:nnF { \seq_count:N #1 }
+        \seq_if_exist:NTF #1
           {
-            { 0 } { }
-            { 1 } { \exp_after:wN \@@_use:NNnNnn #1 ? { } { } }
-            { 2 } { \exp_after:wN \@@_use:NNnNnn #1 {#2} }
+            \int_case:nnF { \seq_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:NNnNnn #1 ? { } { } }
+                { 2 } { \exp_after:wN \@@_use:NNnNnn #1 {#2} }
+              }
+              {
+                \exp_after:wN \@@_use_setup:w #1 \@@_item:n
+                \q_mark { \@@_use:nwwwwnwn {#3} }
+                \q_mark { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
           }
           {
-            \exp_after:wN \@@_use_setup:w #1 \@@_item:n
-            \q_mark { \@@_use:nwwwwnwn {#3} }
-            \q_mark { \@@_use:nwwn {#4} }
-            \q_stop { }
+            \__kernel_msg_expandable_error:nnn
+              { kernel } { bad-variable } {#1}
           }
       }
+  }
+  {
+    \cs_new:Npn \seq_use:Nnnn #1#2#3#4
       {
-        \__kernel_msg_expandable_error:nnn
-          { kernel } { bad-variable } {#1}
+            \int_case:nnF { \seq_count:N #1 }
+              {
+                { 0 } { }
+                { 1 } { \exp_after:wN \@@_use:NNnNnn #1 ? { } { } }
+                { 2 } { \exp_after:wN \@@_use:NNnNnn #1 {#2} }
+              }
+              {
+                \exp_after:wN \@@_use_setup:w #1 \@@_item:n
+                \q_mark { \@@_use:nwwwwnwn {#3} }
+                \q_mark { \@@_use:nwwn {#4} }
+                \q_stop { }
+              }
       }
   }
 \cs_generate_variant:Nn \seq_use:Nnnn { c }





More information about the latex3-commits mailing list