home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s038 / 10.ddi / 017.LIF / STDLIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-07-02  |  5.4 KB  |  184 lines

  1. /* stdlib.h - standard utility functions
  2.  * $Version: 1.1 $
  3.  * Copyright (C) 1988-91 Intel Corporation, ALL RIGHTS RESERVED
  4.  */
  5.  
  6. #ifndef _stdlibh
  7. #define _stdlibh
  8. /*lint -library */
  9.  
  10. #pragma fixedparams("abort",  "getenv",   "putenv",  "swab",  "system")
  11. #pragma fixedparams("sbrk")
  12. #pragma fixedparams("atof",   "ecvt",     "fcvt",    "ftoa",  "gcvt")
  13. #pragma fixedparams("strtod")
  14. #pragma fixedparams("abs",    "atexit",   "atoi",    "atol",  "bsearch")
  15. #pragma fixedparams("calloc", "div",      "exit",    "free",  "labs")
  16. #pragma fixedparams("ldiv",   "malloc",   "qsort",   "rand",  "realloc")
  17. #pragma fixedparams("srand",  "strtol",   "strtoul", "mblen", "mbtowc")
  18. #pragma fixedparams("wctomb", "mbstowcs", "wcstombs")
  19. #pragma fixedparams("itoa",   "itoh",     "ltoa",    "ltoh",  "ltos")
  20. #pragma fixedparams("onexit", "ultoa",    "utoa")
  21.  
  22.  
  23. #ifndef NULL
  24. #define NULL ((void *)0)
  25. #endif
  26.  
  27. #ifndef _size_t
  28. #define _size_t
  29. typedef unsigned size_t;
  30. #endif
  31.  
  32. #ifndef _wchar_t
  33. #define _wchar_t
  34. typedef char wchar_t;
  35. #endif
  36.  
  37. #ifndef _div_t
  38. typedef struct {
  39.     int quot;
  40.     int rem;
  41. } div_t;
  42.  
  43. typedef struct {
  44.     long quot;
  45.     long rem;
  46. } ldiv_t;
  47.  
  48. #define _div_t
  49. #endif
  50.  
  51. #ifndef _regs
  52. #pragma align (DWORDREGS)
  53. #pragma align (WORDREGS)
  54. #pragma align (BYTEREGS)
  55. union REGS {
  56.   struct DWORDREGS {unsigned  eax, ebx, ecx, edx, esi,
  57.                               edi, cflag, eflags, ebp;} w;
  58.  
  59.   struct WORDREGS  {unsigned  ax, bx, cx, dx, si,
  60.                               di, cflag, flags, bp;} x;
  61.  
  62. #if _ARCHITECTURE_ == 386 ||  _ARCHITECTURE_ == 486
  63.  
  64.   struct BYTEREGS  {unsigned  al:8, ah:8, :16, bl:8, bh:8, :16,
  65.                               cl:8, ch:8, :16, dl:8, dh:8, :16;} h;
  66. #else
  67.   struct BYTEREGS  {unsigned  al:8, ah:8, bl:8, bh:8,
  68.                               cl:8, ch:8, dl:8, dh:8;} h;
  69. #endif
  70.  
  71. };
  72.  
  73. #pragma align (SREGS)
  74. struct SREGS {
  75.     unsigned short es, cs, ss, ds, fs, gs;
  76. };
  77.  
  78. #define    _regs
  79. #endif    /* _regs */
  80.  
  81. typedef int (*onexit_t)(void);
  82.  
  83. #define RAND_MAX        0x7FFF
  84. #define MB_CUR_MAX      1
  85. #define EXIT_FAILURE    1
  86. #define EXIT_SUCCESS    0
  87.  
  88. #define _MAX_PATH       260             /* Max length of full pathname */
  89. #define _MAX_DRIVE      3               /* Max length of drive component */
  90. #define _MAX_DIR        256             /* Max length of path component */
  91. #define _MAX_FNAME      256             /* Max length of file name component */
  92. #define _MAX_EXT        256             /* Max length of extension component */
  93.  
  94. extern int              _fmode;         /* Default file translation mode     */
  95.  
  96. /*
  97.  * Function prototypes:
  98.  */
  99. void          abort(void);
  100. int           abs(int);
  101. int           atexit(void (*)(void));
  102. double        atof(const char *);
  103. int           atoi(const char *);
  104. long          atol(const char *);
  105. void         *bsearch(const void *, const void *, size_t, size_t, 
  106.                       int (*)(const void *, const void *));
  107. void         *calloc(size_t, size_t);
  108. div_t         div(int, int);
  109. char         *ecvt(double, int, int *, int *);
  110. void          exit(int);
  111. char         *fcvt(double, int, int *, int *);
  112. void          free(void *);
  113. char         *ftoa(double, char *, unsigned int, unsigned int);
  114. char        *_fullpath(char *, const char *, size_t);
  115. char         *gcvt(double, int, char *);
  116. char         *getenv(const char *);
  117. char         *itoa(int, char *, int);
  118. char         *itoh(int, char *);
  119. long          labs(long);
  120. ldiv_t        ldiv(long, long);
  121. char         *ltoa(long, char *, int);
  122. char         *ltoh(unsigned long, char *);
  123. char         *ltos(long int, char *, int);
  124. void         _makepath(char *, const char *, const char *,
  125.                        const char *, const char *);
  126. void         *malloc(size_t);
  127. int           mblen(const char *, size_t);
  128. size_t        mbstowcs(wchar_t *, const char *, size_t);
  129. int           mbtowc(wchar_t *, const char *, size_t);
  130. onexit_t      onexit(onexit_t);
  131. int           putenv(const char *);
  132. void          qsort(void *, size_t, size_t, int (*)(const void *,
  133.                     const void *));
  134. int           rand(void);
  135. void         *realloc(void *, size_t);
  136. void         *sbrk(unsigned);
  137. void         _searchenv(const char *, const char *, char *);
  138. void         _splitpath(const char *, char *, char *, char *, char *);
  139. void          srand(unsigned int);
  140. double        strtod(const char *, char **);
  141. long          strtol(const char *, char **, int);
  142. unsigned long strtoul(const char *, char **, int);
  143. void          swab(const char *, char *, int);
  144. int           system(const char *);
  145. char         *ultoa(unsigned long, char *, int);
  146. char         *utoa(unsigned int, char *, int);
  147. size_t        wcstombs(char *, const wchar_t *, size_t);
  148. int           wctomb(char *, wchar_t);
  149.  
  150.  
  151. /*
  152.  * Non-ANSI function also prototyped in dos.h
  153.  */
  154. #ifndef _stdlib_dos
  155. #define _stdlib_dos
  156. #pragma fixedparams("segread")
  157. void     segread(struct SREGS *);
  158. #endif
  159.  
  160. /*
  161.  * Compiler built-in functions:
  162.  */
  163. #ifndef _stdlibh_builtin
  164. #define _stdlibh_builtin
  165.  
  166. #pragma _builtin_("_abs_"==51)
  167. int _abs_(int);
  168. #define abs(x) _abs_(x)
  169.  
  170. #pragma _builtin_("_labs_"==52)
  171. long _labs_(long);
  172. #define labs(x) _labs_(x)
  173.  
  174. #endif /* _stdlibh_builtin */
  175.  
  176. /*
  177.  * Macro definitions:
  178.  */
  179. #define max(a,b) (((a) > (b)) ? (a) : (b))
  180. #define min(a,b) (((a) < (b)) ? (a) : (b))
  181. #define _strtold(_a, _b) (long double)strtod(_a, _b)
  182.  
  183. #endif  /* _stdlibh */
  184.