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 <coopercc (at) users.sourceforge.net> 11 Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake (at) users.sourceforge.net> 12 Copyright (c) 2001-2002 Greg Stein <gstein (at) users.sourceforge.net> 13 Copyright (c) 2002-2006 Karl Waclawek <karl (at) waclawek.net> 14 Copyright (c) 2016 Cristian Rodrguez <crrodriguez (at) opensuse.org> 15 Copyright (c) 2016-2025 Sebastian Pipping <sebastian (at) pipping.org> 16 Copyright (c) 2017 Rhodri James <rhodri (at) wildebeest.org.uk> 17 Copyright (c) 2018 Yury Gribov <tetra2005 (at) gmail.com> 18 Copyright (c) 2026 Matthew Fernandez <matthew.fernandez (at) gmail.com> 19 Copyright (c) 2026 Braian Plaku <braianplaku (at) gmail.com> 20 Licensed under the MIT license: 21 22 Permission is hereby granted, free of charge, to any person obtaining 23 a copy of this software and associated documentation files (the 24 "Software"), to deal in the Software without restriction, including 25 without limitation the rights to use, copy, modify, merge, publish, 26 distribute, sublicense, and/or sell copies of the Software, and to permit 27 persons to whom the Software is furnished to do so, subject to the 28 following conditions: 29 30 The above copyright notice and this permission notice shall be included 31 in all copies or substantial portions of the Software. 32 33 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 34 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 35 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 36 NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 37 DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 38 OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 39 USE OR OTHER DEALINGS IN THE SOFTWARE. 40 41 SPDX-License-Identifier: MIT 42 */ 43 44 #ifndef Expat_External_INCLUDED 45 # define Expat_External_INCLUDED 1 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 /* Marks a function that Expat still provides but that callers should move off 130 of. */ 131 # if defined(__clang__) || defined(__GNUC__) 132 # define XML_ATTR_DEPRECATED(message) \ 133 __attribute__((__deprecated__(message))) 134 # elif defined(_MSC_VER) 135 # define XML_ATTR_DEPRECATED(message) __declspec(deprecated(message)) 136 # else 137 # define XML_ATTR_DEPRECATED(message) // empty i.e. no deprecation 138 # endif 139 140 # define XMLPARSEAPI(type) XMLIMPORT type XMLCALL 141 142 # ifdef __cplusplus 143 extern "C" { 144 # endif 145 146 # ifdef XML_UNICODE_WCHAR_T 147 # ifndef XML_UNICODE 148 # define XML_UNICODE 149 # endif 150 # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) 151 # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc" 152 # endif 153 # endif 154 155 # ifdef XML_UNICODE /* Information is UTF-16 encoded. */ 156 # ifdef XML_UNICODE_WCHAR_T 157 typedef wchar_t XML_Char; 158 typedef wchar_t XML_LChar; 159 # else 160 typedef unsigned short XML_Char; 161 typedef char XML_LChar; 162 # endif /* XML_UNICODE_WCHAR_T */ 163 # else /* Information is UTF-8 encoded. */ 164 typedef char XML_Char; 165 typedef char XML_LChar; 166 # endif /* XML_UNICODE */ 167 168 # ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ 169 typedef long long XML_Index; 170 typedef unsigned long long XML_Size; 171 # else 172 typedef long XML_Index; 173 typedef unsigned long XML_Size; 174 # endif /* XML_LARGE_SIZE */ 175 176 # ifdef __cplusplus 177 } 178 # endif 179 180 #endif /* not Expat_External_INCLUDED */ 181