stdlib.h 20 KB

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