Klimi's new dotfiles with stow.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

152 lines
5.6 KiB

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