texlive[57724] \tracingstacklevels: new cross-engine parameter

commits+karl at tug.org commits+karl at tug.org
Sat Feb 13 03:14:44 CET 2021


Revision: 57724
          http://tug.org/svn/texlive?view=revision&revision=57724
Author:   karl
Date:     2021-02-13 03:14:44 +0100 (Sat, 13 Feb 2021)
Log Message:
-----------
\tracingstacklevels: new cross-engine parameter proposed and implemented by Petr Olsak

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ChangeLog
    trunk/Build/source/texk/web2c/Makefile.in
    trunk/Build/source/texk/web2c/NEWS
    trunk/Build/source/texk/web2c/enctex.ch
    trunk/Build/source/texk/web2c/pdftexdir/am/pdftex.am
    trunk/Build/source/texk/web2c/xetexdir/am/xetex.am
    trunk/Build/source/texk/web2c/xetexdir/xetex.ch

Added Paths:
-----------
    trunk/Build/source/texk/web2c/tests/tracingstacklevel2.tex
    trunk/Build/source/texk/web2c/tests/tracingstacklevels.tex
    trunk/Build/source/texk/web2c/tracingstacklevels.ch

Property Changed:
----------------
    trunk/Build/source/texk/web2c/xetexdir/xetex.ch

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2021-02-13 00:54:20 UTC (rev 57723)
+++ trunk/Build/source/texk/web2c/ChangeLog	2021-02-13 02:14:44 UTC (rev 57724)
@@ -1,3 +1,16 @@
+2021-02-12  Karl Berry  <karl at freefriends.org>
+
+	* tracingstacklevels.ch: new change file for \tracingstacklevels
+	parameter, proposed and implemented by Petr Olsak.
+	* pdftexdir/am/pdftex.am (pdftex_ch_srcs),
+	* xetexdir/am/xetex.am (xetex_ch_srcs): add it.
+	* tests/tracingstacklevels.tex,
+	* tests/tracingstacklevel2.tex: test files (for manual use; not
+	included in make check).
+	* xetexdir/xetex.ch (v): new declaration needed in start_input.
+	* enctex.ch: adjust web2c_int_pars so that this is applied after
+	tracingstacklevels.ch.
+
 2021-02-08  Andreas Scherer  <https://ascherer.github.io>
 
 	* ctangleboot.cin,

Modified: trunk/Build/source/texk/web2c/Makefile.in
===================================================================
--- trunk/Build/source/texk/web2c/Makefile.in	2021-02-13 00:54:20 UTC (rev 57723)
+++ trunk/Build/source/texk/web2c/Makefile.in	2021-02-13 02:14:44 UTC (rev 57724)
@@ -4539,6 +4539,7 @@
 	pdftexdir/pdftex.web \
 	pdftexdir/tex.ch0 \
 	tex.ch \
+	tracingstacklevels.ch \
 	zlib-fmt.ch \
 	enctex.ch \
 	$(pdftex_ch_synctex) \
@@ -5228,6 +5229,7 @@
 	xetexdir/xetex.web \
 	xetexdir/tex.ch0 \
 	tex.ch \
+	tracingstacklevels.ch \
 	$(xetex_ch_synctex) \
 	xetexdir/xetex.ch \
 	$(xetex_post_ch_synctex) \

Modified: trunk/Build/source/texk/web2c/NEWS
===================================================================
--- trunk/Build/source/texk/web2c/NEWS	2021-02-13 00:54:20 UTC (rev 57723)
+++ trunk/Build/source/texk/web2c/NEWS	2021-02-13 02:14:44 UTC (rev 57724)
@@ -4,11 +4,14 @@
 https://tug.org/TUGboat/42-1/tb130knuth-tuneup21.pdf
 New TeX version is 3.141592653, MF 2.71828182.
 
-* pdftex, xetex, e(u)ptex: if \tracinglostchars >= 3,
-make missing characters an error (not just a log message),
-and always report the character code in hex.
+* for all engines except original TeX:
+- if \tracinglostchars >= 3, make missing characters an error (not just
+  a log message), and always report the character code in hex.
+- if new primitive parameter \tracingstacklevels > 0, logging of macro
+  expansion at higher levels is truncated; also, the macro expansion
+  depth is indicated on \tracingmacros log lines.
 
-* obscure interaction sequences try to avoid crashing.
+* obscure interaction sequences no longer crash.
 
 

 2020 (for TeX Live 2020, 27 March 2020)

Modified: trunk/Build/source/texk/web2c/enctex.ch
===================================================================
--- trunk/Build/source/texk/web2c/enctex.ch	2021-02-13 00:54:20 UTC (rev 57723)
+++ trunk/Build/source/texk/web2c/enctex.ch	2021-02-13 02:14:44 UTC (rev 57724)
@@ -93,13 +93,13 @@
 
 % encTeX: \mubytein \mubyteout \mubytelog and \specialout
 @x [17.236] l.4954
- at d web2c_int_pars=web2c_int_base+3 {total number of web2c's integer parameters}
+ at d web2c_int_pars=web2c_int_base+4 {total number of web2c's integer parameters}
 @y
- at d mubyte_in_code=web2c_int_base+3 {if positive then reading mubytes is active}
- at d mubyte_out_code=web2c_int_base+4 {if positive then printing mubytes is active}
- at d mubyte_log_code=web2c_int_base+5 {if positive then print mubytes to log and terminal}
- at d spec_out_code=web2c_int_base+6 {if positive then print specials by mubytes}
- at d web2c_int_pars=web2c_int_base+7 {total number of web2c's integer parameters}
+ at d mubyte_in_code=web2c_int_base+4{if positive then reading mubytes is active}
+ at d mubyte_out_code=web2c_int_base+5{if positive then printing mubytes is active}
+ at d mubyte_log_code=web2c_int_base+6{if positive then print mubytes to log and terminal}
+ at d spec_out_code=web2c_int_base+7 {if positive then print specials by mubytes}
+ at d web2c_int_pars=web2c_int_base+8 {total number of web2c's integer parameters}
 @z
 
 % encTeX: \mubytein \mubyteout \mubytelog and \specialout

Modified: trunk/Build/source/texk/web2c/pdftexdir/am/pdftex.am
===================================================================
--- trunk/Build/source/texk/web2c/pdftexdir/am/pdftex.am	2021-02-13 00:54:20 UTC (rev 57723)
+++ trunk/Build/source/texk/web2c/pdftexdir/am/pdftex.am	2021-02-13 02:14:44 UTC (rev 57724)
@@ -1,7 +1,7 @@
 ## $Id$
 ## texk/web2c/pdftexdir/am/pdftex.am: Makefile fragment for pdfTeX.
 ##
-## Copyright 2016-2020 Karl Berry <tex-live at tug.org>
+## Copyright 2016-2021 Karl Berry <tex-live at tug.org>
 ## Copyright 2009-2015 Peter Breitenlohner <tex-live at tug.org>
 ## You may freely use, modify and/or distribute this file.
 
@@ -70,6 +70,7 @@
 	pdftexdir/pdftex.web \
 	pdftexdir/tex.ch0 \
 	tex.ch \
+	tracingstacklevels.ch \
 	zlib-fmt.ch \
 	enctex.ch \
 	$(pdftex_ch_synctex) \

Added: trunk/Build/source/texk/web2c/tests/tracingstacklevel2.tex
===================================================================
--- trunk/Build/source/texk/web2c/tests/tracingstacklevel2.tex	                        (rev 0)
+++ trunk/Build/source/texk/web2c/tests/tracingstacklevel2.tex	2021-02-13 02:14:44 UTC (rev 57724)
@@ -0,0 +1,4 @@
+% $Id$
+% Public domain. Originally written by Karl Berry, 2021.
+% Trivial subfile for tracingstacklevels.tex.
+\b2


Property changes on: trunk/Build/source/texk/web2c/tests/tracingstacklevel2.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: trunk/Build/source/texk/web2c/tests/tracingstacklevels.tex
===================================================================
--- trunk/Build/source/texk/web2c/tests/tracingstacklevels.tex	                        (rev 0)
+++ trunk/Build/source/texk/web2c/tests/tracingstacklevels.tex	2021-02-13 02:14:44 UTC (rev 57724)
@@ -0,0 +1,22 @@
+% $Id$
+% Public domain. Originally written by Karl Berry, 2021.
+% Trivially test \tracingstacklevels (works with initex).
+% (Run by hand; not included in the make check tests.)
+% See tracingstacklevels.ch and the pdftex manual for more info.
+
+\catcode`\{=1 \catcode`\}=2 \catcode`\#=6
+
+%\tracingcommands=3 % more output if you want to see
+
+\tracingmacros=2      % so macro expansion is logged at all
+\tracingstacklevels=2 % cut off at level 2
+
+\def\a#1{\relax}      % arguments since parameter logging is affected too
+\def\b#1{\a{#1}}
+\b1
+
+% try \input, which counts as another level for this.
+% The file expands \b again.
+\input tracingstacklevel2
+
+\end


Property changes on: trunk/Build/source/texk/web2c/tests/tracingstacklevels.tex
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Added: trunk/Build/source/texk/web2c/tracingstacklevels.ch
===================================================================
--- trunk/Build/source/texk/web2c/tracingstacklevels.ch	                        (rev 0)
+++ trunk/Build/source/texk/web2c/tracingstacklevels.ch	2021-02-13 02:14:44 UTC (rev 57724)
@@ -0,0 +1,117 @@
+% $Id$
+% Public domain. From Petr Olsak, tex-implementors 2feb2021,
+% with adaptations by Akira Kakuto.
+%
+% If new parameter \tracingstacklevels>0, and \tracingmacros>0,
+% output a prefix indicating depth of macro nesting. Also output a
+% similar prefix for each \input (regardless of \tracingmacros), which
+% counts as a level of input for this.
+% 
+% Furthermore, if macro expansion is >= the \tracingstacklevels
+% value, abbreviate the output.
+% 
+% A simple test file is in web2c/tests; running:
+%   TEXINPUTS=/.../web2c/tests pdftex -ini tracingstacklevels.tex
+% should result in log output like:
+%   ~.\b ->\a 
+%   ~~\a 
+%   ...
+%   ~.INPUT tracingstacklevel2
+%   ~~\b
+%   ...
+
+ at x
+ at d web2c_int_pars=web2c_int_base+3 {total number of web2c's integer parameters}
+ at y
+ at d tracing_stack_levels_code=web2c_int_base+3 {tracing input_stack level if tracingmacros positive}
+ at d web2c_int_pars=web2c_int_base+4 {total number of web2c's integer parameters}
+ at z
+
+ at x
+ at d tracing_char_sub_def==int_par(tracing_char_sub_def_code)
+ at y
+ at d tracing_char_sub_def==int_par(tracing_char_sub_def_code)
+ at d tracing_stack_levels==int_par(tracing_stack_levels_code)
+ at z
+
+ at x
+tracing_char_sub_def_code:print_esc("tracingcharsubdef");
+ at y
+tracing_char_sub_def_code:print_esc("tracingcharsubdef");
+tracing_stack_levels_code:print_esc("tracingstacklevels");
+ at z
+
+ at x
+  primitive("tracingcharsubdef",assign_int,int_base+tracing_char_sub_def_code);@/
+@!@:tracing_char_sub_def_}{\.{\\tracingcharsubdef} primitive@>
+  end;
+ at y
+  primitive("tracingcharsubdef",assign_int,int_base+tracing_char_sub_def_code);@/
+@!@:tracing_char_sub_def_}{\.{\\tracingcharsubdef} primitive@>
+  end;
+  primitive("tracingstacklevels",assign_int,int_base+tracing_stack_levels_code);@/
+@!@:tracing_stack_levels_}{\.{\\tracingstacklevels} primitive@>
+ at z
+
+ at x This is in <Tidy up the parameter...>.
+incr(n);
+if tracing_macros>0 then
+ at y
+incr(n);
+if tracing_macros>0 then
+  if (tracing_stack_levels=0) or (input_ptr<tracing_stack_levels) then
+ at z
+
+ at x \tracingstacklevels for macro expansion.
+begin begin_diagnostic; print_ln; print_cs(warning_index);
+token_show(ref_count); end_diagnostic(false);
+ at y
+begin begin_diagnostic;
+  if tracing_stack_levels > 0 then
+    if input_ptr < tracing_stack_levels then
+      begin
+        v := input_ptr;
+        print_ln;  print_char("~");
+        while v > 0 do
+          begin print_char("."); decr(v);
+          end;
+        print_cs(warning_index); token_show(ref_count);
+      end
+    else begin
+           print_char("~"); print_char("~"); print_cs(warning_index);
+         end
+  else begin print_ln; print_cs(warning_index); token_show(ref_count); end;
+end_diagnostic(false);
+ at z
+
+ at x New variable in |start_input|.
+var temp_str: str_number;
+begin scan_file_name; {set |cur_name| to desired file name}
+ at y
+var temp_str: str_number;
+v: pointer;
+begin scan_file_name; {set |cur_name| to desired file name}
+ at z
+
+% \tracingstacklevels for \input.
+% Still in |start_input|, after other changes from the general \.{tex.ch}.
+ at x
+else if (term_offset>0)or(file_offset>0) then print_char(" ");
+print_char("("); incr(open_parens);
+slow_print(full_source_filename_stack[in_open]); update_terminal;
+ at y
+else if (term_offset>0)or(file_offset>0) then print_char(" ");
+print_char("("); incr(open_parens);
+slow_print(full_source_filename_stack[in_open]); update_terminal;
+if tracing_stack_levels > 0 then
+begin
+  begin_diagnostic; print_ln;
+  print_char("~");
+  v := input_ptr-1;
+  if v < tracing_stack_levels then
+    while v > 0 do begin print_char("."); decr(v); end
+  else print_char("~");
+  slow_print("INPUT "); slow_print(cur_name); print_ln;
+  end_diagnostic(false);
+end;
+ at z


Property changes on: trunk/Build/source/texk/web2c/tracingstacklevels.ch
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property
Modified: trunk/Build/source/texk/web2c/xetexdir/am/xetex.am
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/am/xetex.am	2021-02-13 00:54:20 UTC (rev 57723)
+++ trunk/Build/source/texk/web2c/xetexdir/am/xetex.am	2021-02-13 02:14:44 UTC (rev 57724)
@@ -1,7 +1,7 @@
 ## $Id$
 ## texk/web2c/xetexdir/am/xetex.am: Makefile fragment for XeTeX.
 ##
-## Copyright 2017-2020 Karl Berry <tex-live at tug.org>
+## Copyright 2017-2021 Karl Berry <tex-live at tug.org>
 ## Copyright 2009-2015 Peter Breitenlohner <tex-live at tug.org>
 ## You may freely use, modify and/or distribute this file.
 
@@ -113,6 +113,7 @@
 	xetexdir/xetex.web \
 	xetexdir/tex.ch0 \
 	tex.ch \
+	tracingstacklevels.ch \
 	$(xetex_ch_synctex) \
 	xetexdir/xetex.ch \
 	$(xetex_post_ch_synctex) \

Modified: trunk/Build/source/texk/web2c/xetexdir/xetex.ch
===================================================================
--- trunk/Build/source/texk/web2c/xetexdir/xetex.ch	2021-02-13 00:54:20 UTC (rev 57723)
+++ trunk/Build/source/texk/web2c/xetexdir/xetex.ch	2021-02-13 02:14:44 UTC (rev 57724)
@@ -1,7 +1,8 @@
 /****************************************************************************\
+ $Id$
  Part of the XeTeX typesetting system
  Copyright (c) 1994-2008 by SIL International
- Copyright (c) 2009-2012 by Jonathan Kew
+ Copyright (c) 2009-2021 by Jonathan Kew
  Copyright (c) 2012 by Khaled Hosny
 
  SIL Author(s): Jonathan Kew
@@ -427,9 +428,11 @@
 
 @x [29.537] l.10338 - start_input
 var temp_str: str_number;
+v: pointer;
 begin scan_file_name; {set |cur_name| to desired file name}
 @y
 var temp_str: str_number;
+v: pointer;
 @!k:0..file_name_size; {index into |name_of_file16|}
 begin scan_file_name; {set |cur_name| to desired file name}
 @z


Property changes on: trunk/Build/source/texk/web2c/xetexdir/xetex.ch
___________________________________________________________________
Added: svn:keywords
## -0,0 +1 ##
+Date Author Id Revision
\ No newline at end of property


More information about the tex-live-commits mailing list.