pdftex[872] branches/stable/source/src/texk/web2c: sync from tl
commits+karl at tug.org
commits+karl at tug.org
Sun Nov 7 23:57:43 CET 2021
Revision: 872
http://tug.org/svn/pdftex?view=revision&revision=872
Author: karl
Date: 2021-11-07 23:57:43 +0100 (Sun, 07 Nov 2021)
Log Message:
-----------
sync from tl 60992, new \showstream primitive from Marcel
Modified Paths:
--------------
branches/stable/source/src/texk/web2c/ChangeLog
branches/stable/source/src/texk/web2c/Makefile.in
branches/stable/source/src/texk/web2c/NEWS
branches/stable/source/src/texk/web2c/enctexdir/enctex-pdftex.ch
branches/stable/source/src/texk/web2c/pdftexdir/am/pdftex.am
Added Paths:
-----------
branches/stable/source/src/texk/web2c/showstream.ch
Modified: branches/stable/source/src/texk/web2c/ChangeLog
===================================================================
--- branches/stable/source/src/texk/web2c/ChangeLog 2021-11-07 00:31:53 UTC (rev 871)
+++ branches/stable/source/src/texk/web2c/ChangeLog 2021-11-07 22:57:43 UTC (rev 872)
@@ -1,3 +1,22 @@
+2021-11-07 Marcel Kr\"uger <tex at 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 at freefriends.org>
* am/texmf.am (install-mf-links) [WIN32]: install via libtool,
Modified: branches/stable/source/src/texk/web2c/Makefile.in
===================================================================
--- branches/stable/source/src/texk/web2c/Makefile.in 2021-11-07 00:31:53 UTC (rev 871)
+++ branches/stable/source/src/texk/web2c/Makefile.in 2021-11-07 22:57:43 UTC (rev 872)
@@ -4434,6 +4434,7 @@
tex.ch \
tracingstacklevels.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
etexdir/tex.ech
@@ -4546,6 +4547,7 @@
tex.ch \
tracingstacklevels.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
etexdir/tex.ech
@@ -4665,6 +4667,7 @@
tracingstacklevels.ch \
partoken-102.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
enctexdir/enctex1.ch \
enctexdir/enctex-pdftex.ch \
@@ -5359,6 +5362,7 @@
tracingstacklevels.ch \
partoken-102.ch \
partoken.ch \
+ showstream.ch \
$(xetex_ch_synctex) \
xetexdir/xetex.ch \
$(xetex_post_ch_synctex) \
Modified: branches/stable/source/src/texk/web2c/NEWS
===================================================================
--- branches/stable/source/src/texk/web2c/NEWS 2021-11-07 00:31:53 UTC (rev 871)
+++ branches/stable/source/src/texk/web2c/NEWS 2021-11-07 22:57:43 UTC (rev 872)
@@ -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.
Modified: branches/stable/source/src/texk/web2c/enctexdir/enctex-pdftex.ch
===================================================================
--- branches/stable/source/src/texk/web2c/enctexdir/enctex-pdftex.ch 2021-11-07 00:31:53 UTC (rev 871)
+++ branches/stable/source/src/texk/web2c/enctexdir/enctex-pdftex.ch 2021-11-07 22:57:43 UTC (rev 872)
@@ -1,16 +1,16 @@
-% $Id: enctex-pdftex.ch 60054 2021-07-25 16:07:35Z karl $
+% $Id: enctex-pdftex.ch 60992 2021-11-07 22:51:07Z karl $
% 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
- at d web2c_int_pars=web2c_int_base+5 {total number of web2c's integer parameters}
+ at d web2c_int_pars=web2c_int_base+6 {total number of web2c's integer parameters}
@y
- at d mubyte_in_code=web2c_int_base+5{if positive then reading mubytes is active}
- at d mubyte_out_code=web2c_int_base+6{if positive then printing mubytes is active}
- at d mubyte_log_code=web2c_int_base+7{if positive then print mubytes to log and terminal}
- at d spec_out_code=web2c_int_base+8 {if positive then print specials by mubytes}
- at d web2c_int_pars=web2c_int_base+9 {total number of web2c's integer parameters}
+ at d mubyte_in_code=web2c_int_base+6{if positive then reading mubytes is active}
+ at d mubyte_out_code=web2c_int_base+7{if positive then printing mubytes is active}
+ at d mubyte_log_code=web2c_int_base+8{if positive then print mubytes to log and terminal}
+ at d spec_out_code=web2c_int_base+9 {if positive then print specials by mubytes}
+ at d web2c_int_pars=web2c_int_base+10 {total number of web2c's integer parameters}
@z
Modified: branches/stable/source/src/texk/web2c/pdftexdir/am/pdftex.am
===================================================================
--- branches/stable/source/src/texk/web2c/pdftexdir/am/pdftex.am 2021-11-07 00:31:53 UTC (rev 871)
+++ branches/stable/source/src/texk/web2c/pdftexdir/am/pdftex.am 2021-11-07 22:57:43 UTC (rev 872)
@@ -1,4 +1,4 @@
-## $Id: pdftex.am 60054 2021-07-25 16:07:35Z karl $
+## $Id: pdftex.am 60992 2021-11-07 22:51:07Z karl $
## texk/web2c/pdftexdir/am/pdftex.am: Makefile fragment for pdfTeX.
##
## Copyright 2016-2021 Karl Berry <tex-live at tug.org>
@@ -73,6 +73,7 @@
tracingstacklevels.ch \
partoken-102.ch \
partoken.ch \
+ showstream.ch \
zlib-fmt.ch \
enctexdir/enctex1.ch \
enctexdir/enctex-pdftex.ch \
Added: branches/stable/source/src/texk/web2c/showstream.ch
===================================================================
--- branches/stable/source/src/texk/web2c/showstream.ch (rev 0)
+++ branches/stable/source/src/texk/web2c/showstream.ch 2021-11-07 22:57:43 UTC (rev 872)
@@ -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.
+ at 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;
+ at 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;
+ at z
+
+Add a integer parameter
+ at x
+ at d web2c_int_pars=web2c_int_base+5 {total number of web2c's integer parameters}
+@#
+ at y
+ at d show_stream_code=web2c_int_base+5 {stream to output xray commands to}
+ at d web2c_int_pars=web2c_int_base+6 {total number of web2c's integer parameters}
+@#
+ at z
+
+ at x
+ at d partoken_context==int_par(partoken_context_code)
+ at y
+ at d partoken_context==int_par(partoken_context_code)
+ at d show_stream==int_par(show_stream_code)
+ at z
+
+ at x
+partoken_context_code:print_esc("partokencontext");
+ at y
+partoken_context_code:print_esc("partokencontext");
+show_stream_code:print_esc("showstream");
+ at z
+
+ at x
+ primitive("partokencontext",assign_int,int_base+partoken_context_code);@/
+@!@:partoken_context_}{\.{\\partokencontext} primitive@>
+ at 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@>
+ at z
+
+Then assign a default value since it's not the normal 0.
+ at x Part of the integer section of @<Initialize table entries...@>=, the integer section
+del_code("."):=0; {this null delimiter is used in error recovery}
+ at y
+del_code("."):=0; {this null delimiter is used in error recovery}
+show_stream:=-1;
+ at 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|.
+ at 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
+ at 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
+ at z
+
+The ending gets skipped if we changed the selector,
+but we have to restore |selector|.
+ at 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 at 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 at 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;
+ at 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 at 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 at 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;
+ at z
Property changes on: branches/stable/source/src/texk/web2c/showstream.ch
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
More information about the pdftex-commits
mailing list.