1 /* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
2 See the file COPYING for copying permission.
5 #ifndef Expat_External_INCLUDED
6 #define Expat_External_INCLUDED 1
8 /* External API definitions */
10 #if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
11 #define XML_USE_MSC_EXTENSIONS 1
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
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
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).
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.
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.
38 #define XMLCALL __cdecl
39 #elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
40 #define XMLCALL __attribute__((cdecl))
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
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.
54 #endif /* not defined XMLCALL */
57 #if !defined(XML_STATIC) && !defined(XMLIMPORT)
58 #ifndef XML_BUILDING_EXPAT
59 /* using Expat from an application */
61 #ifdef XML_USE_MSC_EXTENSIONS
62 #define XMLIMPORT __declspec(dllimport)
66 #endif /* not defined XML_STATIC */
68 #if !defined(XMLIMPORT) && defined(__GNUC__) && (__GNUC__ >= 4)
69 #define XMLIMPORT __attribute__ ((visibility ("default")))
72 /* If we didn't define it above, define it away: */
77 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96))
78 #define XML_ATTR_MALLOC __attribute__((__malloc__))
80 #define XML_ATTR_MALLOC
83 #if defined(__GNUC__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))
84 #define XML_ATTR_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
86 #define XML_ATTR_ALLOC_SIZE(x)
89 #define XMLPARSEAPI(type) XMLIMPORT type XMLCALL
95 #ifdef XML_UNICODE_WCHAR_T
99 #ifdef XML_UNICODE /* Information is UTF-16 encoded. */
100 #ifdef XML_UNICODE_WCHAR_T
101 typedef wchar_t XML_Char;
102 typedef wchar_t XML_LChar;
104 typedef unsigned short XML_Char;
105 typedef char XML_LChar;
106 #endif /* XML_UNICODE_WCHAR_T */
107 #else /* Information is UTF-8 encoded. */
108 typedef char XML_Char;
109 typedef char XML_LChar;
110 #endif /* XML_UNICODE */
112 #ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
113 #if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
114 typedef __int64 XML_Index;
115 typedef unsigned __int64 XML_Size;
117 typedef long long XML_Index;
118 typedef unsigned long long XML_Size;
121 typedef long XML_Index;
122 typedef unsigned long XML_Size;
123 #endif /* XML_LARGE_SIZE */
129 #endif /* not Expat_External_INCLUDED */