~ubuntu-branches/ubuntu/maverick/kdegraphics/maverick-proposed

« back to all changes in this revision

Viewing changes to okular/generators/poppler/synctex/synctex_parser_utils.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2009-12-02 14:03:43 UTC
  • mfrom: (1.1.35 upstream)
  • Revision ID: james.westby@ubuntu.com-20091202140343-2732gbkj69g89arq
Tags: 4:4.3.80-0ubuntu1
* New upstream beta release:
  - Add build-depend on shared-desktop-ontologies for nepomuk integration
  - Bump .so versions for libkexiv, libkdcraw and libkipi
  - Update various .install files

Show diffs side-by-side

added added

removed removed

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