texlive[61717] Build/source/texk/web2c/luatexdir: luatex : sync with

commits+kakuto at tug.org commits+kakuto at tug.org
Sun Jan 23 22:24:49 CET 2022


Revision: 61717
          http://tug.org/svn/texlive?view=revision&revision=61717
Author:   kakuto
Date:     2022-01-23 22:24:49 +0100 (Sun, 23 Jan 2022)
Log Message:
-----------
luatex : sync with the upstream

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
    trunk/Build/source/texk/web2c/luatexdir/tex/commands.c
    trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c
    trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h
    trunk/Build/source/texk/web2c/luatexdir/tex/texmath.c
    trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c

Modified: trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h	2022-01-23 21:12:21 UTC (rev 61716)
+++ trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h	2022-01-23 21:24:49 UTC (rev 61717)
@@ -1 +1 @@
-#define luatex_svn_revision 7483
+#define luatex_svn_revision 7484

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/commands.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/commands.c	2022-01-23 21:12:21 UTC (rev 61716)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/commands.c	2022-01-23 21:24:49 UTC (rev 61717)
@@ -799,6 +799,7 @@
     primitive_luatex("mathnolimitsmode", assign_int_cmd, int_base + math_nolimits_mode_code, int_base);
     primitive_luatex("mathitalicsmode", assign_int_cmd, int_base + math_italics_mode_code, int_base);
     primitive_luatex("mathrulesmode", assign_int_cmd, int_base + math_rules_mode_code, int_base);
+    primitive_luatex("matheqdirmode", assign_int_cmd, int_base + math_eq_dir_mode_code, int_base);
     primitive_luatex("mathrulesfam", assign_int_cmd, int_base + math_rules_fam_code, int_base);
     primitive_luatex("synctex", assign_int_cmd, int_base + synctex_code, int_base);
 

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c	2022-01-23 21:12:21 UTC (rev 61716)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c	2022-01-23 21:24:49 UTC (rev 61717)
@@ -32,7 +32,7 @@
 
 */
 
-#define FORMAT_ID (907+57)
+#define FORMAT_ID (907+58)
 #if ((FORMAT_ID>=0) && (FORMAT_ID<=256))
 #error Wrong value for FORMAT_ID.
 #endif

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h	2022-01-23 21:12:21 UTC (rev 61716)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/equivalents.h	2022-01-23 21:24:49 UTC (rev 61717)
@@ -313,8 +313,9 @@
 #  define discretionary_ligature_mode_code 120
 #  define partoken_context_code 121
 #  define show_stream_code 122
+#  define math_eq_dir_mode_code 123
 
-#  define math_option_code 123
+#  define math_option_code 124
 
 #  define mathoption_int_base_code (math_option_code+1)                 /* one reserve */
 #  define mathoption_int_last_code (mathoption_int_base_code+8)
@@ -816,6 +817,7 @@
 #define fixup_boxes_par                    int_par(fixup_boxes_code)
 #define glyph_dimensions_par               int_par(glyph_dimensions_code)
 #define math_defaults_mode_par             int_par(math_defaults_mode_code)
+#define math_eq_dir_mode_par               int_par(math_eq_dir_mode_code)
 #define discretionary_ligature_mode_par    int_par(discretionary_ligature_mode_code)
 #define partoken_context_code_par          int_par(partoken_context_code)
 

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/texmath.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/texmath.c	2022-01-23 21:12:21 UTC (rev 61716)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/texmath.c	2022-01-23 21:24:49 UTC (rev 61717)
@@ -241,10 +241,35 @@
 
 static sa_tree math_param_head = NULL;
 
+// void def_math_param(int param_id, int style_id, scaled value, int lvl)
+// {
+//     int n = param_id + (256 * style_id);
+//     sa_tree_item sa_value = { 0 };
+//     sa_value.int_value = (int) value;
+//     set_sa_item(math_param_head, n, sa_value, lvl);
+//     if (tracing_assigns_par > 1) {
+//         begin_diagnostic();
+//         tprint("{assigning");
+//         print_char(' ');
+//         print_cmd_chr(set_math_param_cmd, param_id);
+//         print_cmd_chr(math_style_cmd, style_id);
+//         print_char('=');
+//         print_int(value);
+//         print_char('}');
+//         end_diagnostic(false);
+//     }
+// }
+
 void def_math_param(int param_id, int style_id, scaled value, int lvl)
 {
     int n = param_id + (256 * style_id);
     sa_tree_item sa_value = { 0 };
+    if (param_id >= math_param_ord_ord_spacing && param_id <= math_param_inner_inner_spacing) {
+        sa_tree_item ti = get_sa_item(math_param_head, n);
+        if (ti.int_value > thick_mu_skip_code && valid_node(ti.int_value)) {
+            free_node(ti.int_value, glue_spec_size);
+        }
+    }
     sa_value.int_value = (int) value;
     set_sa_item(math_param_head, n, sa_value, lvl);
     if (tracing_assigns_par > 1) {
@@ -266,6 +291,36 @@
     return (scaled) get_sa_item(math_param_head, n).int_value;
 }
 
+// static void unsave_math_param_data(int gl)
+// {
+//     sa_stack_item st;
+//     if (math_param_head->stack == NULL)
+//         return;
+//     while (math_param_head->stack_ptr > 0 &&
+//            abs(math_param_head->stack[math_param_head->stack_ptr].level)
+//            >= (int) gl) {
+//         st = math_param_head->stack[math_param_head->stack_ptr];
+//         if (st.level > 0) {
+//             rawset_sa_item(math_param_head, st.code, st.value);
+//             /*tex Do a trace message, if requested. */
+//             if (tracing_restores_par > 1) {
+//                 int param_id = st.code % 256;
+//                 int style_id = st.code / 256;
+//                 begin_diagnostic();
+//                 tprint("{restoring");
+//                 print_char(' ');
+//                 print_cmd_chr(set_math_param_cmd, param_id);
+//                 print_cmd_chr(math_style_cmd, style_id);
+//                 print_char('=');
+//                 print_int(get_math_param(param_id, style_id));
+//                 print_char('}');
+//                 end_diagnostic(false);
+//             }
+//         }
+//         (math_param_head->stack_ptr)--;
+//     }
+// }
+
 static void unsave_math_param_data(int gl)
 {
     sa_stack_item st;
@@ -276,11 +331,17 @@
            >= (int) gl) {
         st = math_param_head->stack[math_param_head->stack_ptr];
         if (st.level > 0) {
+            int param_id = st.code % 256;
+            int style_id = st.code / 256;
+            if (param_id >= math_param_ord_ord_spacing && param_id <= math_param_inner_inner_spacing) {
+                sa_tree_item ti = get_sa_item(math_param_head, st.code);
+                if (ti.int_value > thick_mu_skip_code && valid_node(ti.int_value)) {
+                    free_node(ti.int_value, glue_spec_size);
+                }
+            }
             rawset_sa_item(math_param_head, st.code, st.value);
             /*tex Do a trace message, if requested. */
             if (tracing_restores_par > 1) {
-                int param_id = st.code % 256;
-                int style_id = st.code / 256;
                 begin_diagnostic();
                 tprint("{restoring");
                 print_char(' ');
@@ -2437,13 +2498,31 @@
                     d = 0;
     }
     tail_append(new_penalty(pre_display_penalty_par,after_display_penalty));
-    if ((d + line_s <= pre_display_size_par) || l) {
+   
+    /* tex
+       By default the short skip detection is not adapted to r2l typesetting and that
+      hasn't been the case since the start of the project. Changing it could break
+      hacks that users came up with but when you set \.{\\matheqdirmode} to a positive
+      value direction will be taken into account.
+    */
+    if (math_eq_dir_mode_par<=0) { /* old behavior */
+       if ((d + line_s <= pre_display_size_par) || l) {
         /*tex not enough clearance */
         g1 = above_display_skip_code;
         g2 = below_display_skip_code;
-    } else {
+       } else {
         g1 = above_display_short_skip_code;
         g2 = below_display_short_skip_code;
+       }
+    } else { 
+      if ((d + line_s <= pre_display_size_par) || ((! dir_math_save && l) || (dir_math_save && ! l))) {
+        /*tex not enough clearance */
+        g1 = above_display_skip_code;
+        g2 = below_display_skip_code;
+      } else {
+        g1 = above_display_short_skip_code;
+        g2 = below_display_short_skip_code;
+      }
     }
     /*tex
 

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c	2022-01-23 21:12:21 UTC (rev 61716)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c	2022-01-23 21:24:49 UTC (rev 61717)
@@ -33,13 +33,10 @@
 */
 
 #define MAX_CHAIN_SIZE   13 /* why not a bit larger */
-#define CHECK_NODE_USAGE  1 /* this triggers checking */
 
 memory_word *volatile varmem = NULL;
 
-#ifdef CHECK_NODE_USAGE
-    char *varmem_sizes = NULL;
-#endif
+char *varmem_sizes = NULL;
 
 halfword var_mem_max = 0;
 halfword rover = 0;
@@ -1436,13 +1433,9 @@
 int valid_node(halfword p)
 {
     if (p > my_prealloc && p < var_mem_max) {
-#ifdef CHECK_NODE_USAGE
         if (varmem_sizes[p] > 0) {
             return 1;
         }
-#else
-        return 1;
-#endif
     }
     return 0;
 }
@@ -1476,8 +1469,6 @@
     } \
 }
 
-#ifdef CHECK_NODE_USAGE
-
 static void check_static_node_mem(void)
 {
     dotest(zero_glue, width(zero_glue), 0);
@@ -1587,12 +1578,9 @@
     }
 }
 
-#endif
-
 static int free_error(halfword p)
 {
     if (p > my_prealloc && p < var_mem_max) {
-#ifdef CHECK_NODE_USAGE
         int i;
         if (varmem_sizes[p] == 0) {
             check_static_node_mem();
@@ -1610,7 +1598,6 @@
             node_mem_dump(p);
             return 1;
         }
-#endif
     } else {
         formatted_error("nodes", "attempt to free an impossible node %d", (int) p);
         return 1;
@@ -1621,7 +1608,6 @@
 static int copy_error(halfword p)
 {
     if (p >= 0 && p < var_mem_max) {
-#ifdef CHECK_NODE_USAGE
         if (p > my_prealloc && varmem_sizes[p] == 0) {
             if (type(p) == glyph_node) {
                 formatted_warning("nodes", "attempt to copy free glyph (%c) node %d, ignored", (int) character(p), (int) p);
@@ -1630,7 +1616,6 @@
             }
             return 1;
         }
-#endif
     } else {
         formatted_error("nodes", "attempt to copy an impossible node %d", (int) p);
         return 1;
@@ -2727,9 +2712,7 @@
         r = free_chain[s];
         if (r != null) {
             free_chain[s] = vlink(r);
-#ifdef CHECK_NODE_USAGE
             varmem_sizes[r] = (char) s;
-#endif
             vlink(r) = null;
             /*tex Maintain usage statistics. */
             var_used += s;
@@ -2749,9 +2732,7 @@
         formatted_error("nodes", "node number %d of type %d should not be freed", (int) p, type(p));
         return;
     }
-#ifdef CHECK_NODE_USAGE
     varmem_sizes[p] = 0;
-#endif
     if (s < MAX_CHAIN_SIZE) {
         vlink(p) = free_chain[s];
         free_chain[s] = p;
@@ -2772,16 +2753,12 @@
 {
     register halfword p = q;
     while (vlink(p) != null) {
-#ifdef CHECK_NODE_USAGE
         varmem_sizes[p] = 0;
-#endif
         var_used -= s;
         p = vlink(p);
     }
     var_used -= s;
-#ifdef CHECK_NODE_USAGE
     varmem_sizes[p] = 0;
-#endif
     vlink(p) = free_chain[s];
     free_chain[s] = q;
 }
@@ -2831,13 +2808,11 @@
         overflow("node memory size", (unsigned) var_mem_max);
     }
     memset((void *) (varmem), 0, (unsigned) t * sizeof(memory_word));
-#ifdef CHECK_NODE_USAGE
     varmem_sizes = (char *) realloc(varmem_sizes, sizeof(char) * (unsigned) t);
     if (varmem_sizes == NULL) {
         overflow("node memory size", (unsigned) var_mem_max);
     }
     memset((void *) varmem_sizes, 0, sizeof(char) * (unsigned) t);
-#endif
     var_mem_max = t;
     rover = var_mem_stat_max + 1;
     vlink(rover) = rover;
@@ -2876,9 +2851,7 @@
     dump_int(var_mem_max);
     dump_int(rover);
     dump_things(varmem[0], var_mem_max);
-#ifdef CHECK_NODE_USAGE
     dump_things(varmem_sizes[0], var_mem_max);
-#endif
     dump_things(free_chain[0], MAX_CHAIN_SIZE);
     dump_int(var_used);
     dump_int(my_prealloc);
@@ -2898,11 +2871,9 @@
     var_mem_max = (x < 100000 ? 100000 : x);
     varmem = xmallocarray(memory_word, (unsigned) var_mem_max);
     undump_things(varmem[0], x);
-#ifdef CHECK_NODE_USAGE
     varmem_sizes = xmallocarray(char, (unsigned) var_mem_max);
     memset((void *) varmem_sizes, 0, (unsigned) var_mem_max * sizeof(char));
     undump_things(varmem_sizes[0], x);
-#endif
     undump_things(free_chain[0], MAX_CHAIN_SIZE);
     undump_int(var_used);
     undump_int(my_prealloc);
@@ -2941,9 +2912,7 @@
                 vlink(rover) += s;
             }
             if (vlink(rover) < var_mem_max) {
-#ifdef CHECK_NODE_USAGE
                 varmem_sizes[r] = (char) (s > 127 ? 127 : s);
-#endif
                 vlink(r) = null;
                 /*tex Maintain usage statistics. */
                 var_used += s;
@@ -2984,13 +2953,11 @@
                 overflow("node memory size", (unsigned) var_mem_max);
             }
             memset((void *) (varmem + var_mem_max), 0, (unsigned) x * sizeof(memory_word));
-#ifdef CHECK_NODE_USAGE
             varmem_sizes = (char *) realloc(varmem_sizes, sizeof(char) * (unsigned) (var_mem_max + x));
             if (varmem_sizes == NULL) {
                 overflow("node memory size", (unsigned) var_mem_max);
             }
             memset((void *) (varmem_sizes + var_mem_max), 0, (unsigned) (x) * sizeof(char));
-#endif
             /*tex Todo: is it perhaps possible to merge the new memory with an existing rover? */
             vlink(var_mem_max) = rover;
             node_size(var_mem_max) = x;
@@ -3011,7 +2978,6 @@
 char *sprint_node_mem_usage(void)
 {
     char *s;
-#ifdef CHECK_NODE_USAGE
     char *ss;
     int i;
     int b = 0;
@@ -3043,9 +3009,6 @@
             b = 1;
         }
     }
-#else
-    s = strdup("");
-#endif
     return s;
 }
 
@@ -3052,7 +3015,6 @@
 halfword list_node_mem_usage(void)
 {
     halfword q = null;
-#ifdef CHECK_NODE_USAGE
     halfword p = null;
     halfword i, j;
     char *saved_varmem_sizes = xmallocarray(char, (unsigned) var_mem_max);
@@ -3069,7 +3031,6 @@
         }
     }
     free(saved_varmem_sizes);
-#endif
     return q;
 }
 



More information about the tex-live-commits mailing list.