1 | /*
|
---|
2 | * CRT definitions
|
---|
3 | *
|
---|
4 | * Copyright 2000 Francois Gouget.
|
---|
5 | *
|
---|
6 | * This library is free software; you can redistribute it and/or
|
---|
7 | * modify it under the terms of the GNU Lesser General Public
|
---|
8 | * License as published by the Free Software Foundation; either
|
---|
9 | * version 2.1 of the License, or (at your option) any later version.
|
---|
10 | *
|
---|
11 | * This library is distributed in the hope that it will be useful,
|
---|
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
14 | * Lesser General Public License for more details.
|
---|
15 | *
|
---|
16 | * You should have received a copy of the GNU Lesser General Public
|
---|
17 | * License along with this library; if not, write to the Free Software
|
---|
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
---|
19 | */
|
---|
20 |
|
---|
21 | /*
|
---|
22 | * Sun LGPL Disclaimer: For the avoidance of doubt, except that if any license choice
|
---|
23 | * other than GPL or LGPL is available it will apply instead, Sun elects to use only
|
---|
24 | * the Lesser General Public License version 2.1 (LGPLv2) at this time for any software where
|
---|
25 | * a choice of LGPL license versions is made available with the language indicating
|
---|
26 | * that LGPLv2 or any later version may be used, or where a choice of which version
|
---|
27 | * of the LGPL is applied is otherwise unspecified.
|
---|
28 | */
|
---|
29 |
|
---|
30 | #ifndef __WINE_USE_MSVCRT
|
---|
31 | #define __WINE_USE_MSVCRT
|
---|
32 | #endif
|
---|
33 |
|
---|
34 | #if defined(__x86_64__) && !defined(_WIN64)
|
---|
35 | #define _WIN64
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | #if !defined(_MSC_VER) && !defined(__int64)
|
---|
39 | # if defined(_WIN64) && !defined(__MINGW64__)
|
---|
40 | # define __int64 long
|
---|
41 | # else
|
---|
42 | # define __int64 long long
|
---|
43 | # endif
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #ifndef __stdcall
|
---|
47 | # ifdef __i386__
|
---|
48 | # ifdef __GNUC__
|
---|
49 | # ifdef __APPLE__ /* Mac OS X uses a 16-byte aligned stack and not a 4-byte one */
|
---|
50 | # define __stdcall __attribute__((__stdcall__)) __attribute__((__force_align_arg_pointer__))
|
---|
51 | # else
|
---|
52 | # define __stdcall __attribute__((__stdcall__))
|
---|
53 | # endif
|
---|
54 | # elif defined(_MSC_VER)
|
---|
55 | /* Nothing needs to be done. __stdcall already exists */
|
---|
56 | # else
|
---|
57 | # error You need to define __stdcall for your compiler
|
---|
58 | # endif
|
---|
59 | # elif defined(__x86_64__) && defined (__GNUC__)
|
---|
60 | # define __stdcall __attribute__((ms_abi))
|
---|
61 | # else
|
---|
62 | # define __stdcall
|
---|
63 | # endif
|
---|
64 | #endif /* __stdcall */
|
---|
65 |
|
---|
66 | #ifndef __cdecl
|
---|
67 | # if defined(__i386__) && defined(__GNUC__)
|
---|
68 | # ifdef __APPLE__ /* Mac OS X uses 16-byte aligned stack and not a 4-byte one */
|
---|
69 | # define __cdecl __attribute__((__cdecl__)) __attribute__((__force_align_arg_pointer__))
|
---|
70 | # else
|
---|
71 | # define __cdecl __attribute__((__cdecl__))
|
---|
72 | # endif
|
---|
73 | # elif defined(__x86_64__) && defined (__GNUC__)
|
---|
74 | # define __cdecl __attribute__((ms_abi))
|
---|
75 | # elif !defined(_MSC_VER)
|
---|
76 | # define __cdecl
|
---|
77 | # endif
|
---|
78 | #endif /* __cdecl */
|
---|
79 |
|
---|
80 | #ifndef __ms_va_list
|
---|
81 | # if defined(__x86_64__) && defined (__GNUC__)
|
---|
82 | # define __ms_va_list __builtin_ms_va_list
|
---|
83 | # define __ms_va_start(list,arg) __builtin_ms_va_start(list,arg)
|
---|
84 | # define __ms_va_end(list) __builtin_ms_va_end(list)
|
---|
85 | # else
|
---|
86 | # define __ms_va_list va_list
|
---|
87 | # define __ms_va_start(list,arg) va_start(list,arg)
|
---|
88 | # define __ms_va_end(list) va_end(list)
|
---|
89 | # endif
|
---|
90 | #endif
|
---|
91 |
|
---|
92 | #ifndef DECLSPEC_ALIGN
|
---|
93 | # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
|
---|
94 | # define DECLSPEC_ALIGN(x) __declspec(align(x))
|
---|
95 | # elif defined(__GNUC__)
|
---|
96 | # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
|
---|
97 | # else
|
---|
98 | # define DECLSPEC_ALIGN(x)
|
---|
99 | # endif
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | #ifndef _MSVCRT_LONG_DEFINED
|
---|
103 | #define _MSVCRT_LONG_DEFINED
|
---|
104 | /* we need 32-bit longs even on 64-bit */
|
---|
105 | typedef int __msvcrt_long;
|
---|
106 | typedef unsigned int __msvcrt_ulong;
|
---|
107 | #endif
|
---|
108 |
|
---|
109 | #ifndef _INTPTR_T_DEFINED
|
---|
110 | #ifdef _WIN64
|
---|
111 | typedef __int64 intptr_t;
|
---|
112 | #else
|
---|
113 | typedef int intptr_t;
|
---|
114 | #endif
|
---|
115 | #define _INTPTR_T_DEFINED
|
---|
116 | #endif
|
---|
117 |
|
---|
118 | #ifndef _UINTPTR_T_DEFINED
|
---|
119 | #ifdef _WIN64
|
---|
120 | typedef unsigned __int64 uintptr_t;
|
---|
121 | #else
|
---|
122 | typedef unsigned int uintptr_t;
|
---|
123 | #endif
|
---|
124 | #define _UINTPTR_T_DEFINED
|
---|
125 | #endif
|
---|
126 |
|
---|
127 | #ifndef _PTRDIFF_T_DEFINED
|
---|
128 | #ifdef _WIN64
|
---|
129 | typedef __int64 ptrdiff_t;
|
---|
130 | #else
|
---|
131 | typedef int ptrdiff_t;
|
---|
132 | #endif
|
---|
133 | #define _PTRDIFF_T_DEFINED
|
---|
134 | #endif
|
---|
135 |
|
---|
136 | #ifndef _SIZE_T_DEFINED
|
---|
137 | #ifdef _WIN64
|
---|
138 | typedef unsigned __int64 size_t;
|
---|
139 | #else
|
---|
140 | typedef unsigned int size_t;
|
---|
141 | #endif
|
---|
142 | #define _SIZE_T_DEFINED
|
---|
143 | #endif
|
---|
144 |
|
---|
145 | #ifndef _TIME32_T_DEFINED
|
---|
146 | typedef __msvcrt_long __time32_t;
|
---|
147 | #define _TIME32_T_DEFINED
|
---|
148 | #endif
|
---|
149 |
|
---|
150 | #ifndef _TIME64_T_DEFINED
|
---|
151 | typedef __int64 DECLSPEC_ALIGN(8) __time64_t;
|
---|
152 | #define _TIME64_T_DEFINED
|
---|
153 | #endif
|
---|
154 |
|
---|
155 | #ifdef _USE_32BIT_TIME_T
|
---|
156 | # ifdef _WIN64
|
---|
157 | # error You cannot use 32-bit time_t in Win64
|
---|
158 | # endif
|
---|
159 | #elif !defined(_WIN64)
|
---|
160 | # define _USE_32BIT_TIME_T
|
---|
161 | #endif
|
---|
162 |
|
---|
163 | #ifndef _TIME_T_DEFINED
|
---|
164 | #ifdef _USE_32BIT_TIME_T
|
---|
165 | typedef __time32_t time_t;
|
---|
166 | #else
|
---|
167 | typedef __time64_t time_t;
|
---|
168 | #endif
|
---|
169 | #define _TIME_T_DEFINED
|
---|
170 | #endif
|
---|
171 |
|
---|
172 | #ifndef _WCHAR_T_DEFINED
|
---|
173 | #ifndef __cplusplus
|
---|
174 | typedef unsigned short wchar_t;
|
---|
175 | #endif
|
---|
176 | #define _WCHAR_T_DEFINED
|
---|
177 | #endif
|
---|
178 |
|
---|
179 | #ifndef _WCTYPE_T_DEFINED
|
---|
180 | typedef unsigned short wint_t;
|
---|
181 | typedef unsigned short wctype_t;
|
---|
182 | #define _WCTYPE_T_DEFINED
|
---|
183 | #endif
|
---|