diff options
author | raveit65 <[email protected]> | 2016-06-24 14:16:51 +0200 |
---|---|---|
committer | raveit65 <[email protected]> | 2016-06-24 20:46:36 +0200 |
commit | 1dbdaee023e47edba8dcc14ca6fced372b89c25b (patch) | |
tree | 54bcc373e912486bed21e297fab52fac9da75de1 /cut-n-paste/synctex/synctex_parser.c | |
parent | ba8d0f79a864b445ea0374a7dc5f9d9af7687859 (diff) | |
download | atril-1dbdaee023e47edba8dcc14ca6fced372b89c25b.tar.bz2 atril-1dbdaee023e47edba8dcc14ca6fced372b89c25b.tar.xz |
synctex: update to 1.18
Diffstat (limited to 'cut-n-paste/synctex/synctex_parser.c')
-rw-r--r-- | cut-n-paste/synctex/synctex_parser.c | 237 |
1 files changed, 110 insertions, 127 deletions
diff --git a/cut-n-paste/synctex/synctex_parser.c b/cut-n-paste/synctex/synctex_parser.c index b0dbad26..5b28ace6 100644 --- a/cut-n-paste/synctex/synctex_parser.c +++ b/cut-n-paste/synctex/synctex_parser.c @@ -5,7 +5,7 @@ This file is part of the SyncTeX package. Latest Revision: Tue Jun 14 08:23:30 UTC 2011 -Version: 1.17 +Version: 1.18 See synctex_parser_readme.txt for more details @@ -240,14 +240,11 @@ struct __synctex_class_t { SYNCTEX_GETTER(NODE,next_hbox)[0]=NEXT_HBOX;\ } -void _synctex_free_node(synctex_node_t node); -void _synctex_free_leaf(synctex_node_t node); - /* 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) { +static void _synctex_free_node(synctex_node_t node) { if (node) { (*((node->class)->sibling))(node); SYNCTEX_FREE(SYNCTEX_SIBLING(node)); @@ -262,7 +259,7 @@ void _synctex_free_node(synctex_node_t node) { * This destructor is for nodes with no child. * The first sheet is onwned by the scanner. */ -void _synctex_free_leaf(synctex_node_t node) { +static void _synctex_free_leaf(synctex_node_t node) { if (node) { SYNCTEX_FREE(SYNCTEX_SIBLING(node)); free(node); @@ -345,8 +342,7 @@ struct __synctex_scanner_t { * 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) {\ +static synctex_node_t * SYNCTEX_GETTER (synctex_node_t node) {\ return node?(synctex_node_t *)((&((node)->implementation))+OFFSET):NULL;\ } SYNCTEX_MAKE_GET(_synctex_implementation_0,0) @@ -363,29 +359,10 @@ typedef struct { * SYNCTEX_PAGE_IDX */ } synctex_node_sheet_t; -synctex_node_t _synctex_new_sheet(synctex_scanner_t scanner); -void _synctex_display_sheet(synctex_node_t node); -void _synctex_log_sheet(synctex_node_t node); - -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 hbox */ - (_synctex_info_getter_t)&_synctex_implementation_3 /* info */ -}; - /* sheet node creator */ #define DEFINE_synctex_new_NODE(NAME)\ -synctex_node_t _synctex_new_##NAME(synctex_scanner_t scanner) {\ +static synctex_node_t _synctex_new_##NAME(synctex_scanner_t scanner) {\ if (scanner) {\ synctex_node_t node = _synctex_malloc(sizeof(synctex_node_##NAME##_t));\ if (node) {\ @@ -399,6 +376,24 @@ synctex_node_t _synctex_new_##NAME(synctex_scanner_t scanner) {\ } DEFINE_synctex_new_NODE(sheet) +static void _synctex_display_sheet(synctex_node_t node); +static void _synctex_log_sheet(synctex_node_t node); + +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 hbox */ + (_synctex_info_getter_t)&_synctex_implementation_3 /* info */ +}; + /* A box node contains navigation and synctex information * There are different kind of boxes. * Only horizontal boxes are treated differently because of their visible size. @@ -432,9 +427,11 @@ typedef struct { * SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH */ } synctex_node_vbox_t; -synctex_node_t _synctex_new_vbox(synctex_scanner_t scanner); -void _synctex_log_vbox(synctex_node_t node); -void _synctex_display_vbox(synctex_node_t node); +/* vertical box node creator */ +DEFINE_synctex_new_NODE(vbox) + +static void _synctex_log_vbox(synctex_node_t node); +static void _synctex_display_vbox(synctex_node_t node); /* These are static class objects, each scanner will make a copy of them and setup the scanner field. */ @@ -453,9 +450,6 @@ static _synctex_class_t synctex_class_vbox = { (_synctex_info_getter_t)&_synctex_implementation_5 }; -/* vertical box node creator */ -DEFINE_synctex_new_NODE(vbox) - /* 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. */ # define SYNCTEX_MEAN_LINE_IDX (SYNCTEX_DEPTH_IDX+1) @@ -487,9 +481,11 @@ typedef struct { * SYNCTEX_HORIZ_V,SYNCTEX_VERT_V,SYNCTEX_WIDTH_V,SYNCTEX_HEIGHT_V,SYNCTEX_DEPTH_V*/ } synctex_node_hbox_t; -synctex_node_t _synctex_new_hbox(synctex_scanner_t scanner); -void _synctex_display_hbox(synctex_node_t node); -void _synctex_log_hbox(synctex_node_t node); +/* horizontal box node creator */ +DEFINE_synctex_new_NODE(hbox) + +static void _synctex_display_hbox(synctex_node_t node); +static void _synctex_log_hbox(synctex_node_t node); static _synctex_class_t synctex_class_hbox = { @@ -507,9 +503,6 @@ static _synctex_class_t synctex_class_hbox = { (_synctex_info_getter_t)&_synctex_implementation_5 }; -/* horizontal box node creator */ -DEFINE_synctex_new_NODE(hbox) - /* This void box node implementation is either horizontal or vertical * It does not contain a child field. */ @@ -521,9 +514,11 @@ typedef struct { * SYNCTEX_HORIZ,SYNCTEX_VERT,SYNCTEX_WIDTH,SYNCTEX_HEIGHT,SYNCTEX_DEPTH*/ } synctex_node_void_vbox_t; -synctex_node_t _synctex_new_void_vbox(synctex_scanner_t scanner); -void _synctex_log_void_box(synctex_node_t node); -void _synctex_display_void_vbox(synctex_node_t node); +/* vertical void box node creator */ +DEFINE_synctex_new_NODE(void_vbox) + +static void _synctex_log_void_box(synctex_node_t node); +static void _synctex_display_void_vbox(synctex_node_t node); static _synctex_class_t synctex_class_void_vbox = { NULL, /* No scanner yet */ @@ -540,13 +535,12 @@ static _synctex_class_t synctex_class_void_vbox = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -/* vertical void box node creator */ -DEFINE_synctex_new_NODE(void_vbox) - typedef synctex_node_void_vbox_t synctex_node_void_hbox_t; -synctex_node_t _synctex_new_void_hbox(synctex_scanner_t scanner); -void _synctex_display_void_hbox(synctex_node_t node); +/* horizontal void box node creator */ +DEFINE_synctex_new_NODE(void_hbox) + +static void _synctex_display_void_hbox(synctex_node_t node); static _synctex_class_t synctex_class_void_hbox = { NULL, /* No scanner yet */ @@ -563,9 +557,6 @@ static _synctex_class_t synctex_class_void_hbox = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -/* horizontal void box node creator */ -DEFINE_synctex_new_NODE(void_hbox) - /* The medium nodes correspond to kern, glue, penalty and math nodes. * In LuaTeX, the size of the nodes may have changed. */ typedef struct { @@ -584,13 +575,14 @@ typedef struct { #define SYNCTEX_HAS_CHILDREN(NODE) (NODE && SYNCTEX_CHILD(NODE)) -void _synctex_log_medium_node(synctex_node_t node); +static void _synctex_log_medium_node(synctex_node_t node); typedef synctex_node_medium_t synctex_node_math_t; /* math node creator */ -synctex_node_t _synctex_new_math(synctex_scanner_t scanner); -void _synctex_display_math(synctex_node_t node); +DEFINE_synctex_new_NODE(math) + +static void _synctex_display_math(synctex_node_t node); static _synctex_class_t synctex_class_math = { NULL, /* No scanner yet */ @@ -607,13 +599,12 @@ static _synctex_class_t synctex_class_math = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(math) - typedef synctex_node_medium_t synctex_node_kern_t; /* kern node creator */ -synctex_node_t _synctex_new_kern(synctex_scanner_t scanner); -void _synctex_display_kern(synctex_node_t node); +DEFINE_synctex_new_NODE(kern) + +static void _synctex_display_kern(synctex_node_t node); static _synctex_class_t synctex_class_kern = { NULL, /* No scanner yet */ @@ -630,8 +621,6 @@ static _synctex_class_t synctex_class_kern = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(kern) - /* The small nodes correspond to glue and boundary nodes. */ typedef struct { SYNCTEX_DECLARE_CHARINDEX @@ -641,12 +630,12 @@ typedef struct { * SYNCTEX_HORIZ,SYNCTEX_VERT */ } synctex_node_small_t; -void _synctex_log_small_node(synctex_node_t node); +static void _synctex_log_small_node(synctex_node_t node); /* glue node creator */ typedef synctex_node_small_t synctex_node_glue_t; -synctex_node_t _synctex_new_glue(synctex_scanner_t scanner); -void _synctex_display_glue(synctex_node_t node); +DEFINE_synctex_new_NODE(glue) +static void _synctex_display_glue(synctex_node_t node); static _synctex_class_t synctex_class_glue = { NULL, /* No scanner yet */ @@ -662,12 +651,12 @@ static _synctex_class_t synctex_class_glue = { NULL, /* No next hbox */ (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(glue) /* boundary node creator */ typedef synctex_node_small_t synctex_node_boundary_t; -synctex_node_t _synctex_new_boundary(synctex_scanner_t scanner); -void _synctex_display_boundary(synctex_node_t node); +DEFINE_synctex_new_NODE(boundary) + +static void _synctex_display_boundary(synctex_node_t node); static _synctex_class_t synctex_class_boundary = { NULL, /* No scanner yet */ @@ -684,8 +673,6 @@ static _synctex_class_t synctex_class_boundary = { (_synctex_info_getter_t)&_synctex_implementation_3 }; -DEFINE_synctex_new_NODE(boundary) - # define SYNCTEX_NAME_IDX (SYNCTEX_TAG_IDX+1) # define SYNCTEX_NAME(NODE) SYNCTEX_INFO(NODE)[SYNCTEX_NAME_IDX].PTR @@ -698,29 +685,8 @@ typedef struct { * SYNCTEX_TAG,SYNCTEX_NAME */ } synctex_input_t; -synctex_node_t _synctex_new_input(synctex_scanner_t scanner); -void _synctex_free_input(synctex_node_t node); -void _synctex_display_input(synctex_node_t node); -void _synctex_log_input(synctex_node_t node); - -static _synctex_class_t synctex_class_input = { - NULL, /* No scanner yet */ - synctex_node_type_input, /* Node type */ - &_synctex_new_input, /* creator */ - &_synctex_free_input, /* destructor */ - &_synctex_log_input, /* log */ - &_synctex_display_input, /* display */ - NULL, /* No parent */ - NULL, /* No child */ - &_synctex_implementation_0, /* sibling */ - NULL, /* No friend */ - NULL, /* No next hbox */ - (_synctex_info_getter_t)&_synctex_implementation_1 -}; - # define SYNCTEX_INPUT_MARK "Input:" - -synctex_node_t _synctex_new_input(synctex_scanner_t scanner) { +static synctex_node_t _synctex_new_input(synctex_scanner_t scanner) { if (scanner) { synctex_node_t node = _synctex_malloc(sizeof(synctex_input_t)); if (node) { @@ -731,13 +697,33 @@ synctex_node_t _synctex_new_input(synctex_scanner_t scanner) { } return NULL; } -void _synctex_free_input(synctex_node_t node){ + +static void _synctex_free_input(synctex_node_t node){ if (node) { SYNCTEX_FREE(SYNCTEX_SIBLING(node)); free(SYNCTEX_NAME(node)); free(node); } } + +static void _synctex_display_input(synctex_node_t node); +static void _synctex_log_input(synctex_node_t node); + +static _synctex_class_t synctex_class_input = { + NULL, /* No scanner yet */ + synctex_node_type_input, /* Node type */ + &_synctex_new_input, /* creator */ + &_synctex_free_input, /* destructor */ + &_synctex_log_input, /* log */ + &_synctex_display_input, /* display */ + NULL, /* No parent */ + NULL, /* No child */ + &_synctex_implementation_0, /* sibling */ + NULL, /* No friend */ + NULL, /* No next hbox */ + (_synctex_info_getter_t)&_synctex_implementation_1 +}; + # ifdef SYNCTEX_NOTHING # pragma mark - # pragma mark Navigation @@ -810,14 +796,14 @@ void synctex_node_log(synctex_node_t node) { SYNCTEX_LOG(node); } -void _synctex_log_input(synctex_node_t node) { +static void _synctex_log_input(synctex_node_t node) { if (node) { printf("%s:%i,%s",synctex_node_isa(node),SYNCTEX_TAG(node),SYNCTEX_NAME(node)); printf(" SYNCTEX_SIBLING:%p",(void *)SYNCTEX_SIBLING(node)); } } -void _synctex_log_sheet(synctex_node_t node) { +static void _synctex_log_sheet(synctex_node_t node) { if (node) { printf("%s:%i",synctex_node_isa(node),SYNCTEX_PAGE(node)); SYNCTEX_PRINT_CHARINDEX; @@ -830,7 +816,7 @@ void _synctex_log_sheet(synctex_node_t node) { } } -void _synctex_log_small_node(synctex_node_t node) { +static void _synctex_log_small_node(synctex_node_t node) { if (node) { printf("%s:%i,%i:%i,%i", synctex_node_isa(node), @@ -847,7 +833,7 @@ void _synctex_log_small_node(synctex_node_t node) { } } -void _synctex_log_medium_node(synctex_node_t node) { +static void _synctex_log_medium_node(synctex_node_t node) { if (node) { printf("%s:%i,%i:%i,%i:%i", synctex_node_isa(node), @@ -865,7 +851,7 @@ void _synctex_log_medium_node(synctex_node_t node) { } } -void _synctex_log_void_box(synctex_node_t node) { +static void _synctex_log_void_box(synctex_node_t node) { if (node) { printf("%s",synctex_node_isa(node)); printf(":%i",SYNCTEX_TAG(node)); @@ -885,7 +871,7 @@ void _synctex_log_void_box(synctex_node_t node) { } } -void _synctex_log_vbox(synctex_node_t node) { +static void _synctex_log_vbox(synctex_node_t node) { if (node) { printf("%s",synctex_node_isa(node)); printf(":%i",SYNCTEX_TAG(node)); @@ -906,7 +892,7 @@ void _synctex_log_vbox(synctex_node_t node) { } } -void _synctex_log_hbox(synctex_node_t node) { +static void _synctex_log_hbox(synctex_node_t node) { if (node) { printf("%s",synctex_node_isa(node)); printf(":%i",SYNCTEX_TAG(node)); @@ -938,7 +924,7 @@ void synctex_node_display(synctex_node_t node) { SYNCTEX_DISPLAY(node); } -void _synctex_display_input(synctex_node_t node) { +static void _synctex_display_input(synctex_node_t node) { if (node) { printf("....Input:%i:%s", SYNCTEX_TAG(node), @@ -948,7 +934,7 @@ void _synctex_display_input(synctex_node_t node) { } } -void _synctex_display_sheet(synctex_node_t node) { +static void _synctex_display_sheet(synctex_node_t node) { if (node) { printf("....{%i",SYNCTEX_PAGE(node)); SYNCTEX_PRINT_CHARINDEX; @@ -958,7 +944,7 @@ void _synctex_display_sheet(synctex_node_t node) { } } -void _synctex_display_vbox(synctex_node_t node) { +static void _synctex_display_vbox(synctex_node_t node) { if (node) { printf("....[%i,%i:%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -975,7 +961,7 @@ void _synctex_display_vbox(synctex_node_t node) { } } -void _synctex_display_hbox(synctex_node_t node) { +static void _synctex_display_hbox(synctex_node_t node) { if (node) { printf("....(%i,%i~%i*%i:%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -994,7 +980,7 @@ void _synctex_display_hbox(synctex_node_t node) { } } -void _synctex_display_void_vbox(synctex_node_t node) { +static void _synctex_display_void_vbox(synctex_node_t node) { if (node) { printf("....v%i,%i;%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -1009,7 +995,7 @@ void _synctex_display_void_vbox(synctex_node_t node) { } } -void _synctex_display_void_hbox(synctex_node_t node) { +static void _synctex_display_void_hbox(synctex_node_t node) { if (node) { printf("....h%i,%i:%i,%i:%i,%i,%i", SYNCTEX_TAG(node), @@ -1024,7 +1010,7 @@ void _synctex_display_void_hbox(synctex_node_t node) { } } -void _synctex_display_glue(synctex_node_t node) { +static void _synctex_display_glue(synctex_node_t node) { if (node) { printf("....glue:%i,%i:%i,%i", SYNCTEX_TAG(node), @@ -1036,7 +1022,7 @@ void _synctex_display_glue(synctex_node_t node) { } } -void _synctex_display_math(synctex_node_t node) { +static void _synctex_display_math(synctex_node_t node) { if (node) { printf("....math:%i,%i:%i,%i", SYNCTEX_TAG(node), @@ -1048,7 +1034,7 @@ void _synctex_display_math(synctex_node_t node) { } } -void _synctex_display_kern(synctex_node_t node) { +static void _synctex_display_kern(synctex_node_t node) { if (node) { printf("....kern:%i,%i:%i,%i:%i", SYNCTEX_TAG(node), @@ -1061,7 +1047,7 @@ void _synctex_display_kern(synctex_node_t node) { } } -void _synctex_display_boundary(synctex_node_t node) { +static void _synctex_display_boundary(synctex_node_t node) { if (node) { printf("....boundary:%i,%i:%i,%i", SYNCTEX_TAG(node), @@ -1089,7 +1075,7 @@ void _synctex_display_boundary(synctex_node_t node) { * 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 */ -typedef int synctex_status_t; + /* 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: */ @@ -1104,7 +1090,7 @@ typedef int synctex_status_t; # define SYNCTEX_FILE (scanner->file) /* Actually, the minimum buffer size is driven by integer and float parsing. - * �0.123456789e123 + * �0.123456789e123 */ # define SYNCTEX_BUFFER_MIN_SIZE 16 # define SYNCTEX_BUFFER_SIZE 32768 @@ -1122,7 +1108,7 @@ synctex_status_t _synctex_scan_input(synctex_scanner_t scanner); synctex_status_t _synctex_scan_preamble(synctex_scanner_t scanner); synctex_status_t _synctex_scan_float_and_dimension(synctex_scanner_t scanner, float * value_ref); synctex_status_t _synctex_scan_post_scriptum(synctex_scanner_t scanner); -int _synctex_scan_postamble(synctex_scanner_t scanner); +synctex_status_t _synctex_scan_postamble(synctex_scanner_t scanner); synctex_status_t _synctex_setup_visible_box(synctex_node_t box); synctex_status_t _synctex_hbox_setup_visible(synctex_node_t node,int h, int v); synctex_status_t _synctex_scan_sheet(synctex_scanner_t scanner, synctex_node_t parent); @@ -1132,7 +1118,6 @@ int synctex_scanner_pre_x_offset(synctex_scanner_t scanner); int synctex_scanner_pre_y_offset(synctex_scanner_t scanner); const char * synctex_scanner_get_output_fmt(synctex_scanner_t scanner); int _synctex_node_is_box(synctex_node_t node); -int _synctex_bail(void); /* Try to ensure that the buffer contains at least size bytes. * Passing a huge size argument means the whole buffer length. @@ -1171,7 +1156,7 @@ synctex_status_t _synctex_buffer_get_available_size(synctex_scanner_t scanner, s } SYNCTEX_CUR = SYNCTEX_START + available; /* the next character after the move, will change. */ /* Fill the buffer up to its end */ - already_read = gzread(SYNCTEX_FILE,(void *)SYNCTEX_CUR,SYNCTEX_BUFFER_SIZE - available); + already_read = gzread(SYNCTEX_FILE,(void *)SYNCTEX_CUR,(int)(SYNCTEX_BUFFER_SIZE - available)); if (already_read>0) { /* We assume that 0<already_read<=SYNCTEX_BUFFER_SIZE - available, such that * SYNCTEX_CUR + already_read = SYNCTEX_START + available + already_read <= SYNCTEX_START + SYNCTEX_BUFFER_SIZE */ @@ -1838,8 +1823,8 @@ report_record_problem: * a negative error otherwise * The postamble comprises the post scriptum section. */ -int _synctex_scan_postamble(synctex_scanner_t scanner) { - int status = 0; +synctex_status_t _synctex_scan_postamble(synctex_scanner_t scanner) { + synctex_status_t status = 0; if (NULL == scanner) { return SYNCTEX_STATUS_BAD_ARGUMENT; } @@ -2095,7 +2080,6 @@ scan_anchor: } goto prepare_loop; } - _synctex_bail(); /* The child loop means that we go down one level, when we just created a box node, * the next node created is a child of this box. */ child_loop: @@ -2354,7 +2338,6 @@ scan_xobh: goto child_loop; } } - _synctex_bail(); /* The vertical loop means that we are on the same level, for example when we just ended a box. * If a node is created now, it will be a sibling of the current node, sharing the same parent. */ sibling_loop: @@ -2728,15 +2711,13 @@ synctex_scanner_t synctex_scanner_new_with_output_file(const char * output, cons return parse? synctex_scanner_parse(scanner):scanner; } -int __synctex_open(const char * output, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_mode_ref); - /* This functions opens the file at the "output" given location. * It manages the problem of quoted filenames that appear with pdftex and filenames containing the space character. * In TeXLive 2008, the synctex file created with pdftex did contain unexpected quotes. * This function will remove them if possible. * All the reference arguments will take a value on return. They must be non NULL. * 0 on success, non 0 on error. */ -int __synctex_open(const char * output, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_mode_ref) { +static int __synctex_open(const char * output, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_mode_ref) { if (synctex_name_ref && file_ref && io_mode_ref) { /* 1 local variables that uses dynamic memory */ char * synctex_name = NULL; @@ -2878,6 +2859,7 @@ int _synctex_open(const char * output, const char * build_directory, char ** syn build_output[0] = '\0'; } else { if (build_output != strcpy(build_output,output)) { + free(build_output); return -4; } build_output[lpc-output]='\0'; @@ -2886,15 +2868,20 @@ int _synctex_open(const char * output, const char * build_directory, char ** syn /* Append a path separator if necessary. */ if (!SYNCTEX_IS_PATH_SEPARATOR(build_output[strlen(build_directory)-1])) { if (build_output != strcat(build_output,"/")) { + free(build_output); return -2; } } /* Append the last path component of the output. */ if (build_output != strcat(build_output,lpc)) { + free(build_output); return -3; } - return __synctex_open(build_output,synctex_name_ref,file_ref,add_quotes,io_mode_ref); + result = __synctex_open(build_output,synctex_name_ref,file_ref,add_quotes,io_mode_ref); + free(build_output); + return result; } + free(build_output); } return -1; } @@ -3438,7 +3425,7 @@ synctex_node_t synctex_sheet_content(synctex_scanner_t scanner,int page) { # pragma mark Query # endif -int synctex_display_query(synctex_scanner_t scanner,const char * name,int line,int column) { +synctex_status_t synctex_display_query(synctex_scanner_t scanner,const char * name,int line,int column) { # ifdef __DARWIN_UNIX03 # pragma unused(column) # endif @@ -3654,7 +3641,7 @@ SYNCTEX_INLINE static synctex_node_t _synctex_eq_closest_child(synctex_point_t h #define SYNCTEX_MASK_LEFT 1 #define SYNCTEX_MASK_RIGHT 2 -int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) { +synctex_status_t synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) { synctex_node_t sheet = NULL; synctex_node_t node = NULL; /* placeholder */ synctex_node_t other_node = NULL; /* placeholder */ @@ -3757,10 +3744,6 @@ end: # pragma mark Utilities # endif -int _synctex_bail(void) { - _synctex_error("SyncTeX ERROR\n"); - return -1; -} /* Rougly speaking, this is: * node's h coordinate - hitPoint's h coordinate. * If node is to the right of the hit point, then this distance is positive, |