[latex3-commits] [l3svn] r7387 - Combine all \debug user-level functions into two
noreply at latex-project.org
noreply at latex-project.org
Mon Jul 17 04:15:50 CEST 2017
Author: bruno
Date: 2017-07-17 04:15:50 +0200 (Mon, 17 Jul 2017)
New Revision: 7387
Modified:
trunk/l3kernel/l3basics.dtx
trunk/l3kernel/l3candidates.dtx
trunk/l3kernel/l3msg.dtx
trunk/l3kernel/testfiles/m3deprecation001.lvt
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:
Combine all \debug user-level functions into two
Now provide \debug_on:n and \debug_off:n, taking comma-separated
lists (eventually keyval if needed). Items can be "deprecation",
"check-declarations", "log-functions", eventually "trace-regex=2"
or similar. This commit deletes previous candidate functions
- \debug_check_declarations_on: and off,
- \debug_log_functions_on: and off,
- \debug_deprecation_on: and off.
These were around only for a few days so I didn't deprecate them.
Modified: trunk/l3kernel/l3basics.dtx
===================================================================
--- trunk/l3kernel/l3basics.dtx 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/l3basics.dtx 2017-07-17 02:15:50 UTC (rev 7387)
@@ -1732,10 +1732,48 @@
% \end{macrocode}
% \end{macro}
%
-% \begin{macro}{\debug_check_declarations_on:, \debug_check_declarations_off:}
+% \begin{macro}{\debug_on:n, \debug_off:n}
+%
+% \begin{macrocode}
+\__debug:TF
+ {
+ \cs_set_protected:Npn \debug_on:n #1
+ {
+ \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} }
+ {
+ \cs_if_exist_use:cF { __debug_##1_on: }
+ { \__msg_kernel_error:nnn { kernel } { debug } {##1} }
+ }
+ }
+ \cs_set_protected:Npn \debug_off:n #1
+ {
+ \exp_args:No \clist_map_inline:nn { \tl_to_str:n {#1} }
+ {
+ \cs_if_exist_use:cF { __debug_##1_off: }
+ { \__msg_kernel_error:nnn { kernel } { debug } {##1} }
+ }
+ }
+ }
+ {
+ \cs_set_protected:Npn \debug_on:n #1
+ {
+ \__msg_kernel_error:nnx { kernel } { enable-debug }
+ { \tl_to_str:n { \debug_on:n {#1} } }
+ }
+ \cs_set_protected:Npn \debug_off:n #1
+ {
+ \__msg_kernel_error:nnx { kernel } { enable-debug }
+ { \tl_to_str:n { \debug_off:n {#1} } }
+ }
+ }
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}[aux]
+% {\__debug_check-declarations_on:, \__debug_check-declarations_off:}
% \begin{macro}[int]{\__debug_chk_var_exist:N}
% \begin{macro}[int]{\__debug_chk_cs_exist:N, \__debug_chk_cs_exist:c}
-% When debugging is not active these two user functions produce an
+% When debugging is not active these two functions produce an
% error. Otherwise they set up \cs{__debug_chk_var_exist:N} and
% \cs{__debug_chk_cs_exist:N}, two functions that test (when
% \texttt{check-declarations} is active) that their argument is
@@ -1743,7 +1781,7 @@
% \begin{macrocode}
\__debug:TF
{
- \cs_set_protected:Npn \debug_check_declarations_on:
+ \exp_args:Nc \cs_set_protected:Npn { __debug_check-declarations_on: }
{
\cs_set_protected:Npn \__debug_chk_var_exist:N ##1
{
@@ -1762,39 +1800,28 @@
}
}
}
- \cs_set_protected:Npn \debug_check_declarations_off:
+ \exp_args:Nc \cs_set_protected:Npn { __debug_check-declarations_off: }
{
\cs_set_protected:Npn \__debug_chk_var_exist:N ##1 { }
\cs_set_protected:Npn \__debug_chk_cs_exist:N ##1 { }
}
+ \cs_set_protected:Npn \__debug_chk_cs_exist:c
+ { \exp_args:Nc \__debug_chk_cs_exist:N }
\tex_ifodd:D \l at expl@check at declarations@bool
- \debug_check_declarations_on:
+ \use:c { __debug_check-declarations_on: }
\else:
- \debug_check_declarations_off:
+ \use:c { __debug_check-declarations_off: }
\fi:
}
- {
- \cs_set_protected:Npn \debug_check_declarations_on:
- {
- \__msg_kernel_error:nnx { kernel } { enable-debug }
- { \token_to_str:N \debug_check_declarations_on: }
- }
- \cs_set_protected:Npn \debug_check_declarations_off:
- {
- \__msg_kernel_error:nnx { kernel } { enable-debug }
- { \token_to_str:N \debug_check_declarations_off: }
- }
- }
-\cs_set_protected:Npn \__debug_chk_cs_exist:c
- { \exp_args:Nc \__debug_chk_cs_exist:N }
+ { }
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\debug_log_functions_on:, \debug_log_functions_off:}
+% \begin{macro}[aux]{\__debug_log-functions_on:, \__debug_log-functions_off:}
% \begin{macro}[int]{\__debug_log:x, \__debug_suspend_log:, \__debug_resume_log:}
-% The \cs{debug_log_functions_on:} and \texttt{off} functions
+% These two functions
% (corresponding to the \pkg{expl3} option \texttt{log-functions})
% control whether \cs{__debug_log:x} writes to the log file or not.
% Since \cs{iow_log:x} does not yet have its final definition we do
@@ -1812,7 +1839,7 @@
% \begin{macrocode}
\__debug:TF
{
- \cs_set_protected:Npn \debug_log_functions_on:
+ \exp_args:Nc \cs_set_protected:Npn { __debug_log-functions_on: }
{
\cs_set_protected:Npn \__debug_log:x { \iow_log:x }
\cs_set_protected:Npn \__debug_suspend_log:
@@ -1828,35 +1855,24 @@
}
\cs_set_protected:Npn \__debug_resume_log: { }
}
- \cs_set_protected:Npn \debug_log_functions_off:
+ \exp_args:Nc \cs_set_protected:Npn { __debug_log-functions_off: }
{
\cs_set_protected:Npn \__debug_log:x { \use_none:n }
\cs_set_protected:Npn \__debug_suspend_log: { }
\cs_set_protected:Npn \__debug_resume_log: { }
}
\tex_ifodd:D \l at expl@log at functions@bool
- \debug_log_functions_on:
+ \use:c { __debug_log-functions_on: }
\else:
- \debug_log_functions_off:
+ \use:c { __debug_log-functions_off: }
\fi:
}
- {
- \cs_set_protected:Npn \debug_log_functions_on:
- {
- \__msg_kernel_error:nnx { kernel } { enable-debug }
- { \token_to_str:N \debug_log_functions_on: }
- }
- \cs_set_protected:Npn \debug_log_functions_off:
- {
- \__msg_kernel_error:nnx { kernel } { enable-debug }
- { \token_to_str:N \debug_log_functions_off: }
- }
- }
+ { }
% \end{macrocode}
% \end{macro}
% \end{macro}
%
-% \begin{macro}{\debug_deprecation_on:, \debug_deprecation_off:}
+% \begin{macro}{\__debug_deprecation_on:, \__debug_deprecation_off:}
% \begin{variable}{\g__debug_deprecation_on_tl, \g__debug_deprecation_off_tl}
% Some commands were more recently deprecated and not yet removed;
% only make these into errors if the user requests it. This relies on
@@ -1865,25 +1881,14 @@
% \begin{macrocode}
\__debug:TF
{
- \cs_set_protected:Npn \debug_deprecation_on:
+ \cs_set_protected:Npn \__debug_deprecation_on:
{ \g__debug_deprecation_on_tl }
- \cs_set_protected:Npn \debug_deprecation_off:
+ \cs_set_protected:Npn \__debug_deprecation_off:
{ \g__debug_deprecation_off_tl }
\cs_set_nopar:Npn \g__debug_deprecation_on_tl { }
\cs_set_nopar:Npn \g__debug_deprecation_off_tl { }
}
- {
- \cs_set_protected:Npn \debug_deprecation_on:
- {
- \__msg_kernel_error:nnx { kernel } { enable-debug }
- { \token_to_str:N \debug_deprecation_on: }
- }
- \cs_set_protected:Npn \debug_deprecation_off:
- {
- \__msg_kernel_error:nnx { kernel } { enable-debug }
- { \token_to_str:N \debug_deprecation_off: }
- }
- }
+ { }
% \end{macrocode}
% \end{variable}
% \end{macro}
Modified: trunk/l3kernel/l3candidates.dtx
===================================================================
--- trunk/l3kernel/l3candidates.dtx 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/l3candidates.dtx 2017-07-17 02:15:50 UTC (rev 7387)
@@ -84,49 +84,27 @@
%
% \section{Additions to \pkg{l3basics}}
%
-% \begin{function}[added = 2017-07-14]
-% {\debug_check_declarations_on:, \debug_check_declarations_off:}
+% \begin{function}[added = 2017-07-16]{\debug_on:n, \debug_off:n}
% \begin{syntax}
-% \cs{debug_check_declarations_on:}
-% \cs{debug_check_declarations_off:}
+% \cs{debug_on:n} |{| \meta{comma-separated list} |}|
+% \cs{debug_off:n} |{| \meta{comma-separated list} |}|
% \end{syntax}
-% Turn on and off within a group the code that checks that all
-% \pkg{expl3} variables used were previously declared, as done
-% globally by the \texttt{check-declarations} option. These functions
-% can only be used in \LaTeXe{} package mode loaded with one of the
-% options \texttt{check-declarations}, \texttt{log-functions}, or
-% \texttt{enable-debug}.
+% Turn on and off within a group various debugging code, some of which
+% is also available as \pkg{expl3} load-time options. The items that
+% can be used in the \meta{list} are
+% \begin{itemize}
+% \item \texttt{check-declarations} that checks all \pkg{expl3}
+% variables used were previously declared;
+% \item \texttt{deprecation} that makes soon-to-be-deprecated commands produce errors;
+% \item \texttt{log-functions} that logs function definitions;
+% \end{itemize}
+% Providing these as switches rather than options allows testing code
+% even if it relies on other packages: load all other packages, call
+% \cs{debug_on:n}, and load the code that one is interested in
+% testing. These functions can only be used in \LaTeXe{} package mode
+% loaded with \texttt{enable-debug} or another option implying it.
% \end{function}
%
-% \begin{function}[added = 2017-07-16]
-% {\debug_deprecation_on:, \debug_deprecation_off:}
-% \begin{syntax}
-% \cs{debug_deprecation_on:}
-% \cs{debug_deprecation_off:}
-% \end{syntax}
-% Turn on and off within a group some code that makes
-% soon-to-be-deprecated commands to produce errors. This allows
-% testing code even if it relies on other packages: load all other
-% packages, call \cs{debug_deprecation_on:}, and load the code that
-% one is interested in testing. These functions can only be used in
-% \LaTeXe{} package mode loaded with one of the options
-% \texttt{check-declarations}, \texttt{log-functions}, or
-% \texttt{enable-debug}.
-% \end{function}
-%
-% \begin{function}[added = 2017-07-14]
-% {\debug_log_functions_on:, \debug_log_functions_off:}
-% \begin{syntax}
-% \cs{debug_log_functions_on:}
-% \cs{debug_log_functions_off:}
-% \end{syntax}
-% Turn on and off within a group the code that logs function
-% definitions, as done globally by the \texttt{log-functions} option.
-% These functions can only be used in \LaTeXe{} package mode loaded
-% with one of the options \texttt{check-declarations},
-% \texttt{log-functions}, or \texttt{enable-debug}.
-% \end{function}
-%
% \begin{function}[added = 2017-07-04]{\mode_leave_vertical:}
% \begin{syntax}
% \cs{mode_leave_vertical:}
Modified: trunk/l3kernel/l3msg.dtx
===================================================================
--- trunk/l3kernel/l3msg.dtx 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/l3msg.dtx 2017-07-17 02:15:50 UTC (rev 7387)
@@ -1952,6 +1952,13 @@
%<*package>
\bool_if:NTF \l at expl@enable at debug@bool
{
+ \@@_kernel_new:nnnn { kernel } { debug }
+ { The~debugging~option~'#1'~does~not~exist~\msg_line_context:. }
+ {
+ The~functions~'\iow_char:N\\debug_on:n'~and~
+ '\iow_char:N\\debug_off:n'~only~accept~the~arguments~
+ 'check-declarations',~'deprecation',~'log-functions',~not~'#1'.
+ }
\@@_kernel_new:nnnn { check } { non-declared-variable }
{ The~variable~#1~has~not~been~declared~\msg_line_context:. }
{
Modified: trunk/l3kernel/testfiles/m3deprecation001.lvt
===================================================================
--- trunk/l3kernel/testfiles/m3deprecation001.lvt 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3deprecation001.lvt 2017-07-17 02:15:50 UTC (rev 7387)
@@ -16,13 +16,13 @@
\tl_to_lowercase:n { \TYPE { Aa } }
\tl_to_lowercase:n { \TYPE { Bb } }
\group_begin:
- \debug_deprecation_on:
+ \debug_on:n { deprecation }
\tl_to_lowercase:n { \TYPE { Cc } }
\tl_to_lowercase:n { \TYPE { Dd } }
\group_end:
\tl_to_lowercase:n { \TYPE { Ee } }
- \debug_deprecation_on:
- \debug_deprecation_off:
+ \debug_on:n { deprecation }
+ \debug_off:n { deprecation }
\tl_to_lowercase:n { \TYPE { Ff } }
\group_end:
\tl_to_lowercase:n { \TYPE { Gg } }
Modified: trunk/l3kernel/testfiles/m3expl001.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl001.luatex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2800,6 +2800,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.ptex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl001.ptex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2788,6 +2788,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl001.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2788,6 +2788,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.uptex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl001.uptex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2788,6 +2788,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl001.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl001.xetex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2798,6 +2798,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.luatex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl003.luatex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2800,6 +2800,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.ptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.ptex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl003.ptex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2788,6 +2788,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl003.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2788,6 +2788,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.uptex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.uptex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl003.uptex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2788,6 +2788,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
Modified: trunk/l3kernel/testfiles/m3expl003.xetex.tlg
===================================================================
--- trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2017-07-17 01:47:07 UTC (rev 7386)
+++ trunk/l3kernel/testfiles/m3expl003.xetex.tlg 2017-07-17 02:15:50 UTC (rev 7387)
@@ -2798,6 +2798,7 @@
Defining message LaTeX/kernel/variable-not-defined on line ...
Defining message LaTeX/kernel/variant-too-long on line ...
Defining message LaTeX/kernel/invalid-variant on line ...
+Defining message LaTeX/kernel/debug on line ...
Defining message LaTeX/check/non-declared-variable on line ...
Defining message LaTeX/kernel/bad-variable on line ...
Defining message LaTeX/kernel/misused-sequence on line ...
More information about the latex3-commits
mailing list