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