Debian Codegraph @

Modules/expat/expat_external.h

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