From 378030dd89abc0f2b0d9902dd343d1f2108a202f Mon Sep 17 00:00:00 2001 From: Luigi Scarso Date: Sun, 13 Oct 2019 17:09:41 +0000 Subject: sync with upstream luatex rev. 7197 git-svn-id: svn://tug.org/texlive/trunk@52360 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/texk/web2c/luatexdir/tex/commands.c | 3 ++ Build/source/texk/web2c/luatexdir/tex/commands.h | 4 +- Build/source/texk/web2c/luatexdir/tex/dumpdata.c | 2 +- Build/source/texk/web2c/luatexdir/tex/expand.c | 3 -- Build/source/texk/web2c/luatexdir/tex/inputstack.c | 7 +++- Build/source/texk/web2c/luatexdir/tex/inputstack.h | 12 +++--- .../source/texk/web2c/luatexdir/tex/maincontrol.c | 43 ++++++++++++++++++---- Build/source/texk/web2c/luatexdir/tex/printing.c | 37 ++++++++++++++++--- Build/source/texk/web2c/luatexdir/tex/printing.h | 2 + Build/source/texk/web2c/luatexdir/tex/scanning.c | 10 ++++- Build/source/texk/web2c/luatexdir/tex/texmath.c | 3 +- Build/source/texk/web2c/luatexdir/tex/textoken.c | 3 +- Build/source/texk/web2c/luatexdir/tex/textoken.h | 2 +- 13 files changed, 100 insertions(+), 31 deletions(-) (limited to 'Build/source/texk/web2c/luatexdir/tex') diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.c b/Build/source/texk/web2c/luatexdir/tex/commands.c index aceb0eb093d..f78d8bb612e 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.c +++ b/Build/source/texk/web2c/luatexdir/tex/commands.c @@ -900,6 +900,9 @@ void initialize_etex_commands(void) primitive_etex("gluestretch", last_item_cmd, glue_stretch_code, 0); primitive_etex("glueshrink", last_item_cmd, glue_shrink_code, 0); + primitive_luatex("eTeXgluestretchorder", last_item_cmd, eTeX_glue_stretch_order_code, 0); + primitive_luatex("eTeXglueshrinkorder", last_item_cmd, eTeX_glue_shrink_order_code, 0); + primitive_etex("mutoglue", last_item_cmd, mu_to_glue_code, 0); primitive_etex("gluetomu", last_item_cmd, glue_to_mu_code, 0); diff --git a/Build/source/texk/web2c/luatexdir/tex/commands.h b/Build/source/texk/web2c/luatexdir/tex/commands.h index c3a3ca30452..7d7a7056564 100644 --- a/Build/source/texk/web2c/luatexdir/tex/commands.h +++ b/Build/source/texk/web2c/luatexdir/tex/commands.h @@ -187,6 +187,7 @@ typedef enum { assign_box_dir_cmd, /* (\.{\\boxdir}) */ assign_direction_cmd, /* (\.{\\pagedirection}, \.{\\textdirection}) */ assign_dir_cmd, /* (\.{\\pagedir}, \.{\\textdir}) */ + combine_toks_cmd, # define max_internal_cmd assign_dir_cmd /* the largest code that can follow \.{\\the} */ advance_cmd, /* advance a register or parameter ( \.{\\advance} ) */ multiply_cmd, /* multiply a register or parameter ( \.{\\multiply} ) */ @@ -217,7 +218,6 @@ typedef enum { variable_cmd, feedback_cmd, the_cmd, /* expand an internal quantity ( \.{\\the} or \.{\\unexpanded}, \.{\\detokenize} ) */ - combine_toks_cmd, top_bot_mark_cmd, /* inserted mark ( \.{\\topmark}, etc.~) */ call_cmd, /* non-long, non-outer control sequence */ long_call_cmd, /* long, non-outer control sequence */ @@ -307,6 +307,8 @@ typedef enum { current_if_branch_code, /* code for \.{\\currentifbranch} */ glue_stretch_order_code, /* code for \.{\\gluestretchorder} */ glue_shrink_order_code, /* code for \.{\\glueshrinkorder} */ + eTeX_glue_stretch_order_code, /* code for \.{\\eTeXgluestretchorder} */ + eTeX_glue_shrink_order_code, /* code for \.{\\eTeXglueshrinkorder} */ font_char_wd_code, /* code for \.{\\fontcharwd} */ # define eTeX_dim font_char_wd_code /* first of \eTeX\ codes for dimensions */ font_char_ht_code, /* code for \.{\\fontcharht} */ diff --git a/Build/source/texk/web2c/luatexdir/tex/dumpdata.c b/Build/source/texk/web2c/luatexdir/tex/dumpdata.c index 0091685fb74..78835d00f6e 100644 --- a/Build/source/texk/web2c/luatexdir/tex/dumpdata.c +++ b/Build/source/texk/web2c/luatexdir/tex/dumpdata.c @@ -32,7 +32,7 @@ with LuaTeX; if not, see . */ -#define FORMAT_ID (907+48) +#define FORMAT_ID (907+51) #if ((FORMAT_ID>=0) && (FORMAT_ID<=256)) #error Wrong value for FORMAT_ID. #endif diff --git a/Build/source/texk/web2c/luatexdir/tex/expand.c b/Build/source/texk/web2c/luatexdir/tex/expand.c index a0a317db238..bdf82c8c0da 100644 --- a/Build/source/texk/web2c/luatexdir/tex/expand.c +++ b/Build/source/texk/web2c/luatexdir/tex/expand.c @@ -261,9 +261,6 @@ void expand(void) case the_cmd: ins_the_toks(); break; - case combine_toks_cmd: - combine_the_toks(cur_chr); - break; case if_test_cmd: /*tex An experiment. */ if (cur_chr == if_condition_code) { diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.c b/Build/source/texk/web2c/luatexdir/tex/inputstack.c index c64111edc89..ad67ac24820 100644 --- a/Build/source/texk/web2c/luatexdir/tex/inputstack.c +++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.c @@ -661,7 +661,7 @@ void begin_file_reading(void) check_buffer_overflow(first); incr(in_open); push_input(); - iindex = (unsigned char) in_open; + iindex = (unsigned short)(in_open); source_filename_stack[iindex] = 0; full_source_filename_stack[iindex] = NULL; eof_seen[iindex] = false; @@ -696,6 +696,11 @@ void end_file_reading(void) } else if (iname > 17) { /*tex Forget it. */ lua_a_close_in(cur_file, 0); + source_filename_stack[iindex] = 0; + if (full_source_filename_stack[iindex] != NULL) { + free(full_source_filename_stack[iindex]); + full_source_filename_stack[iindex] = NULL; + } } pop_input(); decr(in_open); diff --git a/Build/source/texk/web2c/luatexdir/tex/inputstack.h b/Build/source/texk/web2c/luatexdir/tex/inputstack.h index 8c139a8332e..0c7669ff3c8 100644 --- a/Build/source/texk/web2c/luatexdir/tex/inputstack.h +++ b/Build/source/texk/web2c/luatexdir/tex/inputstack.h @@ -32,12 +32,12 @@ typedef struct in_state_record { halfword loc_field; halfword limit_field; halfword name_field; - int synctex_tag_field; /* stack the tag of the current file */ - signed int cattable_field:16; /* category table used by the current line (see textoken.c) */ - quarterword state_field:8; - quarterword index_field:8; - boolean partial_field:8; /* is the current line partial? (see textoken.c) */ - boolean nofilter_field:8; /* used by token filtering */ + int synctex_tag_field; /* stack the tag of the current file */ + unsigned short state_field:16; + unsigned short index_field:16; + signed short cattable_field:16; /* category table used by the current line (see textoken.c) */ + boolean partial_field:8; /* is the current line partial? (see textoken.c) */ + boolean nofilter_field:8; /* used by token filtering */ } in_state_record; extern in_state_record *input_stack; diff --git a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c index ef5fb64d601..f68f9e7ad76 100644 --- a/Build/source/texk/web2c/luatexdir/tex/maincontrol.c +++ b/Build/source/texk/web2c/luatexdir/tex/maincontrol.c @@ -991,6 +991,7 @@ static void init_main_control (void) { /* any_mode(lua_expandable_call_cmd, run_lua_call); */ /* no! outside jump table anyway, handled in expand() */ any_mode(node_cmd, run_node); + any_mode(combine_toks_cmd, combine_the_toks); } /*tex @@ -1041,8 +1042,6 @@ We assume a trailing relax: |{...}\relax|, so we don't need a |back_input()| her */ -/*int local_level = 0; */ - extern void local_control_message(const char *s) { tprint("local control level "); @@ -1052,11 +1051,29 @@ extern void local_control_message(const char *s) tprint_nl(""); } +/*tex Note for me (HH): in luametatex I have the option to use the save stack which for + some experiments seems to work better. But I'll probably not go forward with + some intended extension anyway (too messy), so we're currently in sync. + Instead there are now two optional parameters in |runtoks|, plus a |quittoks| + companion. I also added some more tracing as well as a warning when we jump + out of control too often. +*/ + void local_control(void) { + /*tex Wrr to saving the state local_control is like some of the conv_toks which + is not entirely correct but good enough for now. Future extensions might + demand another solution. + */ + int save_scanner_status = scanner_status; + halfword save_def_ref = def_ref; + halfword save_warning_index = warning_index; int ll = local_level; main_control_state = goto_next; local_level += 1; + if (tracing_nesting_par > 2) { + local_control_message("entering local control"); + } while (1) { if (main_control_state == goto_skip_token) { main_control_state = goto_next; @@ -1075,22 +1092,32 @@ void local_control(void) if (local_level <= ll) { main_control_state = goto_next; if (tracing_nesting_par > 2) { - local_control_message("leaving due to level change"); + local_control_message("leaving local control due to level change"); } - return ; + break; } else if (main_control_state == goto_return) { if (tracing_nesting_par > 2) { - local_control_message("leaving due to triggering"); + local_control_message("leaving local control due to triggering"); } - return; + break; } } - return; + /*tex From the perspective of ending and changing the level this is the + wrong spot, as it should be done in |end_local_control| in which case + we should use the save stack. Maybe some day. + */ + scanner_status = save_scanner_status; + def_ref = save_def_ref; + warning_index = save_warning_index; } void end_local_control(void ) { - local_level -= 1; + if (local_level > 0) { + local_level -= 1; + } else { + local_control_message("redundant end local control"); + } } /*tex diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.c b/Build/source/texk/web2c/luatexdir/tex/printing.c index 70bf1fc4148..c85a6a5323c 100644 --- a/Build/source/texk/web2c/luatexdir/tex/printing.c +++ b/Build/source/texk/web2c/luatexdir/tex/printing.c @@ -1005,9 +1005,33 @@ void print_font_identifier(internal_font_number f) } /*tex + We could do this much nicer but then we need to also adapt short_display a + bit and we have to be as compatible as possible in the log for some macro + packages. -This prints highlights of list |p|. + The callback is also responsible for either or not reporting the character + number itself. +*/ +void print_character_info(halfword p) +{ + int callback_id = callback_defined(glyph_info_callback); + if (callback_id) { + char* str = NULL; + run_callback(callback_id, "N->R", p, &str); + if (str == NULL) { + print_qhex(character(p)); + } else { + tprint(str); + free(str); + } + } else { + print(character(p)); + } +} + +/*tex + This prints highlights of list |p|. */ void short_display(int p) @@ -1018,14 +1042,15 @@ void short_display(int p) short_display(lig_ptr(p)); } else { if (font(p) != font_in_short_display) { - if (!is_valid_font(font(p))) + if (!is_valid_font(font(p))) { print_char('*'); - else + } else { print_font_identifier(font(p)); + } print_char(' '); font_in_short_display = font(p); } - print(character(p)); + print_character_info(p); } } else { /*tex Print a short indication of the contents of node |p| */ @@ -1056,7 +1081,7 @@ void print_font_and_char(int p) else print_font_identifier(font(p)); print_char(' '); - print(character(p)); + print_character_info(p); } /*tex @@ -1154,7 +1179,7 @@ void short_display_n(int p, int m) print_char(' '); font_in_short_display = font(p); } - print(character(p)); + print_character_info(p); } } else { if ( (type(p) == glue_node) || diff --git a/Build/source/texk/web2c/luatexdir/tex/printing.h b/Build/source/texk/web2c/luatexdir/tex/printing.h index 79ca524ef6f..e54186a2710 100644 --- a/Build/source/texk/web2c/luatexdir/tex/printing.h +++ b/Build/source/texk/web2c/luatexdir/tex/printing.h @@ -127,4 +127,6 @@ extern void begin_diagnostic(void); extern void end_diagnostic(boolean blank_line); extern int global_old_setting; +extern void print_character_info(halfword p); + #endif diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.c b/Build/source/texk/web2c/luatexdir/tex/scanning.c index 8f7e1d59178..66f28a18b13 100644 --- a/Build/source/texk/web2c/luatexdir/tex/scanning.c +++ b/Build/source/texk/web2c/luatexdir/tex/scanning.c @@ -505,12 +505,18 @@ static boolean short_scan_something_internal(int cmd, int chr, int level, boolea break; case glue_stretch_order_code: case glue_shrink_order_code: + case eTeX_glue_stretch_order_code: + case eTeX_glue_shrink_order_code: scan_normal_glue(); q = cur_val; - if (m == glue_stretch_order_code) + if (m == glue_stretch_order_code || m == eTeX_glue_stretch_order_code) { cur_val = stretch_order(q); - else + } else { cur_val = shrink_order(q); + } + if (cur_val && (m == eTeX_glue_stretch_order_code || m == eTeX_glue_shrink_order_code)) { + cur_val = (cur_val == 1) ? - 1 : cur_val - 1; + } flush_node(q); break; } diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.c b/Build/source/texk/web2c/luatexdir/tex/texmath.c index 7f1f1296d33..67f352d40fc 100644 --- a/Build/source/texk/web2c/luatexdir/tex/texmath.c +++ b/Build/source/texk/web2c/luatexdir/tex/texmath.c @@ -461,6 +461,7 @@ const char *math_param_names[] = { "stackvgap", "stacknumup", "stackdenomdown", "fractionrule", "fractionnumvgap", "fractionnumup", "fractiondenomvgap", "fractiondenomdown", "fractiondelsize", + "skewedfractionhgap", "skewedfractionvgap", "limitabovevgap", "limitabovebgap", "limitabovekern", "limitbelowvgap", "limitbelowbgap", "limitbelowkern", "nolimitsubfactor", "nolimitsupfactor", /* bonus */ @@ -2621,7 +2622,7 @@ void after_math(void) } run_mlist_to_hlist(p, (mode > 0), text_style); try_couple_nodes(tail,vlink(temp_head)); - + while (vlink(tail) != null) { tail = vlink(tail); } diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.c b/Build/source/texk/web2c/luatexdir/tex/textoken.c index d6c16890649..609eae8104b 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.c +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.c @@ -2352,8 +2352,9 @@ void ins_the_toks(void) */ -void combine_the_toks(int how) +void combine_the_toks(void) { + halfword how = cur_chr; halfword source = null; halfword target = null; halfword append = (how == 0) || (how == 1) || (how == 4) || (how == 5); diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.h b/Build/source/texk/web2c/luatexdir/tex/textoken.h index 4b33b099ab3..248a12168cf 100644 --- a/Build/source/texk/web2c/luatexdir/tex/textoken.h +++ b/Build/source/texk/web2c/luatexdir/tex/textoken.h @@ -150,7 +150,7 @@ extern void get_token(void); extern halfword str_toks(lstring b); extern halfword str_scan_toks(int c, lstring b); extern void ins_the_toks(void); -extern void combine_the_toks(int how); +extern void combine_the_toks(void); extern int scan_lua_state(void); -- cgit v1.2.3