diff options
author | Hans Hagen <pragma@wxs.nl> | 2022-12-22 23:12:04 +0100 |
---|---|---|
committer | Context Git Mirror Bot <phg@phi-gamma.net> | 2022-12-22 23:12:04 +0100 |
commit | 32ca60de005df4b45e8904ab63e0e03978331c6f (patch) | |
tree | 3d09a8b53adc9f5384cfebafb02d9dfcec674792 | |
parent | 36355f3d0c23357fccf2c76b3e9605a41cae519d (diff) | |
download | context-32ca60de005df4b45e8904ab63e0e03978331c6f.tar.gz |
2022-12-22 22:16:00
30 files changed, 352 insertions, 385 deletions
diff --git a/doc/context/sources/general/manuals/luametatex/luametatex-libraries.tex b/doc/context/sources/general/manuals/luametatex/luametatex-libraries.tex index 086dc18a2..298a5d054 100644 --- a/doc/context/sources/general/manuals/luametatex/luametatex-libraries.tex +++ b/doc/context/sources/general/manuals/luametatex/luametatex-libraries.tex @@ -254,7 +254,7 @@ There is a bunch of functions that take a complex number: These are accompanied by \type {libcerf} functions: -\starttabulate[|Tw(12em)|T|T|] +\starttabulate[|Tw(12em)|T|Tpl|] \DB name \BC arguments \BC results \NC \NR \TB \NC erf \NC (a) \NC The complex error function erf(z) \NC \NR diff --git a/source/luametatex/source/luametatex.h b/source/luametatex/source/luametatex.h index c92599fbc..b46922a11 100644 --- a/source/luametatex/source/luametatex.h +++ b/source/luametatex/source/luametatex.h @@ -89,7 +89,7 @@ # define luametatex_version 210 # define luametatex_revision 04 # define luametatex_version_string "2.10.04" -# define luametatex_development_id 20221221 +# define luametatex_development_id 20221222 # define luametatex_name_camelcase "LuaMetaTeX" # define luametatex_name_lowercase "luametatex" diff --git a/source/luametatex/source/tex/texequivalents.c b/source/luametatex/source/tex/texequivalents.c index d91663dd3..827f68a77 100644 --- a/source/luametatex/source/tex/texequivalents.c +++ b/source/luametatex/source/tex/texequivalents.c @@ -507,6 +507,12 @@ static int tex_aux_save_value(int id) return i ? saved_value(i) : 0; } +static int tex_aux_save_level(int id) +{ + int i = tex_aux_found_save_type(id); + return i ? saved_level(i) : 0; +} + static int tex_aux_saved_box_spec(halfword *packing, halfword *amount) { int i = tex_aux_found_save_type(box_spec_save_type); @@ -675,43 +681,47 @@ void tex_show_save_groups(void) tex_confusion("show groups"); break; } - /*tex Show the box context */ - { - int i = tex_aux_save_value(saved_full_spec_item_context);; - if (i) { - if (i < box_flag) { - /* this is pretty horrible and likely wrong */ - singleword cmd = (abs(lmt_nest_state.nest[pointer].mode) == vmode) ? hmove_cmd : vmove_cmd; - tex_print_cmd_chr(cmd, (i > 0) ? move_forward_code : move_backward_code); - tex_print_dimension(abs(i), pt_unit); - } else if (i <= max_global_box_flag) { - if (i >= global_box_flag) { - tex_print_str_esc("global"); - i -= (global_box_flag - box_flag); + /*tex + Show the box context. In traditional \TEX\ the shift is encoded in the context which is + why it had such a large offset for the other context value. That somewhat dirty trick + was has stepwise been removed. + */ + switch (tex_aux_save_value(saved_full_spec_item_context)) { + case direct_box_flag: + { + scaled shift = tex_aux_save_value(saved_full_spec_item_shift); + if (shift != null_flag) { + /*tex We passed the safeguard. */ + singleword cmd = (abs(lmt_nest_state.nest[pointer].mode) == vmode) ? hmove_cmd : vmove_cmd; + tex_print_cmd_chr(cmd, (shift > 0) ? move_forward_code : move_backward_code); + tex_print_dimension(abs(shift), pt_unit); } + } + break; + case global_box_flag: + tex_print_str_esc("global"); + case box_flag: + { tex_print_str_esc("setbox"); - tex_print_int(i - box_flag); + tex_print_int(tex_aux_save_level(saved_full_spec_item_context)); tex_print_char('='); - } else { - switch (i) { - case a_leaders_flag: - tex_print_cmd_chr(leader_cmd, a_leaders); - break; - case c_leaders_flag: - tex_print_cmd_chr(leader_cmd, c_leaders); - break; - case x_leaders_flag: - tex_print_cmd_chr(leader_cmd, x_leaders); - break; - case g_leaders_flag: - tex_print_cmd_chr(leader_cmd, g_leaders); - break; - case u_leaders_flag: - tex_print_cmd_chr(leader_cmd, u_leaders); - break; - } } - } + break; + case a_leaders_flag: + tex_print_cmd_chr(leader_cmd, a_leaders); + break; + case c_leaders_flag: + tex_print_cmd_chr(leader_cmd, c_leaders); + break; + case x_leaders_flag: + tex_print_cmd_chr(leader_cmd, x_leaders); + break; + case g_leaders_flag: + tex_print_cmd_chr(leader_cmd, g_leaders); + break; + case u_leaders_flag: + tex_print_cmd_chr(leader_cmd, u_leaders); + break; } FOUND1: { diff --git a/source/luametatex/source/tex/texequivalents.h b/source/luametatex/source/tex/texequivalents.h index 511463c6a..82e500fb3 100644 --- a/source/luametatex/source/tex/texequivalents.h +++ b/source/luametatex/source/tex/texequivalents.h @@ -1788,8 +1788,8 @@ extern halfword tex_explicit_disc_penalty (halfword mode); # define update_tex_tab_skip_local(v) tex_eq_define(internal_glue_location(tab_skip_code), internal_glue_reference_cmd, v); # define update_tex_tab_skip_global(v) tex_geq_define(internal_glue_location(tab_skip_code), internal_glue_reference_cmd, v); -# define update_tex_box_local(n,v) tex_eq_define(register_box_location(n) - box_flag, register_box_reference_cmd, v); -# define update_tex_box_global(n,v) tex_geq_define(register_box_location(n) - global_box_flag, register_box_reference_cmd, v); +# define update_tex_box_local(n,v) tex_eq_define(register_box_location(n), register_box_reference_cmd, v); +# define update_tex_box_global(n,v) tex_geq_define(register_box_location(n), register_box_reference_cmd, v); # define update_tex_insert_mode(a,v) tex_word_define(a, internal_int_location(insert_mode_code), v) diff --git a/source/luametatex/source/tex/texmaincontrol.c b/source/luametatex/source/tex/texmaincontrol.c index aa160968e..62b6d1e1e 100644 --- a/source/luametatex/source/tex/texmaincontrol.c +++ b/source/luametatex/source/tex/texmaincontrol.c @@ -662,7 +662,7 @@ static void tex_aux_run_end_group(void) { */ -static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) +static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift, halfword slot) { /*tex Get the next non-blank non-relax... and optionally skip an equal sign */ while (1) { @@ -680,7 +680,7 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) switch (cur_cmd) { case make_box_cmd: { - tex_begin_box(boxcontext, shift); + tex_begin_box(boxcontext, shift, slot); return; } case vcenter_cmd: @@ -705,7 +705,7 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) case vlist_node: case rule_node: case glyph_node: - tex_box_end(boxcontext, boxnode, shift, unset_noad_class); + tex_box_end(boxcontext, boxnode, shift, unset_noad_class, slot); return; } } @@ -720,7 +720,7 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) halfword v = tex_scan_lua_value(cur_chr); switch (v) { case no_val_level: - tex_box_end(boxcontext, null, shift, unset_noad_class); + tex_box_end(boxcontext, null, shift, unset_noad_class, slot); return; case list_val_level: if (box_leaders_flag(boxcontext)) { @@ -729,14 +729,14 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) case vlist_node: case rule_node: // case glyph_node: - tex_box_end(boxcontext, cur_val, shift, unset_noad_class); + tex_box_end(boxcontext, cur_val, shift, unset_noad_class, slot); return; } } else { switch (node_type(cur_val)) { case hlist_node: case vlist_node: - tex_box_end(boxcontext, cur_val, shift, unset_noad_class); + tex_box_end(boxcontext, cur_val, shift, unset_noad_class, slot); return; } } @@ -749,7 +749,7 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) { if (box_leaders_flag(boxcontext)) { halfword rulenode = tex_aux_scan_rule_spec(cur_cmd == hrule_cmd ? h_rule_type : (cur_cmd == vrule_cmd ? v_rule_type : m_rule_type), cur_chr); - tex_box_end(boxcontext, rulenode, shift, unset_noad_class); + tex_box_end(boxcontext, rulenode, shift, unset_noad_class, slot); return; } else { break; @@ -762,7 +762,7 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) halfword boxnode = null; tex_aux_run_text_char_number(); boxnode = tex_pop_tail(); - tex_box_end(boxcontext, boxnode, shift, unset_noad_class); + tex_box_end(boxcontext, boxnode, shift, unset_noad_class, slot); return; } else { break; @@ -776,8 +776,8 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) "that. So you might find something missing in your output. But keep trying; you\n" "can fix this later." ); - if (boxcontext == lua_scan_flag) { - tex_box_end(boxcontext, null, shift, unset_noad_class); + if (boxcontext == lua_scan_flag) { /* hm */ + tex_box_end(boxcontext, null, shift, unset_noad_class, slot); } } @@ -791,7 +791,7 @@ static void tex_aux_scan_box(int boxcontext, int optional_equal, scaled shift) static void tex_aux_run_move(void) { int code = cur_chr; halfword val = tex_scan_dimen(0, 0, 0, 0, NULL); - tex_aux_scan_box(0, 0, code == move_forward_code ? val : - val); + tex_aux_scan_box(direct_box_flag, 0, code == move_forward_code ? val : - val, -1); } /*tex @@ -903,13 +903,13 @@ static int leader_flags[] = { }; static void tex_aux_run_leader(void) { - tex_aux_scan_box(leader_flags[cur_chr], 0, null_flag); + tex_aux_scan_box(leader_flags[cur_chr], 0, null_flag, -1); } static void tex_aux_run_legacy(void) { switch (cur_chr) { case shipout_code: - tex_aux_scan_box(shipout_flag, 0, null_flag); + tex_aux_scan_box(shipout_flag, 0, null_flag, -1); break; default: /* cant_happen */ @@ -922,7 +922,7 @@ static void tex_aux_run_local_box(void) { } static void tex_aux_run_make_box(void) { - tex_begin_box(0, null_flag); + tex_begin_box(direct_box_flag, null_flag, -1); } /*tex @@ -1465,7 +1465,7 @@ static void tex_aux_invalid_catcode_table_error(void) { tex_handle_error( normal_error_type, "Invalid \\catcode table", - "All \\catcode table ids must be between 0 and " LMT_TOSTRING(max_n_of_catcode_tables-1) + "All \\catcode table ids must be between 0 and " LMT_TOSTRING(max_n_of_catcode_tables - 1) ); } @@ -1890,7 +1890,7 @@ halfword tex_local_scan_box(void) int old_mode = cur_list.mode; int old_level = lmt_main_control_state.local_level; cur_list.mode = -hmode; - tex_aux_scan_box(lua_scan_flag, 0, null_flag); + tex_aux_scan_box(lua_scan_flag, 0, null_flag, -1); if (lmt_main_control_state.local_level == old_level) { /*tex |\directlua{print(token.scan_list())}\hbox{!}| (n n) */ if (tracing_nesting_par > 2) { @@ -2726,125 +2726,122 @@ static void tex_aux_wrapup_leader_box(halfword boxcontext, halfword boxnode) } } -void tex_box_end(int boxcontext, halfword boxnode, scaled shift, halfword mainclass) +void tex_box_end(int boxcontext, halfword boxnode, scaled shift, halfword mainclass, halfword slot) { cur_box = boxnode; - if (boxcontext < box_flag) { - /*tex - - Append box |boxnode| to the current list, shifted by |boxcontext|. The global variable - |adjust_tail| will be non-null if and only if the current box might include adjustments - that should be appended to the current vertical list. - - Having shift in the box context is kind of strange but as long as we stay below maxdimen - it works. + switch (boxcontext) { + case direct_box_flag: + /*tex - We now pass the shift directly, so no boxcontext trick here. + Append box |boxnode| to the current list, shifted by |boxcontext|. The global variable + |adjust_tail| will be non-null if and only if the current box might include adjustments + that should be appended to the current vertical list. - */ + Having shift in the box context is kind of strange but as long as we stay below maxdimen + it works. We now pass the shift directly, so no boxcontext trick here. - if (boxnode) { - // box_shift_amount(boxnode) = boxcontext; - if (shift != null_flag) { - box_shift_amount(boxnode) = shift; - } - switch (cur_mode) { - case vmode: - if (lmt_packaging_state.pre_adjust_tail) { - if (pre_adjust_head != lmt_packaging_state.pre_adjust_tail) { - tex_inject_adjust_list(pre_adjust_head, 1, boxnode, NULL); + */ + if (boxnode) { + if (shift != null_flag) { + box_shift_amount(boxnode) = shift; + } + switch (cur_mode) { + case vmode: + if (lmt_packaging_state.pre_adjust_tail) { + if (pre_adjust_head != lmt_packaging_state.pre_adjust_tail) { + tex_inject_adjust_list(pre_adjust_head, 1, boxnode, NULL); + } + lmt_packaging_state.pre_adjust_tail = null; } - lmt_packaging_state.pre_adjust_tail = null; - } - if (lmt_packaging_state.pre_migrate_tail) { - if (pre_migrate_head != lmt_packaging_state.pre_migrate_tail) { - tex_append_list(pre_migrate_head, lmt_packaging_state.pre_migrate_tail); + if (lmt_packaging_state.pre_migrate_tail) { + if (pre_migrate_head != lmt_packaging_state.pre_migrate_tail) { + tex_append_list(pre_migrate_head, lmt_packaging_state.pre_migrate_tail); + } + lmt_packaging_state.pre_migrate_tail = null; } - lmt_packaging_state.pre_migrate_tail = null; - } - tex_append_to_vlist(boxnode, lua_key_index(box), NULL); - if (lmt_packaging_state.post_migrate_tail) { - if (post_migrate_head != lmt_packaging_state.post_migrate_tail) { - tex_append_list(post_migrate_head, lmt_packaging_state.post_migrate_tail); + tex_append_to_vlist(boxnode, lua_key_index(box), NULL); + if (lmt_packaging_state.post_migrate_tail) { + if (post_migrate_head != lmt_packaging_state.post_migrate_tail) { + tex_append_list(post_migrate_head, lmt_packaging_state.post_migrate_tail); + } + lmt_packaging_state.post_migrate_tail = null; } - lmt_packaging_state.post_migrate_tail = null; - } - if (lmt_packaging_state.post_adjust_tail) { - if (post_adjust_head != lmt_packaging_state.post_adjust_tail) { - tex_inject_adjust_list(post_adjust_head, 1, null, NULL); + if (lmt_packaging_state.post_adjust_tail) { + if (post_adjust_head != lmt_packaging_state.post_adjust_tail) { + tex_inject_adjust_list(post_adjust_head, 1, null, NULL); + } + lmt_packaging_state.post_adjust_tail = null; } - lmt_packaging_state.post_adjust_tail = null; - } - if (cur_list.mode > nomode) { - if (! lmt_page_builder_state.output_active) { - lmt_page_filter_callback(box_page_context, 0); + if (cur_list.mode > nomode) { + if (! lmt_page_builder_state.output_active) { + lmt_page_filter_callback(box_page_context, 0); + } + tex_build_page(); } - tex_build_page(); - } - break; - case hmode: - cur_list.space_factor = default_space_factor; - tex_couple_nodes(cur_list.tail, boxnode); - cur_list.tail = boxnode; - break; - /* case mmode: */ - default: - boxnode = tex_new_sub_box(boxnode); - tex_couple_nodes(cur_list.tail, boxnode); - cur_list.tail = boxnode; - if (mainclass != unset_noad_class) { - set_noad_classes(boxnode, mainclass); - } - break; + break; + case hmode: + cur_list.space_factor = default_space_factor; + tex_couple_nodes(cur_list.tail, boxnode); + cur_list.tail = boxnode; + break; + /* case mmode: */ + default: + boxnode = tex_new_sub_box(boxnode); + tex_couple_nodes(cur_list.tail, boxnode); + cur_list.tail = boxnode; + if (mainclass != unset_noad_class) { + set_noad_classes(boxnode, mainclass); + } + break; + } + } else { + /* just scanning */ } - } else { - /* just scanning */ - } - } else if (boxcontext < global_box_flag) { - /*tex Store |box| in a local box register */ - update_tex_box_local(boxcontext, boxnode); - } else if (boxcontext <= max_global_box_flag) { - /*tex Store |box| in a global box register */ - update_tex_box_global(boxcontext, boxnode); - } else { - switch (boxcontext) { - case shipout_flag: - /*tex This normally can't happen as some backend code needs to kick in. */ - if (boxnode) { - /*tex We just show the box ... */ - tex_begin_diagnostic(); - tex_show_node_list(boxnode, max_integer, max_integer); - tex_end_diagnostic(); - /*tex ... and wipe it when it's a register ... */ - if (box_register(boxnode)) { - tex_flush_node_list(boxnode); - box_register(boxnode) = null; - } - /*tex ... so there is at least an indication that we flushed. */ + break; + case box_flag: + /*tex Store |box| in a local box register */ + update_tex_box_local(slot, boxnode); + break; + case global_box_flag: + /*tex Store |box| in a global box register */ + update_tex_box_global(slot, boxnode); + break; + case shipout_flag: + /*tex This normally can't happen as some backend code needs to kick in. */ + if (boxnode) { + /*tex We just show the box ... */ + tex_begin_diagnostic(); + tex_show_node_list(boxnode, max_integer, max_integer); + tex_end_diagnostic(); + /*tex ... and wipe it when it's a register ... */ + if (box_register(boxnode)) { + tex_flush_node_list(boxnode); + box_register(boxnode) = null; } - break; - case left_box_flag: - case right_box_flag: - case middle_box_flag: - /*tex Actualy, this cannot happen ... will go away. */ - tex_aux_finish_local_box(); - break; - case lua_scan_flag: - /*tex We are done with scanning so let's return to the caller. */ - tex_aux_wrapup_local_scan_box(); - cur_box = boxnode; - break; - case a_leaders_flag: - case c_leaders_flag: - case x_leaders_flag: - case g_leaders_flag: - case u_leaders_flag: - tex_aux_wrapup_leader_box(boxcontext, boxnode); - break; - default: - /* fatal error */ - break; - } + /*tex ... so there is at least an indication that we flushed. */ + } + break; + case left_box_flag: + case right_box_flag: + case middle_box_flag: + /*tex Actualy, this cannot happen ... will go away. */ + tex_aux_finish_local_box(); + break; + case lua_scan_flag: + /*tex We are done with scanning so let's return to the caller. */ + tex_aux_wrapup_local_scan_box(); + cur_box = boxnode; + break; + case a_leaders_flag: + case c_leaders_flag: + case x_leaders_flag: + case g_leaders_flag: + case u_leaders_flag: + tex_aux_wrapup_leader_box(boxcontext, boxnode); + break; + default: + /* fatal error */ + break; } } @@ -2858,76 +2855,6 @@ void tex_box_end(int boxcontext, halfword boxnode, scaled shift, halfword maincl */ -// void tex_begin_paragraph(int doindent, int context) -// { -// halfword q; -// int indented = doindent; -// int isvmode = cur_list.mode == vmode; -// if (isvmode || cur_list.head != cur_list.tail) { -// /*tex -// Actually we could remove the callback and hook it into the |\everybeforepar| but that one -// started out as a |tex.expandmacro| itself and we don't want the callback overhead every -// time, so now we have both. However, in the end I decided to do this one {\em before} the -// parskip is injected. -// */ -// if (every_before_par_par) { -// tex_begin_inserted_list(tex_get_available_token(token_val(end_local_cmd, 0))); -// tex_begin_token_list(every_before_par_par, every_before_par_text); -// if (tracing_nesting_par > 2) { -// tex_local_control_message("entering local control via \\everybeforepar"); -// } -// tex_local_control(1); -// } -// // if (type(cur_list.tail) == glue_node && subtype(cur_list.tail) == par_skip_glue) { -// // /* ignore */ -// // } else { -// tex_tail_append(tex_new_param_glue_node(par_skip_code, par_skip_glue)); -// // } -// } -// lmt_begin_paragraph_callback(isvmode, &indented, context); -// /*tex We'd better not messed up things in the callback! */ -// cur_list.prev_graf = 0; -// tex_push_nest(); -// cur_list.mode = hmode; -// cur_list.space_factor = default_space_factor; -// /*tex Add local paragraph node */ -// tex_tail_append(tex_new_par_node(vmode_par_par_subtype)); -// // if (end_of_par_par) { -// // update_tex_end_of_par(null); /* option */ -// // } -// q = cur_list.tail; -// /*tex We will move this to after the dir nodes have been dealt with. */ -// tex_aux_insert_parindent(indented); -// /*tex Dir nodes end up before the indent box. */ -// { -// halfword dir_rover = lmt_dir_state.text_dir_ptr; -// while (dir_rover) { -// if ((node_next(dir_rover)) || (dir_direction(dir_rover) != par_direction_par)) { -// halfword dir_graf_tmp = tex_new_dir(normal_dir_subtype, dir_direction(dir_rover)); -// tex_try_couple_nodes(dir_graf_tmp, node_next(q)); -// tex_couple_nodes(q, dir_graf_tmp); -// } -// dir_rover = node_next(dir_rover); -// } -// } -// /*tex We might need to go to the last injected dir and/or indent node. */ -// while (node_next(q)) { -// q = node_next(q); -// } -// cur_list.tail = q; -// /*tex The |\everypar| tokens are injected after dir nodes have been added. */ -// if (every_par_par) { -// tex_begin_token_list(every_par_par, every_par_text); -// } -// if (lmt_nest_state.nest_data.ptr == 1) { -// if (! lmt_page_builder_state.output_active) { -// lmt_page_filter_callback(begin_paragraph_page_context, 0); -// } -// /*tex put |par_skip| glue on current page */ -// tex_build_page(); -// } -// } - void tex_tail_prepend(halfword n) { tex_couple_nodes(node_prev(cur_list.tail), n); @@ -3048,7 +2975,7 @@ static void tex_aux_run_kern(void) { halfword code = cur_chr; switch (code) { - /* not yet enabled and maybe it never wil be */ + /* not yet enabled and maybe it never will be */ case h_kern_code: if (cur_mode == vmode) { tex_back_input(token_val(kern_cmd, normal_kern_code)); @@ -4227,9 +4154,9 @@ static void tex_aux_set_box_property(void) static void tex_aux_set_box(int a) { - halfword n = tex_scan_box_register_number() + (is_global(a) ? global_box_flag : box_flag); + halfword slot = tex_scan_box_register_number(); if (lmt_error_state.set_box_allowed) { - tex_aux_scan_box(n, 1, null_flag); + tex_aux_scan_box(is_global(a) ? global_box_flag : box_flag, 1, null_flag, slot); } else { tex_handle_error( normal_error_type, @@ -5492,32 +5419,22 @@ static int tex_aux_set_some_item(halfword a) static void tex_aux_set_constant_register(halfword cmd, halfword cs, halfword flags) { + halfword v = null; switch(cmd) { case integer_cmd: - { - halfword v = tex_scan_int(1, NULL); - tex_define(flags, cs, integer_cmd, v); - } + v = tex_scan_int(1, NULL); break; case dimension_cmd: - { - scaled v = tex_scan_dimen(0, 0, 0, 1, NULL); - tex_define(flags, cs, dimension_cmd, v); - } + v = tex_scan_dimen(0, 0, 0, 1, NULL); break; case gluespec_cmd: - { - halfword v = tex_scan_glue(glue_val_level, 1); - tex_define(flags, cs, gluespec_cmd, v); - } + v = tex_scan_glue(glue_val_level, 1); break; case mugluespec_cmd: - { - halfword v = tex_scan_glue(mu_val_level, 1); - tex_define(flags, cs, mugluespec_cmd, v); - } + v = tex_scan_glue(mu_val_level, 1); break; } + tex_define(flags, cs, cmd, v); } void tex_run_prefixed_command(void) diff --git a/source/luametatex/source/tex/texmaincontrol.h b/source/luametatex/source/tex/texmaincontrol.h index b71aaedac..5b72a3d43 100644 --- a/source/luametatex/source/tex/texmaincontrol.h +++ b/source/luametatex/source/tex/texmaincontrol.h @@ -52,7 +52,7 @@ extern void tex_you_cant_error (const char *helpinfo); extern void tex_off_save (void); extern halfword tex_local_scan_box (void); -extern void tex_box_end (int boxcontext, halfword boxnode, scaled shift, halfword mainclass); +extern void tex_box_end (int boxcontext, halfword boxnode, scaled shift, halfword mainclass, halfword slot); extern void tex_get_r_token (void); diff --git a/source/luametatex/source/tex/texmath.c b/source/luametatex/source/tex/texmath.c index ffc73cd12..ec30de1ca 100644 --- a/source/luametatex/source/tex/texmath.c +++ b/source/luametatex/source/tex/texmath.c @@ -2458,53 +2458,70 @@ halfword tex_math_make_disc(halfword d) void tex_run_math_modifier(void) { halfword tail = cur_list.tail; - if (cur_list.head != tail && node_type(tail) == simple_noad) { // maybe all - switch (cur_chr) { - case adapt_to_left_modifier_code: - noad_options(tail) = unset_option(noad_options(tail), noad_option_adapt_to_right_size); - noad_options(tail) |= noad_option_adapt_to_left_size; - break; - case adapt_to_right_modifier_code: - noad_options(tail) = unset_option(noad_options(tail), noad_option_adapt_to_left_size); - noad_options(tail) |= noad_option_adapt_to_right_size; - break; - /* todo: actually this one can also be used for other types */ - case axis_modifier_code: - noad_options(tail) |= noad_option_axis; - break; - case no_axis_modifier_code: - noad_options(tail) |= noad_option_no_axis; - break; - case phantom_modifier_code: - noad_options(tail) |= noad_option_phantom; - break; - case void_modifier_code: - noad_options(tail) |= noad_option_void; - break; - case source_modifier_code: - if (tex_scan_keyword("nucleus")) { - noad_options(tail) |= noad_option_source_on_nucleus; + if (cur_list.head != tail) { + switch (node_type(tail)) { + case simple_noad: + switch (cur_chr) { + case adapt_to_left_modifier_code: + noad_options(tail) = unset_option(noad_options(tail), noad_option_adapt_to_right_size); + noad_options(tail) |= noad_option_adapt_to_left_size; + break; + case adapt_to_right_modifier_code: + noad_options(tail) = unset_option(noad_options(tail), noad_option_adapt_to_left_size); + noad_options(tail) |= noad_option_adapt_to_right_size; + break; + /* todo: actually this one can also be used for other types */ + case axis_modifier_code: + noad_options(tail) |= noad_option_axis; + break; + case no_axis_modifier_code: + noad_options(tail) |= noad_option_no_axis; + break; + case phantom_modifier_code: + noad_options(tail) |= noad_option_phantom; + break; + case void_modifier_code: + noad_options(tail) |= noad_option_void; + break; + case source_modifier_code: + if (tex_scan_keyword("nucleus")) { + noad_options(tail) |= noad_option_source_on_nucleus; + } + noad_source(tail) = tex_scan_int(0, NULL); + break; + case openup_height_modifier_code: + noad_options(tail) |= noad_option_openup_height; + noad_height(tail) = tex_scan_dimen(0, 0, 0, 0, NULL); + break; + case openup_depth_modifier_code: + noad_options(tail) |= noad_option_openup_depth; + noad_depth(tail) = tex_scan_dimen(0, 0, 0, 0, NULL); + break; + case display_limits_modifier_code: + noad_options(tail) = unset_option(noad_options(tail), noad_option_limits | noad_option_no_limits); + break; + case limits_modifier_code: + noad_options(tail) = unset_option(noad_options(tail), noad_option_no_limits); + noad_options(tail) |= noad_option_limits; + break; + case no_limits_modifier_code: + noad_options(tail) = unset_option(noad_options(tail), noad_option_limits); + noad_options(tail) |= noad_option_no_limits; + break; + } + default: + switch (node_type(tail)) { + case accent_noad: + switch (cur_chr) { + case source_modifier_code: + if (tex_scan_keyword("nucleus")) { + noad_options(tail) |= noad_option_source_on_nucleus; + } + noad_source(tail) = tex_scan_int(0, NULL); + break; + } + } - noad_source(tail) = tex_scan_int(0, NULL); - break; - case openup_height_modifier_code: - noad_options(tail) |= noad_option_openup_height; - noad_height(tail) = tex_scan_dimen(0, 0, 0, 0, NULL); - break; - case openup_depth_modifier_code: - noad_options(tail) |= noad_option_openup_depth; - noad_depth(tail) = tex_scan_dimen(0, 0, 0, 0, NULL); - break; - case display_limits_modifier_code: - noad_options(tail) = unset_option(noad_options(tail), noad_option_limits | noad_option_no_limits); - break; - case limits_modifier_code: - noad_options(tail) = unset_option(noad_options(tail), noad_option_no_limits); - noad_options(tail) |= noad_option_limits; - break; - case no_limits_modifier_code: - noad_options(tail) = unset_option(noad_options(tail), noad_option_limits); - noad_options(tail) |= noad_option_no_limits; break; } } diff --git a/source/luametatex/source/tex/texpackaging.c b/source/luametatex/source/tex/texpackaging.c index 9b7ff31bf..49a18497c 100644 --- a/source/luametatex/source/tex/texpackaging.c +++ b/source/luametatex/source/tex/texpackaging.c @@ -65,7 +65,7 @@ */ -static void tex_aux_scan_full_spec(quarterword c, quarterword spec_direction, int just_pack, scaled shift) +static void tex_aux_scan_full_spec(halfword context, quarterword c, quarterword spec_direction, int just_pack, scaled shift, halfword slot) { quarterword spec_code = packing_additional; int spec_amount = 0; @@ -85,7 +85,6 @@ static void tex_aux_scan_full_spec(quarterword c, quarterword spec_direction, in halfword state = 0; halfword retain = 0; halfword mainclass = unset_noad_class; - int context = saved_value(saved_full_spec_item_context); int brace = 0; while (1) { /*tex Maybe |migrate <int>| makes sense here. */ @@ -300,7 +299,7 @@ static void tex_aux_scan_full_spec(quarterword c, quarterword spec_direction, in /*tex Now we're referenced. We need to preserve this over the group. */ add_attribute_reference(attrlist); /* */ - tex_set_saved_record(saved_full_spec_item_context, box_context_save_type, 0, context); + tex_set_saved_record(saved_full_spec_item_context, box_context_save_type, slot, context); /* slot fits in a quarterword */ /*tex Traditionally these two are packed into one record: */ tex_set_saved_record(saved_full_spec_item_packaging, box_spec_save_type, spec_code, spec_amount); /*tex Adjust |text_dir_ptr| for |scan_spec|: */ @@ -2320,7 +2319,7 @@ halfword tex_filtered_vpack(halfword p, scaled h, int m, scaled maxdepth, int gr void tex_run_vcenter(void) { - tex_aux_scan_full_spec(vcenter_group, direction_l2r, 0, 0); + tex_aux_scan_full_spec(direct_box_flag, vcenter_group, direction_l2r, 0, 0, -1); tex_normal_paragraph(vcenter_par_context); tex_push_nest(); cur_list.mode = -vmode; @@ -2398,13 +2397,14 @@ static scaled tex_aux_first_height(halfword boxnode) void tex_package(singleword nature) { - halfword context, spec, dirptr, attrlist, justpack, orientation, anchor, geometry, source, target, axis, mainclass, state, retain; + halfword slot, context, spec, dirptr, attrlist, justpack, orientation, anchor, geometry, source, target, axis, mainclass, state, retain; scaled shift; int grp = cur_group; scaled maxdepth = box_max_depth_par; halfword boxnode = null; /*tex Aka |cur_box|. */ tex_unsave(); lmt_save_state.save_stack_data.ptr -= saved_full_spec_n_of_items; + slot = saved_level(saved_full_spec_item_context); context = saved_value(saved_full_spec_item_context); spec = saved_value(saved_full_spec_item_packaging); dirptr = saved_value(saved_full_spec_item_direction); @@ -2536,7 +2536,7 @@ void tex_package(singleword nature) box_axis(boxnode) = (singleword) axis; box_package_state(boxnode) |= (singleword) state; tex_pop_nest(); - tex_box_end(context, boxnode, shift, mainclass); + tex_box_end(context, boxnode, shift, mainclass, slot); } void tex_run_unpackage(void) @@ -2786,7 +2786,7 @@ void tex_run_unpackage(void) */ -inline static halfword tex_aux_depth_correction(halfword b, const line_break_properties *properties) +static halfword tex_aux_depth_correction(halfword b, const line_break_properties *properties) { /*tex The deficiency of space between baselines: */ halfword p; @@ -3227,7 +3227,7 @@ halfword tex_vsplit(halfword n, scaled h, int m) */ -void tex_begin_box(int boxcontext, scaled shift) +void tex_begin_box(int boxcontext, scaled shift, halfword slot) { halfword code = cur_chr; halfword boxnode = null; /*tex Aka |cur_box|. */ @@ -3392,7 +3392,6 @@ void tex_begin_box(int boxcontext, scaled shift) break; } mode = code - vtop_code; - tex_set_saved_record(saved_full_spec_item_context, box_context_save_type, 0, boxcontext); switch (abs(cur_list.mode)) { case vmode: spec_direction = dir_lefttoright; @@ -3405,16 +3404,16 @@ void tex_begin_box(int boxcontext, scaled shift) break; } if (mode == hmode) { - if ((boxcontext < box_flag) && (abs(cur_list.mode) == vmode)) { - tex_aux_scan_full_spec(adjusted_hbox_group, spec_direction, just_pack, shift); + if ((boxcontext == direct_box_flag) && (abs(cur_list.mode) == vmode)) { + tex_aux_scan_full_spec(boxcontext, adjusted_hbox_group, spec_direction, just_pack, shift, slot); } else { - tex_aux_scan_full_spec(hbox_group, spec_direction, just_pack, shift); + tex_aux_scan_full_spec(boxcontext, hbox_group, spec_direction, just_pack, shift, slot); } } else { if (mode == vmode) { - tex_aux_scan_full_spec(vbox_group, spec_direction, just_pack, shift); + tex_aux_scan_full_spec(boxcontext, vbox_group, spec_direction, just_pack, shift, slot); } else { - tex_aux_scan_full_spec((code == dbox_code || code == dpack_code) ? dbox_group : vtop_group, spec_direction, just_pack, shift); + tex_aux_scan_full_spec(boxcontext, (code == dbox_code || code == dpack_code) ? dbox_group : vtop_group, spec_direction, just_pack, shift, slot); mode = vmode; } tex_normal_paragraph(vmode_par_context); @@ -3437,5 +3436,5 @@ void tex_begin_box(int boxcontext, scaled shift) } } /*tex In simple cases, we use the box immediately. */ - tex_box_end(boxcontext, boxnode, shift, unset_noad_class); + tex_box_end(boxcontext, boxnode, shift, unset_noad_class, slot); } diff --git a/source/luametatex/source/tex/texpackaging.h b/source/luametatex/source/tex/texpackaging.h index 5fd4bf9e4..0e3c0a471 100644 --- a/source/luametatex/source/tex/texpackaging.h +++ b/source/luametatex/source/tex/texpackaging.h @@ -179,29 +179,37 @@ extern void tex_run_vcenter (void); |box_code|, |copy_code|, |last_box_code|, |vsplit_code|, |vtop_code|, |vtop_code + vmode|, and |vtop_code + hmode|, where the latter two are used denote |\vbox| and |\hbox|, respectively. + Originally the shift was encoded in the box context in case of a move. In fact even the local + and global register assignments were in that property but this is no longer the case. This + actually makes implementing a |\boxspecdef| cleaner (a discarded experiment). The intermediate + cleasned up flags can be found in the history. + */ # define biggest_reg 65535 /*tex This could be in |textypes.h|. */ typedef enum box_flags { - box_flag = 010000000000, /*tex context code for |\setbox0| (< maxdimen) */ - global_box_flag = 010000000000 + biggest_reg, /*tex context code for |\global\setbox0| */ - max_global_box_flag = 010000000000 + 2 * biggest_reg, - left_box_flag = 010000000000 + 2 * biggest_reg + 1, /*tex context code for |\localleftbox| (not used) */ - right_box_flag = 010000000000 + 2 * biggest_reg + 2, /*tex context code for |\localrightbox| (not used) */ - middle_box_flag = 010000000000 + 2 * biggest_reg + 3, /*tex context code for |\localrightbox| (not used) */ - shipout_flag = 010000000000 + 2 * biggest_reg + 4, /*tex context code for |\shipout| */ - lua_scan_flag = 010000000000 + 2 * biggest_reg + 5, /*tex context code for |scan_list| */ - a_leaders_flag = 010000000000 + 2 * biggest_reg + 6, /*tex context code for |\leaders| */ - c_leaders_flag = 010000000000 + 2 * biggest_reg + 7, /*tex context code for |\cleaders| */ - x_leaders_flag = 010000000000 + 2 * biggest_reg + 8, /*tex context code for |\xleaders| */ - g_leaders_flag = 010000000000 + 2 * biggest_reg + 9, /*tex context code for |\gleaders| */ - u_leaders_flag = 010000000000 + 2 * biggest_reg + 10, /*tex context code for |\uleaders| */ + direct_box_flag = 0x00, + /* moved_box_flag = 0x01, */ + /* vcenter_box_flag = 0x02, */ + box_flag = 0x02, /*tex context code for |\setbox0| */ + global_box_flag = 0x03, /*tex context code for |\global\setbox0| */ + left_box_flag = 0x04, /*tex context code for |\localleftbox| */ + right_box_flag = 0x05, /*tex context code for |\localrightbox| */ + middle_box_flag = 0x06, /*tex context code for |\localrightbox| */ + shipout_flag = 0x07, /*tex context code for |\shipout| */ + lua_scan_flag = 0x08, /*tex context code for |scan_list| */ + a_leaders_flag = 0x09, /*tex context code for |\leaders| */ + c_leaders_flag = 0x0A, /*tex context code for |\cleaders| */ + x_leaders_flag = 0x0B, /*tex context code for |\xleaders| */ + g_leaders_flag = 0x0C, /*tex context code for |\gleaders| */ + u_leaders_flag = 0x0D, /*tex context code for |\uleaders| */ + } box_flags; # define box_leaders_flag(f) (f >= a_leaders_flag && f <= u_leaders_flag) -extern void tex_begin_box (int boxcontext, scaled shift); +extern void tex_begin_box (int boxcontext, scaled shift, halfword slot); extern int tex_ignore_math_skip (halfword p); # endif diff --git a/source/luametatex/source/tex/textypes.h b/source/luametatex/source/tex/textypes.h index 0fa80dd99..12a0aadf9 100644 --- a/source/luametatex/source/tex/textypes.h +++ b/source/luametatex/source/tex/textypes.h @@ -170,7 +170,8 @@ extern halfword tex_badness( # define semi_tight_criterium 12 /* same as |decent_criterium| */ # define default_rule 26214 /*tex 0.4pt */ -# define ignore_depth -65536000 /*tex The magic dimension value to mean \quote {ignore me}. */ +# define ignore_depth -65536000 /*tex The magic dimension value to mean \quote {ignore me}: -1000pt */ +# define ignore_depth_zero_baselineskip -131072000 /*tex Idem but keep zero skip: -2000pt */ # define min_quarterword 0 /*tex The smallest allowable value in a |quarterword|. */ # define max_quarterword 65535 /*tex The largest allowable value in a |quarterword|. */ diff --git a/tex/context/base/mkii/cont-new.mkii b/tex/context/base/mkii/cont-new.mkii index f1976200c..3809814e6 100644 --- a/tex/context/base/mkii/cont-new.mkii +++ b/tex/context/base/mkii/cont-new.mkii @@ -11,7 +11,7 @@ %C therefore copyrighted by \PRAGMA. See mreadme.pdf for %C details. -\newcontextversion{2022.12.21 17:10} +\newcontextversion{2022.12.22 22:14} %D This file is loaded at runtime, thereby providing an %D excellent place for hacks, patches, extensions and new diff --git a/tex/context/base/mkii/context.mkii b/tex/context/base/mkii/context.mkii index 503abc26c..73d2ecbc6 100644 --- a/tex/context/base/mkii/context.mkii +++ b/tex/context/base/mkii/context.mkii @@ -20,7 +20,7 @@ %D your styles an modules. \edef\contextformat {\jobname} -\edef\contextversion{2022.12.21 17:10} +\edef\contextversion{2022.12.22 22:14} %D For those who want to use this: diff --git a/tex/context/base/mkii/mult-pe.mkii b/tex/context/base/mkii/mult-pe.mkii index 08a2cbb62..8968b2083 100644 --- a/tex/context/base/mkii/mult-pe.mkii +++ b/tex/context/base/mkii/mult-pe.mkii @@ -93,7 +93,6 @@ \setinterfacevariable{author}{author} \setinterfacevariable{auto}{خودکار} \setinterfacevariable{autointro}{پیشگفتارخودکار} -\setinterfacevariable{autopunctuation}{autopunctuation} \setinterfacevariable{back}{پشت} \setinterfacevariable{background}{پسزمینه} \setinterfacevariable{backmatter}{پسمطلب} @@ -592,6 +591,7 @@ \setinterfacevariable{temporary}{موقتی} \setinterfacevariable{test}{تست} \setinterfacevariable{text}{متن} +\setinterfacevariable{textdisplay}{textdisplay} \setinterfacevariable{textnote}{textnote} \setinterfacevariable{three}{سه} \setinterfacevariable{thursday}{پنجشنبه} @@ -677,9 +677,13 @@ \setinterfaceconstant{authoretaltext}{authoretaltext} \setinterfaceconstant{auto}{خودکار} \setinterfaceconstant{autocase}{autocase} +\setinterfaceconstant{autofencing}{autofencing} \setinterfaceconstant{autofile}{پروندهخودکار} \setinterfaceconstant{autofocus}{تمرکزخودکار} \setinterfaceconstant{autohang}{آویزانخودکار} +\setinterfaceconstant{autonumbers}{autonumbers} +\setinterfaceconstant{autopunctuation}{autopunctuation} +\setinterfaceconstant{autospacing}{autospacing} \setinterfaceconstant{autostrut}{بستخودکار} \setinterfaceconstant{autowidth}{عرضخودکار} \setinterfaceconstant{availableheight}{availableheight} diff --git a/tex/context/base/mkiv/cont-new.mkiv b/tex/context/base/mkiv/cont-new.mkiv index e8c7f0e07..b863f8982 100644 --- a/tex/context/base/mkiv/cont-new.mkiv +++ b/tex/context/base/mkiv/cont-new.mkiv @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.12.21 17:10} +\newcontextversion{2022.12.22 22:14} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkiv/context.mkiv b/tex/context/base/mkiv/context.mkiv index 6d7353656..5186fe98b 100644 --- a/tex/context/base/mkiv/context.mkiv +++ b/tex/context/base/mkiv/context.mkiv @@ -49,7 +49,7 @@ %D {YYYY.MM.DD HH:MM} format. \edef\contextformat {\jobname} -\edef\contextversion{2022.12.21 17:10} +\edef\contextversion{2022.12.22 22:14} %D Kind of special: diff --git a/tex/context/base/mkiv/status-files.pdf b/tex/context/base/mkiv/status-files.pdf Binary files differindex fe10b5bff..f172a1695 100644 --- a/tex/context/base/mkiv/status-files.pdf +++ b/tex/context/base/mkiv/status-files.pdf diff --git a/tex/context/base/mkiv/status-lua.pdf b/tex/context/base/mkiv/status-lua.pdf Binary files differindex bd12d076b..11e841468 100644 --- a/tex/context/base/mkiv/status-lua.pdf +++ b/tex/context/base/mkiv/status-lua.pdf diff --git a/tex/context/base/mkxl/chem-str.mkxl b/tex/context/base/mkxl/chem-str.mkxl index a4cf376c3..6c9d346b6 100644 --- a/tex/context/base/mkxl/chem-str.mkxl +++ b/tex/context/base/mkxl/chem-str.mkxl @@ -268,17 +268,17 @@ \to \everystructurechemical \def\chem_add_texts - {\setbox2\hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_mid_text}\hss}% - \setbox4\hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_top_text}\hss}% - \setbox6\hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_bot_text}\hss}% + {\setbox\scratchboxone \hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_mid_text}\hss}% + \setbox\scratchboxtwo \hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_top_text}\hss}% + \setbox\scratchboxthree\hpack to \d_chem_width{\strut\hss\hbox{\strut\m_chem_bot_text}\hss}% \setbox\b_chem_result\hpack \bgroup \box\b_chem_result \hskip-\d_chem_width - \raise\d_chem_height\hpack{\lower\ht4\box4}% + \raise\d_chem_height\hpack{\lower\ht\scratchboxtwo\box\scratchboxtwo}% \hskip-\d_chem_width - \lower.5\dimexpr\ht2-\dp2\relax\box2% + \lower.5\dimexpr\ht\scratchboxone-\dp\scratchboxone\relax\box\scratchboxone \hskip-\d_chem_width - \lower\d_chem_depth \hpack{\raise\dp6\box6}% + \lower\d_chem_depth\hpack{\raise\dp\scratchboxthree\box\scratchboxthree}% \hss \egroup} % text on top of chemicals diff --git a/tex/context/base/mkxl/cont-new.mkxl b/tex/context/base/mkxl/cont-new.mkxl index 38e7f7b70..ed5b54767 100644 --- a/tex/context/base/mkxl/cont-new.mkxl +++ b/tex/context/base/mkxl/cont-new.mkxl @@ -13,7 +13,7 @@ % \normalend % uncomment this to get the real base runtime -\newcontextversion{2022.12.21 17:10} +\newcontextversion{2022.12.22 22:14} %D This file is loaded at runtime, thereby providing an excellent place for hacks, %D patches, extensions and new features. There can be local overloads in cont-loc diff --git a/tex/context/base/mkxl/context.mkxl b/tex/context/base/mkxl/context.mkxl index 897cf8bf7..77660ad15 100644 --- a/tex/context/base/mkxl/context.mkxl +++ b/tex/context/base/mkxl/context.mkxl @@ -29,7 +29,7 @@ %D {YYYY.MM.DD HH:MM} format. \immutable\edef\contextformat {\jobname} -\immutable\edef\contextversion{2022.12.21 17:10} +\immutable\edef\contextversion{2022.12.22 22:14} %overloadmode 1 % check frozen / warning %overloadmode 2 % check frozen / error diff --git a/tex/context/base/mkxl/font-ots.lmt b/tex/context/base/mkxl/font-ots.lmt index 73c9b7c56..e7fcfc576 100644 --- a/tex/context/base/mkxl/font-ots.lmt +++ b/tex/context/base/mkxl/font-ots.lmt @@ -292,9 +292,9 @@ local marks = false local classes = false local currentfont = false local currentdynamic = false -local currentscale = 1000 -local currentxscale = 1000 -local currentyscale = 1000 +local currentscale = 1000 +local currentxscale = 1000 +local currentyscale = 1000 local factor = 0 local threshold = 0 local checkmarks = false @@ -2351,6 +2351,7 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) if keepdisc then keepdisc = false if notmatchpost[current] ~= notmatchreplace[current] then +-- print(notmatchpost[current],notmatchreplace[current]) backtrackdisc = current end -- we assume a simple text only replace (we could use nuts.count) @@ -2435,7 +2436,9 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(lookaheaddisc,cf,post,new) end start = getprev(lookaheaddisc) +if done then -- new 2022-12-22 : discretionary-001.tex useddisc = lookaheaddisc -- new 2022-09-25 +end sweephead[cf] = getnext(clast) or false sweephead[new] = getnext(cl) or false elseif backtrackdisc then @@ -2496,7 +2499,9 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) setdisc(backtrackdisc,pre,post,replace) end start = getprev(backtrackdisc) +if done then -- new 2022-12-22 : discretionary-001.tex useddisc = backtrackdisc -- new 2022-09-25 +end sweephead[post] = getnext(clast) or false sweephead[replace] = getnext(last) or false else @@ -2508,10 +2513,11 @@ local function chaindisk(head,start,dataset,sequence,rlmode,skiphash,ck) end end +-- test case ? if useddisc and start ~= usedstart then -- make this option per font -- new 2022-09-25 start = getnext(start) -- new 2022-09-25 end -- new 2022-09-25 - return head, start, done, useddisc -- new 2022-09-25 + return head, start, done, useddisc -- new 2022-09-25 end local chaintrac do @@ -3038,7 +3044,7 @@ handlers.gpos_context = handle_contextchain -- end -- new 2022-09-25 - + local function chained_contextchain(head,start,stop,dataset,sequence,currentlookup,rlmode,skiphash) local steps = currentlookup.steps local nofsteps = currentlookup.nofsteps diff --git a/tex/context/base/mkxl/pack-rul.mkxl b/tex/context/base/mkxl/pack-rul.mkxl index 26b62d8b1..9bb7ddd8d 100644 --- a/tex/context/base/mkxl/pack-rul.mkxl +++ b/tex/context/base/mkxl/pack-rul.mkxl @@ -2694,7 +2694,7 @@ \tolerant\protected\def\pack_framed_text_start[#1]#*[#2]#*[#3]% or #1#*[#2]#*[#3]% and pass {#1} {\bgroup - \edef\currentframedtext{#1} + \edef\currentframedtext{#1}% \doifelseassignment{#2} {\pack_framed_text_start_indeed\empty{#2}} {\pack_framed_text_start_indeed{#2}{#3}}} diff --git a/tex/context/base/mkxl/publ-ini.mkxl b/tex/context/base/mkxl/publ-ini.mkxl index 15da8ada5..e64104305 100644 --- a/tex/context/base/mkxl/publ-ini.mkxl +++ b/tex/context/base/mkxl/publ-ini.mkxl @@ -906,7 +906,7 @@ \clf_btxfetchlistentries{\currentbtxdataset}% \egroup \d_publ_number_width\wd\scratchbox - \letlistparameter\c!width\d_publ_number_width + \letlistparameter\c!width\d_publ_number_width % no need for _reference here, frozen \fi \fi \doifelse{\listparameter\c!prefix}\v!yes\settrue\setfalse\c_publ_prefixed diff --git a/tex/context/base/mkxl/scrn-bar.mklx b/tex/context/base/mkxl/scrn-bar.mklx index 155a3b716..5fbd47d6c 100644 --- a/tex/context/base/mkxl/scrn-bar.mklx +++ b/tex/context/base/mkxl/scrn-bar.mklx @@ -167,9 +167,6 @@ \def\scrn_bar_goto#action% {\button{\symbol[#action]}[#action]\hss} -% todo: this will be \letblackruleparameter\c!width\scratchdimenone (faster) -% todo: make these setups - \def\scrn_bar_alternative_a {\d_scrn_bar_width \interactionbarparameter\c!width \d_scrn_bar_distance\interactionbarparameter\c!distance diff --git a/tex/context/base/mkxl/strc-itm.mklx b/tex/context/base/mkxl/strc-itm.mklx index fd07208c6..7c3f0af8a 100644 --- a/tex/context/base/mkxl/strc-itm.mklx +++ b/tex/context/base/mkxl/strc-itm.mklx @@ -216,8 +216,8 @@ \newdimension \d_strc_itemgroups_list_width \newdimension \d_strc_itemgroups_asked_width -\newdimension \d_strc_itemgroups_max_width % multipass -\newinteger \c_strc_itemgroups_max_items % multipass +\newdimension \d_strc_itemgroups_max_width \def\d_strc_itemgroups_max_width_reference{\d_strc_itemgroups_max_width} +\newinteger \c_strc_itemgroups_max_items \newinteger \c_strc_itemgroups_n_of_items \newinteger \c_strc_itemgroups_nesting @@ -960,7 +960,7 @@ \fi \ifconditional\c_strc_itemgroups_fitting \ifdim\d_strc_itemgroups_max_width>\zeropoint - \letitemgroupparameter\c!width\d_strc_itemgroups_max_width + \letitemgroupparameter\c!width\d_strc_itemgroups_max_width_reference \fi \fi \strc_itemgroups_calculate_list_width\c_strc_itemgroups_nesting diff --git a/tex/context/base/mkxl/tabl-frm.mkxl b/tex/context/base/mkxl/tabl-frm.mkxl index 7f9189c61..e19ea34fe 100644 --- a/tex/context/base/mkxl/tabl-frm.mkxl +++ b/tex/context/base/mkxl/tabl-frm.mkxl @@ -23,7 +23,7 @@ \newinteger \c_tabl_framed_c \newinteger \c_tabl_framed_r -\newdimension\d_tabl_framed_h +\newdimension\d_tabl_framed_h \def\d_tabl_framed_h_reference{\d_tabl_framed_h}% \newdimension\d_tabl_framed_d \newdimension\b_tabl_framed @@ -221,7 +221,7 @@ \resetframedparameter\c!background \letframedparameter\c!frame\v!off \or - \letframedparameter\c!height\d_tabl_framed_h + \letframedparameter\c!height\d_tabl_framed_h_reference \fi \pack_framed_start_framed_whatever} diff --git a/tex/context/base/mkxl/tabl-ntb.mkxl b/tex/context/base/mkxl/tabl-ntb.mkxl index 147cb30f5..049dff58c 100644 --- a/tex/context/base/mkxl/tabl-ntb.mkxl +++ b/tex/context/base/mkxl/tabl-ntb.mkxl @@ -160,7 +160,7 @@ \newinteger \c_tabl_ntb_current_row_four \newinteger \c_tabl_ntb_current_col_four -\newinteger \c_tabl_ntb_running_col +\newinteger \c_tabl_ntb_running_col \def\c_tabl_ntb_running_col_reference{\c_tabl_ntb_running_col} \newinteger \c_tabl_ntb_maximum_row \newinteger \c_tabl_ntb_maximum_col \newinteger \c_tabl_ntb_maximum_row_span @@ -758,11 +758,11 @@ \fi[#1]} \def\tabl_ntb_td_yes[#1]#2\eTD - {\letnaturaltableparameter \c!ny \m_tabl_ntb_default_nr - \letnaturaltableparameter \c!nx \m_tabl_ntb_default_nc - \letnaturaltableparameter \c!nc \plusone - \letnaturaltableparameter \c!nr \plusone - \letnaturaltableparameter \c!n \c_tabl_ntb_running_col + {\letnaturaltableparameter \c!ny\m_tabl_ntb_default_nr + \letnaturaltableparameter \c!nx\m_tabl_ntb_default_nc + \letnaturaltableparameter \c!nc\plusone + \letnaturaltableparameter \c!nr\plusone + \letnaturaltableparameter \c!n \c_tabl_ntb_running_col_reference \resetnaturaltableparameter\c!m \resetnaturaltableparameter\c!action% not that important \setupcurrentnaturaltable[#1]% diff --git a/tex/context/base/mkxl/tabl-xtb.mklx b/tex/context/base/mkxl/tabl-xtb.mklx index 57685bbcd..84755cc1c 100644 --- a/tex/context/base/mkxl/tabl-xtb.mklx +++ b/tex/context/base/mkxl/tabl-xtb.mklx @@ -15,6 +15,26 @@ \writestatus{loading}{ConTeXt Table Macros / Xtreme} +\unprotect + +\newdimension\d_tabl_x_width \def\d_tabl_x_width_reference {\d_tabl_x_width } +\newdimension\d_tabl_x_height \def\d_tabl_x_height_reference{\d_tabl_x_height} +\newdimension\d_tabl_x_depth % not used +\newdimension\d_tabl_x_distance +\newdimension\d_tabl_x_final_width \def\d_tabl_x_final_width_reference{\d_tabl_x_final_width} +\newinteger \c_tabl_x_nx +\newinteger \c_tabl_x_ny +\newinteger \c_tabl_x_mode +\newbox \b_tabl_x +\newinteger \c_tabl_x_state % 0=empty 1=content 3=splitleft +\newinteger \c_tabl_x_nesting +\newinteger \c_tabl_x_skip_mode % 1 = skip +\newdimension\d_tabl_x_textwidth +\newinteger \c_tabl_x_swapped +\newinteger \c_tabl_x_swapped_max + +\protect + \registerctxluafile{tabl-xtb}{autosuffix} % todo: @@ -82,22 +102,6 @@ {\signalcharacter}% not used \to \everyenableelements -\newdimension\d_tabl_x_width -\newdimension\d_tabl_x_height -\newdimension\d_tabl_x_depth % not used -\newdimension\d_tabl_x_distance -\newinteger \c_tabl_x_nx -\newinteger \c_tabl_x_ny -\newinteger \c_tabl_x_mode -\newbox \b_tabl_x -\newinteger \c_tabl_x_state % 0=empty 1=content 3=splitleft -\newdimension\d_tabl_x_final_width -\newinteger \c_tabl_x_nesting -\newinteger \c_tabl_x_skip_mode % 1 = skip -\newdimension\d_tabl_x_textwidth -\newinteger \c_tabl_x_swapped -\newinteger \c_tabl_x_swapped_max - \lettonothing\m_tabl_x_swapped_settings \aliased\let\currentxtablerow \clf_x_table_r @@ -436,7 +440,7 @@ \d_split_minimum_free_space\dimexpr\extraxtablesplitheight+\xtableparameter\c!splitoffset\relax %\c_split_minimum_free_lines\plustwo % not needed here as we're precise enough \let\tsplitdirectsplitter\tabl_x_split_splitter - \let\tsplitdirectwidth \d_tabl_x_final_width + \let\tsplitdirectwidth \d_tabl_x_final_width_reference \handledirecttsplit} \protected\def\tabl_x_split_splitter#height% @@ -627,7 +631,7 @@ \fi \setupcurrentxtable[#settings]% \relax - \letxtableparameter\c!width\d_tabl_x_width % overloads given width + \letxtableparameter\c!width\d_tabl_x_width_reference % overloads given width \inheritedxtableframed\bgroup \tabl_x_begin_of_cell \fi} @@ -640,7 +644,7 @@ \letxtableparameter\c!height\v!fit % overloads given height \fi \relax - \letxtableparameter\c!width\d_tabl_x_width % overloads given width + \letxtableparameter\c!width\d_tabl_x_width_reference % overloads given width \inheritedxtableframed\bgroup \tabl_x_begin_of_cell \fi} @@ -657,8 +661,8 @@ {\dostarttagged\t!tablecell\empty % can't we just tag the box \setbox\b_tabl_x\hpack\bgroup \setupcurrentxtable[#settings]% - \letxtableparameter\c!width \d_tabl_x_width % overloads given width - \letxtableparameter\c!height\d_tabl_x_height % overloads given height + \letxtableparameter\c!width \d_tabl_x_width_reference % overloads given width + \letxtableparameter\c!height\d_tabl_x_height_reference % overloads given height \clf_x_table_init_construct \inheritedxtableframed\bgroup \tabl_x_begin_of_cell @@ -667,8 +671,8 @@ \protected\def\tabl_x_start_cell_construct_nop {\dostarttagged\t!tablecell\empty % can't we just tag the box \setbox\b_tabl_x\hpack\bgroup - \letxtableparameter\c!width \d_tabl_x_width % overloads given width - \letxtableparameter\c!height\d_tabl_x_height % overloads given height (commenting it ... nice option) + \letxtableparameter\c!width \d_tabl_x_width_reference % overloads given width + \letxtableparameter\c!height\d_tabl_x_height_reference % overloads given height (commenting it ... nice option) \clf_x_table_init_construct \inheritedxtableframed\bgroup \tabl_x_begin_of_cell diff --git a/tex/context/interface/mkii/keys-pe.xml b/tex/context/interface/mkii/keys-pe.xml index ba477f82e..5eca0c1bc 100644 --- a/tex/context/interface/mkii/keys-pe.xml +++ b/tex/context/interface/mkii/keys-pe.xml @@ -96,7 +96,6 @@ <cd:variable name='author' value='author'/> <cd:variable name='auto' value='خودکار'/> <cd:variable name='autointro' value='پیشگفتارخودکار'/> - <cd:variable name='autopunctuation' value='autopunctuation'/> <cd:variable name='back' value='پشت'/> <cd:variable name='background' value='پسزمینه'/> <cd:variable name='backmatter' value='پسمطلب'/> @@ -595,6 +594,7 @@ <cd:variable name='temporary' value='موقتی'/> <cd:variable name='test' value='تست'/> <cd:variable name='text' value='متن'/> + <cd:variable name='textdisplay' value='textdisplay'/> <cd:variable name='textnote' value='textnote'/> <cd:variable name='three' value='سه'/> <cd:variable name='thursday' value='پنجشنبه'/> @@ -683,9 +683,13 @@ <cd:constant name='authoretaltext' value='authoretaltext'/> <cd:constant name='auto' value='خودکار'/> <cd:constant name='autocase' value='autocase'/> + <cd:constant name='autofencing' value='autofencing'/> <cd:constant name='autofile' value='پروندهخودکار'/> <cd:constant name='autofocus' value='تمرکزخودکار'/> <cd:constant name='autohang' value='آویزانخودکار'/> + <cd:constant name='autonumbers' value='autonumbers'/> + <cd:constant name='autopunctuation' value='autopunctuation'/> + <cd:constant name='autospacing' value='autospacing'/> <cd:constant name='autostrut' value='بستخودکار'/> <cd:constant name='autowidth' value='عرضخودکار'/> <cd:constant name='availableheight' value='availableheight'/> diff --git a/tex/generic/context/luatex/luatex-fonts-merged.lua b/tex/generic/context/luatex/luatex-fonts-merged.lua index 460a6816f..ab96db37c 100644 --- a/tex/generic/context/luatex/luatex-fonts-merged.lua +++ b/tex/generic/context/luatex/luatex-fonts-merged.lua @@ -1,6 +1,6 @@ -- merged file : c:/data/develop/context/sources/luatex-fonts-merged.lua -- parent file : c:/data/develop/context/sources/luatex-fonts.lua --- merge date : 2022-12-21 17:10 +-- merge date : 2022-12-22 22:14 do -- begin closure to overcome local limits and interference |