sync to trunk r38300
[reactos.git] / reactos / include / crt / crtdefs.h
1 /**
2 * This file has no copyright assigned and is placed in the Public Domain.
3 * This file is part of the w64 mingw-runtime package.
4 * No warranty is given; refer to the file DISCLAIMER within this package.
5 */
6 #include <_mingw.h>
7
8 #ifndef _INC_CRTDEFS
9 #define _INC_CRTDEFS
10
11 #ifdef _USE_32BIT_TIME_T
12 #ifdef _WIN64
13 #error You cannot use 32-bit time_t (_USE_32BIT_TIME_T) with _WIN64
14 #undef _USE_32BIT_TIME_T
15 #endif
16 #else
17 #if _INTEGRAL_MAX_BITS < 64
18 #define _USE_32BIT_TIME_T
19 #endif
20 #endif
21
22 /* Compatability definition */
23 #if _MSC_VER > 0 && __STDC__
24 #define NO_OLDNAMES
25 #endif
26
27 /** Properties ***************************************************************/
28
29 #undef _CRT_PACKING
30 #define _CRT_PACKING 8
31 #pragma pack(push,_CRT_PACKING)
32
33 #ifndef _CRT_STRINGIZE
34 #define __CRT_STRINGIZE(_Value) #_Value
35 #define _CRT_STRINGIZE(_Value) __CRT_STRINGIZE(_Value)
36 #endif
37
38 #ifndef _CRT_WIDE
39 #define __CRT_WIDE(_String) L ## _String
40 #define _CRT_WIDE(_String) __CRT_WIDE(_String)
41 #endif
42
43 #ifndef _W64
44 #if !defined(_midl) && defined(_X86_) && _MSC_VER >= 1300
45 #define _W64 __w64
46 #else
47 #define _W64
48 #endif
49 #endif
50
51 #ifndef _CRTIMP
52 #ifdef _DLL
53 #define _CRTIMP __declspec(dllimport)
54 #else
55 #define _CRTIMP
56 #endif
57 #endif
58
59 //#define _CRT_ALTERNATIVE_INLINES
60
61 #ifndef _CRTIMP_ALT
62 #ifdef _DLL
63 #ifdef _CRT_ALTERNATIVE_INLINES
64 #define _CRTIMP_ALT
65 #else
66 #define _CRTIMP_ALT _CRTIMP
67 #define _CRT_ALTERNATIVE_IMPORTED
68 #endif
69 #else
70 #define _CRTIMP_ALT
71 #endif
72 #endif
73
74 #ifndef _CRTDATA
75 #ifdef _M_CEE_PURE
76 #define _CRTDATA(x) x
77 #else
78 #define _CRTDATA(x) _CRTIMP x
79 #endif
80 #endif
81
82 #ifndef _CRTIMP2
83 #define _CRTIMP2 _CRTIMP
84 #endif
85
86 #ifndef _CRTIMP_PURE
87 #define _CRTIMP_PURE _CRTIMP
88 #endif
89
90 #ifndef _CRTIMP_ALTERNATIVE
91 #define _CRTIMP_ALTERNATIVE _CRTIMP
92 #define _CRT_ALTERNATIVE_IMPORTED
93 #endif
94
95 #ifndef _CRTIMP_NOIA64
96 #ifdef __ia64__
97 #define _CRTIMP_NOIA64
98 #else
99 #define _CRTIMP_NOIA64 _CRTIMP
100 #endif
101 #endif
102
103 #ifndef _MRTIMP2
104 #define _MRTIMP2 _CRTIMP
105 #endif
106
107 #ifndef _MCRTIMP
108 #define _MCRTIMP _CRTIMP
109 #endif
110
111 #ifndef _PGLOBAL
112 #define _PGLOBAL
113 #endif
114
115 #ifndef _AGLOBAL
116 #define _AGLOBAL
117 #endif
118
119 #ifndef _CONST_RETURN
120 #define _CONST_RETURN
121 #endif
122
123 #ifndef UNALIGNED
124 #if defined(__ia64__) || defined(__x86_64)
125 #define UNALIGNED __unaligned
126 #else
127 #define UNALIGNED
128 #endif
129 #endif
130
131 #ifndef _CRT_ALIGN
132 #define _CRT_ALIGN(x) __attribute__ ((aligned(x)))
133 #endif
134
135 #ifndef _CRTNOALIAS
136 #define _CRTNOALIAS
137 #endif
138
139 #ifndef _CRTRESTRICT
140 #define _CRTRESTRICT
141 #endif
142
143 #ifndef __CRTDECL
144 #define __CRTDECL __cdecl
145 #endif
146
147 #ifndef _CRT_UNUSED
148 #define _CRT_UNUSED(x) (void)x
149 #endif
150
151 #ifndef _CONST_RETURN
152 #ifdef __cplusplus
153 #define _CONST_RETURN const
154 #define _CRT_CONST_CORRECT_OVERLOADS
155 #else
156 #define _CONST_RETURN
157 #endif
158 #endif
159
160 #define __crt_typefix(ctype)
161
162
163 /** Deprecated ***************************************************************/
164
165 #define _CRT_DEPRECATE_TEXT(_Text) __declspec(deprecated)
166
167 #ifndef _CRT_INSECURE_DEPRECATE
168 # ifdef _CRT_SECURE_NO_DEPRECATE
169 # define _CRT_INSECURE_DEPRECATE(_Replacement)
170 # else
171 # define _CRT_INSECURE_DEPRECATE(_Replacement) \
172 _CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead!")
173 # endif
174 #endif
175
176 #ifndef _CRT_INSECURE_DEPRECATE_CORE
177 # ifdef _CRT_SECURE_NO_DEPRECATE_CORE
178 # define _CRT_INSECURE_DEPRECATE_CORE(_Replacement)
179 # else
180 # define _CRT_INSECURE_DEPRECATE_CORE(_Replacement) \
181 _CRT_DEPRECATE_TEXT("This may be unsafe, Try " #_Replacement " instead! Enable _CRT_SECURE_NO_DEPRECATE to avoid thie warning.")
182 # endif
183 #endif
184
185 #ifndef _CRT_NONSTDC_DEPRECATE
186 # ifdef _CRT_NONSTDC_NO_DEPRECATE
187 # define _CRT_NONSTDC_DEPRECATE(_Replacement)
188 # else
189 # define _CRT_NONSTDC_DEPRECATE(_Replacement) \
190 _CRT_DEPRECATE_TEXT("Deprecated POSIX name, Try " #_Replacement " instead!")
191 # endif
192 #endif
193
194 #ifndef _CRT_INSECURE_DEPRECATE_MEMORY
195 #define _CRT_INSECURE_DEPRECATE_MEMORY(_Replacement)
196 #endif
197
198 #ifndef _CRT_INSECURE_DEPRECATE_GLOBALS
199 #define _CRT_INSECURE_DEPRECATE_GLOBALS(_Replacement)
200 #endif
201
202 #ifndef _CRT_MANAGED_HEAP_DEPRECATE
203 #define _CRT_MANAGED_HEAP_DEPRECATE
204 #endif
205
206 #ifndef _CRT_OBSOLETE
207 #define _CRT_OBSOLETE(_NewItem)
208 #endif
209
210 /** Constants ****************************************************************/
211
212 #define _ARGMAX 100
213
214 #ifndef _TRUNCATE
215 #define _TRUNCATE ((size_t)-1)
216 #endif
217
218 #define __STDC_SECURE_LIB__ 200411L
219 #define __GOT_SECURE_LIB__ __STDC_SECURE_LIB__
220 #define _SECURECRT_FILL_BUFFER_PATTERN 0xFD
221
222
223
224 /** Type definitions *********************************************************/
225
226 #ifdef __cplusplus
227 extern "C" {
228 #endif
229
230 #ifndef _SIZE_T_DEFINED
231 #define _SIZE_T_DEFINED
232 #undef size_t
233 #ifdef _WIN64
234 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
235 typedef unsigned int size_t __attribute__ ((mode (DI)));
236 #else
237 typedef unsigned __int64 size_t;
238 #endif
239 #else
240 typedef unsigned int size_t;
241 #endif
242 #endif
243
244 #ifndef _INTPTR_T_DEFINED
245 #define _INTPTR_T_DEFINED
246 #ifndef __intptr_t_defined
247 #define __intptr_t_defined
248 #undef intptr_t
249 #ifdef _WIN64
250 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
251 typedef int intptr_t __attribute__ ((mode (DI)));
252 #else
253 typedef __int64 intptr_t;
254 #endif
255 #else
256 typedef int intptr_t;
257 #endif
258 #endif
259 #endif
260
261 #ifndef _UINTPTR_T_DEFINED
262 #define _UINTPTR_T_DEFINED
263 #ifndef __uintptr_t_defined
264 #define __uintptr_t_defined
265 #undef uintptr_t
266 #ifdef _WIN64
267 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
268 typedef unsigned int uintptr_t __attribute__ ((mode (DI)));
269 #else
270 typedef unsigned __int64 uintptr_t;
271 #endif
272 #else
273 typedef unsigned int uintptr_t;
274 #endif
275 #endif
276 #endif
277
278 #ifndef _PTRDIFF_T_DEFINED
279 #define _PTRDIFF_T_DEFINED
280 #ifndef _PTRDIFF_T_
281 #undef ptrdiff_t
282 #ifdef _WIN64
283 #if defined(__GNUC__) && defined(__STRICT_ANSI__)
284 typedef int ptrdiff_t __attribute__ ((mode (DI)));
285 #else
286 typedef __int64 ptrdiff_t;
287 #endif
288 #else
289 typedef int ptrdiff_t;
290 #endif
291 #endif
292 #endif
293
294 #ifndef _WCHAR_T_DEFINED
295 #define _WCHAR_T_DEFINED
296 #ifndef __cplusplus
297 typedef unsigned short wchar_t;
298 #endif
299 #endif
300
301 #ifndef _WCTYPE_T_DEFINED
302 #define _WCTYPE_T_DEFINED
303 typedef unsigned short wint_t;
304 typedef unsigned short wctype_t;
305 #endif
306
307 #ifndef _ERRCODE_DEFINED
308 #define _ERRCODE_DEFINED
309 typedef int errcode;
310 typedef int errno_t;
311 #endif
312
313 #ifndef _TIME32_T_DEFINED
314 #define _TIME32_T_DEFINED
315 typedef long __time32_t;
316 #endif
317
318 #ifndef _TIME64_T_DEFINED
319 #define _TIME64_T_DEFINED
320 #if _INTEGRAL_MAX_BITS >= 64
321 typedef __int64 __time64_t;
322 #endif
323 #endif
324
325 #ifndef _TIME_T_DEFINED
326 #define _TIME_T_DEFINED
327 #ifdef _USE_32BIT_TIME_T
328 typedef __time32_t time_t;
329 #else
330 typedef __time64_t time_t;
331 #endif
332 #endif
333
334 struct threadlocaleinfostruct;
335 typedef struct threadlocaleinfostruct *pthreadlocinfo;
336
337 struct threadmbcinfostruct;
338 typedef struct threadmbcinfostruct *pthreadmbcinfo;
339
340 struct __lc_time_data;
341
342 typedef struct localeinfo_struct {
343 pthreadlocinfo locinfo;
344 pthreadmbcinfo mbcinfo;
345 } _locale_tstruct,*_locale_t;
346
347 #ifndef _TAGLC_ID_DEFINED
348 #define _TAGLC_ID_DEFINED
349 typedef struct tagLC_ID {
350 unsigned short wLanguage;
351 unsigned short wCountry;
352 unsigned short wCodePage;
353 } LC_ID,*LPLC_ID;
354 #endif
355
356 #ifndef _THREADLOCALEINFO
357 #define _THREADLOCALEINFO
358 typedef struct threadlocaleinfostruct {
359 int refcount;
360 unsigned int lc_codepage;
361 unsigned int lc_collate_cp;
362 unsigned long lc_handle[6];
363 LC_ID lc_id[6];
364 struct {
365 char *locale;
366 wchar_t *wlocale;
367 int *refcount;
368 int *wrefcount;
369 } lc_category[6];
370 int lc_clike;
371 int mb_cur_max;
372 int *lconv_intl_refcount;
373 int *lconv_num_refcount;
374 int *lconv_mon_refcount;
375 struct lconv *lconv;
376 int *ctype1_refcount;
377 unsigned short *ctype1;
378 const unsigned short *pctype;
379 const unsigned char *pclmap;
380 const unsigned char *pcumap;
381 struct __lc_time_data *lc_time_curr;
382 } threadlocinfo;
383 #endif
384
385
386 #ifdef __cplusplus
387 }
388 #endif
389
390 #pragma pack(pop)
391
392 #endif /* !_INC_CRTDEFS */