[latex3-commits] [git/LaTeX3-latex3-latex2e] marks-debug: debugging version 0 (234f9933)
Frank Mittelbach
frank.mittelbach at latex-project.org
Wed Apr 13 19:55:39 CEST 2022
Repository : https://github.com/latex3/latex2e
On branch : marks-debug
Link : https://github.com/latex3/latex2e/commit/234f9933fdd7b06e478965224b7939b7ec1e522f
>---------------------------------------------------------------
commit 234f9933fdd7b06e478965224b7939b7ec1e522f
Author: Frank Mittelbach <frank.mittelbach at latex-project.org>
Date: Wed Apr 13 19:55:39 2022 +0200
debugging version 0
>---------------------------------------------------------------
234f9933fdd7b06e478965224b7939b7ec1e522f
base/ltmarks.dtx | 63 +++++++++++++++++++++++++----------
base/testfiles-ltmarks/xmarks-001.lvt | 2 +-
base/testfiles-ltmarks/xmarks-002.lvt | 2 +-
base/testfiles-ltmarks/xmarks-003.lvt | 2 +-
base/testfiles-ltmarks/xmarks-004.lvt | 2 +-
base/testfiles-ltmarks/xmarks-005.lvt | 3 +-
base/testfiles-ltmarks/xmarks-006.lvt | 2 +-
7 files changed, 51 insertions(+), 25 deletions(-)
diff --git a/base/ltmarks.dtx b/base/ltmarks.dtx
index 8b053e61..ae9106fd 100644
--- a/base/ltmarks.dtx
+++ b/base/ltmarks.dtx
@@ -330,14 +330,14 @@
%
%
% \begin{function}{\DebugsMarksOn,\DebugMarksOff,
-% \hook_debug_on:,\hook_debug_off:}
+% \mark_debug_on:,\mark_debug_off:}
% \begin{syntax}
% \cs{DebugsMarksOn} ... \cs{DebugMarksOff}
% \end{syntax}
%
% Commands to turn the debugging of mark code on or off. The
% debugging output is rather coarse and not really intended for
-% normal use.
+% normal use at this point in time.
%
% \end{function}
%
@@ -704,7 +704,7 @@
\cs_new_protected:Npn \@@_new_class:nn #1
{
%<*trace>
- \@@_trace:n { new~mark:~ #1 }
+ \@@_debug:n{ \iow_term:x { Marks:~ new~mark:~ #1 ~ \msg_line_context: } }
%</trace>
% \end{macrocode}
% Use the \LaTeXe{} interface for now as the L3 programming layer
@@ -1022,7 +1022,8 @@
\cs_set_eq:NN \glossary \scan_stop:
\unrestored at protected@xdef \g_@@_tmp_tl {#2}
%<*trace>
- \@@_trace:n { set~#1~<-~ '\tl_to_str:V \g_@@_tmp_tl' }
+ \@@_debug:n{ \iow_term:x { Marks:~ set~#1~<-~
+ '\tl_to_str:V \g_@@_tmp_tl' ~ \msg_line_context: } }
%</trace>
\tex_marks:D \use:c { c_@@_class_ #1 _mark }
{
@@ -1168,27 +1169,52 @@
% be useful in practice. For now the tracing is mainly meant to be used
% for code testing and not so much for application testing.
%
-% The fact that it is not documented above should indicate that the
+% It is quite likely that the
% commands and the behavior of the tracing might change in the
% future once we gained some experience with it.
%
-% \begin{variable}{\tracingmarks}
-% Used to control the amount of trace material placed in the log.
+% \begin{macro}{\g_@@_debug_bool}
+% Holds the current debugging state.
% \begin{macrocode}
-\int_new:N \tracingmarks
+\bool_new:N \g_@@_debug_bool
% \end{macrocode}
-% \end{variable}
+% \end{macro}
%
-% \begin{macro}{\@@_trace:n}
-% Two trace functions, one more verbose than the other.
+% \begin{macro}{\mark_debug_on:,\mark_debug_off:}
+% \begin{macro}{\@@_debug:n}
+% \begin{macro}{\@@_debug_gset:}
+% Turns debugging on and off by redefining \cs{@@_debug:n}.
% \begin{macrocode}
-%<*trace>
-\cs_new_protected:Npn \@@_trace:n #1 {
- \int_compare:nNnT \tracingmarks > 0
- { \iow_term:x { Marks:~#1~ \msg_line_context: } }
-}
+\cs_new_eq:NN \@@_debug:n \use_none:n
+\cs_new_protected:Npn \mark_debug_on:
+ {
+ \bool_gset_true:N \g_@@_debug_bool
+ \@@_debug_gset:
+ }
+\cs_new_protected:Npn \mark_debug_off:
+ {
+ \bool_gset_false:N \g_@@_debug_bool
+ \@@_debug_gset:
+ }
+\cs_new_protected:Npn \@@_debug_gset:
+ {
+ \cs_gset_protected:Npx \@@_debug:n ##1
+ { \bool_if:NT \g_@@_debug_bool {##1} }
+ }
% \end{macrocode}
-% \end{macro}
+% \end{macro}
+% \end{macro}
+% \end{macro}
+%
+%
+%
+% \begin{macro}{\DebugMarksOn,\DebugMarksOff}
+%
+% \begin{macrocode}
+\cs_new_protected:Npn \DebugMarksOn { \mark_debug_on: }
+\cs_new_protected:Npn \DebugMarksOff { \mark_debug_off: }
+% \end{macrocode}
+% \end{macro}
%
%
%
@@ -1197,9 +1223,10 @@
% (\verb=#2=). The first argument gives some \meta{info} to help
% identifying where the command was called.
% \begin{macrocode}
+%<*trace>
\cs_new_protected:Npn \mark_status:nn #1#2
{
- \int_compare:nNnT \tracingmarks > 1
+ \@@_debug:n
{
\typeout{ Marks:~#2~ #1:}
\typeout{\@spaces page~ (current):
diff --git a/base/testfiles-ltmarks/xmarks-001.lvt b/base/testfiles-ltmarks/xmarks-001.lvt
index 33da61dc..9a8f38fd 100644
--- a/base/testfiles-ltmarks/xmarks-001.lvt
+++ b/base/testfiles-ltmarks/xmarks-001.lvt
@@ -8,7 +8,7 @@
\input{regression-test}
-\tracingmarks=2
+\DebugMarksOn
\START
diff --git a/base/testfiles-ltmarks/xmarks-002.lvt b/base/testfiles-ltmarks/xmarks-002.lvt
index 335c4929..cc247dd2 100644
--- a/base/testfiles-ltmarks/xmarks-002.lvt
+++ b/base/testfiles-ltmarks/xmarks-002.lvt
@@ -8,7 +8,7 @@
\input{regression-test}
-\tracingmarks=2
+\DebugMarksOn
\START
diff --git a/base/testfiles-ltmarks/xmarks-003.lvt b/base/testfiles-ltmarks/xmarks-003.lvt
index f9138201..a124b4df 100644
--- a/base/testfiles-ltmarks/xmarks-003.lvt
+++ b/base/testfiles-ltmarks/xmarks-003.lvt
@@ -8,7 +8,7 @@
\input{regression-test}
-\tracingmarks=2
+\DebugMarksOn
\START
diff --git a/base/testfiles-ltmarks/xmarks-004.lvt b/base/testfiles-ltmarks/xmarks-004.lvt
index 04f173d8..1c0c168e 100644
--- a/base/testfiles-ltmarks/xmarks-004.lvt
+++ b/base/testfiles-ltmarks/xmarks-004.lvt
@@ -8,7 +8,7 @@
\input{regression-test}
-\tracingmarks=2
+\DebugMarksOn
\START
diff --git a/base/testfiles-ltmarks/xmarks-005.lvt b/base/testfiles-ltmarks/xmarks-005.lvt
index 1ff2aee8..8cc42474 100644
--- a/base/testfiles-ltmarks/xmarks-005.lvt
+++ b/base/testfiles-ltmarks/xmarks-005.lvt
@@ -8,8 +8,7 @@
\input{regression-test}
-\tracingmarks=2
-
+\DebugMarksOn
%\showoutput
diff --git a/base/testfiles-ltmarks/xmarks-006.lvt b/base/testfiles-ltmarks/xmarks-006.lvt
index 298f218a..60be8ee1 100644
--- a/base/testfiles-ltmarks/xmarks-006.lvt
+++ b/base/testfiles-ltmarks/xmarks-006.lvt
@@ -11,7 +11,7 @@
\input{regression-test}
-%\tracingmarks=0
+\DebugMarksOff
\makeatletter
\def\@oddhead{\rightmark\hfil\thepage\protected at xdef\XXX{===Odd======|left=\leftmark |right=\rightmark|}}
More information about the latex3-commits
mailing list.