Revision: 9425
http://sourceforge.net/p/skim-app/code/9425
Author: hofman
Date: 2017-09-26 12:50:12 +0000 (Tue, 26 Sep 2017)
Log Message:
-----------
update synctex to version 1.19
Modified Paths:
--------------
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.h
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.m
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_local.h
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_readme.txt
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_utils.h
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_utils.m
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_version.txt
Added Paths:
-----------
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_c-auto.h
trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser_private.h
Modified: trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.h
===================================================================
--- trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.h
2017-06-03 17:02:13 UTC (rev 9424)
+++ trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.h
2017-09-26 12:50:12 UTC (rev 9425)
@@ -1,57 +1,57 @@
-/*
-Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr
+/*
+ Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr
+
+ This file is part of the SyncTeX package.
+
+ Latest Revision: Tue Jun 14 08:23:30 UTC 2011
+
+ Version: 1.19
+
+ See synctex_parser_readme.txt 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.
+
+ Version 1
+ Thu Jun 19 09:39:21 UTC 2008
+
+ */
-This file is part of the SyncTeX package.
-
-Latest Revision: Tue Jun 14 08:23:30 UTC 2011
-
-Version: 1.16
-
-See synctex_parser_readme.txt 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.
-
-Version 1
-Thu Jun 19 09:39:21 UTC 2008
-
-*/
-
#ifndef __SYNCTEX_PARSER__
# define __SYNCTEX_PARSER__
@@ -58,287 +58,345 @@
#ifdef __cplusplus
extern "C" {
#endif
-
-/* synctex_node_t is the type for all synctex nodes.
- * The synctex file is parsed into a tree of nodes, either sheet, boxes, math
nodes... */
-typedef struct _synctex_node * synctex_node_t;
-
-/* The main synctex object is a scanner
- * Its implementation is considered private.
- * The basic workflow is
- * - create a "synctex scanner" with the contents of a file
- * - perform actions on that scanner like display or edit queries
- * - free the scanner when the work is done
- */
-typedef struct __synctex_scanner_t _synctex_scanner_t;
-typedef _synctex_scanner_t * synctex_scanner_t;
-
-/* This is the designated method to create a new synctex scanner object.
- * output is the pdf/dvi/xdv file associated to the synctex file.
- * If necessary, it can be the tex file that originated the synctex file
- * but this might cause problems if the \jobname has a custom value.
- * Despite this method can accept a relative path in practice,
- * you should only pass a full path name.
- * The path should be encoded by the underlying file system,
- * assuming that it is based on 8 bits characters, including UTF8,
- * not 16 bits nor 32 bits.
- * The last file extension is removed and replaced by the proper extension.
- * Then the private method _synctex_scanner_new_with_contents_of_file is
called.
- * NULL is returned in case of an error or non existent file.
- * Once you have a scanner, use the synctex_display_query and
synctex_edit_query below.
- * The new "build_directory" argument is available since version 1.5.
- * It is the directory where all the auxiliary stuff is created.
- * Sometimes, the synctex output file and the pdf, dvi or xdv files are
not created in the same directory.
- * This is the case in MikTeX (I will include this into TeX Live).
- * This directory path can be nil, it will be ignored then.
- * It can be either absolute or relative to the directory of the output
pdf (dvi or xdv) file.
- * If no synctex file is found in the same directory as the output file,
then we try to find one in the build directory.
- * Please note that this new "build_directory" is provided as a convenient
argument but should not be used.
- * In fact, this is implempented as a work around of a bug in MikTeX where
the synctex file does not follow the pdf file.
- * The new "parse" argument is available since version 1.5. In general, use 1.
- * Use 0 only if you do not want to parse the content but just check the
existence.
- */
-synctex_scanner_t synctex_scanner_new_with_output_file(const char * output,
const char * build_directory, int parse);
-
-/* This is the designated method to delete a synctex scanner object.
- * Frees all the memory, you must call it when you are finished with the
scanner.
- */
-void synctex_scanner_free(synctex_scanner_t scanner);
-
-/* Send this message to force the scanner to parse the contents of the
synctex output file.
- * Nothing is performed if the file was already parsed.
- * In each query below, this message is sent, but if you need to access
information more directly,
- * you must be sure that the parsing did occur.
- * Usage:
- * if((my_scanner = synctex_scanner_parse(my_scanner))) {
- * continue with my_scanner...
- * } else {
- * there was a problem
- * }
- */
-synctex_scanner_t synctex_scanner_parse(synctex_scanner_t scanner);
-
-/* The main entry points.
- * Given the file name, a line and a column number, synctex_display_query
returns the number of nodes
- * satisfying the contrain. Use code like
- *
- * if(synctex_display_query(scanner,name,line,column)>0) {
- * synctex_node_t node;
- * while((node = synctex_next_result(scanner))) {
- * // do something with node
- * ...
- * }
- * }
- *
- * For example, one can
- * - highlight each resulting node in the output, using synctex_node_h and
synctex_node_v
- * - highlight all the rectangles enclosing those nodes, using synctex_box_...
functions
- * - highlight just the character using that information
- *
- * Given the page and the position in the page, synctex_edit_query returns
the number of nodes
- * satisfying the contrain. Use code like
- *
- * if(synctex_edit_query(scanner,page,h,v)>0) {
- * synctex_node_t node;
- * while(node = synctex_next_result(scanner)) {
- * // do something with node
- * ...
- * }
- * }
- *
- * For example, one can
- * - highlight each resulting line in the input,
- * - highlight just the character using that information
- *
- * page is 1 based
- * h and v are coordinates in 72 dpi unit, relative to the top left corner of
the page.
- * If you make a new query, the result of the previous one is discarded.
- * If one of this function returns a non positive integer,
- * it means that an error occurred.
- *
- * Both methods are conservative, in the sense that matching is weak.
- * If the exact column number is not found, there will be an answer with the
whole line.
- *
- * Sumatra-PDF, Skim, iTeXMac2 and Texworks are examples of open source
software that use this library.
- * You can browse their code for a concrete implementation.
- */
-int synctex_display_query(synctex_scanner_t scanner,const char * name,int
line,int column);
-int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v);
-synctex_node_t synctex_next_result(synctex_scanner_t scanner);
-
-/* Display all the information contained in the scanner object.
- * If the records are too numerous, only the first ones are displayed.
- * This is mainly for informatinal purpose to help developers.
- */
-void synctex_scanner_display(synctex_scanner_t scanner);
-
-/* The x and y offset of the origin in TeX coordinates. The magnification
- These are used by pdf viewers that want to display the real box size.
- For example, getting the horizontal coordinates of a node would require
-
synctex_node_box_h(node)*synctex_scanner_magnification(scanner)+synctex_scanner_x_offset(scanner)
- Getting its TeX width would simply require
- synctex_node_box_width(node)*synctex_scanner_magnification(scanner)
- but direct methods are available for that below.
- */
-int synctex_scanner_x_offset(synctex_scanner_t scanner);
-int synctex_scanner_y_offset(synctex_scanner_t scanner);
-float synctex_scanner_magnification(synctex_scanner_t scanner);
-
-/* Managing the input file names.
- * Given a tag, synctex_scanner_get_name will return the corresponding file
name.
- * Conversely, given a file name, synctex_scanner_get_tag will retur, the
corresponding tag.
- * The file name must be the very same as understood by TeX.
- * For example, if you \input myDir/foo.tex, the file name is myDir/foo.tex.
- * No automatic path expansion is performed.
- * Finally, synctex_scanner_input is the first input node of the scanner.
- * To browse all the input node, use a loop like
- *
- * if((input_node = synctex_scanner_input(scanner))){
- * do {
- * blah
- * } while((input_node=synctex_node_sibling(input_node)));
- * }
- *
- * The output is the name that was used to create the scanner.
- * The synctex is the real name of the synctex file,
- * it was obtained from output by setting the proper file extension.
- */
-const char * synctex_scanner_get_name(synctex_scanner_t scanner,int tag);
-int synctex_scanner_get_tag(synctex_scanner_t scanner,const char * name);
-synctex_node_t synctex_scanner_input(synctex_scanner_t scanner);
-const char * synctex_scanner_get_output(synctex_scanner_t scanner);
-const char * synctex_scanner_get_synctex(synctex_scanner_t scanner);
-
-/* Browsing the nodes
- * parent, child and sibling are standard names for tree nodes.
- * The parent is one level higher, the child is one level deeper,
- * and the sibling is at the same level.
- * The sheet of a node is the first ancestor, it is of type sheet.
- * A node and its sibling have the same parent.
- * A node is the parent of its child.
- * A node is either the child of its parent,
- * or belongs to the sibling chain of its parent's child.
- * The next node is either the child, the sibling or the parent's sibling,
- * unless the parent is a sheet.
- * This allows to navigate through all the nodes of a given sheet node:
- *
- * synctex_node_t node = sheet;
- * while((node = synctex_node_next(node))) {
- * // do something with node
- * }
- *
- * With synctex_sheet_content, you can retrieve the sheet node given the page.
- * The page is 1 based, according to TeX standards.
- * Conversely synctex_node_sheet allows to retrieve the sheet containing a
given node.
- */
-synctex_node_t synctex_node_parent(synctex_node_t node);
-synctex_node_t synctex_node_sheet(synctex_node_t node);
-synctex_node_t synctex_node_child(synctex_node_t node);
-synctex_node_t synctex_node_sibling(synctex_node_t node);
-synctex_node_t synctex_node_next(synctex_node_t node);
-synctex_node_t synctex_sheet_content(synctex_scanner_t scanner,int page);
-
-/* These are the types of the synctex nodes */
-typedef enum {
- synctex_node_type_error = 0,
- synctex_node_type_input,
- synctex_node_type_sheet,
- synctex_node_type_vbox,
- synctex_node_type_void_vbox,
- synctex_node_type_hbox,
- synctex_node_type_void_hbox,
- synctex_node_type_kern,
- synctex_node_type_glue,
- synctex_node_type_math,
- synctex_node_type_boundary,
- synctex_node_number_of_types
-} synctex_node_type_t;
-
-/* synctex_node_type gives the type of a given node,
- * synctex_node_isa gives the same information as a human readable text. */
-synctex_node_type_t synctex_node_type(synctex_node_t node);
-const char * synctex_node_isa(synctex_node_t node);
-
-/* This is primarily used for debugging purpose.
- * The second one logs information for the node and recursively displays
information for its next node */
-void synctex_node_log(synctex_node_t node);
-void synctex_node_display(synctex_node_t node);
-
-/* Given a node, access to its tag, line and column.
- * The line and column numbers are 1 based.
- * The latter is not yet fully supported in TeX, the default implementation
returns 0 which means the whole line.
- * When the tag is known, the scanner of the node will give the corresponding
file name.
- * When the tag is known, the scanner of the node will give the name.
- */
-int synctex_node_tag(synctex_node_t node);
-int synctex_node_line(synctex_node_t node);
-int synctex_node_column(synctex_node_t node);
-
-/* This is the page where the node appears.
- * This is a 1 based index as given by TeX.
- */
-int synctex_node_page(synctex_node_t node);
-
-/* For quite all nodes, horizontal, vertical coordinates, and width.
- * These are expressed in TeX small points coordinates, with origin at the
top left corner.
- */
-int synctex_node_h(synctex_node_t node);
-int synctex_node_v(synctex_node_t node);
-int synctex_node_width(synctex_node_t node);
-
-/* For all nodes, dimensions of the enclosing box.
- * These are expressed in TeX small points coordinates, with origin at the
top left corner.
- * A box is enclosing itself.
- */
-int synctex_node_box_h(synctex_node_t node);
-int synctex_node_box_v(synctex_node_t node);
-int synctex_node_box_width(synctex_node_t node);
-int synctex_node_box_height(synctex_node_t node);
-int synctex_node_box_depth(synctex_node_t node);
-
-/* For quite all nodes, horizontal, vertical coordinates, and width.
- * The visible dimensions are bigger than real ones to compensate 0 width
boxes
- * that do contain nodes.
- * These are expressed in page coordinates, with origin at the top left
corner.
- * A box is enclosing itself.
- */
-float synctex_node_visible_h(synctex_node_t node);
-float synctex_node_visible_v(synctex_node_t node);
-float synctex_node_visible_width(synctex_node_t node);
-/* For all nodes, visible dimensions of the enclosing box.
- * A box is enclosing itself.
- * The visible dimensions are bigger than real ones to compensate 0 width
boxes
- * that do contain nodes.
- */
-float synctex_node_box_visible_h(synctex_node_t node);
-float synctex_node_box_visible_v(synctex_node_t node);
-float synctex_node_box_visible_width(synctex_node_t node);
-float synctex_node_box_visible_height(synctex_node_t node);
-float synctex_node_box_visible_depth(synctex_node_t node);
-
-/* The main synctex updater object.
- * This object is used to append information to the synctex file.
- * Its implementation is considered private.
- * It is used by the synctex command line tool to take into account
modifications
- * that could occur while postprocessing files by dvipdf like filters.
- */
-typedef struct __synctex_updater_t _synctex_updater_t;
-typedef _synctex_updater_t * synctex_updater_t;
-
-/* Designated initializer.
- * Once you are done with your whole job,
- * free the updater */
-synctex_updater_t synctex_updater_new_with_output_file(const char * output,
const char * directory);
-
-/* Use the next functions to append records to the synctex file,
- * no consistency tests made on the arguments */
-void synctex_updater_append_magnification(synctex_updater_t updater, char *
magnification);
-void synctex_updater_append_x_offset(synctex_updater_t updater, char *
x_offset);
-void synctex_updater_append_y_offset(synctex_updater_t updater, char *
y_offset);
-
-/* You MUST free the updater, once everything is properly appended */
-void synctex_updater_free(synctex_updater_t updater);
-
+
+# define SYNCTEX_VERSION_STRING "1.19"
+
+ /* The main synctex object is a scanner
+ * Its implementation is considered private.
+ * The basic workflow is
+ * - create a "synctex scanner" with the contents of a file
+ * - perform actions on that scanner like display or edit queries
+ * - free the scanner when the work is done
+ */
+ typedef struct synctex_scanner_t synctex_scanner_s;
+ typedef synctex_scanner_s * synctex_scanner_p;
+
+ /* This is the designated method to create a new synctex scanner object.
+ * output is the pdf/dvi/xdv file associated to the synctex file.
+ * If necessary, it can be the tex file that originated the synctex file
+ * but this might cause problems if the \jobname has a custom value.
+ * Despite this method can accept a relative path in practice,
+ * you should only pass a full path name.
+ * The path should be encoded by the underlying file system,
+ * assuming that it is based on 8 bits characters, including UTF8,
+ * not 16 bits nor 32 bits.
+ * The last file extension is removed and replaced by the proper
extension.
+ * Then the private method _synctex_scanner_new_with_contents_of_file is
called.
+ * NULL is returned in case of an error or non existent file.
+ * Once you have a scanner, use the synctex_display_query and
synctex_edit_query below.
+ * The new "build_directory" argument is available since version 1.5.
+ * It is the directory where all the auxiliary stuff is created.
+ * Sometimes, the synctex output file and the pdf, dvi or xdv files are
not created in the same directory.
+ * This is the case in MikTeX (I will include this into TeX Live).
+ * This directory path can be nil, it will be ignored then.
+ * It can be either absolute or relative to the directory of the output
pdf (dvi or xdv) file.
+ * If no synctex file is found in the same directory as the output file,
then we try to find one in the build directory.
+ * Please note that this new "build_directory" is provided as a
convenient argument but should not be used.
+ * In fact, this is implempented as a work around of a bug in MikTeX
where the synctex file does not follow the pdf file.
+ * The new "parse" argument is available since version 1.5. In general,
use 1.
+ * Use 0 only if you do not want to parse the content but just check the
existence.
+ */
+ synctex_scanner_p synctex_scanner_new_with_output_file(const char *
output, const char * build_directory, int parse);
+
+ /* This is the designated method to delete a synctex scanner object.
+ * Frees all the memory, you must call it when you are finished with the
scanner.
+ */
+ void synctex_scanner_free(synctex_scanner_p scanner);
+
+ /* Send this message to force the scanner to parse the contents of the
synctex output file.
+ * Nothing is performed if the file was already parsed.
+ * In each query below, this message is sent, but if you need to access
information more directly,
+ * you must be sure that the parsing did occur.
+ * Usage:
+ * if((my_scanner = synctex_scanner_parse(my_scanner))) {
+ * continue with my_scanner...
+ * } else {
+ * there was a problem
+ * }
+ */
+ synctex_scanner_p synctex_scanner_parse(synctex_scanner_p scanner);
+
+ /* synctex_node_p is the type for all synctex nodes.
+ * The synctex file is parsed into a tree of nodes, either sheet, boxes,
math nodes... */
+
+ typedef struct synctex_node_t synctex_node_s;
+ typedef synctex_node_s * synctex_node_p;
+
+ /* The main entry points.
+ * Given the file name, a line and a column number, synctex_display_query
returns the number of nodes
+ * satisfying the contrain. Use code like
+ *
+ * if(synctex_display_query(scanner,name,line,column)>0) {
+ * synctex_node_s node;
+ * while((node = synctex_next_result(scanner))) {
+ * // do something with node
+ * ...
+ * }
+ * }
+ *
+ * For example, one can
+ * - highlight each resulting node in the output, using synctex_node_h and
synctex_node_v
+ * - highlight all the rectangles enclosing those nodes, using
synctex_box_... functions
+ * - highlight just the character using that information
+ *
+ * Given the page and the position in the page, synctex_edit_query
returns the number of nodes
+ * satisfying the contrain. Use code like
+ *
+ * if(synctex_edit_query(scanner,page,h,v)>0) {
+ * synctex_node_p node;
+ * while(node = synctex_next_result(scanner)) {
+ * // do something with node
+ * ...
+ * }
+ * }
+ *
+ * For example, one can
+ * - highlight each resulting line in the input,
+ * - highlight just the character using that information
+ *
+ * page is 1 based
+ * h and v are coordinates in 72 dpi unit, relative to the top left
corner of the page.
+ * If you make a new query, the result of the previous one is discarded.
+ * If one of this function returns a non positive integer,
+ * it means that an error occurred.
+ *
+ * Both methods are conservative, in the sense that matching is weak.
+ * If the exact column number is not found, there will be an answer with
the whole line.
+ *
+ * Sumatra-PDF, Skim, iTeXMac2 and Texworks are examples of open source
software that use this library.
+ * You can browse their code for a concrete implementation.
+ */
+ typedef long synctex_status_t;
+ /* The page_hint argument is used to resolve ambiguities.
+ * Whenever, different matches occur, the ones closest
+ * to the page will be given first. Pass a negative number
+ * when in doubt. Using pdf forms may lead to ambiguities.
+ */
+ synctex_status_t synctex_display_query(synctex_scanner_p scanner,const
char * name,int line,int column, int page_hint);
+ synctex_status_t synctex_edit_query(synctex_scanner_p scanner,int
page,float h,float v);
+ synctex_node_p synctex_next_result(synctex_scanner_p scanner);
+ synctex_status_t synctex_reset_result(synctex_scanner_p scanner);
+
+ /* Display all the information contained in the scanner object.
+ * If the records are too numerous, only the first ones are displayed.
+ * This is mainly for informatinal purpose to help developers.
+ */
+ void synctex_scanner_display(synctex_scanner_p scanner);
+
+ /* The x and y offset of the origin in TeX coordinates. The magnification
+ These are used by pdf viewers that want to display the real box size.
+ For example, getting the horizontal coordinates of a node would require
+
synctex_node_box_h(node)*synctex_scanner_magnification(scanner)+synctex_scanner_x_offset(scanner)
+ Getting its TeX width would simply require
+ synctex_node_box_width(node)*synctex_scanner_magnification(scanner)
+ but direct methods are available for that below.
+ */
+ int synctex_scanner_x_offset(synctex_scanner_p scanner);
+ int synctex_scanner_y_offset(synctex_scanner_p scanner);
+ float synctex_scanner_magnification(synctex_scanner_p scanner);
+
+ /* Managing the input file names.
+ * Given a tag, synctex_scanner_get_name will return the corresponding
file name.
+ * Conversely, given a file name, synctex_scanner_get_tag will retur, the
corresponding tag.
+ * The file name must be the very same as understood by TeX.
+ * For example, if you \input myDir/foo.tex, the file name is
myDir/foo.tex.
+ * No automatic path expansion is performed.
+ * Finally, synctex_scanner_input is the first input node of the scanner.
+ * To browse all the input node, use a loop like
+ * ...
+ * synctex_node_p = input_node;
+ * ...
+ * if((input_node = synctex_scanner_input(scanner))) {
+ * do {
+ * blah
+ * } while((input_node=synctex_node_sibling(input_node)));
+ * }
+ *
+ * The output is the name that was used to create the scanner.
+ * The synctex is the real name of the synctex file,
+ * it was obtained from output by setting the proper file extension.
+ */
+ const char * synctex_scanner_get_name(synctex_scanner_p scanner,int tag);
+ int synctex_scanner_get_tag(synctex_scanner_p scanner,const char * name);
+ synctex_node_p synctex_scanner_input(synctex_scanner_p scanner);
+ synctex_node_p synctex_scanner_input_with_tag(synctex_scanner_p
scanner,int tag);
+ const char * synctex_scanner_get_output(synctex_scanner_p scanner);
+ const char * synctex_scanner_get_synctex(synctex_scanner_p scanner);
+
+ /* Browsing the nodes
+ * parent, child and sibling are standard names for tree nodes.
+ * The parent is one level higher, the child is one level deeper,
+ * and the sibling is at the same level.
+ * The sheet of a node is the first ancestor, it is of type sheet.
+ * A node and its sibling have the same parent.
+ * A node is the parent of its child.
+ * A node is either the child of its parent,
+ * or belongs to the sibling chain of its parent's child.
+ * The next node is either the child, the sibling or the parent's sibling,
+ * unless the parent is a sheet.
+ * This allows to navigate through all the nodes of a given sheet node:
+ *
+ * synctex_node_p node = sheet;
+ * while((node = synctex_node_next(node))) {
+ * // do something with node
+ * }
+ *
+ * With synctex_sheet_content, you can retrieve the sheet node given the
page.
+ * The page is 1 based, according to TeX standards.
+ * Conversely synctex_node_parent_sheet allows to retrieve the sheet
containing a given node.
+ */
+
+ synctex_node_p synctex_node_parent(synctex_node_p node);
+ synctex_node_p synctex_node_parent_sheet(synctex_node_p node);
+ synctex_node_p synctex_node_parent_form(synctex_node_p node);
+ synctex_node_p synctex_node_child(synctex_node_p node);
+ synctex_node_p synctex_node_last_child(synctex_node_p node);
+ synctex_node_p synctex_node_sibling(synctex_node_p node);
+ synctex_node_p synctex_node_last_sibling(synctex_node_p node);
+ synctex_node_p synctex_node_arg_sibling(synctex_node_p node);
+ synctex_node_p synctex_node_next(synctex_node_p node);
+
+ synctex_node_p synctex_sheet(synctex_scanner_p scanner,int page);
+ synctex_node_p synctex_sheet_content(synctex_scanner_p scanner,int page);
+ synctex_node_p synctex_form(synctex_scanner_p scanner,int tag);
+ synctex_node_p synctex_form_content(synctex_scanner_p scanner,int tag);
+
+ /* These are the types of the synctex nodes */
+ typedef enum {
+ synctex_node_type_none,
+ synctex_node_type_input,
+ synctex_node_type_sheet,
+ synctex_node_type_form,
+ synctex_node_type_ref,
+ synctex_node_type_vbox,
+ synctex_node_type_void_vbox,
+ synctex_node_type_hbox,
+ synctex_node_type_void_hbox,
+ synctex_node_type_kern,
+ synctex_node_type_glue,
+ synctex_node_type_rule,
+ synctex_node_type_math,
+ synctex_node_type_boundary,
+ synctex_node_type_box_bdry,
+ synctex_node_type_proxy,
+ synctex_node_type_last_proxy,
+ synctex_node_type_vbox_proxy,
+ synctex_node_type_hbox_proxy,
+ synctex_node_type_result,
+ synctex_node_number_of_types
+ } synctex_node_type_t;
+ /* synctex_node_type gives the type of a given node,
+ * synctex_node_isa gives the same information as a human readable text.
*/
+ synctex_node_type_t synctex_node_type(synctex_node_p node);
+ synctex_node_type_t synctex_node_target_type(synctex_node_p node);
+ const char * synctex_node_isa(synctex_node_p node);
+
+ /* This is primarily used for debugging purpose.
+ * The second one logs information for the node and recursively displays
information for its next node */
+ void synctex_node_log(synctex_node_p node);
+ void synctex_node_display(synctex_node_p node);
+ /**
+ * Scanner display switcher getter.
+ * If the switcher is 0, synctex_node_display is disabled.
+ * If the switcher is <0, synctex_node_display has no limit.
+ * If the switcher is >0, only the first switcher (as number) nodes are
displayed.
+ * - parameter: a scanner
+ * - returns: an integer
+ */
+ int synctex_scanner_display_switcher(synctex_scanner_p scanR);
+ void synctex_scanner_set_display_switcher(synctex_scanner_p scanR, int
switcher);
+ /* Given a node, access to its tag, line and column.
+ * The line and column numbers are 1 based.
+ * The latter is not yet fully supported in TeX, the default
implementation returns 0 which means the whole line.
+ * When the tag is known, the scanner of the node will give the
corresponding file name.
+ * When the tag is known, the scanner of the node will give the name.
+ */
+ int synctex_node_tag(synctex_node_p node);
+ int synctex_node_line(synctex_node_p node);
+ int synctex_node_column(synctex_node_p node);
+
+ /* In order to enhance forward synchronization,
+ * non void horizontal boxes have supplemental cached information.
+ * The mean line is the average of the line numbers of the included nodes.
+ * The child count is the number of chidren.
+ */
+ int synctex_node_mean_line(synctex_node_p node);
+ int synctex_node_child_count(synctex_node_p node);
+
+ /* This is the page where the node appears.
+ * This is a 1 based index as given by TeX.
+ */
+ int synctex_node_page(synctex_node_p node);
+
+ /* For quite all nodes, horizontal, vertical coordinates, and width.
+ * These are expressed in TeX small points coordinates, with origin at
the top left corner.
+ */
+ int synctex_node_h(synctex_node_p node);
+ int synctex_node_v(synctex_node_p node);
+ int synctex_node_width(synctex_node_p node);
+ int synctex_node_height(synctex_node_p node);
+ int synctex_node_depth(synctex_node_p node);
+
+ /* For all nodes, dimensions of the enclosing box.
+ * These are expressed in TeX small points coordinates, with origin at
the top left corner.
+ * A box is enclosing itself.
+ */
+ int synctex_node_box_h(synctex_node_p node);
+ int synctex_node_box_v(synctex_node_p node);
+ int synctex_node_box_width(synctex_node_p node);
+ int synctex_node_box_height(synctex_node_p node);
+ int synctex_node_box_depth(synctex_node_p node);
+
+ /* For quite all nodes, horizontal, vertical coordinates, and width.
+ * The visible dimensions are bigger than real ones to compensate 0 width
boxes
+ * that do contain nodes.
+ * These are expressed in page coordinates, with origin at the top left
corner.
+ * A box is enclosing itself.
+ */
+ float synctex_node_visible_h(synctex_node_p node);
+ float synctex_node_visible_v(synctex_node_p node);
+ float synctex_node_visible_width(synctex_node_p node);
+ float synctex_node_visible_height(synctex_node_p node);
+ float synctex_node_visible_depth(synctex_node_p node);
+ typedef struct {
+ float location;
+ float length;
+ } synctex_visible_range_s;
+ synctex_visible_range_s synctex_node_h_visible_range(synctex_node_p node);
+ /* For all nodes, visible dimensions of the enclosing box.
+ * A box is enclosing itself.
+ * The visible dimensions are bigger than real ones to compensate 0 width
boxes
+ * that do contain nodes.
+ */
+ float synctex_node_box_visible_h(synctex_node_p node);
+ float synctex_node_box_visible_v(synctex_node_p node);
+ float synctex_node_box_visible_width(synctex_node_p node);
+ float synctex_node_box_visible_height(synctex_node_p node);
+ float synctex_node_box_visible_depth(synctex_node_p node);
+
+ /* The main synctex updater object.
+ * This object is used to append information to the synctex file.
+ * Its implementation is considered private.
+ * It is used by the synctex command line tool to take into account
modifications
+ * that could occur while postprocessing files by dvipdf like filters.
+ */
+ typedef struct synctex_updater_t synctex_updater_s;
+ typedef synctex_updater_s * synctex_updater_p;
+
+ /* Designated initializer.
+ * Once you are done with your whole job,
+ * free the updater */
+ synctex_updater_p synctex_updater_new_with_output_file(const char *
output, const char * directory);
+
+ /* Use the next functions to append records to the synctex file,
+ * no consistency tests made on the arguments */
+ void synctex_updater_append_magnification(synctex_updater_p updater, char
* magnification);
+ void synctex_updater_append_x_offset(synctex_updater_p updater, char *
x_offset);
+ void synctex_updater_append_y_offset(synctex_updater_p updater, char *
y_offset);
+
+ /* You MUST free the updater, once everything is properly appended */
+ void synctex_updater_free(synctex_updater_p updater);
+
#ifdef __cplusplus
}
#endif
Modified: trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.m
===================================================================
--- trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.m
2017-06-03 17:02:13 UTC (rev 9424)
+++ trunk/vendorsrc/jeromelaurens/synctex-parser/synctex_parser.m
2017-09-26 12:50:12 UTC (rev 9425)
@@ -1,57 +1,54 @@
-/*
-Copyright (c) 2008, 2009, 2010 , 2011 jerome DOT laurens AT u-bourgogne DOT fr
+/*
+ Copyright (c) 2008-2017 jerome DOT laurens AT u-bourgogne DOT fr
+
+ This file is part of the SyncTeX package.
+
+ Latest Revision: Thu Mar 9 21:26:27 UTC 2017
+
+ Version: 1.19
+
+ See synctex_parser_readme.txt 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.
+
+ */
-This file is part of the SyncTeX package.
-
-Latest Revision: Tue Jun 14 08:23:30 UTC 2011
-
-Version: 1.16
-
-See synctex_parser_readme.txt 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.
-
-Version 1
-Thu Jun 19 09:39:21 UTC 2008
-
-*/
-
/* 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,
@@ -59,12 +56,40 @@
* 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.19
+ * \date Mon Apr 24 07:08:56 UTC 2017
+ *
+ * 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_next_result
+ * - synctex_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 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.
+ */
# 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)
+# if defined(_MSC_VER)
# define SYNCTEX_INLINE __inline
# else
# define SYNCTEX_INLINE inline
@@ -81,177 +106,362 @@
#include <locale.h>
#endif
-/* 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 leaf of the tree is a 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, containing boxes, glues, kerns...
- * The third tree allows to browse leaves according to tag and line.
- */
+#include "synctex_parser_private.h"
-#include "synctex_parser.h"
-#include "synctex_parser_utils.h"
-
+SYNCTEX_INLINE static int _synctex_abs(int x) {
+ return x>0? x: -x;
+}
/* These are the possible extensions of the synctex file */
const char * synctex_suffix = ".synctex";
const char * synctex_suffix_gz = ".gz";
-/* each synctex node has a class */
-typedef struct __synctex_class_t _synctex_class_t;
-typedef _synctex_class_t * synctex_class_t;
+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);
-
-/* synctex_node_t is a pointer to a node
- * _synctex_node is the target of the synctex_node_t pointer
- * It is a pseudo object oriented program.
- * class is a pointer to the class object the node belongs to.
- * implementation is meant to contain the private data of the node
- * basically, there are 2 kinds of information: navigation information and
- * synctex information. Both will depend on the type of the node,
- * thus different nodes will have different private data.
- * There is no inheritancy overhead.
+/**
+ * Pseudo class.
+ * - author: J. Laurens
+ *
+ * Each nodes has a class, it is therefore called an object.
+ * Each class has a unique scanner.
+ * Each class has a type which is a unique identifier.
+ * Each class has a node mask which identifies node's attributes.
+ * Each class has an info mask which info's attributes.
+ * The class points to various methods,
+ * each of them vary amongst objects.
+ * The navigator records the offsets of the tree members getters.
+ * The modelator records the offsets of the data members getters, relative to
the last navigator getter.
*/
-typedef union _synctex_info_t {
- int INT;
- char * PTR;
-} synctex_info_t;
-struct _synctex_node {
- synctex_class_t class;
- synctex_info_t * implementation;
+typedef struct synctex_tree_model_t {
+ int sibling;
+ int parent;
+ int child;
+ int friend;
+ int last;
+ int next_hbox;
+ int arg_sibling;
+ int target;
+ int size;
+} synctex_tree_model_s;
+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;
+
+static const synctex_data_model_s synctex_data_model_none = {
+ -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 */
+ -1, /* page */
+ 0
};
+typedef const synctex_data_model_s * synctex_data_model_p;
-/* Each node of the tree, except the scanner itself belongs to a class.
- * The class object is just a struct declaring the owning scanner
- * This is a pointer to the scanner as root of the tree.
- * The type is used to identify the kind of node.
- * The class declares pointers to a creator and a destructor method.
- * The log and display fields are used to log and display the node.
- * display will also display the child, sibling and parent sibling.
- * parent, child and sibling are used to navigate the tree,
- * from TeX box hierarchy point of view.
- * The friend field points to a method which allows to navigate from friend
to friend.
- * A friend is a node with very close tag and line numbers.
- * Finally, the info field point to a method giving the private node info
offset.
- */
+typedef int (*synctex_int_getter_f)(synctex_node_p);
+typedef struct synctex_tlcpector_t {
+ synctex_int_getter_f tag;
+ synctex_int_getter_f line;
+ 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) {
+# ifdef __DARWIN_UNIX03
+# pragma unused(node)
+# endif
+ return 0;
+}
+static const synctex_tlcpector_s synctex_tlcpector_none = {
+ &_synctex_int_none, /* tag */
+ &_synctex_int_none, /* line */
+ &_synctex_int_none, /* column */
+};
-typedef synctex_node_t *(*_synctex_node_getter_t)(synctex_node_t);
-typedef synctex_info_t *(*_synctex_info_getter_t)(synctex_node_t);
+typedef struct synctex_inspector_t {
+ synctex_int_getter_f h;
+ synctex_int_getter_f v;
+ synctex_int_getter_f width;
+ synctex_int_getter_f height;
+ 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 */
+};
-struct __synctex_class_t {
- synctex_scanner_t scanner;
- int type;
- synctex_node_t (*new)(synctex_scanner_t scanner);
- void (*free)(synctex_node_t);
- void (*log)(synctex_node_t);
- void (*display)(synctex_node_t);
- _synctex_node_getter_t parent;
- _synctex_node_getter_t child;
- _synctex_node_getter_t sibling;
- _synctex_node_getter_t friend;
- _synctex_node_getter_t next_box;
- _synctex_info_getter_t info;
+typedef float (*synctex_float_getter_f)(synctex_node_p);
+typedef struct synctex_vispector_t {
+ synctex_float_getter_f h;
+ synctex_float_getter_f v;
+ synctex_float_getter_f width;
+ synctex_float_getter_f height;
+ synctex_float_getter_f depth;
+} synctex_vispector_s;
+static float _synctex_float_none(synctex_node_p node) {
+# ifdef __DARWIN_UNIX03
+# pragma unused(node)
+# endif
+ 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_mask_t node_mask;
+ 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;
+};
+
# ifdef SYNCTEX_NOTHING
# pragma mark -
# pragma mark Abstract OBJECTS and METHODS
# endif
-/* These macros are shortcuts
- * This macro checks if a message can be sent.
+/**
+ * \def SYNCTEX_TYPE
+ * \brief Get the type of the argument.
+ * - parameter NODE: of type synctex_node_p
+ * - returns: A synctex_node_type_t, synctex_node_type_none for NULL param
*/
-# define SYNCTEX_CAN_PERFORM(NODE,SELECTOR)\
- (NULL!=((((NODE)->class))->SELECTOR))
+# define SYNCTEX_TYPE(NODE)
((NODE)?(((NODE)->class)->type):synctex_node_type_none)
-/* This macro is some kind of objc_msg_send.
- * It takes care of sending the proper message if possible.
+/**
+ * \def SYNCTEX_NODE_MASK
+ * \brief Get the node mask of the argument.
+ * - parameter NODE: of type synctex_node_p
+ * - returns: A synctex_node_mask_t, 0 for NULL param
*/
-# define SYNCTEX_MSG_SEND(NODE,SELECTOR) if (NODE &&
SYNCTEX_CAN_PERFORM(NODE,SELECTOR)) {\
- (*((((NODE)->class))->SELECTOR))(NODE);\
- }
+# define SYNCTEX_NODE_MASK(NODE) ((NODE)?(((NODE)->class)->node_mask):0)
-/* read only safe getter
- */
-# define SYNCTEX_GET(NODE,SELECTOR)((NODE &&
SYNCTEX_CAN_PERFORM(NODE,SELECTOR))?SYNCTEX_GETTER(NODE,SELECTOR)[0]:(NULL))
+# define SYNCTEX_IS_BOX(NODE)\
+ ((SYNCTEX_NODE_MASK(NODE)&synctex_mask_box)!=0)
+# define SYNCTEX_IS_PROXY(NODE)\
+ (SYNCTEX_NODE_MASK(NODE)&synctex_mask_proxy)
-/* read/write getter
+/**
+ * Checks if a message can be sent to a node.
+ * - parameter NODE: of type synctex_node_p
+ * - parameter SELECTOR: one of the class pointer properties
+ * - returns: yorn
*/
-# define SYNCTEX_GETTER(NODE,SELECTOR)\
- ((synctex_node_t *)((*((((NODE)->class))->SELECTOR))(NODE)))
+# define SYNCTEX_CAN_PERFORM(NODE,SELECTOR)\
+((NODE) && ((((NODE)->class))->SELECTOR))
+# define SYNCTEX_NAV_CAN_PERFORM(NODE,SELECTOR)\
+((NODE) && (((((NODE)->class)->navigator))->SELECTOR>=0))
+# define SYNCTEX_DATA_CAN_PERFORM(NODE,SELECTOR)\
+((NODE) && (((((NODE)->class)->modelator))->SELECTOR>=0))
-# define SYNCTEX_FREE(NODE) SYNCTEX_MSG_SEND(NODE,free);
-
-/* Parent getter and setter
+/**
+ * \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_PARENT(NODE) SYNCTEX_GET(NODE,parent)
-# define SYNCTEX_SET_PARENT(NODE,NEW_PARENT) if (NODE && NEW_PARENT &&
SYNCTEX_CAN_PERFORM(NODE,parent)){\
- SYNCTEX_GETTER(NODE,parent)[0]=NEW_PARENT;\
- }
+# define SYNCTEX_MSG_SEND(NODE,SELECTOR) do {\
+ synctex_node_p N__ = NODE;\
+ if (N__ && SYNCTEX_CAN_PERFORM(N__,SELECTOR)) {\
+ (*(((N__)->class)->SELECTOR))(N__);\
+ }\
+} while (0)
-/* Child getter and setter
+/**
+ * Free the given node by sending the free message.
+ * - parameter NODE: of type synctex_node_p
*/
-# define SYNCTEX_CHILD(NODE) SYNCTEX_GET(NODE,child)
-# define SYNCTEX_SET_CHILD(NODE,NEW_CHILD) if (NODE && NEW_CHILD){\
- SYNCTEX_GETTER(NODE,child)[0]=NEW_CHILD;\
- SYNCTEX_GETTER(NEW_CHILD,parent)[0]=NODE;\
- }
+void synctex_node_free(synctex_node_p node) {
+ SYNCTEX_MSG_SEND(node,free);
+}
-/* Sibling getter and setter
+#define synctex_NON_NULL_node_p synctex_node_p
+/**
+ * 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
*/
-# define SYNCTEX_SIBLING(NODE) SYNCTEX_GET(NODE,sibling)
-# define SYNCTEX_SET_SIBLING(NODE,NEW_SIBLING) if (NODE && NEW_SIBLING) {\
- SYNCTEX_GETTER(NODE,sibling)[0]=NEW_SIBLING;\
- if (SYNCTEX_CAN_PERFORM(NEW_SIBLING,parent) &&
SYNCTEX_CAN_PERFORM(NODE,parent)) {\
-
SYNCTEX_GETTER(NEW_SIBLING,parent)[0]=SYNCTEX_GETTER(NODE,parent)[0];\
- }\
- }
-/* Friend getter and setter. A friend is a kern, math, glue or void box node
which tag and line numbers are similar.
- * This is a first filter on the nodes that avoids testing all of them.
- * Friends are used mainly in forward synchronization aka from source to
output.
- */
-# define SYNCTEX_FRIEND(NODE) SYNCTEX_GET(NODE,friend)
-# define SYNCTEX_SET_FRIEND(NODE,NEW_FRIEND) if (NODE && NEW_FRIEND){\
- SYNCTEX_GETTER(NODE,friend)[0]=NEW_FRIEND;\
- }
+# ifdef SYNCTEX_NOTHING
+# pragma mark -
+# pragma mark Tree SETGET
+# endif
-/* Next box getter and setter. The box tree can be traversed from one
horizontal box to the other.
- * Navigation starts with the deeper boxes.
- */
-# define SYNCTEX_NEXT_HORIZ_BOX(NODE) SYNCTEX_GET(NODE,next_box)
-# define SYNCTEX_SET_NEXT_HORIZ_BOX(NODE,NEXT_BOX) if (NODE && NEXT_BOX){\
- SYNCTEX_GETTER(NODE,next_box)[0]=NEXT_BOX;\
- }
+#if SYNCTEX_DEBUG > 1000
+#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 (0==0); \
+ } else {\
+ printf("WARNING: NO tree %s for %s\n", #WHAT,
synctex_node_isa(node));\
+ }\
+ }\
+ return 0 == 1;\
+}
+#else
+#define DEFINE_SYNCTEX_TREE_HAS(WHAT) \
+static synctex_bool_t _synctex_tree_has_##WHAT(synctex_node_p node) {\
+ return (node && (node->class->navigator->WHAT>=0));\
+}
+#endif
-void _synctex_free_node(synctex_node_t node);
-void _synctex_free_leaf(synctex_node_t node);
+# 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) \
+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) {\
+ if (_synctex_tree_has_##WHAT(node)) {\
+ return __synctex_tree_reset_##WHAT(node);\
+ }\
+ return 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)
-/* A node is meant to own its child and sibling.
+# 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)
+
+DEFINE_SYNCTEX_TREE__GETSETRESET(sibling)
+DEFINE_SYNCTEX_TREE_GETSETRESET(parent)
+DEFINE_SYNCTEX_TREE_GETSETRESET(child)
+DEFINE_SYNCTEX_TREE_GETSETRESET(friend)
+DEFINE_SYNCTEX_TREE_GETSET(last)
+DEFINE_SYNCTEX_TREE_GETSET(next_hbox)
+DEFINE_SYNCTEX_TREE_GETSET(arg_sibling)
+DEFINE_SYNCTEX_TREE_GETSET(target)
+
+SYNCTEX_INLINE static synctex_node_p _synctex_tree_setup_target(synctex_node_p
node, synctex_node_p target) {
+ synctex_node_p old = _synctex_tree_target(node);
+ synctex_node_p beyond = _synctex_tree_target(target);
+ _synctex_tree_set_target(node,beyond?beyond:target);
+ return old;
+}
+
+/**
+ * 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.
*/
-void _synctex_free_node(synctex_node_t node) {
- if (node) {
- (*((node->class)->sibling))(node);
- SYNCTEX_FREE(SYNCTEX_SIBLING(node));
- SYNCTEX_FREE(SYNCTEX_CHILD(node));
- free(node);
- }
- return;
+static void _synctex_free_node(synctex_node_p node) {
+ if (node) {
+ synctex_node_free(__synctex_tree_sibling(node));
+ synctex_node_free(_synctex_tree_child(node));
+ _synctex_free(node);
+ }
+ return;
}
-/* A node is meant to own its child and sibling.
+#define SYNCTEX_HAS_CHILDREN(NODE) (NODE && _synctex_tree_child(NODE))
+/**
+ * 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 nodes with no child.
+ * This destructor is for all nodes with no children.
*/
-void _synctex_free_leaf(synctex_node_t node) {
- if (node) {
- SYNCTEX_FREE(SYNCTEX_SIBLING(node));
- free(node);
- }
- return;
+static void _synctex_free_leaf(synctex_node_p node) {
+ if (node) {
+ synctex_node_free(__synctex_tree_sibling(node));
+ _synctex_free(node);
+ }
+ return;
}
# ifdef __SYNCTEX_WORK__
# include "/usr/include/zlib.h"
@@ -259,519 +469,1936 @@
# include <zlib.h>
# endif
-/* The synctex scanner is the root object.
+#ifdef 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.
+ * The buffer_.* are first used to parse the text.
*/
-struct __synctex_scanner_t {
- gzFile file; /* The (possibly compressed) file */
- char * buffer_cur; /* current location in the buffer */
- char * buffer_start; /* start of the buffer */
- char * buffer_end; /* end of the buffer */
- char * output_fmt; /* dvi or pdf, not yet used */
- char * output; /* the output name used to create the
scanner */
- char * synctex; /* the .synctex or .synctex.gz name used
to create the scanner */
- int version; /* 1, not yet used */
- struct {
- unsigned has_parsed:1; /* Whether the scanner has
parsed its underlying synctex file. */
- unsigned reserved:sizeof(unsigned)-1; /* alignment */
- } flags;
- int pre_magnification; /* magnification from the synctex
preamble */
- int pre_unit; /* unit from the synctex preamble */
- int pre_x_offset; /* X offste from the synctex preamble */
- int pre_y_offset; /* Y offset from the synctex preamble */
- int count; /* Number of records, from the synctex
postamble */
- float unit; /* real unit, from synctex preamble or
post scriptum */
- float x_offset; /* X offset, from synctex preamble or
post scriptum */
- float y_offset; /* Y Offset, from synctex preamble or
post scriptum */
- synctex_node_t sheet; /* The first sheet node, its siblings
are the other sheet nodes */
- synctex_node_t input; /* The first input node, its siblings
are the other input nodes */
- int number_of_lists; /* The number of friend lists */
- synctex_node_t * lists_of_friends;/* The friend lists */
- _synctex_class_t class[synctex_node_number_of_types]; /* The classes
of the nodes of the scanner */
+struct synctex_scanner_t {
+ gzFile file; /* The (possibly compressed) file */
+ SYNCTEX_DECLARE_CHAR_OFFSET;
+ char * buffer_cur; /* current location in the buffer */
+ char * buffer_start; /* start of the buffer */
+ char * buffer_end; /* end of the buffer */
+ char * output_fmt; /* dvi or pdf, not yet used */
+ char * output; /* the output name used to create the scanner
*/
+ char * synctex; /* the .synctex or .synctex.gz name used to
create the scanner */
+ synctex_iterator_p iterator;/* result iterator */
+ int version; /* 1, not yet used */
+ struct {
+ unsigned has_parsed:1; /* Whether the scanner has parsed its
underlying synctex file. */
+ unsigned postamble:1; /* Whether the scanner has parsed its
underlying synctex file. */
+ unsigned reserved:sizeof(unsigned)-2; /* alignment */
+ } flags;
+ int pre_magnification; /* magnification from the synctex preamble */
+ int pre_unit; /* unit from the synctex preamble */
+ int pre_x_offset; /* X offset from the synctex preamble */
+ int pre_y_offset; /* Y offset from the synctex preamble */
+ int count; /* Number of records, from the synctex postamble
*/
+ float unit; /* real unit, from synctex preamble or post
scriptum */
+ float x_offset; /* X offset, from synctex preamble or post
scriptum */
+ float y_offset; /* Y Offset, from synctex preamble or post
scriptum */
+ synctex_node_p input; /* The first input node, its siblings are the
other input nodes */
+ synctex_node_p sheet; /* The first sheet node, its siblings are the
other sheet nodes */
+ synctex_node_p form; /* The first form, its siblings are the other
forms */
+ synctex_node_p ref_in_sheet; /* The first form ref node in sheet, its
friends are the other form ref nodes */
+ synctex_node_p ref_in_form; /* The first form ref node, its friends are
the other form ref nodes in sheet */
+ int number_of_lists; /* The number of friend lists */
+ synctex_node_r lists_of_friends;/* The friend lists */
+ synctex_class_s class[synctex_node_number_of_types]; /* The classes of
the nodes of the scanner */
+ int lastv; /* last vertical position read, for compression purpose */
+ int line_number;
+ int display_switcher;
+ char * display_prompt;
};
-/* SYNCTEX_CUR, SYNCTEX_START and SYNCTEX_END are convenient shortcuts
+/**
+ * Create a new node of the given type.
+ * - parameter scanner: of type synctex_node_p
+ * - parameter type: a type, the client is responsible
+ * to ask for an acceptable type.
*/
+synctex_node_p synctex_node_new(synctex_scanner_p scanner, synctex_node_type_t
type) {
+ return scanner? scanner->class[type].new(scanner):NULL;
+}
+/**
+ SYNCTEX_CUR, SYNCTEX_START and SYNCTEX_END are convenient shortcuts
+ */
# define SYNCTEX_CUR (scanner->buffer_cur)
# define SYNCTEX_START (scanner->buffer_start)
# define SYNCTEX_END (scanner->buffer_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
+ */
+
# ifdef SYNCTEX_NOTHING
# pragma mark -
-# pragma mark OBJECTS, their creators and destructors.
+# 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)
-/* Here, we define the indices for the different informations.
- * They are used to declare the size of the implementation.
- * For example, if one object uses SYNCTEX_HORIZ_IDX is its size,
- * then its info will contain a tag, line, column, horiz but no width nor
height nor depth
+# 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);
+
+typedef struct {
+ char * string;
+ 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
+ * 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
*/
+# define SYNCTEX_DATA(NODE) ((*((((NODE)->class))->info))(NODE))
+#if defined 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*/
+
+# 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_node_mask_input, /* Node mask */
+ &_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 */
+};
+
+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;
+
+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) {
+ SYNCTEX_IMPLEMENT_CHARINDEX(node,strlen(SYNCTEX_INPUT_MARK));
+ node->class = scanner->class+synctex_node_type_input;
+ }
+ return node;
+ }
+ return NULL;
+}
+
+static void _synctex_free_input(synctex_node_p node){
+ if (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 parent is the scanner itself)
+ * 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.
*/
-/* The next macros are used to access the node info
- * SYNCTEX_INFO(node) points to the first synctex integer or pointer data of
node
- * SYNCTEX_INFO(node)[index] is the information at index
- * for example, the page of a sheet is stored in
SYNCTEX_INFO(sheet)[SYNCTEX_PAGE_IDX]
+
+# ifdef SYNCTEX_NOTHING
+# pragma mark sheet.
+# endif
+/**
+ * Every node has the same structure, but not the same size.
*/
-# define SYNCTEX_INFO(NODE) ((*((((NODE)->class))->info))(NODE))
-# define SYNCTEX_PAGE_IDX 0
-# define SYNCTEX_PAGE(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_PAGE_IDX].INT
-/* This macro defines implementation offsets
- * It is only used for pointer values
- */
-# define SYNCTEX_MAKE_GET(SYNCTEX_GETTER,OFFSET)\
-synctex_node_t * SYNCTEX_GETTER (synctex_node_t node);\
-synctex_node_t * SYNCTEX_GETTER (synctex_node_t node) {\
- return node?(synctex_node_t
*)((&((node)->implementation))+OFFSET):NULL;\
+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) {\
+ SYNCTEX_IMPLEMENT_CHARINDEX(node,0);\
+ node->class = scanner->class+synctex_node_type_##NAME;\
+ }\
+ return node;\
+ }\
+ return NULL;\
}
-SYNCTEX_MAKE_GET(_synctex_implementation_0,0)
-SYNCTEX_MAKE_GET(_synctex_implementation_1,1)
-SYNCTEX_MAKE_GET(_synctex_implementation_2,2)
-SYNCTEX_MAKE_GET(_synctex_implementation_3,3)
-SYNCTEX_MAKE_GET(_synctex_implementation_4,4)
-SYNCTEX_MAKE_GET(_synctex_implementation_5,5)
+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_node_mask_sf, /* Node mask */
+ &_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_class_t class;
- synctex_info_t implementation[3+SYNCTEX_PAGE_IDX+1];/* child, sibling,
next box,
- * SYNCTEX_PAGE_IDX */
-} synctex_sheet_t;
+ 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;
-synctex_node_t _synctex_new_sheet(synctex_scanner_t scanner);
-void _synctex_display_sheet(synctex_node_t sheet);
-void _synctex_log_sheet(synctex_node_t sheet);
+DEFINE_synctex_new_scanned_NODE(form)
-static _synctex_class_t 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 */
- NULL, /* No parent */
- &_synctex_implementation_0, /* child */
- &_synctex_implementation_1, /* sibling */
- NULL, /* No friend */
- &_synctex_implementation_2, /* Next box */
- (_synctex_info_getter_t)&_synctex_implementation_3 /* info */
+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_node_mask_sf, /* Node mask */
+ &_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 */
+};
-/* sheet node creator */
-synctex_node_t _synctex_new_sheet(synctex_scanner_t scanner) {
- synctex_node_t node = _synctex_malloc(sizeof(synctex_sheet_t));
- if (node) {
- node->class =
scanner?scanner->class+synctex_node_type_sheet:(synctex_class_t)&synctex_class_sheet;
- }
- return node;
-}
+# ifdef SYNCTEX_NOTHING
+# pragma mark vbox.
+# endif
/* A box node contains navigation and synctex information
- * There are different kind of boxes.
+ * There are different kinds of boxes.
* Only horizontal boxes are treated differently because of their visible
size.
*/
-# define SYNCTEX_TAG_IDX 0
-# define SYNCTEX_LINE_IDX (SYNCTEX_TAG_IDX+1)
-# define SYNCTEX_COLUMN_IDX (SYNCTEX_LINE_IDX+1)
-# define SYNCTEX_HORIZ_IDX (SYNCTEX_COLUMN_IDX+1)
-# define SYNCTEX_VERT_IDX (SYNCTEX_HORIZ_IDX+1)
-# define SYNCTEX_WIDTH_IDX (SYNCTEX_VERT_IDX+1)
-# define SYNCTEX_HEIGHT_IDX (SYNCTEX_WIDTH_IDX+1)
-# define SYNCTEX_DEPTH_IDX (SYNCTEX_HEIGHT_IDX+1)
-/* the corresponding info accessors */
-# define SYNCTEX_TAG(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_TAG_IDX].INT
-# define SYNCTEX_LINE(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_LINE_IDX].INT
-# define SYNCTEX_COLUMN(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_COLUMN_IDX].INT
-# define SYNCTEX_HORIZ(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HORIZ_IDX].INT
-# define SYNCTEX_VERT(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_VERT_IDX].INT
-# define SYNCTEX_WIDTH(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_WIDTH_IDX].INT
-# define SYNCTEX_HEIGHT(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HEIGHT_IDX].INT
-# define SYNCTEX_DEPTH(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_DEPTH_IDX].INT
-# define SYNCTEX_ABS_WIDTH(NODE)
((SYNCTEX_WIDTH(NODE)>0?SYNCTEX_WIDTH(NODE):-SYNCTEX_WIDTH(NODE)))
-# define SYNCTEX_ABS_HEIGHT(NODE)
((SYNCTEX_HEIGHT(NODE)>0?SYNCTEX_HEIGHT(NODE):-SYNCTEX_HEIGHT(NODE)))
-# define SYNCTEX_ABS_DEPTH(NODE)
((SYNCTEX_DEPTH(NODE)>0?SYNCTEX_DEPTH(NODE):-SYNCTEX_DEPTH(NODE)))
-
typedef struct {
- synctex_class_t class;
- synctex_info_t implementation[5+SYNCTEX_DEPTH_IDX+1]; /*
parent,child,sibling,friend,next box,
- *
SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,
- *
SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH */
-} synctex_vert_box_node_t;
+ SYNCTEX_DECLARE_CHARINDEX
+ synctex_class_p class;
+ synctex_data_u data[synctex_tree_spcfl_vbox_max+synctex_data_box_max];
+} synctex_node_vbox_s;
-synctex_node_t _synctex_new_vbox(synctex_scanner_t scanner);
-void _synctex_log_box(synctex_node_t sheet);
-void _synctex_display_vbox(synctex_node_t node);
+/* 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_DATA_INT_GETSET(column)
+static synctex_status_t _synctex_data_decode_column(synctex_node_p node) {
+ if (_synctex_data_has_column(node)) {
+ synctex_is_s is = _synctex_decode_int_opt(node->class->scanner,-1);
+ if (is.status == SYNCTEX_STATUS_OK) {
+ _synctex_data_set_column(node,is.integer);
+ }
+ return is.status;
+ }
+ return SYNCTEX_STATUS_BAD_ARGUMENT;
+}
+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)
+
+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_t synctex_class_vbox = {
- NULL, /* No scanner yet */
- synctex_node_type_vbox, /* Node type */
- &_synctex_new_vbox, /* creator */
- &_synctex_free_node, /* destructor */
- &_synctex_log_box, /* log */
- &_synctex_display_vbox, /* display */
- &_synctex_implementation_0, /* parent */
- &_synctex_implementation_1, /* child */
- &_synctex_implementation_2, /* sibling */
- &_synctex_implementation_3, /* friend */
- &_synctex_implementation_4, /* next box */
- (_synctex_info_getter_t)&_synctex_implementation_5
+static synctex_class_s synctex_class_vbox = {
+ NULL, /* No scanner yet */
+ synctex_node_type_vbox, /* Node type */
+ synctex_node_mask_vbox, /* Node mask */
+ &_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_none, /* tlcpector */
+ &synctex_inspector_box, /* inspector */
+ &synctex_vispector_box, /* vispector */
};
-/* vertical box node creator */
-synctex_node_t _synctex_new_vbox(synctex_scanner_t scanner) {
- synctex_node_t node = _synctex_malloc(sizeof(synctex_vert_box_node_t));
- if (node) {
- node->class =
scanner?scanner->class+synctex_node_type_vbox:(synctex_class_t)&synctex_class_vbox;
- }
- return node;
-}
+# ifdef SYNCTEX_NOTHING
+# pragma mark hbox.
+# endif
-# define SYNCTEX_HORIZ_V_IDX (SYNCTEX_DEPTH_IDX+1)
-# define SYNCTEX_VERT_V_IDX (SYNCTEX_HORIZ_V_IDX+1)
-# define SYNCTEX_WIDTH_V_IDX (SYNCTEX_VERT_V_IDX+1)
-# define SYNCTEX_HEIGHT_V_IDX (SYNCTEX_WIDTH_V_IDX+1)
-# define SYNCTEX_DEPTH_V_IDX (SYNCTEX_HEIGHT_V_IDX+1)
-/* the corresponding info accessors */
-# define SYNCTEX_HORIZ_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HORIZ_V_IDX].INT
-# define SYNCTEX_VERT_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_VERT_V_IDX].INT
-# define SYNCTEX_WIDTH_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_WIDTH_V_IDX].INT
-# define SYNCTEX_HEIGHT_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_HEIGHT_V_IDX].INT
-# define SYNCTEX_DEPTH_V(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_DEPTH_V_IDX].INT
-# define SYNCTEX_ABS_WIDTH_V(NODE)
((SYNCTEX_WIDTH_V(NODE)>0?SYNCTEX_WIDTH_V(NODE):-SYNCTEX_WIDTH_V(NODE)))
-# define SYNCTEX_ABS_HEIGHT_V(NODE)
((SYNCTEX_HEIGHT_V(NODE)>0?SYNCTEX_HEIGHT_V(NODE):-SYNCTEX_HEIGHT_V(NODE)))
-# define SYNCTEX_ABS_DEPTH_V(NODE)
((SYNCTEX_DEPTH_V(NODE)>0?SYNCTEX_DEPTH_V(NODE):-SYNCTEX_DEPTH_V(NODE)))
+/* 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.
*/
-/* Horizontal boxes must contain visible size, because 0 width does not mean
emptiness */
-typedef struct {
- synctex_class_t class;
- synctex_info_t implementation[5+SYNCTEX_DEPTH_V_IDX+1];
/*parent,child,sibling,friend,next box,
- *
SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,
- *
SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH,
- *
SYNCTEX_HORIZ_V,SYNCTEX_VERT_V,SYNCTEX_WIDTH_V,SYNCTEX_HEIGHT_V,SYNCTEX_DEPTH_V*/
-} synctex_horiz_box_node_t;
+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
+};
-synctex_node_t _synctex_new_hbox(synctex_scanner_t scanner);
-void _synctex_display_hbox(synctex_node_t node);
-void _synctex_log_horiz_box(synctex_node_t sheet);
+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 _synctex_class_t synctex_class_hbox = {
- NULL, /* No scanner yet */
- synctex_node_type_hbox, /* Node type */
- &_synctex_new_hbox, /* creator */
- &_synctex_free_node, /* destructor */
- &_synctex_log_horiz_box, /* log */
- &_synctex_display_hbox, /* display */
- &_synctex_implementation_0, /* parent */
- &_synctex_implementation_1, /* child */
- &_synctex_implementation_2, /* sibling */
- &_synctex_implementation_3, /* friend */
- &_synctex_implementation_4, /* next box */
- (_synctex_info_getter_t)&_synctex_implementation_5
+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 */
-synctex_node_t _synctex_new_hbox(synctex_scanner_t scanner) {
- synctex_node_t node = _synctex_malloc(sizeof(synctex_horiz_box_node_t));
- if (node) {
- node->class =
scanner?scanner->class+synctex_node_type_hbox:(synctex_class_t)&synctex_class_hbox;
- }
- return node;
-}
+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_node_mask_hbox, /* Node mask */
+ &_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_class_t class;
- synctex_info_t implementation[3+SYNCTEX_DEPTH_IDX+1]; /*
parent,sibling,friend,
- * SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,
- *
SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH*/
-} synctex_void_box_node_t;
+ SYNCTEX_DECLARE_CHARINDEX
+ synctex_class_p class;
+ synctex_data_u data[synctex_tree_spf_max+synctex_data_box_max];
+} synctex_node_void_vbox_s;
-synctex_node_t _synctex_new_void_vbox(synctex_scanner_t scanner);
-void _synctex_log_void_box(synctex_node_t sheet);
-void _synctex_display_void_vbox(synctex_node_t node);
+/* vertical void box node creator */
+DEFINE_synctex_new_scanned_NODE(void_vbox)
-static _synctex_class_t synctex_class_void_vbox = {
- NULL, /* No scanner yet */
- synctex_node_type_void_vbox,/* Node type */
- &_synctex_new_void_vbox, /* creator */
- &_synctex_free_node, /* destructor */
- &_synctex_log_void_box, /* log */
- &_synctex_display_void_vbox,/* display */
- &_synctex_implementation_0, /* parent */
- NULL, /* No child */
- &_synctex_implementation_1, /* sibling */
- &_synctex_implementation_2, /* friend */
- NULL, /* No next box */
- (_synctex_info_getter_t)&_synctex_implementation_3
+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_node_mask_void_vbox,/* Node mask */
+ &_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 */
};
-/* vertical void box node creator */
-synctex_node_t _synctex_new_void_vbox(synctex_scanner_t scanner) {
- synctex_node_t node = _synctex_malloc(sizeof(synctex_void_box_node_t));
- if (node) {
- node->class =
scanner?scanner->class+synctex_node_type_void_vbox:(synctex_class_t)&synctex_class_void_vbox;
- }
- return node;
-}
+# ifdef SYNCTEX_NOTHING
+# pragma mark void hbox.
+# endif
-synctex_node_t _synctex_new_void_hbox(synctex_scanner_t scanner);
-void _synctex_display_void_hbox(synctex_node_t node);
+typedef synctex_node_void_vbox_s synctex_node_void_hbox_s;
-static _synctex_class_t synctex_class_void_hbox = {
- NULL, /* No scanner yet */
- synctex_node_type_void_hbox,/* Node type */
- &_synctex_new_void_hbox, /* creator */
- &_synctex_free_node, /* destructor */
- &_synctex_log_void_box, /* log */
- &_synctex_display_void_hbox,/* display */
- &_synctex_implementation_0, /* parent */
- NULL, /* No child */
- &_synctex_implementation_1, /* sibling */
- &_synctex_implementation_2, /* friend */
- NULL, /* No next box */
- (_synctex_info_getter_t)&_synctex_implementation_3
+/* 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_node_mask_void_hbox,/* Node mask */
+ &_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 */
};
-/* horizontal void box node creator */
-synctex_node_t _synctex_new_void_hbox(synctex_scanner_t scanner) {
- synctex_node_t node = _synctex_malloc(sizeof(synctex_void_box_node_t));
- if (node) {
- node->class =
scanner?scanner->class+synctex_node_type_void_hbox:(synctex_class_t)&synctex_class_void_hbox;
- }
- return node;
-}
+# ifdef SYNCTEX_NOTHING
+# pragma mark form ref.
+# endif
-/* The medium nodes correspond to kern, glue, penalty and math nodes. */
+/* The form ref node. */
typedef struct {
- synctex_class_t class;
- synctex_info_t implementation[3+SYNCTEX_WIDTH_IDX+1]; /*
parent,sibling,friend,
- * SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN,
- *
SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH */
-} synctex_medium_node_t;
+ SYNCTEX_DECLARE_CHARINDEX
+ synctex_class_p class;
+ synctex_data_u data[synctex_tree_spfa_max+synctex_data_ref_thv_max];
+} synctex_node_ref_s;
-#define SYNCTEX_IS_BOX(NODE)\
- ((NODE->class->type == synctex_node_type_vbox)\
- || (NODE->class->type == synctex_node_type_void_vbox)\
- || (NODE->class->type == synctex_node_type_hbox)\
- || (NODE->class->type == synctex_node_type_void_hbox))
-
-#define SYNCTEX_HAS_CHILDREN(NODE) (NODE && SYNCTEX_CHILD(NODE))
-
-void _synctex_log_medium_node(synctex_node_t node);
+/* 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 */
+ synctex_data_ref_thv_max
+};
+static synctex_class_s synctex_class_ref = {
+ NULL, /* No scanner yet */
+ synctex_node_type_ref, /* Node type */
+ synctex_node_mask_nvnn, /* Node mask */
+ &_synctex_new_ref, /* creator */
+ &_synctex_free_leaf, /* destructor */
@@ Diff output truncated at 100000 characters. @@
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Skim-app-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/skim-app-commit