Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

647 lines
26 KiB

  1. /***
  2. *stdlib.h - declarations/definitions for commonly used library functions
  3. *
  4. * Copyright (c) 1985-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This include file contains the function declarations for commonly
  8. * used library functions which either don't fit somewhere else, or,
  9. * cannot be declared in the normal place for other reasons.
  10. * [ANSI]
  11. *
  12. * [Public]
  13. *
  14. *Revision History:
  15. * 06-03-87 JMB Added MSSDK_ONLY switch to OS2_MODE, DOS_MODE
  16. * 06-30-87 SKS Added MSSDK_ONLY switch to _osmode
  17. * 08-17-87 PHG Removed const from params to _makepath, _splitpath,
  18. * _searchenv to conform with spec and documentation.
  19. * 10/20/87 JCR Removed "MSC40_ONLY" entries and "MSSDK_ONLY" comments
  20. * 12-11-87 JCR Added "_loadds" functionality
  21. * 12-18-87 JCR Added _FAR_ to declarations
  22. * 01-04-88 WAJ Increased _MAX_PATH and _MAX_DIR
  23. * 01-21-88 JCR Removed _LOAD_DS from search routine declarations
  24. * 02-10-88 JCR Cleaned up white space
  25. * 05-31-88 SKS Added EXIT_SUCCESS and EXIT_FAILURE
  26. * 08-19-88 GJF Modified to also work for the 386 (small model only)
  27. * 09-29-88 JCR onexit/atexit user routines must be _loadds in DLL
  28. * 09-30-88 JCR environ is a routine for DLL (bug fix)
  29. * 12-08-88 JCR DLL environ is resolved directly (no __environ call)
  30. * 12-15-88 GJF Added definition of NULL (ANSI)
  31. * 12-27-88 JCR Added _fileinfo, also DLL support for _fmode entry
  32. * 05-03-89 JCR Corrected _osmajor/_osminor for 386
  33. * 05-03-89 JCR Added _INTERNAL_IFSTRIP for relinc usage
  34. * 07-24-89 GJF Gave names to the structs for div_t and ldiv_t types
  35. * 08-01-89 GJF Cleanup, now specific to OS/2 2.0 (i.e., 386 flat
  36. * model). Also added parens to *_errno and *_doserrno
  37. * definitions (same as 11-14-88 change to CRT version).
  38. * 10-25-89 JCR Upgraded _MAX values for long filename support
  39. * 10-30-89 GJF Fixed copyright
  40. * 11-02-89 JCR Changed "DLL" to "_DLL", removed superfluous _DLL defs
  41. * 11-17-89 GJF Moved _fullpath prototype here (from direct.h). Also,
  42. * added const to appropriate arg types for _makepath(),
  43. * putenv(), _searchenv() and _splitpath().
  44. * 11-20-89 JCR Routines are now _cdecl in both single and multi-thread
  45. * 11-27-89 KRS Fixed _MAX_PATH etc. to match current OS/2 limits.
  46. * 03-02-90 GJF Added #ifndef _INC_STDLIB and #include <cruntime.h>
  47. * stuff. Also, removed some (now) useless preprocessor
  48. * directives.
  49. * 03-22-90 GJF Replaced _cdecl with _CALLTYPE1 in prototypes and
  50. * with _VARTYPE1 in variable declarations.
  51. * 04-10-90 GJF Made _errno() and __doserrno() _CALLTYPE1.
  52. * 08-15-90 SBM Made MTHREAD _errno() and __doserrno() return int *
  53. * 10-31-90 JCR Added WINR_MODE and WINP_MODE for consistency
  54. * 11-12-90 GJF Changed NULL to (void *)0.
  55. * 11-30-90 GJF Conditioned definition of _doserrno on _CRUISER_ or
  56. * _WIN32_
  57. * 01-21-91 GJF ANSI naming.
  58. * 02-12-91 GJF Only #define NULL if it isn't #define-d.
  59. * 03-21-91 KRS Added wchar_t type, MB_CUR_MAX macro, and mblen,
  60. * mbtowc, mbstowcs, wctomb, and wcstombs functions.
  61. * 04-09-91 PNT Added _MAC_ definitions
  62. * 05-21-91 GJF #define onexit_t to _onexit_t if __STDC__ is not
  63. * not defined
  64. * 08-08-91 GJF Added prototypes for _atold and _strtold.
  65. * 08-20-91 JCR C++ and ANSI naming
  66. * 08-26-91 BWM Added prototypes for _beep, _sleep, _seterrormode.
  67. * 09-28-91 JCR ANSI names: DOSX32=prototypes, WIN32=#defines for now
  68. * 11-15-91 GJF Changed definitions of min and max to agree with
  69. * windef.h
  70. * 01-22-92 GJF Fixed up definitions of global variables for build of,
  71. * and users of, crtdll.dll. Also, deleted declaration
  72. * of _psp (has no meaning outside of DOS).
  73. * 01-30-92 GJF Removed prototype for _strtold (no such function yet).
  74. * 03-30-92 DJM POSIX support.
  75. * 04-29-92 GJF Added _putenv_lk and _getenv_lk for Win32.
  76. * 06-16-92 KRS Added prototypes for wcstol and wcstod.
  77. * 06-29-92 GJF Removed bogus #define.
  78. * 08-05-92 GJF Function calling type and variable type macros. Also,
  79. * replaced ref. to i386 with ref to _M_IX86.
  80. * 08-18-92 KRS Add _mblen_lk.
  81. * 08-21-92 GJF Conditionally removed _atold for Win32 (no long double
  82. * in Win32).
  83. * 08-21-92 GJF Moved _mblen_lk into area that is stripped out by
  84. * release scripts.
  85. * 08-23-92 GJF Exposed _itoa, _ltoa, _ultoa, mblen, mbtowc, mbstowcs
  86. * for POSIX.
  87. * 08-26-92 SKS Add _osver, _winver, _winmajor, _winminor, _pgmptr
  88. * 09-03-92 GJF Merged changes from 8-5-92 on.
  89. * 01-21-93 GJF Removed support for C6-386's _cdecl.
  90. * 03-01-93 SKS Add __argc and __argv
  91. * 03-20-93 SKS Remove obsolete variables _cpumode, _osmajor, etc.
  92. * Remove obsolete functions _beep, _sleep, _seterrormode
  93. * 04-06-93 SKS Replace _CRTAPI1/2 with __cdecl, _CRTVAR1 with nothing
  94. * 04-07-93 SKS Add _CRTIMP keyword for CRT DLL model
  95. * Use link-time aliases for old names, not #define's
  96. * 04-12-93 CFW Add _MB_CUR_MAX_DEFINED protection.
  97. * 04-14-93 CFW Simplify MB_CUR_MAX def.
  98. * 04-29-93 CFW Add _mbslen prototype.
  99. * 05-24-93 SKS atexit and _onexit are no longner imported directly
  100. * 06-03-93 CFW Change _mbslen to _mbstrlen, returning type size_t.
  101. * 09-13-93 CFW Add _wtox and _xtow function prototypes.
  102. * 09-13-93 GJF Merged Cuda and NT SDK versions, with some cleanup.
  103. * 10-21-93 GJF Re-purged the obsolete version and mode variables.
  104. * Changed _NTSDK definitions for _fmode slightly, to
  105. * support setting it in dllstuff\crtexe.c.
  106. * 11-19-93 CFW Add _wargv, _wpgmptr.
  107. * 11-29-93 CFW Wide environment.
  108. * 12-07-93 CFW Move wide defs outside __STDC__ check.
  109. * 12-23-93 GJF __mb_cur_max must same type for _NTSDK (int) as for
  110. * our own build.
  111. * 04-27-94 GJF Changed definitions/declarations of:
  112. * MB_CUR_MAX
  113. * __argc
  114. * __argv
  115. * __wargv
  116. * _environ
  117. * _wenviron
  118. * _fmode
  119. * _osver
  120. * _pgmptr
  121. * _wpgmptr
  122. * _winver
  123. * _winmajor
  124. * _winminor
  125. * for _DLL and/or DLL_FOR_WIN32S.
  126. * 05-03-94 GJF Made the changes above, for _DLL, conditional on
  127. * _M_IX86 too.
  128. * 06-06-94 SKS Change if def(_MT) to if def(_MT) || def(_DLL)
  129. * This will support single-thread apps using MSVCRT*.DLL
  130. * 09-06-94 GJF Added _set_error_mode() and related constants.
  131. * 11-03-94 GJF Ensure 8 byte alignment.
  132. * 12-28-94 JCF Merged with mac header.
  133. * 02-11-95 CFW Remove duplicate def.
  134. * 02-11-95 CFW Add _CRTBLD to avoid users getting wrong headers.
  135. * 02-14-95 CFW Clean up Mac merge.
  136. * 03-10-95 BWT Add _CRTIMP for mips intrinsics.
  137. * 03-30-95 BWT Fix _fmode definition for non-X86 CRTEXE. (second try)
  138. * 10-20-95 GJF #ifdef-ed out declarations of toupper/tolower for ANSI
  139. * compilations (-Za). This was Olympus 1314. They cannot
  140. * be removed completely (for now) because they are
  141. * documented.
  142. * 12-14-95 JWM Add "#pragma once".
  143. * 03-18-96 SKS Add _fileinfo to variables implemented as functions.
  144. * 04-01-96 BWT Add _i64toa, _i64tow, _ui64toa, _ui64tow, _atoi64, _wtoi64
  145. * 05-15-96 BWT Fix POSIX definitions of environ
  146. * 08-13-96 JWM Add inline long abs(long), ifdef _cplusplus only.
  147. * 08-19-96 JWM Removed inline abs - entire header is being
  148. * wrapped in 'extern "C"' by some users.
  149. * 01-20-97 GJF Cleaned out obsolete support for Win32s, _CRTAPI* and
  150. * _NTSDK.
  151. * 04-04-97 GJF Restored some of the deleted support because it might
  152. * be useful in planned startup improvements.
  153. * 04-16-97 GJF Restored some more for the same reason.
  154. * 08-13-97 GJF Strip out __p_* prototypes which aren't actually used
  155. * from release version.
  156. * 09-30-97 JWM Restored not-so-obsolete _CRTAPI1 support.
  157. * 10-07-97 RDL Added IA64.
  158. * 09-10-98 GJF Added support for per-thread locale information.
  159. * 10-02-98 GJF Added _osplatform.
  160. * 12-15-98 GJF Changes for 64-bit size_t.
  161. * 05-13-99 PML Remove _CRTAPI1
  162. * 05-17-99 PML Remove all Macintosh support.
  163. * 10-06-99 PML Add _W64 modifier to types which are 32 bits in Win32,
  164. * 64 bits in Win64.
  165. * 02-11-00 GB Add _strtoi64, wcstoi64, strtoui64 and wcstoui64
  166. * 08-29-00 PML Add _set_security_error_handler.
  167. * 01-04-01 GB Add _abs64, _rotl64, _rotr64, _byteswap and functions
  168. * 01-29-01 GB Added _func function version of data variable used in msvcprt.lib
  169. * to work with STATIC_CPPLIB
  170. *
  171. ****/
  172. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  173. #pragma once
  174. #endif
  175. #ifndef _INC_STDLIB
  176. #define _INC_STDLIB
  177. #if !defined(_WIN32)
  178. #error ERROR: Only Win32 target supported!
  179. #endif
  180. #ifndef _CRTBLD
  181. /* This version of the header files is NOT for user programs.
  182. * It is intended for use when building the C runtimes ONLY.
  183. * The version intended for public use will not have this message.
  184. */
  185. #error ERROR: Use of C runtime library internal header file.
  186. #endif /* _CRTBLD */
  187. #ifdef _MSC_VER
  188. /*
  189. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  190. * alignment.
  191. */
  192. #pragma pack(push,8)
  193. #endif /* _MSC_VER */
  194. #ifdef __cplusplus
  195. extern "C" {
  196. #endif
  197. #ifndef _INTERNAL_IFSTRIP_
  198. #include <cruntime.h>
  199. #endif /* _INTERNAL_IFSTRIP_ */
  200. #if !defined(_W64)
  201. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  202. #define _W64 __w64
  203. #else
  204. #define _W64
  205. #endif
  206. #endif
  207. /* Define _CRTIMP */
  208. #ifndef _CRTIMP
  209. #ifdef CRTDLL
  210. #define _CRTIMP __declspec(dllexport)
  211. #else /* ndef CRTDLL */
  212. #ifdef _DLL
  213. #define _CRTIMP __declspec(dllimport)
  214. #else /* ndef _DLL */
  215. #define _CRTIMP
  216. #endif /* _DLL */
  217. #endif /* CRTDLL */
  218. #endif /* _CRTIMP */
  219. /* Define __cdecl for non-Microsoft compilers */
  220. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  221. #define __cdecl
  222. #endif
  223. #ifndef _SIZE_T_DEFINED
  224. #ifdef _WIN64
  225. typedef unsigned __int64 size_t;
  226. #else
  227. typedef _W64 unsigned int size_t;
  228. #endif
  229. #define _SIZE_T_DEFINED
  230. #endif
  231. #ifndef _WCHAR_T_DEFINED
  232. typedef unsigned short wchar_t;
  233. #define _WCHAR_T_DEFINED
  234. #endif
  235. /* Define NULL pointer value */
  236. #ifndef NULL
  237. #ifdef __cplusplus
  238. #define NULL 0
  239. #else
  240. #define NULL ((void *)0)
  241. #endif
  242. #endif
  243. /* Definition of the argument values for the exit() function */
  244. #define EXIT_SUCCESS 0
  245. #define EXIT_FAILURE 1
  246. #ifndef _ONEXIT_T_DEFINED
  247. typedef int (__cdecl * _onexit_t)(void);
  248. #if !__STDC__
  249. /* Non-ANSI name for compatibility */
  250. #define onexit_t _onexit_t
  251. #endif
  252. #define _ONEXIT_T_DEFINED
  253. #endif
  254. /* Data structure definitions for div and ldiv runtimes. */
  255. #ifndef _DIV_T_DEFINED
  256. typedef struct _div_t {
  257. int quot;
  258. int rem;
  259. } div_t;
  260. typedef struct _ldiv_t {
  261. long quot;
  262. long rem;
  263. } ldiv_t;
  264. #define _DIV_T_DEFINED
  265. #endif
  266. /* Maximum value that can be returned by the rand function. */
  267. #define RAND_MAX 0x7fff
  268. /*
  269. * Maximum number of bytes in multi-byte character in the current locale
  270. * (also defined in ctype.h).
  271. */
  272. #ifndef MB_CUR_MAX
  273. #ifndef _INTERNAL_IFSTRIP_
  274. #if defined(_DLL) && defined(_M_IX86)
  275. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  276. _CRTIMP int * __cdecl __p___mb_cur_max(void);
  277. #endif
  278. #endif /* _INTERNAL_IFSTRIP_ */
  279. #define MB_CUR_MAX __mb_cur_max
  280. _CRTIMP extern int __mb_cur_max;
  281. /* These functions are for enabling STATIC_CPPLIB functionality */
  282. _CRTIMP int __cdecl ___mb_cur_max_func(void);
  283. #endif /* MB_CUR_MAX */
  284. /* Minimum and maximum macros */
  285. #define __max(a,b) (((a) > (b)) ? (a) : (b))
  286. #define __min(a,b) (((a) < (b)) ? (a) : (b))
  287. /*
  288. * Sizes for buffers used by the _makepath() and _splitpath() functions.
  289. * note that the sizes include space for 0-terminator
  290. */
  291. #define _MAX_PATH 260 /* max. length of full pathname */
  292. #define _MAX_DRIVE 3 /* max. length of drive component */
  293. #define _MAX_DIR 256 /* max. length of path component */
  294. #define _MAX_FNAME 256 /* max. length of file name component */
  295. #define _MAX_EXT 256 /* max. length of extension component */
  296. /*
  297. * Argument values for _set_error_mode().
  298. */
  299. #define _OUT_TO_DEFAULT 0
  300. #define _OUT_TO_STDERR 1
  301. #define _OUT_TO_MSGBOX 2
  302. #define _REPORT_ERRMODE 3
  303. #if defined(_M_IX86)
  304. /*
  305. * Typedefs and argument values for _set_security_error_handler()
  306. */
  307. #define _SECERR_BUFFER_OVERRUN 1 /* void* arg ignored */
  308. typedef void (__cdecl * _secerr_handler_func)(int, void *);
  309. #endif
  310. /* External variable declarations */
  311. #if defined(_MT) || defined(_DLL)
  312. _CRTIMP int * __cdecl _errno(void);
  313. _CRTIMP unsigned long * __cdecl __doserrno(void);
  314. #define errno (*_errno())
  315. #define _doserrno (*__doserrno())
  316. #else /* ndef _MT && ndef _DLL */
  317. _CRTIMP extern int errno; /* XENIX style error number */
  318. _CRTIMP extern unsigned long _doserrno; /* OS system error value */
  319. #endif /* _MT || _DLL */
  320. _CRTIMP extern char * _sys_errlist[]; /* perror error message table */
  321. _CRTIMP extern int _sys_nerr; /* # of entries in sys_errlist table */
  322. #if defined(_DLL) && defined(_M_IX86)
  323. _CRTIMP int * __cdecl __p___argc(void);
  324. _CRTIMP char *** __cdecl __p___argv(void);
  325. _CRTIMP wchar_t *** __cdecl __p___wargv(void);
  326. _CRTIMP char *** __cdecl __p__environ(void);
  327. _CRTIMP wchar_t *** __cdecl __p__wenviron(void);
  328. _CRTIMP char ** __cdecl __p__pgmptr(void);
  329. _CRTIMP wchar_t ** __cdecl __p__wpgmptr(void);
  330. #ifndef _INTERNAL_IFSTRIP_
  331. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  332. _CRTIMP int * __cdecl __p__fmode(void);
  333. _CRTIMP int * __cdecl __p__fileinfo(void);
  334. _CRTIMP unsigned int * __cdecl __p__osver(void);
  335. _CRTIMP unsigned int * __cdecl __p__winver(void);
  336. _CRTIMP unsigned int * __cdecl __p__winmajor(void);
  337. _CRTIMP unsigned int * __cdecl __p__winminor(void);
  338. #endif /* _INTERNAL_IFSTRIP_ */
  339. #endif /* _M_IX86 && _DLL */
  340. _CRTIMP extern int __argc; /* count of cmd line args */
  341. _CRTIMP extern char ** __argv; /* pointer to table of cmd line args */
  342. _CRTIMP extern wchar_t ** __wargv; /* pointer to table of wide cmd line args */
  343. #ifdef _POSIX_
  344. extern char ** environ; /* pointer to environment table */
  345. #else
  346. _CRTIMP extern char ** _environ; /* pointer to environment table */
  347. _CRTIMP extern wchar_t ** _wenviron; /* pointer to wide environment table */
  348. #endif /* _POSIX_ */
  349. _CRTIMP extern char * _pgmptr; /* points to the module (EXE) name */
  350. _CRTIMP extern wchar_t * _wpgmptr; /* points to the module (EXE) wide name */
  351. #ifdef SPECIAL_CRTEXE
  352. extern int _fmode; /* default file translation mode */
  353. #else
  354. _CRTIMP extern int _fmode; /* default file translation mode */
  355. #endif
  356. _CRTIMP extern int _fileinfo; /* open file info mode (for spawn) */
  357. /* Windows major/minor and O.S. version numbers */
  358. _CRTIMP extern unsigned int _osplatform;
  359. _CRTIMP extern unsigned int _osver;
  360. _CRTIMP extern unsigned int _winver;
  361. _CRTIMP extern unsigned int _winmajor;
  362. _CRTIMP extern unsigned int _winminor;
  363. /* function prototypes */
  364. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  365. _CRTIMP __declspec(noreturn) void __cdecl abort(void);
  366. _CRTIMP __declspec(noreturn) void __cdecl exit(int);
  367. #else
  368. _CRTIMP void __cdecl abort(void);
  369. _CRTIMP void __cdecl exit(int);
  370. #endif
  371. #if defined(_M_MRX000)
  372. _CRTIMP int __cdecl abs(int);
  373. #else
  374. int __cdecl abs(int);
  375. #endif
  376. __int64 __cdecl _abs64(__int64);
  377. int __cdecl atexit(void (__cdecl *)(void));
  378. _CRTIMP double __cdecl atof(const char *);
  379. _CRTIMP int __cdecl atoi(const char *);
  380. _CRTIMP long __cdecl atol(const char *);
  381. _CRTIMP void * __cdecl bsearch(const void *, const void *, size_t, size_t,
  382. int (__cdecl *)(const void *, const void *));
  383. unsigned short __cdecl _byteswap_ushort(unsigned short);
  384. unsigned long __cdecl _byteswap_ulong (unsigned long);
  385. unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
  386. _CRTIMP void * __cdecl calloc(size_t, size_t);
  387. _CRTIMP div_t __cdecl div(int, int);
  388. _CRTIMP void __cdecl free(void *);
  389. _CRTIMP char * __cdecl getenv(const char *);
  390. _CRTIMP char * __cdecl _itoa(int, char *, int);
  391. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  392. _CRTIMP char * __cdecl _i64toa(__int64, char *, int);
  393. _CRTIMP char * __cdecl _ui64toa(unsigned __int64, char *, int);
  394. _CRTIMP __int64 __cdecl _atoi64(const char *);
  395. _CRTIMP __int64 __cdecl _strtoi64(const char *, char **, int);
  396. _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *, char **, int);
  397. #endif
  398. #if defined(_M_MRX000)
  399. _CRTIMP long __cdecl labs(long);
  400. #else
  401. long __cdecl labs(long);
  402. #endif
  403. _CRTIMP ldiv_t __cdecl ldiv(long, long);
  404. _CRTIMP char * __cdecl _ltoa(long, char *, int);
  405. _CRTIMP void * __cdecl malloc(size_t);
  406. _CRTIMP int __cdecl mblen(const char *, size_t);
  407. _CRTIMP size_t __cdecl _mbstrlen(const char *s);
  408. _CRTIMP int __cdecl mbtowc(wchar_t *, const char *, size_t);
  409. _CRTIMP size_t __cdecl mbstowcs(wchar_t *, const char *, size_t);
  410. _CRTIMP void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)
  411. (const void *, const void *));
  412. _CRTIMP int __cdecl rand(void);
  413. _CRTIMP void * __cdecl realloc(void *, size_t);
  414. _CRTIMP int __cdecl _set_error_mode(int);
  415. #if defined(_M_IX86)
  416. _CRTIMP _secerr_handler_func
  417. __cdecl _set_security_error_handler(_secerr_handler_func);
  418. #endif
  419. _CRTIMP void __cdecl srand(unsigned int);
  420. _CRTIMP double __cdecl strtod(const char *, char **);
  421. _CRTIMP long __cdecl strtol(const char *, char **, int);
  422. _CRTIMP unsigned long __cdecl strtoul(const char *, char **, int);
  423. _CRTIMP int __cdecl system(const char *);
  424. _CRTIMP char * __cdecl _ultoa(unsigned long, char *, int);
  425. _CRTIMP int __cdecl wctomb(char *, wchar_t);
  426. _CRTIMP size_t __cdecl wcstombs(char *, const wchar_t *, size_t);
  427. #ifndef _WSTDLIB_DEFINED
  428. /* wide function prototypes, also declared in wchar.h */
  429. _CRTIMP wchar_t * __cdecl _itow (int, wchar_t *, int);
  430. _CRTIMP wchar_t * __cdecl _ltow (long, wchar_t *, int);
  431. _CRTIMP wchar_t * __cdecl _ultow (unsigned long, wchar_t *, int);
  432. _CRTIMP double __cdecl wcstod(const wchar_t *, wchar_t **);
  433. _CRTIMP long __cdecl wcstol(const wchar_t *, wchar_t **, int);
  434. _CRTIMP unsigned long __cdecl wcstoul(const wchar_t *, wchar_t **, int);
  435. _CRTIMP wchar_t * __cdecl _wgetenv(const wchar_t *);
  436. _CRTIMP int __cdecl _wsystem(const wchar_t *);
  437. _CRTIMP double __cdecl _wtof(const wchar_t *);
  438. _CRTIMP int __cdecl _wtoi(const wchar_t *);
  439. _CRTIMP long __cdecl _wtol(const wchar_t *);
  440. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  441. _CRTIMP wchar_t * __cdecl _i64tow(__int64, wchar_t *, int);
  442. _CRTIMP wchar_t * __cdecl _ui64tow(unsigned __int64, wchar_t *, int);
  443. _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *);
  444. _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *, wchar_t **, int);
  445. _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *, wchar_t **, int);
  446. #endif
  447. #define _WSTDLIB_DEFINED
  448. #endif
  449. #ifndef _POSIX_
  450. _CRTIMP char * __cdecl _ecvt(double, int, int *, int *);
  451. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  452. _CRTIMP __declspec(noreturn) void __cdecl _exit(int);
  453. #else
  454. _CRTIMP void __cdecl _exit(int);
  455. #endif
  456. _CRTIMP char * __cdecl _fcvt(double, int, int *, int *);
  457. _CRTIMP char * __cdecl _fullpath(char *, const char *, size_t);
  458. _CRTIMP char * __cdecl _gcvt(double, int, char *);
  459. unsigned long __cdecl _lrotl(unsigned long, int);
  460. unsigned long __cdecl _lrotr(unsigned long, int);
  461. _CRTIMP void __cdecl _makepath(char *, const char *, const char *, const char *,
  462. const char *);
  463. _onexit_t __cdecl _onexit(_onexit_t);
  464. _CRTIMP void __cdecl perror(const char *);
  465. _CRTIMP int __cdecl _putenv(const char *);
  466. unsigned int __cdecl _rotl(unsigned int, int);
  467. unsigned __int64 __cdecl _rotl64(unsigned __int64, int);
  468. unsigned int __cdecl _rotr(unsigned int, int);
  469. unsigned __int64 __cdecl _rotr64(unsigned __int64, int);
  470. _CRTIMP void __cdecl _searchenv(const char *, const char *, char *);
  471. _CRTIMP void __cdecl _splitpath(const char *, char *, char *, char *, char *);
  472. _CRTIMP void __cdecl _swab(char *, char *, int);
  473. #ifndef _WSTDLIBP_DEFINED
  474. /* wide function prototypes, also declared in wchar.h */
  475. _CRTIMP wchar_t * __cdecl _wfullpath(wchar_t *, const wchar_t *, size_t);
  476. _CRTIMP void __cdecl _wmakepath(wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *,
  477. const wchar_t *);
  478. _CRTIMP void __cdecl _wperror(const wchar_t *);
  479. _CRTIMP int __cdecl _wputenv(const wchar_t *);
  480. _CRTIMP void __cdecl _wsearchenv(const wchar_t *, const wchar_t *, wchar_t *);
  481. _CRTIMP void __cdecl _wsplitpath(const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);
  482. #define _WSTDLIBP_DEFINED
  483. #endif
  484. /* --------- The following functions are OBSOLETE --------- */
  485. /* The Win32 API SetErrorMode, Beep and Sleep should be used instead. */
  486. _CRTIMP void __cdecl _seterrormode(int);
  487. _CRTIMP void __cdecl _beep(unsigned, unsigned);
  488. _CRTIMP void __cdecl _sleep(unsigned long);
  489. /* --------- The preceding functions are OBSOLETE --------- */
  490. #endif /* _POSIX_ */
  491. #if !__STDC__
  492. /* --------- The declarations below should not be in stdlib.h --------- */
  493. /* --------- and will be removed in a future release. Include --------- */
  494. /* --------- ctype.h to obtain these declarations. --------- */
  495. #ifndef tolower /* tolower has been undefined - use function */
  496. _CRTIMP int __cdecl tolower(int);
  497. #endif /* tolower */
  498. #ifndef toupper /* toupper has been undefined - use function */
  499. _CRTIMP int __cdecl toupper(int);
  500. #endif /* toupper */
  501. /* --------- The declarations above will be removed. --------- */
  502. #endif
  503. #ifdef _MT /* _MTHREAD_ONLY */
  504. /* _MTHREAD_ONLY */
  505. struct threadlocaleinfostruct; /* _MTHREAD_ONLY */
  506. typedef struct threadlocaleinfostruct * pthreadlocinfo; /* _MTHREAD_ONLY */
  507. /* _MTHREAD_ONLY */
  508. char * __cdecl _getenv_lk(const char *); /* _MTHREAD_ONLY */
  509. wchar_t * __cdecl _wgetenv_lk(const wchar_t *); /* _MTHREAD_ONLY */
  510. int __cdecl _putenv_lk(const char *); /* _MTHREAD_ONLY */
  511. int __cdecl _wputenv_lk(const wchar_t *); /* _MTHREAD_ONLY */
  512. int __cdecl _mblen_lk(const char *, size_t); /* _MTHREAD_ONLY */
  513. int __cdecl __mbtowc_mt(pthreadlocinfo, wchar_t*, const char*,size_t); /* _MTHREAD_ONLY */
  514. size_t __cdecl __mbstowcs_mt(pthreadlocinfo, wchar_t*, const char*,size_t); /* _MTHREAD_ONLY */
  515. int __cdecl __wctomb_mt(pthreadlocinfo, char*, wchar_t); /* _MTHREAD_ONLY */
  516. size_t __cdecl __wcstombs_mt(pthreadlocinfo, char*, const wchar_t*,size_t); /* _MTHREAD_ONLY */
  517. #else /* _MTHREAD_ONLY */
  518. #define _getenv_lk(envvar) getenv(envvar) /* _MTHREAD_ONLY */
  519. #define _wgetenv_lk(envvar) _wgetenv(envvar) /* _MTHREAD_ONLY */
  520. #define _putenv_lk(envvar) _putenv(envvar) /* _MTHREAD_ONLY */
  521. #define _wputenv_lk(envvar) _wputenv(envvar) /* _MTHREAD_ONLY */
  522. #define _mblen_lk(s,n) mblen(s,n) /* _MTHREAD_ONLY */
  523. #define __mbtowc_mt(p,pwc,s,n) mbtowc(pwc,s,n) /* _MTHREAD_ONLY */
  524. #define __mbstowcs_mt(p,pwcs,s,n) mbstowcs(pwcs,s,n) /* _MTHREAD_ONLY */
  525. #define __wctomb_mt(p,s,wchar) wctomb(s,wchar) /* _MTHREAD_ONLY */
  526. #define __wcstombs_mt(p,s,pwcs,n) wcstombs(s,pwcs,n) /* _MTHREAD_ONLY */
  527. /* _MTHREAD_ONLY */
  528. #endif /* _MTHREAD_ONLY */
  529. #if !__STDC__
  530. #ifndef _POSIX_
  531. /* Non-ANSI names for compatibility */
  532. #ifndef __cplusplus
  533. #define max(a,b) (((a) > (b)) ? (a) : (b))
  534. #define min(a,b) (((a) < (b)) ? (a) : (b))
  535. #endif
  536. #define sys_errlist _sys_errlist
  537. #define sys_nerr _sys_nerr
  538. #define environ _environ
  539. _CRTIMP char * __cdecl ecvt(double, int, int *, int *);
  540. _CRTIMP char * __cdecl fcvt(double, int, int *, int *);
  541. _CRTIMP char * __cdecl gcvt(double, int, char *);
  542. _CRTIMP char * __cdecl itoa(int, char *, int);
  543. _CRTIMP char * __cdecl ltoa(long, char *, int);
  544. onexit_t __cdecl onexit(onexit_t);
  545. _CRTIMP int __cdecl putenv(const char *);
  546. _CRTIMP void __cdecl swab(char *, char *, int);
  547. _CRTIMP char * __cdecl ultoa(unsigned long, char *, int);
  548. #endif /* _POSIX_ */
  549. #endif /* __STDC__ */
  550. #ifdef __cplusplus
  551. }
  552. #endif
  553. #ifdef _MSC_VER
  554. #pragma pack(pop)
  555. #endif /* _MSC_VER */
  556. #endif /* _INC_STDLIB */