Sync with trunk (48237)
[reactos.git] / include / crt / stdlib.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 #ifndef _INC_STDLIB
7 #define _INC_STDLIB
8
9 #include <crtdefs.h>
10 #include <limits.h>
11
12 #pragma pack(push,_CRT_PACKING)
13
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17
18 #ifndef NULL
19 #ifdef __cplusplus
20 #ifndef _WIN64
21 #define NULL 0
22 #else
23 #define NULL 0LL
24 #endif /* W64 */
25 #else
26 #define NULL ((void *)0)
27 #endif
28 #endif
29
30 #define EXIT_SUCCESS 0
31 #define EXIT_FAILURE 1
32
33 #ifndef _ONEXIT_T_DEFINED
34 #define _ONEXIT_T_DEFINED
35
36 typedef int (__cdecl *_onexit_t)(void);
37
38 #ifndef NO_OLDNAMES
39 #define onexit_t _onexit_t
40 #endif
41 #endif
42
43 #ifndef _DIV_T_DEFINED
44 #define _DIV_T_DEFINED
45
46 typedef struct _div_t {
47 int quot;
48 int rem;
49 } div_t;
50
51 typedef struct _ldiv_t {
52 long quot;
53 long rem;
54 } ldiv_t;
55 #endif
56
57 #ifndef _CRT_DOUBLE_DEC
58 #define _CRT_DOUBLE_DEC
59
60 #pragma pack(4)
61 typedef struct {
62 unsigned char ld[10];
63 } _LDOUBLE;
64 #pragma pack()
65
66 #define _PTR_LD(x) ((unsigned char *)(&(x)->ld))
67
68 typedef struct {
69 double x;
70 } _CRT_DOUBLE;
71
72 typedef struct {
73 float f;
74 } _CRT_FLOAT;
75 #if __MINGW_GNUC_PREREQ(4,4)
76 #pragma push_macro("long")
77 #undef long
78 #endif
79
80 typedef struct {
81 long double x;
82 } _LONGDOUBLE;
83
84 #if __MINGW_GNUC_PREREQ(4,4)
85 #pragma pop_macro("long")
86 #endif
87
88 #pragma pack(4)
89 typedef struct {
90 unsigned char ld12[12];
91 } _LDBL12;
92 #pragma pack()
93 #endif
94
95 #define RAND_MAX 0x7fff
96
97 #ifndef MB_CUR_MAX
98 #define MB_CUR_MAX ___mb_cur_max_func()
99 #ifdef _M_CEE_PURE
100 _CRTIMP int* __cdecl __p___mb_cur_max();
101 #define __mb_cur_max (*__p___mb_cur_max())
102 #else /* !_M_CEE_PURE */
103 _CRTIMP extern int __mb_cur_max;
104 #endif /* !_M_CEE_PURE */
105 _CRTIMP int __cdecl ___mb_cur_max_func(void);
106 _CRTIMP int __cdecl ___mb_cur_max_l_func(_locale_t);
107 #endif /* !MB_CUR_MAX */
108
109 #define __max(a,b) (((a) > (b)) ? (a) : (b))
110 #define __min(a,b) (((a) < (b)) ? (a) : (b))
111
112 #define _MAX_PATH 260
113 #define _MAX_DRIVE 3
114 #define _MAX_DIR 256
115 #define _MAX_FNAME 256
116 #define _MAX_EXT 256
117
118 #define _OUT_TO_DEFAULT 0
119 #define _OUT_TO_STDERR 1
120 #define _OUT_TO_MSGBOX 2
121 #define _REPORT_ERRMODE 3
122
123 #define _WRITE_ABORT_MSG 0x1
124 #define _CALL_REPORTFAULT 0x2
125
126 #define _MAX_ENV 32767
127
128 typedef void (__cdecl *_purecall_handler)(void);
129
130 _CRTIMP _purecall_handler __cdecl _set_purecall_handler(_purecall_handler _Handler);
131 _CRTIMP _purecall_handler __cdecl _get_purecall_handler(void);
132
133 typedef void (__cdecl *_invalid_parameter_handler)(const wchar_t *,const wchar_t *,const wchar_t *,unsigned int,uintptr_t);
134 _invalid_parameter_handler __cdecl _set_invalid_parameter_handler(_invalid_parameter_handler _Handler);
135 _invalid_parameter_handler __cdecl _get_invalid_parameter_handler(void);
136
137 #ifndef _CRT_ERRNO_DEFINED
138 #define _CRT_ERRNO_DEFINED
139 _CRTIMP extern int *__cdecl _errno(void);
140 #define errno (*_errno())
141 errno_t __cdecl _set_errno(int _Value);
142 errno_t __cdecl _get_errno(int *_Value);
143 #endif
144 _CRTIMP unsigned long *__cdecl __doserrno(void);
145 #define _doserrno (*__doserrno())
146 errno_t __cdecl _set_doserrno(unsigned long _Value);
147 errno_t __cdecl _get_doserrno(unsigned long *_Value);
148
149 _CRTIMP extern char *_sys_errlist[];
150 _CRTIMP extern int _sys_nerr;
151
152 #if defined(_DLL) && defined(_M_IX86)
153 _CRTIMP int *__cdecl __p___argc(void);
154 _CRTIMP char ***__cdecl __p___argv(void);
155 _CRTIMP wchar_t ***__cdecl __p___wargv(void);
156 _CRTIMP char ***__cdecl __p__environ(void);
157 _CRTIMP wchar_t ***__cdecl __p__wenviron(void);
158 _CRTIMP char **__cdecl __p__pgmptr(void);
159 _CRTIMP wchar_t **__cdecl __p__wpgmptr(void);
160 #endif
161
162 // FIXME: move inside _M_CEE_PURE section
163 _CRTIMP int *__cdecl __p___argc();
164 _CRTIMP char ***__cdecl __p___argv();
165 _CRTIMP wchar_t ***__cdecl __p___wargv();
166 _CRTIMP char ***__cdecl __p__environ();
167 _CRTIMP wchar_t ***__cdecl __p__wenviron();
168 _CRTIMP char **__cdecl __p__pgmptr();
169 _CRTIMP wchar_t **__cdecl __p__wpgmptr();
170
171 #ifdef _M_CEE_PURE
172 #define __argv (*__p___argv())
173 #define __argc (*__p___argc())
174 #define __wargv (*__p___wargv())
175 #define _environ (*__p__environ())
176 #define _wenviron (*__p__wenviron())
177 #define _pgmptr (*__p__pgmptr())
178 #define _wpgmptr (*__p__wpgmptr())
179 #else /* !_M_CEE_PURE */
180 _CRTIMP extern int __argc;
181 _CRTIMP extern char **__argv;
182 _CRTIMP extern wchar_t **__wargv;
183 _CRTIMP extern char **_environ;
184 _CRTIMP extern wchar_t **_wenviron;
185 _CRTIMP extern char *_pgmptr;
186 _CRTIMP extern wchar_t *_wpgmptr;
187 #endif /* !_M_CEE_PURE */
188
189 _CRTIMP errno_t __cdecl _get_environ(char***);
190 _CRTIMP errno_t __cdecl _get_wenviron(wchar_t***);
191 _CRTIMP errno_t __cdecl _get_pgmptr(char **_Value);
192 _CRTIMP errno_t __cdecl _get_wpgmptr(wchar_t **_Value);
193
194 #ifdef _M_CEE_PURE
195 _CRTIMP int* __cdecl __p__fmode();
196 #define _fmode (*__p__fmode())
197 #else
198 _CRTIMP extern int _fmode;
199 #endif /* !_M_CEE_PURE */
200 _CRTIMP errno_t __cdecl _set_fmode(int _Mode);
201 _CRTIMP errno_t __cdecl _get_fmode(int *_PMode);
202
203 #ifdef _M_CEE_PURE
204 _CRTIMP unsigned int* __cdecl __p__osplatform();
205 _CRTIMP unsigned int* __cdecl __p__osver();
206 _CRTIMP unsigned int* __cdecl __p__winver();
207 _CRTIMP unsigned int* __cdecl __p__winmajor();
208 _CRTIMP unsigned int* __cdecl __p__winminor();
209 #define _osplatform (*__p__osplatform())
210 #define _osver (*__p__osver())
211 #define _winver (*__p__winver())
212 #define _winmajor (*__p__winmajor())
213 #define _winminor (*__p__winminor())
214 #else /* !_M_CEE_PURE */
215 _CRTIMP extern unsigned int _osplatform;
216 _CRTIMP extern unsigned int _osver;
217 _CRTIMP extern unsigned int _winver;
218 _CRTIMP extern unsigned int _winmajor;
219 _CRTIMP extern unsigned int _winminor;
220 #endif /* !_M_CEE_PURE */
221
222 errno_t __cdecl _get_osplatform(unsigned int *_Value);
223 errno_t __cdecl _get_osver(unsigned int *_Value);
224 errno_t __cdecl _get_winver(unsigned int *_Value);
225 errno_t __cdecl _get_winmajor(unsigned int *_Value);
226 errno_t __cdecl _get_winminor(unsigned int *_Value);
227
228 #ifndef _countof
229 #ifndef __cplusplus
230 #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
231 #else
232 extern "C++" {
233 template <typename _CountofType,size_t _SizeOfArray>
234 char (*__countof_helper(/*UNALIGNED*/ _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
235 #define _countof(_Array) sizeof(*__countof_helper(_Array))
236 }
237 #endif
238 #endif
239
240 #ifndef _CRT_TERMINATE_DEFINED
241 #define _CRT_TERMINATE_DEFINED
242 __declspec(noreturn) void __cdecl exit(int _Code);
243 _CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code);
244 #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
245 /* C99 function name */
246 __declspec(noreturn) void __cdecl _Exit(int); /* Declare to get noreturn attribute. */
247 __CRT_INLINE void __cdecl _Exit(int status)
248 { _exit(status); }
249 #endif
250 #if __MINGW_GNUC_PREREQ(4,4)
251 #pragma push_macro("abort")
252 #undef abort
253 #endif
254 __declspec(noreturn) void __cdecl abort(void);
255 #if __MINGW_GNUC_PREREQ(4,4)
256 #pragma pop_macro("abort")
257 #endif
258 #endif
259
260 _CRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int _Flags,unsigned int _Mask);
261
262 #ifndef _CRT_ABS_DEFINED
263 #define _CRT_ABS_DEFINED
264 int __cdecl abs(int _X);
265 long __cdecl labs(long _X);
266 #endif
267
268 #if _INTEGRAL_MAX_BITS >= 64
269 __MINGW_EXTENSION __int64 __cdecl _abs64(__int64);
270 #endif
271 int __cdecl atexit(void (__cdecl *)(void));
272 #ifndef _CRT_ATOF_DEFINED
273 #define _CRT_ATOF_DEFINED
274 double __cdecl atof(const char *_String);
275 double __cdecl _atof_l(const char *_String,_locale_t _Locale);
276 #endif
277 int __cdecl atoi(const char *_Str);
278 _CRTIMP int __cdecl _atoi_l(const char *_Str,_locale_t _Locale);
279 long __cdecl atol(const char *_Str);
280 _CRTIMP long __cdecl _atol_l(const char *_Str,_locale_t _Locale);
281 #ifndef _CRT_ALGO_DEFINED
282 #define _CRT_ALGO_DEFINED
283 void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
284 void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
285 #endif
286
287 #if !defined(__GNUC__) && !defined(__clang)
288 unsigned short __cdecl _byteswap_ushort(unsigned short _Short);
289 unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
290 #if _INTEGRAL_MAX_BITS >= 64
291 __MINGW_EXTENSION unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64);
292 #endif
293 #endif
294
295 div_t __cdecl div(int _Numerator,int _Denominator);
296 char *__cdecl getenv(const char *_VarName);
297 _CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix);
298 #if _INTEGRAL_MAX_BITS >= 64
299 __MINGW_EXTENSION _CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix);
300 __MINGW_EXTENSION _CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix);
301 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _atoi64(const char *_String);
302 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _atoi64_l(const char *_String,_locale_t _Locale);
303 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _strtoi64(const char *_String,char **_EndPtr,int _Radix);
304 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
305 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix);
306 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
307 #endif
308 ldiv_t __cdecl ldiv(long _Numerator,long _Denominator);
309 _CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix);
310 int __cdecl mblen(const char *_Ch,size_t _MaxCount);
311 _CRTIMP int __cdecl _mblen_l(const char *_Ch,size_t _MaxCount,_locale_t _Locale);
312 _CRTIMP size_t __cdecl _mbstrlen(const char *_Str);
313 _CRTIMP size_t __cdecl _mbstrlen_l(const char *_Str,_locale_t _Locale);
314 _CRTIMP size_t __cdecl _mbstrnlen(const char *_Str,size_t _MaxCount);
315 _CRTIMP size_t __cdecl _mbstrnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale);
316 int __cdecl mbtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes);
317 _CRTIMP int __cdecl _mbtowc_l(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes,_locale_t _Locale);
318 size_t __cdecl mbstowcs(wchar_t *_Dest,const char *_Source,size_t _MaxCount);
319 _CRTIMP size_t __cdecl _mbstowcs_l(wchar_t *_Dest,const char *_Source,size_t _MaxCount,_locale_t _Locale);
320 int __cdecl rand(void);
321 _CRTIMP int __cdecl _set_error_mode(int _Mode);
322 void __cdecl srand(unsigned int _Seed);
323 double __cdecl strtod(const char *_Str,char **_EndPtr);
324 float __cdecl strtof(const char *nptr, char **endptr);
325 #if !defined __NO_ISOCEXT /* in libmingwex.a */
326 float __cdecl strtof (const char * __restrict__, char ** __restrict__);
327 long double __cdecl strtold(const char * __restrict__, char ** __restrict__);
328 #endif /* __NO_ISOCEXT */
329 _CRTIMP double __cdecl _strtod_l(const char *_Str,char **_EndPtr,_locale_t _Locale);
330 long __cdecl strtol(const char *_Str,char **_EndPtr,int _Radix);
331 _CRTIMP long __cdecl _strtol_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale);
332 unsigned long __cdecl strtoul(const char *_Str,char **_EndPtr,int _Radix);
333 _CRTIMP unsigned long __cdecl _strtoul_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale);
334 #ifndef _CRT_SYSTEM_DEFINED
335 #define _CRT_SYSTEM_DEFINED
336 int __cdecl system(const char *_Command);
337 #endif
338 _CRTIMP char *__cdecl _ultoa(unsigned long _Value,char *_Dest,int _Radix);
339 int __cdecl wctomb(char *_MbCh,wchar_t _WCh);
340 _CRTIMP int __cdecl _wctomb_l(char *_MbCh,wchar_t _WCh,_locale_t _Locale);
341 size_t __cdecl wcstombs(char *_Dest,const wchar_t *_Source,size_t _MaxCount);
342 _CRTIMP size_t __cdecl _wcstombs_l(char *_Dest,const wchar_t *_Source,size_t _MaxCount,_locale_t _Locale);
343
344 #ifndef _CRT_ALLOCATION_DEFINED
345 #define _CRT_ALLOCATION_DEFINED
346 void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements);
347 void __cdecl free(void *_Memory);
348 void *__cdecl malloc(size_t _Size);
349 void *__cdecl realloc(void *_Memory,size_t _NewSize);
350 _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size);
351 //_CRTIMP void __cdecl _aligned_free(void *_Memory);
352 //_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment);
353 _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset);
354 _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment);
355 _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment);
356 _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset);
357 _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset);
358 #endif
359
360 #ifndef _WSTDLIB_DEFINED
361 #define _WSTDLIB_DEFINED
362
363 _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix);
364 _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix);
365 _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix);
366 double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr);
367 float __cdecl wcstof(const wchar_t *nptr, wchar_t **endptr);
368 #if !defined __NO_ISOCEXT /* in libmingwex.a */
369 float __cdecl wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__);
370 long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__);
371 #endif /* __NO_ISOCEXT */
372 _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale);
373 long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
374 _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
375 unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
376 _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
377 _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName);
378 #ifndef _CRT_WSYSTEM_DEFINED
379 #define _CRT_WSYSTEM_DEFINED
380 _CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
381 #endif
382 _CRTIMP double __cdecl _wtof(const wchar_t *_Str);
383 _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale);
384 _CRTIMP int __cdecl _wtoi(const wchar_t *_Str);
385 _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale);
386 _CRTIMP long __cdecl _wtol(const wchar_t *_Str);
387 _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale);
388
389 #if _INTEGRAL_MAX_BITS >= 64
390 __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix);
391 __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix);
392 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str);
393 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale);
394 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
395 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
396 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
397 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
398 #endif
399 #endif
400
401 #ifndef _POSIX_
402 #define _CVTBUFSIZE (309+40)
403 _CRTIMP char *__cdecl _fullpath(char *_FullPath,const char *_Path,size_t _SizeInBytes);
404 _CRTIMP char *__cdecl _ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign);
405 _CRTIMP char *__cdecl _fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign);
406 _CRTIMP char *__cdecl _gcvt(double _Val,int _NumOfDigits,char *_DstBuf);
407 _CRTIMP int __cdecl _atodbl(_CRT_DOUBLE *_Result,char *_Str);
408 _CRTIMP int __cdecl _atoldbl(_LDOUBLE *_Result,char *_Str);
409 _CRTIMP int __cdecl _atoflt(_CRT_FLOAT *_Result,char *_Str);
410 _CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale);
411 _CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale);
412 _CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale);
413 unsigned long __cdecl _lrotl(unsigned long _Val,int _Shift);
414 unsigned long __cdecl _lrotr(unsigned long _Val,int _Shift);
415 _CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext);
416 _onexit_t __cdecl _onexit(_onexit_t _Func);
417
418 #ifndef _CRT_PERROR_DEFINED
419 #define _CRT_PERROR_DEFINED
420 void __cdecl perror(const char *_ErrMsg);
421 #endif
422 _CRTIMP int __cdecl _putenv(const char *_EnvString);
423 #if !defined(__GNUC__) && !defined(__clang)
424 unsigned int __cdecl _rotl(unsigned int _Val,int _Shift);
425 #if _INTEGRAL_MAX_BITS >= 64
426 __MINGW_EXTENSION unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val,int _Shift);
427 #endif
428 unsigned int __cdecl _rotr(unsigned int _Val,int _Shift);
429 #if _INTEGRAL_MAX_BITS >= 64
430 __MINGW_EXTENSION unsigned __int64 __cdecl _rotr64(unsigned __int64 _Val,int _Shift);
431 #endif
432 #endif
433 _CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath);
434 _CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext);
435 _CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes);
436
437 #ifndef _WSTDLIBP_DEFINED
438 #define _WSTDLIBP_DEFINED
439 _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords);
440 _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext);
441 #ifndef _CRT_WPERROR_DEFINED
442 #define _CRT_WPERROR_DEFINED
443 _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
444 #endif
445 _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString);
446 _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath);
447 _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext);
448 #endif
449
450 _CRTIMP void __cdecl _beep(unsigned _Frequency,unsigned _Duration) __MINGW_ATTRIB_DEPRECATED;
451 /* Not to be confused with _set_error_mode (int). */
452 _CRTIMP void __cdecl _seterrormode(int _Mode) __MINGW_ATTRIB_DEPRECATED;
453 _CRTIMP void __cdecl _sleep(unsigned long _Duration) __MINGW_ATTRIB_DEPRECATED;
454 #endif
455
456 #ifndef NO_OLDNAMES
457 #ifndef _POSIX_
458 #if 0
459 #ifndef __cplusplus
460 #ifndef NOMINMAX
461 #ifndef max
462 #define max(a,b) (((a) > (b)) ? (a) : (b))
463 #endif
464 #ifndef min
465 #define min(a,b) (((a) < (b)) ? (a) : (b))
466 #endif
467 #endif
468 #endif
469 #endif
470
471 #define sys_errlist _sys_errlist
472 #define sys_nerr _sys_nerr
473 #define environ _environ
474 _CRTIMP char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign);
475 _CRTIMP char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign);
476 _CRTIMP char *__cdecl gcvt(double _Val,int _NumOfDigits,char *_DstBuf);
477 _CRTIMP char *__cdecl itoa(int _Val,char *_DstBuf,int _Radix);
478 _CRTIMP char *__cdecl ltoa(long _Val,char *_DstBuf,int _Radix);
479 _CRTIMP int __cdecl putenv(const char *_EnvString);
480 _CRTIMP void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes);
481 _CRTIMP char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix);
482 onexit_t __cdecl onexit(onexit_t _Func);
483 #endif
484 #endif
485
486 #if !defined __NO_ISOCEXT /* externs in static libmingwex.a */
487
488 __MINGW_EXTENSION typedef struct { long long quot, rem; } lldiv_t;
489
490 __MINGW_EXTENSION lldiv_t __cdecl lldiv(long long, long long);
491
492 __MINGW_EXTENSION __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); }
493
494 __MINGW_EXTENSION long long __cdecl strtoll(const char* __restrict__, char** __restrict, int);
495 __MINGW_EXTENSION unsigned long long __cdecl strtoull(const char* __restrict__, char** __restrict__, int);
496
497 /* these are stubs for MS _i64 versions */
498 __MINGW_EXTENSION long long __cdecl atoll (const char *);
499
500 #ifndef __STRICT_ANSI__
501 __MINGW_EXTENSION long long __cdecl wtoll (const wchar_t *);
502 __MINGW_EXTENSION char *__cdecl lltoa (long long, char *, int);
503 __MINGW_EXTENSION char *__cdecl ulltoa (unsigned long long , char *, int);
504 __MINGW_EXTENSION wchar_t *__cdecl lltow (long long, wchar_t *, int);
505 __MINGW_EXTENSION wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int);
506
507 /* __CRT_INLINE using non-ansi functions */
508 __MINGW_EXTENSION __CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); }
509 __MINGW_EXTENSION __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); }
510 __MINGW_EXTENSION __CRT_INLINE char *__cdecl ulltoa (unsigned long long _n, char * _c, int _i) { return _ui64toa (_n, _c, _i); }
511 __MINGW_EXTENSION __CRT_INLINE long long __cdecl wtoll (const wchar_t * _w) { return _wtoi64 (_w); }
512 __MINGW_EXTENSION __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); }
513 __MINGW_EXTENSION __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); }
514 #endif /* (__STRICT_ANSI__) */
515
516 #endif /* !__NO_ISOCEXT */
517
518 #ifdef __cplusplus
519 }
520 #endif
521
522 #pragma pack(pop)
523
524 #include <sec_api/stdlib_s.h>
525 #endif