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.

263 lines
6.9 KiB

  1. /***
  2. *stdlib.h - declarations/definitions for commonly used library functions
  3. *
  4. * Copyright (c) 1985-1992, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * This include file contains the function declarations for
  8. * commonly used library functions which either don't fit somewhere
  9. * else, or, like toupper/tolower, can't be declared in the normal
  10. * place for other reasons.
  11. * [ANSI]
  12. *
  13. ****/
  14. #ifndef _INC_STDLIB
  15. #ifdef __cplusplus
  16. extern "C" {
  17. #endif
  18. #if (_MSC_VER <= 600)
  19. #define __cdecl _cdecl
  20. #define __far _far
  21. #define __near _near
  22. #define __pascal _pascal
  23. #endif
  24. #ifndef _SIZE_T_DEFINED
  25. typedef unsigned int size_t;
  26. #define _SIZE_T_DEFINED
  27. #endif
  28. #ifndef _WCHAR_T_DEFINED
  29. typedef unsigned short wchar_t;
  30. #define _WCHAR_T_DEFINED
  31. #endif
  32. /* define NULL pointer value */
  33. #ifndef NULL
  34. #ifdef __cplusplus
  35. #define NULL 0
  36. #else
  37. #define NULL ((void *)0)
  38. #endif
  39. #endif
  40. /* exit() arg values */
  41. #define EXIT_SUCCESS 0
  42. #define EXIT_FAILURE 1
  43. #ifndef _ONEXIT_T_DEFINED
  44. typedef int (__cdecl * _onexit_t)();
  45. typedef int (__far __cdecl * _fonexit_t)();
  46. #ifndef __STDC__
  47. /* Non-ANSI name for compatibility */
  48. typedef int (__cdecl * onexit_t)();
  49. #endif
  50. #define _ONEXIT_T_DEFINED
  51. #endif
  52. /* data structure definitions for div and ldiv runtimes. */
  53. #ifndef _DIV_T_DEFINED
  54. typedef struct _div_t {
  55. int quot;
  56. int rem;
  57. } div_t;
  58. typedef struct _ldiv_t {
  59. long quot;
  60. long rem;
  61. } ldiv_t;
  62. #define _DIV_T_DEFINED
  63. #endif
  64. /* maximum value that can be returned by the rand function. */
  65. #define RAND_MAX 0x7fff
  66. extern unsigned short __mb_cur_max; /* mb-len for curr. locale */
  67. #define MB_CUR_MAX __mb_cur_max
  68. /* min and max macros */
  69. #define __max(a,b) (((a) > (b)) ? (a) : (b))
  70. #define __min(a,b) (((a) < (b)) ? (a) : (b))
  71. /* sizes for buffers used by the _makepath() and _splitpath() functions.
  72. * note that the sizes include space for 0-terminator
  73. */
  74. #define _MAX_PATH 260 /* max. length of full pathname */
  75. #define _MAX_DRIVE 3 /* max. length of drive component */
  76. #define _MAX_DIR 256 /* max. length of path component */
  77. #define _MAX_FNAME 256 /* max. length of file name component */
  78. #define _MAX_EXT 256 /* max. length of extension component */
  79. /* external variable declarations */
  80. extern int __near __cdecl volatile errno; /* error value */
  81. extern int __near __cdecl _doserrno; /* OS system error value */
  82. extern char * __near __cdecl _sys_errlist[]; /* perror error message table */
  83. extern int __near __cdecl _sys_nerr; /* # of entries in sys_errlist table */
  84. extern char ** __near __cdecl _environ; /* pointer to environment table */
  85. extern int __near __cdecl _fmode; /* default file translation mode */
  86. #ifndef _WINDOWS
  87. extern int __near __cdecl _fileinfo; /* open file info mode (for spawn) */
  88. #endif
  89. extern unsigned int __near __cdecl _psp; /* Program Segment Prefix */
  90. /* OS major/minor version numbers */
  91. extern unsigned char __near __cdecl _osmajor;
  92. extern unsigned char __near __cdecl _osminor;
  93. /* OS mode */
  94. #define _DOS_MODE 0 /* DOS */
  95. #define _OS2_MODE 1 /* OS/2 */
  96. #define _WIN_MODE 2 /* Windows */
  97. extern unsigned char __near __cdecl _osmode;
  98. /* CPU mode */
  99. #define _REAL_MODE 0 /* real mode */
  100. #define _PROT_MODE 1 /* protect mode */
  101. extern unsigned char __near __cdecl _cpumode;
  102. /* function prototypes */
  103. double __cdecl atof(const char *);
  104. double __cdecl strtod(const char *, char * *);
  105. ldiv_t __cdecl ldiv(long, long);
  106. void __cdecl abort(void);
  107. int __cdecl abs(int);
  108. int __cdecl atexit(void (__cdecl *)(void));
  109. int __cdecl atoi(const char *);
  110. long __cdecl atol(const char *);
  111. long double __cdecl _atold(const char *);
  112. void * __cdecl bsearch(const void *, const void *,
  113. size_t, size_t, int (__cdecl *)(const void *,
  114. const void *));
  115. void * __cdecl calloc(size_t, size_t);
  116. div_t __cdecl div(int, int);
  117. char * __cdecl _ecvt(double, int, int *, int *);
  118. #ifndef _WINDLL
  119. void __cdecl exit(int);
  120. void __cdecl _exit(int);
  121. #endif
  122. int __far __cdecl _fatexit(void (__cdecl __far *)(void));
  123. char * __cdecl _fcvt(double, int, int *, int *);
  124. _fonexit_t __far __cdecl _fonexit(_fonexit_t);
  125. void __cdecl free(void *);
  126. char * __cdecl _fullpath(char *, const char *,
  127. size_t);
  128. char * __cdecl _gcvt(double, int, char *);
  129. char * __cdecl getenv(const char *);
  130. char * __cdecl _itoa(int, char *, int);
  131. long __cdecl labs(long);
  132. unsigned long __cdecl _lrotl(unsigned long, int);
  133. unsigned long __cdecl _lrotr(unsigned long, int);
  134. char * __cdecl _ltoa(long, char *, int);
  135. void __cdecl _makepath(char *, const char *,
  136. const char *, const char *, const char *);
  137. void * __cdecl malloc(size_t);
  138. _onexit_t __cdecl _onexit(_onexit_t);
  139. #ifndef _WINDLL
  140. void __cdecl perror(const char *);
  141. #endif
  142. int __cdecl _putenv(const char *);
  143. void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)
  144. (const void *, const void *));
  145. unsigned int __cdecl _rotl(unsigned int, int);
  146. unsigned int __cdecl _rotr(unsigned int, int);
  147. int __cdecl rand(void);
  148. void * __cdecl realloc(void *, size_t);
  149. void __cdecl _searchenv(const char *, const char *,
  150. char *);
  151. void __cdecl _splitpath(const char *, char *,
  152. char *, char *, char *);
  153. void __cdecl srand(unsigned int);
  154. long __cdecl strtol(const char *, char * *,
  155. int);
  156. long double __cdecl _strtold(const char *,
  157. char * *);
  158. unsigned long __cdecl strtoul(const char *,
  159. char * *, int);
  160. void __cdecl _swab(char *, char *, int);
  161. #ifndef _WINDOWS
  162. int __cdecl system(const char *);
  163. #endif
  164. char * __cdecl _ultoa(unsigned long, char *, int);
  165. int __cdecl mblen(const char *, size_t);
  166. int __cdecl mbtowc(wchar_t *, const char *, size_t);
  167. int __cdecl wctomb(char *, wchar_t);
  168. size_t __cdecl mbstowcs(wchar_t *, const char *, size_t);
  169. size_t __cdecl wcstombs(char *, const wchar_t *, size_t);
  170. /* model-independent function prototypes */
  171. int __far __cdecl _fmblen(const char __far *, size_t);
  172. int __far __cdecl _fmbtowc(wchar_t __far *, const char __far *,
  173. size_t);
  174. int __far __cdecl _fwctomb(char __far *, wchar_t);
  175. size_t __far __cdecl _fmbstowcs(wchar_t __far *, const char __far *,
  176. size_t);
  177. size_t __far __cdecl _fwcstombs(char __far *, const wchar_t __far *,
  178. size_t);
  179. #ifndef tolower /* tolower has been undefined - use function */
  180. int __cdecl tolower(int);
  181. #endif /* tolower */
  182. #ifndef toupper /* toupper has been undefined - use function */
  183. int __cdecl toupper(int);
  184. #endif /* toupper */
  185. #ifndef __STDC__
  186. /* Non-ANSI names for compatibility */
  187. #ifndef __cplusplus
  188. #define max(a,b) (((a) > (b)) ? (a) : (b))
  189. #define min(a,b) (((a) < (b)) ? (a) : (b))
  190. #endif
  191. extern char * __near __cdecl sys_errlist[];
  192. extern int __near __cdecl sys_nerr;
  193. extern char ** __near __cdecl environ;
  194. #define DOS_MODE _DOS_MODE
  195. #define OS2_MODE _OS2_MODE
  196. char * __cdecl ecvt(double, int, int *, int *);
  197. char * __cdecl fcvt(double, int, int *, int *);
  198. char * __cdecl gcvt(double, int, char *);
  199. char * __cdecl itoa(int, char *, int);
  200. char * __cdecl ltoa(long, char *, int);
  201. onexit_t __cdecl onexit(onexit_t);
  202. int __cdecl putenv(const char *);
  203. void __cdecl swab(char *, char *, int);
  204. char * __cdecl ultoa(unsigned long, char *, int);
  205. #endif /* __STDC__ */
  206. #ifdef __cplusplus
  207. }
  208. #endif
  209. #define _INC_STDLIB
  210. #endif /* _INC_STDLIB */