Skip to content
Snippets Groups Projects
Commit 83ee213a authored by Luigi Scarso's avatar Luigi Scarso
Browse files

Partial porting of source/texk/web2c/locnull-optimize.ch and...

Partial porting of source/texk/web2c/locnull-optimize.ch and source/texk/web2c/unbalanced-braces.ch patches from TeXLive (work in progress)
parent 26086515
No related branches found
No related tags found
No related merge requests found
#ifndef luatex_svn_revision_h
#define luatex_svn_revision_h
#define luatex_svn_revision 7608
#define luatex_svn_revision 7609
#endif
......@@ -1112,7 +1112,16 @@ void fire_up(halfword c)
void resume_after_output(void)
{
if ((iloc != null) || ((token_type != output_text) && (token_type != backed_up))) {
/* $Id: unbalanced-braces.ch 70173 2024-02-26 15:53:56Z karl $*/
/* Fix overrun/underrun of \write and \output. David Fuchs, 2024.*/
/* Original line :*/
/*if ((iloc != null) || ((token_type != output_text) && (token_type != backed_up))) {*/
/*tex output-ending brace may have been backed-up */
while ((istate == token_list) && (iloc == null) && (token_type == backed_up)) {
end_token_list();
}
if ((istate != token_list) || (iloc != null) || (token_type !=output_text)){
/*tex Recover from an unbalanced output routine */
print_err("Unbalanced output routine");
help2(
......@@ -1125,12 +1134,12 @@ void resume_after_output(void)
get_token();
} while (iloc != null);
}
/*tex Conserve stack space in case more outputs are triggered. */
end_token_list();
end_graf(bottom_level);
unsave();
output_active = false;
insert_penalties = 0;
/*tex Conserve stack space in case more outputs are triggered. */
end_token_list();
/*tex Ensure that box |output_box| is empty after output. */
if (box(output_box_par) != null) {
print_err("Output routine didn't use all of \\box");
......
......@@ -920,7 +920,17 @@ void macro_call(void)
to itself will not require unbounded stack space.
*/
while ((istate == token_list) && (iloc == null) && (token_type != v_template)) {
/* In strict order: */
/* first:
/* % $Id: locnull-optimize.ch 70150 2024-02-25 17:08:15Z karl $ */
/* % (public domain) */
/* second:
/* % $Id: unbalanced-braces.ch 70173 2024-02-26 15:53:56Z karl $ */
/* % Fix overrun/underrun of \write and \output. David Fuchs, 2024. */
/* Original line: */
/*while ((istate == token_list) && (iloc == null) && (token_type != v_template)) {*/
while ((iloc == null) && (token_type != v_template) && (token_type != output_text)) {
/*tex Conserve stack space. */
end_token_list();
}
......
......@@ -567,7 +567,11 @@ void end_token_list(void)
decr(param_ptr);
flush_list(param_stack[param_ptr]);
}
}
/*% $Id: unbalanced-braces.ch 70173 2024-02-26 15:53:56Z karl $*/
/* Catch extra left braces in \output right when finished scanning it.*/
} else if( (token_type == output_text) && output_active) {
fatal_error("Unbalanced output routine");
}
}
} else if (token_type == u_template) {
if (align_state > 500000)
......@@ -595,7 +599,16 @@ void back_input(void)
{
/*tex A token list of length one: */
halfword p;
while ((istate == token_list) && (iloc == null) && (token_type != v_template)) {
/* In strict order: */
/* first:
/* % $Id: locnull-optimize.ch 70150 2024-02-25 17:08:15Z karl $ */
/* % (public domain) */
/* second:
/* % $Id: unbalanced-braces.ch 70173 2024-02-26 15:53:56Z karl $ */
/* % Fix overrun/underrun of \write and \output. David Fuchs, 2024. */
/* Original line: */
/* while ((istate == token_list) && (iloc == null) && (token_type != v_template)) {*/
while ((iloc == null) && (token_type != v_template) && (token_type != output_text)) {
/*tex Conserve stack space. */
end_token_list();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment