blob: f337e1c5622a952b513a53028a2fb9fa0f6998c7 [file] [log] [blame]
Fred Drake31d485c2004-08-03 07:06:22 +00001/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
2 See the file COPYING for copying permission.
3*/
4
Thomas Wouters0e3f5912006-08-11 14:57:12 +00005#ifndef Expat_External_INCLUDED
6#define Expat_External_INCLUDED 1
7
Fred Drake31d485c2004-08-03 07:06:22 +00008/* External API definitions */
9
Benjamin Peterson091d0172014-02-04 10:10:55 -050010/* Namespace external symbols to allow multiple libexpat version to
11 co-exist. */
12#include "pyexpatns.h"
13
Gregory P. Smith7c6309c2012-07-14 14:12:35 -070014#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
Fred Drake31d485c2004-08-03 07:06:22 +000015#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. Smith7c6309c2012-07-14 14:12:35 -070041#if defined(_MSC_VER)
Fred Drake31d485c2004-08-03 07:06:22 +000042#define XMLCALL __cdecl
Gregory P. Smith7c6309c2012-07-14 14:12:35 -070043#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER)
Fred Drake31d485c2004-08-03 07:06:22 +000044#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 Wouters0e3f5912006-08-11 14:57:12 +000072
Fred Drake31d485c2004-08-03 07:06:22 +000073/* 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
82extern "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
91typedef wchar_t XML_Char;
92typedef wchar_t XML_LChar;
93#else
94typedef unsigned short XML_Char;
95typedef char XML_LChar;
96#endif /* XML_UNICODE_WCHAR_T */
97#else /* Information is UTF-8 encoded. */
98typedef char XML_Char;
99typedef char XML_LChar;
100#endif /* XML_UNICODE */
Thomas Wouters0e3f5912006-08-11 14:57:12 +0000101
102#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */
103#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400
104typedef __int64 XML_Index;
105typedef unsigned __int64 XML_Size;
106#else
107typedef long long XML_Index;
108typedef unsigned long long XML_Size;
109#endif
110#else
111typedef long XML_Index;
112typedef unsigned long XML_Size;
113#endif /* XML_LARGE_SIZE */
114
115#ifdef __cplusplus
116}
117#endif
118
119#endif /* not Expat_External_INCLUDED */