summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/texk/web2c/ChangeLog19
-rw-r--r--Build/source/texk/web2c/Makefile.in4
-rw-r--r--Build/source/texk/web2c/NEWS5
-rw-r--r--Build/source/texk/web2c/enctexdir/enctex-pdftex.ch14
-rw-r--r--Build/source/texk/web2c/eptexdir/am/eptex.am1
-rw-r--r--Build/source/texk/web2c/euptexdir/am/euptex.am1
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/commands.c9
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/equivalents.h6
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mainbody.c1
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/maincontrol.c8
-rw-r--r--Build/source/texk/web2c/pdftexdir/am/pdftex.am1
-rw-r--r--Build/source/texk/web2c/showstream.ch135
-rw-r--r--Build/source/texk/web2c/xetexdir/am/xetex.am1
13 files changed, 195 insertions, 10 deletions
diff --git a/Build/source/texk/web2c/ChangeLog b/Build/source/texk/web2c/ChangeLog
index 329a982e538..83af7d8d979 100644
--- a/Build/source/texk/web2c/ChangeLog
+++ b/Build/source/texk/web2c/ChangeLog
@@ -1,3 +1,22 @@
+2021-11-07 Marcel Kr\"uger <tex@2krueger.de>
+
+ * showstream.ch: new primitive \showstream.
+ * NEWS: mention this.
+
+ * eptexdir/am/eptex.am (eptex_web_srcs),
+ * euptexdir/am/euptex.am (euptex_web_srcs),
+ * pdftexdir/am/pdftex.am (pdftex_ch_srcs),
+ * xetexdir/am/xetex.am (xetex_ch_srcs): include showstream.ch.
+
+ * enctexdir/enctex-pdftex.ch: rearrange constants.
+
+ * luatexdir/tex/commands.c (initialize_etex_commands): primitive_etex.
+ * luatexdir/tex/equivalents.h (show_stream_code, show_stream_par):
+ new #define.
+ (math_option_code): increment.
+ * luatexdir/tex/mainbody.c (main_initialize): show_stream_par=-1.
+ * luatexdir/tex/maincontrol.c (show_whatever): implement \showstream.
+
2021-11-03 Karl Berry <karl@freefriends.org>
* am/texmf.am (install-mf-links) [WIN32]: install via libtool,
diff --git a/Build/source/texk/web2c/Makefile.in b/Build/source/texk/web2c/Makefile.in
index 97250f55507..b3bdc56a4f9 100644
--- a/Build/source/texk/web2c/Makefile.in
+++ b/Build/source/texk/web2c/Makefile.in
@@ -4434,6 +4434,7 @@ eptex_web_srcs = \
tex.ch \
tracingstacklevels.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
etexdir/tex.ech
@@ -4546,6 +4547,7 @@ euptex_web_srcs = \
tex.ch \
tracingstacklevels.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
etexdir/tex.ech
@@ -4665,6 +4667,7 @@ pdftex_ch_srcs = \
tracingstacklevels.ch \
partoken-102.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
enctexdir/enctex1.ch \
enctexdir/enctex-pdftex.ch \
@@ -5359,6 +5362,7 @@ xetex_ch_srcs = \
tracingstacklevels.ch \
partoken-102.ch \
partoken.ch \
+ showstream.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 d398bf800f8..d2d9af17f85 100644
--- a/Build/source/texk/web2c/NEWS
+++ b/Build/source/texk/web2c/NEWS
@@ -1,12 +1,13 @@
This file records noteworthy changes. (Public domain.)
-* for all engines except original TeX:
+* for all engines except original (e)TeX:
+- new primitive \showstream to redirect \show output to a file.
- new primitives \partokenname and \partokencontext allow overriding the
name of the internally-emitted \par token at blank lines, the end of
vboxes, etc.
-2021 (for TeX Live 2021, 23 March 2021)
+2021 (for TeX Live 2021, 23 March (e)2021)
* Knuth 2021 tune-up, with fixes to all of his *.web files. Overview:
https://tug.org/TUGboat/42-1/tb130knuth-tuneup21.pdf
New TeX version is 3.141592653, MF 2.71828182.
diff --git a/Build/source/texk/web2c/enctexdir/enctex-pdftex.ch b/Build/source/texk/web2c/enctexdir/enctex-pdftex.ch
index 283cd3e84b0..8cb1a7a6d5b 100644
--- a/Build/source/texk/web2c/enctexdir/enctex-pdftex.ch
+++ b/Build/source/texk/web2c/enctexdir/enctex-pdftex.ch
@@ -1,16 +1,16 @@
% $Id$
% enctex1.ch is applied first.
% Then this change is applied for pdfTeX et al.,
-% assuming that tracingstacklevels.ch plus partoken.ch has been included,
+% assuming that tracingstacklevels.ch, partoken.ch, and showstream.ch has been included,
% as specified in the *.am files.
% encTeX: \mubytein \mubyteout \mubytelog and \specialout
@x [17.236] l.4954
-@d web2c_int_pars=web2c_int_base+5 {total number of web2c's integer parameters}
+@d web2c_int_pars=web2c_int_base+6 {total number of web2c's integer parameters}
@y
-@d mubyte_in_code=web2c_int_base+5{if positive then reading mubytes is active}
-@d mubyte_out_code=web2c_int_base+6{if positive then printing mubytes is active}
-@d mubyte_log_code=web2c_int_base+7{if positive then print mubytes to log and terminal}
-@d spec_out_code=web2c_int_base+8 {if positive then print specials by mubytes}
-@d web2c_int_pars=web2c_int_base+9 {total number of web2c's integer parameters}
+@d mubyte_in_code=web2c_int_base+6{if positive then reading mubytes is active}
+@d mubyte_out_code=web2c_int_base+7{if positive then printing mubytes is active}
+@d mubyte_log_code=web2c_int_base+8{if positive then print mubytes to log and terminal}
+@d spec_out_code=web2c_int_base+9 {if positive then print specials by mubytes}
+@d web2c_int_pars=web2c_int_base+10 {total number of web2c's integer parameters}
@z
diff --git a/Build/source/texk/web2c/eptexdir/am/eptex.am b/Build/source/texk/web2c/eptexdir/am/eptex.am
index 41e3ccc9a8c..31af85a6dea 100644
--- a/Build/source/texk/web2c/eptexdir/am/eptex.am
+++ b/Build/source/texk/web2c/eptexdir/am/eptex.am
@@ -56,6 +56,7 @@ eptex_web_srcs = \
tex.ch \
tracingstacklevels.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
etexdir/tex.ech
diff --git a/Build/source/texk/web2c/euptexdir/am/euptex.am b/Build/source/texk/web2c/euptexdir/am/euptex.am
index 7f163aa6ec1..e795882859f 100644
--- a/Build/source/texk/web2c/euptexdir/am/euptex.am
+++ b/Build/source/texk/web2c/euptexdir/am/euptex.am
@@ -52,6 +52,7 @@ euptex_web_srcs = \
tex.ch \
tracingstacklevels.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
etexdir/tex.ech
diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.c b/Build/source/texk/web2c/luatexdir/tex/commands.c
index 576306b35eb..c4f85dd0437 100644
--- a/Build/source/texk/web2c/luatexdir/tex/commands.c
+++ b/Build/source/texk/web2c/luatexdir/tex/commands.c
@@ -818,6 +818,15 @@ void initialize_etex_commands(void)
primitive_luatex("shapemode", assign_int_cmd, int_base + shape_mode_code, int_base);
primitive_luatex("hyphenationbounds", assign_int_cmd, int_base + hyphenation_bounds_code, int_base);
+ /*tex
+
+ The \.{\\showstream} parameter allows to redirect the output of xray_cmd
+ commands to any write stream.
+
+ */
+
+ primitive_tex("showstream", assign_int_cmd, int_base + show_stream_code, int_base);
+
primitive_etex("showgroups", xray_cmd, show_groups, 0);
/*tex
diff --git a/Build/source/texk/web2c/luatexdir/tex/equivalents.h b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
index 459c2cb0143..84f85ba88ea 100644
--- a/Build/source/texk/web2c/luatexdir/tex/equivalents.h
+++ b/Build/source/texk/web2c/luatexdir/tex/equivalents.h
@@ -312,7 +312,9 @@ the |number_regs| \.{\\dimen} registers.
# define math_defaults_mode_code 119 /* > 0 : latex preferences */
# define discretionary_ligature_mode_code 120
-# define math_option_code 121
+# define show_stream_code 121
+
+# define math_option_code 122
# define mathoption_int_base_code (math_option_code+1) /* one reserve */
# define mathoption_int_last_code (mathoption_int_base_code+8)
@@ -816,6 +818,8 @@ extern halfword last_cs_name;
#define math_defaults_mode_par int_par(math_defaults_mode_code)
#define discretionary_ligature_mode_par int_par(discretionary_ligature_mode_code)
+#define show_stream_par int_par(show_stream_code)
+
/* */
#define math_use_current_family_code 7
diff --git a/Build/source/texk/web2c/luatexdir/tex/mainbody.c b/Build/source/texk/web2c/luatexdir/tex/mainbody.c
index 2f45f9989d2..4fbe62b69bc 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mainbody.c
+++ b/Build/source/texk/web2c/luatexdir/tex/mainbody.c
@@ -441,6 +441,7 @@ int main_initialize(void)
memset(eqtb, 0, sizeof(memory_word) * (unsigned) (eqtb_top + 1));
init_string_pool_array((unsigned) max_strings);
reset_cur_string();
+ show_stream_par = -1;
}
/*tex
Check the ``constant'' values...
diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
index 22f601ba275..9aec6c12ff4 100644
--- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
+++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
@@ -3968,6 +3968,10 @@ void show_whatever(void)
int m; /* upper bound on |fi_or_else| codes */
int l; /* line where that conditional began */
int n; /* level of \.{\\if...\\fi} nesting */
+ int saved_selector; /* previous selector. Must be distinct from the global err_old_setting. */
+ saved_selector = selector;
+ if (file_can_be_written(show_stream_par))
+ selector = show_stream_par;
switch (cur_chr) {
case show_lists:
begin_diagnostic();
@@ -4062,6 +4066,10 @@ void show_whatever(void)
}
}
COMMON_ENDING:
+ if (valid_write_file(selector)) {
+ selector = saved_selector;
+ return;
+ }
if (interaction < error_stop_mode) {
help0();
decr(error_count);
diff --git a/Build/source/texk/web2c/pdftexdir/am/pdftex.am b/Build/source/texk/web2c/pdftexdir/am/pdftex.am
index 07acca7cb7a..bb85a00f23a 100644
--- a/Build/source/texk/web2c/pdftexdir/am/pdftex.am
+++ b/Build/source/texk/web2c/pdftexdir/am/pdftex.am
@@ -73,6 +73,7 @@ pdftex_ch_srcs = \
tracingstacklevels.ch \
partoken-102.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
enctexdir/enctex1.ch \
enctexdir/enctex-pdftex.ch \
diff --git a/Build/source/texk/web2c/showstream.ch b/Build/source/texk/web2c/showstream.ch
new file mode 100644
index 00000000000..ba319209644
--- /dev/null
+++ b/Build/source/texk/web2c/showstream.ch
@@ -0,0 +1,135 @@
+Since we redirect content which is normally written to the terminal/log
+to a write stream, print_nl will sometimes get called while selector is a write
+stream. Therefore we adapt print_nl to handle that case properly.
+@x
+procedure print_nl(@!s:str_number); {prints string |s| at beginning of line}
+begin if ((term_offset>0)and(odd(selector)))or@|
+ ((file_offset>0)and(selector>=log_only)) then print_ln;
+print(s);
+end;
+@y
+procedure print_nl(@!s:str_number); {prints string |s| at beginning of line}
+begin if (selector<log_only)or((term_offset>0)and(odd(selector)))or@|
+ ((file_offset>0)and(selector>=log_only)) then print_ln;
+print(s);
+end;
+@z
+
+Add a integer parameter
+@x
+@d web2c_int_pars=web2c_int_base+5 {total number of web2c's integer parameters}
+@#
+@y
+@d show_stream_code=web2c_int_base+5 {stream to output xray commands to}
+@d web2c_int_pars=web2c_int_base+6 {total number of web2c's integer parameters}
+@#
+@z
+
+@x
+@d partoken_context==int_par(partoken_context_code)
+@y
+@d partoken_context==int_par(partoken_context_code)
+@d show_stream==int_par(show_stream_code)
+@z
+
+@x
+partoken_context_code:print_esc("partokencontext");
+@y
+partoken_context_code:print_esc("partokencontext");
+show_stream_code:print_esc("showstream");
+@z
+
+@x
+ primitive("partokencontext",assign_int,int_base+partoken_context_code);@/
+@!@:partoken_context_}{\.{\\partokencontext} primitive@>
+@y
+ primitive("partokencontext",assign_int,int_base+partoken_context_code);@/
+@!@:partoken_context_}{\.{\\partokencontext} primitive@>
+primitive("showstream",assign_int,int_base+show_stream_code);@/
+@!@:show_stream_}{\.{\\showstream} primitive@>
+@z
+
+Then assign a default value since it's not the normal 0.
+@x Part of the integer section of @<Initialize table entries...@>=, the integer section
+del_code("."):=0; {this null delimiter is used in error recovery}
+@y
+del_code("."):=0; {this null delimiter is used in error recovery}
+show_stream:=-1;
+@z
+
+Then do the actual change: In |show_whatever| we save the old selector
+and then replace it based on |show_stream|. We don't need any changes
+to |begin/end_diagnostic| since they don't do anything interesting if
+|selector| isn't |term_and_log|.
+@x
+procedure show_whatever;
+label common_ending;
+var p:pointer; {tail of a token list to show}
+@!t:small_number; {type of conditional being shown}
+@!m:normal..or_code; {upper bound on |fi_or_else| codes}
+@!l:integer; {line where that conditional began}
+@!n:integer; {level of \.{\\if...\\fi} nesting}
+begin case cur_chr of
+@y
+procedure show_whatever;
+label common_ending;
+var p:pointer; {tail of a token list to show}
+@!t:small_number; {type of conditional being shown}
+@!m:normal..or_code; {upper bound on |fi_or_else| codes}
+@!l:integer; {line where that conditional began}
+@!n:integer; {level of \.{\\if...\\fi} nesting}
+@!saved_selector:0..max_selector; {previous selector, separate from the global |old_setting|}
+begin saved_selector:=selector;
+if (show_stream>=0) and (show_stream<no_print) and write_open[show_stream] then
+ selector:=show_stream;
+case cur_chr of
+@z
+
+The ending gets skipped if we changed the selector,
+but we have to restore |selector|.
+@x
+@<Complete a potentially long \.{\\show} command@>;
+common_ending: if interaction<error_stop_mode then
+ begin help0; decr(error_count);
+ end
+else if tracing_online>0 then
+ begin@t@>@;@/
+ help3("This isn't an error message; I'm just \showing something.")@/
+ ("Type `I\show...' to show more (e.g., \show\cs,")@/
+ ("\showthe\count10, \showbox255, \showlists).");
+ end
+else begin@t@>@;@/
+ help5("This isn't an error message; I'm just \showing something.")@/
+ ("Type `I\show...' to show more (e.g., \show\cs,")@/
+ ("\showthe\count10, \showbox255, \showlists).")@/
+ ("And type `I\tracingonline=1\show...' to show boxes and")@/
+ ("lists on your terminal as well as in the transcript file.");
+ end;
+error;
+end;
+@y
+@<Complete a potentially long \.{\\show} command@>;
+common_ending: if selector<no_print then
+ begin print_ln;
+ selector:=saved_selector
+ end
+else begin if interaction<error_stop_mode then
+ begin help0; decr(error_count);
+ end
+ else if tracing_online>0 then
+ begin@t@>@;@/
+ help3("This isn't an error message; I'm just \showing something.")@/
+ ("Type `I\show...' to show more (e.g., \show\cs,")@/
+ ("\showthe\count10, \showbox255, \showlists).");
+ end
+ else begin@t@>@;@/
+ help5("This isn't an error message; I'm just \showing something.")@/
+ ("Type `I\show...' to show more (e.g., \show\cs,")@/
+ ("\showthe\count10, \showbox255, \showlists).")@/
+ ("And type `I\tracingonline=1\show...' to show boxes and")@/
+ ("lists on your terminal as well as in the transcript file.");
+ end;
+ error;
+ end;
+end;
+@z
diff --git a/Build/source/texk/web2c/xetexdir/am/xetex.am b/Build/source/texk/web2c/xetexdir/am/xetex.am
index f12ed3b3e59..7f164eb423a 100644
--- a/Build/source/texk/web2c/xetexdir/am/xetex.am
+++ b/Build/source/texk/web2c/xetexdir/am/xetex.am
@@ -116,6 +116,7 @@ xetex_ch_srcs = \
tracingstacklevels.ch \
partoken-102.ch \
partoken.ch \
+ showstream.ch \
$(xetex_ch_synctex) \
xetexdir/xetex.ch \
$(xetex_post_ch_synctex) \