home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c031 / 4.ddi / INCLUDE / STDLIB.H$ / STDLIB
Encoding:
Text File  |  1991-12-11  |  7.2 KB  |  264 lines

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