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