]> www.fi.muni.cz Git - evince.git/blob - cut-n-paste/synctex/synctex_parser_utils.h
Revert "cut-n-paste: update synctex_parser to version 1.13"
[evince.git] / cut-n-paste / synctex / synctex_parser_utils.h
1 /* 
2 Copyright (c) 2008, 2009 jerome DOT laurens AT u-bourgogne DOT fr
3
4 This file is part of the SyncTeX package.
5
6 Version: 1.8
7 Latest Revision: Wed Jul  1 11:16:01 UTC 2009
8 See synctex_parser_readme.txt for more details
9
10 License:
11 --------
12 Permission is hereby granted, free of charge, to any person
13 obtaining a copy of this software and associated documentation
14 files (the "Software"), to deal in the Software without
15 restriction, including without limitation the rights to use,
16 copy, modify, merge, publish, distribute, sublicense, and/or sell
17 copies of the Software, and to permit persons to whom the
18 Software is furnished to do so, subject to the following
19 conditions:
20
21 The above copyright notice and this permission notice shall be
22 included in all copies or substantial portions of the Software.
23
24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
25 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
26 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
27 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
28 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
29 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
30 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
31 OTHER DEALINGS IN THE SOFTWARE
32
33 Except as contained in this notice, the name of the copyright holder  
34 shall not be used in advertising or otherwise to promote the sale,  
35 use or other dealings in this Software without prior written  
36 authorization from the copyright holder.
37
38 */
39
40 /*  The utilities declared here are subject to conditional implementation.
41  *  All the operating system special stuff goes here.
42  *  The problem mainly comes from file name management: path separator, encoding...
43  */
44
45 #       define synctex_bool_t int
46 #       define synctex_YES -1
47 #       define synctex_NO 0
48
49 #ifndef __SYNCTEX_PARSER_UTILS__
50 #   define __SYNCTEX_PARSER_UTILS__
51
52 #include <stdlib.h>
53
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57
58 #       if _WIN32
59 #               define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c || '\\' == c)
60 #       else
61 #               define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c)
62 #       endif
63
64 /*  This custom malloc functions initializes to 0 the newly allocated memory.
65  *  There is no bzero function on windows. */
66 void *_synctex_malloc(size_t size);
67
68 /*  This is used to log some informational message to the standard error stream.
69  *  On Windows, the stderr stream is not exposed and another method is used.
70  *      The return value is the number of characters printed.   */
71 int _synctex_error(const char * reason,...);
72
73 /*  strip the last extension of the given string, this string is modified!
74  *  This function depends on the OS because the path separator may differ.
75  *  This should be discussed more precisely. */
76 void _synctex_strip_last_path_extension(char * string);
77
78 /*  Compare two file names, windows is sometimes case insensitive...
79  *  The given strings may differ stricto sensu, but represent the same file name.
80  *  It might not be the real way of doing things.
81  *  The return value is an undefined non 0 value when the two file names are equivalent.
82  *  It is 0 otherwise. */
83 synctex_bool_t _synctex_is_equivalent_file_name(const char *lhs, const char *rhs);
84
85 /*      Description forthcoming.*/
86 synctex_bool_t _synctex_path_is_absolute(const char * name);
87
88 /*      Description forthcoming...*/
89 const char * _synctex_last_path_component(const char * name);
90
91 /*      If the core of the last path component of src is not already enclosed with double quotes ('"')
92  *  and contains a space character (' '), then a new buffer is created, the src is copied and quotes are added.
93  *      In all other cases, no destination buffer is created and the src is not copied.
94  *  0 on success, which means no error, something non 0 means error, mainly due to memory allocation failure, or bad parameter.
95  *  This is used to fix a bug in the first version of pdftex with synctex (1.40.9) for which names with spaces
96  *  were not managed in a standard way.
97  *  On success, the caller owns the buffer pointed to by dest_ref (is any) and
98  *  is responsible of freeing the memory when done.
99  *      The size argument is the size of the src buffer. On return the dest_ref points to a buffer sized size+2.*/
100 int _synctex_copy_with_quoting_last_path_component(const char * src, char ** dest_ref, size_t size);
101
102 /*  These are the possible extensions of the synctex file */
103 extern const char * synctex_suffix;
104 extern const char * synctex_suffix_gz;
105
106 typedef enum {
107         synctex_io_mode_read = 0,
108         synctex_io_mode_append = 2
109 } synctex_io_mode_t;
110
111 typedef enum {
112         synctex_compress_mode_none = 0,
113         synctex_compress_mode_gz = 1
114 } synctex_compress_mode_t;
115
116 int _synctex_get_name(const char * output, const char * build_directory, char ** synctex_name_ref, synctex_compress_mode_t * compress_mode_ref);
117
118
119 #ifdef __cplusplus
120 }
121 #endif
122
123 #endif