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.

212 lines
6.5 KiB

  1. /***
  2. *stdlib.h - declarations/definitions for commonly used library functions
  3. *
  4. * Copyright (c) 1985-1990, 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. #if defined(_DLL) && !defined(_MT)
  15. #error Cannot define _DLL without _MT
  16. #endif
  17. #ifdef _MT
  18. #define _FAR_ _far
  19. #else
  20. #define _FAR_
  21. #endif
  22. #ifdef _DLL
  23. #define _LOADDS_ _loadds
  24. #else
  25. #define _LOADDS_
  26. #endif
  27. #ifndef _SIZE_T_DEFINED
  28. typedef unsigned int size_t;
  29. #define _SIZE_T_DEFINED
  30. #endif
  31. /* define NULL pointer value */
  32. #ifndef NULL
  33. #if (_MSC_VER >= 600)
  34. #define NULL ((void *)0)
  35. #elif (defined(M_I86SM) || defined(M_I86MM))
  36. #define NULL 0
  37. #else
  38. #define NULL 0L
  39. #endif
  40. #endif
  41. /* definition of the return type for the onexit() function */
  42. #define EXIT_SUCCESS 0
  43. #define EXIT_FAILURE 1
  44. #ifndef _ONEXIT_T_DEFINED
  45. typedef int (_FAR_ _cdecl _LOADDS_ * _cdecl onexit_t)();
  46. #define _ONEXIT_T_DEFINED
  47. #endif
  48. /* data structure definitions for div and ldiv runtimes. */
  49. #ifndef _DIV_T_DEFINED
  50. typedef struct _div_t {
  51. int quot;
  52. int rem;
  53. } div_t;
  54. typedef struct _ldiv_t {
  55. long quot;
  56. long rem;
  57. } ldiv_t;
  58. #define _DIV_T_DEFINED
  59. #endif
  60. /* maximum value that can be returned by the rand function. */
  61. #define RAND_MAX 0x7fff
  62. /* min and max macros */
  63. #define max(a,b) (((a) > (b)) ? (a) : (b))
  64. #define min(a,b) (((a) < (b)) ? (a) : (b))
  65. /* sizes for buffers used by the _makepath() and _splitpath() functions.
  66. * note that the sizes include space for 0-terminator
  67. */
  68. #define _MAX_PATH 260 /* max. length of full pathname */
  69. #define _MAX_DRIVE 3 /* max. length of drive component */
  70. #define _MAX_DIR 256 /* max. length of path component */
  71. #define _MAX_FNAME 256 /* max. length of file name component */
  72. #define _MAX_EXT 256 /* max. length of extension component */
  73. /* external variable declarations */
  74. #ifdef _MT
  75. extern int _far * _cdecl _far volatile _errno(void);
  76. extern unsigned _far * _cdecl _far __doserrno(void);
  77. #define errno (*_errno())
  78. #define _doserrno (*__doserrno())
  79. #else
  80. extern int _near _cdecl volatile errno; /* XENIX style error number */
  81. extern int _near _cdecl _doserrno; /* MS-DOS system error value */
  82. #endif
  83. extern char * _near _cdecl sys_errlist[]; /* perror error message table */
  84. extern int _near _cdecl sys_nerr; /* # of entries in sys_errlist table */
  85. #ifdef _DLL
  86. extern char ** _FAR_ _cdecl environ; /* pointer to environment table */
  87. extern int _FAR_ _cdecl _fmode; /* default file translation mode */
  88. extern int _FAR_ _cdecl _fileinfo; /* open file info mode (for spawn) */
  89. #else
  90. extern char ** _near _cdecl environ; /* pointer to environment table */
  91. extern int _near _cdecl _fmode; /* default file translation mode */
  92. extern int _near _cdecl _fileinfo; /* open file info mode (for spawn) */
  93. #endif
  94. extern unsigned int _near _cdecl _psp; /* Program Segment Prefix */
  95. /* OS major/minor version numbers */
  96. #ifndef _WINDLL
  97. extern unsigned char _near _cdecl _osmajor;
  98. extern unsigned char _near _cdecl _osminor;
  99. #endif
  100. #define DOS_MODE 0 /* Real Address Mode */
  101. #define OS2_MODE 1 /* Protected Address Mode */
  102. extern unsigned char _near _cdecl _osmode;
  103. /* function prototypes */
  104. #ifdef _MT
  105. double _FAR_ _pascal atof(const char _FAR_ *);
  106. double _FAR_ _pascal strtod(const char _FAR_ *, char _FAR_ * _FAR_ *);
  107. ldiv_t _FAR_ _pascal ldiv(long, long);
  108. #else /* not _MT */
  109. double _FAR_ _cdecl atof(const char _FAR_ *);
  110. double _FAR_ _cdecl strtod(const char _FAR_ *, char _FAR_ * _FAR_ *);
  111. ldiv_t _FAR_ _cdecl ldiv(long, long);
  112. #endif
  113. void _FAR_ _cdecl abort(void);
  114. int _FAR_ _cdecl abs(int);
  115. int _FAR_ _cdecl atexit(void (_cdecl _FAR_ _LOADDS_ *)(void));
  116. int _FAR_ _cdecl atoi(const char _FAR_ *);
  117. long _FAR_ _cdecl atol(const char _FAR_ *);
  118. long double _FAR_ _cdecl _atold(const char _FAR_ *);
  119. void _FAR_ * _FAR_ _cdecl bsearch(const void _FAR_ *, const void _FAR_ *,
  120. size_t, size_t, int (_FAR_ _cdecl *)(const void _FAR_ *,
  121. const void _FAR_ *));
  122. void _FAR_ * _FAR_ _cdecl calloc(size_t, size_t);
  123. div_t _FAR_ _cdecl div(int, int);
  124. char _FAR_ * _FAR_ _cdecl ecvt(double, int, int _FAR_ *, int _FAR_ *);
  125. void _FAR_ _cdecl exit(int);
  126. void _FAR_ _cdecl _exit(int);
  127. char _FAR_ * _FAR_ _cdecl fcvt(double, int, int _FAR_ *, int _FAR_ *);
  128. void _FAR_ _cdecl free(void _FAR_ *);
  129. char _FAR_ * _FAR_ _cdecl _fullpath(char _FAR_ *, const char _FAR_ *,
  130. size_t);
  131. #ifndef _WINDLL
  132. char _FAR_ * _FAR_ _cdecl gcvt(double, int, char _FAR_ *);
  133. #endif
  134. char _FAR_ * _FAR_ _cdecl getenv(const char _FAR_ *);
  135. char _FAR_ * _FAR_ _cdecl itoa(int, char _FAR_ *, int);
  136. long _FAR_ _cdecl labs(long);
  137. unsigned long _FAR_ _cdecl _lrotl(unsigned long, int);
  138. unsigned long _FAR_ _cdecl _lrotr(unsigned long, int);
  139. char _FAR_ * _FAR_ _cdecl ltoa(long, char _FAR_ *, int);
  140. void _FAR_ _cdecl _makepath(char _FAR_ *, const char _FAR_ *,
  141. const char _FAR_ *, const char _FAR_ *, const char _FAR_ *);
  142. void _FAR_ * _FAR_ _cdecl malloc(size_t);
  143. onexit_t _FAR_ _cdecl onexit(onexit_t);
  144. #ifndef _WINDOWS
  145. void _FAR_ _cdecl perror(const char _FAR_ *);
  146. #endif
  147. int _FAR_ _cdecl putenv(const char _FAR_ *);
  148. void _FAR_ _cdecl qsort(void _FAR_ *, size_t, size_t, int (_FAR_ _cdecl *)
  149. (const void _FAR_ *, const void _FAR_ *));
  150. unsigned int _FAR_ _cdecl _rotl(unsigned int, int);
  151. unsigned int _FAR_ _cdecl _rotr(unsigned int, int);
  152. int _FAR_ _cdecl rand(void);
  153. void _FAR_ * _FAR_ _cdecl realloc(void _FAR_ *, size_t);
  154. void _FAR_ _cdecl _searchenv(const char _FAR_ *, const char _FAR_ *,
  155. char _FAR_ *);
  156. void _FAR_ _cdecl _splitpath(const char _FAR_ *, char _FAR_ *,
  157. char _FAR_ *, char _FAR_ *, char _FAR_ *);
  158. void _FAR_ _cdecl srand(unsigned int);
  159. long _FAR_ _cdecl strtol(const char _FAR_ *, char _FAR_ * _FAR_ *,
  160. int);
  161. long double _FAR_ _cdecl _strtold(const char _FAR_ *,
  162. char _FAR_ * _FAR_ *);
  163. unsigned long _FAR_ _cdecl strtoul(const char _FAR_ *,
  164. char _FAR_ * _FAR_ *, int);
  165. void _FAR_ _cdecl swab(char _FAR_ *, char _FAR_ *, int);
  166. #ifndef _WINDOWS
  167. int _FAR_ _cdecl system(const char _FAR_ *);
  168. #endif
  169. char _FAR_ * _FAR_ _cdecl ultoa(unsigned long, char _FAR_ *, int);
  170. #ifndef tolower /* tolower has been undefined - use function */
  171. int _FAR_ _cdecl tolower(int);
  172. #endif /* tolower */
  173. #ifndef toupper /* toupper has been undefined - use function */
  174. int _FAR_ _cdecl toupper(int);
  175. #endif /* toupper */