12e724bc9Sbluhm /* 22e724bc9Sbluhm __ __ _ 32e724bc9Sbluhm ___\ \/ /_ __ __ _| |_ 42e724bc9Sbluhm / _ \\ /| '_ \ / _` | __| 52e724bc9Sbluhm | __// \| |_) | (_| | |_ 62e724bc9Sbluhm \___/_/\_\ .__/ \__,_|\__| 72e724bc9Sbluhm |_| XML parser 82e724bc9Sbluhm 92e724bc9Sbluhm Copyright (c) 1997-2000 Thai Open Source Software Center Ltd 10*08819b41Sbluhm Copyright (c) 2000 Clark Cooper <coopercc@users.sourceforge.net> 11*08819b41Sbluhm Copyright (c) 2000-2004 Fred L. Drake, Jr. <fdrake@users.sourceforge.net> 12*08819b41Sbluhm Copyright (c) 2001-2002 Greg Stein <gstein@users.sourceforge.net> 13*08819b41Sbluhm Copyright (c) 2002-2006 Karl Waclawek <karl@waclawek.net> 14*08819b41Sbluhm Copyright (c) 2016 Cristian Rodríguez <crrodriguez@opensuse.org> 15*08819b41Sbluhm Copyright (c) 2016-2019 Sebastian Pipping <sebastian@pipping.org> 16*08819b41Sbluhm Copyright (c) 2017 Rhodri James <rhodri@wildebeest.org.uk> 17*08819b41Sbluhm Copyright (c) 2018 Yury Gribov <tetra2005@gmail.com> 182e724bc9Sbluhm Licensed under the MIT license: 192e724bc9Sbluhm 202e724bc9Sbluhm Permission is hereby granted, free of charge, to any person obtaining 212e724bc9Sbluhm a copy of this software and associated documentation files (the 222e724bc9Sbluhm "Software"), to deal in the Software without restriction, including 232e724bc9Sbluhm without limitation the rights to use, copy, modify, merge, publish, 242e724bc9Sbluhm distribute, sublicense, and/or sell copies of the Software, and to permit 252e724bc9Sbluhm persons to whom the Software is furnished to do so, subject to the 262e724bc9Sbluhm following conditions: 272e724bc9Sbluhm 282e724bc9Sbluhm The above copyright notice and this permission notice shall be included 292e724bc9Sbluhm in all copies or substantial portions of the Software. 302e724bc9Sbluhm 312e724bc9Sbluhm THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 322e724bc9Sbluhm EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 332e724bc9Sbluhm MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN 342e724bc9Sbluhm NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 352e724bc9Sbluhm DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 362e724bc9Sbluhm OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE 372e724bc9Sbluhm USE OR OTHER DEALINGS IN THE SOFTWARE. 387d36914fSalek */ 397d36914fSalek 407d36914fSalek #ifndef Expat_External_INCLUDED 417d36914fSalek #define Expat_External_INCLUDED 1 427d36914fSalek 437d36914fSalek /* External API definitions */ 447d36914fSalek 457d36914fSalek /* Expat tries very hard to make the API boundary very specifically 467d36914fSalek defined. There are two macros defined to control this boundary; 477d36914fSalek each of these can be defined before including this header to 487d36914fSalek achieve some different behavior, but doing so it not recommended or 497d36914fSalek tested frequently. 507d36914fSalek 517d36914fSalek XMLCALL - The calling convention to use for all calls across the 527d36914fSalek "library boundary." This will default to cdecl, and 537d36914fSalek try really hard to tell the compiler that's what we 547d36914fSalek want. 557d36914fSalek 567d36914fSalek XMLIMPORT - Whatever magic is needed to note that a function is 577d36914fSalek to be imported from a dynamically loaded library 587d36914fSalek (.dll, .so, or .sl, depending on your platform). 597d36914fSalek 607d36914fSalek The XMLCALL macro was added in Expat 1.95.7. The only one which is 617d36914fSalek expected to be directly useful in client code is XMLCALL. 627d36914fSalek 637d36914fSalek Note that on at least some Unix versions, the Expat library must be 647d36914fSalek compiled with the cdecl calling convention as the default since 657d36914fSalek system headers may assume the cdecl convention. 667d36914fSalek */ 677d36914fSalek #ifndef XMLCALL 68b26ab0f8Smatthieu # if defined(_MSC_VER) 697d36914fSalek # define XMLCALL __cdecl 70b26ab0f8Smatthieu # elif defined(__GNUC__) && defined(__i386) && ! defined(__INTEL_COMPILER) 717d36914fSalek # define XMLCALL __attribute__((cdecl)) 727d36914fSalek # else 737d36914fSalek /* For any platform which uses this definition and supports more than 747d36914fSalek one calling convention, we need to extend this definition to 757d36914fSalek declare the convention used on that platform, if it's possible to 767d36914fSalek do so. 777d36914fSalek 787d36914fSalek If this is the case for your platform, please file a bug report 797d36914fSalek with information on how to identify your platform via the C 807d36914fSalek pre-processor and how to specify the same calling convention as the 817d36914fSalek platform's malloc() implementation. 827d36914fSalek */ 837d36914fSalek # define XMLCALL 847d36914fSalek # endif 857d36914fSalek #endif /* not defined XMLCALL */ 867d36914fSalek 877d36914fSalek #if ! defined(XML_STATIC) && ! defined(XMLIMPORT) 887d36914fSalek # ifndef XML_BUILDING_EXPAT 897d36914fSalek /* using Expat from an application */ 907d36914fSalek 9128ce3119Sbluhm # if defined(_MSC_EXTENSIONS) && ! defined(__BEOS__) && ! defined(__CYGWIN__) 927d36914fSalek # define XMLIMPORT __declspec(dllimport) 937d36914fSalek # endif 947d36914fSalek 957d36914fSalek # endif 967d36914fSalek #endif /* not defined XML_STATIC */ 977d36914fSalek 9804da3532Sbluhm #ifndef XML_ENABLE_VISIBILITY 9904da3532Sbluhm # define XML_ENABLE_VISIBILITY 0 10004da3532Sbluhm #endif 10104da3532Sbluhm 10204da3532Sbluhm #if ! defined(XMLIMPORT) && XML_ENABLE_VISIBILITY 1032feb5d2aSbluhm # define XMLIMPORT __attribute__((visibility("default"))) 1042feb5d2aSbluhm #endif 1057d36914fSalek 1067d36914fSalek /* If we didn't define it above, define it away: */ 1077d36914fSalek #ifndef XMLIMPORT 1087d36914fSalek # define XMLIMPORT 1097d36914fSalek #endif 1107d36914fSalek 11128ce3119Sbluhm #if defined(__GNUC__) \ 11228ce3119Sbluhm && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)) 1132feb5d2aSbluhm # define XML_ATTR_MALLOC __attribute__((__malloc__)) 1142feb5d2aSbluhm #else 1152feb5d2aSbluhm # define XML_ATTR_MALLOC 1162feb5d2aSbluhm #endif 1172feb5d2aSbluhm 11828ce3119Sbluhm #if defined(__GNUC__) \ 11928ce3119Sbluhm && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) 1202feb5d2aSbluhm # define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) 1212feb5d2aSbluhm #else 1222feb5d2aSbluhm # define XML_ATTR_ALLOC_SIZE(x) 1232feb5d2aSbluhm #endif 1247d36914fSalek 1257d36914fSalek #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL 1267d36914fSalek 1277d36914fSalek #ifdef __cplusplus 1287d36914fSalek extern "C" { 1297d36914fSalek #endif 1307d36914fSalek 1317d36914fSalek #ifdef XML_UNICODE_WCHAR_T 1329b8e2351Sbluhm # ifndef XML_UNICODE 1337d36914fSalek # define XML_UNICODE 1349b8e2351Sbluhm # endif 1352feb5d2aSbluhm # if defined(__SIZEOF_WCHAR_T__) && (__SIZEOF_WCHAR_T__ != 2) 1362feb5d2aSbluhm # error "sizeof(wchar_t) != 2; Need -fshort-wchar for both Expat and libc" 1372feb5d2aSbluhm # endif 1387d36914fSalek #endif 1397d36914fSalek 1407d36914fSalek #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ 1417d36914fSalek # ifdef XML_UNICODE_WCHAR_T 1427d36914fSalek typedef wchar_t XML_Char; 1437d36914fSalek typedef wchar_t XML_LChar; 1447d36914fSalek # else 1457d36914fSalek typedef unsigned short XML_Char; 1467d36914fSalek typedef char XML_LChar; 1477d36914fSalek # endif /* XML_UNICODE_WCHAR_T */ 1487d36914fSalek #else /* Information is UTF-8 encoded. */ 1497d36914fSalek typedef char XML_Char; 1507d36914fSalek typedef char XML_LChar; 1517d36914fSalek #endif /* XML_UNICODE */ 1527d36914fSalek 1537d36914fSalek #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ 1547d36914fSalek typedef long long XML_Index; 1557d36914fSalek typedef unsigned long long XML_Size; 1567d36914fSalek #else 1577d36914fSalek typedef long XML_Index; 1587d36914fSalek typedef unsigned long XML_Size; 1597d36914fSalek #endif /* XML_LARGE_SIZE */ 1607d36914fSalek 1617d36914fSalek #ifdef __cplusplus 1627d36914fSalek } 1637d36914fSalek #endif 1647d36914fSalek 1657d36914fSalek #endif /* not Expat_External_INCLUDED */ 166