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