475bf924342c1e1802fbd1e851b8c4be000f5d3c
[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 #include <errno.h>
138 _CRTIMP unsigned long *__cdecl __doserrno(void);
139 #define _doserrno (*__doserrno())
140 errno_t __cdecl _set_doserrno(unsigned long _Value);
141 errno_t __cdecl _get_doserrno(unsigned long *_Value);
142
143 _CRTIMP extern char *_sys_errlist[];
144 _CRTIMP extern int _sys_nerr;
145
146 #if defined(_DLL) && defined(_M_IX86)
147 _CRTIMP int *__cdecl __p___argc(void);
148 _CRTIMP char ***__cdecl __p___argv(void);
149 _CRTIMP wchar_t ***__cdecl __p___wargv(void);
150 _CRTIMP char ***__cdecl __p__environ(void);
151 _CRTIMP wchar_t ***__cdecl __p__wenviron(void);
152 _CRTIMP char **__cdecl __p__pgmptr(void);
153 _CRTIMP wchar_t **__cdecl __p__wpgmptr(void);
154 #endif
155
156 // FIXME: move inside _M_CEE_PURE section
157 _CRTIMP int *__cdecl __p___argc();
158 _CRTIMP char ***__cdecl __p___argv();
159 _CRTIMP wchar_t ***__cdecl __p___wargv();
160 _CRTIMP char ***__cdecl __p__environ();
161 _CRTIMP wchar_t ***__cdecl __p__wenviron();
162 _CRTIMP char **__cdecl __p__pgmptr();
163 _CRTIMP wchar_t **__cdecl __p__wpgmptr();
164
165 #ifdef _M_CEE_PURE
166 #define __argv (*__p___argv())
167 #define __argc (*__p___argc())
168 #define __wargv (*__p___wargv())
169 #define _environ (*__p__environ())
170 #define _wenviron (*__p__wenviron())
171 #define _pgmptr (*__p__pgmptr())
172 #define _wpgmptr (*__p__wpgmptr())
173 #else /* !_M_CEE_PURE */
174 _CRTIMP extern int __argc;
175 _CRTIMP extern char **__argv;
176 _CRTIMP extern wchar_t **__wargv;
177 _CRTIMP extern char **_environ;
178 _CRTIMP extern wchar_t **_wenviron;
179 _CRTIMP extern char *_pgmptr;
180 _CRTIMP extern wchar_t *_wpgmptr;
181 #endif /* !_M_CEE_PURE */
182
183 _CRTIMP errno_t __cdecl _get_environ(char***);
184 _CRTIMP errno_t __cdecl _get_wenviron(wchar_t***);
185 _CRTIMP errno_t __cdecl _get_pgmptr(char **_Value);
186 _CRTIMP errno_t __cdecl _get_wpgmptr(wchar_t **_Value);
187
188 #ifdef _M_CEE_PURE
189 _CRTIMP int* __cdecl __p__fmode();
190 #define _fmode (*__p__fmode())
191 #else
192 _CRTIMP extern int _fmode;
193 #endif /* !_M_CEE_PURE */
194 _CRTIMP errno_t __cdecl _set_fmode(int _Mode);
195 _CRTIMP errno_t __cdecl _get_fmode(int *_PMode);
196
197 #ifdef _M_CEE_PURE
198 _CRTIMP unsigned int* __cdecl __p__osplatform();
199 _CRTIMP unsigned int* __cdecl __p__osver();
200 _CRTIMP unsigned int* __cdecl __p__winver();
201 _CRTIMP unsigned int* __cdecl __p__winmajor();
202 _CRTIMP unsigned int* __cdecl __p__winminor();
203 #define _osplatform (*__p__osplatform())
204 #define _osver (*__p__osver())
205 #define _winver (*__p__winver())
206 #define _winmajor (*__p__winmajor())
207 #define _winminor (*__p__winminor())
208 #else /* !_M_CEE_PURE */
209 _CRTIMP extern unsigned int _osplatform;
210 _CRTIMP extern unsigned int _osver;
211 _CRTIMP extern unsigned int _winver;
212 _CRTIMP extern unsigned int _winmajor;
213 _CRTIMP extern unsigned int _winminor;
214 #endif /* !_M_CEE_PURE */
215
216 errno_t __cdecl _get_osplatform(unsigned int *_Value);
217 errno_t __cdecl _get_osver(unsigned int *_Value);
218 errno_t __cdecl _get_winver(unsigned int *_Value);
219 errno_t __cdecl _get_winmajor(unsigned int *_Value);
220 errno_t __cdecl _get_winminor(unsigned int *_Value);
221
222 #ifndef _countof
223 #ifndef __cplusplus
224 #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
225 #else
226 extern "C++" {
227 template <typename _CountofType,size_t _SizeOfArray>
228 char (*__countof_helper(/*UNALIGNED*/ _CountofType (&_Array)[_SizeOfArray]))[_SizeOfArray];
229 #define _countof(_Array) sizeof(*__countof_helper(_Array))
230 }
231 #endif
232 #endif
233
234 #ifndef _CRT_TERMINATE_DEFINED
235 #define _CRT_TERMINATE_DEFINED
236 __declspec(noreturn) void __cdecl exit(int _Code);
237 _CRTIMP __declspec(noreturn) void __cdecl _exit(int _Code);
238 #if !defined __NO_ISOCEXT /* extern stub in static libmingwex.a */
239 /* C99 function name */
240 __declspec(noreturn) void __cdecl _Exit(int); /* Declare to get noreturn attribute. */
241 __CRT_INLINE void __cdecl _Exit(int status)
242 { _exit(status); }
243 #endif
244 #if __MINGW_GNUC_PREREQ(4,4)
245 #pragma push_macro("abort")
246 #undef abort
247 #endif
248 __declspec(noreturn) void __cdecl abort(void);
249 #if __MINGW_GNUC_PREREQ(4,4)
250 #pragma pop_macro("abort")
251 #endif
252 #endif
253
254 _CRTIMP unsigned int __cdecl _set_abort_behavior(unsigned int _Flags,unsigned int _Mask);
255
256 #ifndef _CRT_ABS_DEFINED
257 #define _CRT_ABS_DEFINED
258 int __cdecl abs(int _X);
259 long __cdecl labs(long _X);
260 #endif
261
262 #if _INTEGRAL_MAX_BITS >= 64
263 __MINGW_EXTENSION __int64 __cdecl _abs64(__int64);
264 #endif
265 int __cdecl atexit(void (__cdecl *)(void));
266 #ifndef _CRT_ATOF_DEFINED
267 #define _CRT_ATOF_DEFINED
268 double __cdecl atof(const char *_String);
269 double __cdecl _atof_l(const char *_String,_locale_t _Locale);
270 #endif
271 int __cdecl atoi(const char *_Str);
272 _CRTIMP int __cdecl _atoi_l(const char *_Str,_locale_t _Locale);
273 long __cdecl atol(const char *_Str);
274 _CRTIMP long __cdecl _atol_l(const char *_Str,_locale_t _Locale);
275 #ifndef _CRT_ALGO_DEFINED
276 #define _CRT_ALGO_DEFINED
277 void *__cdecl bsearch(const void *_Key,const void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
278 void __cdecl qsort(void *_Base,size_t _NumOfElements,size_t _SizeOfElements,int (__cdecl *_PtFuncCompare)(const void *,const void *));
279 #endif
280
281 #if !defined(__GNUC__) && !defined(__clang)
282 unsigned short __cdecl _byteswap_ushort(unsigned short _Short);
283 unsigned long __cdecl _byteswap_ulong (unsigned long _Long);
284 #if _INTEGRAL_MAX_BITS >= 64
285 __MINGW_EXTENSION unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64 _Int64);
286 #endif
287 #endif
288
289 div_t __cdecl div(int _Numerator,int _Denominator);
290 char *__cdecl getenv(const char *_VarName);
291 _CRTIMP char *__cdecl _itoa(int _Value,char *_Dest,int _Radix);
292 #if _INTEGRAL_MAX_BITS >= 64
293 __MINGW_EXTENSION _CRTIMP char *__cdecl _i64toa(__int64 _Val,char *_DstBuf,int _Radix);
294 __MINGW_EXTENSION _CRTIMP char *__cdecl _ui64toa(unsigned __int64 _Val,char *_DstBuf,int _Radix);
295 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _atoi64(const char *_String);
296 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _atoi64_l(const char *_String,_locale_t _Locale);
297 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _strtoi64(const char *_String,char **_EndPtr,int _Radix);
298 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _strtoi64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
299 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *_String,char **_EndPtr,int _Radix);
300 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _strtoui64_l(const char *_String,char **_EndPtr,int _Radix,_locale_t _Locale);
301 #endif
302 ldiv_t __cdecl ldiv(long _Numerator,long _Denominator);
303 _CRTIMP char *__cdecl _ltoa(long _Value,char *_Dest,int _Radix);
304 int __cdecl mblen(const char *_Ch,size_t _MaxCount);
305 _CRTIMP int __cdecl _mblen_l(const char *_Ch,size_t _MaxCount,_locale_t _Locale);
306 _CRTIMP size_t __cdecl _mbstrlen(const char *_Str);
307 _CRTIMP size_t __cdecl _mbstrlen_l(const char *_Str,_locale_t _Locale);
308 _CRTIMP size_t __cdecl _mbstrnlen(const char *_Str,size_t _MaxCount);
309 _CRTIMP size_t __cdecl _mbstrnlen_l(const char *_Str,size_t _MaxCount,_locale_t _Locale);
310 int __cdecl mbtowc(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes);
311 _CRTIMP int __cdecl _mbtowc_l(wchar_t *_DstCh,const char *_SrcCh,size_t _SrcSizeInBytes,_locale_t _Locale);
312 size_t __cdecl mbstowcs(wchar_t *_Dest,const char *_Source,size_t _MaxCount);
313 _CRTIMP size_t __cdecl _mbstowcs_l(wchar_t *_Dest,const char *_Source,size_t _MaxCount,_locale_t _Locale);
314 int __cdecl rand(void);
315 _CRTIMP int __cdecl _set_error_mode(int _Mode);
316 void __cdecl srand(unsigned int _Seed);
317 double __cdecl strtod(const char *_Str,char **_EndPtr);
318 float __cdecl strtof(const char *nptr, char **endptr);
319 #if !defined __NO_ISOCEXT /* in libmingwex.a */
320 float __cdecl strtof (const char * __restrict__, char ** __restrict__);
321 long double __cdecl strtold(const char * __restrict__, char ** __restrict__);
322 #endif /* __NO_ISOCEXT */
323 _CRTIMP double __cdecl _strtod_l(const char *_Str,char **_EndPtr,_locale_t _Locale);
324 long __cdecl strtol(const char *_Str,char **_EndPtr,int _Radix);
325 _CRTIMP long __cdecl _strtol_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale);
326 unsigned long __cdecl strtoul(const char *_Str,char **_EndPtr,int _Radix);
327 _CRTIMP unsigned long __cdecl _strtoul_l(const char *_Str,char **_EndPtr,int _Radix,_locale_t _Locale);
328 #ifndef _CRT_SYSTEM_DEFINED
329 #define _CRT_SYSTEM_DEFINED
330 int __cdecl system(const char *_Command);
331 #endif
332 _CRTIMP char *__cdecl _ultoa(unsigned long _Value,char *_Dest,int _Radix);
333 int __cdecl wctomb(char *_MbCh,wchar_t _WCh);
334 _CRTIMP int __cdecl _wctomb_l(char *_MbCh,wchar_t _WCh,_locale_t _Locale);
335 size_t __cdecl wcstombs(char *_Dest,const wchar_t *_Source,size_t _MaxCount);
336 _CRTIMP size_t __cdecl _wcstombs_l(char *_Dest,const wchar_t *_Source,size_t _MaxCount,_locale_t _Locale);
337
338 #ifndef _CRT_ALLOCATION_DEFINED
339 #define _CRT_ALLOCATION_DEFINED
340 void *__cdecl calloc(size_t _NumOfElements,size_t _SizeOfElements);
341 void __cdecl free(void *_Memory);
342 void *__cdecl malloc(size_t _Size);
343 void *__cdecl realloc(void *_Memory,size_t _NewSize);
344 _CRTIMP void *__cdecl _recalloc(void *_Memory,size_t _Count,size_t _Size);
345 //_CRTIMP void __cdecl _aligned_free(void *_Memory);
346 //_CRTIMP void *__cdecl _aligned_malloc(size_t _Size,size_t _Alignment);
347 _CRTIMP void *__cdecl _aligned_offset_malloc(size_t _Size,size_t _Alignment,size_t _Offset);
348 _CRTIMP void *__cdecl _aligned_realloc(void *_Memory,size_t _Size,size_t _Alignment);
349 _CRTIMP void *__cdecl _aligned_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment);
350 _CRTIMP void *__cdecl _aligned_offset_realloc(void *_Memory,size_t _Size,size_t _Alignment,size_t _Offset);
351 _CRTIMP void *__cdecl _aligned_offset_recalloc(void *_Memory,size_t _Count,size_t _Size,size_t _Alignment,size_t _Offset);
352 #endif
353
354 #ifndef _WSTDLIB_DEFINED
355 #define _WSTDLIB_DEFINED
356
357 _CRTIMP wchar_t *__cdecl _itow(int _Value,wchar_t *_Dest,int _Radix);
358 _CRTIMP wchar_t *__cdecl _ltow(long _Value,wchar_t *_Dest,int _Radix);
359 _CRTIMP wchar_t *__cdecl _ultow(unsigned long _Value,wchar_t *_Dest,int _Radix);
360 double __cdecl wcstod(const wchar_t *_Str,wchar_t **_EndPtr);
361 float __cdecl wcstof(const wchar_t *nptr, wchar_t **endptr);
362 #if !defined __NO_ISOCEXT /* in libmingwex.a */
363 float __cdecl wcstof( const wchar_t * __restrict__, wchar_t ** __restrict__);
364 long double __cdecl wcstold(const wchar_t * __restrict__, wchar_t ** __restrict__);
365 #endif /* __NO_ISOCEXT */
366 _CRTIMP double __cdecl _wcstod_l(const wchar_t *_Str,wchar_t **_EndPtr,_locale_t _Locale);
367 long __cdecl wcstol(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
368 _CRTIMP long __cdecl _wcstol_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
369 unsigned long __cdecl wcstoul(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
370 _CRTIMP unsigned long __cdecl _wcstoul_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
371 _CRTIMP wchar_t *__cdecl _wgetenv(const wchar_t *_VarName);
372 #ifndef _CRT_WSYSTEM_DEFINED
373 #define _CRT_WSYSTEM_DEFINED
374 _CRTIMP int __cdecl _wsystem(const wchar_t *_Command);
375 #endif
376 _CRTIMP double __cdecl _wtof(const wchar_t *_Str);
377 _CRTIMP double __cdecl _wtof_l(const wchar_t *_Str,_locale_t _Locale);
378 _CRTIMP int __cdecl _wtoi(const wchar_t *_Str);
379 _CRTIMP int __cdecl _wtoi_l(const wchar_t *_Str,_locale_t _Locale);
380 _CRTIMP long __cdecl _wtol(const wchar_t *_Str);
381 _CRTIMP long __cdecl _wtol_l(const wchar_t *_Str,_locale_t _Locale);
382
383 #if _INTEGRAL_MAX_BITS >= 64
384 __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _i64tow(__int64 _Val,wchar_t *_DstBuf,int _Radix);
385 __MINGW_EXTENSION _CRTIMP wchar_t *__cdecl _ui64tow(unsigned __int64 _Val,wchar_t *_DstBuf,int _Radix);
386 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *_Str);
387 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wtoi64_l(const wchar_t *_Str,_locale_t _Locale);
388 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
389 __MINGW_EXTENSION _CRTIMP __int64 __cdecl _wcstoi64_l(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
390 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *_Str,wchar_t **_EndPtr,int _Radix);
391 __MINGW_EXTENSION _CRTIMP unsigned __int64 __cdecl _wcstoui64_l(const wchar_t *_Str ,wchar_t **_EndPtr,int _Radix,_locale_t _Locale);
392 #endif
393 #endif
394
395 #ifndef _POSIX_
396 #define _CVTBUFSIZE (309+40)
397 _CRTIMP char *__cdecl _fullpath(char *_FullPath,const char *_Path,size_t _SizeInBytes);
398 _CRTIMP char *__cdecl _ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign);
399 _CRTIMP char *__cdecl _fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign);
400 _CRTIMP char *__cdecl _gcvt(double _Val,int _NumOfDigits,char *_DstBuf);
401 _CRTIMP int __cdecl _atodbl(_CRT_DOUBLE *_Result,char *_Str);
402 _CRTIMP int __cdecl _atoldbl(_LDOUBLE *_Result,char *_Str);
403 _CRTIMP int __cdecl _atoflt(_CRT_FLOAT *_Result,char *_Str);
404 _CRTIMP int __cdecl _atodbl_l(_CRT_DOUBLE *_Result,char *_Str,_locale_t _Locale);
405 _CRTIMP int __cdecl _atoldbl_l(_LDOUBLE *_Result,char *_Str,_locale_t _Locale);
406 _CRTIMP int __cdecl _atoflt_l(_CRT_FLOAT *_Result,char *_Str,_locale_t _Locale);
407 unsigned long __cdecl _lrotl(unsigned long _Val,int _Shift);
408 unsigned long __cdecl _lrotr(unsigned long _Val,int _Shift);
409 _CRTIMP void __cdecl _makepath(char *_Path,const char *_Drive,const char *_Dir,const char *_Filename,const char *_Ext);
410 _onexit_t __cdecl _onexit(_onexit_t _Func);
411
412 #ifndef _CRT_PERROR_DEFINED
413 #define _CRT_PERROR_DEFINED
414 void __cdecl perror(const char *_ErrMsg);
415 #endif
416 _CRTIMP int __cdecl _putenv(const char *_EnvString);
417 #if !defined(__GNUC__) && !defined(__clang)
418 unsigned int __cdecl _rotl(unsigned int _Val,int _Shift);
419 #if _INTEGRAL_MAX_BITS >= 64
420 __MINGW_EXTENSION unsigned __int64 __cdecl _rotl64(unsigned __int64 _Val,int _Shift);
421 #endif
422 unsigned int __cdecl _rotr(unsigned int _Val,int _Shift);
423 #if _INTEGRAL_MAX_BITS >= 64
424 __MINGW_EXTENSION unsigned __int64 __cdecl _rotr64(unsigned __int64 _Val,int _Shift);
425 #endif
426 #endif
427 _CRTIMP void __cdecl _searchenv(const char *_Filename,const char *_EnvVar,char *_ResultPath);
428 _CRTIMP void __cdecl _splitpath(const char *_FullPath,char *_Drive,char *_Dir,char *_Filename,char *_Ext);
429 _CRTIMP void __cdecl _swab(char *_Buf1,char *_Buf2,int _SizeInBytes);
430
431 #ifndef _WSTDLIBP_DEFINED
432 #define _WSTDLIBP_DEFINED
433 _CRTIMP wchar_t *__cdecl _wfullpath(wchar_t *_FullPath,const wchar_t *_Path,size_t _SizeInWords);
434 _CRTIMP void __cdecl _wmakepath(wchar_t *_ResultPath,const wchar_t *_Drive,const wchar_t *_Dir,const wchar_t *_Filename,const wchar_t *_Ext);
435 #ifndef _CRT_WPERROR_DEFINED
436 #define _CRT_WPERROR_DEFINED
437 _CRTIMP void __cdecl _wperror(const wchar_t *_ErrMsg);
438 #endif
439 _CRTIMP int __cdecl _wputenv(const wchar_t *_EnvString);
440 _CRTIMP void __cdecl _wsearchenv(const wchar_t *_Filename,const wchar_t *_EnvVar,wchar_t *_ResultPath);
441 _CRTIMP void __cdecl _wsplitpath(const wchar_t *_FullPath,wchar_t *_Drive,wchar_t *_Dir,wchar_t *_Filename,wchar_t *_Ext);
442 #endif
443
444 _CRTIMP __MINGW_ATTRIB_DEPRECATED void __cdecl _beep(unsigned _Frequency,unsigned _Duration);
445 /* Not to be confused with _set_error_mode (int). */
446 _CRTIMP __MINGW_ATTRIB_DEPRECATED void __cdecl _seterrormode(int _Mode);
447 _CRTIMP __MINGW_ATTRIB_DEPRECATED void __cdecl _sleep(unsigned long _Duration);
448 #endif
449
450 #ifndef NO_OLDNAMES
451 #ifndef _POSIX_
452 #if 0
453 #ifndef __cplusplus
454 #ifndef NOMINMAX
455 #ifndef max
456 #define max(a,b) (((a) > (b)) ? (a) : (b))
457 #endif
458 #ifndef min
459 #define min(a,b) (((a) < (b)) ? (a) : (b))
460 #endif
461 #endif
462 #endif
463 #endif
464
465 #define sys_errlist _sys_errlist
466 #define sys_nerr _sys_nerr
467 #define environ _environ
468 _CRTIMP char *__cdecl ecvt(double _Val,int _NumOfDigits,int *_PtDec,int *_PtSign);
469 _CRTIMP char *__cdecl fcvt(double _Val,int _NumOfDec,int *_PtDec,int *_PtSign);
470 _CRTIMP char *__cdecl gcvt(double _Val,int _NumOfDigits,char *_DstBuf);
471 _CRTIMP char *__cdecl itoa(int _Val,char *_DstBuf,int _Radix);
472 _CRTIMP char *__cdecl ltoa(long _Val,char *_DstBuf,int _Radix);
473 _CRTIMP int __cdecl putenv(const char *_EnvString);
474 _CRTIMP void __cdecl swab(char *_Buf1,char *_Buf2,int _SizeInBytes);
475 _CRTIMP char *__cdecl ultoa(unsigned long _Val,char *_Dstbuf,int _Radix);
476 onexit_t __cdecl onexit(onexit_t _Func);
477 #endif
478 #endif
479
480 #if !defined __NO_ISOCEXT /* externs in static libmingwex.a */
481
482 __MINGW_EXTENSION typedef struct { long long quot, rem; } lldiv_t;
483
484 __MINGW_EXTENSION lldiv_t __cdecl lldiv(long long, long long);
485
486 #ifndef _MSC_VER
487 __MINGW_EXTENSION __CRT_INLINE long long __cdecl llabs(long long _j) { return (_j >= 0 ? _j : -_j); }
488 #endif
489
490 __MINGW_EXTENSION long long __cdecl strtoll(const char* __restrict__, char** __restrict, int);
491 __MINGW_EXTENSION unsigned long long __cdecl strtoull(const char* __restrict__, char** __restrict__, int);
492
493 /* these are stubs for MS _i64 versions */
494 __MINGW_EXTENSION long long __cdecl atoll (const char *);
495
496 #ifndef __STRICT_ANSI__
497 __MINGW_EXTENSION long long __cdecl wtoll (const wchar_t *);
498 __MINGW_EXTENSION char *__cdecl lltoa (long long, char *, int);
499 __MINGW_EXTENSION char *__cdecl ulltoa (unsigned long long , char *, int);
500 __MINGW_EXTENSION wchar_t *__cdecl lltow (long long, wchar_t *, int);
501 __MINGW_EXTENSION wchar_t *__cdecl ulltow (unsigned long long, wchar_t *, int);
502
503 /* __CRT_INLINE using non-ansi functions */
504 __MINGW_EXTENSION __CRT_INLINE long long __cdecl atoll (const char * _c) { return _atoi64 (_c); }
505 __MINGW_EXTENSION __CRT_INLINE char *__cdecl lltoa (long long _n, char * _c, int _i) { return _i64toa (_n, _c, _i); }
506 __MINGW_EXTENSION __CRT_INLINE char *__cdecl ulltoa (unsigned long long _n, char * _c, int _i) { return _ui64toa (_n, _c, _i); }
507 __MINGW_EXTENSION __CRT_INLINE long long __cdecl wtoll (const wchar_t * _w) { return _wtoi64 (_w); }
508 __MINGW_EXTENSION __CRT_INLINE wchar_t *__cdecl lltow (long long _n, wchar_t * _w, int _i) { return _i64tow (_n, _w, _i); }
509 __MINGW_EXTENSION __CRT_INLINE wchar_t *__cdecl ulltow (unsigned long long _n, wchar_t * _w, int _i) { return _ui64tow (_n, _w, _i); }
510 #endif /* (__STRICT_ANSI__) */
511
512 #endif /* !__NO_ISOCEXT */
513
514 #ifdef __cplusplus
515 }
516 #endif
517
518 #pragma pack(pop)
519
520 #include <sec_api/stdlib_s.h>
521 #endif