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