Mercurial > mplayer.hg
annotate loader/wine/windef.h @ 5914:808e7bda84fc
some vfw codecs supports I420 and YV12 too
author | alex |
---|---|
date | Tue, 30 Apr 2002 14:37:41 +0000 |
parents | 0dc1c224724d |
children | aa9aca7772de |
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 | |
130 #define _stdcall __stdcall | |
131 #define _fastcall __stdcall | |
132 #define __fastcall __stdcall | |
133 #define __export __stdcall | |
134 #define CDECL __cdecl | |
135 #define _CDECL __cdecl | |
136 #define cdecl __cdecl | |
137 #define _cdecl __cdecl | |
138 #define WINAPIV __cdecl | |
139 #define APIENTRY WINAPI | |
140 | |
141 #define __declspec(x) | |
142 #define dllimport | |
143 #define dllexport | |
144 | |
145 #define CONST const | |
146 | |
147 /* Standard data types. These are the same for emulator and library. */ | |
148 | |
149 typedef void VOID; | |
150 typedef int INT; | |
151 typedef unsigned int UINT; | |
152 typedef unsigned short WORD; | |
3536
633a8d6e40dc
workaround for Alpha - by Falk Hueffner <falk.hueffner@student.uni-tuebingen.de>
arpi
parents:
186
diff
changeset
|
153 typedef unsigned int DWORD; |
3548 | 154 typedef unsigned int ULONG; |
1 | 155 typedef unsigned char BYTE; |
156 typedef long LONG; | |
157 typedef short SHORT; | |
158 typedef unsigned short USHORT; | |
159 typedef char CHAR; | |
160 typedef unsigned char UCHAR; | |
161 | |
162 typedef LONG SCODE; | |
163 | |
164 /* Some systems might have wchar_t, but we really need 16 bit characters */ | |
165 typedef unsigned short WCHAR; | |
166 typedef int WIN_BOOL; | |
167 typedef double DATE; | |
168 typedef double DOUBLE; | |
128 | 169 typedef long long LONGLONG; |
170 typedef unsigned long long ULONGLONG; | |
1 | 171 |
172 /* FIXME: Wine does not compile with strict on, therefore strict | |
173 * handles are presently only usable on machines where sizeof(UINT) == | |
174 * sizeof(void*). HANDLEs are supposed to be void* but a large amount | |
175 * of WINE code operates on HANDLES as if they are UINTs. So to WINE | |
176 * they exist as UINTs but to the Winelib user who turns on strict, | |
177 * they exist as void*. If there is a size difference between UINT and | |
178 * void* then things get ugly. */ | |
179 #ifdef STRICT | |
180 typedef VOID* HANDLE; | |
181 #else | |
182 typedef UINT HANDLE; | |
183 #endif | |
184 | |
185 | |
186 typedef HANDLE *LPHANDLE; | |
187 | |
188 /* Integer types. These are the same for emulator and library. */ | |
189 typedef UINT WPARAM; | |
190 typedef LONG LPARAM; | |
191 typedef LONG HRESULT; | |
192 typedef LONG LRESULT; | |
193 typedef WORD ATOM; | |
194 typedef WORD CATCHBUF[9]; | |
195 typedef WORD *LPCATCHBUF; | |
196 typedef HANDLE HHOOK; | |
197 typedef HANDLE HMONITOR; | |
198 typedef DWORD LCID; | |
199 typedef WORD LANGID; | |
200 typedef DWORD LCTYPE; | |
201 typedef float FLOAT; | |
202 | |
203 /* Pointers types. These are the same for emulator and library. */ | |
204 /* winnt types */ | |
205 typedef VOID *PVOID; | |
206 typedef const void *PCVOID; | |
207 typedef CHAR *PCHAR; | |
208 typedef UCHAR *PUCHAR; | |
209 typedef BYTE *PBYTE; | |
210 typedef WORD *PWORD; | |
211 typedef USHORT *PUSHORT; | |
212 typedef SHORT *PSHORT; | |
213 typedef ULONG *PULONG; | |
214 typedef LONG *PLONG; | |
215 typedef DWORD *PDWORD; | |
216 /* common win32 types */ | |
217 typedef CHAR *LPSTR; | |
218 typedef CHAR *PSTR; | |
219 typedef const CHAR *LPCSTR; | |
220 typedef const CHAR *PCSTR; | |
221 typedef WCHAR *LPWSTR; | |
222 typedef WCHAR *PWSTR; | |
223 typedef const WCHAR *LPCWSTR; | |
224 typedef const WCHAR *PCWSTR; | |
225 typedef BYTE *LPBYTE; | |
226 typedef WORD *LPWORD; | |
227 typedef DWORD *LPDWORD; | |
228 typedef LONG *LPLONG; | |
229 typedef VOID *LPVOID; | |
230 typedef const VOID *LPCVOID; | |
231 typedef INT *PINT; | |
232 typedef INT *LPINT; | |
233 typedef UINT *PUINT; | |
234 typedef UINT *LPUINT; | |
235 typedef FLOAT *PFLOAT; | |
236 typedef FLOAT *LPFLOAT; | |
237 typedef WIN_BOOL *PWIN_BOOL; | |
238 typedef WIN_BOOL *LPWIN_BOOL; | |
239 | |
240 /* Special case: a segmented pointer is just a pointer in the user's code. */ | |
241 | |
242 #ifdef __WINE__ | |
243 typedef DWORD SEGPTR; | |
244 #else | |
245 typedef void* SEGPTR; | |
246 #endif /* __WINE__ */ | |
247 | |
248 /* Handle types that exist both in Win16 and Win32. */ | |
249 | |
250 #ifdef STRICT | |
251 #define DECLARE_HANDLE(a) \ | |
252 typedef struct a##__ { int unused; } *a; \ | |
253 typedef a *P##a; \ | |
254 typedef a *LP##a | |
255 #else /*STRICT*/ | |
256 #define DECLARE_HANDLE(a) \ | |
257 typedef HANDLE a; \ | |
258 typedef a *P##a; \ | |
259 typedef a *LP##a | |
260 #endif /*STRICT*/ | |
261 | |
262 DECLARE_HANDLE(HACMDRIVERID); | |
263 DECLARE_HANDLE(HACMDRIVER); | |
264 DECLARE_HANDLE(HACMOBJ); | |
265 DECLARE_HANDLE(HACMSTREAM); | |
266 DECLARE_HANDLE(HMETAFILEPICT); | |
267 | |
268 DECLARE_HANDLE(HACCEL); | |
269 DECLARE_HANDLE(HBITMAP); | |
270 DECLARE_HANDLE(HBRUSH); | |
271 DECLARE_HANDLE(HCOLORSPACE); | |
272 DECLARE_HANDLE(HCURSOR); | |
273 DECLARE_HANDLE(HDC); | |
274 DECLARE_HANDLE(HDROP); | |
275 DECLARE_HANDLE(HDRVR); | |
276 DECLARE_HANDLE(HDWP); | |
277 DECLARE_HANDLE(HENHMETAFILE); | |
278 DECLARE_HANDLE(HFILE); | |
279 DECLARE_HANDLE(HFONT); | |
280 DECLARE_HANDLE(HICON); | |
281 DECLARE_HANDLE(HINSTANCE); | |
282 DECLARE_HANDLE(HKEY); | |
283 DECLARE_HANDLE(HMENU); | |
284 DECLARE_HANDLE(HMETAFILE); | |
285 DECLARE_HANDLE(HMIDI); | |
286 DECLARE_HANDLE(HMIDIIN); | |
287 DECLARE_HANDLE(HMIDIOUT); | |
288 DECLARE_HANDLE(HMIDISTRM); | |
289 DECLARE_HANDLE(HMIXER); | |
290 DECLARE_HANDLE(HMIXEROBJ); | |
291 DECLARE_HANDLE(HMMIO); | |
292 DECLARE_HANDLE(HPALETTE); | |
293 DECLARE_HANDLE(HPEN); | |
294 DECLARE_HANDLE(HQUEUE); | |
295 DECLARE_HANDLE(HRGN); | |
296 DECLARE_HANDLE(HRSRC); | |
297 DECLARE_HANDLE(HTASK); | |
298 DECLARE_HANDLE(HWAVE); | |
299 DECLARE_HANDLE(HWAVEIN); | |
300 DECLARE_HANDLE(HWAVEOUT); | |
301 DECLARE_HANDLE(HWINSTA); | |
302 DECLARE_HANDLE(HDESK); | |
303 DECLARE_HANDLE(HWND); | |
304 DECLARE_HANDLE(HKL); | |
305 DECLARE_HANDLE(HIC); | |
306 DECLARE_HANDLE(HRASCONN); | |
307 | |
308 /* Handle types that must remain interchangeable even with strict on */ | |
309 | |
310 typedef HINSTANCE HMODULE; | |
311 typedef HANDLE HGDIOBJ; | |
312 typedef HANDLE HGLOBAL; | |
313 typedef HANDLE HLOCAL; | |
314 typedef HANDLE GLOBALHANDLE; | |
315 typedef HANDLE LOCALHANDLE; | |
316 | |
317 /* Callback function pointers types */ | |
318 //WIN_BOOL CALLBACK DATEFMT_ENUMPROCA(LPSTR); | |
319 | |
320 typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCA)(LPSTR); | |
321 typedef WIN_BOOL CALLBACK (* DATEFMT_ENUMPROCW)(LPWSTR); | |
322 DECL_WINELIB_TYPE_AW(DATEFMT_ENUMPROC) | |
323 typedef WIN_BOOL CALLBACK (*DLGPROC)(HWND,UINT,WPARAM,LPARAM); | |
324 typedef LRESULT CALLBACK (*DRIVERPROC)(DWORD,HDRVR,UINT,LPARAM,LPARAM); | |
325 typedef INT CALLBACK (*EDITWORDBREAKPROCA)(LPSTR,INT,INT,INT); | |
326 typedef INT CALLBACK (*EDITWORDBREAKPROCW)(LPWSTR,INT,INT,INT); | |
327 DECL_WINELIB_TYPE_AW(EDITWORDBREAKPROC) | |
328 typedef LRESULT CALLBACK (*FARPROC)(); | |
329 typedef INT CALLBACK (*PROC)(); | |
330 typedef WIN_BOOL CALLBACK (*GRAYSTRINGPROC)(HDC,LPARAM,INT); | |
331 typedef LRESULT CALLBACK (*HOOKPROC)(INT,WPARAM,LPARAM); | |
332 typedef WIN_BOOL CALLBACK (*PROPENUMPROCA)(HWND,LPCSTR,HANDLE); | |
333 typedef WIN_BOOL CALLBACK (*PROPENUMPROCW)(HWND,LPCWSTR,HANDLE); | |
334 DECL_WINELIB_TYPE_AW(PROPENUMPROC) | |
335 typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXA)(HWND,LPCSTR,HANDLE,LPARAM); | |
336 typedef WIN_BOOL CALLBACK (*PROPENUMPROCEXW)(HWND,LPCWSTR,HANDLE,LPARAM); | |
337 DECL_WINELIB_TYPE_AW(PROPENUMPROCEX) | |
338 typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCA)(LPSTR); | |
339 typedef WIN_BOOL CALLBACK (* TIMEFMT_ENUMPROCW)(LPWSTR); | |
340 DECL_WINELIB_TYPE_AW(TIMEFMT_ENUMPROC) | |
341 typedef VOID CALLBACK (*TIMERPROC)(HWND,UINT,UINT,DWORD); | |
342 typedef WIN_BOOL CALLBACK (*WNDENUMPROC)(HWND,LPARAM); | |
343 typedef LRESULT CALLBACK (*WNDPROC)(HWND,UINT,WPARAM,LPARAM); | |
344 | |
345 /*---------------------------------------------------------------------------- | |
346 ** FIXME: Better isolate Wine's reliance on the xxx16 type definitions. | |
347 ** For now, we just isolate them to make the situation clear. | |
348 **--------------------------------------------------------------------------*/ | |
349 /* | |
350 * Basic type definitions for 16 bit variations on Windows types. | |
351 * These types are provided mostly to insure compatibility with | |
352 * 16 bit windows code. | |
353 */ | |
354 | |
355 #ifndef __WINE_WINDEF16_H | |
356 #define __WINE_WINDEF16_H | |
357 | |
358 #include "windef.h" | |
359 | |
360 /* Standard data types */ | |
361 | |
362 typedef short INT16; | |
363 typedef unsigned short UINT16; | |
364 typedef unsigned short WIN_BOOL16; | |
365 | |
366 typedef UINT16 HANDLE16; | |
367 typedef HANDLE16 *LPHANDLE16; | |
368 | |
369 typedef UINT16 WPARAM16; | |
370 typedef INT16 *LPINT16; | |
371 typedef UINT16 *LPUINT16; | |
372 | |
373 #define DECLARE_HANDLE16(a) \ | |
374 typedef HANDLE16 a##16; \ | |
375 typedef a##16 *P##a##16; \ | |
376 typedef a##16 *NP##a##16; \ | |
377 typedef a##16 *LP##a##16 | |
378 | |
379 DECLARE_HANDLE16(HACMDRIVERID); | |
380 DECLARE_HANDLE16(HACMDRIVER); | |
381 DECLARE_HANDLE16(HACMOBJ); | |
382 DECLARE_HANDLE16(HACMSTREAM); | |
383 DECLARE_HANDLE16(HMETAFILEPICT); | |
384 | |
385 DECLARE_HANDLE16(HACCEL); | |
386 DECLARE_HANDLE16(HBITMAP); | |
387 DECLARE_HANDLE16(HBRUSH); | |
388 DECLARE_HANDLE16(HCOLORSPACE); | |
389 DECLARE_HANDLE16(HCURSOR); | |
390 DECLARE_HANDLE16(HDC); | |
391 DECLARE_HANDLE16(HDROP); | |
392 DECLARE_HANDLE16(HDRVR); | |
393 DECLARE_HANDLE16(HDWP); | |
394 DECLARE_HANDLE16(HENHMETAFILE); | |
395 DECLARE_HANDLE16(HFILE); | |
396 DECLARE_HANDLE16(HFONT); | |
397 DECLARE_HANDLE16(HICON); | |
398 DECLARE_HANDLE16(HINSTANCE); | |
399 DECLARE_HANDLE16(HKEY); | |
400 DECLARE_HANDLE16(HMENU); | |
401 DECLARE_HANDLE16(HMETAFILE); | |
402 DECLARE_HANDLE16(HMIDI); | |
403 DECLARE_HANDLE16(HMIDIIN); | |
404 DECLARE_HANDLE16(HMIDIOUT); | |
405 DECLARE_HANDLE16(HMIDISTRM); | |
406 DECLARE_HANDLE16(HMIXER); | |
407 DECLARE_HANDLE16(HMIXEROBJ); | |
408 DECLARE_HANDLE16(HMMIO); | |
409 DECLARE_HANDLE16(HPALETTE); | |
410 DECLARE_HANDLE16(HPEN); | |
411 DECLARE_HANDLE16(HQUEUE); | |
412 DECLARE_HANDLE16(HRGN); | |
413 DECLARE_HANDLE16(HRSRC); | |
414 DECLARE_HANDLE16(HTASK); | |
415 DECLARE_HANDLE16(HWAVE); | |
416 DECLARE_HANDLE16(HWAVEIN); | |
417 DECLARE_HANDLE16(HWAVEOUT); | |
418 DECLARE_HANDLE16(HWINSTA); | |
419 DECLARE_HANDLE16(HDESK); | |
420 DECLARE_HANDLE16(HWND); | |
421 DECLARE_HANDLE16(HKL); | |
422 DECLARE_HANDLE16(HIC); | |
423 DECLARE_HANDLE16(HRASCONN); | |
424 #undef DECLARE_HANDLE16 | |
425 | |
426 typedef HINSTANCE16 HMODULE16; | |
427 typedef HANDLE16 HGDIOBJ16; | |
428 typedef HANDLE16 HGLOBAL16; | |
429 typedef HANDLE16 HLOCAL16; | |
430 | |
431 /* The SIZE structure */ | |
432 typedef struct | |
433 { | |
434 INT16 cx; | |
435 INT16 cy; | |
436 } SIZE16, *PSIZE16, *LPSIZE16; | |
437 | |
438 /* The POINT structure */ | |
439 | |
440 typedef struct | |
441 { | |
442 INT16 x; | |
443 INT16 y; | |
444 } POINT16, *PPOINT16, *LPPOINT16; | |
445 | |
446 /* The RECT structure */ | |
447 | |
448 typedef struct | |
449 { | |
450 INT16 left; | |
451 INT16 top; | |
452 INT16 right; | |
453 INT16 bottom; | |
454 } RECT16, *LPRECT16; | |
455 | |
456 /* Callback function pointers types */ | |
457 | |
458 typedef LRESULT CALLBACK (*DRIVERPROC16)(DWORD,HDRVR16,UINT16,LPARAM,LPARAM); | |
459 typedef WIN_BOOL16 CALLBACK (*DLGPROC16)(HWND16,UINT16,WPARAM16,LPARAM); | |
460 typedef INT16 CALLBACK (*EDITWORDBREAKPROC16)(LPSTR,INT16,INT16,INT16); | |
461 typedef LRESULT CALLBACK (*FARPROC16)(); | |
462 typedef INT16 CALLBACK (*PROC16)(); | |
463 typedef WIN_BOOL16 CALLBACK (*GRAYSTRINGPROC16)(HDC16,LPARAM,INT16); | |
464 typedef LRESULT CALLBACK (*HOOKPROC16)(INT16,WPARAM16,LPARAM); | |
465 typedef WIN_BOOL16 CALLBACK (*PROPENUMPROC16)(HWND16,SEGPTR,HANDLE16); | |
466 typedef VOID CALLBACK (*TIMERPROC16)(HWND16,UINT16,UINT16,DWORD); | |
467 typedef LRESULT CALLBACK (*WNDENUMPROC16)(HWND16,LPARAM); | |
468 typedef LRESULT CALLBACK (*WNDPROC16)(HWND16,UINT16,WPARAM16,LPARAM); | |
469 | |
470 #endif /* __WINE_WINDEF16_H */ | |
471 | |
472 /* Define some empty macros for compatibility with Windows code. */ | |
473 | |
474 #ifndef __WINE__ | |
475 #define NEAR | |
476 #define FAR | |
477 #define near | |
478 #define far | |
479 #define _near | |
480 #define _far | |
481 #define IN | |
482 #define OUT | |
483 #define OPTIONAL | |
484 #endif /* __WINE__ */ | |
485 | |
486 /* Macro for structure packing. */ | |
487 | |
488 #ifdef __GNUC__ | |
489 #ifndef _EGCS_ | |
490 #define WINE_PACKED __attribute__((packed)) | |
491 #define WINE_UNUSED __attribute__((unused)) | |
492 #define WINE_NORETURN __attribute__((noreturn)) | |
493 #endif | |
494 #else | |
495 #define WINE_PACKED /* nothing */ | |
496 #define WINE_UNUSED /* nothing */ | |
497 #define WINE_NORETURN /* nothing */ | |
498 #endif | |
499 | |
500 /* Macros to split words and longs. */ | |
501 | |
502 #define LOBYTE(w) ((BYTE)(WORD)(w)) | |
503 #define HIBYTE(w) ((BYTE)((WORD)(w) >> 8)) | |
504 | |
505 #define LOWORD(l) ((WORD)(DWORD)(l)) | |
506 #define HIWORD(l) ((WORD)((DWORD)(l) >> 16)) | |
507 | |
508 #define SLOWORD(l) ((INT16)(LONG)(l)) | |
509 #define SHIWORD(l) ((INT16)((LONG)(l) >> 16)) | |
510 | |
511 #define MAKEWORD(low,high) ((WORD)(((BYTE)(low)) | ((WORD)((BYTE)(high))) << 8)) | |
512 #define MAKELONG(low,high) ((LONG)(((WORD)(low)) | (((DWORD)((WORD)(high))) << 16))) | |
513 #define MAKELPARAM(low,high) ((LPARAM)MAKELONG(low,high)) | |
514 #define MAKEWPARAM(low,high) ((WPARAM)MAKELONG(low,high)) | |
515 #define MAKELRESULT(low,high) ((LRESULT)MAKELONG(low,high)) | |
516 #define MAKEINTATOM(atom) ((LPCSTR)MAKELONG((atom),0)) | |
517 | |
518 #define SELECTOROF(ptr) (HIWORD(ptr)) | |
519 #define OFFSETOF(ptr) (LOWORD(ptr)) | |
520 | |
521 #ifdef __WINE__ | |
522 /* macros to set parts of a DWORD (not in the Windows API) */ | |
523 #define SET_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD(val)) | |
524 #define SET_LOBYTE(dw,val) ((dw) = ((dw) & 0xffffff00) | LOBYTE(val)) | |
525 #define SET_HIBYTE(dw,val) ((dw) = ((dw) & 0xffff00ff) | (LOWORD(val) & 0xff00)) | |
526 #define ADD_LOWORD(dw,val) ((dw) = ((dw) & 0xffff0000) | LOWORD((DWORD)(dw)+(val))) | |
527 #endif | |
528 | |
529 /* Macros to access unaligned or wrong-endian WORDs and DWORDs. */ | |
530 /* Note: These macros are semantically broken, at least for wrc. wrc | |
531 spits out data in the platform's current binary format, *not* in | |
532 little-endian format. These macros are used throughout the resource | |
533 code to load and store data to the resources. Since it is unlikely | |
534 that we'll ever be dealing with little-endian resource data, the | |
535 byte-swapping nature of these macros has been disabled. Rather than | |
536 remove the use of these macros from the resource loading code, the | |
537 macros have simply been disabled. In the future, someone may want | |
538 to reactivate these macros for other purposes. In that case, the | |
539 resource code will have to be modified to use different macros. */ | |
540 | |
541 #if 1 | |
542 #define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w)) | |
543 #define GET_WORD(ptr) (*(WORD *)(ptr)) | |
544 #define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw)) | |
545 #define GET_DWORD(ptr) (*(DWORD *)(ptr)) | |
546 #else | |
547 #define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \ | |
548 *((BYTE *)(ptr) + 1) = HIBYTE(w)) | |
549 #define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \ | |
550 (WORD)(*((BYTE *)(ptr)+1) << 8))) | |
551 #define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \ | |
552 PUT_WORD((WORD *)(ptr)+1,HIWORD(dw))) | |
553 #define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \ | |
554 ((DWORD)GET_WORD((WORD *)(ptr)+1) << 16))) | |
555 #endif /* 1 */ | |
556 | |
557 /* min and max macros */ | |
558 #define __max(a,b) (((a) > (b)) ? (a) : (b)) | |
559 #define __min(a,b) (((a) < (b)) ? (a) : (b)) | |
560 #ifndef max | |
561 #define max(a,b) (((a) > (b)) ? (a) : (b)) | |
562 #endif | |
563 #ifndef min | |
564 #define min(a,b) (((a) < (b)) ? (a) : (b)) | |
565 #endif | |
566 | |
567 #define _MAX_PATH 260 | |
568 #define MAX_PATH 260 | |
569 #define _MAX_DRIVE 3 | |
570 #define _MAX_DIR 256 | |
571 #define _MAX_FNAME 255 | |
572 #define _MAX_EXT 256 | |
573 | |
574 #define HFILE_ERROR16 ((HFILE16)-1) | |
575 #define HFILE_ERROR ((HFILE)-1) | |
576 | |
577 /* The SIZE structure */ | |
578 typedef struct tagSIZE | |
579 { | |
580 INT cx; | |
581 INT cy; | |
582 } SIZE, *PSIZE, *LPSIZE; | |
583 | |
584 | |
585 typedef SIZE SIZEL, *PSIZEL, *LPSIZEL; | |
586 | |
587 #define CONV_SIZE16TO32(s16,s32) \ | |
588 ((s32)->cx = (INT)(s16)->cx, (s32)->cy = (INT)(s16)->cy) | |
589 #define CONV_SIZE32TO16(s32,s16) \ | |
590 ((s16)->cx = (INT16)(s32)->cx, (s16)->cy = (INT16)(s32)->cy) | |
591 | |
592 /* The POINT structure */ | |
593 typedef struct tagPOINT | |
594 { | |
595 LONG x; | |
596 LONG y; | |
597 } POINT, *PPOINT, *LPPOINT; | |
598 | |
599 typedef struct _POINTL | |
600 { | |
601 LONG x; | |
602 LONG y; | |
603 } POINTL; | |
604 | |
605 #define CONV_POINT16TO32(p16,p32) \ | |
606 ((p32)->x = (INT)(p16)->x, (p32)->y = (INT)(p16)->y) | |
607 #define CONV_POINT32TO16(p32,p16) \ | |
608 ((p16)->x = (INT16)(p32)->x, (p16)->y = (INT16)(p32)->y) | |
609 | |
610 #define MAKEPOINT16(l) (*((POINT16 *)&(l))) | |
611 | |
612 /* The POINTS structure */ | |
613 | |
614 typedef struct tagPOINTS | |
615 { | |
616 SHORT x; | |
617 SHORT y; | |
618 } POINTS, *PPOINTS, *LPPOINTS; | |
619 | |
620 | |
621 #define MAKEPOINTS(l) (*((POINTS *)&(l))) | |
622 | |
623 | |
624 /* The RECT structure */ | |
625 typedef struct tagRECT | |
626 { | |
627 short left; | |
628 short top; | |
629 short right; | |
630 short bottom; | |
631 } RECT, *PRECT, *LPRECT; | |
632 typedef const RECT *LPCRECT; | |
633 | |
634 | |
635 typedef struct tagRECTL | |
636 { | |
637 LONG left; | |
638 LONG top; | |
639 LONG right; | |
640 LONG bottom; | |
641 } RECTL, *PRECTL, *LPRECTL; | |
642 | |
643 typedef const RECTL *LPCRECTL; | |
644 | |
645 #define CONV_RECT16TO32(r16,r32) \ | |
646 ((r32)->left = (INT)(r16)->left, (r32)->top = (INT)(r16)->top, \ | |
647 (r32)->right = (INT)(r16)->right, (r32)->bottom = (INT)(r16)->bottom) | |
648 #define CONV_RECT32TO16(r32,r16) \ | |
649 ((r16)->left = (INT16)(r32)->left, (r16)->top = (INT16)(r32)->top, \ | |
650 (r16)->right = (INT16)(r32)->right, (r16)->bottom = (INT16)(r32)->bottom) | |
651 | |
652 #ifdef __cplusplus | |
653 } | |
654 #endif | |
655 | |
656 #endif /* __WINE_WINDEF_H */ |