home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c034 / 4.ddi / INCLUDE / STDLIB.H$ / STDLIB.bin
Encoding:
Text File  |  1989-11-28  |  6.4 KB  |  205 lines

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