texlive[61580] Build/source/texk/web2c/luatexdir: LuaTeX \showstream
commits+lscarso at tug.org
commits+lscarso at tug.org
Wed Jan 12 12:26:00 CET 2022
Revision: 61580
http://tug.org/svn/texlive?view=revision&revision=61580
Author: lscarso
Date: 2022-01-12 12:25:59 +0100 (Wed, 12 Jan 2022)
Log Message:
-----------
LuaTeX \showstream (M.Kruger)
Modified Paths:
--------------
trunk/Build/source/texk/web2c/luatexdir/ChangeLog
trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
trunk/Build/source/texk/web2c/luatexdir/tex/commands.c
trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h
trunk/Build/source/texk/web2c/luatexdir/tex/mainbody.c
trunk/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
trunk/Build/source/texk/web2c/luatexdir/tex/printing.c
Modified: trunk/Build/source/texk/web2c/luatexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/ChangeLog 2022-01-12 00:49:17 UTC (rev 61579)
+++ trunk/Build/source/texk/web2c/luatexdir/ChangeLog 2022-01-12 11:25:59 UTC (rev 61580)
@@ -1,3 +1,6 @@
+2022-01-12 Luigi Scarso <luigi.scarso at gmail.com>
+ * fixed \showstream (M.Krüger)
+
2021-12-31 Luigi Scarso <luigi.scarso at gmail.com>
* drop (for the moment) \showstream
Modified: trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h 2022-01-12 00:49:17 UTC (rev 61579)
+++ trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h 2022-01-12 11:25:59 UTC (rev 61580)
@@ -1 +1 @@
-#define luatex_svn_revision 7474
+#define luatex_svn_revision 7478
Modified: trunk/Build/source/texk/web2c/luatexdir/tex/commands.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/commands.c 2022-01-12 00:49:17 UTC (rev 61579)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/commands.c 2022-01-12 11:25:59 UTC (rev 61580)
@@ -820,6 +820,15 @@
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
Modified: trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h 2022-01-12 00:49:17 UTC (rev 61579)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h 2022-01-12 11:25:59 UTC (rev 61580)
@@ -312,8 +312,9 @@
# define math_defaults_mode_code 119 /* > 0 : latex preferences */
# define discretionary_ligature_mode_code 120
# define partoken_context_code 121
+# define show_stream_code 122
-# define math_option_code 122
+# define math_option_code 123
# define mathoption_int_base_code (math_option_code+1) /* one reserve */
# define mathoption_int_last_code (mathoption_int_base_code+8)
@@ -818,6 +819,7 @@
#define discretionary_ligature_mode_par int_par(discretionary_ligature_mode_code)
#define partoken_context_code_par int_par(partoken_context_code)
+#define show_stream_par int_par(show_stream_code)
/* */
Modified: trunk/Build/source/texk/web2c/luatexdir/tex/mainbody.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/mainbody.c 2022-01-12 00:49:17 UTC (rev 61579)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/mainbody.c 2022-01-12 11:25:59 UTC (rev 61580)
@@ -441,6 +441,7 @@
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...
Modified: trunk/Build/source/texk/web2c/luatexdir/tex/maincontrol.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/maincontrol.c 2022-01-12 00:49:17 UTC (rev 61579)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/maincontrol.c 2022-01-12 11:25:59 UTC (rev 61580)
@@ -4055,6 +4055,8 @@
int n; /* level of \.{\\if...\\fi} nesting */
switch (cur_chr) {
case show_lists:
+ if (file_can_be_written(show_stream_par))
+ selector = show_stream_par;
begin_diagnostic();
show_activities();
break;
@@ -4061,6 +4063,8 @@
case show_box_code:
/*tex Show the current contents of a box. */
scan_register_num();
+ if (file_can_be_written(show_stream_par))
+ selector = show_stream_par;
begin_diagnostic();
tprint_nl("> \\box");
print_int(cur_val);
@@ -4073,7 +4077,9 @@
case show_code:
/*tex Show the current meaning of a token, then |goto common_ending|. */
get_token();
- if (interaction == error_stop_mode)
+ if (file_can_be_written(show_stream_par))
+ selector = show_stream_par;
+ else if (interaction == error_stop_mode)
wake_up_terminal();
tprint_nl("> ");
if (cur_cs != 0) {
@@ -4085,10 +4091,14 @@
break;
/*tex Cases for |show_whatever| */
case show_groups:
+ if (file_can_be_written(show_stream_par))
+ selector = show_stream_par;
begin_diagnostic();
show_save_groups();
break;
case show_ifs:
+ if (file_can_be_written(show_stream_par))
+ selector = show_stream_par;
begin_diagnostic();
tprint_nl("");
print_ln();
@@ -4128,7 +4138,9 @@
common_ending|.
*/
p = the_toks();
- if (interaction == error_stop_mode)
+ if (file_can_be_written(show_stream_par))
+ selector = show_stream_par;
+ else if (interaction == error_stop_mode)
wake_up_terminal();
tprint_nl("> ");
token_show(temp_token_head);
@@ -4147,6 +4159,10 @@
}
}
COMMON_ENDING:
+ if (valid_write_file(selector)) {
+ fixup_selector(log_opened_global);
+ return;
+ }
if (interaction < error_stop_mode) {
help0();
decr(error_count);
Modified: trunk/Build/source/texk/web2c/luatexdir/tex/printing.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/printing.c 2022-01-12 00:49:17 UTC (rev 61579)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/printing.c 2022-01-12 11:25:59 UTC (rev 61580)
@@ -382,7 +382,8 @@
{
if (new_string_line > 0) {
print_char(new_string_line);
- } else if (((term_offset > 0) && (odd(selector))) ||
+ } else if ((selector < no_print) ||
+ ((term_offset > 0) && (odd(selector))) ||
((file_offset > 0) && (selector >= log_only))) {
print_ln();
}
More information about the tex-live-commits
mailing list.