VirtualBox

source: vbox/trunk/src/VBox/Additions/WINNT/Graphics/Wine/include/basetsd.h@ 25949

Last change on this file since 25949 was 25949, checked in by vboxsync, 15 years ago

crOpenGL: update to wine 1.1.36 and disable unnecessary fbo state poll

  • Property svn:eol-style set to native
File size: 8.9 KB
Line 
1/*
2 * Compilers that uses ILP32, LP64 or P64 type models
3 * for both Win32 and Win64 are supported by this file.
4 *
5 * Copyright (C) 1999 Patrik Stridvall
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22/*
23 * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
24 * other than GPL or LGPL is available it will apply instead, Sun elects to use only
25 * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
26 * a choice of LGPL license versions is made available with the language indicating
27 * that LGPLv2 or any later version may be used, or where a choice of which version
28 * of the LGPL is applied is otherwise unspecified.
29 */
30
31#ifndef __WINE_BASETSD_H
32#define __WINE_BASETSD_H
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* defined(__cplusplus) */
37
38/*
39 * Win32 was easy to implement under Unix since most (all?) 32-bit
40 * Unices uses the same type model (ILP32) as Win32, where int, long
41 * and pointer are 32-bit.
42 *
43 * Win64, however, will cause some problems when implemented under Unix.
44 * Linux/{Alpha, Sparc64} and most (all?) other 64-bit Unices use
45 * the LP64 type model where int is 32-bit and long and pointer are
46 * 64-bit. Win64 on the other hand uses the P64 (sometimes called LLP64)
47 * type model where int and long are 32 bit and pointer is 64-bit.
48 */
49
50#if defined(__x86_64__) && !defined(_WIN64)
51#define _WIN64
52#endif
53
54/* Type model independent typedefs */
55/* The __intXX types are native types defined by the MS C compiler.
56 * Apps that make use of them before they get defined here, can
57 * simply add to the command line:
58 * -D__int8=char -D__int16=short -D__int32=int "-D__int64=long long"
59 */
60#if !defined(_MSC_VER) && !defined(__WIDL__)
61# ifndef __int8
62# define __int8 char
63# endif
64# ifndef __int16
65# define __int16 short
66# endif
67# ifndef __int32
68# define __int32 int
69# endif
70# ifndef __int64
71# if defined(_WIN64) && !defined(__MINGW64__)
72# define __int64 long
73# else
74# define __int64 long long
75# endif
76# endif
77#endif /* !defined(_MSC_VER) */
78
79/* FIXME: DECLSPEC_ALIGN should be declared only in winnt.h, but we need it here too */
80#ifndef DECLSPEC_ALIGN
81# if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
82# define DECLSPEC_ALIGN(x) __declspec(align(x))
83# elif defined(__GNUC__)
84# define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
85# else
86# define DECLSPEC_ALIGN(x)
87# endif
88#endif
89
90typedef signed char INT8, *PINT8;
91typedef signed short INT16, *PINT16;
92typedef signed int INT32, *PINT32;
93typedef unsigned char UINT8, *PUINT8;
94typedef unsigned short UINT16, *PUINT16;
95typedef unsigned int UINT32, *PUINT32;
96typedef signed int LONG32, *PLONG32;
97typedef unsigned int ULONG32, *PULONG32;
98typedef unsigned int DWORD32, *PDWORD32;
99
100#ifdef _MSC_VER
101typedef signed __int64 INT64, *PINT64;
102typedef unsigned __int64 UINT64, *PUINT64;
103typedef signed __int64 LONG64, *PLONG64;
104typedef unsigned __int64 ULONG64, *PULONG64;
105typedef unsigned __int64 DWORD64, *PDWORD64;
106#else
107typedef signed __int64 DECLSPEC_ALIGN(8) INT64, *PINT64;
108typedef unsigned __int64 DECLSPEC_ALIGN(8) UINT64, *PUINT64;
109typedef signed __int64 DECLSPEC_ALIGN(8) LONG64, *PLONG64;
110typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONG64, *PULONG64;
111typedef unsigned __int64 DECLSPEC_ALIGN(8) DWORD64, *PDWORD64;
112#endif
113
114/* Basic pointer-sized integer types */
115
116#if defined(__midl) || defined(__WIDL__)
117
118typedef /* [public] */ signed __int3264 INT_PTR, *PINT_PTR;
119typedef /* [public] */ signed __int3264 LONG_PTR, *PLONG_PTR;
120typedef /* [public] */ unsigned __int3264 UINT_PTR, *PUINT_PTR;
121typedef /* [public] */ unsigned __int3264 ULONG_PTR, *PULONG_PTR;
122typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
123
124#elif defined(_WIN64)
125
126#define __int3264 __int64
127
128typedef signed __int64 INT_PTR, *PINT_PTR;
129typedef signed __int64 LONG_PTR, *PLONG_PTR;
130typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
131typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
132typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
133
134#else
135
136#define __int3264 __int32
137
138typedef long INT_PTR, *PINT_PTR;
139typedef unsigned long UINT_PTR, *PUINT_PTR;
140typedef long LONG_PTR, *PLONG_PTR;
141typedef unsigned long ULONG_PTR, *PULONG_PTR;
142typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
143
144#endif
145
146/* Win32 or Win64 dependent typedef/defines. */
147
148#ifdef _WIN64
149
150#define MAXINT_PTR 0x7fffffffffffffff
151#define MININT_PTR 0x8000000000000000
152#define MAXUINT_PTR 0xffffffffffffffff
153
154typedef __int64 SHANDLE_PTR;
155typedef unsigned __int64 HANDLE_PTR;
156typedef int HALF_PTR, *PHALF_PTR;
157typedef unsigned int UHALF_PTR, *PUHALF_PTR;
158
159#define MAXHALF_PTR 0x7fffffff
160#define MINHALF_PTR 0x80000000
161#define MAXUHALF_PTR 0xffffffff
162
163#if !defined(__midl) && !defined(__WIDL__)
164
165static inline ULONG32 HandleToULong(const void *h)
166{
167 return (ULONG_PTR)h;
168}
169
170static inline LONG32 HandleToLong(const void *h)
171{
172 return (LONG_PTR)h;
173}
174
175static inline void *ULongToHandle(ULONG32 ul)
176{
177 return (void *)(ULONG_PTR)ul;
178}
179
180static inline void *LongToHandle(LONG32 l)
181{
182 return (void *)(LONG_PTR)l;
183}
184
185static inline ULONG32 PtrToUlong(const void *p)
186{
187 return (ULONG_PTR)p;
188}
189
190static inline LONG32 PtrToLong(const void *p)
191{
192 return (LONG_PTR)p;
193}
194
195static inline UINT32 PtrToUint(const void *p)
196{
197 return (UINT_PTR)p;
198}
199
200static inline INT32 PtrToInt(const void *p)
201{
202 return (INT_PTR)p;
203}
204
205static inline UINT16 PtrToUshort(const void *p)
206{
207 return (ULONG_PTR)p;
208}
209
210static inline INT16 PtrToShort(const void *p)
211{
212 return (LONG_PTR)p;
213}
214
215static inline void *IntToPtr(INT32 i)
216{
217 return (void *)(INT_PTR)i;
218}
219
220static inline void *UIntToPtr(UINT32 ui)
221{
222 return (void *)(UINT_PTR)ui;
223}
224
225static inline void *LongToPtr(LONG32 l)
226{
227 return (void *)(LONG_PTR)l;
228}
229
230static inline void *ULongToPtr(ULONG32 ul)
231{
232 return (void *)(ULONG_PTR)ul;
233}
234
235#endif /* !__midl && !__WIDL__ */
236
237#else /* FIXME: defined(_WIN32) */
238
239#define MAXINT_PTR 0x7fffffff
240#define MININT_PTR 0x80000000
241#define MAXUINT_PTR 0xffffffff
242
243typedef long SHANDLE_PTR;
244typedef unsigned long HANDLE_PTR;
245typedef signed short HALF_PTR, *PHALF_PTR;
246typedef unsigned short UHALF_PTR, *PUHALF_PTR;
247
248#define MAXUHALF_PTR 0xffff
249#define MAXHALF_PTR 0x7fff
250#define MINHALF_PTR 0x8000
251
252#define HandleToULong(h) ((ULONG)(ULONG_PTR)(h))
253#define HandleToLong(h) ((LONG)(LONG_PTR)(h))
254#define ULongToHandle(ul) ((HANDLE)(ULONG_PTR)(ul))
255#define LongToHandle(l) ((HANDLE)(LONG_PTR)(l))
256#define PtrToUlong(p) ((ULONG)(ULONG_PTR)(p))
257#define PtrToLong(p) ((LONG)(LONG_PTR)(p))
258#define PtrToUint(p) ((UINT)(UINT_PTR)(p))
259#define PtrToInt(p) ((INT)(INT_PTR)(p))
260#define PtrToUshort(p) ((USHORT)(ULONG_PTR)(p))
261#define PtrToShort(p) ((SHORT)(LONG_PTR)(p))
262#define IntToPtr(i) ((void *)(INT_PTR)((INT)i))
263#define UIntToPtr(ui) ((void *)(UINT_PTR)((UINT)ui))
264#define LongToPtr(l) ((void *)(LONG_PTR)((LONG)l))
265#define ULongToPtr(ul) ((void *)(ULONG_PTR)((ULONG)ul))
266
267#endif /* defined(_WIN64) || defined(_WIN32) */
268
269#define HandleToUlong(h) HandleToULong(h)
270#define UlongToHandle(ul) ULongToHandle(ul)
271#define UintToPtr(ui) UIntToPtr(ui)
272#define UlongToPtr(ul) ULongToPtr(ul)
273
274typedef LONG_PTR SSIZE_T, *PSSIZE_T;
275typedef ULONG_PTR SIZE_T, *PSIZE_T;
276
277typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
278
279/* Some Wine-specific definitions */
280
281/* Architecture dependent settings. */
282/* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
283#if defined(__i386__)
284# undef WORDS_BIGENDIAN
285# undef BITFIELDS_BIGENDIAN
286# define ALLOW_UNALIGNED_ACCESS
287#elif defined(__x86_64__)
288# undef WORDS_BIGENDIAN
289# undef BITFIELDS_BIGENDIAN
290# define ALLOW_UNALIGNED_ACCESS
291#elif defined(__sparc__)
292# define WORDS_BIGENDIAN
293# define BITFIELDS_BIGENDIAN
294# undef ALLOW_UNALIGNED_ACCESS
295#elif defined(__powerpc__)
296# define WORDS_BIGENDIAN
297# define BITFIELDS_BIGENDIAN
298# undef ALLOW_UNALIGNED_ACCESS
299#elif defined(__ALPHA__)
300# undef WORDS_BIGENDIAN
301# undef BITFIELDS_BIGENDIAN
302# undef ALLOW_UNALIGNED_ACCESS
303#elif !defined(RC_INVOKED) && !defined(__WIDL__) && !defined(__midl)
304# error Unknown CPU architecture!
305#endif
306
307#ifdef __cplusplus
308} /* extern "C" */
309#endif /* defined(__cplusplus) */
310
311#endif /* !defined(__WINE_BASETSD_H) */
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette