Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / include / windef.h
blob3fd01c5bb761b1f6e2b0aca6ab3708874ba28abb
1 #ifndef _WINDEF_H
2 #define _WINDEF_H
3 #if __GNUC__ >=3
4 #pragma GCC system_header
5 #endif
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
11 #ifndef WINVER
12 #define WINVER 0x0400
14 * If you need Win32 API features newer the Win95 and WinNT then you must
15 * define WINVER before including windows.h or any other method of including
16 * the windef.h header.
18 #endif
19 #ifndef _WIN32_WINNT
20 #define _WIN32_WINNT WINVER
22 * There may be the need to define _WIN32_WINNT to a value different from
23 * the value of WINVER. I don't have any example of why you would do that.
24 * However, if you must then define _WIN32_WINNT to the value required before
25 * including windows.h or any other method of including the windef.h header.
27 #endif
28 #ifndef WIN32
29 #define WIN32
30 #endif
31 #ifndef _WIN32
32 #define _WIN32
33 #endif
34 #define FAR
35 #define far
36 #define NEAR
37 #define near
38 #ifndef CONST
39 #define CONST const
40 #endif
41 #undef MAX_PATH
42 #define MAX_PATH 260
44 #ifndef NULL
45 #ifdef __cplusplus
46 #define NULL 0
47 #else
48 #define NULL ((void*)0)
49 #endif
50 #endif
51 #ifndef FALSE
52 #define FALSE 0
53 #endif
54 #ifndef TRUE
55 #define TRUE 1
56 #endif
58 /* Pseudo modifiers for parameters
59 We don't use these unnecessary defines in the w32api headers. Define
60 them by default since that is what people expect, but allow users
61 to avoid the pollution. */
62 #ifndef _NO_W32_PSEUDO_MODIFIERS
63 #define IN
64 #define OUT
65 #ifndef OPTIONAL
66 #define OPTIONAL
67 #endif
68 #endif
70 #ifdef __GNUC__
71 #define PACKED __attribute__((packed))
72 #ifndef _fastcall
73 #define _fastcall __attribute__((fastcall))
74 #endif
75 #ifndef __fastcall
76 #define __fastcall __attribute__((fastcall))
77 #endif
78 #ifndef _stdcall
79 #define _stdcall __attribute__((stdcall))
80 #endif
81 #ifndef __stdcall
82 #define __stdcall __attribute__((stdcall))
83 #endif
84 #ifndef _cdecl
85 #define _cdecl __attribute__((cdecl))
86 #endif
87 #ifndef __cdecl
88 #define __cdecl __attribute__((cdecl))
89 #endif
90 #ifndef __declspec
91 #define __declspec(e) __attribute__((e))
92 #endif
93 #ifndef _declspec
94 #define _declspec(e) __attribute__((e))
95 #endif
96 #elif defined(__WATCOMC__)
97 #define PACKED
98 #else
99 #define PACKED
100 #define _cdecl
101 #define __cdecl
102 #endif
104 #undef pascal
105 #undef _pascal
106 #undef __pascal
107 #define pascal __stdcall
108 #define _pascal __stdcall
109 #define __pascal __stdcall
110 #define PASCAL _pascal
111 #define CDECL _cdecl
112 #define STDCALL __stdcall
113 #define FASTCALL __fastcall
114 #define WINAPI __stdcall
115 #define WINAPIV __cdecl
116 #define APIENTRY __stdcall
117 #define CALLBACK __stdcall
118 #define APIPRIVATE __stdcall
120 #define DECLSPEC_IMPORT __declspec(dllimport)
121 #define DECLSPEC_EXPORT __declspec(dllexport)
122 #ifdef __GNUC__
123 #define DECLSPEC_NORETURN __declspec(noreturn)
124 #define DECLARE_STDCALL_P( type ) __stdcall type
125 #elif defined(__WATCOMC__)
126 #define DECLSPEC_NORETURN
127 #define DECLARE_STDCALL_P( type ) type __stdcall
128 #endif /* __GNUC__/__WATCOMC__ */
129 #define MAKEWORD(a,b) ((WORD)(((BYTE)(a))|(((WORD)((BYTE)(b)))<<8)))
130 #define MAKELONG(a,b) ((LONG)(((WORD)(a))|(((DWORD)((WORD)(b)))<<16)))
131 #define LOWORD(l) ((WORD)((DWORD)(l)))
132 #define HIWORD(l) ((WORD)(((DWORD)(l)>>16)&0xFFFF))
133 #define LOBYTE(w) ((BYTE)(w))
134 #define HIBYTE(w) ((BYTE)(((WORD)(w)>>8)&0xFF))
136 #ifndef __WATCOMC__
137 #ifndef _export
138 #define _export
139 #endif
140 #ifndef __export
141 #define __export
142 #endif
143 #endif
145 #ifndef NOMINMAX
146 #ifndef max
147 #define max(a,b) ((a)>(b)?(a):(b))
148 #endif
149 #ifndef min
150 #define min(a,b) ((a)<(b)?(a):(b))
151 #endif
152 #endif
154 #define UNREFERENCED_PARAMETER(P) {(P)=(P);}
155 #define UNREFERENCED_LOCAL_VARIABLE(L) {(L)=(L);}
156 #define DBG_UNREFERENCED_PARAMETER(P)
157 #define DBG_UNREFERENCED_LOCAL_VARIABLE(L)
159 #ifndef NONAMELESSUNION
160 #ifdef __GNUC__
161 #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
162 #define _ANONYMOUS_UNION __extension__
163 #define _ANONYMOUS_STRUCT __extension__
164 #else
165 #if defined(__cplusplus)
166 #define _ANONYMOUS_UNION __extension__
167 #endif /* __cplusplus */
168 #endif /* __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) */
169 #elif defined(__WATCOMC__)
170 #define _ANONYMOUS_UNION
171 #define _ANONYMOUS_STRUCT
172 #endif /* __GNUC__/__WATCOMC__ */
173 #endif /* NONAMELESSUNION */
175 #ifndef _ANONYMOUS_UNION
176 #define _ANONYMOUS_UNION
177 #define _UNION_NAME(x) x
178 #define DUMMYUNIONNAME u
179 #define DUMMYUNIONNAME2 u2
180 #define DUMMYUNIONNAME3 u3
181 #define DUMMYUNIONNAME4 u4
182 #define DUMMYUNIONNAME5 u5
183 #define DUMMYUNIONNAME6 u6
184 #define DUMMYUNIONNAME7 u7
185 #define DUMMYUNIONNAME8 u8
186 #else
187 #define _UNION_NAME(x)
188 #define DUMMYUNIONNAME
189 #define DUMMYUNIONNAME2
190 #define DUMMYUNIONNAME3
191 #define DUMMYUNIONNAME4
192 #define DUMMYUNIONNAME5
193 #define DUMMYUNIONNAME6
194 #define DUMMYUNIONNAME7
195 #define DUMMYUNIONNAME8
196 #endif
197 #ifndef _ANONYMOUS_STRUCT
198 #define _ANONYMOUS_STRUCT
199 #define _STRUCT_NAME(x) x
200 #define DUMMYSTRUCTNAME s
201 #define DUMMYSTRUCTNAME2 s2
202 #define DUMMYSTRUCTNAME3 s3
203 #else
204 #define _STRUCT_NAME(x)
205 #define DUMMYSTRUCTNAME
206 #define DUMMYSTRUCTNAME2
207 #define DUMMYSTRUCTNAME3
208 #endif
210 #ifndef NO_STRICT
211 #ifndef STRICT
212 #define STRICT 1
213 #endif
214 #endif
216 /* FIXME: This will make some code compile. The programs will most
217 likely crash when an exception is raised, but at least they will
218 compile. */
219 #if defined (__GNUC__) && defined (__SEH_NOOP)
220 #define __try
221 #define __except(x) if (0) /* don't execute handler */
222 #define __finally
224 #define _try __try
225 #define _except __except
226 #define _finally __finally
227 #endif
229 typedef unsigned long DWORD;
230 typedef int WINBOOL,*PWINBOOL,*LPWINBOOL;
231 /* FIXME: Is there a good solution to this? */
232 #ifndef XFree86Server
233 #ifndef __OBJC__
234 typedef WINBOOL BOOL;
235 #else
236 #define BOOL WINBOOL
237 #endif
238 typedef unsigned char BYTE;
239 #endif /* ndef XFree86Server */
240 typedef BOOL *PBOOL,*LPBOOL;
241 typedef unsigned short WORD;
242 typedef float FLOAT;
243 typedef FLOAT *PFLOAT;
244 typedef BYTE *PBYTE,*LPBYTE;
245 typedef int *PINT,*LPINT;
246 typedef WORD *PWORD,*LPWORD;
247 typedef long *LPLONG;
248 typedef DWORD *PDWORD,*LPDWORD;
249 typedef CONST void *PCVOID,*LPCVOID;
250 typedef int INT;
251 typedef unsigned int UINT,*PUINT,*LPUINT;
253 #include <winnt.h>
255 typedef UINT_PTR WPARAM;
256 typedef LONG_PTR LPARAM;
257 typedef LONG_PTR LRESULT;
258 #ifndef _HRESULT_DEFINED
259 typedef LONG HRESULT;
260 #define _HRESULT_DEFINED
261 #endif
262 #ifndef XFree86Server
263 typedef WORD ATOM;
264 #endif /* XFree86Server */
265 typedef HANDLE HGLOBAL;
266 typedef HANDLE HLOCAL;
267 typedef HANDLE GLOBALHANDLE;
268 typedef HANDLE LOCALHANDLE;
269 typedef void *HGDIOBJ;
270 DECLARE_HANDLE(HACCEL);
271 DECLARE_HANDLE(HBITMAP);
272 DECLARE_HANDLE(HBRUSH);
273 DECLARE_HANDLE(HCOLORSPACE);
274 DECLARE_HANDLE(HDC);
275 DECLARE_HANDLE(HGLRC);
276 DECLARE_HANDLE(HDESK);
277 DECLARE_HANDLE(HENHMETAFILE);
278 DECLARE_HANDLE(HFONT);
279 DECLARE_HANDLE(HICON);
280 DECLARE_HANDLE(HKEY);
281 /* FIXME: How to handle these. SM_CMONITORS etc in winuser.h also. */
282 DECLARE_HANDLE(HMONITOR);
283 #define HMONITOR_DECLARED 1
284 DECLARE_HANDLE(HTERMINAL);
285 DECLARE_HANDLE(HWINEVENTHOOK);
287 typedef HKEY *PHKEY;
288 DECLARE_HANDLE(HMENU);
289 DECLARE_HANDLE(HMETAFILE);
290 DECLARE_HANDLE(HINSTANCE);
291 typedef HINSTANCE HMODULE;
292 DECLARE_HANDLE(HPALETTE);
293 DECLARE_HANDLE(HPEN);
294 DECLARE_HANDLE(HRGN);
295 DECLARE_HANDLE(HRSRC);
296 DECLARE_HANDLE(HSTR);
297 DECLARE_HANDLE(HTASK);
298 DECLARE_HANDLE(HWND);
299 DECLARE_HANDLE(HWINSTA);
300 DECLARE_HANDLE(HKL);
301 typedef int HFILE;
302 typedef HICON HCURSOR;
303 typedef DWORD COLORREF;
304 typedef int (WINAPI *FARPROC)();
305 typedef int (WINAPI *NEARPROC)();
306 typedef int (WINAPI *PROC)();
307 typedef struct tagRECT {
308 LONG left;
309 LONG top;
310 LONG right;
311 LONG bottom;
312 } RECT,*PRECT,*LPRECT;
313 typedef const RECT *LPCRECT;
314 typedef struct tagRECTL {
315 LONG left;
316 LONG top;
317 LONG right;
318 LONG bottom;
319 } RECTL,*PRECTL,*LPRECTL;
320 typedef const RECTL *LPCRECTL;
321 typedef struct tagPOINT {
322 LONG x;
323 LONG y;
324 } POINT,POINTL,*PPOINT,*LPPOINT,*PPOINTL,*LPPOINTL;
325 typedef struct tagSIZE {
326 LONG cx;
327 LONG cy;
328 } SIZE,SIZEL,*PSIZE,*LPSIZE,*PSIZEL,*LPSIZEL;
329 typedef struct tagPOINTS {
330 SHORT x;
331 SHORT y;
332 } POINTS,*PPOINTS,*LPPOINTS;
334 #ifdef __cplusplus
336 #endif
337 #endif