Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / basetyps.h
blob7c38b39430c20ae9e6b187861ff7a9e608a1028f
1 #ifndef _BASETYPS_H
2 #define _BASETYPS_H
3 #if __GNUC__ >=3
4 #pragma GCC system_header
5 #endif
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
58 __attribute__((com_interface)) is obsolete in __GNUC__ >= 3
59 g++ vtables are now COM-compatible by default
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
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; \
105 # define DECLARE_ENUMERATOR(T) DECLARE_ENUMERATOR_(IEnum##T,T)
107 #endif /* _OBJC_NO_COM_ */
109 #ifdef _GUID_DEFINED
110 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
111 #endif
113 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in winnt.h */
114 #define GUID_DEFINED
115 typedef struct _GUID
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 typedef GUID IID;
128 typedef GUID CLSID;
129 typedef CLSID *LPCLSID;
130 typedef IID *LPIID;
131 typedef IID *REFIID;
132 typedef CLSID *REFCLSID;
133 typedef GUID FMTID;
134 typedef FMTID *REFFMTID;
135 typedef unsigned long error_status_t;
136 #define uuid_t UUID
137 typedef unsigned long PROPID;
139 #ifndef _REFGUID_DEFINED
140 #if defined (__cplusplus) && !defined (CINTERFACE)
141 #define REFGUID const GUID&
142 #define REFIID const IID&
143 #define REFCLSID const CLSID&
144 #define REFFMTID const FMTID&
145 #else
146 #define REFGUID const GUID* const
147 #define REFIID const IID* const
148 #define REFCLSID const CLSID* const
149 #define REFFMTID const FMTID* const
150 #endif
151 #define _REFGUID_DEFINED
152 #define _REFIID_DEFINED
153 #define _REFCLSID_DEFINED
154 #define _REFFMTID_DEFINED
155 #endif
156 #ifndef GUID_SECTION
157 #define GUID_SECTION ".text"
158 #endif
159 /* Explicit naming of .text section for readonly data is only
160 needed for older GGC (pre-2.95).
161 More recent (3.4) GCC puts readonly data in .rdata. */
162 #if defined (__GNUC__) && (__GNUC__ <= 2 && __GNUC_MINOR__ < 95)
163 #define GUID_SECT __attribute__ ((section (GUID_SECTION)))
164 #else
165 #define GUID_SECT
166 #endif
167 #if !defined(INITGUID) || (defined(INITGUID) && defined(__cplusplus))
168 #define GUID_EXT EXTERN_C
169 #else
170 #define GUID_EXT
171 #endif
172 #ifdef INITGUID
173 #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}}
174 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46)
175 #else
176 #define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n
177 #define DEFINE_OLEGUID(n,l,w1,w2) DEFINE_GUID(n,l,w1,w2,0xC0,0,0,0,0,0,0,0x46)
178 #endif
179 #endif