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