|
1 #ifndef _BASETYPS_H |
|
2 #define _BASETYPS_H |
|
3 #if __GNUC__ >=3 |
|
4 #pragma GCC system_header |
|
5 #endif |
|
6 |
|
7 #ifndef _OBJC_NO_COM_ |
|
8 # ifdef __cplusplus |
|
9 # define EXTERN_C extern "C" |
|
10 # else |
|
11 # define EXTERN_C extern |
|
12 # endif /* __cplusplus */ |
|
13 # ifndef __int64 |
|
14 # define __int64 long long |
|
15 # endif |
|
16 # ifndef __int32 |
|
17 # define __int32 long |
|
18 # endif |
|
19 # ifndef __int16 |
|
20 # define __int16 short |
|
21 # endif |
|
22 # ifndef __int8 |
|
23 # define __int8 char |
|
24 # endif |
|
25 # ifndef __small |
|
26 # define __small char |
|
27 # endif |
|
28 # ifndef __hyper |
|
29 # define __hyper long long |
|
30 # endif |
|
31 # define STDMETHODCALLTYPE __stdcall |
|
32 # define STDMETHODVCALLTYPE __cdecl |
|
33 # define STDAPICALLTYPE __stdcall |
|
34 # define STDAPIVCALLTYPE __cdecl |
|
35 # define STDAPI EXTERN_C HRESULT STDAPICALLTYPE |
|
36 # define STDAPI_(t) EXTERN_C t STDAPICALLTYPE |
|
37 # define STDMETHODIMP HRESULT STDMETHODCALLTYPE |
|
38 # define STDMETHODIMP_(t) t STDMETHODCALLTYPE |
|
39 # define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE |
|
40 # define STDAPIV_(t) EXTERN_C t STDAPIVCALLTYPE |
|
41 # define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE |
|
42 # define STDMETHODIMPV_(t) t STDMETHODVCALLTYPE |
|
43 /* Newer MS compilers support the __interface keyword, but |
|
44 that has a specific meaning that is enforced by the compiler. |
|
45 For now, just get 'interface' out of the global namespace |
|
46 for __OBJC__ */ |
|
47 # define _COM_interface struct |
|
48 # ifndef __OBJC__ |
|
49 # define interface _COM_interface |
|
50 # endif |
|
51 # if defined(__cplusplus) && !defined(CINTERFACE) |
|
52 # define STDMETHOD(m) virtual HRESULT STDMETHODCALLTYPE m |
|
53 # define STDMETHOD_(t,m) virtual t STDMETHODCALLTYPE m |
|
54 # define PURE =0 |
|
55 # define THIS_ |
|
56 # define THIS void |
|
57 /* |
|
58 __attribute__((com_interface)) is obsolete in __GNUC__ >= 3 |
|
59 g++ vtables are now COM-compatible by default |
|
60 */ |
|
61 # if defined(__GNUC__) && __GNUC__ < 3 && !defined(NOCOMATTRIBUTE) |
|
62 # define DECLARE_INTERFACE(i) _COM_interface __attribute__((com_interface)) i |
|
63 # define DECLARE_INTERFACE_(i,b) _COM_interface __attribute__((com_interface)) i : public b |
|
64 # else |
|
65 # define DECLARE_INTERFACE(i) _COM_interface i |
|
66 # define DECLARE_INTERFACE_(i,b) _COM_interface i : public b |
|
67 # endif |
|
68 # else |
|
69 # define STDMETHOD(m) HRESULT(STDMETHODCALLTYPE *m) |
|
70 # define STDMETHOD_(t,m) t(STDMETHODCALLTYPE *m) |
|
71 # define PURE |
|
72 # define THIS_ INTERFACE *, |
|
73 # define THIS INTERFACE * |
|
74 # ifndef CONST_VTABLE |
|
75 # define CONST_VTABLE |
|
76 # endif |
|
77 # define DECLARE_INTERFACE(i) \ |
|
78 typedef _COM_interface i { CONST_VTABLE struct i##Vtbl *lpVtbl; } i; \ |
|
79 typedef CONST_VTABLE struct i##Vtbl i##Vtbl; \ |
|
80 CONST_VTABLE struct i##Vtbl |
|
81 # define DECLARE_INTERFACE_(i,b) DECLARE_INTERFACE(i) |
|
82 # endif |
|
83 # define BEGIN_INTERFACE |
|
84 # define END_INTERFACE |
|
85 |
|
86 # define FWD_DECL(i) typedef _COM_interface i i |
|
87 # if defined(__cplusplus) && !defined(CINTERFACE) |
|
88 # define IENUM_THIS(T) |
|
89 # define IENUM_THIS_(T) |
|
90 # else |
|
91 # define IENUM_THIS(T) T* |
|
92 # define IENUM_THIS_(T) T*, |
|
93 # endif |
|
94 # define DECLARE_ENUMERATOR_(I,T) \ |
|
95 DECLARE_INTERFACE_(I,IUnknown) \ |
|
96 { \ |
|
97 STDMETHOD(QueryInterface)(IENUM_THIS_(I) REFIID,PVOID*) PURE; \ |
|
98 STDMETHOD_(ULONG,AddRef)(IENUM_THIS(I)) PURE; \ |
|
99 STDMETHOD_(ULONG,Release)(IENUM_THIS(I)) PURE; \ |
|
100 STDMETHOD(Next)(IENUM_THIS_(I) ULONG,T*,ULONG*) PURE; \ |
|
101 STDMETHOD(Skip)(IENUM_THIS_(I) ULONG) PURE; \ |
|
102 STDMETHOD(Reset)(IENUM_THIS(I)) PURE; \ |
|
103 STDMETHOD(Clone)(IENUM_THIS_(I) I**) PURE; \ |
|
104 } |
|
105 # define DECLARE_ENUMERATOR(T) DECLARE_ENUMERATOR_(IEnum##T,T) |
|
106 |
|
107 #endif /* _OBJC_NO_COM_ */ |
|
108 |
|
109 #ifdef _GUID_DEFINED |
|
110 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead |
|
111 #endif |
|
112 |
|
113 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in winnt.h */ |
|
114 #define GUID_DEFINED |
|
115 typedef struct _GUID |
|
116 { |
|
117 unsigned long Data1; |
|
118 unsigned short Data2; |
|
119 unsigned short Data3; |
|
120 unsigned char Data4[8]; |
|
121 } GUID,*REFGUID,*LPGUID; |
|
122 #endif /* GUID_DEFINED */ |
|
123 #ifndef UUID_DEFINED |
|
124 #define UUID_DEFINED |
|
125 typedef GUID UUID; |
|
126 #endif /* UUID_DEFINED */ |
|
127 #ifndef __IID_DEFINED__ |
|
128 #define __IID_DEFINED__ |
|
129 typedef GUID IID; |
|
130 #endif /* __IID_DEFINED__ */ |
|
131 typedef GUID CLSID; |
|
132 typedef CLSID *LPCLSID; |
|
133 typedef IID *LPIID; |
|
134 typedef IID *REFIID; |
|
135 typedef CLSID *REFCLSID; |
|
136 typedef GUID FMTID; |
|
137 typedef FMTID *REFFMTID; |
|
138 typedef unsigned long error_status_t; |
|
139 #define uuid_t UUID |
|
140 typedef unsigned long PROPID; |
|
141 |
|
142 #ifndef _REFGUID_DEFINED |
|
143 #if defined (__cplusplus) && !defined (CINTERFACE) |
|
144 #define REFGUID const GUID& |
|
145 #define REFIID const IID& |
|
146 #define REFCLSID const CLSID& |
|
147 #define REFFMTID const FMTID& |
|
148 #else |
|
149 #define REFGUID const GUID* const |
|
150 #define REFIID const IID* const |
|
151 #define REFCLSID const CLSID* const |
|
152 #define REFFMTID const FMTID* const |
|
153 #endif |
|
154 #define _REFGUID_DEFINED |
|
155 #define _REFIID_DEFINED |
|
156 #define _REFCLSID_DEFINED |
|
157 #define _REFFMTID_DEFINED |
|
158 #endif |
|
159 #ifndef GUID_SECTION |
|
160 #define GUID_SECTION ".text" |
|
161 #endif |
|
162 /* Explicit naming of .text section for readonly data is only |
|
163 needed for older GGC (pre-2.95). |
|
164 More recent (3.4) GCC puts readonly data in .rdata. */ |
|
165 #if defined (__GNUC__) && (__GNUC__ <= 2 && __GNUC_MINOR__ < 95) |
|
166 #define GUID_SECT __attribute__ ((section (GUID_SECTION))) |
|
167 #else |
|
168 #define GUID_SECT |
|
169 #endif |
|
170 #if !defined(INITGUID) || (defined(INITGUID) && defined(__cplusplus)) |
|
171 #define GUID_EXT EXTERN_C |
|
172 #else |
|
173 #define GUID_EXT |
|
174 #endif |
|
175 #ifdef INITGUID |
|
176 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} |
|
177 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) |
|
178 #else |
|
179 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n |
|
180 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46) |
|
181 #endif |
|
182 #endif |