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.

282 lines
7.8 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. #ifdef _MT
  81. extern int __far * __cdecl __far volatile _errno(void);
  82. extern int __far * __cdecl __far __doserrno(void);
  83. #define errno (*_errno())
  84. #define _doserrno (*__doserrno())
  85. #else
  86. extern int __near __cdecl volatile errno; /* error value */
  87. extern int __near __cdecl _doserrno; /* OS system error value */
  88. #endif
  89. extern char * __near __cdecl _sys_errlist[]; /* perror error message table */
  90. extern int __near __cdecl _sys_nerr; /* # of entries in sys_errlist table */
  91. extern char ** __near __cdecl _environ; /* pointer to environment table */
  92. extern int __near __cdecl _fmode; /* default file translation mode */
  93. #ifndef _WINDOWS
  94. extern int __near __cdecl _fileinfo; /* open file info mode (for spawn) */
  95. #endif
  96. extern unsigned int __near __cdecl _psp; /* Program Segment Prefix */
  97. extern char __far * __near __cdecl _pgmptr; /* Pointer to Program name */
  98. /* DOS and Windows major/minor version numbers */
  99. extern unsigned int __near __cdecl _osver;
  100. extern unsigned char __near __cdecl _osmajor;
  101. extern unsigned char __near __cdecl _osminor;
  102. extern unsigned int __near __cdecl _winver;
  103. extern unsigned char __near __cdecl _winmajor;
  104. extern unsigned char __near __cdecl _winminor;
  105. /* OS mode */
  106. #define _DOS_MODE 0 /* DOS */
  107. #define _OS2_MODE 1 /* OS/2 */
  108. #define _WIN_MODE 2 /* Windows */
  109. extern unsigned char __near __cdecl _osmode;
  110. /* CPU mode */
  111. #define _REAL_MODE 0 /* real mode */
  112. #define _PROT_MODE 1 /* protect mode */
  113. extern unsigned char __near __cdecl _cpumode;
  114. /* function prototypes */
  115. #ifdef _MT
  116. double __pascal atof(const char *);
  117. double __pascal strtod(const char *, char * *);
  118. ldiv_t __pascal ldiv(long, long);
  119. #else
  120. double __cdecl atof(const char *);
  121. double __cdecl strtod(const char *, char * *);
  122. ldiv_t __cdecl ldiv(long, long);
  123. #endif
  124. void __cdecl abort(void);
  125. int __cdecl abs(int);
  126. int __cdecl atexit(void (__cdecl *)(void));
  127. int __cdecl atoi(const char *);
  128. long __cdecl atol(const char *);
  129. long double __cdecl _atold(const char *);
  130. void * __cdecl bsearch(const void *, const void *,
  131. size_t, size_t, int (__cdecl *)(const void *,
  132. const void *));
  133. void * __cdecl calloc(size_t, size_t);
  134. div_t __cdecl div(int, int);
  135. char * __cdecl _ecvt(double, int, int *, int *);
  136. #ifndef _WINDLL
  137. void __cdecl exit(int);
  138. void __cdecl _exit(int);
  139. #endif
  140. int __far __cdecl _fatexit(void (__cdecl __far *)(void));
  141. char * __cdecl _fcvt(double, int, int *, int *);
  142. _fonexit_t __far __cdecl _fonexit(_fonexit_t);
  143. void __cdecl free(void *);
  144. char * __cdecl _fullpath(char *, const char *,
  145. size_t);
  146. char * __cdecl _gcvt(double, int, char *);
  147. char * __cdecl getenv(const char *);
  148. char * __cdecl _itoa(int, char *, int);
  149. long __cdecl labs(long);
  150. unsigned long __cdecl _lrotl(unsigned long, int);
  151. unsigned long __cdecl _lrotr(unsigned long, int);
  152. char * __cdecl _ltoa(long, char *, int);
  153. void __cdecl _makepath(char *, const char *,
  154. const char *, const char *, const char *);
  155. void * __cdecl malloc(size_t);
  156. _onexit_t __cdecl _onexit(_onexit_t);
  157. #ifndef _WINDLL
  158. void __cdecl perror(const char *);
  159. #endif
  160. int __cdecl _putenv(const char *);
  161. void __cdecl qsort(void *, size_t, size_t, int (__cdecl *)
  162. (const void *, const void *));
  163. unsigned int __cdecl _rotl(unsigned int, int);
  164. unsigned int __cdecl _rotr(unsigned int, int);
  165. int __cdecl rand(void);
  166. void * __cdecl realloc(void *, size_t);
  167. void __cdecl _searchenv(const char *, const char *,
  168. char *);
  169. void __cdecl _splitpath(const char *, char *,
  170. char *, char *, char *);
  171. void __cdecl srand(unsigned int);
  172. long __cdecl strtol(const char *, char * *,
  173. int);
  174. long double __cdecl _strtold(const char *,
  175. char * *);
  176. unsigned long __cdecl strtoul(const char *,
  177. char * *, int);
  178. void __cdecl _swab(char *, char *, int);
  179. #ifndef _WINDOWS
  180. int __cdecl system(const char *);
  181. #endif
  182. char * __cdecl _ultoa(unsigned long, char *, int);
  183. int __cdecl mblen(const char *, size_t);
  184. int __cdecl mbtowc(wchar_t *, const char *, size_t);
  185. int __cdecl wctomb(char *, wchar_t);
  186. size_t __cdecl mbstowcs(wchar_t *, const char *, size_t);
  187. size_t __cdecl wcstombs(char *, const wchar_t *, size_t);
  188. /* model-independent function prototypes */
  189. int __far __cdecl _fmblen(const char __far *, size_t);
  190. int __far __cdecl _fmbtowc(wchar_t __far *, const char __far *,
  191. size_t);
  192. int __far __cdecl _fwctomb(char __far *, wchar_t);
  193. size_t __far __cdecl _fmbstowcs(wchar_t __far *, const char __far *,
  194. size_t);
  195. size_t __far __cdecl _fwcstombs(char __far *, const wchar_t __far *,
  196. size_t);
  197. #ifndef tolower
  198. int __cdecl tolower(int);
  199. #endif
  200. #ifndef toupper
  201. int __cdecl toupper(int);
  202. #endif
  203. #ifndef __STDC__
  204. /* Non-ANSI names for compatibility */
  205. #ifndef __cplusplus
  206. #define max(a,b) (((a) > (b)) ? (a) : (b))
  207. #define min(a,b) (((a) < (b)) ? (a) : (b))
  208. #endif
  209. extern char * __near __cdecl sys_errlist[];
  210. extern int __near __cdecl sys_nerr;
  211. extern char ** __near __cdecl environ;
  212. #define DOS_MODE _DOS_MODE
  213. #define OS2_MODE _OS2_MODE
  214. char * __cdecl ecvt(double, int, int *, int *);
  215. char * __cdecl fcvt(double, int, int *, int *);
  216. char * __cdecl gcvt(double, int, char *);
  217. char * __cdecl itoa(int, char *, int);
  218. char * __cdecl ltoa(long, char *, int);
  219. onexit_t __cdecl onexit(onexit_t);
  220. int __cdecl putenv(const char *);
  221. void __cdecl swab(char *, char *, int);
  222. char * __cdecl ultoa(unsigned long, char *, int);
  223. #endif
  224. #ifdef __cplusplus
  225. }
  226. #endif
  227. #define _INC_STDLIB
  228. #endif