diff options
author | Karl Berry <karl@freefriends.org> | 2021-11-07 22:51:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-11-07 22:51:07 +0000 |
commit | 13db542d785efd5e247e6ce1bb00ddcf3e6a9e0c (patch) | |
tree | e4f840ce031276f5739a43ab71b67803eada1f99 /Build/source/texk/web2c/luatexdir/tex | |
parent | 6db201ee577d919c52166a873f7f3755b4113c1f (diff) |
new cross-engine primitive \showstream, from Marcel
git-svn-id: svn://tug.org/texlive/trunk@60992 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex')
4 files changed, 23 insertions, 1 deletions
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); |