texlive[61577] \showstream fix from Marcel

commits+karl at tug.org commits+karl at tug.org
Wed Jan 12 00:13:18 CET 2022


Revision: 61577
          http://tug.org/svn/texlive?view=revision&revision=61577
Author:   karl
Date:     2022-01-12 00:13:18 +0100 (Wed, 12 Jan 2022)
Log Message:
-----------
\showstream fix from Marcel

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/ChangeLog
    trunk/Build/source/texk/web2c/showstream.ch

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

Modified: trunk/Build/source/texk/web2c/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/ChangeLog	2022-01-11 22:54:49 UTC (rev 61576)
+++ trunk/Build/source/texk/web2c/ChangeLog	2022-01-11 23:13:18 UTC (rev 61577)
@@ -1,3 +1,15 @@
+2022-01-11  Marcel Kr\"uger  <tex at 2krueger.de>
+
+	* showstream.ch: adjust selector for show_stream.
+	Bug report from Hironobu Yamashita, 8 Dec 2021:
+\newwrite\IO
+\immediate\openout\IO=io.tex
+\showstream=\IO
+\showtokens A \end
+
+This should throw an error "! Missing { inserted." but for now
+it just stops silently and if I press [Enter] it crashes.
+
 2022-01-10  Karl Berry  <karl at freefriends.org>
 
 	* tangle-sh.in,

Modified: trunk/Build/source/texk/web2c/showstream.ch
===================================================================
--- trunk/Build/source/texk/web2c/showstream.ch	2022-01-11 22:54:49 UTC (rev 61576)
+++ trunk/Build/source/texk/web2c/showstream.ch	2022-01-11 23:13:18 UTC (rev 61577)
@@ -1,3 +1,7 @@
+% $Id$
+% Implementation of |\showstream|.
+% Public domain. Originally written by Marcel Kr\"uger, 2021.
+
 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.
@@ -57,36 +61,24 @@
 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
+Then do the actual change: In all cases of |show_whatever| we adjust the selector
+if |show_stream| is set. We don't need any changes
 to |begin/end_diagnostic| since they don't do anything interesting if
 |selector| isn't |term_and_log|.
+
+For |show_lists_code| this is done directly in |show_whatever|:
 @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
+show_lists_code: begin begin_diagnostic; show_activities;
+  end;
 @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
+show_lists_code:
+  begin @<Adjust |selector| based on |show_stream|@>
+  begin_diagnostic; show_activities;
+  end;
 @z
 
 The ending gets skipped if we changed the selector,
-but we have to restore |selector|.
+but we have to reset the |selector| based on the current interaction setting.
 @x
 @<Complete a potentially long \.{\\show} command@>;
 common_ending: if interaction<error_stop_mode then
@@ -111,7 +103,8 @@
 @<Complete a potentially long \.{\\show} command@>;
 common_ending: if selector<no_print then
   begin print_ln;
-  selector:=saved_selector
+  @<Initialize the print |selector| based on |interaction|@>;
+  if log_opened then selector:=selector+2;
   end
 else begin if interaction<error_stop_mode then
     begin help0; decr(error_count);
@@ -133,3 +126,50 @@
   end;
 end;
 @z
+
+While the other cases have separate blocks
+ at x
+@ @<Show the current meaning of a token...@>=
+begin get_token;
+ at y
+@ @<Adjust |selector| based on |show_stream|@>=
+if (show_stream>=0) and (show_stream<no_print) and write_open[show_stream] then
+  selector:=show_stream;
+
+@ @<Show the current meaning of a token...@>=
+begin get_token;
+  @<Adjust |selector| based on |show_stream|@>
+ at z
+
+ at x
+@ @<Show the current contents of a box@>=
+begin scan_register_num; fetch_box(p); begin_diagnostic;
+ at y
+@ @<Show the current contents of a box@>=
+begin scan_register_num; fetch_box(p);
+@<Adjust |selector| based on |show_stream|@>
+begin_diagnostic;
+ at z
+
+ at x
+@ @<Show the current value of some parameter...@>=
+begin p:=the_toks;
+ at y
+@ @<Show the current value of some parameter...@>=
+begin p:=the_toks;
+@<Adjust |selector| based on |show_stream|@>
+ at z
+
+ at x
+show_groups: begin begin_diagnostic; show_save_groups;
+ at y
+show_groups: begin @<Adjust |selector| based on |show_stream|@>
+  begin_diagnostic; show_save_groups;
+ at z
+
+ at x
+show_ifs: begin begin_diagnostic; print_nl(""); print_ln;
+ at y
+show_ifs: begin @<Adjust |selector| based on |show_stream|@>
+  begin_diagnostic; print_nl(""); print_ln;
+ at z


Property changes on: trunk/Build/source/texk/web2c/showstream.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.