texlive[57441] Build/source/texk/web2c/luatexdir: sync with the

commits+kakuto at tug.org commits+kakuto at tug.org
Sat Jan 16 06:54:04 CET 2021


Revision: 57441
          http://tug.org/svn/texlive?view=revision&revision=57441
Author:   kakuto
Date:     2021-01-16 06:54:04 +0100 (Sat, 16 Jan 2021)
Log Message:
-----------
sync with the upstream

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/luatexdir/ChangeLog
    trunk/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
    trunk/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
    trunk/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
    trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.c
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.h
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.c
    trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
    trunk/Build/source/texk/web2c/luatexdir/tex/backend.c
    trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c
    trunk/Build/source/texk/web2c/luatexdir/tex/errors.c
    trunk/Build/source/texk/web2c/luatexdir/tex/extensions.c
    trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c
    trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.h

Modified: trunk/Build/source/texk/web2c/luatexdir/ChangeLog
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/ChangeLog	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/ChangeLog	2021-01-16 05:54:04 UTC (rev 57441)
@@ -1,3 +1,6 @@
+2021-01-13 Luigi Scarso <luigi.scarso at gmail.com> 
+    * pdftex compatibility hack (H. Hagen)
+
 2020-12-13 Luigi Scarso <luigi.scarso at gmail.com> 
     * fixed Hyphenation issue regarding frozen glyph nodes (M.F. Krüger)
 

Modified: trunk/Build/source/texk/web2c/luatexdir/lua/lnodelib.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/lua/lnodelib.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/lua/lnodelib.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -6772,6 +6772,12 @@
         } else {
             return nodelib_cantset(L, n, s);
         }
+    } else if (t == pdf_link_state_node) {
+        if (lua_key_eq(s, value)) {
+            pdf_link_state(n) = (halfword) lua_tointeger(L, 3);
+        } else {
+            return nodelib_cantset(L, n, s);
+        }
     } else if ((t == pdf_end_link_node) || (t == pdf_end_thread_node) || (t == save_pos_node) ||
                (t == pdf_save_node)     || (t == pdf_restore_node)) {
         return nodelib_cantset(L, n, s);

Modified: trunk/Build/source/texk/web2c/luatexdir/lua/ltexlib.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/lua/ltexlib.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/lua/ltexlib.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -2668,10 +2668,21 @@
     while (cs < hash_size) {
         s = hash_text(cs);
         if (s > 0) {
+            halfword n = cs_next(cs);
             char *ss = makecstring(s);
             lua_pushstring(L, ss);
             free(ss);
             lua_rawseti(L, -2, ++nt);
+            while (n) {
+                s = cs_text(n);
+                if (s) {
+                    ss = makecstring(s);
+                    lua_pushstring(L, ss);
+                    free(ss);
+                    lua_rawseti(L, -2, ++nt);
+                }
+                n = cs_next(n);
+            }
         }
         cs++;
     }

Modified: trunk/Build/source/texk/web2c/luatexdir/lua/luatex-api.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/lua/luatex-api.h	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/lua/luatex-api.h	2021-01-16 05:54:04 UTC (rev 57441)
@@ -1014,6 +1014,7 @@
 make_lua_key(pdf_end_link);\
 make_lua_key(pdf_end_thread);\
 make_lua_key(pdf_link_data);\
+make_lua_key(pdf_link_state);\
 make_lua_key(pdf_literal);\
 make_lua_key(pdf_refobj);\
 make_lua_key(pdf_restore);\
@@ -1715,6 +1716,7 @@
 init_lua_key(pdf_end_link);\
 init_lua_key(pdf_end_thread);\
 init_lua_key(pdf_link_data);\
+init_lua_key(pdf_link_state);\
 init_lua_key(pdf_literal);\
 init_lua_key(pdf_refobj);\
 init_lua_key(pdf_restore);\
@@ -2483,6 +2485,7 @@
 use_lua_key(pdf_end_link);
 use_lua_key(pdf_end_thread);
 use_lua_key(pdf_link_data);
+use_lua_key(pdf_link_state);
 use_lua_key(pdf_literal);
 use_lua_key(pdf_refobj);
 use_lua_key(pdf_restore);

Modified: trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/luatex_svnversion.h	2021-01-16 05:54:04 UTC (rev 57441)
@@ -1 +1 @@
-#define luatex_svn_revision 7395
+#define luatex_svn_revision 7397

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdfgen.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -916,6 +916,7 @@
     xfree(s);
 }
 
+/*
 void pdf_add_rect_spec(PDF pdf, halfword r)
 {
     pdf_add_bp(pdf, pdf_ann_left(r));
@@ -923,7 +924,17 @@
     pdf_add_bp(pdf, pdf_ann_right(r));
     pdf_add_bp(pdf, pdf_ann_top(r));
 }
+*/
 
+void pdf_add_rect_spec(PDF pdf, halfword r)
+{
+    /* the check is now here */
+    pdf_add_bp(pdf, pdf_ann_left(r)   < pdf_ann_right(r) ? pdf_ann_left(r)   : pdf_ann_right(r));
+    pdf_add_bp(pdf, pdf_ann_bottom(r) < pdf_ann_top(r)   ? pdf_ann_bottom(r) : pdf_ann_top(r));
+    pdf_add_bp(pdf, pdf_ann_left(r)   < pdf_ann_right(r) ? pdf_ann_right(r)  : pdf_ann_left(r));
+    pdf_add_bp(pdf, pdf_ann_bottom(r) < pdf_ann_top(r)   ? pdf_ann_top(r)    : pdf_ann_bottom(r));
+}
+
 void pdf_rectangle(PDF pdf, halfword r)
 {
     pdf_add_name(pdf, "Rect");

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -29,6 +29,16 @@
 
 */
 
+void pdf_out_link_state(PDF pdf, halfword p)
+{
+    if (pdf_link_state(p) >= 0 && pdf_link_state(p) <= 1) {
+        pdf->link_state = pdf_link_state(p);
+    } else {
+        /* ignores so one can use them for whatever purpose */
+    }
+}
+
+
 void push_link_level(PDF pdf, halfword p)
 {
     if (pdf->link_stack_ptr >= pdf_max_link_level)

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.h	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdflink.h	2021-01-16 05:54:04 UTC (rev 57441)
@@ -28,6 +28,7 @@
 extern void push_link_level(PDF pdf, halfword p);
 extern void pop_link_level(PDF pdf);
 extern void do_link(PDF pdf, halfword p, halfword parent_box, scaledpos cur);
+extern void pdf_out_link_state(PDF pdf, halfword p);
 extern void end_link(PDF pdf, halfword p);
 extern void append_link(PDF pdf, halfword parent_box, scaledpos cur, small_number i);
 extern void scan_startlink(PDF pdf);

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdflistout.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -177,6 +177,7 @@
             case pdf_refobj_node:
             case pdf_end_link_node:
             case pdf_end_thread_node:
+            case pdf_link_state_node:
                 backend_out_whatsit[subtype(p)](pdf, p);
                 break;
             case pdf_annot_node:
@@ -254,8 +255,20 @@
     cur_s++;
     backend_out_control[backend_control_push_list](pdf,&saved_pos,&saved_loc);
     for (i = 1; i <= pdf->link_stack_ptr; i++) {
-        if (pdf->link_stack[i].nesting_level == cur_s)
+        if (pdf->link_state == 1) {
+            /*
+                We ignore this link. This is a compatibility-with-pdftex feature needed for latex. It
+                is suboptimal in the sense that when the whatsit is set, the next box is influenced,
+                so there there can be side effects when used in the middle of a line, when using
+                vadjust, etc. But we can assume that tha macro package knows when and where this
+                mechanism is triggered, so a more sophisticated solution is not needed (and would be
+                confusing in its own anyway.)
+
+                I would not be surprised of we have some leak here but it's harmless.
+           */
+        } else if (pdf->link_stack[i].nesting_level == cur_s) {
             append_link(pdf, this_box, cur, (small_number) i);
+        }
     }
     if (synctex) {
         synctexhlist(this_box);

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdftables.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -224,8 +224,7 @@
 void set_rect_dimens(PDF pdf, halfword p, halfword parent_box, scaledpos cur, scaled_whd alt_rule, scaled margin)
 {
     /*tex The positions relative to cur: */
-    scaledpos ll, ur;
-    scaledpos pos_ll, pos_ur, tmp;
+    scaledpos ll, ur, pos_ll, pos_ur;
     posstructure localpos;
     localpos.dir = pdf->posstruct->dir;
     /*tex |pdf| contains current point on page: */
@@ -246,16 +245,11 @@
     pos_ll = localpos.pos;
     synch_pos_with_cur(&localpos, pdf->posstruct, ur);
     pos_ur = localpos.pos;
-    if (pos_ll.h > pos_ur.h) {
-        tmp.h = pos_ll.h;
-        pos_ll.h = pos_ur.h;
-        pos_ur.h = tmp.h;
-    }
-    if (pos_ll.v > pos_ur.v) {
-        tmp.v = pos_ll.v;
-        pos_ll.v = pos_ur.v;
-        pos_ur.v = tmp.v;
-    }
+    /*
+        The test for swapping has been moved to the moment we write the rectangle. This has to
+        do with the fact that we have code dealing with directions and that the |pdf_ann_*|
+        horizontal edges get recalculated in some places.
+    */
     if (global_shipping_mode == SHIPPING_PAGE && matrixused()) {
         matrixtransformrect(pos_ll.h, pos_ll.v, pos_ur.h, pos_ur.v);
         pos_ll.h = getllx();

Modified: trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/pdf/pdftypes.h	2021-01-16 05:54:04 UTC (rev 57441)
@@ -371,6 +371,7 @@
     /* the pdf link stack */
     pdf_link_stack_record link_stack[(pdf_max_link_level + 1)];
     int link_stack_ptr;
+    int link_state;
     /* the thread data */
     int last_thread;            /* pointer to the last thread */
     scaled_whd thread;

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/backend.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/backend.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/backend.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -45,6 +45,7 @@
     p->whatsit_fu[pdf_setmatrix_node] = &pdf_out_setmatrix;
     p->whatsit_fu[pdf_save_node] = &pdf_out_save;
     p->whatsit_fu[pdf_restore_node] = &pdf_out_restore;
+    p->whatsit_fu[pdf_link_state_node] = &pdf_out_link_state;
     p->control_fu[backend_control_push_list] = &pdf_push_list;
     p->control_fu[backend_control_pop_list] = &pdf_pop_list;
     p->control_fu[backend_control_begin_page] = &pdf_begin_page;

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/dumpdata.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -32,7 +32,7 @@
 
 */
 
-#define FORMAT_ID (907+53)
+#define FORMAT_ID (907+54)
 #if ((FORMAT_ID>=0) && (FORMAT_ID<=256))
 #error Wrong value for FORMAT_ID.
 #endif

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/errors.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/errors.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/errors.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -290,7 +290,8 @@
 __attribute__ ((noreturn))
 static void luatex_calledit (int baseptr, int linenumber)
 {
-    char *temp, *command, *fullcmd;
+    char *temp, *command;
+    char *fullcmd = NULL; /* avoid compiler warning */
     char c;
     int sdone, ddone, i;
     char *filename = makecstring(input_stack[base_ptr].name_field);
@@ -442,7 +443,7 @@
         /*tex Get user's advice and |return|. */
         while (1) {
           CONTINUE:
-            /*tex  
+            /*tex
              Original reports:
 
              https://tex.stackexchange.com/questions/551313/
@@ -455,7 +456,7 @@
             selector from 16 to 15 in term_input, due to the lack of this check in
             recursive error() call.
             */
-            if (interaction !=error_stop_mode) 
+            if (interaction !=error_stop_mode)
                 return;
             clear_for_error_prompt();
             prompt_input("? ");
@@ -986,7 +987,7 @@
         new_line_char_par = 10;
         report_id = callback_defined(show_lua_error_hook_callback);
         if (report_id == 0) {
-	    if (p != NULL) 
+	    if (p != NULL)
 	      tprint(p);
             help2(
                 "The lua interpreter ran into a problem, so the",

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/extensions.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/extensions.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/extensions.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -156,6 +156,10 @@
         new_whatsit(pdf_save_node);
     } else if (scan_keyword("restore")) {
         new_whatsit(pdf_restore_node);
+    } else if (scan_keyword("linkstate")) {
+        new_whatsit(pdf_link_state_node);
+        scan_int();
+        pdf_link_state(tail) = cur_val;
     } else if (scan_keyword("setmatrix")) {
         new_whatsit(pdf_setmatrix_node);
         scan_toks(false, true);

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.c	2021-01-16 05:54:04 UTC (rev 57441)
@@ -136,6 +136,7 @@
 field_info node_fields_whatsit_pdf_literal[4];
 field_info node_fields_whatsit_pdf_refobj[3];
 field_info node_fields_whatsit_pdf_restore[2];
+field_info node_fields_whatsit_pdf_link_state[3];
 field_info node_fields_whatsit_pdf_save[2];
 field_info node_fields_whatsit_pdf_setmatrix[3];
 field_info node_fields_whatsit_pdf_start_link[8];
@@ -142,6 +143,7 @@
 field_info node_fields_whatsit_pdf_start_thread[8];
 field_info node_fields_whatsit_pdf_thread[8];
 
+
 /*tex The values of fields. */
 
 subtype_info node_values_dir[] = {
@@ -997,6 +999,7 @@
     { pdf_setmatrix_node,    pdf_setmatrix_node_size,  NULL, node_fields_whatsit_pdf_setmatrix,    NULL, -1, 0 },
     { pdf_save_node,         pdf_save_node_size,       NULL, node_fields_whatsit_pdf_save,         NULL, -1, 0 },
     { pdf_restore_node,      pdf_restore_node_size,    NULL, node_fields_whatsit_pdf_restore,      NULL, -1, 0 },
+    { pdf_link_state_node,   pdf_link_state_node_size, NULL, node_fields_whatsit_pdf_link_state,   NULL, -1, 0 },
 
     /*tex That's it. */
 
@@ -1065,6 +1068,7 @@
     init_node_key(whatsit_node_data, pdf_setmatrix_node,   pdf_setmatrix)
     init_node_key(whatsit_node_data, pdf_save_node,        pdf_save)
     init_node_key(whatsit_node_data, pdf_restore_node,     pdf_restore)
+    init_node_key(whatsit_node_data, pdf_link_state_node,  pdf_link_state)
 
     init_node_key(node_values_pdf_destination, 0, xyz)
     init_node_key(node_values_pdf_destination, 1, fit)
@@ -1133,6 +1137,10 @@
     init_field_key(node_fields_whatsit_pdf_end_link, 0, attr);
     init_field_nop(node_fields_whatsit_pdf_end_link, 1);
 
+    init_field_key(node_fields_whatsit_pdf_link_state, 0, attr);
+    init_field_key(node_fields_whatsit_pdf_link_state, 1, value);
+    init_field_nop(node_fields_whatsit_pdf_link_state, 2);
+
     init_field_key(node_fields_whatsit_pdf_end_thread, 0, attr);
     init_field_nop(node_fields_whatsit_pdf_end_thread, 1);
 
@@ -2257,6 +2265,7 @@
     switch(subtype(p)) {
         case pdf_save_node:
         case pdf_restore_node:
+        case pdf_link_state_node:
         case pdf_refobj_node:
         case pdf_end_link_node:
         case pdf_end_thread_node:
@@ -2559,6 +2568,7 @@
             break;
         case pdf_save_node:
         case pdf_restore_node:
+        case pdf_link_state_node:
         case pdf_refobj_node:
         case pdf_end_link_node:
         case pdf_end_thread_node:
@@ -3550,21 +3560,21 @@
             tprint_esc("pdfcolorstack ");
             print_int(pdf_colorstack_stack(p));
             switch (pdf_colorstack_cmd(p)) {
-            case colorstack_set:
-                tprint(" set ");
-                break;
-            case colorstack_push:
-                tprint(" push ");
-                break;
-            case colorstack_pop:
-                tprint(" pop");
-                break;
-            case colorstack_current:
-                tprint(" current");
-                break;
-            default:
-                confusion("colorstack");
-                break;
+                case colorstack_set:
+                    tprint(" set ");
+                    break;
+                case colorstack_push:
+                    tprint(" push ");
+                    break;
+                case colorstack_pop:
+                    tprint(" pop");
+                    break;
+                case colorstack_current:
+                    tprint(" current");
+                    break;
+                default:
+                    confusion("colorstack");
+                    break;
             }
             if (pdf_colorstack_cmd(p) <= colorstack_data)
                 print_mark(pdf_colorstack_data(p));
@@ -3579,6 +3589,10 @@
         case pdf_restore_node:
             tprint_esc("pdfrestore");
             break;
+        case pdf_link_state_node:
+            tprint_esc("pdflinkstate ");
+            print_int(pdf_link_state(p));
+            break;
         case pdf_refobj_node:
             tprint_esc("pdfrefobj");
             if (obj_obj_is_stream(static_pdf, pdf_obj_objnum(p))) {

Modified: trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.h
===================================================================
--- trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.h	2021-01-16 04:05:51 UTC (rev 57440)
+++ trunk/Build/source/texk/web2c/luatexdir/tex/texnodes.h	2021-01-16 05:54:04 UTC (rev 57441)
@@ -734,6 +734,7 @@
     pdf_setmatrix_node,
     pdf_save_node,
     pdf_restore_node,
+    pdf_link_state_node,
 } whatsit_types;
 
 #  define first_common_whatsit      0
@@ -741,10 +742,12 @@
 #  define backend_first_dvi_whatsit 15
 #  define backend_last_dvi_whatsit  15
 #  define backend_first_pdf_whatsit 16
-#  define backend_last_pdf_whatsit  31
+#  define backend_last_pdf_whatsit  32
 
-#  define MAX_WHATSIT_TYPE 32
+/* add some slack for the future */
 
+#  define MAX_WHATSIT_TYPE 34
+
 #  define known_whatsit_type(i) ( \
     (i >= first_common_whatsit      && i <= last_common_whatsit) || \
     (i >= backend_first_dvi_whatsit && i <= backend_last_dvi_whatsit) || \
@@ -920,6 +923,10 @@
 #  define pdf_save_node_size        3
 #  define pdf_restore_node_size     3
 
+#  define pdf_link_state_node_size  3
+
+#  define pdf_link_state(a) vinfo((a) + 2)
+
 #  define pdf_colorstack_node_size  4
 #  define pdf_colorstack_stack(a)   vlink((a)+2)
 #  define pdf_colorstack_cmd(a)     vinfo((a)+2)



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