Use slighly more accurate formula for C816.
[wine/multimedia.git] / include / windef.h
blobe53d014ff7ba9d34e28de31fc946e910cf238e80
1 /*
2 * Basic types definitions
4 * Copyright 1996 Alexandre Julliard
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.
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.
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
21 #ifndef __WINE_WINDEF_H
22 #define __WINE_WINDEF_H
24 #ifdef __WINE__
25 # undef UNICODE
26 #endif /* __WINE__ */
28 #ifndef WINVER
29 #define WINVER 0x0500
30 #endif
32 #ifndef NO_STRICT
33 # ifndef STRICT
34 # define STRICT
35 # endif /* STRICT */
36 #endif /* NO_STRICT */
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
42 /* Calling conventions definitions */
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__ */
61 #ifndef __WINE__
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
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
107 #ifndef _declspec
108 #define _declspec(x)
109 #endif
110 #ifndef __declspec
111 #define __declspec(x)
112 #endif
114 #endif /* __WINE__ */
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
126 /* Misc. constants. */
128 #undef NULL
129 #ifdef __cplusplus
130 #define NULL 0
131 #else
132 #define NULL ((void*)0)
133 #endif
135 #ifdef FALSE
136 #undef FALSE
137 #endif
138 #define FALSE 0
140 #ifdef TRUE
141 #undef TRUE
142 #endif
143 #define TRUE 1
145 #ifndef IN
146 #define IN
147 #endif
149 #ifndef OUT
150 #define OUT
151 #endif
153 #ifndef OPTIONAL
154 #define OPTIONAL
155 #endif
157 /* Standard data types */
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;
175 #include "winnt.h"
177 /* Macros to map Winelib names to the correct implementation name */
178 /* depending on __WINE__ and UNICODE macros. */
179 /* Note that Winelib is purely Win32. */
181 #ifdef __WINE__
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 /* __WINE__ */
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 /* __WINE__ */
193 #ifdef __WINE__
194 # define DECL_WINELIB_TYPE_AW(type) /* nothing */
195 #else /* __WINE__ */
196 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type;
197 #endif /* __WINE__ */
200 /* Integer types */
201 typedef UINT WPARAM;
202 typedef LONG LPARAM;
203 typedef LONG LRESULT;
204 typedef WORD ATOM;
205 typedef WORD CATCHBUF[9];
206 typedef WORD *LPCATCHBUF;
207 typedef DWORD COLORREF, *LPCOLORREF;
210 /* Handle types */
212 typedef int HFILE;
213 DECLARE_HANDLE(HACCEL);
214 DECLARE_HANDLE(HBITMAP);
215 DECLARE_HANDLE(HBRUSH);
216 DECLARE_HANDLE(HCOLORSPACE);
217 DECLARE_HANDLE(HDC);
218 DECLARE_HANDLE(HDESK);
219 DECLARE_HANDLE(HENHMETAFILE);
220 DECLARE_HANDLE(HFONT);
221 DECLARE_HANDLE(HHOOK);
222 DECLARE_HANDLE(HICON);
223 DECLARE_HANDLE(HINSTANCE);
224 DECLARE_HANDLE(HKEY);
225 typedef HKEY *PHKEY;
226 DECLARE_HANDLE(HKL);
227 DECLARE_HANDLE(HMENU);
228 DECLARE_HANDLE(HMETAFILE);
229 DECLARE_HANDLE(HMONITOR);
230 DECLARE_HANDLE(HPALETTE);
231 DECLARE_HANDLE(HPEN);
232 DECLARE_HANDLE(HRGN);
233 DECLARE_HANDLE(HRSRC);
234 DECLARE_HANDLE(HTASK);
235 DECLARE_HANDLE(HWINEVENTHOOK);
236 DECLARE_HANDLE(HWINSTA);
237 DECLARE_HANDLE(HWND);
239 /* Handle types that must remain interchangeable even with strict on */
241 typedef HINSTANCE HMODULE;
242 typedef HANDLE HGDIOBJ;
243 typedef HANDLE HGLOBAL;
244 typedef HANDLE HLOCAL;
245 typedef HANDLE GLOBALHANDLE;
246 typedef HANDLE LOCALHANDLE;
247 typedef HICON HCURSOR;
249 /* Callback function pointers types */
251 typedef INT (CALLBACK *FARPROC)();
252 typedef INT (CALLBACK *PROC)();
255 /* Macros to split words and longs. */
257 #define LOBYTE(w) ((BYTE)(WORD)(w))
258 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8))
260 #define LOWORD(l) ((WORD)(DWORD)(l))
261 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16))
263 #define SLOWORD(l) ((SHORT)(LONG)(l))
264 #define SHIWORD(l) ((SHORT)((LONG)(l) >> 16))
266 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8))
267 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16)))
268 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high))
269 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high))
270 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high))
272 #define SELECTOROF(ptr) (HIWORD(ptr))
273 #define OFFSETOF(ptr) (LOWORD(ptr))
275 /* min and max macros */
276 #ifndef NOMINMAX
277 #ifndef max
278 #define max(a,b) (((a) > (b)) ? (a) : (b))
279 #endif
280 #ifndef min
281 #define min(a,b) (((a) < (b)) ? (a) : (b))
282 #endif
283 #endif /* NOMINMAX */
285 #ifdef MAX_PATH /* Work-around for Mingw */
286 #undef MAX_PATH
287 #endif /* MAX_PATH */
289 #define MAX_PATH 260
290 #define HFILE_ERROR ((HFILE)-1)
292 /* The SIZE structure */
293 typedef struct tagSIZE
295 LONG cx;
296 LONG cy;
297 } SIZE, *PSIZE, *LPSIZE;
299 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL;
301 /* The POINT structure */
302 typedef struct tagPOINT
304 LONG x;
305 LONG y;
306 } POINT, *PPOINT, *LPPOINT;
308 typedef struct _POINTL
310 LONG x;
311 LONG y;
312 } POINTL;
314 /* The POINTS structure */
316 typedef struct tagPOINTS
318 SHORT x;
319 SHORT y;
320 } POINTS, *PPOINTS, *LPPOINTS;
322 /* The RECT structure */
323 typedef struct tagRECT
325 INT left;
326 INT top;
327 INT right;
328 INT bottom;
329 } RECT, *PRECT, *LPRECT;
330 typedef const RECT *LPCRECT;
333 typedef struct tagRECTL
335 LONG left;
336 LONG top;
337 LONG right;
338 LONG bottom;
339 } RECTL, *PRECTL, *LPRECTL;
341 typedef const RECTL *LPCRECTL;
343 #ifdef __cplusplus
345 #endif
347 #endif /* __WINE_WINDEF_H */