VirtualBox

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

最後變更 在這個檔案從20793是 19678,由 vboxsync 提交於 16 年 前

opengl: update wine to 1.1.21, add d3d9.dll to build list

  • 屬性 svn:eol-style 設為 native
檔案大小: 8.3 KB
 
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/* Win32 or Win64 dependent typedef/defines. */
115
116#ifdef _WIN64
117
118typedef signed __int64 INT_PTR, *PINT_PTR;
119typedef signed __int64 LONG_PTR, *PLONG_PTR;
120typedef unsigned __int64 UINT_PTR, *PUINT_PTR;
121typedef unsigned __int64 ULONG_PTR, *PULONG_PTR;
122typedef unsigned __int64 DWORD_PTR, *PDWORD_PTR;
123
124#define MAXINT_PTR 0x7fffffffffffffff
125#define MININT_PTR 0x8000000000000000
126#define MAXUINT_PTR 0xffffffffffffffff
127
128typedef __int64 SHANDLE_PTR;
129typedef unsigned __int64 HANDLE_PTR;
130typedef int HALF_PTR, *PHALF_PTR;
131typedef unsigned int UHALF_PTR, *PUHALF_PTR;
132
133#define MAXHALF_PTR 0x7fffffff
134#define MINHALF_PTR 0x80000000
135#define MAXUHALF_PTR 0xffffffff
136
137#if !defined(__midl) && !defined(__WIDL__)
138
139static inline ULONG32 HandleToULong(const void *h)
140{
141 return (ULONG_PTR)h;
142}
143
144static inline LONG32 HandleToLong(const void *h)
145{
146 return (LONG_PTR)h;
147}
148
149static inline void *ULongToHandle(ULONG32 ul)
150{
151 return (void *)(ULONG_PTR)ul;
152}
153
154static inline void *LongToHandle(LONG32 l)
155{
156 return (void *)(LONG_PTR)l;
157}
158
159static inline ULONG32 PtrToUlong(const void *p)
160{
161 return (ULONG_PTR)p;
162}
163
164static inline LONG32 PtrToLong(const void *p)
165{
166 return (LONG_PTR)p;
167}
168
169static inline UINT32 PtrToUint(const void *p)
170{
171 return (UINT_PTR)p;
172}
173
174static inline INT32 PtrToInt(const void *p)
175{
176 return (INT_PTR)p;
177}
178
179static inline UINT16 PtrToUshort(const void *p)
180{
181 return (ULONG_PTR)p;
182}
183
184static inline INT16 PtrToShort(const void *p)
185{
186 return (LONG_PTR)p;
187}
188
189static inline void *IntToPtr(INT32 i)
190{
191 return (void *)(INT_PTR)i;
192}
193
194static inline void *UIntToPtr(UINT32 ui)
195{
196 return (void *)(UINT_PTR)ui;
197}
198
199static inline void *LongToPtr(LONG32 l)
200{
201 return (void *)(LONG_PTR)l;
202}
203
204static inline void *ULongToPtr(ULONG32 ul)
205{
206 return (void *)(ULONG_PTR)ul;
207}
208
209#endif /* !__midl && !__WIDL__ */
210
211#else /* FIXME: defined(_WIN32) */
212
213typedef long INT_PTR, *PINT_PTR;
214typedef unsigned long UINT_PTR, *PUINT_PTR;
215typedef long LONG_PTR, *PLONG_PTR;
216typedef unsigned long ULONG_PTR, *PULONG_PTR;
217typedef ULONG_PTR DWORD_PTR, *PDWORD_PTR;
218
219#define MAXINT_PTR 0x7fffffff
220#define MININT_PTR 0x80000000
221#define MAXUINT_PTR 0xffffffff
222
223typedef long SHANDLE_PTR;
224typedef unsigned long HANDLE_PTR;
225typedef signed short HALF_PTR, *PHALF_PTR;
226typedef unsigned short UHALF_PTR, *PUHALF_PTR;
227
228#define MAXUHALF_PTR 0xffff
229#define MAXHALF_PTR 0x7fff
230#define MINHALF_PTR 0x8000
231
232#define HandleToULong(h) ((ULONG)(ULONG_PTR)(h))
233#define HandleToLong(h) ((LONG)(LONG_PTR)(h))
234#define ULongToHandle(ul) ((HANDLE)(ULONG_PTR)(ul))
235#define LongToHandle(l) ((HANDLE)(LONG_PTR)(l))
236#define PtrToUlong(p) ((ULONG)(ULONG_PTR)(p))
237#define PtrToLong(p) ((LONG)(LONG_PTR)(p))
238#define PtrToUint(p) ((UINT)(UINT_PTR)(p))
239#define PtrToInt(p) ((INT)(INT_PTR)(p))
240#define PtrToUshort(p) ((USHORT)(ULONG_PTR)(p))
241#define PtrToShort(p) ((SHORT)(LONG_PTR)(p))
242#define IntToPtr(i) ((void *)(INT_PTR)((INT)i))
243#define UIntToPtr(ui) ((void *)(UINT_PTR)((UINT)ui))
244#define LongToPtr(l) ((void *)(LONG_PTR)((LONG)l))
245#define ULongToPtr(ul) ((void *)(ULONG_PTR)((ULONG)ul))
246
247#endif /* defined(_WIN64) || defined(_WIN32) */
248
249#define HandleToUlong(h) HandleToULong(h)
250#define UlongToHandle(ul) ULongToHandle(ul)
251#define UintToPtr(ui) UIntToPtr(ui)
252#define UlongToPtr(ul) ULongToPtr(ul)
253
254typedef LONG_PTR SSIZE_T, *PSSIZE_T;
255typedef ULONG_PTR SIZE_T, *PSIZE_T;
256
257typedef ULONG_PTR KAFFINITY, *PKAFFINITY;
258
259/* Some Wine-specific definitions */
260
261/* Architecture dependent settings. */
262/* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
263#if defined(__i386__)
264# undef WORDS_BIGENDIAN
265# undef BITFIELDS_BIGENDIAN
266# define ALLOW_UNALIGNED_ACCESS
267#elif defined(__x86_64__)
268# undef WORDS_BIGENDIAN
269# undef BITFIELDS_BIGENDIAN
270# define ALLOW_UNALIGNED_ACCESS
271#elif defined(__sparc__)
272# define WORDS_BIGENDIAN
273# define BITFIELDS_BIGENDIAN
274# undef ALLOW_UNALIGNED_ACCESS
275#elif defined(__powerpc__)
276# define WORDS_BIGENDIAN
277# define BITFIELDS_BIGENDIAN
278# undef ALLOW_UNALIGNED_ACCESS
279#elif defined(__ALPHA__)
280# undef WORDS_BIGENDIAN
281# undef BITFIELDS_BIGENDIAN
282# undef ALLOW_UNALIGNED_ACCESS
283#elif !defined(RC_INVOKED) && !defined(__WIDL__) && !defined(__midl)
284# error Unknown CPU architecture!
285#endif
286
287#ifdef __cplusplus
288} /* extern "C" */
289#endif /* defined(__cplusplus) */
290
291#endif /* !defined(__WINE_BASETSD_H) */
注意: 瀏覽 TracBrowser 來幫助您使用儲存庫瀏覽器

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