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-2025 Sebastian Pipping <[email protected]>
16 Copyright (c) 2017 Rhodri James <[email protected]>
17 Copyright (c) 2018 Yury Gribov <[email protected]>
18 Copyright (c) 2026 Matthew Fernandez <[email protected]>
19 Licensed under the MIT license:
20
21 Permission is hereby granted, free of charge, to any person obtaining
22 a copy of this software and associated documentation files (the
23 "Software"), to deal in the Software without restriction, including
24 without limitation the rights to use, copy, modify, merge, publish,
25 distribute, sublicense, and/or sell copies of the Software, and to permit
26 persons to whom the Software is furnished to do so, subject to the
27 following conditions:
28
29 The above copyright notice and this permission notice shall be included
30 in all copies or substantial portions of the Software.
31
32 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
33 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
34 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
35 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
36 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
37 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
38 USE OR OTHER DEALINGS IN THE SOFTWARE.
39 */
40
41 #ifndef Expat_External_INCLUDED
42 # define Expat_External_INCLUDED 1
43 /* Namespace external symbols to allow multiple libexpat version to
44 co-exist. */
45 #include "pyexpatns.h"
46
47 /* External API definitions */
48
49 /* Expat tries very hard to make the API boundary very specifically
50 defined. There are two macros defined to control this boundary;
51 each of these can be defined before including this header to
52 achieve some different behavior, but doing so is not recommended or
53 tested frequently.
54
55 XMLCALL - The calling convention to use for all calls across the
56 "library boundary." This will default to cdecl, and
57 try really hard to tell the compiler that's what we
58 want.
59
60 XMLIMPORT - Whatever magic is needed to note that a function is
61 to be imported from a dynamically loaded library
62 (.dll, .so, or .sl, depending on your platform).
63
64 The XMLCALL macro was added in Expat 1.95.7. The only one which is
65 expected to be directly useful in client code is XMLCALL.
66
67 Note that on at least some Unix versions, the Expat library must be
68 compiled with the cdecl calling convention as the default since
69 system headers may assume the cdecl convention.
70 */
71 # ifndef XMLCALL
72 # if defined(_MSC_VER)
73 # define XMLCALL __cdecl
74 # elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER)
75 # define XMLCALL __attribute__((cdecl))
76 # else
77 /* For any platform which uses this definition and supports more than
78 one calling convention, we need to extend this definition to
79 declare the convention used on that platform, if it's possible to
80 do so.
81
82 If this is the case for your platform, please file a bug report
83 with information on how to identify your platform via the C
84 pre-processor and how to specify the same calling convention as the
85 platform's malloc() implementation.
86 */
87 # define XMLCALL
88 # endif
89 # endif /* not defined XMLCALL */
90
91 # if ! defined(XML_STATIC) && ! defined(XMLIMPORT)
92 # ifndef XML_BUILDING_EXPAT
93 /* using Expat from an application */
94
95 # if defined(_MSC_VER) && ! defined(__BEOS__) && ! 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 */