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