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