summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/tex
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/tex')
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/errors.c20
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/extensions.c15
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/mlist.c37
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/scanning.c4
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texmath.c2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/texnodes.h2
-rw-r--r--Build/source/texk/web2c/luatexdir/tex/textoken.c16
7 files changed, 51 insertions, 45 deletions
diff --git a/Build/source/texk/web2c/luatexdir/tex/errors.c b/Build/source/texk/web2c/luatexdir/tex/errors.c
index 0c64927cea2..0c8f564236e 100644
--- a/Build/source/texk/web2c/luatexdir/tex/errors.c
+++ b/Build/source/texk/web2c/luatexdir/tex/errors.c
@@ -441,6 +441,21 @@ void error(void)
/*tex Get user's advice and |return|. */
while (1) {
CONTINUE:
+ /*tex
+ Original reports:
+
+ https://tex.stackexchange.com/questions/551313/
+ https://tug.org/pipermail/tex-live/2020-June/045876.html
+
+ This will probably be fixed by DEK in the 2021 tuneup in a different
+ way (so we'll have to remove or alter this change), but the interaction
+ sequence in the reports above causes a segmentation fault in web2c -
+ writing to the closed \write15 stream because we wrongly decrement
+ selector from 16 to 15 in term_input, due to the lack of this check in
+ recursive error() call.
+ */
+ if (interaction !=error_stop_mode)
+ return;
clear_for_error_prompt();
prompt_input("? ");
if (last == first)
@@ -879,6 +894,8 @@ When \TeX\ wants to typeset a character that doesn't exist, the character node i
not created; thus the output routine can assume that characters exist when it
sees them. The following procedure prints a warning message unless the user has
suppressed it.
+If |tracing_lost_chars_par| (i.e. \.{\\tracinglostchar}) is greater than 2,
+it's considered as an error.
*/
@@ -915,6 +932,9 @@ void char_warning(internal_font_number f, int c)
end_diagnostic(false);
tracing_online_par = old_setting;
}
+ if (tracing_lost_chars_par > 2) {
+ error();
+ }
}
void wrapup_backend(void) {
diff --git a/Build/source/texk/web2c/luatexdir/tex/extensions.c b/Build/source/texk/web2c/luatexdir/tex/extensions.c
index d24bee13b3f..60deb747a85 100644
--- a/Build/source/texk/web2c/luatexdir/tex/extensions.c
+++ b/Build/source/texk/web2c/luatexdir/tex/extensions.c
@@ -563,8 +563,9 @@ void write_out(halfword p)
int old_setting;
/*tex write stream number */
int j;
- /*tex line to be written, as a C string */
- char *s, *ss;
+ /*tex line to be written, as a Lua string */
+ lstring *ss = NULL;
+ lstring *s = NULL;
int callback_id;
int lua_retval;
expand_macros_in_tokenlist(p);
@@ -579,21 +580,21 @@ void write_out(halfword p)
} else {
tprint_nl("");
}
- s = tokenlist_to_cstring(def_ref, false, NULL);
+ s = tokenlist_to_lstring(def_ref, false);
if (selector < no_print) {
/*tex selector is a file */
callback_id = callback_defined(process_output_buffer_callback);
if (callback_id > 0) {
/*tex fix up the output buffer using callbacks */
- lua_retval = run_callback(callback_id, "S->S", s, &ss);
+ lua_retval = run_callback(callback_id, "L->L", s, &ss);
if ((lua_retval == true) && (ss != NULL)) {
- xfree(s);
+ free_lstring(s);
s = ss;
}
}
}
- tprint(s);
- xfree(s);
+ lprint(s);
+ free_lstring(s);
print_ln();
flush_list(def_ref);
selector = old_setting;
diff --git a/Build/source/texk/web2c/luatexdir/tex/mlist.c b/Build/source/texk/web2c/luatexdir/tex/mlist.c
index 43db6adbbb2..c34dee48839 100644
--- a/Build/source/texk/web2c/luatexdir/tex/mlist.c
+++ b/Build/source/texk/web2c/luatexdir/tex/mlist.c
@@ -1248,13 +1248,6 @@ static void stack_glue_into_box(pointer b, scaled min, scaled max) {
int cur_size = 0;
-/*tex A few state variables: */
-
-halfword del_height = 0;
-halfword del_depth = 0;
-halfword del_width = 0;
-halfword del_shift = 0;
-
static pointer get_delim_box(internal_font_number fnt, halfword chr, scaled v, scaled min_overlap, int horizontal, halfword att)
{
int callback_id = callback_defined(make_extensible_callback);
@@ -1549,10 +1542,8 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat,
if (d && ! small_fam(d) && ! large_fam(d) && ! small_char(d) && ! large_char(d)) {
halfword b = new_null_box();
subtype(b) = math_v_delimiter_list;
- height(b) = del_height;
- depth(b) = del_depth;
- width(b) = del_width;
- shift_amount(b) = del_shift;
+ if (! flat)
+ width(b) = null_delimiter_space_par;
node_attr(b) = node_attr(d);
node_attr(d) = null;
flush_node(d);
@@ -1709,12 +1700,6 @@ static pointer do_delimiter(pointer q, pointer d, int s, scaled v, boolean flat,
}
DONE:
delete_attribute_ref(att);
-
- del_height = height(b);
- del_depth = depth(b);
- del_width = width(b);
- del_shift = shift_amount(b);
-
return b;
}
@@ -3003,10 +2988,7 @@ static void make_fraction(pointer q, int cur_style)
/*tex This also equals |width(z)|. */
width(v) = width(x);
reset_attributes(v, node_attr(q));
- if (thickness(q) == 0) {
- p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));
- couple_nodes(p,z);
- } else {
+ if (thickness(q) && ! fractionnorule(q)) {
y = do_fraction_rule(thickness(q), node_attr(q), math_fraction_rule, cur_size, used_fam);
p = new_kern((math_axis_size(cur_size) - delta) - (height(z) - shift_down));
reset_attributes(p, node_attr(q));
@@ -3014,6 +2996,9 @@ static void make_fraction(pointer q, int cur_style)
couple_nodes(p,z);
p = new_kern((shift_up - depth(x)) - (math_axis_size(cur_size) + delta));
couple_nodes(p,y);
+ } else {
+ p = new_kern((shift_up - depth(x)) - (height(z) - shift_down));
+ couple_nodes(p,z);
}
reset_attributes(p, node_attr(q));
couple_nodes(x,p);
@@ -3321,12 +3306,10 @@ static scaled make_op(pointer q, int cur_style)
shift_down = limit_below_bgap(cur_style) - height(z);
if (shift_down < limit_below_vgap(cur_style))
shift_down = limit_below_vgap(cur_style);
- if (shift_down > 0) {
- p = new_kern(shift_down);
- reset_attributes(p, node_attr(q));
- couple_nodes(y,p);
- couple_nodes(p,z);
- }
+ p = new_kern(shift_down);
+ reset_attributes(p, node_attr(q));
+ couple_nodes(y,p);
+ couple_nodes(p,z);
p = new_kern(limit_below_kern(cur_style));
reset_attributes(p, node_attr(q));
couple_nodes(z,p);
diff --git a/Build/source/texk/web2c/luatexdir/tex/scanning.c b/Build/source/texk/web2c/luatexdir/tex/scanning.c
index 66f28a18b13..2ecb54bc2f6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/scanning.c
+++ b/Build/source/texk/web2c/luatexdir/tex/scanning.c
@@ -536,9 +536,7 @@ static boolean short_scan_something_internal(int cmd, int chr, int level, boolea
/*tex assumes identical values */
cur_val_level = cur_chr;
}
- if ((cur_list.tail_field != contrib_head) &&
- !is_char_node(cur_list.tail_field) &&
- (cur_list.mode_field != 0)) {
+ if ((cur_list.tail_field != contrib_head) && (cur_list.mode_field != 0)) {
switch (cur_chr) {
case lastpenalty_code:
if (type(cur_list.tail_field) == penalty_node)
diff --git a/Build/source/texk/web2c/luatexdir/tex/texmath.c b/Build/source/texk/web2c/luatexdir/tex/texmath.c
index fd04e2a5c11..4d2bf80ecd6 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texmath.c
+++ b/Build/source/texk/web2c/luatexdir/tex/texmath.c
@@ -1926,6 +1926,8 @@ void math_fraction(void)
while (1) {
if (scan_keyword("exact")) {
options = options | noad_option_exact ;
+ } else if (scan_keyword("norule")) {
+ options = options | noad_option_no_rule ;
} else {
break;
}
diff --git a/Build/source/texk/web2c/luatexdir/tex/texnodes.h b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
index 848f9ea4799..121511bc098 100644
--- a/Build/source/texk/web2c/luatexdir/tex/texnodes.h
+++ b/Build/source/texk/web2c/luatexdir/tex/texnodes.h
@@ -597,6 +597,7 @@ typedef enum {
noad_option_no_sub_script = 0x21 + 0x08,
noad_option_no_super_script = 0x22 + 0x08,
noad_option_no_script = 0x23 + 0x08,
+ noad_option_no_rule = 0x24 + 0x08,
} delimiter_options ;
# define delimiteroptionset(a) ((delimiteroptions(a) & noad_option_set ) == noad_option_set )
@@ -657,6 +658,7 @@ typedef enum {
# define fractionoptionset(a) ((fractionoptions(a) & noad_option_set ) == noad_option_set )
# define fractionexact(a) ((fractionoptions(a) & noad_option_exact ) == noad_option_exact )
# define fractionnoaxis(a) ((fractionoptions(a) & noad_option_no_axis) == noad_option_no_axis)
+# define fractionnorule(a) ((fractionoptions(a) & noad_option_no_rule) == noad_option_no_rule)
/* radical noads */
/* this is like a fraction, but it only stores a |left_delimiter| */
diff --git a/Build/source/texk/web2c/luatexdir/tex/textoken.c b/Build/source/texk/web2c/luatexdir/tex/textoken.c
index a59e650df42..e28626bbd26 100644
--- a/Build/source/texk/web2c/luatexdir/tex/textoken.c
+++ b/Build/source/texk/web2c/luatexdir/tex/textoken.c
@@ -2352,6 +2352,8 @@ void ins_the_toks(void)
*/
+# define immediate_permitted(n,target) ((eq_level(toks_base + n) == cur_level) && (token_ref_count(target) == 0))
+
void combine_the_toks(void)
{
halfword how = cur_chr;
@@ -2395,7 +2397,7 @@ void combine_the_toks(void)
token_link(source) = null;
} else if (append) {
/*tex Append. */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
p = t;
while (token_link(p) != null) {
p = token_link(p);
@@ -2405,13 +2407,12 @@ void combine_the_toks(void)
s = token_link(s);
}
} else {
- token_ref_count(target)--;
append_copied_toks_list(t,s);
set_toks_register(nt,temp_token_head,global);
}
} else {
/* prepend */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
h = null;
p = null ;
while (s != null) {
@@ -2424,7 +2425,6 @@ void combine_the_toks(void)
set_token_link(p,t);
set_token_link(target,h);
} else {
- token_ref_count(target)--;
append_copied_toks_list(s,t);
set_toks_register(nt,temp_token_head,global);
}
@@ -2455,7 +2455,7 @@ void combine_the_toks(void)
t = token_link(target);
if (append) {
/*tex Append. */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
p = t;
while (token_link(p) != null) {
p = token_link(p);
@@ -2465,13 +2465,12 @@ void combine_the_toks(void)
s = token_link(s);
}
} else {
- token_ref_count(target)--;
append_copied_toks_list(t,s);
set_toks_register(nt,temp_token_head,global);
}
} else {
/*tex Prepend. */
- if (token_ref_count(target) == 0) {
+ if (immediate_permitted(nt,target)) {
h = null;
p = null;
while (s != null) {
@@ -2484,7 +2483,6 @@ void combine_the_toks(void)
set_token_link(p,t);
set_token_link(target,h);
} else {
- token_ref_count(target)--;
append_copied_toks_list(s,t);
set_toks_register(nt,temp_token_head,global);
}
@@ -2873,6 +2871,8 @@ void conv_toks(void)
warning_index = save_warning_index;
scanner_status = save_scanner_status;
ins_list(token_link(def_ref));
+ token_link(def_ref) = null;
+ free_avail(def_ref);
def_ref = save_def_ref;
restore_cur_string(u);
/*tex No further action. */