Fred Drake | 31d485c | 2004-08-03 07:06:22 +0000 | [diff] [blame] | 1 | /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd |
| 2 | See the file COPYING for copying permission. |
| 3 | */ |
| 4 | |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 5 | #ifndef Expat_External_INCLUDED |
| 6 | #define Expat_External_INCLUDED 1 |
| 7 | |
Fred Drake | 31d485c | 2004-08-03 07:06:22 +0000 | [diff] [blame] | 8 | /* External API definitions */ |
| 9 | |
Benjamin Peterson | 091d017 | 2014-02-04 10:10:55 -0500 | [diff] [blame] | 10 | /* Namespace external symbols to allow multiple libexpat version to |
| 11 | co-exist. */ |
| 12 | #include "pyexpatns.h" |
| 13 | |
Gregory P. Smith | 7c6309c | 2012-07-14 14:12:35 -0700 | [diff] [blame] | 14 | #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) |
Fred Drake | 31d485c | 2004-08-03 07:06:22 +0000 | [diff] [blame] | 15 | #define XML_USE_MSC_EXTENSIONS 1 |
| 16 | #endif |
| 17 | |
| 18 | /* Expat tries very hard to make the API boundary very specifically |
| 19 | defined. There are two macros defined to control this boundary; |
| 20 | each of these can be defined before including this header to |
| 21 | achieve some different behavior, but doing so it not recommended or |
| 22 | tested frequently. |
| 23 | |
| 24 | XMLCALL - The calling convention to use for all calls across the |
| 25 | "library boundary." This will default to cdecl, and |
| 26 | try really hard to tell the compiler that's what we |
| 27 | want. |
| 28 | |
| 29 | XMLIMPORT - Whatever magic is needed to note that a function is |
| 30 | to be imported from a dynamically loaded library |
| 31 | (.dll, .so, or .sl, depending on your platform). |
| 32 | |
| 33 | The XMLCALL macro was added in Expat 1.95.7. The only one which is |
| 34 | expected to be directly useful in client code is XMLCALL. |
| 35 | |
| 36 | Note that on at least some Unix versions, the Expat library must be |
| 37 | compiled with the cdecl calling convention as the default since |
| 38 | system headers may assume the cdecl convention. |
| 39 | */ |
| 40 | #ifndef XMLCALL |
Gregory P. Smith | 7c6309c | 2012-07-14 14:12:35 -0700 | [diff] [blame] | 41 | #if defined(_MSC_VER) |
Fred Drake | 31d485c | 2004-08-03 07:06:22 +0000 | [diff] [blame] | 42 | #define XMLCALL __cdecl |
Gregory P. Smith | 7c6309c | 2012-07-14 14:12:35 -0700 | [diff] [blame] | 43 | #elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) |
Fred Drake | 31d485c | 2004-08-03 07:06:22 +0000 | [diff] [blame] | 44 | #define XMLCALL __attribute__((cdecl)) |
| 45 | #else |
| 46 | /* For any platform which uses this definition and supports more than |
| 47 | one calling convention, we need to extend this definition to |
| 48 | declare the convention used on that platform, if it's possible to |
| 49 | do so. |
| 50 | |
| 51 | If this is the case for your platform, please file a bug report |
| 52 | with information on how to identify your platform via the C |
| 53 | pre-processor and how to specify the same calling convention as the |
| 54 | platform's malloc() implementation. |
| 55 | */ |
| 56 | #define XMLCALL |
| 57 | #endif |
| 58 | #endif /* not defined XMLCALL */ |
| 59 | |
| 60 | |
| 61 | #if !defined(XML_STATIC) && !defined(XMLIMPORT) |
| 62 | #ifndef XML_BUILDING_EXPAT |
| 63 | /* using Expat from an application */ |
| 64 | |
| 65 | #ifdef XML_USE_MSC_EXTENSIONS |
| 66 | #define XMLIMPORT __declspec(dllimport) |
| 67 | #endif |
| 68 | |
| 69 | #endif |
| 70 | #endif /* not defined XML_STATIC */ |
| 71 | |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 72 | |
Fred Drake | 31d485c | 2004-08-03 07:06:22 +0000 | [diff] [blame] | 73 | /* If we didn't define it above, define it away: */ |
| 74 | #ifndef XMLIMPORT |
| 75 | #define XMLIMPORT |
| 76 | #endif |
| 77 | |
| 78 | |
| 79 | #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL |
| 80 | |
| 81 | #ifdef __cplusplus |
| 82 | extern "C" { |
| 83 | #endif |
| 84 | |
| 85 | #ifdef XML_UNICODE_WCHAR_T |
| 86 | #define XML_UNICODE |
| 87 | #endif |
| 88 | |
| 89 | #ifdef XML_UNICODE /* Information is UTF-16 encoded. */ |
| 90 | #ifdef XML_UNICODE_WCHAR_T |
| 91 | typedef wchar_t XML_Char; |
| 92 | typedef wchar_t XML_LChar; |
| 93 | #else |
| 94 | typedef unsigned short XML_Char; |
| 95 | typedef char XML_LChar; |
| 96 | #endif /* XML_UNICODE_WCHAR_T */ |
| 97 | #else /* Information is UTF-8 encoded. */ |
| 98 | typedef char XML_Char; |
| 99 | typedef char XML_LChar; |
| 100 | #endif /* XML_UNICODE */ |
Thomas Wouters | 0e3f591 | 2006-08-11 14:57:12 +0000 | [diff] [blame] | 101 | |
| 102 | #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ |
| 103 | #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 |
| 104 | typedef __int64 XML_Index; |
| 105 | typedef unsigned __int64 XML_Size; |
| 106 | #else |
| 107 | typedef long long XML_Index; |
| 108 | typedef unsigned long long XML_Size; |
| 109 | #endif |
| 110 | #else |
| 111 | typedef long XML_Index; |
| 112 | typedef unsigned long XML_Size; |
| 113 | #endif /* XML_LARGE_SIZE */ |
| 114 | |
| 115 | #ifdef __cplusplus |
| 116 | } |
| 117 | #endif |
| 118 | |
| 119 | #endif /* not Expat_External_INCLUDED */ |