diff options
Diffstat (limited to 'cut-n-paste/synctex')
-rw-r--r-- | cut-n-paste/synctex/synctex_parser.c | 28 | ||||
-rw-r--r-- | cut-n-paste/synctex/synctex_parser_utils.c | 8 | ||||
-rw-r--r-- | cut-n-paste/synctex/synctex_parser_utils.h | 11 |
3 files changed, 24 insertions, 23 deletions
diff --git a/cut-n-paste/synctex/synctex_parser.c b/cut-n-paste/synctex/synctex_parser.c index 638eb3d2..b0dbad26 100644 --- a/cut-n-paste/synctex/synctex_parser.c +++ b/cut-n-paste/synctex/synctex_parser.c @@ -119,7 +119,7 @@ typedef union _synctex_info_t { } synctex_info_t; # if defined(SYNCTEX_USE_CHARINDEX) -# define SYNCTEX_DECLARE_CHARINDEX synctex_charindex_t char_index +# define SYNCTEX_DECLARE_CHARINDEX synctex_charindex_t char_index; # define SYNCTEX_CHARINDEX(NODE) (NODE->char_index) # define SYNCTEX_PRINT_CHARINDEX printf("#%i\n",SYNCTEX_CHARINDEX(node)) # define SYNCTEX_DECLARE_CHAR_OFFSET synctex_charindex_t charindex_offset @@ -133,7 +133,7 @@ typedef union _synctex_info_t { # endif struct _synctex_node { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX synctex_class_t class; synctex_info_t * implementation; }; @@ -357,7 +357,7 @@ SYNCTEX_MAKE_GET(_synctex_implementation_4,4) SYNCTEX_MAKE_GET(_synctex_implementation_5,5) typedef struct { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX synctex_class_t class; synctex_info_t implementation[3+SYNCTEX_PAGE_IDX+1];/* child, sibling, next box, * SYNCTEX_PAGE_IDX */ @@ -425,7 +425,7 @@ DEFINE_synctex_new_NODE(sheet) # define SYNCTEX_ABS_DEPTH(NODE) ((SYNCTEX_DEPTH(NODE)>0?SYNCTEX_DEPTH(NODE):-SYNCTEX_DEPTH(NODE))) typedef struct { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX 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, @@ -478,7 +478,7 @@ DEFINE_synctex_new_NODE(vbox) # define SYNCTEX_ABS_DEPTH_V(NODE) ((SYNCTEX_DEPTH_V(NODE)>0?SYNCTEX_DEPTH_V(NODE):-SYNCTEX_DEPTH_V(NODE))) typedef struct { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX 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, @@ -514,7 +514,7 @@ DEFINE_synctex_new_NODE(hbox) * It does not contain a child field. */ typedef struct { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX synctex_class_t class; synctex_info_t implementation[3+SYNCTEX_DEPTH_IDX+1]; /* parent,sibling,friend, * SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN, @@ -569,7 +569,7 @@ 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 { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX synctex_class_t class; synctex_info_t implementation[3+SYNCTEX_WIDTH_IDX+1]; /* parent,sibling,friend, * SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN, @@ -634,7 +634,7 @@ DEFINE_synctex_new_NODE(kern) /* The small nodes correspond to glue and boundary nodes. */ typedef struct { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX synctex_class_t class; synctex_info_t implementation[3+SYNCTEX_VERT_IDX+1]; /* parent,sibling,friend, * SYNCTEX_TAG,SYNCTEX_LINE,SYNCTEX_COLUMN, @@ -692,7 +692,7 @@ DEFINE_synctex_new_NODE(boundary) /* Input nodes only know about their sibling, which is another input node. * The synctex information is the SYNCTEX_TAG and SYNCTEX_NAME*/ typedef struct { - SYNCTEX_DECLARE_CHARINDEX; + SYNCTEX_DECLARE_CHARINDEX synctex_class_t class; synctex_info_t implementation[1+SYNCTEX_NAME_IDX+1]; /* sibling, * SYNCTEX_TAG,SYNCTEX_NAME */ @@ -4328,9 +4328,9 @@ typedef int (*synctex_fprintf_t)(void *, const char * , ...); /* print formatte # define SYNCTEX_BITS_PER_BYTE 8 struct __synctex_updater_t { - void *file; /* the foo.synctex or foo.synctex.gz I/O identifier */ - synctex_fprintf_t fprintf; /* either fprintf or gzprintf */ - int length; /* the number of chars appended */ + gzFile file; /* the foo.synctex or foo.synctex.gz I/O identifier */ + synctex_fprintf_t fprintf; /* either fprintf or gzprintf */ + int length; /* the number of chars appended */ struct _flags { unsigned int no_gz:1; /* Whether zlib is used or not */ unsigned int reserved:SYNCTEX_BITS_PER_BYTE*sizeof(int)-1; /* Align */ @@ -4351,8 +4351,8 @@ synctex_updater_t synctex_updater_new_with_output_file(const char * output, cons _synctex_error("! synctex_updater_new_with_file: malloc problem"); return NULL; } - if (_synctex_open(output,build_directory,&synctex,(gzFile *)&SYNCTEX_FILE,synctex_ADD_QUOTES,&io_mode) - && _synctex_open(output,build_directory,&synctex,(gzFile *)&SYNCTEX_FILE,synctex_DONT_ADD_QUOTES,&io_mode)) { + if (_synctex_open(output,build_directory,&synctex,&SYNCTEX_FILE,synctex_ADD_QUOTES,&io_mode) + && _synctex_open(output,build_directory,&synctex,&SYNCTEX_FILE,synctex_DONT_ADD_QUOTES,&io_mode)) { return_on_error: free(updater); updater = NULL; diff --git a/cut-n-paste/synctex/synctex_parser_utils.c b/cut-n-paste/synctex/synctex_parser_utils.c index 6ba6dc9f..70132bda 100644 --- a/cut-n-paste/synctex/synctex_parser_utils.c +++ b/cut-n-paste/synctex/synctex_parser_utils.c @@ -57,6 +57,10 @@ authorization from the copyright holder. #define SYNCTEX_WINDOWS 1 #endif +#if defined(__OS2__) +#define SYNCTEX_OS2 1 +#endif + #ifdef _WIN32_WINNT_WINXP #define SYNCTEX_RECENT_WINDOWS 1 #endif @@ -121,7 +125,7 @@ void _synctex_strip_last_path_extension(char * string) { last_component = next+1; } } -# ifdef SYNCTEX_WINDOWS +# if defined(SYNCTEX_WINDOWS) || defined(SYNCTEX_OS2) /* On Windows, the '\' is also a path separator. */ while((next = strstr(last_component,"\\"))){ last_component = next+1; @@ -207,7 +211,7 @@ synctex_bool_t _synctex_path_is_absolute(const char * name) { if(!strlen(name)) { return synctex_NO; } -# if SYNCTEX_WINDOWS +# if defined(SYNCTEX_WINDOWS) || defined(SYNCTEX_OS2) if(strlen(name)>2) { return (name[1]==':' && SYNCTEX_IS_PATH_SEPARATOR(name[2]))?synctex_YES:synctex_NO; } diff --git a/cut-n-paste/synctex/synctex_parser_utils.h b/cut-n-paste/synctex/synctex_parser_utils.h index 18348aa6..db19b2da 100644 --- a/cut-n-paste/synctex/synctex_parser_utils.h +++ b/cut-n-paste/synctex/synctex_parser_utils.h @@ -61,18 +61,15 @@ authorization from the copyright holder. extern "C" { #endif -#define FALSE 0 -#define TRUE !FALSE - -# if _WIN32 -# define SYNCTEX_CASE_SENSITIVE_PATH FALSE +# if defined(_WIN32) || defined(__OS2__) +# define SYNCTEX_CASE_SENSITIVE_PATH 0 # define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c || '\\' == c) # else -# define SYNCTEX_CASE_SENSITIVE_PATH TRUE +# define SYNCTEX_CASE_SENSITIVE_PATH 1 # define SYNCTEX_IS_PATH_SEPARATOR(c) ('/' == c) # endif -# if _WIN32 +# if defined(_WIN32) || defined(__OS2__) # define SYNCTEX_IS_DOT(c) ('.' == c) # else # define SYNCTEX_IS_DOT(c) ('.' == c) |