[latex3-commits] [l3svn] r7364 - Move check-declarations code near each function such as \tl_set:Nn

noreply at latex-project.org noreply at latex-project.org
Sat Jul 15 04:23:14 CEST 2017


Author: bruno
Date: 2017-07-15 04:23:14 +0200 (Sat, 15 Jul 2017)
New Revision: 7364

Modified:
   trunk/l3kernel/expl3.dtx
   trunk/l3kernel/l3basics.dtx
   trunk/l3kernel/l3bootstrap.dtx
   trunk/l3kernel/l3flag.dtx
   trunk/l3kernel/l3msg.dtx
   trunk/l3kernel/l3prg.dtx
   trunk/l3kernel/l3tl.dtx
   trunk/l3kernel/testfiles/m3expl001.luatex.tlg
   trunk/l3kernel/testfiles/m3expl001.ptex.tlg
   trunk/l3kernel/testfiles/m3expl001.tlg
   trunk/l3kernel/testfiles/m3expl001.uptex.tlg
   trunk/l3kernel/testfiles/m3expl001.xetex.tlg
   trunk/l3kernel/testfiles/m3expl003.luatex.tlg
   trunk/l3kernel/testfiles/m3expl003.ptex.tlg
   trunk/l3kernel/testfiles/m3expl003.tlg
   trunk/l3kernel/testfiles/m3expl003.uptex.tlg
   trunk/l3kernel/testfiles/m3expl003.xetex.tlg
Log:
Move check-declarations code near each function such as \tl_set:Nn

Rather than redefining \tl_set:Nn, \bool_set_false:N etc at the end of
each module to implement the check-declarations, use a "patching" system
that gives the correct definition the first time around.


Modified: trunk/l3kernel/expl3.dtx
===================================================================
--- trunk/l3kernel/expl3.dtx	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/expl3.dtx	2017-07-15 02:23:14 UTC (rev 7364)
@@ -1174,6 +1174,7 @@
 % \begin{macro}[aux]{\expl at create@bool at option}
 % \begin{variable}[int]
 %   {
+%     \l at expl@debug at bool ,
 %     \l at expl@check at declarations@bool ,
 %     \l at expl@log at functions@bool
 %   }
@@ -1182,12 +1183,14 @@
 %   These have to be done by hand as there is no \pkg{expl3} yet: the logging
 %   option is needed before loading \pkg{l3basics}! Only a minimal set of
 %   options are handled here: others are left for a proper key--value approach
-%   once the kernel is loaded.
+%   once the kernel is loaded.  Both |check-declarations| and
+%   |log-functions| turn on a |debug| boolean that tells later code to
+%   include the needed checking functions.
 %    \begin{macrocode}
 \newcommand\expl at create@bool at option[2]%
   {%
-    \DeclareOption{#1}{\chardef #2=1 }%
-    \DeclareOption{#1=true}{\chardef #2=1 }%
+    \DeclareOption{#1}{\chardef #2=1 \chardef\l at expl@debug at bool=1 }%
+    \DeclareOption{#1=true}{\chardef #2=1 \chardef\l at expl@debug at bool=1 }%
     \DeclareOption{#1=false}{\chardef #2=0 }%
     \newcommand*#2{}%
     \chardef #2=0 %
@@ -1195,6 +1198,7 @@
 \expl at create@bool at option{check-declarations}\l at expl@check at declarations@bool
 \expl at create@bool at option{log-functions}\l at expl@log at functions@bool
 \let\expl at create@bool at option\@undefined
+\chardef\l at expl@debug at bool=0 %
 \newcommand*\l at expl@options at clist{}
 \DeclareOption*
   {%
@@ -1638,13 +1642,15 @@
 %
 % \begin{variable}[int]
 %   {
+%     \l at expl@debug at bool ,
 %     \l at expl@check at declarations@bool ,
 %     \l at expl@log at functions@bool
 %   }
 %  In generic mode, there is no convenient option handling and so instead
 %  the two variables are defined to do nothing.
-%  appropriate value before input of the loader.
+%  Appropriate value before input of the loader.
 %    \begin{macrocode}
+\chardef \l at expl@debug at bool = 0 %
 \chardef \l at expl@check at declarations@bool = 0 %
 \chardef \l at expl@log at functions@bool = 0 %
 %    \end{macrocode}

Modified: trunk/l3kernel/l3basics.dtx
===================================================================
--- trunk/l3kernel/l3basics.dtx	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/l3basics.dtx	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2361,6 +2361,53 @@
 %    \end{macrocode}
 % \end{macro}
 %
+% \begin{macro}[int]{\__debug_patch:nnNw}
+% \begin{macro}[aux]
+%   {
+%     \__debug_patch_param:w,
+%     \__debug_patch_new:nnNNnn,
+%     \__debug_patch_new_conditional:nnNNnnn
+%   }
+%    \begin{macrocode}
+%<*package>
+\tex_ifodd:D \l at expl@debug at bool
+  \cs_set_protected:Npn \__debug_patch:nnNw #1#2#3
+    {
+      \if_meaning:w #3 \cs_new_protected:Npn
+        \__debug_patch_param:w \__debug_patch_new:nnNNnn
+      \fi:
+      \if_meaning:w #3 \cs_new:Npn
+        \__debug_patch_param:w \__debug_patch_new:nnNNnn
+      \fi:
+      \if_meaning:w #3 \prg_new_protected_conditional:Npnn
+        \__debug_patch_param:w \__debug_patch_new_conditional:nnNNnnn
+      \fi:
+      \if_meaning:w #3 \prg_new_conditional:Npnn
+        \__debug_patch_param:w \__debug_patch_new_conditional:nnNNnnn
+      \fi:
+      \__msg_kernel_error:nnx { kernel } { debug-unpatchable }
+        { \token_to_str:N #3 }
+      \use_none:nn {#1} {#2} #3
+    }
+  \cs_set_protected:Npn \__debug_patch_param:w
+      #1#2#3 \use_none:nn #4#5#6#7#8#
+    {
+      #2
+      #1 {#4} {#5} #6 #7 {#8}
+    }
+  \cs_set_protected:Npn \__debug_patch_new:nnNNnn #1#2#3#4#5#6
+    { #3 #4 #5 { #1 #6 #2 } }
+  \cs_set_protected:Npn \__debug_patch_new_conditional:nnNNnnn
+      #1#2#3#4#5#6#7
+    { #3 #4 #5 {#6} { #1 #7 #2 } }
+\else:
+  \cs_set_protected:Npn \__debug_patch:nnNw #1#2 { }
+\fi:
+%</package>
+%    \end{macrocode}
+% \end{macro}
+% \end{macro}
+%
 % \begin{macro}[int]{\__chk_if_free_cs:N, \__chk_if_free_cs:c}
 %   This command is called by \cs{cs_new_nopar:Npn} and \cs{cs_new_eq:NN}
 %   \emph{etc.}\
@@ -2377,7 +2424,7 @@
         \__msg_kernel_error:nnxx { kernel } { command-already-defined }
           { \token_to_str:N #1 } { \token_to_meaning:N #1 }
       }
-}
+  }
 %<*package>
 \tex_ifodd:D \l at expl@log at functions@bool
   \cs_set_protected:Npn \__chk_if_free_cs:N #1
@@ -2410,6 +2457,10 @@
             { \token_to_str:N #1 }
         }
     }
+\else:
+  \tex_ifodd:D \l at expl@debug at bool
+    \cs_set_protected:Npn \__chk_if_exist_var:N #1 { }
+  \fi:
 \fi:
 %</package>
 %    \end{macrocode}

Modified: trunk/l3kernel/l3bootstrap.dtx
===================================================================
--- trunk/l3kernel/l3bootstrap.dtx	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/l3bootstrap.dtx	2017-07-15 02:23:14 UTC (rev 7364)
@@ -281,7 +281,7 @@
       local t = { }
       for _,i in pairs(tex.extraprimitives("luatex")) do
         if string.match(i,"^U") then
-          if not string.match(i,"^Uchar$") then
+          if not string.match(i,"^Uchar$") then %$
             table.insert(t,i)
           end
         end

Modified: trunk/l3kernel/l3flag.dtx
===================================================================
--- trunk/l3kernel/l3flag.dtx	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/l3flag.dtx	2017-07-15 02:23:14 UTC (rev 7364)
@@ -193,8 +193,12 @@
 %   Undefine control sequences, starting from the |0| flag, upwards,
 %   until reaching an undefined control sequence.  We don't use
 %   \cs{cs_undefine:c} because that would act globally.
+%   When the option |check-declarations| is used, check for the
+%   function defined by \cs{flag_new:n}.
 %    \begin{macrocode}
-\cs_new_protected:Npn \flag_clear:n { \@@_clear:wn 0 ; }
+\__debug_patch:nnNw
+  { \exp_args:Nc \__chk_if_exist_var:N { flag~#1 } } { }
+\cs_new_protected:Npn \flag_clear:n #1 { \@@_clear:wn 0 ; {#1} }
 \cs_new_protected:Npn \@@_clear:wn #1 ; #2
   {
     \if_cs_exist:w flag~#2~#1 \cs_end:
@@ -235,6 +239,27 @@
 %
 % \subsection{Expandable flag commands}
 %
+% \begin{macro}[EXP,aux]{\@@_chk_exist:n}
+%   Analogue of \cs{__chk_if_exist_var:N} for flags, and with an
+%   expandable error.  We need to add checks by hand because flags are
+%   not implemented in terms of other variables.  Not all functions need
+%   to be patched since some are defined in terms of others.
+%    \begin{macrocode}
+%<*package>
+\tex_ifodd:D \l at expl@debug at bool
+  \cs_set:Npn \@@_chk_exist:n #1
+    {
+      \flag_if_exist:nF {#1}
+        {
+          \__msg_kernel_expandable_error:nnn
+            { kernel } { bad-variable } { flag~#1~ }
+        }
+    }
+\fi:
+%</package>
+%    \end{macrocode}
+% \end{macro}
+%
 % \begin{macro}[EXP, pTF]{\flag_if_exist:n}
 %   A flag exist if the corresponding trap \cs[no-index]{flag \meta{flag
 %   name}:n} is defined.
@@ -250,6 +275,7 @@
 % \begin{macro}[EXP, pTF]{\flag_if_raised:n}
 %   Test if the flag has a non-zero height, by checking the |0| control sequence.
 %    \begin{macrocode}
+\__debug_patch:nnNw { \@@_chk_exist:n {#1} } { }
 \prg_new_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF }
   {
     \if_cs_exist:w flag~#1~0 \cs_end:
@@ -266,7 +292,8 @@
 %   Extract the value of the flag by going through all of the
 %   control sequences starting from |0|.
 %    \begin{macrocode}
-\cs_new:Npn \flag_height:n { \@@_height_loop:wn 0; }
+\__debug_patch:nnNw { \@@_chk_exist:n {#1} } { }
+\cs_new:Npn \flag_height:n #1 { \@@_height_loop:wn 0; {#1} }
 \cs_new:Npn \@@_height_loop:wn #1 ; #2
   {
     \if_cs_exist:w flag~#2~#1 \cs_end:
@@ -292,49 +319,7 @@
 %    \end{macrocode}
 % \end{macro}
 %
-% \subsection{Option check-declarations}
-%
-% \begin{macro}[EXP,aux]{\@@_chk_exist:n}
-%   In package mode, there is an option to check all variables used are
-%   defined.  Since flags are not implemented in terms of other
-%   variables, we need to add checks by hand.  Not all functions need to
-%   be patched because some are defined in terms of others.
 %    \begin{macrocode}
-%<*package>
-\tex_ifodd:D \l at expl@check at declarations@bool
-  \cs_set_protected:Npn \flag_clear:n #1
-    {
-      \exp_args:Nc \__chk_if_exist_var:N { flag~#1 }
-      \@@_clear:wn 0 ; {#1}
-    }
-  \cs_set:Npn \@@_chk_exist:n #1
-    {
-      \flag_if_exist:nF {#1}
-        {
-          \__msg_kernel_expandable_error:nnn
-            { kernel } { bad-variable } { flag~#1~ }
-        }
-    }
-  \cs_set:Npn \flag_height:n #1
-    {
-      \@@_chk_exist:n {#1}
-      \@@_height_loop:wn 0; {#1}
-    }
-  \prg_set_conditional:Npnn \flag_if_raised:n #1 { p , T , F , TF }
-    {
-      \@@_chk_exist:n {#1}
-      \if_cs_exist:w flag~#1~0 \cs_end:
-        \prg_return_true:
-      \else:
-        \prg_return_false:
-      \fi:
-    }
-\fi:
-%</package>
-%    \end{macrocode}
-% \end{macro}
-%
-%    \begin{macrocode}
 %</initex|package>
 %    \end{macrocode}
 %

Modified: trunk/l3kernel/l3msg.dtx
===================================================================
--- trunk/l3kernel/l3msg.dtx	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/l3msg.dtx	2017-07-15 02:23:14 UTC (rev 7364)
@@ -1863,6 +1863,13 @@
     LaTeX~has~been~asked~to~use~a~control~sequence~'#1':\\
     this~has~not~been~defined~yet.
   }
+%<*package>
+\bool_if:NT \l at expl@debug at bool
+  {
+    \@@_kernel_new:nnn { kernel } { debug-unpatchable }
+      { Only~some~definitions~can~be~patched;~'#3'~cannot. }
+  }
+%</package>
 \@@_kernel_new:nnn { kernel } { deprecated-command }
   {
     The~deprecated~command~'#2'~has~been~or~will~be~removed~on~#1.

Modified: trunk/l3kernel/l3prg.dtx
===================================================================
--- trunk/l3kernel/l3prg.dtx	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/l3prg.dtx	2017-07-15 02:23:14 UTC (rev 7364)
@@ -804,13 +804,20 @@
 %   }
 % \UnitTested
 %   Setting is already pretty easy.
+%   When |check-declarations| is active, the definitions are patched to
+%   make sure the boolean exists.  This is needed because booleans are
+%   not based on token lists nor on \TeX{} registers.
 %    \begin{macrocode}
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \bool_set_true:N #1
   { \cs_set_eq:NN #1 \c_true_bool }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \bool_set_false:N #1
   { \cs_set_eq:NN #1 \c_false_bool }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \bool_gset_true:N #1
   { \cs_gset_eq:NN #1 \c_true_bool }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \bool_gset_false:N #1
   { \cs_gset_eq:NN #1 \c_false_bool }
 \cs_generate_variant:Nn \bool_set_true:N   { c }
@@ -828,16 +835,18 @@
 %     \bool_gset_eq:Nc, \bool_gset_eq:cc
 %   }
 % \UnitTested
-%   The usual copy code.
+%   The usual copy code.  While it would be cleaner semantically to copy
+%   the \cs{cs_set_eq:NN} family of functions, we copy \cs{tl_set_eq:NN}
+%   because that has the correct checking code.
 %    \begin{macrocode}
-\cs_new_eq:NN \bool_set_eq:NN  \cs_set_eq:NN
-\cs_new_eq:NN \bool_set_eq:Nc  \cs_set_eq:Nc
-\cs_new_eq:NN \bool_set_eq:cN  \cs_set_eq:cN
-\cs_new_eq:NN \bool_set_eq:cc  \cs_set_eq:cc
-\cs_new_eq:NN \bool_gset_eq:NN \cs_gset_eq:NN
-\cs_new_eq:NN \bool_gset_eq:Nc \cs_gset_eq:Nc
-\cs_new_eq:NN \bool_gset_eq:cN \cs_gset_eq:cN
-\cs_new_eq:NN \bool_gset_eq:cc \cs_gset_eq:cc
+\cs_new_eq:NN \bool_set_eq:NN  \tl_set_eq:NN
+\cs_new_eq:NN \bool_set_eq:Nc  \tl_set_eq:Nc
+\cs_new_eq:NN \bool_set_eq:cN  \tl_set_eq:cN
+\cs_new_eq:NN \bool_set_eq:cc  \tl_set_eq:cc
+\cs_new_eq:NN \bool_gset_eq:NN \tl_gset_eq:NN
+\cs_new_eq:NN \bool_gset_eq:Nc \tl_gset_eq:Nc
+\cs_new_eq:NN \bool_gset_eq:cN \tl_gset_eq:cN
+\cs_new_eq:NN \bool_gset_eq:cc \tl_gset_eq:cc
 %    \end{macrocode}
 % \end{macro}
 %
@@ -845,9 +854,12 @@
 % \begin{macro}{\bool_gset:Nn, \bool_gset:cn}
 %   This function evaluates a boolean expression and assigns the first
 %   argument the meaning \cs{c_true_bool} or \cs{c_false_bool}.
+%   Again, we include some checking code.
 %    \begin{macrocode}
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \bool_set:Nn #1#2
   { \tex_chardef:D #1 = \bool_if_p:n {#2} }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \bool_gset:Nn #1#2
   { \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2} }
 \cs_generate_variant:Nn \bool_set:Nn  { c }
@@ -856,55 +868,6 @@
 % \end{macro}
 % \end{macro}
 %
-%  Booleans are not based on token lists but do need checking: this
-%  code complements similar material in \pkg{l3tl}.
-%    \begin{macrocode}
-%<*package>
-\if_bool:N \l at expl@check at declarations@bool
-  \cs_set_protected:Npn \bool_set_true:N #1
-    {
-      \__chk_if_exist_var:N #1
-      \cs_set_eq:NN #1 \c_true_bool
-    }
-  \cs_set_protected:Npn \bool_set_false:N #1
-    {
-      \__chk_if_exist_var:N #1
-      \cs_set_eq:NN #1 \c_false_bool
-    }
-  \cs_set_protected:Npn \bool_gset_true:N #1
-    {
-      \__chk_if_exist_var:N #1
-      \cs_gset_eq:NN #1 \c_true_bool
-    }
-  \cs_set_protected:Npn \bool_gset_false:N #1
-    {
-      \__chk_if_exist_var:N #1
-      \cs_gset_eq:NN #1 \c_false_bool
-    }
-  \cs_set_protected:Npn \bool_set_eq:NN  #1
-    {
-      \__chk_if_exist_var:N #1
-      \cs_set_eq:NN #1
-    }
-  \cs_set_protected:Npn \bool_gset_eq:NN  #1
-    {
-      \__chk_if_exist_var:N #1
-      \cs_gset_eq:NN #1
-    }
-  \cs_set_protected:Npn \bool_set:Nn #1#2
-    {
-      \__chk_if_exist_var:N #1
-      \tex_chardef:D #1 = \bool_if_p:n {#2}
-    }
-  \cs_set_protected:Npn \bool_gset:Nn #1#2
-    {
-      \__chk_if_exist_var:N #1
-      \tex_global:D \tex_chardef:D #1 = \bool_if_p:n {#2}
-    }
-\fi:
-%</package>
-%    \end{macrocode}
-%
 % \begin{macro}[pTF]{\bool_if:N, \bool_if:c}
 % \UnitTested
 %  Straight forward here. We could optimize here if we wanted to as

Modified: trunk/l3kernel/l3tl.dtx
===================================================================
--- trunk/l3kernel/l3tl.dtx	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/l3tl.dtx	2017-07-15 02:23:14 UTC (rev 7364)
@@ -1154,7 +1154,8 @@
 %
 % \begin{macro}{\tl_set_eq:NN, \tl_set_eq:Nc, \tl_set_eq:cN, \tl_set_eq:cc}
 % \begin{macro}{\tl_gset_eq:NN, \tl_gset_eq:Nc, \tl_gset_eq:cN, \tl_gset_eq:cc}
-%   For setting token list variables equal to each other.
+%   For setting token list variables equal to each other.  When checking
+%   is turned on, make sure both variables exist.
 %    \begin{macrocode}
 \cs_new_eq:NN \tl_set_eq:NN  \cs_set_eq:NN
 \cs_new_eq:NN \tl_set_eq:cN  \cs_set_eq:cN
@@ -1164,16 +1165,46 @@
 \cs_new_eq:NN \tl_gset_eq:cN \cs_gset_eq:cN
 \cs_new_eq:NN \tl_gset_eq:Nc \cs_gset_eq:Nc
 \cs_new_eq:NN \tl_gset_eq:cc \cs_gset_eq:cc
+\tex_ifodd:D \l at expl@debug at bool
+  \cs_set_protected:Npn \tl_set_eq:NN #1#2
+    {
+      \__chk_if_exist_var:N #1
+      \__chk_if_exist_var:N #2
+      \cs_set_eq:NN #1 #2
+    }
+  \cs_set_protected:Npn \tl_gset_eq:NN #1#2
+    {
+      \__chk_if_exist_var:N #1
+      \__chk_if_exist_var:N #2
+      \cs_gset_eq:NN #1 #2
+    }
+\fi:
 %    \end{macrocode}
 % \end{macro}
 % \end{macro}
 %
 % \begin{macro}{\tl_concat:NNN, \tl_concat:ccc}
 % \begin{macro}{\tl_gconcat:NNN, \tl_gconcat:ccc}
-%   Concatenating token lists is easy.
+%   Concatenating token lists is easy.  When checking is turned on, all
+%   three arguments must be checked: a token list |#2| or |#3| equal to
+%   \cs{scan_stop:} would lead to problems later on.
 %    \begin{macrocode}
+\__debug_patch:nnNw
+  {
+    \__chk_if_exist_var:N #1
+    \__chk_if_exist_var:N #2
+    \__chk_if_exist_var:N #3
+  }
+  { }
 \cs_new_protected:Npn \tl_concat:NNN #1#2#3
   { \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } }
+\__debug_patch:nnNw
+  {
+    \__chk_if_exist_var:N #1
+    \__chk_if_exist_var:N #2
+    \__chk_if_exist_var:N #3
+  }
+  { }
 \cs_new_protected:Npn \tl_gconcat:NNN #1#2#3
   { \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} } }
 \cs_generate_variant:Nn \tl_concat:NNN  { ccc }
@@ -1223,18 +1254,26 @@
 %   By using \cs{exp_not:n} token list variables can contain |#| tokens,
 %   which makes the token list registers provided by \TeX{}
 %   more or less redundant. The \cs{tl_set:No} version is done
-%   \enquote{by hand} as it is used quite a lot.
+%   \enquote{by hand} as it is used quite a lot.  Each definition is
+%   prefixed by a call to \cs{__debug_patch:nnNw} which adds an
+%   existence check to the definition.
 %    \begin{macrocode}
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_set:Nn #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:n {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_set:No #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:o {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_set:Nx #1#2
   { \cs_set_nopar:Npx #1 {#2} }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gset:Nn #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gset:No #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gset:Nx #1#2
   { \cs_gset_nopar:Npx #1 {#2} }
 \cs_generate_variant:Nn \tl_set:Nn  {         NV , Nv , Nf }
@@ -1259,20 +1298,28 @@
 %   }
 % Adding to the left is done directly to gain a little performance.
 %    \begin{macrocode}
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_left:Nn #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_left:NV #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_left:No #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_left:Nx #1#2
   { \cs_set_nopar:Npx #1 { #2 \exp_not:o #1 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_left:Nn #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:n {#2} \exp_not:o #1 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_left:NV #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:V #2 \exp_not:o #1 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_left:No #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:o {#2} \exp_not:o #1 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_left:Nx #1#2
   { \cs_gset_nopar:Npx #1 { #2 \exp_not:o {#1} } }
 \cs_generate_variant:Nn \tl_put_left:Nn  { c }
@@ -1301,20 +1348,28 @@
 %   }
 % The same on the right.
 %    \begin{macrocode}
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_right:Nn #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_right:NV #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_right:No #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_put_right:Nx #1#2
   { \cs_set_nopar:Npx #1 { \exp_not:o #1 #2 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_right:Nn #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:n {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_right:NV #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:V #2 } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_right:No #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:o #1 \exp_not:o {#2} } }
+\__debug_patch:nnNw { \__chk_if_exist_var:N #1 } { }
 \cs_new_protected:Npn \tl_gput_right:Nx #1#2
   { \cs_gset_nopar:Npx #1 { \exp_not:o {#1} #2 } }
 \cs_generate_variant:Nn \tl_put_right:Nn  { c }
@@ -1329,85 +1384,6 @@
 % \end{macro}
 % \end{macro}
 %
-%   When used as a package, there is an option to be picky and to
-%   check definitions exist. This part of the process is done now, so that
-%   variable types based on |tl| (for example |clist|, |seq| and |prop|)
-%   inherit the appropriate definitions.
-%   No \cs[no-index]{tl_map_\ldots} yet as the mechanisms are not fully in place. Thus
-%   instead do a more low level set up for a mapping, as in \pkg{l3basics}.
-%    \begin{macrocode}
-%<*package>
-\tex_ifodd:D \l at expl@check at declarations@bool
-  \cs_set_protected:Npn \__cs_tmp:w #1
-    {
-      \if_meaning:w \q_recursion_tail #1
-        \exp_after:wN \use_none_delimit_by_q_recursion_stop:w
-      \fi:
-      \use:x
-        {
-          \cs_set_protected:Npn #1 \exp_not:n { ##1 ##2 }
-            {
-              \__chk_if_exist_var:N \exp_not:n {##1}
-              \exp_not:o { #1 {##1} {##2} }
-            }
-        }
-      \__cs_tmp:w
-    }
-  \__cs_tmp:w
-    \tl_set:Nn  \tl_set:No  \tl_set:Nx
-    \tl_gset:Nn \tl_gset:No \tl_gset:Nx
-    \tl_put_left:Nn   \tl_put_left:NV
-    \tl_put_left:No   \tl_put_left:Nx
-    \tl_gput_left:Nn  \tl_gput_left:NV
-    \tl_gput_left:No  \tl_gput_left:Nx
-    \tl_put_right:Nn  \tl_put_right:NV
-    \tl_put_right:No  \tl_put_right:Nx
-    \tl_gput_right:Nn \tl_gput_right:NV
-    \tl_gput_right:No \tl_gput_right:Nx
-    \q_recursion_tail \q_recursion_stop
-%</package>
-%    \end{macrocode}
-%   The two \texttt{set_eq} functions are done by hand as the internals there
-%   are a bit different.
-%    \begin{macrocode}
-%<*package>
-  \cs_set_protected:Npn \tl_set_eq:NN #1#2
-    {
-      \__chk_if_exist_var:N #1
-      \__chk_if_exist_var:N #2
-      \cs_set_eq:NN #1 #2
-    }
-  \cs_set_protected:Npn \tl_gset_eq:NN #1#2
-    {
-      \__chk_if_exist_var:N #1
-      \__chk_if_exist_var:N #2
-      \cs_gset_eq:NN #1 #2
-    }
-%</package>
-%    \end{macrocode}
-%   There is also a need to check all three arguments of the
-%   \texttt{concat} functions: a token list |#2| or |#3| equal to
-%   \cs{scan_stop:} would lead to problems later on.
-%    \begin{macrocode}
-%<*package>
-  \cs_set_protected:Npn \tl_concat:NNN #1#2#3
-    {
-      \__chk_if_exist_var:N #1
-      \__chk_if_exist_var:N #2
-      \__chk_if_exist_var:N #3
-      \tl_set:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} }
-    }
-  \cs_set_protected:Npn \tl_gconcat:NNN #1#2#3
-    {
-      \__chk_if_exist_var:N #1
-      \__chk_if_exist_var:N #2
-      \__chk_if_exist_var:N #3
-      \tl_gset:Nx #1 { \exp_not:o {#2} \exp_not:o {#3} }
-    }
-\tex_fi:D
-%</package>
-%    \end{macrocode}
-%
 % \subsection{Reassigning token list category codes}
 %
 % \begin{variable}{\c_@@_rescan_marker_tl}

Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2791,6 +2791,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2779,6 +2779,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl001.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2779,6 +2779,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2779,6 +2779,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2789,6 +2789,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2791,6 +2791,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2779,6 +2779,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl003.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2779,6 +2779,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2779,6 +2779,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...

Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-07-14 21:33:40 UTC (rev 7363)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg	2017-07-15 02:23:14 UTC (rev 7364)
@@ -2789,6 +2789,7 @@
 Defining message LaTeX/kernel/char-space on line ...
 Defining message LaTeX/kernel/command-already-defined on line ...
 Defining message LaTeX/kernel/command-not-defined on line ...
+Defining message LaTeX/kernel/debug-unpatchable on line ...
 Defining message LaTeX/kernel/deprecated-command on line ...
 Defining message LaTeX/kernel/empty-search-pattern on line ...
 Defining message LaTeX/kernel/out-of-registers on line ...



More information about the latex3-commits mailing list