Leaked source code of windows server 2003
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.

671 lines
27 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
  169. * msvcprt.lib to work with STATIC_CPPLIB
  170. * 07-15-01 PML Remove all ALPHA, MIPS, and PPC code
  171. * 03-04-02 PML Add __declspec(noalias, restrict) support
  172. *
  173. ****/
  174. #if _MSC_VER > 1000 /*IFSTRIP=IGN*/
  175. #pragma once
  176. #endif
  177. #ifndef _INC_STDLIB
  178. #define _INC_STDLIB
  179. #if !defined(_WIN32)
  180. #error ERROR: Only Win32 target supported!
  181. #endif
  182. #ifndef _CRTBLD
  183. /* This version of the header files is NOT for user programs.
  184. * It is intended for use when building the C runtimes ONLY.
  185. * The version intended for public use will not have this message.
  186. */
  187. #error ERROR: Use of C runtime library internal header file.
  188. #endif /* _CRTBLD */
  189. #ifdef _MSC_VER
  190. /*
  191. * Currently, all MS C compilers for Win32 platforms default to 8 byte
  192. * alignment.
  193. */
  194. #pragma pack(push,8)
  195. #endif /* _MSC_VER */
  196. #ifdef __cplusplus
  197. extern "C" {
  198. #endif
  199. #ifndef _INTERNAL_IFSTRIP_
  200. #include <cruntime.h>
  201. #endif /* _INTERNAL_IFSTRIP_ */
  202. #if !defined(_W64)
  203. #if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 /*IFSTRIP=IGN*/
  204. #define _W64 __w64
  205. #else
  206. #define _W64
  207. #endif
  208. #endif
  209. /* Define _CRTIMP */
  210. #ifndef _CRTIMP
  211. #ifdef CRTDLL
  212. #define _CRTIMP __declspec(dllexport)
  213. #else /* ndef CRTDLL */
  214. #ifdef _DLL
  215. #define _CRTIMP __declspec(dllimport)
  216. #else /* ndef _DLL */
  217. #define _CRTIMP
  218. #endif /* _DLL */
  219. #endif /* CRTDLL */
  220. #endif /* _CRTIMP */
  221. /* Define _CRTNOALIAS, _CRTRESTRICT */
  222. #if _MSC_FULL_VER >= 14002050 /*IFSTRIP=IGN*/
  223. #ifndef _CRTNOALIAS
  224. #ifndef _INTERNAL_IFSTRIP_
  225. #define _CRTNOALIAS
  226. #else
  227. #define _CRTNOALIAS __declspec(noalias)
  228. #endif
  229. #endif /* _CRTNOALIAS */
  230. #ifndef _CRTRESTRICT
  231. #ifndef _INTERNAL_IFSTRIP_
  232. #define _CRTRESTRICT
  233. #else
  234. #define _CRTRESTRICT __declspec(restrict)
  235. #endif
  236. #endif /* _CRTRESTRICT */
  237. #else
  238. #ifndef _CRTNOALIAS
  239. #define _CRTNOALIAS
  240. #endif /* _CRTNOALIAS */
  241. #ifndef _CRTRESTRICT
  242. #define _CRTRESTRICT
  243. #endif /* _CRTRESTRICT */
  244. #endif
  245. /* Define __cdecl for non-Microsoft compilers */
  246. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  247. #define __cdecl
  248. #endif
  249. #ifndef _SIZE_T_DEFINED
  250. #ifdef _WIN64
  251. typedef unsigned __int64 size_t;
  252. #else
  253. typedef _W64 unsigned int size_t;
  254. #endif
  255. #define _SIZE_T_DEFINED
  256. #endif
  257. #ifndef _WCHAR_T_DEFINED
  258. typedef unsigned short wchar_t;
  259. #define _WCHAR_T_DEFINED
  260. #endif
  261. /* Define NULL pointer value */
  262. #ifndef NULL
  263. #ifdef __cplusplus
  264. #define NULL 0
  265. #else
  266. #define NULL ((void *)0)
  267. #endif
  268. #endif
  269. /* Definition of the argument values for the exit() function */
  270. #define EXIT_SUCCESS 0
  271. #define EXIT_FAILURE 1
  272. #ifndef _ONEXIT_T_DEFINED
  273. typedef int (__cdecl * _onexit_t)(void);
  274. #if !__STDC__
  275. /* Non-ANSI name for compatibility */
  276. #define onexit_t _onexit_t
  277. #endif
  278. #define _ONEXIT_T_DEFINED
  279. #endif
  280. /* Data structure definitions for div and ldiv runtimes. */
  281. #ifndef _DIV_T_DEFINED
  282. typedef struct _div_t {
  283. int quot;
  284. int rem;
  285. } div_t;
  286. typedef struct _ldiv_t {
  287. long quot;
  288. long rem;
  289. } ldiv_t;
  290. #define _DIV_T_DEFINED
  291. #endif
  292. /* Maximum value that can be returned by the rand function. */
  293. #define RAND_MAX 0x7fff
  294. /*
  295. * Maximum number of bytes in multi-byte character in the current locale
  296. * (also defined in ctype.h).
  297. */
  298. #ifndef MB_CUR_MAX
  299. #ifndef _INTERNAL_IFSTRIP_
  300. #if defined(_DLL) && defined(_M_IX86)
  301. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  302. _CRTIMP int * __cdecl __p___mb_cur_max(void);
  303. #endif
  304. #endif /* _INTERNAL_IFSTRIP_ */
  305. #define MB_CUR_MAX __mb_cur_max
  306. _CRTIMP extern int __mb_cur_max;
  307. _CRTIMP int __cdecl ___mb_cur_max_func(void);
  308. #endif /* MB_CUR_MAX */
  309. /* Minimum and maximum macros */
  310. #define __max(a,b) (((a) > (b)) ? (a) : (b))
  311. #define __min(a,b) (((a) < (b)) ? (a) : (b))
  312. /*
  313. * Sizes for buffers used by the _makepath() and _splitpath() functions.
  314. * note that the sizes include space for 0-terminator
  315. */
  316. #define _MAX_PATH 260 /* max. length of full pathname */
  317. #define _MAX_DRIVE 3 /* max. length of drive component */
  318. #define _MAX_DIR 256 /* max. length of path component */
  319. #define _MAX_FNAME 256 /* max. length of file name component */
  320. #define _MAX_EXT 256 /* max. length of extension component */
  321. /*
  322. * Argument values for _set_error_mode().
  323. */
  324. #define _OUT_TO_DEFAULT 0
  325. #define _OUT_TO_STDERR 1
  326. #define _OUT_TO_MSGBOX 2
  327. #define _REPORT_ERRMODE 3
  328. #if defined(_M_IX86)
  329. /*
  330. * Typedefs and argument values for _set_security_error_handler()
  331. */
  332. #define _SECERR_BUFFER_OVERRUN 1 /* void* arg ignored */
  333. typedef void (__cdecl * _secerr_handler_func)(int, void *);
  334. #endif
  335. /* External variable declarations */
  336. #if defined(_MT) || defined(_DLL)
  337. _CRTIMP int * __cdecl _errno(void);
  338. _CRTIMP unsigned long * __cdecl __doserrno(void);
  339. #define errno (*_errno())
  340. #define _doserrno (*__doserrno())
  341. #else /* ndef _MT && ndef _DLL */
  342. _CRTIMP extern int errno; /* XENIX style error number */
  343. _CRTIMP extern unsigned long _doserrno; /* OS system error value */
  344. #endif /* _MT || _DLL */
  345. _CRTIMP extern char * _sys_errlist[]; /* perror error message table */
  346. _CRTIMP extern int _sys_nerr; /* # of entries in sys_errlist table */
  347. #if defined(_DLL) && defined(_M_IX86)
  348. _CRTIMP int * __cdecl __p___argc(void);
  349. _CRTIMP char *** __cdecl __p___argv(void);
  350. _CRTIMP wchar_t *** __cdecl __p___wargv(void);
  351. _CRTIMP char *** __cdecl __p__environ(void);
  352. _CRTIMP wchar_t *** __cdecl __p__wenviron(void);
  353. _CRTIMP char ** __cdecl __p__pgmptr(void);
  354. _CRTIMP wchar_t ** __cdecl __p__wpgmptr(void);
  355. #ifndef _INTERNAL_IFSTRIP_
  356. /* Retained for compatibility with VC++ 5.0 and earlier versions */
  357. _CRTIMP int * __cdecl __p__fmode(void);
  358. _CRTIMP int * __cdecl __p__fileinfo(void);
  359. _CRTIMP unsigned int * __cdecl __p__osver(void);
  360. _CRTIMP unsigned int * __cdecl __p__winver(void);
  361. _CRTIMP unsigned int * __cdecl __p__winmajor(void);
  362. _CRTIMP unsigned int * __cdecl __p__winminor(void);
  363. #endif /* _INTERNAL_IFSTRIP_ */
  364. #endif /* _M_IX86 && _DLL */
  365. _CRTIMP extern int __argc; /* count of cmd line args */
  366. _CRTIMP extern char ** __argv; /* pointer to table of cmd line args */
  367. _CRTIMP extern wchar_t ** __wargv; /* pointer to table of wide cmd line args */
  368. #ifdef _POSIX_
  369. extern char ** environ; /* pointer to environment table */
  370. #else
  371. _CRTIMP extern char ** _environ; /* pointer to environment table */
  372. _CRTIMP extern wchar_t ** _wenviron; /* pointer to wide environment table */
  373. #endif /* _POSIX_ */
  374. _CRTIMP extern char * _pgmptr; /* points to the module (EXE) name */
  375. _CRTIMP extern wchar_t * _wpgmptr; /* points to the module (EXE) wide name */
  376. #ifdef SPECIAL_CRTEXE
  377. extern int _fmode; /* default file translation mode */
  378. #else
  379. _CRTIMP extern int _fmode; /* default file translation mode */
  380. #endif
  381. _CRTIMP extern int _fileinfo; /* open file info mode (for spawn) */
  382. /* Windows major/minor and O.S. version numbers */
  383. _CRTIMP extern unsigned int _osplatform;
  384. _CRTIMP extern unsigned int _osver;
  385. _CRTIMP extern unsigned int _winver;
  386. _CRTIMP extern unsigned int _winmajor;
  387. _CRTIMP extern unsigned int _winminor;
  388. /* function prototypes */
  389. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  390. _CRTIMP __declspec(noreturn) void __cdecl abort(void);
  391. _CRTIMP __declspec(noreturn) void __cdecl exit(int);
  392. #else
  393. _CRTIMP void __cdecl abort(void);
  394. _CRTIMP void __cdecl exit(int);
  395. #endif
  396. int __cdecl abs(int);
  397. __int64 __cdecl _abs64(__int64);
  398. int __cdecl atexit(void (__cdecl *)(void));
  399. _CRTIMP double __cdecl atof(const char *);
  400. _CRTIMP int __cdecl atoi(const char *);
  401. _CRTIMP long __cdecl atol(const char *);
  402. _CRTIMP void * __cdecl bsearch(const void *, const void *, size_t, size_t,
  403. int (__cdecl *)(const void *, const void *));
  404. unsigned short __cdecl _byteswap_ushort(unsigned short);
  405. unsigned long __cdecl _byteswap_ulong (unsigned long);
  406. unsigned __int64 __cdecl _byteswap_uint64(unsigned __int64);
  407. _CRTIMP _CRTNOALIAS _CRTRESTRICT void * __cdecl calloc(size_t, size_t);
  408. _CRTIMP div_t __cdecl div(int, int);
  409. _CRTIMP _CRTNOALIAS void __cdecl free(void *);
  410. _CRTIMP char * __cdecl getenv(const char *);
  411. _CRTIMP char * __cdecl _itoa(int, char *, int);
  412. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  413. _CRTIMP char * __cdecl _i64toa(__int64, char *, int);
  414. _CRTIMP char * __cdecl _ui64toa(unsigned __int64, char *, int);
  415. _CRTIMP __int64 __cdecl _atoi64(const char *);
  416. _CRTIMP __int64 __cdecl _strtoi64(const char *, char **, int);
  417. _CRTIMP unsigned __int64 __cdecl _strtoui64(const char *, char **, int);
  418. #endif
  419. long __cdecl labs(long);
  420. _CRTIMP ldiv_t __cdecl ldiv(long, long);
  421. _CRTIMP char * __cdecl _ltoa(long, char *, int);
  422. _CRTIMP _CRTNOALIAS _CRTRESTRICT void * __cdecl malloc(size_t);
  423. _CRTIMP int __cdecl mblen(const char *, size_t);
  424. _CRTIMP size_t __cdecl _mbstrlen(const char *s);
  425. _CRTIMP int __cdecl mbtowc(wchar_t *, const char *, size_t);
  426. _CRTIMP size_t __cdecl mbstowcs(wchar_t *, const char *, size_t);
  427. _CRTIMP void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)
  428. (const void *, const void *));
  429. _CRTIMP int __cdecl rand(void);
  430. _CRTIMP _CRTNOALIAS _CRTRESTRICT void * __cdecl realloc(void *, size_t);
  431. _CRTIMP int __cdecl _set_error_mode(int);
  432. #if defined(_M_IX86)
  433. _CRTIMP _secerr_handler_func
  434. __cdecl _set_security_error_handler(_secerr_handler_func);
  435. #endif
  436. _CRTIMP void __cdecl srand(unsigned int);
  437. _CRTIMP double __cdecl strtod(const char *, char **);
  438. _CRTIMP long __cdecl strtol(const char *, char **, int);
  439. _CRTIMP unsigned long __cdecl strtoul(const char *, char **, int);
  440. _CRTIMP int __cdecl system(const char *);
  441. _CRTIMP char * __cdecl _ultoa(unsigned long, char *, int);
  442. _CRTIMP int __cdecl wctomb(char *, wchar_t);
  443. _CRTIMP size_t __cdecl wcstombs(char *, const wchar_t *, size_t);
  444. #ifndef _WSTDLIB_DEFINED
  445. /* wide function prototypes, also declared in wchar.h */
  446. _CRTIMP wchar_t * __cdecl _itow (int, wchar_t *, int);
  447. _CRTIMP wchar_t * __cdecl _ltow (long, wchar_t *, int);
  448. _CRTIMP wchar_t * __cdecl _ultow (unsigned long, wchar_t *, int);
  449. _CRTIMP double __cdecl wcstod(const wchar_t *, wchar_t **);
  450. _CRTIMP long __cdecl wcstol(const wchar_t *, wchar_t **, int);
  451. _CRTIMP unsigned long __cdecl wcstoul(const wchar_t *, wchar_t **, int);
  452. _CRTIMP wchar_t * __cdecl _wgetenv(const wchar_t *);
  453. _CRTIMP int __cdecl _wsystem(const wchar_t *);
  454. _CRTIMP double __cdecl _wtof(const wchar_t *);
  455. _CRTIMP int __cdecl _wtoi(const wchar_t *);
  456. _CRTIMP long __cdecl _wtol(const wchar_t *);
  457. #if _INTEGRAL_MAX_BITS >= 64 /*IFSTRIP=IGN*/
  458. _CRTIMP wchar_t * __cdecl _i64tow(__int64, wchar_t *, int);
  459. _CRTIMP wchar_t * __cdecl _ui64tow(unsigned __int64, wchar_t *, int);
  460. _CRTIMP __int64 __cdecl _wtoi64(const wchar_t *);
  461. _CRTIMP __int64 __cdecl _wcstoi64(const wchar_t *, wchar_t **, int);
  462. _CRTIMP unsigned __int64 __cdecl _wcstoui64(const wchar_t *, wchar_t **, int);
  463. #endif
  464. #define _WSTDLIB_DEFINED
  465. #endif
  466. #ifndef _POSIX_
  467. _CRTIMP char * __cdecl _ecvt(double, int, int *, int *);
  468. #if _MSC_VER >= 1200 /*IFSTRIP=IGN*/
  469. _CRTIMP __declspec(noreturn) void __cdecl _exit(int);
  470. #else
  471. _CRTIMP void __cdecl _exit(int);
  472. #endif
  473. _CRTIMP char * __cdecl _fcvt(double, int, int *, int *);
  474. _CRTIMP char * __cdecl _fullpath(char *, const char *, size_t);
  475. _CRTIMP char * __cdecl _gcvt(double, int, char *);
  476. unsigned long __cdecl _lrotl(unsigned long, int);
  477. unsigned long __cdecl _lrotr(unsigned long, int);
  478. _CRTIMP void __cdecl _makepath(char *, const char *, const char *, const char *,
  479. const char *);
  480. _onexit_t __cdecl _onexit(_onexit_t);
  481. _CRTIMP void __cdecl perror(const char *);
  482. _CRTIMP int __cdecl _putenv(const char *);
  483. unsigned int __cdecl _rotl(unsigned int, int);
  484. unsigned __int64 __cdecl _rotl64(unsigned __int64, int);
  485. unsigned int __cdecl _rotr(unsigned int, int);
  486. unsigned __int64 __cdecl _rotr64(unsigned __int64, int);
  487. _CRTIMP void __cdecl _searchenv(const char *, const char *, char *);
  488. _CRTIMP void __cdecl _splitpath(const char *, char *, char *, char *, char *);
  489. _CRTIMP void __cdecl _swab(char *, char *, int);
  490. #ifndef _WSTDLIBP_DEFINED
  491. /* wide function prototypes, also declared in wchar.h */
  492. _CRTIMP wchar_t * __cdecl _wfullpath(wchar_t *, const wchar_t *, size_t);
  493. _CRTIMP void __cdecl _wmakepath(wchar_t *, const wchar_t *, const wchar_t *, const wchar_t *,
  494. const wchar_t *);
  495. _CRTIMP void __cdecl _wperror(const wchar_t *);
  496. _CRTIMP int __cdecl _wputenv(const wchar_t *);
  497. _CRTIMP void __cdecl _wsearchenv(const wchar_t *, const wchar_t *, wchar_t *);
  498. _CRTIMP void __cdecl _wsplitpath(const wchar_t *, wchar_t *, wchar_t *, wchar_t *, wchar_t *);
  499. #define _WSTDLIBP_DEFINED
  500. #endif
  501. /* --------- The following functions are OBSOLETE --------- */
  502. /* The Win32 API SetErrorMode, Beep and Sleep should be used instead. */
  503. _CRTIMP void __cdecl _seterrormode(int);
  504. _CRTIMP void __cdecl _beep(unsigned, unsigned);
  505. _CRTIMP void __cdecl _sleep(unsigned long);
  506. /* --------- The preceding functions are OBSOLETE --------- */
  507. #endif /* _POSIX_ */
  508. #if !__STDC__
  509. /* --------- The declarations below should not be in stdlib.h --------- */
  510. /* --------- and will be removed in a future release. Include --------- */
  511. /* --------- ctype.h to obtain these declarations. --------- */
  512. #ifndef tolower /* tolower has been undefined - use function */
  513. _CRTIMP int __cdecl tolower(int);
  514. #endif /* tolower */
  515. #ifndef toupper /* toupper has been undefined - use function */
  516. _CRTIMP int __cdecl toupper(int);
  517. #endif /* toupper */
  518. /* --------- The declarations above will be removed. --------- */
  519. #endif
  520. #ifdef _MT /* _MTHREAD_ONLY */
  521. /* _MTHREAD_ONLY */
  522. struct threadlocaleinfostruct; /* _MTHREAD_ONLY */
  523. typedef struct threadlocaleinfostruct * pthreadlocinfo; /* _MTHREAD_ONLY */
  524. /* _MTHREAD_ONLY */
  525. char * __cdecl _getenv_lk(const char *); /* _MTHREAD_ONLY */
  526. wchar_t * __cdecl _wgetenv_lk(const wchar_t *); /* _MTHREAD_ONLY */
  527. int __cdecl _putenv_lk(const char *); /* _MTHREAD_ONLY */
  528. int __cdecl _wputenv_lk(const wchar_t *); /* _MTHREAD_ONLY */
  529. int __cdecl _mblen_lk(const char *, size_t); /* _MTHREAD_ONLY */
  530. int __cdecl __mbtowc_mt(pthreadlocinfo, wchar_t*, const char*,size_t); /* _MTHREAD_ONLY */
  531. size_t __cdecl __mbstowcs_mt(pthreadlocinfo, wchar_t*, const char*,size_t); /* _MTHREAD_ONLY */
  532. int __cdecl __wctomb_mt(pthreadlocinfo, char*, wchar_t); /* _MTHREAD_ONLY */
  533. size_t __cdecl __wcstombs_mt(pthreadlocinfo, char*, const wchar_t*,size_t); /* _MTHREAD_ONLY */
  534. #else /* _MTHREAD_ONLY */
  535. #define _getenv_lk(envvar) getenv(envvar) /* _MTHREAD_ONLY */
  536. #define _wgetenv_lk(envvar) _wgetenv(envvar) /* _MTHREAD_ONLY */
  537. #define _putenv_lk(envvar) _putenv(envvar) /* _MTHREAD_ONLY */
  538. #define _wputenv_lk(envvar) _wputenv(envvar) /* _MTHREAD_ONLY */
  539. #define _mblen_lk(s,n) mblen(s,n) /* _MTHREAD_ONLY */
  540. #define __mbtowc_mt(p,pwc,s,n) mbtowc(pwc,s,n) /* _MTHREAD_ONLY */
  541. #define __mbstowcs_mt(p,pwcs,s,n) mbstowcs(pwcs,s,n) /* _MTHREAD_ONLY */
  542. #define __wctomb_mt(p,s,wchar) wctomb(s,wchar) /* _MTHREAD_ONLY */
  543. #define __wcstombs_mt(p,s,pwcs,n) wcstombs(s,pwcs,n) /* _MTHREAD_ONLY */
  544. /* _MTHREAD_ONLY */
  545. #endif /* _MTHREAD_ONLY */
  546. #if !__STDC__
  547. #ifndef _POSIX_
  548. /* Non-ANSI names for compatibility */
  549. #ifndef __cplusplus
  550. #define max(a,b) (((a) > (b)) ? (a) : (b))
  551. #define min(a,b) (((a) < (b)) ? (a) : (b))
  552. #endif
  553. #define sys_errlist _sys_errlist
  554. #define sys_nerr _sys_nerr
  555. #define environ _environ
  556. _CRTIMP char * __cdecl ecvt(double, int, int *, int *);
  557. _CRTIMP char * __cdecl fcvt(double, int, int *, int *);
  558. _CRTIMP char * __cdecl gcvt(double, int, char *);
  559. _CRTIMP char * __cdecl itoa(int, char *, int);
  560. _CRTIMP char * __cdecl ltoa(long, char *, int);
  561. onexit_t __cdecl onexit(onexit_t);
  562. _CRTIMP int __cdecl putenv(const char *);
  563. _CRTIMP void __cdecl swab(char *, char *, int);
  564. _CRTIMP char * __cdecl ultoa(unsigned long, char *, int);
  565. #endif /* _POSIX_ */
  566. #endif /* __STDC__ */
  567. #ifdef __cplusplus
  568. }
  569. #endif
  570. #ifdef _MSC_VER
  571. #pragma pack(pop)
  572. #endif /* _MSC_VER */
  573. #endif /* _INC_STDLIB */