Revision: 14166
          http://sourceforge.net/p/skim-app/code/14166
Author:   hofman
Date:     2024-04-02 14:57:03 +0000 (Tue, 02 Apr 2024)
Log Message:
-----------
move synctex source files back to .c files

Modified Paths:
--------------
    trunk/Skim.xcodeproj/project.pbxproj

Added Paths:
-----------
    trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.c
    trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_utils.c

Removed Paths:
-------------
    trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.m
    trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_utils.m

Modified: trunk/Skim.xcodeproj/project.pbxproj
===================================================================
--- trunk/Skim.xcodeproj/project.pbxproj        2024-04-02 14:41:20 UTC (rev 
14165)
+++ trunk/Skim.xcodeproj/project.pbxproj        2024-04-02 14:57:03 UTC (rev 
14166)
@@ -105,7 +105,7 @@
                CE31A6180C01FC45003612A9 /* SKDocumentController.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CE31A6160C01FC45003612A9 /* 
SKDocumentController.m */; };
                CE32531F0F4723EA0021BADD /* SKMainWindowController_Actions.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CE32531E0F4723EA0021BADD /* 
SKMainWindowController_Actions.m */; };
                CE325592226F73810032390F /* SKAnnotationTypeImageView.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CE325591226F73810032390F /* 
SKAnnotationTypeImageView.m */; };
-               CE3364310E2761E9005F99E6 /* synctex_parser.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE33639F0E26E120005F99E6 /* synctex_parser.m */; 
};
+               CE3364310E2761E9005F99E6 /* synctex_parser.c in Sources */ = 
{isa = PBXBuildFile; fileRef = CE33639F0E26E120005F99E6 /* synctex_parser.c */; 
};
                CE3364320E2761EF005F99E6 /* libz.dylib in Frameworks */ = {isa 
= PBXBuildFile; fileRef = CE3363CD0E26E378005F99E6 /* libz.dylib */; };
                CE3366DF0E28BCFA005F99E6 /* SKPDFSyncRecord.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE3366DE0E28BCFA005F99E6 /* SKPDFSyncRecord.m 
*/; };
                CE3400AC0E0034DF00A7FFE6 /* NSMenu_SKExtensions.m in Sources */ 
= {isa = PBXBuildFile; fileRef = CE3400AB0E0034DF00A7FFE6 /* 
NSMenu_SKExtensions.m */; };
@@ -215,7 +215,7 @@
                CE8DC47124620A7E00BD5D50 /* Metal.framework in Frameworks */ = 
{isa = PBXBuildFile; fileRef = CE8DC46F24620A7E00BD5D50 /* Metal.framework */; 
settings = {ATTRIBUTES = (Required, ); }; };
                CE8DEF0820D2702A00A10FFE /* NSDate_SKExtensions.m in Sources */ 
= {isa = PBXBuildFile; fileRef = CE8DEF0720D2702A00A10FFE /* 
NSDate_SKExtensions.m */; };
                CE91C7962449F56600D04039 /* SKFileShare.m in Sources */ = {isa 
= PBXBuildFile; fileRef = CE91C7952449F56600D04039 /* SKFileShare.m */; };
-               CE94D17B125535DE0053A520 /* synctex_parser_utils.m in Sources 
*/ = {isa = PBXBuildFile; fileRef = CE94D17A125535DE0053A520 /* 
synctex_parser_utils.m */; };
+               CE94D17B125535DE0053A520 /* synctex_parser_utils.c in Sources 
*/ = {isa = PBXBuildFile; fileRef = CE94D17A125535DE0053A520 /* 
synctex_parser_utils.c */; };
                CE9768831161195C008DCB8F /* SKDownloadPreferenceController.m in 
Sources */ = {isa = PBXBuildFile; fileRef = CE9768821161195C008DCB8F /* 
SKDownloadPreferenceController.m */; };
                CE9768A211611C0F008DCB8F /* DownloadPreferenceSheet.strings in 
Resources */ = {isa = PBXBuildFile; fileRef = CE9768A011611C0F008DCB8F /* 
DownloadPreferenceSheet.strings */; };
                CE9B804A1030642400EA8774 /* SKTransitionInfo.m in Sources */ = 
{isa = PBXBuildFile; fileRef = CE9B80491030642400EA8774 /* SKTransitionInfo.m 
*/; };
@@ -895,7 +895,7 @@
                CE32531E0F4723EA0021BADD /* SKMainWindowController_Actions.m */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = SKMainWindowController_Actions.m; sourceTree = 
"<group>"; };
                CE325590226F73810032390F /* SKAnnotationTypeImageView.h */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = 
SKAnnotationTypeImageView.h; sourceTree = "<group>"; };
                CE325591226F73810032390F /* SKAnnotationTypeImageView.m */ = 
{isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = 
SKAnnotationTypeImageView.m; sourceTree = "<group>"; };
-               CE33639F0E26E120005F99E6 /* synctex_parser.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= synctex_parser.m; sourceTree = "<group>"; };
+               CE33639F0E26E120005F99E6 /* synctex_parser.c */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = 
synctex_parser.c; sourceTree = "<group>"; };
                CE3363A00E26E120005F99E6 /* synctex_parser.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
synctex_parser.h; sourceTree = "<group>"; };
                CE3363CD0E26E378005F99E6 /* libz.dylib */ = {isa = 
PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = 
libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
                CE3366DD0E28BCFA005F99E6 /* SKPDFSyncRecord.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
SKPDFSyncRecord.h; sourceTree = "<group>"; };
@@ -1101,7 +1101,7 @@
                CE91C7942449F56600D04039 /* SKFileShare.h */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SKFileShare.h; 
sourceTree = "<group>"; };
                CE91C7952449F56600D04039 /* SKFileShare.m */ = {isa = 
PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SKFileShare.m; 
sourceTree = "<group>"; };
                CE94D179125535DE0053A520 /* synctex_parser_utils.h */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = 
synctex_parser_utils.h; sourceTree = "<group>"; };
-               CE94D17A125535DE0053A520 /* synctex_parser_utils.m */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path 
= synctex_parser_utils.m; sourceTree = "<group>"; };
+               CE94D17A125535DE0053A520 /* synctex_parser_utils.c */ = {isa = 
PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = 
synctex_parser_utils.c; sourceTree = "<group>"; };
                CE9768811161195C008DCB8F /* SKDownloadPreferenceController.h */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.h; path = SKDownloadPreferenceController.h; sourceTree = 
"<group>"; };
                CE9768821161195C008DCB8F /* SKDownloadPreferenceController.m */ 
= {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = 
sourcecode.c.objc; path = SKDownloadPreferenceController.m; sourceTree = 
"<group>"; };
                CE9768A111611C0F008DCB8F /* en */ = {isa = PBXFileReference; 
fileEncoding = 10; lastKnownFileType = text.plist.strings; name = en; path = 
en.lproj/DownloadPreferenceSheet.strings; sourceTree = "<group>"; };
@@ -2000,9 +2000,9 @@
                        isa = PBXGroup;
                        children = (
                                CE3363A00E26E120005F99E6 /* synctex_parser.h */,
-                               CE33639F0E26E120005F99E6 /* synctex_parser.m */,
+                               CE33639F0E26E120005F99E6 /* synctex_parser.c */,
                                CE94D179125535DE0053A520 /* 
synctex_parser_utils.h */,
-                               CE94D17A125535DE0053A520 /* 
synctex_parser_utils.m */,
+                               CE94D17A125535DE0053A520 /* 
synctex_parser_utils.c */,
                                CE2EF6852022753D004A73D8 /* 
synctex_parser_advanced.h */,
                                CE2EF68D2022753D004A73D8 /* synctex_version.h 
*/,
                                CEE7B7451F7A84E800004238 /* 
synctex_parser_local.h */,
@@ -2912,7 +2912,7 @@
                                CEDC7B1A2913CD2500032269 /* SKLoupeController.m 
in Sources */,
                                CE3401E60E01388700A7FFE6 /* 
NSNumber_SKExtensions.m in Sources */,
                                CEC3AD240E23EC0300F40B0B /* 
PDFAnnotationLink_SKExtensions.m in Sources */,
-                               CE3364310E2761E9005F99E6 /* synctex_parser.m in 
Sources */,
+                               CE3364310E2761E9005F99E6 /* synctex_parser.c in 
Sources */,
                                CE3366DF0E28BCFA005F99E6 /* SKPDFSyncRecord.m 
in Sources */,
                                CEC29536275A7D58000F2D4C /* 
SKPreferencesCommand.m in Sources */,
                                CE09FC3C0E3886C100BDF413 /* SKRuntime.m in 
Sources */,
@@ -2954,7 +2954,7 @@
                                CE121AC81180644A00951425 /* SKScriptMenu.m in 
Sources */,
                                CEFDEA9111F6FF8300D6FEBA /* 
NSScreen_SKExtensions.m in Sources */,
                                CE1C77B6123FB41E00C73F1A /* SKNoteTextView.m in 
Sources */,
-                               CE94D17B125535DE0053A520 /* 
synctex_parser_utils.m in Sources */,
+                               CE94D17B125535DE0053A520 /* 
synctex_parser_utils.c in Sources */,
                                CE1D798F129FE44E00EA3AF0 /* 
NSScriptCommand_SKExtensions.m in Sources */,
                                CE4E1E9A12BCFF5A005227ED /* HIDRemote.m in 
Sources */,
                                CE171E3512C3AC1600291179 /* 
SKFileUpdateChecker.m in Sources */,

Copied: trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.c (from rev 
14165, trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.m)
===================================================================
--- trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.c               
                (rev 0)
+++ trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.c       
2024-04-02 14:57:03 UTC (rev 14166)
@@ -0,0 +1,9193 @@
+/*
+ Copyright (c) 2008-2024 jerome DOT laurens AT u-bourgogne DOT fr
+ 
+ This file is part of the __SyncTeX__ package.
+ 
+ Version: see synctex_version.h
+ Latest Revision: Thu Mar 21 14:12:58 UTC 2024
+
+ 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.
+ 
+ */
+
+/*  We assume that high level application like pdf viewers will want
+ *  to embed this code as is. We assume that they also have locale.h and 
setlocale.
+ *  For other tools such as TeXLive tools, you must define 
SYNCTEX_USE_LOCAL_HEADER,
+ *  when building. You also have to create and customize 
synctex_parser_local.h to fit your system.
+ *  In particular, the HAVE_LOCALE_H and HAVE_SETLOCALE macros should be 
properly defined.
+ *  With this design, you should not need to edit this file. */
+
+/**
+ * @file synctex_parser.c
+ * @brief SyncTeX file parser and controller.
+ * @author: Jérôme LAURENS
+ * @version 1.22
+ * @date Tue Mar  5 21:16:33 UTC 2024
+ *
+ * Reads and parse *.synctex[.gz] files,
+ * performs edit and display queries.
+ *
+ *  See
+ *  - synctex_scanner_new_with_output_file
+ *  - synctex_scanner_parse
+ *  - synctex_scanner_free
+ *  - synctex_display_query
+ *  - synctex_edit_query
+ *  - synctex_scanner_next_result
+ *  - synctex_scanner_reset_result
+ *
+ *  The data is organized in a graph with multiple entries.
+ *  The root object is a scanner, it is created with the contents on a synctex 
file.
+ *  Each node of the tree is a private `_synctex_node_t` object.
+ *  There are 3 subtrees, two of them sharing the same leaves.
+ *  The first tree is the list of input records, where input file names are 
associated with tags.
+ *  The second tree is the box tree as given by TeX when shipping pages out.
+ *  First level objects are sheets and forms, containing boxes, glues, kerns...
+ *  The third tree allows to browse leaves according to tag and line.
+ */
+/* Declare _GNU_SOURCE for accessing vasprintf. For MSC compiler, vasprintf is
+ * defined in this file
+ */
+/** @cond */
+#define _GNU_SOURCE
+
+#   if defined(SYNCTEX_USE_LOCAL_HEADER)
+#       include "synctex_parser_local.h"
+#   else
+#       define HAVE_LOCALE_H 1
+#       define HAVE_SETLOCALE 1
+#       if defined(_MSC_VER)
+#          define SYNCTEX_INLINE __inline
+#       else
+#          define SYNCTEX_INLINE inline
+#       endif
+#   endif
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <limits.h>
+
+#if defined(HAVE_LOCALE_H)
+#include <locale.h>
+#endif
+
+/* Mark unused parameters, so that there will be no compile warnings. */
+#ifdef __DARWIN_UNIX03
+#   define SYNCTEX_UNUSED(x) SYNCTEX_PRAGMA(unused(x))
+#   define SYNCTEX_PRAGMA(x) _Pragma ( #x )
+#else
+#   define SYNCTEX_UNUSED(x) (void)(x);
+#endif
+
+#include "synctex_parser_advanced.h"
+
+SYNCTEX_INLINE static int _synctex_abs(int x) {
+    return x>0? x: -x;
+}
+
+/** @endcond */
+
+/*  These are the possible extensions of the synctex file */
+/**
+ * @brief Extension of uncompressed synctex file
+ */
+const char * synctex_suffix = ".synctex";
+/**
+ * @brief Extension of compressed synctex file
+ */
+const char * synctex_suffix_gz = ".gz";
+
+/** @cond */
+
+typedef synctex_node_p(*_synctex_node_new_f)(synctex_scanner_p);
+typedef void(*_synctex_node_fld_f)(synctex_node_p);
+typedef char *(*_synctex_node_str_f)(synctex_node_p);
+
+/**
+ * @brief A tree model structure
+ * @author: Jérôme LAURENS
+ * 
+ * 8 fields + size: `spcflnat` referring to the first letters of each field.
+ */
+typedef struct synctex_tree_model_t {
+    /** A sibling node, if any */
+    int sibling;
+    /** The parent node, if any */
+    int parent;
+    /** The first child node, if any */
+    int child;
+    /** The first friend node, if any */
+    int friend;
+    /** The last node, if any */
+    int last;
+    /** The next hbox node, if any */
+    int next_hbox;
+    /** Undocumented */
+    int arg_sibling;
+    /** Undocumented */
+    int target;
+    /** Undocumented */
+    int size;
+} _synctex_tree_model_s;
+/**
+ * @brief A pointer to a constant tree model structure
+ * @author: Jérôme LAURENS
+ */
+typedef const _synctex_tree_model_s * _synctex_tree_model_p;
+
+typedef struct _synctex_data_model_t {
+    int tag;
+    int line;
+    int column;
+    int h;
+    int v;
+    int width;
+    int height;
+    int depth;
+    int mean_line;
+    int weight;
+    int h_V;
+    int v_V;
+    int width_V;
+    int height_V;
+    int depth_V;
+    int name;
+    int page;
+    int size;
+} _synctex_data_model_s;
+
+/**
+ * @brief A pointer to a constant data model structure
+ * @author: Jérôme LAURENS
+ */
+typedef const _synctex_data_model_s * _synctex_data_model_p;
+
+/**
+ * @brief node -> integer function type
+ * @author: Jérôme LAURENS
+ * 
+ */
+typedef int (*_synctex_int_getter_f)(synctex_node_p);
+
+/**
+ * @brief tlc inspector structure
+ * 
+ */
+typedef struct synctex_tlcpector_t {
+    /** tag getter */
+    _synctex_int_getter_f tag;
+    /** line getter */
+    _synctex_int_getter_f line;
+    /** column getter */
+    _synctex_int_getter_f column;
+} _synctex_tlcpector_s;
+typedef const _synctex_tlcpector_s * _synctex_tlcpector_p;
+static int _synctex_int_none(synctex_node_p node) {
+    SYNCTEX_UNUSED(node)
+    return 0;
+}
+static const _synctex_tlcpector_s synctex_tlcpector_none = {
+    &_synctex_int_none, /* tag */
+    &_synctex_int_none, /* line */
+    &_synctex_int_none, /* column */
+};
+
+/**
+ * @brief Geometry inspector structure
+ * 
+ */
+typedef struct _synctex_inspector_t {
+    /** h getter */
+    _synctex_int_getter_f h;
+    /** v getter */
+    _synctex_int_getter_f v;
+    /** width getter */
+    _synctex_int_getter_f width;
+    /** height getter */
+    _synctex_int_getter_f height;
+    /** depth getter */
+    _synctex_int_getter_f depth;
+} _synctex_inspector_s;
+typedef const _synctex_inspector_s * _synctex_inspector_p;
+static const _synctex_inspector_s synctex_inspector_none = {
+    &_synctex_int_none, /* h */
+    &_synctex_int_none, /* v */
+    &_synctex_int_none, /* width */
+    &_synctex_int_none, /* height */
+    &_synctex_int_none, /* depth */
+};
+
+typedef float (*_synctex_float_getter_f)(synctex_node_p);
+/**
+ * @brief vi inspector data structure.
+ * 
+ */
+typedef struct _synctex_vispector_t {
+    /** h attribute getter */
+    _synctex_float_getter_f h;
+    /** v attribute getter */
+    _synctex_float_getter_f v;
+    /** width attribute getter */
+    _synctex_float_getter_f width;
+    /** height attribute getter */
+    _synctex_float_getter_f height;
+    /** depth attribute getter */
+    _synctex_float_getter_f depth;
+} _synctex_vispector_s;
+static float _synctex_float_none(synctex_node_p node) {
+    SYNCTEX_UNUSED(node)
+    return 0;
+}
+static const _synctex_vispector_s synctex_vispector_none = {
+    &_synctex_float_none, /* h */
+    &_synctex_float_none, /* v */
+    &_synctex_float_none, /* width */
+    &_synctex_float_none, /* height */
+    &_synctex_float_none, /* depth */
+};
+typedef const _synctex_vispector_s * _synctex_vispector_p;
+
+struct _synctex_class_t {
+    synctex_scanner_p scanner;
+    synctex_node_type_t type;
+    _synctex_node_new_f new;
+    _synctex_node_fld_f free;
+    _synctex_node_fld_f log;
+    _synctex_node_fld_f display;
+    _synctex_node_str_f abstract;
+    _synctex_tree_model_p navigator;
+    _synctex_data_model_p modelator;
+    _synctex_tlcpector_p tlcpector;
+    _synctex_inspector_p inspector;
+    _synctex_vispector_p vispector;
+};
+
+/**
+ *  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", well it depends...
+ */
+
+typedef synctex_node_p _synctex_proxy_p;
+typedef synctex_node_p _synctex_noxy_p;
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark Abstract OBJECTS and METHODS
+#   endif
+
+/**
+ *  @def SYNCTEX_MSG_SEND
+ *  @brief Takes care of sending the given message if possible.
+ *  - parameter NODE: of type synctex_node_p
+ *  - parameter SELECTOR: one of the class_ pointer properties
+ */
+#   define SYNCTEX_MSG_SEND(NODE,SELECTOR) do {\
+    synctex_node_p N__ = NODE;\
+    if (N__ && N__->class_->SELECTOR) {\
+        (*(N__->class_->SELECTOR))(N__);\
+    }\
+} while (synctex_NO)
+
+/**
+ *  Free the given node by sending the free message.
+ *  - parameter NODE: of type synctex_node_p
+ */
+static void _synctex_node_free(synctex_node_p node) {
+    SYNCTEX_MSG_SEND(node,free);
+}
+#   if defined(SYNCTEX_TESTING)
+#       if !defined(SYNCTEX_USE_HANDLE)
+#           define SYNCTEX_USE_HANDLE 1
+#       endif
+#       if !defined(SYNCTEX_USE_CHARINDEX)
+#           define SYNCTEX_USE_CHARINDEX 1
+#       endif
+#   endif
+SYNCTEX_INLINE static synctex_node_p 
_synctex_new_handle_with_target(synctex_node_p target);
+#   if defined(SYNCTEX_USE_HANDLE)
+#       define SYNCTEX_SCANNER_FREE_HANDLE(SCANR) \
+__synctex_scanner_free_handle(SCANR)
+#       define SYNCTEX_SCANNER_REMOVE_HANDLE_TO(WHAT) \
+__synctex_scanner_remove_handle_to(WHAT)
+#       define SYNCTEX_REGISTER_HANDLE_TO(NODE) \
+__synctex_scanner_register_handle_to(NODE)
+#   else
+#       define SYNCTEX_SCANNER_FREE_HANDLE(SCANR)
+#       define SYNCTEX_SCANNER_REMOVE_HANDLE_TO(WHAT)
+#       define SYNCTEX_REGISTER_HANDLE_TO(NODE)
+#   endif
+
+#   if defined(SYNCTEX_USE_CHARINDEX)
+#       define SYNCTEX_CHARINDEX(NODE) (NODE->char_index)
+#       define SYNCTEX_LINEINDEX(NODE) (NODE->line_index)
+#       define SYNCTEX_PRINT_CHARINDEX_FMT "#%i"
+#       define SYNCTEX_PRINT_CHARINDEX_WHAT ,SYNCTEX_CHARINDEX(node)
+#       define SYNCTEX_PRINT_CHARINDEX \
+            printf(SYNCTEX_PRINT_CHARINDEX_FMT SYNCTEX_PRINT_CHARINDEX_WHAT)
+#       define SYNCTEX_PRINT_LINEINDEX_FMT "L#%i"
+#       define SYNCTEX_PRINT_LINEINDEX_WHAT ,SYNCTEX_LINEINDEX(node)
+#       define SYNCTEX_PRINT_LINEINDEX \
+            printf(SYNCTEX_PRINT_LINEINDEX_FMT SYNCTEX_PRINT_LINEINDEX_WHAT)
+#       define SYNCTEX_PRINT_CHARINDEX_NL \
+            printf(SYNCTEX_PRINT_CHARINDEX_FMT "\n" 
SYNCTEX_PRINT_CHARINDEX_WHAT)
+#       define SYNCTEX_PRINT_LINEINDEX_NL \
+            printf(SYNCTEX_PRINT_CHARINDEX_FMT 
"\n"SYNCTEX_PRINT_LINEINDEX_WHAT)
+#       define SYNCTEX_IMPLEMENT_CHARINDEX(NODE,CORRECTION)\
+            NODE->char_index = 
(synctex_charindex_t)(scanner->reader->charindex_offset+SYNCTEX_CUR-SYNCTEX_START+(CORRECTION));
 \
+            NODE->line_index = scanner->reader->line_number;
+#   else
+#       define SYNCTEX_CHARINDEX(NODE) 0
+#       define SYNCTEX_LINEINDEX(NODE) 0
+#       define SYNCTEX_PRINT_CHARINDEX_FMT
+#       define SYNCTEX_PRINT_CHARINDEX_WHAT
+#       define SYNCTEX_PRINT_CHARINDEX
+#       define SYNCTEX_PRINT_CHARINDEX
+#       define SYNCTEX_PRINT_LINEINDEX_FMT
+#       define SYNCTEX_PRINT_LINEINDEX_WHAT
+#       define SYNCTEX_PRINT_LINEINDEX
+#       define SYNCTEX_PRINT_CHARINDEX_NL printf("\n")
+#       define SYNCTEX_PRINT_LINEINDEX_NL printf("\n")
+#       define SYNCTEX_IMPLEMENT_CHARINDEX(NODE,CORRECTION)
+#   endif
+
+/**
+ *  The next macros are used to access the node tree info
+ *  SYNCTEX_DATA(node) points to the first synctex integer or pointer data of 
node
+ *  SYNCTEX_DATA(node)[index] is the information at index
+ *  for example, the page of a sheet is stored in 
SYNCTEX_DATA(sheet)[_synctex_data_page_idx]
+ *  - parameter NODE: of type synctex_node_p
+ *  If the name starts with "__", the argument is nonullable
+ */
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark Tree SETGET
+#   endif
+
+#if SYNCTEX_DEBUG > 1000
+#define SYNCTEX_PARAMETER_ASSERT(WHAT) \
+    do { \
+        if (!(WHAT)) { \
+            printf("! Parameter failure: %s\n",#WHAT); \
+        } \
+    } while (synctex_NO)
+#define DEFINE_SYNCTEX_TREE_HAS(WHAT)\
+static synctex_bool_t _synctex_tree_has_##WHAT(synctex_node_p node) {\
+    if (node) {\
+        if (node->class_->navigator->WHAT>=0) {\
+            return synctex_YES; \
+        } else {\
+            printf("WARNING: NO tree %s for %s\n", #WHAT, 
synctex_node_isa(node));\
+        }\
+    }\
+    return synctex_NO;\
+}
+#else
+#   define SYNCTEX_PARAMETER_ASSERT(WHAT)
+#   define DEFINE_SYNCTEX_TREE_HAS(WHAT) \
+SYNCTEX_INLINE static synctex_bool_t _synctex_tree_has_##WHAT(synctex_node_p 
node) {\
+    return (node && (node->class_->navigator->WHAT>=0));\
+}
+#endif
+
+#   define DEFINE_SYNCTEX_TREE__GET(WHAT) \
+SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_##WHAT(synctex_non_null_node_p node) {\
+    return node->data[node->class_->navigator->WHAT].as_node;\
+}
+#   define DEFINE_SYNCTEX_TREE_GET(WHAT) \
+DEFINE_SYNCTEX_TREE__GET(WHAT) \
+SYNCTEX_INLINE static synctex_node_p _synctex_tree_##WHAT(synctex_node_p node) 
{\
+    if (_synctex_tree_has_##WHAT(node)) {\
+        return __synctex_tree_##WHAT(node);\
+    }\
+    return 0;\
+}
+#   define DEFINE_SYNCTEX_TREE__RESET(WHAT) \
+SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_reset_##WHAT(synctex_non_null_node_p node) {\
+    synctex_node_p old = node->data[node->class_->navigator->WHAT].as_node;\
+    node->data[node->class_->navigator->WHAT].as_node=NULL;\
+    return old;\
+}
+#   define DEFINE_SYNCTEX_TREE_RESET(WHAT) \
+DEFINE_SYNCTEX_TREE__RESET(WHAT) \
+SYNCTEX_INLINE static synctex_node_p _synctex_tree_reset_##WHAT(synctex_node_p 
node) {\
+        return _synctex_tree_has_##WHAT(node)? \
+            __synctex_tree_reset_##WHAT(node): NULL; \
+}
+#   define DEFINE_SYNCTEX_TREE__SET(WHAT) \
+SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_set_##WHAT(synctex_non_null_node_p node, synctex_node_p 
new_value) {\
+    synctex_node_p old = __synctex_tree_##WHAT(node);\
+    node->data[node->class_->navigator->WHAT].as_node=new_value;\
+    return old;\
+}
+#   define DEFINE_SYNCTEX_TREE_SET(WHAT) \
+DEFINE_SYNCTEX_TREE__SET(WHAT) \
+SYNCTEX_INLINE static synctex_node_p _synctex_tree_set_##WHAT(synctex_node_p 
node, synctex_node_p new_value) {\
+    return _synctex_tree_has_##WHAT(node)?\
+        __synctex_tree_set_##WHAT(node,new_value):NULL;\
+}
+#   define DEFINE_SYNCTEX_TREE__GETSETRESET(WHAT) \
+DEFINE_SYNCTEX_TREE__GET(WHAT) \
+DEFINE_SYNCTEX_TREE__SET(WHAT) \
+DEFINE_SYNCTEX_TREE__RESET(WHAT)
+
+#   define DEFINE_SYNCTEX_TREE_GETSET(WHAT) \
+DEFINE_SYNCTEX_TREE_HAS(WHAT) \
+DEFINE_SYNCTEX_TREE_GET(WHAT) \
+DEFINE_SYNCTEX_TREE_SET(WHAT)
+
+#   define DEFINE_SYNCTEX_TREE_GETRESET(WHAT) \
+DEFINE_SYNCTEX_TREE_HAS(WHAT) \
+DEFINE_SYNCTEX_TREE_GET(WHAT) \
+DEFINE_SYNCTEX_TREE_RESET(WHAT)
+
+#   define DEFINE_SYNCTEX_TREE_GETSETRESET(WHAT) \
+DEFINE_SYNCTEX_TREE_HAS(WHAT) \
+DEFINE_SYNCTEX_TREE_GET(WHAT) \
+DEFINE_SYNCTEX_TREE_SET(WHAT) \
+DEFINE_SYNCTEX_TREE_RESET(WHAT)
+
+/*
+ *  _synctex_tree_set_... methods return the old value.
+ *  The return value of _synctex_tree_set_child and 
+ *  _synctex_tree_set_sibling must be released somehow.
+ */
+/* The next macro call creates:
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_sibling(synctex_node_p 
node)
+ SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_set_sibling(synctex_node_p node, synctex_node_p new_value)
+ SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_reset_sibling(synctex_node_p node)
+ */
+DEFINE_SYNCTEX_TREE__GETSETRESET(sibling)
+/* The next macro call creates:
+ SYNCTEX_INLINE static synctex_bool_t _synctex_tree_has_parent(synctex_node_p 
node);
+ SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_parent(synctex_non_null_node_p node);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_parent(synctex_node_p 
node);
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_set_parent(synctex_node_p 
node, synctex_node_p new_value);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_set_parent(synctex_node_p 
node, synctex_node_p new_value);
+ SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_reset_parent(synctex_node_p node);
+ SYNCTEX_INLINE static synctex_node_p 
_synctex_tree_reset_parent(synctex_node_p node);
+ */
+DEFINE_SYNCTEX_TREE_GETSETRESET(parent)
+DEFINE_SYNCTEX_TREE_GETSETRESET(child)
+DEFINE_SYNCTEX_TREE_GETSETRESET(friend)
+/* The next macro call creates:
+ SYNCTEX_INLINE static synctex_bool_t _synctex_tree_has_last(synctex_node_p 
node);
+ SYNCTEX_INLINE static synctex_node_p 
__synctex_tree_last(synctex_non_null_node_p node);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_last(synctex_node_p node);
+ SYNCTEX_INLINE static synctex_node_p __synctex_tree_set_last(synctex_node_p 
node, synctex_node_p new_value);
+ SYNCTEX_INLINE static synctex_node_p _synctex_tree_set_last(synctex_node_p 
node, synctex_node_p new_value);
+ */
+DEFINE_SYNCTEX_TREE_GETSET(last)
+DEFINE_SYNCTEX_TREE_GETSET(next_hbox)
+DEFINE_SYNCTEX_TREE_GETSET(arg_sibling)
+DEFINE_SYNCTEX_TREE_GETSETRESET(target)
+
+#if SYNCTEX_DEBUG > 1000
+#   undef SYNCTEX_USE_NODE_COUNT
+#   define SYNCTEX_USE_NODE_COUNT 1
+#endif
+#if SYNCTEX_USE_NODE_COUNT>0
+#   define SYNCTEX_DECLARE_NODE_COUNT int node_count;
+#   define SYNCTEX_INIT_NODE_COUNT \
+        do { node_count = 0; } while(synctex_NO)
+#else
+#   define SYNCTEX_DECLARE_NODE_COUNT
+#   define SYNCTEX_INIT_NODE_COUNT
+#endif
+
+#if SYNCTEX_USE_NODE_COUNT>10
+#   define SYNCTEX_DID_NEW(N)   _synctex_did_new(N)
+#   define SYNCTEX_WILL_FREE(N) _synctex_will_free(N)
+#else
+#   define SYNCTEX_DID_NEW(N)
+#   define SYNCTEX_WILL_FREE(N)
+#endif
+
+#define SYNCTEX_HAS_CHILDREN(NODE) (NODE && _synctex_tree_child(NODE))
+#      ifdef   SYNCTEX_STANDALONE
+#              include "/usr/local/include/node/zlib.h"
+#      else
+#              include <zlib.h>
+#      endif
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark STATUS
+#   endif
+/*  When the end of the synctex file has been reached: */
+#   define SYNCTEX_STATUS_EOF 0
+/*  When the function could not return the value it was asked for: */
+#   define SYNCTEX_STATUS_NOT_OK (SYNCTEX_STATUS_EOF+1)
+/*  When the function returns the value it was asked for:
+ It must be the biggest one */
+#   define SYNCTEX_STATUS_OK (SYNCTEX_STATUS_NOT_OK+1)
+/*  Generic error: */
+#   define SYNCTEX_STATUS_ERROR (SYNCTEX_STATUS_EOF-1)
+/*  Parameter error: */
+#   define SYNCTEX_STATUS_BAD_ARGUMENT (SYNCTEX_STATUS_ERROR-1)
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark File reader
+#   endif
+
+/*  We ensure that SYNCTEX_BUFFER_SIZE < UINT_MAX, I don't know if it makes 
sense... */
+/*  Actually, the minimum buffer size is driven by integer and float parsing, 
including the unit.
+ *  ±0.123456789e123??
+ */
+#   define SYNCTEX_BUFFER_MIN_SIZE 32
+#   define SYNCTEX_BUFFER_SIZE 32768
+
+#if SYNCTEX_BUFFER_SIZE >= UINT_MAX
+#   error BAD BUFFER SIZE(1)
+#endif
+#if SYNCTEX_BUFFER_SIZE < SYNCTEX_BUFFER_MIN_SIZE
+#   error BAD BUFFER SIZE(2)
+#endif
+/** @endcond */
+
+/**
+ * @brief Data structure fot a file reader
+ * 
+ */
+typedef struct _synctex_reader_t {
+    /** The (possibly compressed) file */
+    gzFile file;
+    /** The output file */
+    char * output;
+    /** The synctex file */
+    char * synctex;
+    /** current location in the buffer */
+    char * current;
+    /** start of the buffer */
+    char * start;
+    /** end of the buffer */
+    char * end;
+    /** Undocumented */
+    size_t min_size;
+    /** Undocumented */
+    size_t size;
+    /** Undocumented */
+    int lastv;
+    /** Undocumented */
+    int line_number;
+    SYNCTEX_DECLARE_CHAR_OFFSET
+} _synctex_reader_s;
+
+/**
+ * @brief Reader structure
+ * 
+ */
+typedef _synctex_reader_s * synctex_reader_p;
+
+/**
+ * @brief Return structure
+ * 
+ * This is the return structure of the open functions.
+ */
+typedef struct {
+    /** error status */
+    synctex_status_t status;
+    /** synctex file name */
+    char * synctex;
+    /** synctex file */
+    gzFile file;
+    /** mode */
+    synctex_io_mode_t io_mode;
+} _synctex_open_s;
+
+/*     This functions opens the file at the "output" given location.
+ *  It manages the problem of quoted filenames that appear with pdftex and 
filenames containing the space character.
+ *  In TeXLive 2008, the synctex file created with pdftex did contain 
unexpected quotes.
+ *     This function will remove them if possible.
+ *  All the reference arguments will take a value on return. They must be non 
NULL.
+ *     - returns: an open structure which status is
+ *      SYNCTEX_STATUS_OK on success,
+ *      SYNCTEX_STATUS_ERROR on failure.
+ *  - note: on success, the caller is the owner
+ *      of the fields of the returned open structure.
+ */
+static _synctex_open_s __synctex_open_v2(const char * output, 
synctex_io_mode_t io_mode, synctex_bool_t add_quotes) {
+    _synctex_open_s open = {SYNCTEX_STATUS_ERROR, NULL, NULL, io_mode};
+    char * quoteless_synctex_name = NULL;
+    const char * mode = _synctex_get_io_mode_name(open.io_mode);
+    size_t size = 
strlen(output)+strlen(synctex_suffix)+strlen(synctex_suffix_gz)+1;
+    if (NULL == (open.synctex = (char *)malloc(size))) {
+        _synctex_error("!  __synctex_open_v2: Memory problem (1)\n");
+        return open;
+    }
+    /*  we have reserved for synctex enough memory to copy output (including 
its 2 eventual quotes), both suffices,
+     *  including the terminating character. size is free now. */
+    if (open.synctex != strcpy(open.synctex,output)) {
+        _synctex_error("!  __synctex_open_v2: Copy problem\n");
+    return_on_error:
+        free(open.synctex);
+        open.synctex = NULL;
+        free(quoteless_synctex_name);/* We MUST have 
quoteless_synctex_name<>synctex_name */
+        return open;
+    }
+    /*  remove the last path extension if any */
+    _synctex_strip_last_path_extension(open.synctex);
+    if (!strlen(open.synctex)) {
+        goto return_on_error;
+    }
+    /*  now insert quotes. */
+    if (add_quotes) {
+        char * quoted = NULL;
+        if 
(_synctex_copy_with_quoting_last_path_component(open.synctex,&quoted,size) || 
quoted == NULL) {
+            /* There was an error or quoting does not make sense: */
+            goto return_on_error;
+        }
+        quoteless_synctex_name = open.synctex;
+        open.synctex = quoted;
+    }
+    /* Now add to open.synctex the first path extension. */
+    if (open.synctex != strcat(open.synctex,synctex_suffix)){
+        _synctex_error("!  __synctex_open_v2: Concatenation problem (can't add 
suffix '%s')\n",synctex_suffix);
+        goto return_on_error;
+    }
+    /* Add to quoteless_synctex_name as well, if relevant. */
+    if (quoteless_synctex_name && (quoteless_synctex_name != 
strcat(quoteless_synctex_name,synctex_suffix))){
+        free(quoteless_synctex_name);
+        quoteless_synctex_name = NULL;
+    }
+    if (NULL == (open.file = gzopen(open.synctex,mode))) {
+        /*  Could not open this file */
+        if (errno != ENOENT) {
+            /*  The file does exist, this is a lower level error, I can't do 
anything. */
+            _synctex_error("could not open %s, error %i\n",open.synctex,errno);
+            goto return_on_error;
+        }
+        /*  Apparently, there is no uncompressed synctex file. Try the 
compressed version */
+        if (open.synctex != strcat(open.synctex,synctex_suffix_gz)){
+            _synctex_error("!  __synctex_open_v2: Concatenation problem (can't 
add suffix '%s')\n",synctex_suffix_gz);
+            goto return_on_error;
+        }
+        open.io_mode |= synctex_io_gz_mask;
+        mode = _synctex_get_io_mode_name(open.io_mode); /* the file is a 
compressed and is a binary file, this caused errors on Windows */
+        /*     Add the suffix to the quoteless_synctex_name as well. */
+        if (quoteless_synctex_name && (quoteless_synctex_name != 
strcat(quoteless_synctex_name,synctex_suffix_gz))){
+            free(quoteless_synctex_name);
+            quoteless_synctex_name = NULL;
+        }
+        if (NULL == (open.file = gzopen(open.synctex,mode))) {
+            /*  Could not open this file */
+            if (errno != ENOENT) {
+                /*  The file does exist, this is a lower level error, I can't 
do anything. */
+                _synctex_error("Could not open %s, error 
%i\n",open.synctex,errno);
+            }
+            goto return_on_error;
+        }
+    }
+    /* At this point, the file is properly open.
+     *  If we are in the add_quotes mode, we change the file name by removing 
the quotes. */
+    if (quoteless_synctex_name) {
+        gzclose(open.file);
+        if (rename(open.synctex,quoteless_synctex_name)) {
+            _synctex_error("Could not rename %s to %s, error 
%i\n",open.synctex,quoteless_synctex_name,errno);
+            /* We could not rename, reopen the file with the quoted name. */
+            if (NULL == (open.file = gzopen(open.synctex,mode))) {
+                /*  No luck, could not re open this file, something has 
happened meanwhile */
+                if (errno != ENOENT) {
+                    /*  The file does not exist any more, it has certainly be 
removed somehow
+                     *  this is a lower level error, I can't do anything. */
+                    _synctex_error("Could not open again %s, error 
%i\n",open.synctex,errno);
+                }
+                goto return_on_error;
+            }
+        } else {
+            /*  The file has been successfully renamed */
+            if (NULL == (open.file = gzopen(quoteless_synctex_name,mode))) {
+                /*  Could not open this file */
+                if (errno != ENOENT) {
+                    /*  The file does exist, this is a lower level error, I 
can't do anything. */
+                    _synctex_error("Could not open renamed %s, error 
%i\n",quoteless_synctex_name,errno);
+                }
+                goto return_on_error;
+            }
+            /*  The quote free file name should replace the old one:*/
+            free(open.synctex);
+            open.synctex = quoteless_synctex_name;
+            quoteless_synctex_name = NULL;
+        }
+    }
+    /*  The operation is successful, return the arguments by value.    */
+    open.status = SYNCTEX_STATUS_OK;
+    return open;
+}
+
+/*     Opens the output file, taking into account the eventual build_directory.
+ *     - returns: an open structure which status is
+ *      SYNCTEX_STATUS_OK on success,
+ *      SYNCTEX_STATUS_ERROR on failure.
+ *  - note: on success, the caller is the owner
+ *      of the fields of the returned open structure.
+ */
+static _synctex_open_s _synctex_open_v2(const char * output, const char * 
build_directory, synctex_io_mode_t io_mode, synctex_bool_t add_quotes) {
+    _synctex_open_s open = __synctex_open_v2(output,io_mode,add_quotes);
+    if (open.status == SYNCTEX_STATUS_OK) {
+        return open;
+    }
+    if (build_directory && strlen(build_directory)) {
+        char * build_output;
+        const char *lpc;
+        size_t size;
+        synctex_bool_t is_absolute;
+        build_output = NULL;
+        lpc = _synctex_last_path_component(output);
+        size = strlen(build_directory)+strlen(lpc)+2;   /*  One for the '/' 
and one for the '\0'.   */
+        is_absolute = _synctex_path_is_absolute(build_directory);
+        if (!is_absolute) {
+            size += strlen(output);
+        }
+        if ((build_output = (char *)_synctex_malloc(size))) {
+            if (is_absolute) {
+                build_output[0] = '\0';
+            } else {
+                if (build_output != strcpy(build_output,output)) {
+                    _synctex_free(build_output);
+                    return open;
+                }
+                build_output[lpc-output]='\0';
+            }
+            if (build_output == strcat(build_output,build_directory)) {
+                /*     Append a path separator if necessary. */
+                if 
(!SYNCTEX_IS_PATH_SEPARATOR(build_output[strlen(build_directory)-1])) {
+                    if (build_output != strcat(build_output,"/")) {
+                        _synctex_free(build_output);
+                        return open;
+                    }
+                }
+                /*     Append the last path component of the output. */
+                if (build_output != strcat(build_output,lpc)) {
+                    _synctex_free(build_output);
+                    return open;
+                }
+                open = __synctex_open_v2(build_output,io_mode,add_quotes);
+            }
+            _synctex_free(build_output);
+        } /* if ((build_output... */
+    } /* if (build_directory...) */
+    return open;
+}
+static void synctex_reader_free(synctex_reader_p reader) {
+    if (reader) {
+        _synctex_free(reader->output);
+        _synctex_free(reader->synctex);
+        _synctex_free(reader->start);
+        gzclose(reader->file);
+        _synctex_free(reader);
+    }
+}
+/*
+ *  Return reader on success.
+ *  Deallocate reader and return NULL on failure.
+ */
+static synctex_reader_p synctex_reader_init_with_output_file(synctex_reader_p 
reader, const char * output, const char * build_directory) {
+    if (reader) {
+        /*  now open the synctex file */
+        _synctex_open_s open = 
_synctex_open_v2(output,build_directory,0,synctex_ADD_QUOTES);
+        if (open.status<SYNCTEX_STATUS_OK) {
+            open = 
_synctex_open_v2(output,build_directory,0,synctex_DONT_ADD_QUOTES);
+            if (open.status<SYNCTEX_STATUS_OK) {
+                return NULL;
+            }
+        }
+        reader->synctex = open.synctex;
+        reader->file = open.file;
+        /*  make a private copy of output */
+        if (NULL == (reader->output = (char 
*)_synctex_malloc(strlen(output)+1))){
+            _synctex_error("!  synctex_scanner_new_with_output_file: Memory 
problem (2), reader's output is not reliable.");
+        } else if (reader->output != strcpy(reader->output,output)) {
+            _synctex_free(reader->output);
+            reader->output = NULL;
+            _synctex_error("!  synctex_scanner_new_with_output_file: Copy 
problem, reader's output is not reliable.");
+        }
+        reader->start = reader->end = reader->current = NULL;
+        reader->min_size = SYNCTEX_BUFFER_MIN_SIZE;
+        reader->size = SYNCTEX_BUFFER_SIZE;
+        reader->start = reader->current =
+            (char *)_synctex_malloc(reader->size+1); /*  one more character 
for null termination */
+        if (NULL == reader->start) {
+            _synctex_error("!  malloc error in 
synctex_reader_init_with_output_file.");
+#ifdef SYNCTEX_DEBUG
+            return reader;
+#else
+            synctex_reader_free(reader);
+            return NULL;
+#endif
+        }
+        reader->end = reader->start+reader->size;
+        /*  reader->end always points to a null terminating character.
+         *  Maybe there is another null terminating character between 
reader->current and reader->end-1.
+         *  At least, we are sure that reader->current points to a string 
covering a valid part of the memory. */
+#   if defined(SYNCTEX_USE_CHARINDEX)
+        reader->charindex_offset = -reader->size;
+#   endif
+    }
+    return reader;
+}
+
+/** @cond */
+
+#   if defined(SYNCTEX_USE_HANDLE)
+#       define SYNCTEX_DECLARE_HANDLE synctex_node_p handle;
+#   else
+#       define SYNCTEX_DECLARE_HANDLE
+#   endif
+
+#   ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark SCANNER
+#   endif
+
+/**
+ *  The synctex scanner is the root object.
+ * 
+ *  Is is initialized with the contents of a text file or a gzipped file.
+ *  The buffer_.* are first used to parse the text.
+ */
+struct _synctex_scanner_t {
+    /** Auxiliary reader object discarded when used */
+    synctex_reader_p reader;
+    SYNCTEX_DECLARE_NODE_COUNT
+    SYNCTEX_DECLARE_HANDLE
+    /** "dvi" or "pdf", not yet used */
+    char * output_fmt;
+    /** result iterator */
+    synctex_iterator_p iterator;
+    /** allways 1, not yet used */
+    int version;
+    /** various flags */
+    struct {
+        /**  Whether the scanner has parsed its underlying synctex file. */
+        unsigned has_parsed:1;
+        /*  Whether the scanner has parsed its underlying synctex file. */
+        unsigned postamble:1;
+        /*  alignment */
+        unsigned reserved:sizeof(unsigned)-2;
+    } flags;
+    /** magnification from the synctex preamble */
+    int pre_magnification;
+    /** unit from the synctex preamble */
+    int pre_unit;
+    /** X offset from the synctex preamble */
+    int pre_x_offset;
+    /** Y offset from the synctex preamble */
+    int pre_y_offset;
+    /** Number of records, from the synctex postamble */
+    int count;
+    /** real unit, from synctex preamble or post scriptum */
+    float unit;
+    /** X offset, from synctex preamble or post scriptum */
+    float x_offset;
+    /** Y Offset, from synctex preamble or post scriptum */
+    float y_offset;
+    /** The first input node, its siblings are the other input nodes */
+    synctex_node_p input;
+    /** The first sheet node, its siblings are the other sheet nodes */
+    synctex_node_p sheet;
+    /** The first form, its siblings are the other forms */
+    synctex_node_p form;
+    /** The first form ref node in sheet, its friends are the other form ref 
nodes */    
+    synctex_node_p ref_in_sheet;
+    /** The first form ref node, its friends are the other form ref nodes in 
sheet */
+    synctex_node_p ref_in_form;
+    /** The number of friend lists */
+    int number_of_lists;
+    /** The friend lists */
+    synctex_node_r lists_of_friends;
+    /** The classes of the nodes of the scanner */
+    _synctex_class_s class_[synctex_node_number_of_types];
+    /** The display switcher value*/
+    int display_switcher;
+    /** The display prompt */
+    char * display_prompt;
+};
+
+/** @endcond */
+
+/**
+ * @brief Create a new node of the given type.
+ * 
+ * @param scanner 
+ * @param type no type checking
+ * @return synctex_node_p 
+ */
+synctex_node_p synctex_node_new(synctex_scanner_p scanner, synctex_node_type_t 
type) {
+    return scanner? scanner->class_[type].new(scanner):NULL;
+}
+#   if defined(SYNCTEX_USE_HANDLE)
+SYNCTEX_INLINE static void __synctex_scanner_free_handle(synctex_scanner_p 
scanner) {
+    _synctex_node_free(scanner->handle);
+}
+SYNCTEX_INLINE static void __synctex_scanner_remove_handle_to(synctex_node_p 
node) {
+    synctex_node_p arg_sibling = NULL;
+    synctex_node_p handle = node->class_->scanner->handle;
+    while (handle) {
+        synctex_node_p sibling;
+        if (node == _synctex_tree_target(handle)) {
+            sibling = __synctex_tree_reset_sibling(handle);
+            if (arg_sibling) {
+                __synctex_tree_set_sibling(arg_sibling, sibling);
+            } else {
+                node->class_->scanner->handle = sibling;
+            }
+            _synctex_node_free(handle);
+            break;
+        } else {
+            sibling = __synctex_tree_sibling(handle);
+        }
+        arg_sibling = handle;
+        handle = sibling;
+    }
+}
+SYNCTEX_INLINE static void __synctex_scanner_register_handle_to(synctex_node_p 
 node) {
+    synctex_node_p NNN = _synctex_new_handle_with_target(node);
+    __synctex_tree_set_sibling(NNN,node->class_->scanner->handle);
+    node->class_->scanner->handle = NNN;
+}
+#endif
+#if SYNCTEX_USE_NODE_COUNT>10
+SYNCTEX_INLINE static void _synctex_did_new(synctex_node_p node) {
+    printf("NODE CREATED # %i, %s, %p\n",
+           (node->class_->scanner->node_count)++,
+           synctex_node_isa(node),
+           node);
+}
+SYNCTEX_INLINE static void _synctex_will_free(synctex_node_p node) {
+    printf("NODE DELETED # %i, %s, %p\n",
+           --(node->class_->scanner->node_count),
+           synctex_node_isa(node),
+           node);
+}
+#endif
+
+/**
+ *  Free the given node.
+ *  - 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 nodes with children.
+ * 
+ * Recursion only occurs from parent to children, which means
+ * that there is a maximum depth determined by the calling stack size.
+ * This is not managed.
+ */
+static void _synctex_free_node(synctex_node_p node) {
+    while (node) {
+        synctex_node_p sibling = __synctex_tree_sibling(node);
+        SYNCTEX_SCANNER_REMOVE_HANDLE_TO(node);
+        SYNCTEX_WILL_FREE(node);
+        _synctex_node_free(_synctex_tree_child(node));
+        _synctex_free(node);
+        node = sibling;
+    }
+    return;
+}
+#if 0
+static void _synctex_free_node(synctex_node_p node) {
+    synctex_node_p sibling;
+    while (node) {
+        SYNCTEX_SCANNER_REMOVE_HANDLE_TO(node);
+        SYNCTEX_WILL_FREE(node);
+        sibling = __synctex_tree_sibling(node);
+        _synctex_node_free(_synctex_tree_child(node));
+        _synctex_free(node);
+        node = sibling;
+    }
+    return;
+}
+#endif
+/**
+ *  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_old(synctex_node_p handle) {
+  if (handle) {
+    _synctex_free_handle_old(__synctex_tree_sibling(handle));
+    _synctex_free_handle_old(_synctex_tree_child(handle));
+    _synctex_free(handle);
+  }
+  return;
+}
+*/
+static void _synctex_free_handle(synctex_node_p handle) {
+  if (handle) {
+    synctex_node_p n = handle;
+    synctex_node_p nn;
+    __synctex_tree_set_parent(n, NULL);
+  down:
+    while ((nn = _synctex_tree_child(n))) {
+      __synctex_tree_set_parent(nn, n);
+      n = nn;
+    };
+  right:
+    nn = __synctex_tree_sibling(n);
+    if (nn) {
+      _synctex_free(n);
+      n = nn;
+      goto down;
+    }
+    nn = __synctex_tree_parent(n);
+    _synctex_free(n);
+    if (nn) {
+      n = nn;
+      goto right;
+    }
+  }
+  return;
+}
+
+/**
+ *  Free the given leaf node.
+ *  - parameter node: of type synctex_node_p, with no child nor sibling.
+ *  - 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 nodes with no children.
+ */
+static void _synctex_free_leaf(synctex_node_p node) {
+    if (node) {
+        SYNCTEX_SCANNER_REMOVE_HANDLE_TO(node);
+        SYNCTEX_WILL_FREE(node);
+        _synctex_node_free(__synctex_tree_sibling(node));
+        _synctex_free(node);
+    }
+    return;
+}
+
+/**
+ SYNCTEX_CUR, SYNCTEX_START and SYNCTEX_END are convenient shortcuts
+ */
+#   define SYNCTEX_CUR (scanner->reader->current)
+#   define SYNCTEX_START (scanner->reader->start)
+#   define SYNCTEX_END (scanner->reader->end)
+
+/*  Here are gathered all the possible status that the next scanning functions 
will return.
+ *  All these functions return a status, and pass their result through 
pointers.
+ *  Negative values correspond to errors.
+ *  The management of the buffer is causing some significant overhead.
+ *  Every function that may access the buffer returns a status related to the 
buffer and file state.
+ *  status >= SYNCTEX_STATUS_OK means the function worked as expected
+ *  status < SYNCTEX_STATUS_OK means the function did not work as expected
+ *  status == SYNCTEX_STATUS_NOT_OK means the function did not work as 
expected but there is still some material to parse.
+ *  status == SYNCTEX_STATUS_EOF means the function did not work as expected 
and there is no more material.
+ *  status<SYNCTEX_STATUS_EOF means an error
+ */
+#if defined(SYNCTEX_USE_CHARINDEX)
+synctex_node_p synctex_scanner_handle(synctex_scanner_p scanner) {
+    return scanner? scanner->handle:NULL;
+}
+#endif
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark Decoding prototypes
+#   endif
+
+typedef struct {
+    int integer;
+    synctex_status_t status;
+} _synctex_is_s;
+
+static _synctex_is_s _synctex_decode_int(synctex_scanner_p scanner);
+static _synctex_is_s _synctex_decode_int_opt(synctex_scanner_p scanner, int 
default_value);
+static _synctex_is_s _synctex_decode_int_v(synctex_scanner_p scanner);
+
+/**
+ * @brief String+status structure.
+ * 
+ * Used to return multiple values from functions.
+ */
+typedef struct {
+    /** string component */
+    char * string;
+    /** status component */
+    synctex_status_t status;
+} _synctex_ss_s;
+
+static _synctex_ss_s _synctex_decode_string(synctex_scanner_p scanner);
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark Data SETGET
+#   endif
+
+/**
+ *  The next macros are used to access the node data info
+ *  through the class modelator integer fields.
+  *  - parameter NODE: of type synctex_node_p
+ */
+#   define SYNCTEX_DATA(NODE) ((*((((NODE)->class_))->info))(NODE))
+#if SYNCTEX_DEBUG > 1000
+#   define DEFINE_SYNCTEX_DATA_HAS(WHAT) \
+SYNCTEX_INLINE static synctex_bool_t __synctex_data_has_##WHAT(synctex_node_p 
node) {\
+    return (node && (node->class_->modelator->WHAT>=0));\
+}\
+SYNCTEX_INLINE static synctex_bool_t _synctex_data_has_##WHAT(synctex_node_p 
node) {\
+    if (node && (node->class_->modelator->WHAT<0)) {\
+        printf("WARNING: NO %s for %s\n", #WHAT, synctex_node_isa(node));\
+    }\
+    return __synctex_data_has_##WHAT(node);\
+}
+#else
+#   define DEFINE_SYNCTEX_DATA_HAS(WHAT) \
+SYNCTEX_INLINE static synctex_bool_t __synctex_data_has_##WHAT(synctex_node_p 
node) {\
+    return (node && (node->class_->modelator->WHAT>=0));\
+}\
+SYNCTEX_INLINE static synctex_bool_t _synctex_data_has_##WHAT(synctex_node_p 
node) {\
+    return __synctex_data_has_##WHAT(node);\
+}
+#endif
+
+SYNCTEX_INLINE static synctex_data_p __synctex_data(synctex_node_p node) {
+    return node->data+node->class_->navigator->size;
+}
+#   define DEFINE_SYNCTEX_DATA_INT_GETSET(WHAT) \
+DEFINE_SYNCTEX_DATA_HAS(WHAT)\
+static int _synctex_data_##WHAT(synctex_node_p node) {\
+    if (_synctex_data_has_##WHAT(node)) {\
+        return __synctex_data(node)[node->class_->modelator->WHAT].as_integer;\
+    }\
+    return 0;\
+}\
+static int _synctex_data_set_##WHAT(synctex_node_p node, int new_value) {\
+    int old = 0;\
+    if (_synctex_data_has_##WHAT(node)) {\
+        old = __synctex_data(node)[node->class_->modelator->WHAT].as_integer;\
+        
__synctex_data(node)[node->class_->modelator->WHAT].as_integer=new_value;\
+    }\
+    return old;\
+}
+#define DEFINE_SYNCTEX_DATA_INT_DECODE(WHAT) \
+static synctex_status_t _synctex_data_decode_##WHAT(synctex_node_p node) {\
+    if (_synctex_data_has_##WHAT(node)) {\
+        _synctex_is_s is = _synctex_decode_int(node->class_->scanner);\
+        if (is.status == SYNCTEX_STATUS_OK) {\
+            _synctex_data_set_##WHAT(node,is.integer);\
+        } \
+        return is.status;\
+    }\
+    return SYNCTEX_STATUS_BAD_ARGUMENT;\
+}
+#   define DEFINE_SYNCTEX_DATA_INT_DECODE_v(WHAT) \
+static synctex_status_t _synctex_data_decode_##WHAT##_v(synctex_node_p node) {\
+    if (_synctex_data_has_##WHAT(node)) {\
+        _synctex_is_s is = _synctex_decode_int_v(node->class_->scanner);\
+        if (is.status == SYNCTEX_STATUS_OK) {\
+            _synctex_data_set_##WHAT(node,is.integer);\
+        } \
+        return is.status;\
+    }\
+    return SYNCTEX_STATUS_BAD_ARGUMENT;\
+}
+#define DEFINE_SYNCTEX_DATA_STR_GETSET(WHAT) \
+DEFINE_SYNCTEX_DATA_HAS(WHAT)\
+static char * _synctex_data_##WHAT(synctex_node_p node) {\
+    if (_synctex_data_has_##WHAT(node)) {\
+        return 
node->data[node->class_->navigator->size+node->class_->modelator->WHAT].as_string;\
+    }\
+    return NULL;\
+}\
+static char * _synctex_data_set_##WHAT(synctex_node_p node, char * new_value) 
{\
+    char * old = "";\
+    if (_synctex_data_has_##WHAT(node)) {\
+        old = 
node->data[node->class_->navigator->size+node->class_->modelator->WHAT].as_string;\
+        
node->data[node->class_->navigator->size+node->class_->modelator->WHAT].as_string
 =new_value;\
+    }\
+    return old;\
+}
+#define DEFINE_SYNCTEX_DATA_STR_DECODE(WHAT) \
+static synctex_status_t _synctex_data_decode_##WHAT(synctex_node_p node) {\
+    if (_synctex_data_has_##WHAT(node)) {\
+        _synctex_ss_s ss = _synctex_decode_string(node->class_->scanner);\
+        if (ss.status == SYNCTEX_STATUS_OK) {\
+            _synctex_data_set_##WHAT(node,ss.string);\
+        } \
+        return ss.status;\
+    }\
+    return SYNCTEX_STATUS_BAD_ARGUMENT;\
+}
+#define DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(WHAT) \
+DEFINE_SYNCTEX_DATA_INT_GETSET(WHAT) \
+DEFINE_SYNCTEX_DATA_INT_DECODE(WHAT)
+#define DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE_v(WHAT) \
+DEFINE_SYNCTEX_DATA_INT_GETSET(WHAT) \
+DEFINE_SYNCTEX_DATA_INT_DECODE_v(WHAT)
+#define DEFINE_SYNCTEX_DATA_STR_GETSET_DECODE(WHAT) \
+DEFINE_SYNCTEX_DATA_STR_GETSET(WHAT) \
+DEFINE_SYNCTEX_DATA_STR_DECODE(WHAT)
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark -
+#       pragma mark OBJECTS, their creators and destructors.
+#   endif
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark input.
+#   endif
+
+DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(tag)
+DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(line)
+DEFINE_SYNCTEX_DATA_STR_GETSET_DECODE(name)
+
+/*  Input nodes only know about their sibling, which is another input node.
+ *  The synctex information is the _synctex_data_tag and _synctex_data_name
+ *  note: the input owns its name. */
+
+#   define SYNCTEX_INPUT_MARK "Input:"
+
+static const _synctex_tree_model_s synctex_tree_model_input = {
+    synctex_tree_sibling_idx, /* sibling */
+    -1, /* parent */
+    -1, /* child */
+    -1, /* friend */
+    -1, /* last */
+    -1, /* next_hbox */
+    -1, /* arg_sibling */
+    -1, /* target */
+    synctex_tree_s_input_max
+};
+static const _synctex_data_model_s synctex_data_model_input = {
+    synctex_data_input_tag_idx, /* tag */
+    synctex_data_input_line_idx,/* line */
+    -1, /* column */
+    -1, /* h */
+    -1, /* v */
+    -1, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    synctex_data_input_name_idx, /* name */
+    -1, /* page */
+    synctex_data_input_tln_max
+};
+
+#define SYNCTEX_INSPECTOR_GETTER_F(WHAT)\
+&_synctex_data_##WHAT, &_synctex_data_set_##WHAT
+
+static synctex_node_p _synctex_new_input(synctex_scanner_p scanner);
+static void _synctex_free_input(synctex_node_p node);
+static void _synctex_log_input(synctex_node_p node);
+static char * _synctex_abstract_input(synctex_node_p node);
+static void _synctex_display_input(synctex_node_p node);
+
+static const _synctex_tlcpector_s synctex_tlcpector_input = {
+    &_synctex_data_tag, /* tag */
+    &_synctex_int_none, /* line */
+    &_synctex_int_none, /* column */
+};
+
+static _synctex_class_s _synctex_class_input = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_input,    /*  Node type */
+    &_synctex_new_input,        /*  creator */
+    &_synctex_free_input,       /*  destructor */
+    &_synctex_log_input,        /*  log */
+    &_synctex_display_input,    /*  display */
+    &_synctex_abstract_input,   /*  abstract */
+    &synctex_tree_model_input,  /*  tree model */
+    &synctex_data_model_input,  /*  data model */
+    &synctex_tlcpector_input,   /*  inspector */
+    &synctex_inspector_none,    /*  inspector */
+    &synctex_vispector_none,    /*  vispector */
+};
+
+/**
+ * @brief Input node structure
+ * 
+ */
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_s_input_max+synctex_data_input_tln_max];
+} _synctex_input_s;
+
+/**
+ * @brief Input node constructor
+ * 
+ * @param scanner 
+ * @return synctex_node_p 
+ */
+static synctex_node_p _synctex_new_input(synctex_scanner_p scanner) {
+    if (scanner) {
+        synctex_node_p node = _synctex_malloc(sizeof(_synctex_input_s));
+        if (node) {
+            node->class_ = scanner->class_+synctex_node_type_input;
+            SYNCTEX_DID_NEW(node);
+            SYNCTEX_IMPLEMENT_CHARINDEX(node,0);
+            SYNCTEX_REGISTER_HANDLE_TO(node);
+        }
+        return node;
+    }
+    return NULL;
+}
+
+/**
+ * @brief Input node destructor
+ * 
+ * @param node 
+ */
+static void _synctex_free_input(synctex_node_p node){
+    if (node) {
+        SYNCTEX_SCANNER_REMOVE_HANDLE_TO(node);
+        SYNCTEX_WILL_FREE(node);
+        _synctex_node_free(__synctex_tree_sibling(node));
+        _synctex_free(_synctex_data_name(node));
+        _synctex_free(node);
+    }
+}
+
+/*  The sheet is a first level node.
+ *  It has no parent (the owner is the scanner itself)
+ *  Its sibling points to another sheet.
+ *  Its child points to its first child, in general a box.
+ *  A sheet node contains only one synctex information: the page.
+ *  This is the 1 based page index as given by TeX.
+ */
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark sheet.
+#   endif
+/**
+ *  Every node has the same structure, but not the same size.
+ */
+
+DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(page)
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_scn_sheet_max+synctex_data_p_sheet_max];
+} _synctex_node_sheet_s;
+
+/*  sheet node creator */
+
+#define DEFINE_synctex_new_scanned_NODE(NAME)\
+static synctex_node_p _synctex_new_##NAME(synctex_scanner_p scanner) {\
+    if (scanner) {\
+        ++SYNCTEX_CUR;\
+        synctex_node_p node = 
_synctex_malloc(sizeof(_synctex_node_##NAME##_s));\
+        if (node) {\
+            node->class_ = scanner->class_+synctex_node_type_##NAME;\
+            SYNCTEX_DID_NEW(node); \
+            SYNCTEX_IMPLEMENT_CHARINDEX(node,-1);\
+            SYNCTEX_REGISTER_HANDLE_TO(node); \
+        }\
+        return node;\
+    }\
+    return NULL;\
+}
+/*  NB: -1 in SYNCTEX_IMPLEMENT_CHARINDEX above because
+ *  the first char of the line has been scanned
+ */
+DEFINE_synctex_new_scanned_NODE(sheet)
+static void _synctex_log_sheet(synctex_node_p node);
+static char * _synctex_abstract_sheet(synctex_node_p node);
+static void _synctex_display_sheet(synctex_node_p node);
+
+static const _synctex_tree_model_s synctex_tree_model_sheet = {
+    synctex_tree_sibling_idx, /* sibling */
+    -1, /* parent */
+    synctex_tree_s_child_idx, /* child */
+    -1, /* friend */
+    -1, /* last */
+    synctex_tree_sc_next_hbox_idx, /* next_hbox */
+    -1, /* arg_sibling */
+    -1, /* target */
+    synctex_tree_scn_sheet_max
+};
+static const _synctex_data_model_s synctex_data_model_sheet = {
+    -1, /* tag */
+    -1, /* line */
+    -1, /* column */
+    -1, /* h */
+    -1, /* v */
+    -1, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    synctex_data_sheet_page_idx, /* page */
+    synctex_data_p_sheet_max
+};
+static _synctex_class_s _synctex_class_sheet = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_sheet,    /*  Node type */
+    &_synctex_new_sheet,        /*  creator */
+    &_synctex_free_node,        /*  destructor */
+    &_synctex_log_sheet,        /*  log */
+    &_synctex_display_sheet,    /*  display */
+    &_synctex_abstract_sheet,   /*  abstract */
+    &synctex_tree_model_sheet,  /*  tree model */
+    &synctex_data_model_sheet,  /*  data model */
+    &synctex_tlcpector_none,    /*  tlcpector */
+    &synctex_inspector_none,    /*  inspector */
+    &synctex_vispector_none,    /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark form.
+#   endif
+/**
+ *  Every node has the same structure, but not the same size.
+ */
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_sct_form_max+synctex_data_t_form_max];
+} _synctex_node_form_s;
+
+DEFINE_synctex_new_scanned_NODE(form)
+
+static char * _synctex_abstract_form(synctex_node_p node);
+static void _synctex_display_form(synctex_node_p node);
+static void _synctex_log_form(synctex_node_p node);
+
+static const _synctex_tree_model_s synctex_tree_model_form = {
+    synctex_tree_sibling_idx, /* sibling */
+    -1, /* parent */
+    synctex_tree_s_child_idx, /* child */
+    -1, /* friend */
+    -1, /* last */
+    -1, /* next_hbox */
+    -1, /* arg_sibling */
+    synctex_tree_sc_target_idx, /* target */
+    synctex_tree_sct_form_max
+};
+static const _synctex_data_model_s synctex_data_model_form = {
+    synctex_data_form_tag_idx, /* tag */
+    -1, /* line */
+    -1, /* column */
+    -1, /* h */
+    -1, /* v */
+    -1, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_t_form_max
+};
+static _synctex_class_s _synctex_class_form = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_form,     /*  Node type */
+    &_synctex_new_form,         /*  creator */
+    &_synctex_free_node,        /*  destructor */
+    &_synctex_log_form,         /*  log */
+    &_synctex_display_form,     /*  display */
+    &_synctex_abstract_form,    /*  abstract */
+    &synctex_tree_model_form,   /*  tree model */
+    &synctex_data_model_form,   /*  data model */
+    &synctex_tlcpector_none,    /*  tlcpector */
+    &synctex_inspector_none,    /*  inspector */
+    &synctex_vispector_none,    /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark vbox.
+#   endif
+
+/*  A box node contains navigation and synctex information
+ *  There are different kinds of boxes.
+ *  Only horizontal boxes are treated differently because of their visible 
size.
+ */
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spcfl_vbox_max+synctex_data_box_max];
+} _synctex_node_vbox_s;
+
+/*  vertical box node creator */
+DEFINE_synctex_new_scanned_NODE(vbox)
+
+static char * _synctex_abstract_vbox(synctex_node_p node);
+static void _synctex_display_vbox(synctex_node_p node);
+static void _synctex_log_vbox(synctex_node_p node);
+
+static const _synctex_tree_model_s synctex_tree_model_vbox = {
+    synctex_tree_sibling_idx,       /* sibling */
+    synctex_tree_s_parent_idx,      /* parent */
+    synctex_tree_sp_child_idx,      /* child */
+    synctex_tree_spc_friend_idx,    /* friend */
+    synctex_tree_spcf_last_idx,     /* last */
+    -1, /* next_hbox */
+    -1, /* arg_sibling */
+    -1, /* target */
+    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,
+            SYNCTEX_DFLT_COLUMN);
+        if (is.status == SYNCTEX_STATUS_OK) {
+            _synctex_data_set_column(node,is.integer);
+        }
+        return is.status;
+    }
+    return SYNCTEX_STATUS_BAD_ARGUMENT;
+}
+/*
+Definitions of
+__synctex_data_has_?, _synctex_data_?, _synctex_data_decode_?
+for ? in h, v, width, height, depth
+*/
+DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE(h)
+DEFINE_SYNCTEX_DATA_INT_GETSET_DECODE_v(v)
+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 */
+    synctex_data_column_idx,/* column */
+    synctex_data_h_idx,     /* h */
+    synctex_data_v_idx,     /* v */
+    synctex_data_width_idx, /* width */
+    synctex_data_height_idx,/* height */
+    synctex_data_depth_idx, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_box_max
+};
+static const _synctex_tlcpector_s synctex_tlcpector_default = {
+    &_synctex_data_tag, /* tag */
+    &_synctex_data_line, /* line */
+    &_synctex_data_column, /* column */
+};
+static const _synctex_inspector_s _synctex_inspector_box = {
+    &_synctex_data_h,
+    &_synctex_data_v,
+    &_synctex_data_width,
+    &_synctex_data_height,
+    &_synctex_data_depth,
+};
+static float __synctex_node_visible_h(synctex_node_p node);
+static float __synctex_node_visible_v(synctex_node_p node);
+static float __synctex_node_visible_width(synctex_node_p node);
+static float __synctex_node_visible_height(synctex_node_p node);
+static float __synctex_node_visible_depth(synctex_node_p node);
+static _synctex_vispector_s _synctex_vispector_box = {
+    &__synctex_node_visible_h,
+    &__synctex_node_visible_v,
+    &__synctex_node_visible_width,
+    &__synctex_node_visible_height,
+    &__synctex_node_visible_depth,
+};
+/*  These are static class objects, each scanner will make a copy of them and 
setup the scanner field.
+ */
+static _synctex_class_s _synctex_class_vbox = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_vbox,     /*  Node type */
+    &_synctex_new_vbox,         /*  creator */
+    &_synctex_free_node,        /*  destructor */
+    &_synctex_log_vbox,         /*  log */
+    &_synctex_display_vbox,     /*  display */
+    &_synctex_abstract_vbox,    /*  abstract */
+    &synctex_tree_model_vbox,   /*  tree model */
+    &synctex_data_model_box,    /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &_synctex_inspector_box,     /*  inspector */
+    &_synctex_vispector_box,     /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark hbox.
+#   endif
+
+/*  Horizontal boxes must contain visible size, because 0 width does not mean 
emptiness.
+ *  They also contain an average of the line numbers of the containing nodes. 
*/
+
+static const _synctex_tree_model_s synctex_tree_model_hbox = {
+    synctex_tree_sibling_idx,       /* sibling */
+    synctex_tree_s_parent_idx,      /* parent */
+    synctex_tree_sp_child_idx,      /* child */
+    synctex_tree_spc_friend_idx,    /* friend */
+    synctex_tree_spcf_last_idx,     /* last */
+    synctex_tree_spcfl_next_hbox_idx, /* next_hbox */
+    -1, /* arg_sibling */
+    -1, /* target */
+    synctex_tree_spcfln_hbox_max
+};
+
+DEFINE_SYNCTEX_DATA_INT_GETSET(mean_line)
+DEFINE_SYNCTEX_DATA_INT_GETSET(weight)
+DEFINE_SYNCTEX_DATA_INT_GETSET(h_V)
+DEFINE_SYNCTEX_DATA_INT_GETSET(v_V)
+DEFINE_SYNCTEX_DATA_INT_GETSET(width_V)
+DEFINE_SYNCTEX_DATA_INT_GETSET(height_V)
+DEFINE_SYNCTEX_DATA_INT_GETSET(depth_V)
+
+/**
+ *  The hbox model.
+ *  It contains V variants of geometrical information.
+ *  It happens that hboxes contain material that is not used to compute
+ *  the bounding box. Some letters may appear out of the box given by TeX.
+ *  In such a situation, the visible bouding box is bigger ence the V variant.
+ *  Only hboxes have such variant. It does not make sense for void boxes
+ *  and it is not used here for vboxes.
+ *  - author: JL
+ */
+
+static const _synctex_data_model_s synctex_data_model_hbox = {
+    synctex_data_tag_idx, /* tag */
+    synctex_data_line_idx,  /* line */
+    synctex_data_column_idx,/* column */
+    synctex_data_h_idx,     /* h */
+    synctex_data_v_idx,     /* v */
+    synctex_data_width_idx, /* width */
+    synctex_data_height_idx,/* height */
+    synctex_data_depth_idx, /* depth */
+    synctex_data_mean_line_idx, /* mean_line */
+    synctex_data_weight_idx, /* weight */
+    synctex_data_h_V_idx, /* h_V */
+    synctex_data_v_V_idx, /* v_V */
+    synctex_data_width_V_idx, /* width_V */
+    synctex_data_height_V_idx, /* height_V */
+    synctex_data_depth_V_idx, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_hbox_max
+};
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spcfln_hbox_max+synctex_data_hbox_max];
+} _synctex_node_hbox_s;
+
+/*  horizontal box node creator */
+DEFINE_synctex_new_scanned_NODE(hbox)
+
+static void _synctex_log_hbox(synctex_node_p node);
+static char * _synctex_abstract_hbox(synctex_node_p node);
+static void _synctex_display_hbox(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_hbox = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_hbox,     /*  Node type */
+    &_synctex_new_hbox,         /*  creator */
+    &_synctex_free_node,        /*  destructor */
+    &_synctex_log_hbox,         /*  log */
+    &_synctex_display_hbox,     /*  display */
+    &_synctex_abstract_hbox,    /*  abstract */
+    &synctex_tree_model_hbox,   /*  tree model */
+    &synctex_data_model_hbox,   /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &_synctex_inspector_box,     /*  inspector */
+    &_synctex_vispector_box,     /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark void vbox.
+#   endif
+
+/*  This void box node implementation is either horizontal or vertical
+ *  It does not contain a child field.
+ */
+static const _synctex_tree_model_s synctex_tree_model_spf = {
+    synctex_tree_sibling_idx,   /* sibling */
+    synctex_tree_s_parent_idx,  /* parent */
+    -1, /* child */
+    synctex_tree_sp_friend_idx, /* friend */
+    -1, /* last */
+    -1, /* next_hbox */
+    -1, /* arg_sibling */
+    -1, /* target */
+    synctex_tree_spf_max
+};
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spf_max+synctex_data_box_max];
+} _synctex_node_void_vbox_s;
+
+/*  vertical void box node creator */
+DEFINE_synctex_new_scanned_NODE(void_vbox)
+
+static void _synctex_log_void_box(synctex_node_p node);
+static char * _synctex_abstract_void_vbox(synctex_node_p node);
+static void _synctex_display_void_vbox(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_void_vbox = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_void_vbox,/*  Node type */
+    &_synctex_new_void_vbox,    /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_void_box,     /*  log */
+    &_synctex_display_void_vbox,/*  display */
+    &_synctex_abstract_void_vbox,/*  abstract */
+    &synctex_tree_model_spf,    /*  tree model */
+    &synctex_data_model_box,    /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &_synctex_inspector_box,     /*  inspector */
+    &_synctex_vispector_box,     /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark void hbox.
+#   endif
+
+typedef _synctex_node_void_vbox_s _synctex_node_void_hbox_s;
+
+/*  horizontal void box node creator */
+DEFINE_synctex_new_scanned_NODE(void_hbox)
+
+static char * _synctex_abstract_void_hbox(synctex_node_p node);
+static void _synctex_display_void_hbox(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_void_hbox = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_void_hbox,/*  Node type */
+    &_synctex_new_void_hbox,    /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_void_box,     /*  log */
+    &_synctex_display_void_hbox,/*  display */
+    &_synctex_abstract_void_hbox,/*  abstract */
+    &synctex_tree_model_spf,    /*  tree model */
+    &synctex_data_model_box,    /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &_synctex_inspector_box,     /*  inspector */
+    &_synctex_vispector_box,     /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark form ref.
+#   endif
+
+/*  The form ref node.  */
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spfa_max+synctex_data_ref_thv_max];
+} _synctex_node_ref_s;
+
+/*  form ref node creator */
+DEFINE_synctex_new_scanned_NODE(ref)
+
+static void _synctex_log_ref(synctex_node_p node);
+static char * _synctex_abstract_ref(synctex_node_p node);
+static void _synctex_display_ref(synctex_node_p node);
+
+static const _synctex_tree_model_s synctex_tree_model_spfa = {
+    synctex_tree_sibling_idx,   /* sibling */
+    synctex_tree_s_parent_idx,  /* parent */
+    -1, /* child */
+    synctex_tree_sp_friend_idx, /* friend */
+    -1, /* last */
+    -1, /* next_hbox */
+    synctex_tree_spf_arg_sibling_idx, /* arg_sibling */
+    -1, /* target */
+    synctex_tree_spfa_max
+};
+static const _synctex_data_model_s synctex_data_model_ref = {
+    synctex_data_tag_idx, /* tag */
+    -1, /* line */
+    -1, /* column */
+    synctex_data_ref_h_idx, /* h */
+    synctex_data_ref_v_idx, /* v */
+    -1, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_ref_thv_max /* size */
+};
+static _synctex_class_s _synctex_class_ref = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_ref,      /*  Node type */
+    &_synctex_new_ref,          /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_ref,          /*  log */
+    &_synctex_display_ref,      /*  display */
+    &_synctex_abstract_ref,     /*  abstract */
+    &synctex_tree_model_spfa,   /*  navigator */
+    &synctex_data_model_ref,    /*  data model */
+    &synctex_tlcpector_none,    /*  tlcpector */
+    &synctex_inspector_none,    /*  inspector */
+    &synctex_vispector_none,    /*  vispector */
+};
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark small node.
+#   endif
+
+/*  The small nodes correspond to glue, penalty, math and boundary nodes. */
+static const _synctex_data_model_s synctex_data_model_tlchv = {
+    synctex_data_tag_idx, /* tag */
+    synctex_data_line_idx, /* line */
+    synctex_data_column_idx, /* column */
+    synctex_data_h_idx, /* h */
+    synctex_data_v_idx, /* v */
+    -1, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_tlchv_max
+};
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spf_max+synctex_data_tlchv_max];
+} _synctex_node_tlchv_s;
+
+static void _synctex_log_tlchv_node(synctex_node_p node);
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark math.
+#   endif
+
+typedef _synctex_node_tlchv_s _synctex_node_math_s;
+
+/*  math node creator */
+DEFINE_synctex_new_scanned_NODE(math)
+
+static char * _synctex_abstract_math(synctex_node_p node);
+static void _synctex_display_math(synctex_node_p node);
+static _synctex_inspector_s synctex_inspector_hv = {
+    &_synctex_data_h,
+    &_synctex_data_v,
+    &_synctex_int_none,
+    &_synctex_int_none,
+    &_synctex_int_none,
+};
+static _synctex_vispector_s synctex_vispector_hv = {
+    &__synctex_node_visible_h,
+    &__synctex_node_visible_v,
+    &_synctex_float_none,
+    &_synctex_float_none,
+    &_synctex_float_none,
+};
+
+static _synctex_class_s _synctex_class_math = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_math,     /*  Node type */
+    &_synctex_new_math,         /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_tlchv_node,   /*  log */
+    &_synctex_display_math,     /*  display */
+    &_synctex_abstract_math,    /*  abstract */
+    &synctex_tree_model_spf,    /*  tree model */
+    &synctex_data_model_tlchv,  /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &synctex_inspector_hv,      /*  inspector */
+    &synctex_vispector_hv,      /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark kern node.
+#   endif
+
+static const _synctex_data_model_s synctex_data_model_tlchvw = {
+    synctex_data_tag_idx,   /* tag */
+    synctex_data_line_idx,  /* line */
+    synctex_data_column_idx,/* column */
+    synctex_data_h_idx,     /* h */
+    synctex_data_v_idx,     /* v */
+    synctex_data_width_idx, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_tlchvw_max
+};
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spf_max+synctex_data_tlchvw_max];
+} _synctex_node_kern_s;
+
+/*  kern node creator */
+DEFINE_synctex_new_scanned_NODE(kern)
+
+static void _synctex_log_kern_node(synctex_node_p node);
+static char * _synctex_abstract_kern(synctex_node_p node);
+static void _synctex_display_kern(synctex_node_p node);
+
+static _synctex_inspector_s synctex_inspector_kern = {
+    &_synctex_data_h,
+    &_synctex_data_v,
+    &_synctex_data_width,
+    &_synctex_int_none,
+    &_synctex_int_none,
+};
+static float __synctex_kern_visible_h(synctex_node_p node);
+static float __synctex_kern_visible_width(synctex_node_p node);
+static _synctex_vispector_s synctex_vispector_kern = {
+    &__synctex_kern_visible_h,
+    &__synctex_node_visible_v,
+    &__synctex_kern_visible_width,
+    &_synctex_float_none,
+    &_synctex_float_none,
+};
+
+static _synctex_class_s _synctex_class_kern = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_kern,     /*  Node type */
+    &_synctex_new_kern,         /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_kern_node,    /*  log */
+    &_synctex_display_kern,     /*  display */
+    &_synctex_abstract_kern,    /*  abstract */
+    &synctex_tree_model_spf,    /*  tree model */
+    &synctex_data_model_tlchvw, /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &synctex_inspector_kern,    /*  inspector */
+    &synctex_vispector_kern,    /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark glue.
+#   endif
+
+/*  glue node creator */
+typedef _synctex_node_tlchv_s _synctex_node_glue_s;
+DEFINE_synctex_new_scanned_NODE(glue)
+
+static char * _synctex_abstract_glue(synctex_node_p node);
+static void _synctex_display_glue(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_glue = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_glue,     /*  Node type */
+    &_synctex_new_glue,         /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_tlchv_node,   /*  log */
+    &_synctex_display_glue,     /*  display */
+    &_synctex_abstract_glue,    /*  abstract */
+    &synctex_tree_model_spf,    /*  tree model */
+    &synctex_data_model_tlchv,  /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &synctex_inspector_hv,      /*  inspector */
+    &synctex_vispector_hv,      /*  vispector */
+};
+
+/*  The small nodes correspond to glue and boundary nodes.  */
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark rule.
+#   endif
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spf_max+synctex_data_box_max];
+} _synctex_node_rule_s;
+
+DEFINE_synctex_new_scanned_NODE(rule)
+
+static void _synctex_log_rule(synctex_node_p node);
+static char * _synctex_abstract_rule(synctex_node_p node);
+static void _synctex_display_rule(synctex_node_p node);
+
+static float __synctex_rule_visible_h(synctex_node_p node);
+static float __synctex_rule_visible_v(synctex_node_p node);
+static float __synctex_rule_visible_width(synctex_node_p node);
+static float __synctex_rule_visible_height(synctex_node_p node);
+static float __synctex_rule_visible_depth(synctex_node_p node);
+static _synctex_vispector_s _synctex_vispector_rule = {
+    &__synctex_rule_visible_h,
+    &__synctex_rule_visible_v,
+    &__synctex_rule_visible_width,
+    &__synctex_rule_visible_height,
+    &__synctex_rule_visible_depth,
+};
+
+static _synctex_class_s _synctex_class_rule = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_rule,     /*  Node type */
+    &_synctex_new_rule,         /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_rule,         /*  log */
+    &_synctex_display_rule,     /*  display */
+    &_synctex_abstract_rule,    /*  abstract */
+    &synctex_tree_model_spf,    /*  tree model */
+    &synctex_data_model_box,    /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &_synctex_inspector_box,     /*  inspector */
+    &_synctex_vispector_rule,    /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark boundary.
+#   endif
+
+/*  boundary node creator */
+typedef _synctex_node_tlchv_s _synctex_node_boundary_s;
+DEFINE_synctex_new_scanned_NODE(boundary)
+
+static char * _synctex_abstract_boundary(synctex_node_p node);
+static void _synctex_display_boundary(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_boundary = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_boundary, /*  Node type */
+    &_synctex_new_boundary,     /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_tlchv_node,   /*  log */
+    &_synctex_display_boundary, /*  display */
+    &_synctex_abstract_boundary,/*  abstract */
+    &synctex_tree_model_spf,    /*  tree model */
+    &synctex_data_model_tlchv,  /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &synctex_inspector_hv,      /*  inspector */
+    &synctex_vispector_hv,      /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark box boundary.
+#   endif
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u data[synctex_tree_spfa_max+synctex_data_tlchv_max];
+} _synctex_node_box_bdry_s;
+
+#define DEFINE_synctex_new_unscanned_NODE(NAME)\
+SYNCTEX_INLINE static synctex_node_p _synctex_new_##NAME(synctex_scanner_p 
scanner) {\
+    if (scanner) {\
+        synctex_node_p node = 
_synctex_malloc(sizeof(_synctex_node_##NAME##_s));\
+        if (node) {\
+            node->class_ = scanner->class_+synctex_node_type_##NAME;\
+            SYNCTEX_DID_NEW(node); \
+        }\
+        return node;\
+    }\
+    return NULL;\
+}
+DEFINE_synctex_new_unscanned_NODE(box_bdry)
+
+static char * _synctex_abstract_box_bdry(synctex_node_p node);
+static void _synctex_display_box_bdry(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_box_bdry = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_box_bdry, /*  Node type */
+    &_synctex_new_box_bdry,     /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_tlchv_node,   /*  log */
+    &_synctex_display_box_bdry, /*  display */
+    &_synctex_abstract_box_bdry,/*  display */
+    &synctex_tree_model_spfa,   /*  tree model */
+    &synctex_data_model_tlchv,  /*  data model */
+    &synctex_tlcpector_default, /*  tlcpector */
+    &synctex_inspector_hv,      /*  inspector */
+    &synctex_vispector_hv,      /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark hbox proxy.
+#   endif
+
+/**
+ *  Standard nodes refer to TeX nodes: math, kern, boxes...
+ *  Proxy nodes are used to support forms.
+ *  A form is parsed as a tree of standard nodes starting
+ *  at the top left position.
+ *  When a reference is used, the form is duplicated
+ *  to the location specified by the reference.
+ *  As the same form can be duplicated at different locations,
+ *  the geometrical information is relative to its own top left point.
+ *  As we need absolute locations, we use proxy nodes.
+ *  A proxy node records an offset and the target node.
+ *  The target partly acts as a delegate.
+ *  The h and v position of the proxy node is the h and v
+ *  position of the target shifted by the proxy's offset.
+ *  The width, height and depth are not sensitive to offsets.
+ *  When are proxies created ?
+ *  1)  when the synctex file has been parsed, all the form refs
+ *  are replaced by proxies to the content of a form.
+ *  This content is a node with siblings (actually none).
+ *  Those root proxies have the parent of the ref they replace,
+ *  so their parents exist and are no proxy.
+ *  Moreover, if they have no sibling, it means that their target have no
+ *  sibling as well.
+ *  Such nodes are called root proxies.
+ *  2)  On the fly, when a proxy is asked for its child
+ *  (or sibling) and has none, a proxy to its target's child
+ *  (or sibling) is created if any. There are only 2 possible situations:
+ *  either the newly created proxy is the child of a proxy,
+ *  or it is the sibling of a proxy created on the fly.
+ *  In both cases, the parent is a proxy with children.
+ *  Such nodes are called child proxies.
+ *  How to compute the offset of a proxy ?
+ *  The offset of root proxy objects is exactly
+ *  the offset of the ref they replace.
+ *  The offset of other proxies is their owner's,
+ *  except when pointing to a root proxy.
+ *  What happens for cascading forms ?
+ *  Here is an example diagram
+ *
+ *  At parse time, the arrow means "owns":
+ *  sheet0 -> ref_to1
+ *
+ *            target1 -> ref_to2
+ *
+ *                       target2 -> child22
+ *
+ *  After replacing the refs:
+ *  sheet0 -> proxy00 -> proxy01 -> proxy02
+ *               |          |          |
+ *            target1 -> proxy11 -> proxy12
+ *                          |          |
+ *                       target2 -> proxy22
+ *
+ *  proxy00, proxy11 and proxy22 are root proxies.
+ *  Their offset is the one of the ref they replace
+ *  proxy01, proxy02 and proxy12 are child proxies.
+ *  Their proxy is the one of their parent.
+ *  Optimization.
+ *  After all the refs are replaced, there are only root nodes
+ *  targeting standard node. We make sure that each child proxy
+ *  also targets a standard node.
+ *  It is possible for a proxy to have a standard sibling 
+ *  whereas its target has no sibling at all. Root proxies
+ *  are such nodes, and are the only ones.
+ *  The consequence is that proxies created on the fly
+ *  must take into account this situation.
+ */
+
+/*  A proxy to a hbox.
+ *  A proxy do have a target, which can be a proxy
+ */
+
+static const _synctex_tree_model_s synctex_tree_model_proxy_hbox = {
+    synctex_tree_sibling_idx,       /* sibling */
+    synctex_tree_s_parent_idx,      /* parent */
+    synctex_tree_sp_child_idx,      /* child */
+    synctex_tree_spc_friend_idx,    /* friend */
+    synctex_tree_spcf_last_idx,     /* last */
+    synctex_tree_spcfl_next_hbox_idx,   /* next_hbox */
+    -1, /* arg_sibling */
+    synctex_tree_spcfln_target_idx, /* target */
+    synctex_tree_spcflnt_proxy_hbox_max
+};
+static const _synctex_data_model_s synctex_data_model_proxy = {
+    -1, /* tag */
+    -1, /* line */
+    -1, /* column */
+    synctex_data_proxy_h_idx, /* h */
+    synctex_data_proxy_v_idx, /* v */
+    -1, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    -1, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_proxy_hv_max
+};
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u 
data[synctex_tree_spcflnt_proxy_hbox_max+synctex_data_proxy_hv_max];
+} _synctex_node_proxy_hbox_s;
+
+/*  box proxy node creator */
+DEFINE_synctex_new_unscanned_NODE(proxy_hbox)
+
+static void _synctex_log_proxy(synctex_node_p node);
+static char * _synctex_abstract_proxy_hbox(synctex_node_p node);
+static void _synctex_display_proxy_hbox(synctex_node_p node);
+
+static int _synctex_proxy_tag(synctex_node_p);
+static int _synctex_proxy_line(synctex_node_p);
+static int _synctex_proxy_column(synctex_node_p);
+
+static _synctex_tlcpector_s synctex_tlcpector_proxy = {
+    &_synctex_proxy_tag,
+    &_synctex_proxy_line,
+    &_synctex_proxy_column,
+};
+static int _synctex_proxy_h(synctex_node_p);
+static int _synctex_proxy_v(synctex_node_p);
+static int _synctex_proxy_width(synctex_node_p);
+static int _synctex_proxy_height(synctex_node_p);
+static int _synctex_proxy_depth(synctex_node_p);
+static _synctex_inspector_s synctex_inspector_proxy_box = {
+    &_synctex_proxy_h,
+    &_synctex_proxy_v,
+    &_synctex_proxy_width,
+    &_synctex_proxy_height,
+    &_synctex_proxy_depth,
+};
+
+static float __synctex_proxy_visible_h(synctex_node_p);
+static float __synctex_proxy_visible_v(synctex_node_p);
+static float __synctex_proxy_visible_width(synctex_node_p);
+static float __synctex_proxy_visible_height(synctex_node_p);
+static float __synctex_proxy_visible_depth(synctex_node_p);
+
+static _synctex_vispector_s synctex_vispector_proxy_box = {
+    &__synctex_proxy_visible_h,
+    &__synctex_proxy_visible_v,
+    &__synctex_proxy_visible_width,
+    &__synctex_proxy_visible_height,
+    &__synctex_proxy_visible_depth,
+};
+
+static _synctex_class_s _synctex_class_proxy_hbox = {
+    NULL,                           /*  No scanner yet */
+    synctex_node_type_proxy_hbox,   /*  Node type */
+    &_synctex_new_proxy_hbox,       /*  creator */
+    &_synctex_free_node,            /*  destructor */
+    &_synctex_log_proxy,            /*  log */
+    &_synctex_display_proxy_hbox,   /*  display */
+    &_synctex_abstract_proxy_hbox,  /*  abstract */
+    &synctex_tree_model_proxy_hbox, /*  tree model */
+    &synctex_data_model_proxy,      /*  data model */
+    &synctex_tlcpector_proxy,       /*  tlcpector */
+    &synctex_inspector_proxy_box,   /*  inspector */
+    &synctex_vispector_proxy_box,   /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark vbox proxy.
+#   endif
+
+/*  A proxy to a vbox. */
+
+static const _synctex_tree_model_s synctex_tree_model_proxy_vbox = {
+    synctex_tree_sibling_idx,       /* sibling */
+    synctex_tree_s_parent_idx,      /* parent */
+    synctex_tree_sp_child_idx,      /* child */
+    synctex_tree_spc_friend_idx,    /* friend */
+    synctex_tree_spcf_last_idx, /* last */
+    -1, /* next_hbox */
+    -1, /* arg_sibling */
+    synctex_tree_spcfl_target_idx,    /* target */
+    synctex_tree_spcflt_proxy_vbox_max
+};
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u 
data[synctex_tree_spcflt_proxy_vbox_max+synctex_data_proxy_hv_max];
+} _synctex_node_proxy_vbox_s;
+
+/*  box proxy node creator */
+DEFINE_synctex_new_unscanned_NODE(proxy_vbox)
+
+static void _synctex_log_proxy(synctex_node_p node);
+static char * _synctex_abstract_proxy_vbox(synctex_node_p node);
+static void _synctex_display_proxy_vbox(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_proxy_vbox = {
+    NULL,                           /*  No scanner yet */
+    synctex_node_type_proxy_vbox,   /*  Node type */
+    &_synctex_new_proxy_vbox,       /*  creator */
+    &_synctex_free_node,            /*  destructor */
+    &_synctex_log_proxy,            /*  log */
+    &_synctex_display_proxy_vbox,   /*  display */
+    &_synctex_abstract_proxy_vbox,  /*  abstract */
+    &synctex_tree_model_proxy_vbox, /*  tree model */
+    &synctex_data_model_proxy,      /*  data model */
+    &synctex_tlcpector_proxy,       /*  tlcpector */
+    &synctex_inspector_proxy_box,   /*  inspector */
+    &synctex_vispector_proxy_box,   /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark proxy.
+#   endif
+
+/**
+ *  A proxy to a node but a box.
+ */
+
+static const _synctex_tree_model_s synctex_tree_model_proxy = {
+    synctex_tree_sibling_idx,   /* sibling */
+    synctex_tree_s_parent_idx,  /* parent */
+    -1, /* child */
+    synctex_tree_sp_friend_idx, /* friend */
+    -1, /* last */
+    -1, /* next_hbox */
+    -1, /* arg_sibling */
+    synctex_tree_spf_target_idx,/* target */
+    synctex_tree_spft_proxy_max
+};
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u 
data[synctex_tree_spft_proxy_max+synctex_data_proxy_hv_max];
+} _synctex_node_proxy_s;
+
+/*  proxy node creator */
+DEFINE_synctex_new_unscanned_NODE(proxy)
+
+static void _synctex_log_proxy(synctex_node_p node);
+static char * _synctex_abstract_proxy(synctex_node_p node);
+static void _synctex_display_proxy(synctex_node_p node);
+
+static _synctex_vispector_s synctex_vispector_proxy = {
+    &__synctex_proxy_visible_h,
+    &__synctex_proxy_visible_v,
+    &__synctex_proxy_visible_width,
+    &_synctex_float_none,
+    &_synctex_float_none,
+};
+
+static _synctex_class_s _synctex_class_proxy = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_proxy,    /*  Node type */
+    &_synctex_new_proxy,        /*  creator */
+    &_synctex_free_leaf,        /*  destructor */
+    &_synctex_log_proxy,        /*  log */
+    &_synctex_display_proxy,    /*  display */
+    &_synctex_abstract_proxy,   /*  abstract */
+    &synctex_tree_model_proxy,  /*  tree model */
+    &synctex_data_model_proxy,  /*  data model */
+    &synctex_tlcpector_proxy,   /*  tlcpector */
+    &synctex_inspector_proxy_box,   /*  inspector */
+    &synctex_vispector_proxy,   /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark last proxy.
+#   endif
+
+/**
+ *  A proxy to the last proxy/box boundary.
+ */
+
+static const _synctex_tree_model_s synctex_tree_model_proxy_last = {
+    synctex_tree_sibling_idx,   /* sibling */
+    synctex_tree_s_parent_idx,  /* parent */
+    -1, /* child */
+    synctex_tree_sp_friend_idx, /* friend */
+    -1, /* last */
+    -1, /* next_hbox */
+    synctex_tree_spf_arg_sibling_idx, /* arg_sibling */
+    synctex_tree_spfa_target_idx,     /* target */
+    synctex_tree_spfat_proxy_last_max
+};
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u 
data[synctex_tree_spfat_proxy_last_max+synctex_data_proxy_hv_max];
+} _synctex_node_proxy_last_s;
+
+/*  proxy node creator */
+DEFINE_synctex_new_unscanned_NODE(proxy_last)
+
+static void _synctex_log_proxy(synctex_node_p node);
+static char * _synctex_abstract_proxy(synctex_node_p node);
+static void _synctex_display_proxy(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_proxy_last = {
+    NULL,                           /*  No scanner yet */
+    synctex_node_type_proxy_last,   /*  Node type */
+    &_synctex_new_proxy,            /*  creator */
+    &_synctex_free_leaf,            /*  destructor */
+    &_synctex_log_proxy,            /*  log */
+    &_synctex_display_proxy,        /*  display */
+    &_synctex_abstract_proxy,       /*  abstract */
+    &synctex_tree_model_proxy_last, /*  tree model */
+    &synctex_data_model_proxy,      /*  data model */
+    &synctex_tlcpector_proxy,       /*  tlcpector */
+    &synctex_inspector_proxy_box,   /*  inspector */
+    &synctex_vispector_proxy,       /*  vispector */
+};
+
+#      ifdef SYNCTEX_NOTHING
+#       pragma mark handle.
+#   endif
+
+/**
+ *  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 = {
+    synctex_tree_sibling_idx,   /* sibling */
+    synctex_tree_s_parent_idx,  /* parent */
+    synctex_tree_sp_child_idx,  /* child */
+    -1, /* friend */
+    -1, /* last */
+    -1, /* next_hbox */
+    -1, /* arg_sibling */
+    synctex_tree_spc_target_idx,/* target */
+    synctex_tree_spct_handle_max
+};
+
+static const _synctex_data_model_s synctex_data_model_handle = {
+    -1, /* tag */
+    -1, /* line */
+    -1, /* column */
+    -1, /* h */
+    -1, /* v */
+    -1, /* width */
+    -1, /* height */
+    -1, /* depth */
+    -1, /* mean_line */
+    synctex_data_handle_w_idx, /* weight */
+    -1, /* h_V */
+    -1, /* v_V */
+    -1, /* width_V */
+    -1, /* height_V */
+    -1, /* depth_V */
+    -1, /* name */
+    -1, /* page */
+    synctex_data_handle_w_max
+};
+
+typedef struct {
+    SYNCTEX_DECLARE_CHARINDEX
+    synctex_class_p class_;
+    _synctex_data_u 
data[synctex_tree_spct_handle_max+synctex_data_handle_w_max];
+} _synctex_node_handle_s;
+
+/*  handle node creator */
+DEFINE_synctex_new_unscanned_NODE(handle)
+
+static void _synctex_log_handle(synctex_node_p node);
+static char * _synctex_abstract_handle(synctex_node_p node);
+static void _synctex_display_handle(synctex_node_p node);
+
+static _synctex_class_s _synctex_class_handle = {
+    NULL,                       /*  No scanner yet */
+    synctex_node_type_handle,   /*  Node type */
+    &_synctex_new_handle,       /*  creator */
+    &_synctex_free_handle,      /*  destructor */
+    &_synctex_log_handle,       /*  log */
+    &_synctex_display_handle,   /*  display */
+    &_synctex_abstract_handle,  /*  abstract */
+    &synctex_tree_model_handle, /*  tree model */
+    &synctex_data_model_handle, /*  data model */
+    &synctex_tlcpector_proxy,   /*  tlcpector */
+    &synctex_inspector_proxy_box,   /*  inspector */
+    &synctex_vispector_proxy_box,   /*  vispector */
+};
+
+SYNCTEX_INLINE static synctex_node_p 
_synctex_new_handle_with_target(synctex_node_p target) {
+    if (target) {
+        synctex_node_p result = _synctex_new_handle(target->class_->scanner);
+        if (result) {
+            _synctex_tree_set_target(result,target);
+            return result;
+        }
+    }
+    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 -
+#       pragma mark Navigation
+#   endif
+synctex_node_p synctex_node_parent(synctex_node_p node)
+{
+    return _synctex_tree_parent(node);
+}
+synctex_node_p synctex_node_parent_sheet(synctex_node_p node)
+{
+    while(node && synctex_node_type(node) != synctex_node_type_sheet) {
+        node = _synctex_tree_parent(node);
+    }
+    /*  exit the while loop either when node is NULL or node is a sheet */
+    return node;
+}
+synctex_node_p synctex_node_parent_form(synctex_node_p node)
+{
+    while(node && synctex_node_type(node) != synctex_node_type_form) {
+        node = _synctex_tree_parent(node);
+    }
+    /*  exit the while loop either when node is NULL or node is a form */
+    return node;
+}
+
+/**
+ *  The returned proxy will be the child or a sibling of source.
+ *  The returned proxy has no parent, child nor sibling.
+ *  Used only by __synctex_replace_ref.
+ *  argument to_node: a box, not a proxy nor anything else.
+ */
+SYNCTEX_INLINE static synctex_node_p 
__synctex_new_proxy_from_ref_to(synctex_node_p ref, synctex_node_p to_node) {
+    synctex_node_p proxy = NULL;
+    if (!ref || !to_node) {
+        return NULL;
+    }
+    switch(synctex_node_type(to_node)) {
+        case synctex_node_type_vbox:
+            proxy = _synctex_new_proxy_vbox(ref->class_->scanner);
+            break;
+        case synctex_node_type_hbox:
+            proxy = _synctex_new_proxy_hbox(ref->class_->scanner);
+            break;
+        default:
+            _synctex_error("!  __synctex_new_proxy_from_ref_to. Unexpected 
form child (%s). Please report.", synctex_node_isa(to_node));
+            return NULL;
+    }
+    if (!proxy) {

@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.



_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit

Reply via email to