jpayne@69
|
1 /*
|
jpayne@69
|
2 __ __ _
|
jpayne@69
|
3 ___\ \/ /_ __ __ _| |_
|
jpayne@69
|
4 / _ \\ /| '_ \ / _` | __|
|
jpayne@69
|
5 | __// \| |_) | (_| | |_
|
jpayne@69
|
6 \___/_/\_\ .__/ \__,_|\__|
|
jpayne@69
|
7 |_| XML parser
|
jpayne@69
|
8
|
jpayne@69
|
9 Copyright (c) 1997-2000 Thai Open Source Software Center Ltd
|
jpayne@69
|
10 Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net>
|
jpayne@69
|
11 Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net>
|
jpayne@69
|
12 Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net>
|
jpayne@69
|
13 Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net>
|
jpayne@69
|
14 Copyright (c) 2016 Cristian RodrÃguez <crrodriguez@opensuse.org>
|
jpayne@69
|
15 Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org>
|
jpayne@69
|
16 Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk>
|
jpayne@69
|
17 Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com>
|
jpayne@69
|
18 Licensed under the MIT license:
|
jpayne@69
|
19
|
jpayne@69
|
20 Permission is hereby granted, free of charge, to any person obtaining
|
jpayne@69
|
21 a copy of this software and associated documentation files (the
|
jpayne@69
|
22 "Software"), to deal in the Software without restriction, including
|
jpayne@69
|
23 without limitation the rights to use, copy, modify, merge, publish,
|
jpayne@69
|
24 distribute, sublicense, and/or sell copies of the Software, and to permit
|
jpayne@69
|
25 persons to whom the Software is furnished to do so, subject to the
|
jpayne@69
|
26 following conditions:
|
jpayne@69
|
27
|
jpayne@69
|
28 The above copyright notice and this permission notice shall be included
|
jpayne@69
|
29 in all copies or substantial portions of the Software.
|
jpayne@69
|
30
|
jpayne@69
|
31 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
jpayne@69
|
32 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
jpayne@69
|
33 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
jpayne@69
|
34 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
jpayne@69
|
35 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
jpayne@69
|
36 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
jpayne@69
|
37 USE OR OTHER DEALINGS IN THE SOFTWARE.
|
jpayne@69
|
38 */
|
jpayne@69
|
39
|
jpayne@69
|
40 #ifndef Expat_External_INCLUDED
|
jpayne@69
|
41 #define Expat_External_INCLUDED 1
|
jpayne@69
|
42
|
jpayne@69
|
43 /* External API definitions */
|
jpayne@69
|
44
|
jpayne@69
|
45 /* Expat tries very hard to make the API boundary very specifically
|
jpayne@69
|
46 defined. There are two macros defined to control this boundary;
|
jpayne@69
|
47 each of these can be defined before including this header to
|
jpayne@69
|
48 achieve some different behavior, but doing so it not recommended or
|
jpayne@69
|
49 tested frequently.
|
jpayne@69
|
50
|
jpayne@69
|
51 XMLCALL - The calling convention to use for all calls across the
|
jpayne@69
|
52 "library boundary." This will default to cdecl, and
|
jpayne@69
|
53 try really hard to tell the compiler that's what we
|
jpayne@69
|
54 want.
|
jpayne@69
|
55
|
jpayne@69
|
56 XMLIMPORT - Whatever magic is needed to note that a function is
|
jpayne@69
|
57 to be imported from a dynamically loaded library
|
jpayne@69
|
58 (.dll, .so, or .sl, depending on your platform).
|
jpayne@69
|
59
|
jpayne@69
|
60 The XMLCALL macro was added in Expat 1.95.7. The only one which is
|
jpayne@69
|
61 expected to be directly useful in client code is XMLCALL.
|
jpayne@69
|
62
|
jpayne@69
|
63 Note that on at least some Unix versions, the Expat library must be
|
jpayne@69
|
64 compiled with the cdecl calling convention as the default since
|
jpayne@69
|
65 system headers may assume the cdecl convention.
|
jpayne@69
|
66 */
|
jpayne@69
|
67 #ifndef XMLCALL
|
jpayne@69
|
68 # if defined(_MSC_VER)
|
jpayne@69
|
69 # define XMLCALL __cdecl
|
jpayne@69
|
70 # elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
|
jpayne@69
|
71 # define XMLCALL __attribute__((cdecl))
|
jpayne@69
|
72 # else
|
jpayne@69
|
73 /* For any platform which uses this definition and supports more than
|
jpayne@69
|
74 one calling convention, we need to extend this definition to
|
jpayne@69
|
75 declare the convention used on that platform, if it's possible to
|
jpayne@69
|
76 do so.
|
jpayne@69
|
77
|
jpayne@69
|
78 If this is the case for your platform, please file a bug report
|
jpayne@69
|
79 with information on how to identify your platform via the C
|
jpayne@69
|
80 pre-processor and how to specify the same calling convention as the
|
jpayne@69
|
81 platform's malloc() implementation.
|
jpayne@69
|
82 */
|
jpayne@69
|
83 # define XMLCALL
|
jpayne@69
|
84 # endif
|
jpayne@69
|
85 #endif /* not defined XMLCALL */
|
jpayne@69
|
86
|
jpayne@69
|
87 #if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
|
jpayne@69
|
88 # ifndef XML_BUILDING_EXPAT
|
jpayne@69
|
89 /* using Expat from an application */
|
jpayne@69
|
90
|
jpayne@69
|
91 # if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__)
|
jpayne@69
|
92 # define XMLIMPORT __declspec(dllimport)
|
jpayne@69
|
93 # endif
|
jpayne@69
|
94
|
jpayne@69
|
95 # endif
|
jpayne@69
|
96 #endif /* not defined XML_STATIC */
|
jpayne@69
|
97
|
jpayne@69
|
98 #ifndef XML_ENABLE_VISIBILITY
|
jpayne@69
|
99 # define XML_ENABLE_VISIBILITY 0
|
jpayne@69
|
100 #endif
|
jpayne@69
|
101
|
jpayne@69
|
102 #if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY
|
jpayne@69
|
103 # define XMLIMPORT __attribute__((visibility("default")))
|
jpayne@69
|
104 #endif
|
jpayne@69
|
105
|
jpayne@69
|
106 /* If we didn't define it above, define it away: */
|
jpayne@69
|
107 #ifndef XMLIMPORT
|
jpayne@69
|
108 # define XMLIMPORT
|
jpayne@69
|
109 #endif
|
jpayne@69
|
110
|
jpayne@69
|
111 #if defined(__GNUC__) \
|
jpayne@69
|
112 && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
|
jpayne@69
|
113 # define XML_ATTR_MALLOC __attribute__((__malloc__))
|
jpayne@69
|
114 #else
|
jpayne@69
|
115 # define XML_ATTR_MALLOC
|
jpayne@69
|
116 #endif
|
jpayne@69
|
117
|
jpayne@69
|
118 #if defined(__GNUC__) \
|
jpayne@69
|
119 && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
|
jpayne@69
|
120 # define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
|
jpayne@69
|
121 #else
|
jpayne@69
|
122 # define XML_ATTR_ALLOC_SIZE(x)
|
jpayne@69
|
123 #endif
|
jpayne@69
|
124
|
jpayne@69
|
125 #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
|
jpayne@69
|
126
|
jpayne@69
|
127 #ifdef __cplusplus
|
jpayne@69
|
128 extern "C" {
|
jpayne@69
|
129 #endif
|
jpayne@69
|
130
|
jpayne@69
|
131 #ifdef XML_UNICODE_WCHAR_T
|
jpayne@69
|
132 # ifndef XML_UNICODE
|
jpayne@69
|
133 # define XML_UNICODE
|
jpayne@69
|
134 # endif
|
jpayne@69
|
135 # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2)
|
jpayne@69
|
136 # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc"
|
jpayne@69
|
137 # endif
|
jpayne@69
|
138 #endif
|
jpayne@69
|
139
|
jpayne@69
|
140 #ifdef XML_UNICODE /* Information is UTF-16 encoded. */
|
jpayne@69
|
141 # ifdef XML_UNICODE_WCHAR_T
|
jpayne@69
|
142 typedef wchar_t XML_Char;
|
jpayne@69
|
143 typedef wchar_t XML_LChar;
|
jpayne@69
|
144 # else
|
jpayne@69
|
145 typedef unsigned short XML_Char;
|
jpayne@69
|
146 typedef char XML_LChar;
|
jpayne@69
|
147 # endif /* XML_UNICODE_WCHAR_T */
|
jpayne@69
|
148 #else /* Information is UTF-8 encoded. */
|
jpayne@69
|
149 typedef char XML_Char;
|
jpayne@69
|
150 typedef char XML_LChar;
|
jpayne@69
|
151 #endif /* XML_UNICODE */
|
jpayne@69
|
152
|
jpayne@69
|
153 #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
|
jpayne@69
|
154 typedef long long XML_Index;
|
jpayne@69
|
155 typedef unsigned long long XML_Size;
|
jpayne@69
|
156 #else
|
jpayne@69
|
157 typedef long XML_Index;
|
jpayne@69
|
158 typedef unsigned long XML_Size;
|
jpayne@69
|
159 #endif /* XML_LARGE_SIZE */
|
jpayne@69
|
160
|
jpayne@69
|
161 #ifdef __cplusplus
|
jpayne@69
|
162 }
|
jpayne@69
|
163 #endif
|
jpayne@69
|
164
|
jpayne@69
|
165 #endif /* not Expat_External_INCLUDED */
|