Mercurial > mplayer.hg
annotate loader/wine/windef.h @ 14289:6b8a0b36799b
synced to 1.72, initial translation
author | gabrov |
---|---|
date | Sat, 01 Jan 2005 02:00:17 +0000 |
parents | 25cb0d6432d4 |
children | f5537cc95b02 |
rev | line source |
---|---|
1 | 1 /* |
2 * Basic types definitions | |
3 * | |
4 * Copyright 1996 Alexandre Julliard | |
5 */ | |
6 | |
7 #ifndef __WINE_WINDEF_H | |
8 #define __WINE_WINDEF_H | |
9 | |
10 #ifdef __WINE__ | |
11 # include "config.h" | |
12 # undef UNICODE | |
13 #endif | |
14 | |
15 #ifdef _EGCS_ | |
16 #define __stdcall | |
17 #endif | |
18 | |
19 #ifdef __cplusplus | |
20 extern "C" { | |
21 #endif | |
22 | |
23 /* Misc. constants. */ | |
24 | |
25 #ifdef FALSE | |
26 #undef FALSE | |
27 #endif | |
28 #define FALSE 0 | |
29 | |
30 #ifdef TRUE | |
31 #undef TRUE | |
32 #endif | |
33 #define TRUE 1 | |
34 | |
35 #ifdef NULL | |
36 #undef NULL | |
37 #endif | |
38 #define NULL 0 | |
39 | |
40 /* Macros to map Winelib names to the correct implementation name */ | |
41 /* depending on __WINE__ and UNICODE macros. */ | |
42 /* Note that Winelib is purely Win32. */ | |
43 | |
44 #ifdef __WINE__ | |
45 # define WINELIB_NAME_AW(func) \ | |
46 func##_must_be_suffixed_with_W_or_A_in_this_context \ | |
47 func##_must_be_suffixed_with_W_or_A_in_this_context | |
48 #else /* __WINE__ */ | |
49 # ifdef UNICODE | |
50 # define WINELIB_NAME_AW(func) func##W | |
51 # else | |
52 # define WINELIB_NAME_AW(func) func##A | |
53 # endif /* UNICODE */ | |
54 #endif /* __WINE__ */ | |
55 | |
56 #ifdef __WINE__ | |
57 # define DECL_WINELIB_TYPE_AW(type) /* nothing */ | |
58 #else /* __WINE__ */ | |
59 # define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; | |
60 #endif /* __WINE__ */ | |
61 | |
62 #ifndef NONAMELESSSTRUCT | |
63 # if defined(__WINE__) || !defined(_FORCENAMELESSSTRUCT) | |
64 # define NONAMELESSSTRUCT | |
65 # endif | |
66 #endif /* !defined(NONAMELESSSTRUCT) */ | |
67 | |
68 #ifndef NONAMELESSUNION | |
69 # if defined(__WINE__) || !defined(_FORCENAMELESSUNION) || !defined(__cplusplus) | |
70 # define NONAMELESSUNION | |
71 # endif | |
72 #endif /* !defined(NONAMELESSUNION) */ | |
73 | |
74 #ifndef NONAMELESSSTRUCT | |
75 #define DUMMYSTRUCTNAME | |
76 #define DUMMYSTRUCTNAME1 | |
77 #define DUMMYSTRUCTNAME2 | |
78 #define DUMMYSTRUCTNAME3 | |
79 #define DUMMYSTRUCTNAME4 | |
80 #define DUMMYSTRUCTNAME5 | |
81 #else /* !defined(NONAMELESSSTRUCT) */ | |
82 #define DUMMYSTRUCTNAME s | |
83 #define DUMMYSTRUCTNAME1 s1 | |
84 #define DUMMYSTRUCTNAME2 s2 | |
85 #define DUMMYSTRUCTNAME3 s3 | |
86 #define DUMMYSTRUCTNAME4 s4 | |
87 #define DUMMYSTRUCTNAME5 s5 | |
88 #endif /* !defined(NONAMELESSSTRUCT) */ | |
89 | |
90 #ifndef NONAMELESSUNION | |
91 #define DUMMYUNIONNAME | |
92 #define DUMMYUNIONNAME1 | |
93 #define DUMMYUNIONNAME2 | |
94 #define DUMMYUNIONNAME3 | |
95 #define DUMMYUNIONNAME4 | |
96 #define DUMMYUNIONNAME5 | |
97 #else /* !defined(NONAMELESSUNION) */ | |
98 #define DUMMYUNIONNAME u | |
99 #define DUMMYUNIONNAME1 u1 | |
100 #define DUMMYUNIONNAME2 u2 | |
101 #define DUMMYUNIONNAME3 u3 | |
102 #define DUMMYUNIONNAME4 u4 | |
103 #define DUMMYUNIONNAME5 u5 | |
104 #endif /* !defined(NONAMELESSUNION) */ | |
105 | |
106 /* Calling conventions definitions */ | |
107 | |
108 #ifdef __i386__ | |
109 # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7))) | |
110 # ifndef _EGCS_ | |
111 #define __stdcall __attribute__((__stdcall__)) | |
112 #define __cdecl __attribute__((__cdecl__)) | |
113 # define __RESTORE_ES __asm__ __volatile__("pushl %ds\n\tpopl %es") | |
114 # endif | |
115 # else | |
186 | 116 // # error You need gcc >= 2.7 to build Wine on a 386 |
1 | 117 # endif |
118 #else | |
119 # define __stdcall | |
120 # define __cdecl | |
121 # define __RESTORE_ES | |
122 #endif | |
123 | |
124 #define CALLBACK __stdcall | |
125 #define WINAPI __stdcall | |
126 #define APIPRIVATE __stdcall | |
127 #define PASCAL __stdcall | |
128 #define pascal __stdcall | |
129 #define _pascal __stdcall | |
9978 | 130 #if !defined(__CYGWIN__) && !defined(__MINGW32__) |
1 | 131 #define _stdcall __stdcall |
132 #define _fastcall __stdcall | |
133 #define __fastcall __stdcall | |
7182
0bfd137f492a
fix some warnings on cygwin, patch by Sylvain Petreolle <spetreolle@yahoo.fr>
atmos4
parents:
6302
diff
changeset
|
134 #endif |
1 | 135 #define __export __stdcall |
136 #define CDECL __cdecl | |
137 #define _CDECL __cdecl | |
138 #define cdecl __cdecl | |
9978 | 139 #if !defined(__CYGWIN__) && !defined(__MINGW32__) |
1 | 140 #define _cdecl __cdecl |
6302
aa9aca7772de
cygwin & darwin fixes by Joey Parrish <joey@yunamusic.com>
arpi
parents:
3548
diff
changeset
|
141 #endif |
1 | 142 #define WINAPIV __cdecl |
143 #define APIENTRY WINAPI | |
144 | |
9978 | 145 #if !defined(__CYGWIN__) && !defined(__MINGW32__) |
1 | 146 #define __declspec(x) |
6302
aa9aca7772de
cygwin & darwin fixes by Joey Parrish <joey@yunamusic.com>
arpi
parents:
3548
diff
changeset
|
147 #endif |
1 | 148 #define dllimport |
149 #define dllexport | |
150 | |
151 #define CONST const | |
152 | |
153 /* Standard data types. These are the same for emulator and library. */ | |
154 | |
155 typedef void VOID; | |
156 typedef int INT; | |
157 typedef unsigned int UINT; | |
158 typedef unsigned short WORD; | |
13182 | 159 typedef unsigned long DWORD; |
160 typedef unsigned long ULONG; | |
1 | 161 typedef unsigned char BYTE; |
162 typedef long LONG; | |
163 typedef short SHORT; | |
164 typedef unsigned short USHORT; | |
165 typedef char CHAR; | |
166 typedef unsigned char UCHAR; | |
167 | |
168 typedef LONG SCODE; | |
169 | |
170 /* Some systems might have wchar_t, but we really need 16 bit characters */ | |
171 typedef unsigned short WCHAR; | |
172 typedef int WIN_BOOL; | |
173 typedef double DATE; | |
174 typedef double DOUBLE; | |
128 | 175 typedef long long LONGLONG; |
176 typedef unsigned long long ULONGLONG; | |
1 | 177 |
178 /* FIXME: Wine does not compile with strict on, therefore strict | |
179 * handles are presently only usable on machines where sizeof(UINT) == | |
180 * sizeof(void*). HANDLEs are supposed to be void* but a large amount | |
181 * of WINE code operates on HANDLES as if they are UINTs. So to WINE | |
182 * they exist as UINTs but to the Winelib user who turns on strict, | |
183 * they exist as void*. If there is a size difference between UINT and | |
184 * void* then things get ugly. */ | |
185 #ifdef STRICT | |
186 typedef VOID* HANDLE; | |
187 #else | |
188 typedef UINT HANDLE; | |
189 #endif | |
190 | |
191 | |
192 typedef HANDLE *LPHANDLE; | |
193 | |
194 /* Integer types. These are the same for emulator and library. */ | |
195 typedef UINT WPARAM; | |
196 typedef LONG LPARAM; | |
197 typedef LONG HRESULT; | |
198 typedef LONG LRESULT; | |
199 typedef WORD ATOM; | |
200 typedef WORD CATCHBUF[9]; | |
201 typedef WORD *LPCATCHBUF; | |
202 typedef HANDLE HHOOK; | |
203 typedef HANDLE HMONITOR; | |
204 typedef DWORD LCID; | |
205 typedef WORD LANGID; | |
206 typedef DWORD LCTYPE; | |
207 typedef float FLOAT; | |
208 | |
209 /* Pointers types. These are the same for emulator and library. */ | |
210 /* winnt types */ | |
211 typedef VOID *PVOID; | |
212 typedef const void *PCVOID; | |
213 typedef CHAR *PCHAR; | |
214 typedef UCHAR *PUCHAR; | |
215 typedef BYTE *PBYTE; | |
216 typedef WORD *PWORD; | |
217 typedef USHORT *PUSHORT; | |
218 typedef SHORT *PSHORT; | |
219 typedef ULONG *PULONG; | |
220 typedef LONG *PLONG; | |
221 typedef DWORD *PDWORD; | |
222 /* common win32 types */ | |
223 typedef CHAR *LPSTR; | |
224 typedef CHAR *PSTR; | |
225 typedef const CHAR *LPCSTR; | |
226 typedef const CHAR *PCSTR; | |
227 typedef WCHAR *LPWSTR; | |
228 typedef WCHAR *PWSTR; | |
229 typedef const WCHAR *LPCWSTR; | |
230 typedef const WCHAR *PCWSTR; | |
231 typedef BYTE *LPBYTE; | |
232 typedef WORD *LPWORD; | |
233 typedef DWORD *LPDWORD; | |
234 typedef LONG *LPLONG; | |
235 typedef VOID *LPVOID; | |
236 typedef const VOID *LPCVOID; | |
237 typedef INT *PINT; | |
238 typedef INT *LPINT; | |
239 typedef UINT *PUINT; | |
240 typedef UINT *LPUINT; | |
241 typedef FLOAT *PFLOAT; | |
242 typedef FLOAT *LPFLOAT; | |
243 typedef WIN_BOOL *PWIN_BOOL; | |
244 typedef WIN_BOOL *LPWIN_BOOL; | |
245 | |
246 /* Special case: a segmented pointer is just a pointer in the user's code. */ | |
247 | |
248 #ifdef __WINE__ | |
249 typedef DWORD SEGPTR; | |
250 #else | |
251 typedef void* SEGPTR; | |
252 #endif /* __WINE__ */ | |
253 | |
254 /* Handle types that exist both in Win16 and Win32. */ | |
255 | |
256 #ifdef STRICT | |
257 #define DECLARE_HANDLE(a) \ | |
258 typedef struct a##__ { int unused; } *a; \ | |
259 typedef a *P##a; \ | |
260 typedef a *LP##a | |
261 #else /*STRICT*/ | |
262 #define DECLARE_HANDLE(a) \ | |
263 typedef HANDLE a; \ | |
264 typedef a *P##a; \ | |
265 typedef a *LP##a | |
266 #endif /*STRICT*/ | |
267 | |
268 DECLARE_HANDLE(HACMDRIVERID); | |
269 DECLARE_HANDLE(HACMDRIVER); | |
270 DECLARE_HANDLE(HACMOBJ); | |
271 DECLARE_HANDLE(HACMSTREAM); | |
272 DECLARE_HANDLE(HMETAFILEPICT); | |
273 | |
274 DECLARE_HANDLE(HACCEL); | |
275 DECLARE_HANDLE(HBITMAP); | |
276 DECLARE_HANDLE(HBRUSH); | |
277 DECLARE_HANDLE(HCOLORSPACE); | |
278 DECLARE_HANDLE(HCURSOR); | |
279 DECLARE_HANDLE(HDC); | |
280 DECLARE_HANDLE(HDROP); | |
281 DECLARE_HANDLE(HDRVR); | |
282 DECLARE_HANDLE(HDWP); | |
283 DECLARE_HANDLE(HENHMETAFILE); | |
284 DECLARE_HANDLE(HFILE); | |
285 DECLARE_HANDLE(HFONT); | |
286 DECLARE_HANDLE(HICON); | |
287 DECLARE_HANDLE(HINSTANCE); | |
288 DECLARE_HANDLE(HKEY); | |
289 DECLARE_HANDLE(HMENU); | |
290 DECLARE_HANDLE(HMETAFILE); | |
291 DECLARE_HANDLE(HMIDI); | |
292 DECLARE_HANDLE(HMIDIIN); | |
293 DECLARE_HANDLE(HMIDIOUT); | |
294 DECLARE_HANDLE(HMIDISTRM); | |
295 DECLARE_HANDLE(HMIXER); | |
296 DECLARE_HANDLE(HMIXEROBJ); | |
297 DECLARE_HANDLE(HMMIO); | |
298 DECLARE_HANDLE(HPALETTE); | |
299 DECLARE_HANDLE(HPEN); | |
300 DECLARE_HANDLE(HQUEUE); | |
301 DECLARE_HANDLE(HRGN); | |
302 DECLARE_HANDLE(HRSRC); | |
303 DECLARE_HANDLE(HTASK); | |
304 DECLARE_HANDLE(HWAVE); | |
305 DECLARE_HANDLE(HWAVEIN); | |
306 DECLARE_HANDLE(HWAVEOUT); | |
307 DECLARE_HANDLE(HWINSTA); | |
308 DECLARE_HANDLE(HDESK); | |
309 DECLARE_HANDLE(HWND); | |
310 DECLARE_HANDLE(HKL); | |
311 DECLARE_HANDLE(HIC); | |
312 DECLARE_HANDLE(HRASCONN); | |
313 | |
314 /* Handle types that must remain interchangeable even with strict on */ | |
315 | |
316 typedef HINSTANCE HMODULE; | |
317 typedef HANDLE HGDIOBJ; | |
318 typedef HANDLE HGLOBAL; | |
319 typedef HANDLE HLOCAL; | |
320 typedef HANDLE GLOBALHANDLE; | |
321 typedef HANDLE LOCALHANDLE; | |
322 | |
323 /* Callback function pointers types */ | |
324 //WIN_BOOL CALLBACK DATEFMT_ENUMPROCA(LPSTR); | |
325 | |
326 typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCA)(LPSTR); | |
327 typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCW)(LPWSTR); | |
328 DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC) | |
329 typedef WIN_BOOL CALLBACK (*DLGPROC)(HWND,UINT,WPARAM,LPARAM); | |
330 typedef LRESULT CALLBACK (*DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM); | |
331 typedef INT CALLBACK (*EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT); | |
332 typedef INT CALLBACK (*EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT); | |
333 DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC) | |
334 typedef LRESULT CALLBACK (*FARPROC)(); | |
335 typedef INT CALLBACK (*PROC)(); | |
336 typedef WIN_BOOL CALLBACK (*GRAYSTRINGPROC)(HDC,LPARAM,INT); | |
337 typedef LRESULT CALLBACK (*HOOKPROC)(INT,WPARAM,LPARAM); | |
338 typedef WIN_BOOL CALLBACK (*PROPENUMPROCA)(HWND,LPCSTR,HANDLE); | |
339 typedef WIN_BOOL CALLBACK (*PROPENUMPROCW)(HWND,LPCWSTR,HANDLE); | |
340 DECL_WINELIB_TYPE_AW(PROPENUMPROC) | |
341 typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM); | |
342 typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM); | |
343 DECL_WINELIB_TYPE_AW(PROPENUMPROCEX) | |
344 typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCA)(LPSTR); | |
345 typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCW)(LPWSTR); | |
346 DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC) | |
347 typedef VOID CALLBACK (*TIMERPROC)(HWND,UINT,UINT,DWORD); | |
348 typedef WIN_BOOL CALLBACK (*WNDENUMPROC)(HWND,LPARAM); | |
349 typedef LRESULT CALLBACK (*WNDPROC)(HWND,UINT,WPARAM,LPARAM); | |
350 | |
351 /*---------------------------------------------------------------------------- | |
352 ** FIXME: Better isolate Wine's reliance on the xxx16 type definitions. | |
353 ** For now, we just isolate them to make the situation clear. | |
354 **--------------------------------------------------------------------------*/ | |
355 /* | |
356 * Basic type definitions for 16 bit variations on Windows types. | |
357 * These types are provided mostly to insure compatibility with | |
358 * 16 bit windows code. | |
359 */ | |
360 | |
361 #ifndef __WINE_WINDEF16_H | |
362 #define __WINE_WINDEF16_H | |
363 | |
364 #include "windef.h" | |
365 | |
366 /* Standard data types */ | |
367 | |
368 typedef short INT16; | |
369 typedef unsigned short UINT16; | |
370 typedef unsigned short WIN_BOOL16; | |
371 | |
372 typedef UINT16 HANDLE16; | |
373 typedef HANDLE16 *LPHANDLE16; | |
374 | |
375 typedef UINT16 WPARAM16; | |
376 typedef INT16 *LPINT16; | |
377 typedef UINT16 *LPUINT16; | |
378 | |
379 #define DECLARE_HANDLE16(a) \ | |
380 typedef HANDLE16 a##16; \ | |
381 typedef a##16 *P##a##16; \ | |
382 typedef a##16 *NP##a##16; \ | |
383 typedef a##16 *LP##a##16 | |
384 | |
385 DECLARE_HANDLE16(HACMDRIVERID); | |
386 DECLARE_HANDLE16(HACMDRIVER); | |
387 DECLARE_HANDLE16(HACMOBJ); | |
388 DECLARE_HANDLE16(HACMSTREAM); | |
389 DECLARE_HANDLE16(HMETAFILEPICT); | |
390 | |
391 DECLARE_HANDLE16(HACCEL); | |
392 DECLARE_HANDLE16(HBITMAP); | |
393 DECLARE_HANDLE16(HBRUSH); | |
394 DECLARE_HANDLE16(HCOLORSPACE); | |
395 DECLARE_HANDLE16(HCURSOR); | |
396 DECLARE_HANDLE16(HDC); | |
397 DECLARE_HANDLE16(HDROP); | |
398 DECLARE_HANDLE16(HDRVR); | |
399 DECLARE_HANDLE16(HDWP); | |
400 DECLARE_HANDLE16(HENHMETAFILE); | |
401 DECLARE_HANDLE16(HFILE); | |
402 DECLARE_HANDLE16(HFONT); | |
403 DECLARE_HANDLE16(HICON); | |
404 DECLARE_HANDLE16(HINSTANCE); | |
405 DECLARE_HANDLE16(HKEY); | |
406 DECLARE_HANDLE16(HMENU); | |
407 DECLARE_HANDLE16(HMETAFILE); | |
408 DECLARE_HANDLE16(HMIDI); | |
409 DECLARE_HANDLE16(HMIDIIN); | |
410 DECLARE_HANDLE16(HMIDIOUT); | |
411 DECLARE_HANDLE16(HMIDISTRM); | |
412 DECLARE_HANDLE16(HMIXER); | |
413 DECLARE_HANDLE16(HMIXEROBJ); | |
414 DECLARE_HANDLE16(HMMIO); | |
415 DECLARE_HANDLE16(HPALETTE); | |
416 DECLARE_HANDLE16(HPEN); | |
417 DECLARE_HANDLE16(HQUEUE); | |
418 DECLARE_HANDLE16(HRGN); | |
419 DECLARE_HANDLE16(HRSRC); | |
420 DECLARE_HANDLE16(HTASK); | |
421 DECLARE_HANDLE16(HWAVE); | |
422 DECLARE_HANDLE16(HWAVEIN); | |
423 DECLARE_HANDLE16(HWAVEOUT); | |
424 DECLARE_HANDLE16(HWINSTA); | |
425 DECLARE_HANDLE16(HDESK); | |
426 DECLARE_HANDLE16(HWND); | |
427 DECLARE_HANDLE16(HKL); | |
428 DECLARE_HANDLE16(HIC); | |
429 DECLARE_HANDLE16(HRASCONN); | |
430 #undef DECLARE_HANDLE16 | |
431 | |
432 typedef HINSTANCE16 HMODULE16; | |
433 typedef HANDLE16 HGDIOBJ16; | |
434 typedef HANDLE16 HGLOBAL16; | |
435 typedef HANDLE16 HLOCAL16; | |
436 | |
437 /* The SIZE structure */ | |
438 typedef struct | |
439 { | |
440 INT16 cx; | |
441 INT16 cy; | |
442 } SIZE16, *PSIZE16, *LPSIZE16; | |
443 | |
444 /* The POINT structure */ | |
445 | |
446 typedef struct | |
447 { | |
448 INT16 x; | |
449 INT16 y; | |
450 } POINT16, *PPOINT16, *LPPOINT16; | |
451 | |
452 /* The RECT structure */ | |
453 | |
454 typedef struct | |
455 { | |
456 INT16 left; | |
457 INT16 top; | |
458 INT16 right; | |
459 INT16 bottom; | |
460 } RECT16, *LPRECT16; | |
461 | |
462 /* Callback function pointers types */ | |
463 | |
464 typedef LRESULT CALLBACK (*DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM); | |
465 typedef WIN_BOOL16 CALLBACK (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM); | |
466 typedef INT16 CALLBACK (*EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16); | |
467 typedef LRESULT CALLBACK (*FARPROC16)(); | |
468 typedef INT16 CALLBACK (*PROC16)(); | |
469 typedef WIN_BOOL16 CALLBACK (*GRAYSTRINGPROC16)(HDC16,LPARAM,INT16); | |
470 typedef LRESULT CALLBACK (*HOOKPROC16)(INT16,WPARAM16,LPARAM); | |
471 typedef WIN_BOOL16 CALLBACK (*PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16); | |
472 typedef VOID CALLBACK (*TIMERPROC16)(HWND16,UINT16,UINT16,DWORD); | |
473 typedef LRESULT CALLBACK (*WNDENUMPROC16)(HWND16,LPARAM); | |
474 typedef LRESULT CALLBACK (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM); | |
475 | |
476 #endif /* __WINE_WINDEF16_H */ | |
477 | |
478 /* Define some empty macros for compatibility with Windows code. */ | |
479 | |
480 #ifndef __WINE__ | |
481 #define NEAR | |
482 #define FAR | |
483 #define near | |
484 #define far | |
485 #define _near | |
486 #define _far | |
487 #define IN | |
488 #define OUT | |
489 #define OPTIONAL | |
490 #endif /* __WINE__ */ | |
491 | |
492 /* Macro for structure packing. */ | |
493 | |
494 #ifdef __GNUC__ | |
495 #ifndef _EGCS_ | |
496 #define WINE_PACKED __attribute__((packed)) | |
497 #define WINE_UNUSED __attribute__((unused)) | |
498 #define WINE_NORETURN __attribute__((noreturn)) | |
499 #endif | |
500 #else | |
501 #define WINE_PACKED /* nothing */ | |
502 #define WINE_UNUSED /* nothing */ | |
503 #define WINE_NORETURN /* nothing */ | |
504 #endif | |
505 | |
506 /* Macros to split words and longs. */ | |
507 | |
508 #define LOBYTE(w) ((BYTE)(WORD)(w)) | |
509 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8)) | |
510 | |
511 #define LOWORD(l) ((WORD)(DWORD)(l)) | |
512 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) | |
513 | |
514 #define SLOWORD(l) ((INT16)(LONG)(l)) | |
515 #define SHIWORD(l) ((INT16)((LONG)(l) >> 16)) | |
516 | |
517 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8)) | |
518 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16))) | |
519 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high)) | |
520 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high)) | |
521 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high)) | |
522 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0)) | |
523 | |
524 #define SELECTOROF(ptr) (HIWORD(ptr)) | |
525 #define OFFSETOF(ptr) (LOWORD(ptr)) | |
526 | |
527 #ifdef __WINE__ | |
528 /* macros to set parts of a DWORD (not in the Windows API) */ | |
529 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val)) | |
530 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val)) | |
531 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOWORD(val) & 0xff00)) | |
532 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val))) | |
533 #endif | |
534 | |
535 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */ | |
536 /* Note: These macros are semantically broken, at least for wrc. wrc | |
537 spits out data in the platform's current binary format, *not* in | |
538 little-endian format. These macros are used throughout the resource | |
539 code to load and store data to the resources. Since it is unlikely | |
540 that we'll ever be dealing with little-endian resource data, the | |
541 byte-swapping nature of these macros has been disabled. Rather than | |
542 remove the use of these macros from the resource loading code, the | |
543 macros have simply been disabled. In the future, someone may want | |
544 to reactivate these macros for other purposes. In that case, the | |
545 resource code will have to be modified to use different macros. */ | |
546 | |
547 #if 1 | |
548 #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w)) | |
549 #define GET_WORD(ptr) (*(WORD *)(ptr)) | |
550 #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw)) | |
551 #define GET_DWORD(ptr) (*(DWORD *)(ptr)) | |
552 #else | |
553 #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \ | |
554 *((BYTE *)(ptr) + 1) = HIBYTE(w)) | |
555 #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \ | |
556 (WORD)(*((BYTE *)(ptr)+1) << 8))) | |
557 #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \ | |
558 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw))) | |
559 #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \ | |
560 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16))) | |
561 #endif /* 1 */ | |
562 | |
563 /* min and max macros */ | |
564 #define __max(a,b) (((a) > (b)) ? (a) : (b)) | |
565 #define __min(a,b) (((a) < (b)) ? (a) : (b)) | |
566 #ifndef max | |
567 #define max(a,b) (((a) > (b)) ? (a) : (b)) | |
568 #endif | |
569 #ifndef min | |
570 #define min(a,b) (((a) < (b)) ? (a) : (b)) | |
571 #endif | |
572 | |
9978 | 573 #ifndef _MAX_PATH |
1 | 574 #define _MAX_PATH 260 |
9978 | 575 #endif |
576 #ifndef MAX_PATH | |
1 | 577 #define MAX_PATH 260 |
9978 | 578 #endif |
579 #ifndef _MAX_DRIVE | |
1 | 580 #define _MAX_DRIVE 3 |
9978 | 581 #endif |
582 #ifndef _MAX_DIR | |
1 | 583 #define _MAX_DIR 256 |
9978 | 584 #endif |
585 #ifndef _MAX_FNAME | |
1 | 586 #define _MAX_FNAME 255 |
9978 | 587 #endif |
588 #ifndef _MAX_EXT | |
1 | 589 #define _MAX_EXT 256 |
9978 | 590 #endif |
1 | 591 |
592 #define HFILE_ERROR16 ((HFILE16)-1) | |
593 #define HFILE_ERROR ((HFILE)-1) | |
594 | |
595 /* The SIZE structure */ | |
596 typedef struct tagSIZE | |
597 { | |
598 INT cx; | |
599 INT cy; | |
600 } SIZE, *PSIZE, *LPSIZE; | |
601 | |
602 | |
603 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL; | |
604 | |
605 #define CONV_SIZE16TO32(s16,s32) \ | |
606 ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy) | |
607 #define CONV_SIZE32TO16(s32,s16) \ | |
608 ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy) | |
609 | |
610 /* The POINT structure */ | |
611 typedef struct tagPOINT | |
612 { | |
613 LONG x; | |
614 LONG y; | |
615 } POINT, *PPOINT, *LPPOINT; | |
616 | |
617 typedef struct _POINTL | |
618 { | |
619 LONG x; | |
620 LONG y; | |
621 } POINTL; | |
622 | |
623 #define CONV_POINT16TO32(p16,p32) \ | |
624 ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y) | |
625 #define CONV_POINT32TO16(p32,p16) \ | |
626 ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y) | |
627 | |
628 #define MAKEPOINT16(l) (*((POINT16 *)&(l))) | |
629 | |
630 /* The POINTS structure */ | |
631 | |
632 typedef struct tagPOINTS | |
633 { | |
634 SHORT x; | |
635 SHORT y; | |
636 } POINTS, *PPOINTS, *LPPOINTS; | |
637 | |
638 | |
639 #define MAKEPOINTS(l) (*((POINTS *)&(l))) | |
640 | |
641 | |
642 /* The RECT structure */ | |
643 typedef struct tagRECT | |
644 { | |
645 short left; | |
646 short top; | |
647 short right; | |
648 short bottom; | |
649 } RECT, *PRECT, *LPRECT; | |
650 typedef const RECT *LPCRECT; | |
651 | |
652 | |
653 typedef struct tagRECTL | |
654 { | |
655 LONG left; | |
656 LONG top; | |
657 LONG right; | |
658 LONG bottom; | |
659 } RECTL, *PRECTL, *LPRECTL; | |
660 | |
661 typedef const RECTL *LPCRECTL; | |
662 | |
663 #define CONV_RECT16TO32(r16,r32) \ | |
664 ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \ | |
665 (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom) | |
666 #define CONV_RECT32TO16(r32,r16) \ | |
667 ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \ | |
668 (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom) | |
669 | |
670 #ifdef __cplusplus | |
671 } | |
672 #endif | |
673 | |
674 #endif /* __WINE_WINDEF_H */ |