Added configure check for regex.h.
[wine] / include / windef.h
1 /*
2  * Basic types definitions
3  *
4  * Copyright 1996 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
23
24 #ifdef __WINESRC__
25 # undef UNICODE
26 #endif  /* __WINESRC__ */
27
28 #ifndef WINVER
29 #define WINVER 0x0500
30 #endif
31
32 #ifndef NO_STRICT
33 # ifndef STRICT
34 #  define STRICT
35 # endif /* STRICT */
36 #endif /* NO_STRICT */
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 /* Calling conventions definitions */
43
44 #ifdef __i386__
45 # ifndef _X86_
46 #  define _X86_
47 # endif
48 # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
49 #  define __stdcall __attribute__((__stdcall__))
50 #  define __cdecl   __attribute__((__cdecl__))
51 # elif defined(_MSC_VER)
52 /* Nothing needs to be done. __cdecl/__stdcall already exists */
53 # else
54 #  error You need gcc >= 2.7 to build Wine on a 386
55 # endif  /* __GNUC__ */
56 #else  /* __i386__ */
57 # define __stdcall
58 # define __cdecl
59 #endif  /* __i386__ */
60
61 #ifndef __WINESRC__
62
63 #ifndef pascal
64 #define pascal      __stdcall
65 #endif
66 #ifndef _pascal
67 #define _pascal     __stdcall
68 #endif
69 #ifndef _stdcall
70 #define _stdcall    __stdcall
71 #endif
72 #ifndef _fastcall
73 #define _fastcall   __stdcall
74 #endif
75 #ifndef __fastcall
76 #define __fastcall  __stdcall
77 #endif
78 #ifndef __export
79 #define __export    __stdcall
80 #endif
81 #ifndef cdecl
82 #define cdecl       __cdecl
83 #endif
84 #ifndef _cdecl
85 #define _cdecl      __cdecl
86 #endif
87
88 #ifndef near
89 #define near
90 #endif
91 #ifndef far
92 #define far
93 #endif
94 #ifndef _near
95 #define _near
96 #endif
97 #ifndef _far
98 #define _far
99 #endif
100 #ifndef NEAR
101 #define NEAR
102 #endif
103 #ifndef FAR
104 #define FAR
105 #endif
106
107 #ifndef _declspec
108 #define _declspec(x)
109 #endif
110 #ifndef __declspec
111 #define __declspec(x)
112 #endif
113
114 #endif /* __WINESRC__ */
115
116 #define CALLBACK    __stdcall
117 #define WINAPI      __stdcall
118 #define APIPRIVATE  __stdcall
119 #define PASCAL      __stdcall
120 #define CDECL       __cdecl
121 #define _CDECL      __cdecl
122 #define WINAPIV     __cdecl
123 #define APIENTRY    WINAPI
124 #define CONST       const
125
126 /* Misc. constants. */
127
128 #undef NULL
129 #ifdef __cplusplus
130 #define NULL  0
131 #else
132 #define NULL  ((void*)0)
133 #endif
134
135 #ifdef FALSE
136 #undef FALSE
137 #endif
138 #define FALSE 0
139
140 #ifdef TRUE
141 #undef TRUE
142 #endif
143 #define TRUE  1
144
145 #ifndef IN
146 #define IN
147 #endif
148
149 #ifndef OUT
150 #define OUT
151 #endif
152
153 #ifndef OPTIONAL
154 #define OPTIONAL
155 #endif
156
157 /* Standard data types */
158
159 typedef void                                   *LPVOID;
160 typedef const void                             *LPCVOID;
161 typedef int             BOOL,       *PBOOL,    *LPBOOL;
162 typedef unsigned char   BYTE,       *PBYTE,    *LPBYTE;
163 typedef unsigned char   UCHAR,      *PUCHAR;
164 typedef unsigned short  WORD,       *PWORD,    *LPWORD;
165 typedef unsigned short  USHORT,     *PUSHORT;
166 typedef int             INT,        *PINT,     *LPINT;
167 typedef unsigned int    UINT,       *PUINT;
168 typedef long                                   *LPLONG;
169 typedef unsigned long   DWORD,      *PDWORD,   *LPDWORD;
170 typedef unsigned long   ULONG,      *PULONG;
171 typedef float           FLOAT,      *PFLOAT;
172 typedef double          DOUBLE;
173 typedef double          DATE;
174
175 #include "winnt.h"
176
177 /* Macros to map Winelib names to the correct implementation name */
178 /* depending on __WINESRC__ and UNICODE macros.                   */
179 /* Note that Winelib is purely Win32.                             */
180
181 #ifdef __WINESRC__
182 # define WINELIB_NAME_AW(func) \
183     func##_must_be_suffixed_with_W_or_A_in_this_context \
184     func##_must_be_suffixed_with_W_or_A_in_this_context
185 #else  /* __WINESRC__ */
186 # ifdef UNICODE
187 #  define WINELIB_NAME_AW(func) func##W
188 # else
189 #  define WINELIB_NAME_AW(func) func##A
190 # endif  /* UNICODE */
191 #endif  /* __WINESRC__ */
192
193 #ifdef __WINESRC__
194 # define DECL_WINELIB_TYPE_AW(type)  /* nothing */
195 #else   /* __WINESRC__ */
196 # define DECL_WINELIB_TYPE_AW(type)  typedef WINELIB_NAME_AW(type) type;
197 #endif  /* __WINESRC__ */
198
199
200 /* Polymorphic types */
201
202 typedef UINT_PTR        WPARAM;
203 typedef LONG_PTR        LPARAM;
204 typedef LONG_PTR        LRESULT;
205
206 /* Integer types */
207
208 typedef WORD            ATOM;
209 typedef WORD            CATCHBUF[9];
210 typedef WORD           *LPCATCHBUF;
211 typedef DWORD           COLORREF, *LPCOLORREF;
212
213
214 /* Handle types */
215
216 typedef int HFILE;
217 DECLARE_HANDLE(HACCEL);
218 DECLARE_HANDLE(HBITMAP);
219 DECLARE_HANDLE(HBRUSH);
220 DECLARE_HANDLE(HCOLORSPACE);
221 DECLARE_HANDLE(HDC);
222 DECLARE_HANDLE(HDESK);
223 DECLARE_HANDLE(HENHMETAFILE);
224 DECLARE_HANDLE(HFONT);
225 DECLARE_HANDLE(HHOOK);
226 DECLARE_HANDLE(HICON);
227 DECLARE_HANDLE(HINSTANCE);
228 DECLARE_HANDLE(HKEY);
229 typedef HKEY *PHKEY;
230 DECLARE_HANDLE(HKL);
231 DECLARE_HANDLE(HMENU);
232 DECLARE_HANDLE(HMETAFILE);
233 DECLARE_HANDLE(HMONITOR);
234 DECLARE_HANDLE(HPALETTE);
235 DECLARE_HANDLE(HPEN);
236 DECLARE_HANDLE(HRGN);
237 DECLARE_HANDLE(HRSRC);
238 DECLARE_HANDLE(HTASK);
239 DECLARE_HANDLE(HWINEVENTHOOK);
240 DECLARE_HANDLE(HWINSTA);
241 DECLARE_HANDLE(HWND);
242
243 /* Handle types that must remain interchangeable even with strict on */
244
245 typedef HINSTANCE HMODULE;
246 typedef HANDLE HGDIOBJ;
247 typedef HANDLE HGLOBAL;
248 typedef HANDLE HLOCAL;
249 typedef HANDLE GLOBALHANDLE;
250 typedef HANDLE LOCALHANDLE;
251 typedef HICON HCURSOR;
252
253 /* Callback function pointers types */
254
255 typedef INT     (CALLBACK *FARPROC)();
256 typedef INT     (CALLBACK *PROC)();
257
258
259 /* Macros to split words and longs. */
260
261 #define LOBYTE(w)              ((BYTE)(WORD)(w))
262 #define HIBYTE(w)              ((BYTE)((WORD)(w) >> 8))
263
264 #define LOWORD(l)              ((WORD)(DWORD)(l))
265 #define HIWORD(l)              ((WORD)((DWORD)(l) >> 16))
266
267 #define SLOWORD(l)             ((SHORT)(LONG)(l))
268 #define SHIWORD(l)             ((SHORT)((LONG)(l) >> 16))
269
270 #define MAKEWORD(low,high)     ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
271 #define MAKELONG(low,high)     ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
272 #define MAKELPARAM(low,high)   ((LPARAM)MAKELONG(low,high))
273 #define MAKEWPARAM(low,high)   ((WPARAM)MAKELONG(low,high))
274 #define MAKELRESULT(low,high)  ((LRESULT)MAKELONG(low,high))
275
276 #define SELECTOROF(ptr)     (HIWORD(ptr))
277 #define OFFSETOF(ptr)       (LOWORD(ptr))
278
279 /* min and max macros */
280 #ifndef NOMINMAX
281 #ifndef max
282 #define max(a,b)   (((a) > (b)) ? (a) : (b))
283 #endif
284 #ifndef min
285 #define min(a,b)   (((a) < (b)) ? (a) : (b))
286 #endif
287 #endif  /* NOMINMAX */
288
289 #ifdef MAX_PATH /* Work-around for Mingw */ 
290 #undef MAX_PATH
291 #endif /* MAX_PATH */
292
293 #define MAX_PATH        260
294 #define HFILE_ERROR     ((HFILE)-1)
295
296 /* The SIZE structure */
297 typedef struct tagSIZE
298 {
299     LONG cx;
300     LONG cy;
301 } SIZE, *PSIZE, *LPSIZE;
302
303 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
304
305 /* The POINT structure */
306 typedef struct tagPOINT
307 {
308     LONG  x;
309     LONG  y;
310 } POINT, *PPOINT, *LPPOINT;
311
312 typedef struct _POINTL
313 {
314     LONG x;
315     LONG y;
316 } POINTL;
317
318 /* The POINTS structure */
319
320 typedef struct tagPOINTS
321 {
322     SHORT x;
323     SHORT y;
324 } POINTS, *PPOINTS, *LPPOINTS;
325
326 /* The RECT structure */
327 typedef struct tagRECT
328 {
329     LONG left;
330     LONG top;
331     LONG right;
332     LONG bottom;
333 } RECT, *PRECT, *LPRECT;
334 typedef const RECT *LPCRECT;
335
336 typedef struct tagRECTL
337 {
338     LONG left;
339     LONG top;
340     LONG right;
341     LONG bottom;
342 } RECTL, *PRECTL, *LPRECTL;
343
344 typedef const RECTL *LPCRECTL;
345
346 #ifdef __cplusplus
347 }
348 #endif
349
350 #endif /* __WINE_WINDEF_H */