summaryrefslogtreecommitdiff
path: root/Build/source/texk
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk')
-rw-r--r--Build/source/texk/web2c/ChangeLog13
-rw-r--r--Build/source/texk/web2c/Makefile.in2
-rw-r--r--Build/source/texk/web2c/NEWS11
-rw-r--r--Build/source/texk/web2c/enctex.ch12
-rw-r--r--Build/source/texk/web2c/pdftexdir/am/pdftex.am3
-rw-r--r--Build/source/texk/web2c/tests/tracingstacklevel2.tex4
-rw-r--r--Build/source/texk/web2c/tests/tracingstacklevels.tex22
-rw-r--r--Build/source/texk/web2c/tracingstacklevels.ch117
-rw-r--r--Build/source/texk/web2c/xetexdir/am/xetex.am3
-rw-r--r--Build/source/texk/web2c/xetexdir/xetex.ch5
10 files changed, 179 insertions, 13 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 16037c6ba05..5c6335985f0 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,16 @@
+2021-02-12 Karl Berry <karl@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,
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in
index 56317a3cb30..8b5d6b90310 100644
--- a/Build/source/texk/web2c/Makefile.in
+++ b/Build/source/texk/web2c/Makefile.in
@@ -4539,6 +4539,7 @@ pdftex_ch_srcs = \
pdftexdir/pdftex.web \
pdftexdir/tex.ch0 \
tex.ch \
+ tracingstacklevels.ch \
zlib-fmt.ch \
enctex.ch \
$(pdftex_ch_synctex) \
@@ -5228,6 +5229,7 @@ xetex_ch_srcs = \
xetexdir/xetex.web \
xetexdir/tex.ch0 \
tex.ch \
+ tracingstacklevels.ch \
$(xetex_ch_synctex) \
xetexdir/xetex.ch \
$(xetex_post_ch_synctex) \
diff --git a/Build/source/texk/web2c/NEWS b/Build/source/texk/web2c/NEWS
index 6ddb6a35364..1c0fc2ef714 100644
--- a/Build/source/texk/web2c/NEWS
+++ b/Build/source/texk/web2c/NEWS
@@ -4,11 +4,14 @@ This file records noteworthy changes. (Public domain.)
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)
diff --git a/Build/source/texk/web2c/enctex.ch b/Build/source/texk/web2c/enctex.ch
index c0f5bfe4fa5..4920a8f9fb3 100644
--- a/Build/source/texk/web2c/enctex.ch
+++ b/Build/source/texk/web2c/enctex.ch
@@ -93,13 +93,13 @@ k:=first; while k < last do begin print_buffer(k) end;
% encTeX: \mubytein \mubyteout \mubytelog and \specialout
@x [17.236] l.4954
-@d web2c_int_pars=web2c_int_base+3 {total number of web2c's integer parameters}
+@d web2c_int_pars=web2c_int_base+4 {total number of web2c's integer parameters}
@y
-@d mubyte_in_code=web2c_int_base+3 {if positive then reading mubytes is active}
-@d mubyte_out_code=web2c_int_base+4 {if positive then printing mubytes is active}
-@d mubyte_log_code=web2c_int_base+5 {if positive then print mubytes to log and terminal}
-@d spec_out_code=web2c_int_base+6 {if positive then print specials by mubytes}
-@d web2c_int_pars=web2c_int_base+7 {total number of web2c's integer parameters}
+@d mubyte_in_code=web2c_int_base+4{if positive then reading mubytes is active}
+@d mubyte_out_code=web2c_int_base+5{if positive then printing mubytes is active}
+@d mubyte_log_code=web2c_int_base+6{if positive then print mubytes to log and terminal}
+@d spec_out_code=web2c_int_base+7 {if positive then print specials by mubytes}
+@d web2c_int_pars=web2c_int_base+8 {total number of web2c's integer parameters}
@z
% encTeX: \mubytein \mubyteout \mubytelog and \specialout
diff --git a/Build/source/texk/web2c/pdftexdir/am/pdftex.am b/Build/source/texk/web2c/pdftexdir/am/pdftex.am
index 3bd5280521a..38f5704517d 100644
--- a/Build/source/texk/web2c/pdftexdir/am/pdftex.am
+++ b/Build/source/texk/web2c/pdftexdir/am/pdftex.am
@@ -1,7 +1,7 @@
## $Id$
## texk/web2c/pdftexdir/am/pdftex.am: Makefile fragment for pdfTeX.
##
-## Copyright 2016-2020 Karl Berry <tex-live@tug.org>
+## Copyright 2016-2021 Karl Berry <tex-live@tug.org>
## Copyright 2009-2015 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
@@ -70,6 +70,7 @@ pdftex_ch_srcs = \
pdftexdir/pdftex.web \
pdftexdir/tex.ch0 \
tex.ch \
+ tracingstacklevels.ch \
zlib-fmt.ch \
enctex.ch \
$(pdftex_ch_synctex) \
diff --git a/Build/source/texk/web2c/tests/tracingstacklevel2.tex b/Build/source/texk/web2c/tests/tracingstacklevel2.tex
new file mode 100644
index 00000000000..a3879ffabba
--- /dev/null
+++ b/Build/source/texk/web2c/tests/tracingstacklevel2.tex
@@ -0,0 +1,4 @@
+% $Id$
+% Public domain. Originally written by Karl Berry, 2021.
+% Trivial subfile for tracingstacklevels.tex.
+\b2
diff --git a/Build/source/texk/web2c/tests/tracingstacklevels.tex b/Build/source/texk/web2c/tests/tracingstacklevels.tex
new file mode 100644
index 00000000000..e2509a8b82c
--- /dev/null
+++ b/Build/source/texk/web2c/tests/tracingstacklevels.tex
@@ -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
diff --git a/Build/source/texk/web2c/tracingstacklevels.ch b/Build/source/texk/web2c/tracingstacklevels.ch
new file mode 100644
index 00000000000..81fb697c821
--- /dev/null
+++ b/Build/source/texk/web2c/tracingstacklevels.ch
@@ -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
+% ...
+
+@x
+@d web2c_int_pars=web2c_int_base+3 {total number of web2c's integer parameters}
+@y
+@d tracing_stack_levels_code=web2c_int_base+3 {tracing input_stack level if tracingmacros positive}
+@d web2c_int_pars=web2c_int_base+4 {total number of web2c's integer parameters}
+@z
+
+@x
+@d tracing_char_sub_def==int_par(tracing_char_sub_def_code)
+@y
+@d tracing_char_sub_def==int_par(tracing_char_sub_def_code)
+@d tracing_stack_levels==int_par(tracing_stack_levels_code)
+@z
+
+@x
+tracing_char_sub_def_code:print_esc("tracingcharsubdef");
+@y
+tracing_char_sub_def_code:print_esc("tracingcharsubdef");
+tracing_stack_levels_code:print_esc("tracingstacklevels");
+@z
+
+@x
+ primitive("tracingcharsubdef",assign_int,int_base+tracing_char_sub_def_code);@/
+@!@:tracing_char_sub_def_}{\.{\\tracingcharsubdef} primitive@>
+ end;
+@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@>
+@z
+
+@x This is in <Tidy up the parameter...>.
+incr(n);
+if tracing_macros>0 then
+@y
+incr(n);
+if tracing_macros>0 then
+ if (tracing_stack_levels=0) or (input_ptr<tracing_stack_levels) then
+@z
+
+@x \tracingstacklevels for macro expansion.
+begin begin_diagnostic; print_ln; print_cs(warning_index);
+token_show(ref_count); end_diagnostic(false);
+@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);
+@z
+
+@x New variable in |start_input|.
+var temp_str: str_number;
+begin scan_file_name; {set |cur_name| to desired file name}
+@y
+var temp_str: str_number;
+v: pointer;
+begin scan_file_name; {set |cur_name| to desired file name}
+@z
+
+% \tracingstacklevels for \input.
+% Still in |start_input|, after other changes from the general \.{tex.ch}.
+@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;
+@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;
+@z
diff --git a/Build/source/texk/web2c/xetexdir/am/xetex.am b/Build/source/texk/web2c/xetexdir/am/xetex.am
index 1d3cb7062eb..ecbdc8ca31f 100644
--- a/Build/source/texk/web2c/xetexdir/am/xetex.am
+++ b/Build/source/texk/web2c/xetexdir/am/xetex.am
@@ -1,7 +1,7 @@
## $Id$
## texk/web2c/xetexdir/am/xetex.am: Makefile fragment for XeTeX.
##
-## Copyright 2017-2020 Karl Berry <tex-live@tug.org>
+## Copyright 2017-2021 Karl Berry <tex-live@tug.org>
## Copyright 2009-2015 Peter Breitenlohner <tex-live@tug.org>
## You may freely use, modify and/or distribute this file.
@@ -113,6 +113,7 @@ xetex_ch_srcs = \
xetexdir/xetex.web \
xetexdir/tex.ch0 \
tex.ch \
+ tracingstacklevels.ch \
$(xetex_ch_synctex) \
xetexdir/xetex.ch \
$(xetex_post_ch_synctex) \
diff --git a/Build/source/texk/web2c/xetexdir/xetex.ch b/Build/source/texk/web2c/xetexdir/xetex.ch
index c7fe814adbf..05cb7dd8de5 100644
--- a/Build/source/texk/web2c/xetexdir/xetex.ch
+++ b/Build/source/texk/web2c/xetexdir/xetex.ch
@@ -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 @@ for j:=1 to n do append_to_name(TEX_format_default[j]);
@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