texlive[45276] Build/source/texk/web2c/synctexdir: synchronization

commits+jlaurens at tug.org commits+jlaurens at tug.org
Tue Sep 12 19:16:54 CEST 2017


Revision: 45276
          http://tug.org/svn/texlive?view=revision&revision=45276
Author:   jlaurens
Date:     2017-09-12 19:16:53 +0200 (Tue, 12 Sep 2017)
Log Message:
-----------
synchronization enhancement and header included, only affects the synctex command line tool and editors

Modified Paths:
--------------
    trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c
    trunk/Build/source/texk/web2c/synctexdir/synctex_parser.h
    trunk/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c	2017-09-12 00:47:29 UTC (rev 45275)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex_parser.c	2017-09-12 17:16:53 UTC (rev 45276)
@@ -96,6 +96,7 @@
 #   endif
 
 #include <stdlib.h>
+#include <stdarg.h>
 #include <stdio.h>
 #include <string.h>
 #include <errno.h>
@@ -125,12 +126,11 @@
  *  Each nodes has a class, it is therefore called an object.
  *  Each class has a unique scanner.
  *  Each class has a type which is a unique identifier.
- *  Each class has a node mask which identifies node's attributes.
- *  Each class has an info mask which info's attributes.
  *  The class points to various methods,
  *  each of them vary amongst objects.
- *  The navigator records the offsets of the tree members getters.
- *  The modelator records the offsets of the data members getters, relative to the last navigator getter.
+ *  Each class has a data model which stores node's attributes.
+ *  Each class has an tree model which stores children and parent.
+ *  Inspectors give access to data and tree elements.
  */
 
 /*  8 fields + size: spcflnat */
@@ -265,9 +265,9 @@
 
 /**
  *  Nota bene: naming convention.
- *  For static API, when the name contains proxy, it applies to proxies.
- *  When the name contains noxy, it applies to non proxies only.
- *  When the name contains node, weel it depends...
+ *  For static API, when the name contains "proxy", it applies to proxies.
+ *  When the name contains "noxy", it applies to non proxies only.
+ *  When the name contains "node", well it depends...
  */
 
 typedef synctex_node_p synctex_proxy_p;
@@ -2391,7 +2391,7 @@
         return NULL;
     }
     _synctex_data_set_h(proxy, _synctex_data_h(ref));
-    _synctex_data_set_v(proxy, _synctex_data_v(ref));
+    _synctex_data_set_v(proxy, _synctex_data_v(ref)-_synctex_data_height(to_node));
     _synctex_tree_set_target(proxy,to_node);
 #   if defined(SYNCTEX_USE_CHARINDEX)
     proxy->line_index=to_node?to_node->line_index:0;
@@ -5194,9 +5194,11 @@
                     synctex_node_p node = _synctex_tree_child(parent);
                     synctex_node_p sibling = NULL;
                     /*  Ignore the first node (a box_bdry) */
-                    if (node && (node = __synctex_tree_sibling(node))) {
+                    if (node && (sibling = __synctex_tree_sibling(node))) {
                         unsigned int node_weight = 0;
                         unsigned int cumulated_line_numbers = 0;
+                        _synctex_data_set_line(node, _synctex_data_line(sibling));
+                        node = sibling;
                         do {
                             if (synctex_node_type(node)==synctex_node_type_hbox) {
                                 if (_synctex_data_weight(node)) {
@@ -6752,12 +6754,19 @@
  *  - author: JL
  */
 int synctex_node_mean_line(synctex_node_p node) {
-    synctex_node_p target = _synctex_tree_target(node);
-    if (target) {
-        node = target;
+    synctex_node_p other = _synctex_tree_target(node);
+    if (other) {
+        node = other;
     }
-    return _synctex_data_has_mean_line(node)?
-    _synctex_data_mean_line(node):_synctex_data_line(node);
+    if (_synctex_data_has_mean_line(node)) {
+        return _synctex_data_mean_line(node);
+    }
+    if ((other = synctex_node_parent(node))) {
+        if (_synctex_data_has_mean_line(other)) {
+            return _synctex_data_mean_line(other);
+        }
+    }
+    return synctex_node_line(node);
 }
 /**
  *  The weight of the node.

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex_parser.h
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex_parser.h	2017-09-12 00:47:29 UTC (rev 45275)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex_parser.h	2017-09-12 17:16:53 UTC (rev 45276)
@@ -274,13 +274,18 @@
      *  When the tag is known, the scanner of the node
      *  will also give that same file name, see
      *  synctex_scanner_get_name below.
+     *  For an hbox node, the mean line is the mean
+     *  of all the lines of the child nodes.
+     *  Sometimes, when synchronization form pdf to source
+     *  fails with the line, one should try with the
+     *  mean line.
      */
     int synctex_node_tag(synctex_node_p node);
     int synctex_node_line(synctex_node_p node);
+    int synctex_node_mean_line(synctex_node_p node);
     int synctex_node_column(synctex_node_p node);
     const char * synctex_node_get_name(synctex_node_p node);
     
-
     /**
      This is the page where the node appears.
      *  This is a 1 based index as given by TeX.

Modified: trunk/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h
===================================================================
--- trunk/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h	2017-09-12 00:47:29 UTC (rev 45275)
+++ trunk/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h	2017-09-12 17:16:53 UTC (rev 45276)
@@ -369,7 +369,6 @@
 
     int synctex_node_form_tag(synctex_node_p node);
     
-    int synctex_node_mean_line(synctex_node_p node);
     int synctex_node_weight(synctex_node_p node);
     int synctex_node_child_count(synctex_node_p node);
     



More information about the tex-live-commits mailing list