summaryrefslogtreecommitdiff
path: root/Build
diff options
context:
space:
mode:
Diffstat (limited to 'Build')
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_main.c3
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser.c272
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser.h4
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser_utils.h2
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser_version.txt2
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_version.h59
6 files changed, 291 insertions, 51 deletions
diff --git a/Build/source/texk/web2c/synctexdir/synctex_main.c b/Build/source/texk/web2c/synctexdir/synctex_main.c
index 46b8e91428e..173d7897da3 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_main.c
+++ b/Build/source/texk/web2c/synctexdir/synctex_main.c
@@ -60,8 +60,6 @@ This file is named "synctex_main.c".
This is the command line interface to the synctex_parser.c.
*/
-# define SYNCTEX_CLI_VERSION_STRING "1.4"
-
# ifdef __linux__
# define _ISOC99_SOURCE /* to get the fmax() prototype */
# endif
@@ -79,6 +77,7 @@ This is the command line interface to the synctex_parser.c.
# include <string.h>
# include <stdarg.h>
# include <math.h>
+# include "synctex_version.h"
# include "synctex_parser_advanced.h"
# include "synctex_parser_utils.h"
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.c b/Build/source/texk/web2c/synctexdir/synctex_parser.c
index 85fbc0df2b6..58fcb590924 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser.c
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser.c
@@ -461,7 +461,7 @@ DEFINE_SYNCTEX_TREE_GETSETRESET(friend)
DEFINE_SYNCTEX_TREE_GETSET(last)
DEFINE_SYNCTEX_TREE_GETSET(next_hbox)
DEFINE_SYNCTEX_TREE_GETSET(arg_sibling)
-DEFINE_SYNCTEX_TREE_GETSET(target)
+DEFINE_SYNCTEX_TREE_GETSETRESET(target)
#if SYNCTEX_DEBUG>1000
# undef SYNCTEX_USE_NODE_COUNT
@@ -901,6 +901,21 @@ static void _synctex_free_node(synctex_node_p node) {
}
return;
}
+/**
+ * Free the given handle.
+ * - parameter node: of type synctex_node_p
+ * - note: a node is meant to own its child and sibling.
+ * It is not owned by its parent, unless it is its first child.
+ * This destructor is for all handles.
+ */
+static void _synctex_free_handle(synctex_node_p handle) {
+ if (handle) {
+ _synctex_free_handle(__synctex_tree_sibling(handle));
+ _synctex_free_handle(_synctex_tree_child(handle));
+ _synctex_free(handle);
+ }
+ return;
+}
/**
* Free the given leaf node.
@@ -1376,10 +1391,13 @@ static const synctex_tree_model_s synctex_tree_model_vbox = {
synctex_tree_spcfl_vbox_max
};
+#define SYNCTEX_DFLT_COLUMN -1
+
DEFINE_SYNCTEX_DATA_INT_GETSET(column)
static synctex_status_t _synctex_data_decode_column(synctex_node_p node) {
if (_synctex_data_has_column(node)) {
- synctex_is_s is = _synctex_decode_int_opt(node->class->scanner,-1);
+ synctex_is_s is = _synctex_decode_int_opt(node->class->scanner,
+ SYNCTEX_DFLT_COLUMN);
if (is.status == SYNCTEX_STATUS_OK) {
_synctex_data_set_column(node,is.integer);
}
@@ -1393,6 +1411,17 @@ DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(width)
DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(height)
DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(depth)
+SYNCTEX_INLINE static void _synctex_data_set_tlc(synctex_node_p node, synctex_node_p model) {
+ _synctex_data_set_tag(node, _synctex_data_tag(model));
+ _synctex_data_set_line(node, _synctex_data_line(model));
+ _synctex_data_set_column(node, _synctex_data_column(model));
+}
+SYNCTEX_INLINE static void _synctex_data_set_tlchv(synctex_node_p node, synctex_node_p model) {
+ _synctex_data_set_tlc(node,model);
+ _synctex_data_set_h(node, _synctex_data_h(model));
+ _synctex_data_set_v(node, _synctex_data_v(model));
+}
+
static const synctex_data_model_s synctex_data_model_box = {
synctex_data_tag_idx, /* tag */
synctex_data_line_idx, /* line */
@@ -2285,7 +2314,12 @@ static synctex_class_s synctex_class_proxy_last = {
# endif
/**
- * A result node.
+ * A handle node.
+ * A handle is never the target of a proxy
+ * or another handle.
+ * The child of a handle is always a handle if any.
+ * The sibling of a handle is always a handle if any.
+ * The parent of a handle is always a handle if any.
*/
static const synctex_tree_model_s synctex_tree_model_handle = {
@@ -2306,7 +2340,7 @@ typedef struct {
synctex_data_u data[synctex_tree_spct_handle_max+0];
} synctex_node_handle_s;
-/* result node creator */
+/* handle node creator */
DEFINE_synctex_new_unscanned_NODE(handle)
static void _synctex_log_handle(synctex_node_p node);
@@ -2317,7 +2351,7 @@ static synctex_class_s synctex_class_handle = {
NULL, /* No scanner yet */
synctex_node_type_handle, /* Node type */
&_synctex_new_handle, /* creator */
- &_synctex_free_node, /* destructor */
+ &_synctex_free_handle, /* destructor */
&_synctex_log_handle, /* log */
&_synctex_display_handle, /* display */
&_synctex_abstract_handle, /* abstract */
@@ -2338,6 +2372,16 @@ SYNCTEX_INLINE static synctex_node_p _synctex_new_handle_with_target(synctex_nod
}
return NULL;
}
+SYNCTEX_INLINE static synctex_node_p _synctex_new_handle_with_child(synctex_node_p child) {
+ if (child) {
+ synctex_node_p result = _synctex_new_handle(child->class->scanner);
+ if (result) {
+ _synctex_tree_set_child(result,child);
+ return result;
+ }
+ }
+ return NULL;
+}
# ifdef SYNCTEX_NOTHING
# pragma mark -
@@ -2923,10 +2967,11 @@ static void _synctex_log_ref(synctex_node_p node) {
static void _synctex_log_tlchv_node(synctex_node_p node) {
if (node) {
- printf("%s:%i,%i:%i,%i",
+ printf("%s:%i,%i,%i:%i,%i",
synctex_node_isa(node),
_synctex_data_tag(node),
_synctex_data_line(node),
+ _synctex_data_column(node),
_synctex_data_h(node),
_synctex_data_v(node));
SYNCTEX_PRINT_CHARINDEX_NL;
@@ -2940,10 +2985,11 @@ static void _synctex_log_tlchv_node(synctex_node_p node) {
static void _synctex_log_kern_node(synctex_node_p node) {
if (node) {
- printf("%s:%i,%i:%i,%i:%i",
+ printf("%s:%i,%i,%i:%i,%i:%i",
synctex_node_isa(node),
_synctex_data_tag(node),
_synctex_data_line(node),
+ _synctex_data_column(node),
_synctex_data_h(node),
_synctex_data_v(node),
_synctex_data_width(node));
@@ -2958,10 +3004,11 @@ static void _synctex_log_kern_node(synctex_node_p node) {
static void _synctex_log_rule(synctex_node_p node) {
if (node) {
- printf("%s:%i,%i:%i,%i",
+ printf("%s:%i,%i,%i:%i,%i",
synctex_node_isa(node),
_synctex_data_tag(node),
_synctex_data_line(node),
+ _synctex_data_column(node),
_synctex_data_h(node),
_synctex_data_v(node));
printf(":%i",_synctex_data_width(node));
@@ -2980,7 +3027,7 @@ static void _synctex_log_void_box(synctex_node_p node) {
printf("%s",synctex_node_isa(node));
printf(":%i",_synctex_data_tag(node));
printf(",%i",_synctex_data_line(node));
- printf(",%i",0);
+ printf(",%i",_synctex_data_column(node));
printf(":%i",_synctex_data_h(node));
printf(",%i",_synctex_data_v(node));
printf(":%i",_synctex_data_width(node));
@@ -3000,7 +3047,7 @@ static void _synctex_log_vbox(synctex_node_p node) {
printf("%s",synctex_node_isa(node));
printf(":%i",_synctex_data_tag(node));
printf(",%i",_synctex_data_line(node));
- printf(",%i",0);
+ printf(",%i",_synctex_data_column(node));
printf(":%i",_synctex_data_h(node));
printf(",%i",_synctex_data_v(node));
printf(":%i",_synctex_data_width(node));
@@ -3021,7 +3068,7 @@ static void _synctex_log_hbox(synctex_node_p node) {
printf("%s",synctex_node_isa(node));
printf(":%i",_synctex_data_tag(node));
printf(",%i~%i*%i",_synctex_data_line(node),_synctex_data_mean_line(node),_synctex_data_weight(node));
- printf(",%i",0);
+ printf(",%i",_synctex_data_column(node));
printf(":%i",_synctex_data_h(node));
printf(",%i",_synctex_data_v(node));
printf(":%i",_synctex_data_width(node));
@@ -4634,8 +4681,6 @@ static synctex_status_t _synctex_make_hbox_contain_box(synctex_node_p node,synct
# define SYNCTEX_CHAR_CHARACTER 'c'
# define SYNCTEX_CHAR_COMMENT '%'
-# define SYNCTEX_RETURN(STATUS) return STATUS;
-
# ifdef SYNCTEX_NOTHING
# pragma mark -
# pragma mark SCANNERS & PARSERS
@@ -4663,7 +4708,8 @@ static synctex_ns_s _synctex_parse_new_sheet(synctex_scanner_p scanner) {
while ((next_sheet = __synctex_tree_sibling(last_sheet))) {
last_sheet = next_sheet;
}
- __synctex_tree_set_sibling(last_sheet,node); /* sheets have no parent */
+ /* sheets have no parent */
+ __synctex_tree_set_sibling(last_sheet,node);
} else {
scanner->sheet = node;
}
@@ -4934,6 +4980,55 @@ SYNCTEX_INLINE static synctex_node_p _synctex_input_register_line(synctex_node_p
return input;
}
/**
+ * Free node and its siblings and return its detached child.
+ */
+SYNCTEX_INLINE static synctex_node_p _synctex_handle_pop_child(synctex_node_p handle) {
+ synctex_node_p child = _synctex_tree_reset_child(handle);
+ synctex_node_free(handle);
+ return child;
+}
+/**
+ * Set the tlc of all the x nodes that are targets of
+ * x_handle and its sibling.
+ * Reset the target of x_handle and deletes its siblings.
+ * child is a node that has just been parsed and is not a boundary node.
+ */
+SYNCTEX_INLINE static void _synctex_handle_set_tlc(synctex_node_p x_handle, synctex_node_p child, synctex_bool_t make_friend) {
+ if (x_handle) {
+ synctex_node_p sibling = x_handle;
+ if (child) {
+ synctex_node_p target;
+ while ((target = synctex_node_target(sibling))) {
+ _synctex_data_set_tlc(target,child);
+ if (make_friend) {
+ _synctex_node_make_friend_tlc(target);
+ }
+ if ((sibling = __synctex_tree_sibling(sibling))) {
+ continue;
+ } else {
+ break;
+ }
+ }
+ }
+ _synctex_tree_reset_target(x_handle);
+ sibling = __synctex_tree_reset_sibling(x_handle);
+ synctex_node_free(sibling);
+ }
+}
+/**
+ * When we have parsed a box, we must register
+ * all the contained heading boundary nodes
+ * that have not yet been registered.
+ * Those handles will be deleted when poping.
+ */
+SYNCTEX_INLINE static void _synctex_handle_make_friend_tlc(synctex_node_p node) {
+ while (node) {
+ synctex_node_p target = _synctex_tree_reset_target(node);
+ _synctex_node_make_friend_tlc(target);
+ node = __synctex_tree_sibling(node);
+ }
+}
+/**
* Scan sheets, forms and input records.
* - parameter scanner: owning scanner
* - returns: status
@@ -4946,10 +5041,27 @@ static synctex_status_t __synctex_parse_sfi(synctex_scanner_p scanner) {
synctex_node_p form = NULL;
synctex_node_p parent = NULL;
synctex_node_p child = NULL;
+ /*
+ * Experimentations lead to the forthcoming conclusion:
+ * Sometimes, the first nodes of a box have the wrong line number.
+ * These are only boundary (x) nodes.
+ * We observed that boundary nodes do have the proper line number
+ * if they follow a node with a different type.
+ * We keep track of these leading x nodes in a handle tree.
+ */
+ synctex_node_p x_handle = NULL;
+# define SYNCTEX_RETURN(STATUS) \
+ synctex_node_free(x_handle);\
+ return STATUS
+ synctex_node_p last_k = NULL;
+ synctex_node_p last_g = NULL;
synctex_ns_s ns = SYNCTEX_NS_NULL;
int form_depth = 0;
int ignored_form_depth = 0;
synctex_bool_t try_input = synctex_YES;
+ if (!(x_handle = _synctex_new_handle(scanner))) {
+ SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
+ }
# ifdef SYNCTEX_NOTHING
# pragma mark MAIN LOOP
# endif
@@ -4976,9 +5088,11 @@ main_loop:
form = ns.node;
parent = form;
child = NULL;
+ last_k = last_g = NULL;
goto content_loop;
}
if (form || sheet) {
+ last_k = last_g = NULL;
goto content_loop;
}
try_input = synctex_YES;
@@ -4992,6 +5106,7 @@ main_loop:
if (ns.status == SYNCTEX_STATUS_OK) {
sheet = ns.node;
parent = sheet;
+ last_k = last_g = NULL;
goto content_loop;
}
goto main_loop;
@@ -5006,6 +5121,7 @@ main_loop:
SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
}
if (form || sheet) {
+ last_k = last_g = NULL;
goto content_loop;
}
try_input = synctex_YES;
@@ -5031,11 +5147,11 @@ main_loop:
status = _synctex_match_string(scanner,"Postamble:");
if (status==SYNCTEX_STATUS_OK) {
scanner->flags.postamble = 1;
- return status;
+ SYNCTEX_RETURN(status);
}
status = _synctex_next_line(scanner);
if (status<SYNCTEX_STATUS_OK) {
- return status;
+ SYNCTEX_RETURN(status);
}
}
/* At least 1 more character */
@@ -5071,6 +5187,7 @@ ignore_loop:
if (ignored_form_depth) {
goto ignore_loop;
} else {
+ last_k = last_g = NULL;
goto content_loop;
}
@@ -5103,6 +5220,7 @@ content_loop:
# endif
ns = _synctex_parse_new_vbox(scanner);
if (ns.status == SYNCTEX_STATUS_OK) {
+ x_handle = _synctex_new_handle_with_child(x_handle);
if (child) {
_synctex_node_set_sibling(child,ns.node);
} else {
@@ -5114,6 +5232,7 @@ content_loop:
synctex_node_log(parent);
# endif
input.node = _synctex_input_register_line(input.node,parent);
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(END_VBOX)) {
@@ -5128,6 +5247,11 @@ content_loop:
}
child = parent;
parent = _synctex_tree_parent(child);
+ if (!form) {
+ _synctex_handle_make_friend_tlc(x_handle);
+ }
+ x_handle = _synctex_handle_pop_child(x_handle);
+ _synctex_handle_set_tlc(x_handle,child,!form);
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
@@ -5135,6 +5259,7 @@ content_loop:
_synctex_error("Uncomplete container.");
SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
}
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(BEGIN_HBOX)) {
@@ -5147,6 +5272,7 @@ content_loop:
# endif
ns = _synctex_parse_new_hbox(scanner);
if (ns.status == SYNCTEX_STATUS_OK) {
+ x_handle = _synctex_new_handle_with_child(x_handle);
if (child) {
_synctex_node_set_sibling(child,ns.node);
} else {
@@ -5160,10 +5286,7 @@ content_loop:
child->char_index=char_index;
# endif
_synctex_node_set_child(parent,child);
- _synctex_data_set_tag(child,_synctex_data_tag(parent));
- _synctex_data_set_line(child,_synctex_data_line(parent));
- _synctex_data_set_h(child,_synctex_data_h(parent));
- _synctex_data_set_v(child,_synctex_data_v(parent));
+ _synctex_data_set_tlchv(child,parent);
if (!form) {
__synctex_node_make_friend_tlc(child);
}
@@ -5174,6 +5297,7 @@ content_loop:
synctex_node_log(parent);
# endif
input.node = _synctex_input_register_line(input.node,parent);
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(END_HBOX)) {
@@ -5182,14 +5306,14 @@ content_loop:
# pragma mark + SCAN XOBH
# endif
++SYNCTEX_CUR;
+ /* setting the next horizontal box at the end ensures
+ * that a child is recorded before any of its ancestors.
+ */
+ if (form == NULL /* && sheet != NULL*/ ) {
+ _synctex_tree_set_next_hbox(parent,_synctex_tree_next_hbox(sheet));
+ _synctex_tree_set_next_hbox(sheet,parent);
+ }
{
- /* setting the next horizontal box at the end ensures
- * that a child is recorded before any of its ancestors.
- */
- if (form == NULL /* && sheet != NULL*/ ) {
- _synctex_tree_set_next_hbox(parent,_synctex_tree_next_hbox(sheet));
- _synctex_tree_set_next_hbox(sheet,parent);
- }
/* Update the mean line number */
synctex_node_p node = _synctex_tree_child(parent);
synctex_node_p sibling = NULL;
@@ -5230,8 +5354,7 @@ content_loop:
while (synctex_node_type(N) == synctex_node_type_ref) {
N = _synctex_tree_arg_sibling(N);
}
- _synctex_data_set_tag(sibling,_synctex_data_tag(N));
- _synctex_data_set_line(sibling,_synctex_data_line(N));
+ _synctex_data_set_tlc(sibling,N);
}
_synctex_data_set_h(sibling,_synctex_data_h_V(parent)+_synctex_data_width_V(parent));
_synctex_data_set_v(sibling,_synctex_data_v_V(parent));
@@ -5241,9 +5364,26 @@ content_loop:
}
sibling = _synctex_tree_child(parent);
_synctex_data_set_point(sibling,_synctex_data_point_V(parent));
+ if (last_k && last_g && (child = synctex_node_child(parent))) {
+ /* Find the node preceeding last_k */
+ synctex_node_p next;
+ while ((next = __synctex_tree_sibling(child))) {
+ if (next == last_k) {
+ _synctex_data_set_tlc(last_k,child);
+ _synctex_data_set_tlc(last_g,child);
+ break;
+ }
+ child = next;
+ }
+ }
child = parent;
parent = _synctex_tree_parent(child);
- _synctex_make_hbox_contain_box(parent,_synctex_data_box_V(child));
+ if (!form) {
+ _synctex_handle_make_friend_tlc(x_handle);
+ }
+ x_handle = _synctex_handle_pop_child(x_handle);
+ _synctex_handle_set_tlc(x_handle,child,!form);
+ _synctex_make_hbox_contain_box(parent, _synctex_data_box_V(child));
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
@@ -5252,6 +5392,7 @@ content_loop:
_synctex_error("Uncomplete container.");
SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
}
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(VOID_VBOX)) {
@@ -5266,10 +5407,12 @@ content_loop:
_synctex_node_set_child(parent,ns.node);
}
child = ns.node;
+ _synctex_handle_set_tlc(x_handle, child,!form);
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
input.node = _synctex_input_register_line(input.node,child);
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(VOID_HBOX)) {
@@ -5287,11 +5430,13 @@ content_loop:
_synctex_node_set_child(parent,ns.node);
}
child = ns.node;
+ _synctex_handle_set_tlc(x_handle, child,!form);
_synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
input.node = _synctex_input_register_line(input.node,child);
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(KERN)) {
@@ -5310,11 +5455,14 @@ content_loop:
if (!form) {
__synctex_node_make_friend_tlc(child);
}
+ _synctex_handle_set_tlc(x_handle, child,!form);
_synctex_make_hbox_contain_box(parent,_synctex_data_xob(child));
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
input.node = _synctex_input_register_line(input.node,child);
+ last_k = child;
+ last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(GLUE)) {
@@ -5332,11 +5480,17 @@ content_loop:
if (!form) {
__synctex_node_make_friend_tlc(child);
}
+ _synctex_handle_set_tlc(x_handle, child,!form);
_synctex_make_hbox_contain_point(parent,_synctex_data_point(child));
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
input.node = _synctex_input_register_line(input.node,child);
+ if (last_k) {
+ last_g = child;
+ } else {
+ last_k = last_g = NULL;
+ }
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(RULE)) {
@@ -5354,6 +5508,7 @@ content_loop:
if (!form) {
__synctex_node_make_friend_tlc(child);
}
+ _synctex_handle_set_tlc(x_handle, child,!form);
/* Rules are sometimes far too big
_synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
*/
@@ -5361,6 +5516,7 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
synctex_node_log(child);
# endif
input.node = _synctex_input_register_line(input.node,child);
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(MATH)) {
@@ -5378,11 +5534,13 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
if (!form) {
__synctex_node_make_friend_tlc(child);
}
+ _synctex_handle_set_tlc(x_handle, child,!form);
_synctex_make_hbox_contain_point(parent,_synctex_data_point(child));
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
input.node = _synctex_input_register_line(input.node,child);
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(FORM_REF)) {
@@ -5415,6 +5573,7 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(BOUNDARY)) {
@@ -5428,15 +5587,23 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
} else {
_synctex_node_set_child(parent,ns.node);
}
- child = ns.node;
- if (!form) {
- __synctex_node_make_friend_tlc(child);
+ if (synctex_node_type(child)==synctex_node_type_box_bdry
+ || _synctex_tree_target(x_handle)) {
+ child = _synctex_tree_reset_child(x_handle);
+ child = _synctex_new_handle_with_child(child);
+ __synctex_tree_set_sibling(child, x_handle);
+ x_handle = child;
+ _synctex_tree_set_target(x_handle,ns.node);
+ } else if (!form) {
+ __synctex_node_make_friend_tlc(ns.node);
}
+ child = ns.node;
_synctex_make_hbox_contain_point(parent,_synctex_data_point(child));
# if SYNCTEX_VERBOSE
synctex_node_log(child);
# endif
input.node = _synctex_input_register_line(input.node,child);
+ last_k = last_g = NULL;
goto content_loop;
}
} else if (SYNCTEX_START_SCAN(CHARACTER)) {
@@ -5448,6 +5615,7 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
_synctex_error("Missing end of container.");
SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
}
+ last_k = last_g = NULL;
goto content_loop;
} else if (SYNCTEX_START_SCAN(ANCHOR)) {
# ifdef SYNCTEX_NOTHING
@@ -5476,7 +5644,7 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
if (_synctex_next_line(scanner)<SYNCTEX_STATUS_OK
&& (form_depth || sheet)) {
_synctex_error("Missing end of container.");
- return SYNCTEX_STATUS_ERROR;
+ SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
}
if ((parent = _synctex_tree_parent(form))) {
_synctex_tree_reset_parent(form);
@@ -5497,6 +5665,7 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
_synctex_error("Missing end of sheet/form.");
SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
}
+ last_k = last_g = NULL;
goto content_loop;
}
zs = _synctex_buffer_get_available_size(scanner,1);
@@ -5504,8 +5673,10 @@ _synctex_make_hbox_contain_box(parent,_synctex_data_box(child));
_synctex_error("Uncomplete synctex file, postamble missing.");
SYNCTEX_RETURN(SYNCTEX_STATUS_ERROR);
}
+ last_k = last_g = NULL;
goto content_loop;
}
+#undef SYNCTEX_RETURN
/**
* Replace ref in its tree hierarchy by a single box
* proxy to the contents of the associated form.
@@ -7072,10 +7243,16 @@ synctex_iterator_p synctex_iterator_new_edit(synctex_scanner_p scanner,int page,
if ((_synctex_data_tag(nds.r.node)!=_synctex_data_tag(nds.l.node))
|| (_synctex_data_line(nds.r.node)!=_synctex_data_line(nds.l.node))
|| (_synctex_data_column(nds.r.node)!=_synctex_data_column(nds.l.node))) {
- if (nds.l.distance>nds.r.distance) {
+ if (_synctex_data_line(nds.r.node)<_synctex_data_line(nds.l.node)) {
node = nds.r.node;
nds.r.node = nds.l.node;
nds.l.node = node;
+ } else if (_synctex_data_line(nds.r.node)==_synctex_data_line(nds.l.node)) {
+ if (nds.l.distance>nds.r.distance) {
+ node = nds.r.node;
+ nds.r.node = nds.l.node;
+ nds.l.node = node;
+ }
}
if((node = _synctex_new_handle_with_target(nds.l.node))) {
synctex_node_p other_handle;
@@ -7887,7 +8064,10 @@ SYNCTEX_INLINE static synctex_nd_lr_s __synctex_eq_get_closest_children_in_hbox_
}
} else if (childd.distance == 0) {
/* hit point is inside node. */
- return _synctex_eq_get_closest_children_in_box_v2(hitP, childd.node);
+ if (_synctex_tree_child(childd.node)) {
+ return _synctex_eq_get_closest_children_in_box_v2(hitP, childd.node);
+ }
+ nds.l = childd;
} else { /* here childd.distance < 0, the hit point is to the right of node */
childd.distance = -childd.distance;
if (nds.l.distance > childd.distance) {
@@ -8175,17 +8355,17 @@ static int _synctex_updater_print(synctex_updater_p updater, const char * format
#include <stdarg.h>
static int vasprintf(char **ret,
- const char *format,
- va_list ap)
+ const char *format,
+ va_list ap)
{
- int len;
- len = _vsnprintf(NULL, 0, format, ap);
- if (len < 0) return -1;
- *ret = malloc(len + 1);
- if (!*ret) return -1;
- _vsnprintf(*ret, len+1, format, ap);
- (*ret)[len] = '\0';
- return len;
+ int len;
+ len = _vsnprintf(NULL, 0, format, ap);
+ if (len < 0) return -1;
+ *ret = malloc(len + 1);
+ if (!*ret) return -1;
+ _vsnprintf(*ret, len+1, format, ap);
+ (*ret)[len] = '\0';
+ return len;
}
#endif
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.h b/Build/source/texk/web2c/synctexdir/synctex_parser.h
index 65cc181a213..3d58885efb5 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser.h
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser.h
@@ -50,12 +50,12 @@
#ifndef __SYNCTEX_PARSER__
# define __SYNCTEX_PARSER__
+#include "synctex_version.h"
+
#ifdef __cplusplus
extern "C" {
#endif
-# define SYNCTEX_VERSION_STRING "1.19"
-
/* The main synctex object is a scanner.
* Its implementation is considered private.
* The basic workflow is
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_utils.h b/Build/source/texk/web2c/synctexdir/synctex_parser_utils.h
index 0f645511e29..f276b3c5b17 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser_utils.h
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser_utils.h
@@ -46,6 +46,8 @@ authorization from the copyright holder.
* The problem mainly comes from file name management: path separator, encoding...
*/
+#include "synctex_version.h"
+
typedef int synctex_bool_t;
# define synctex_YES (0==0)
# define synctex_NO (0==1)
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt b/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt
index bc4493477ae..5fb5a6b4f54 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt
@@ -1 +1 @@
-1.19
+1.20
diff --git a/Build/source/texk/web2c/synctexdir/synctex_version.h b/Build/source/texk/web2c/synctexdir/synctex_version.h
new file mode 100644
index 00000000000..2f460558df6
--- /dev/null
+++ b/Build/source/texk/web2c/synctexdir/synctex_version.h
@@ -0,0 +1,59 @@
+/*
+Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
+
+This file is part of the __SyncTeX__ package.
+
+[//]: # (Latest Revision: Fri Jul 14 16:20:41 UTC 2017)
+[//]: # (Version: 1.20)
+
+See `synctex_parser_readme.md` for more details
+
+## License
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE
+
+Except as contained in this notice, the name of the copyright holder
+shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in this Software without prior written
+authorization from the copyright holder.
+
+## Acknowledgments:
+
+The author received useful remarks from the __pdfTeX__ developers, especially Hahn The Thanh,
+and significant help from __XeTeX__ developer Jonathan Kew.
+
+## Nota Bene:
+
+If you include or use a significant part of the __SyncTeX__ package into a software,
+I would appreciate to be listed as contributor and see "__SyncTeX__" highlighted.
+*/
+
+#ifndef __SYNCTEX_VERSION__
+# define __SYNCTEX_VERSION__
+
+# define SYNCTEX_VERSION_MAJOR 1
+
+# define SYNCTEX_VERSION_STRING "1.20"
+
+# define SYNCTEX_CLI_VERSION_STRING "1.5"
+
+#endif