home *** CD-ROM | disk | FTP | other *** search
/ CD Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / STDLIB.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-10-14  |  23.5 KB  |  664 lines

  1. /*  stdlib.h
  2.  
  3.     Definitions for common types, variables, and functions.
  4.  
  5. */
  6.  
  7. /* $Copyright: 1987$ */
  8. /* $Revision:   8.10  $ */
  9.  
  10. #ifndef __STDLIB_H
  11. #define __STDLIB_H
  12.  
  13. #if !defined(___DEFS_H)
  14. #include <_defs.h>
  15. #endif
  16.  
  17. #ifndef NULL
  18. #include <_null.h>
  19. #endif
  20.  
  21.  
  22. #if !defined(RC_INVOKED)
  23.  
  24. #if defined(__STDC__)
  25. #pragma warn -nak
  26. #endif
  27.  
  28. #pragma pack(push, 1)
  29.  
  30. #endif  /* !RC_INVOKED */
  31.  
  32.  
  33. #ifndef _SIZE_T
  34. #define _SIZE_T
  35. typedef unsigned size_t;
  36. #endif
  37.  
  38. #ifndef _DIV_T
  39. #define _DIV_T
  40. typedef struct {
  41.         int     quot;
  42.         int     rem;
  43. } div_t;
  44. #endif
  45.  
  46. #ifndef _LDIV_T
  47. #define _LDIV_T
  48. typedef struct {
  49.         long    quot;
  50.         long    rem;
  51. } ldiv_t;
  52. #endif
  53.  
  54. #ifndef __cplusplus
  55. #if !defined(_WCHAR_T) && !defined(_WCHAR_T_DEFINED)
  56. #define _WCHAR_T
  57. #define _WCHAR_T_DEFINED  /* For WINDOWS.H */
  58. typedef unsigned short wchar_t;
  59. #endif
  60. #endif
  61.  
  62. #if !defined(_WINT_T)
  63. typedef unsigned short wint_t;
  64. #define _WINT_T
  65. #endif
  66.  
  67. #define MB_CUR_MAX 1
  68.  
  69. /* Maximum value returned by "rand" function
  70. */
  71. #define RAND_MAX 0x7FFFU
  72.  
  73. #define EXIT_SUCCESS 0
  74. #define EXIT_FAILURE 1
  75.  
  76. typedef void (_USERENTRY * atexit_t)(void);
  77.  
  78. /*
  79.   These 2 constants are defined in MS's stdlib.h.
  80. */
  81.  
  82. #define DOS_MODE    0  /* DOS 16-bit */
  83. #define OS2_MODE    1  /* OS/2 16-bit */
  84.  
  85. #if !defined(__FLAT__)
  86.  
  87.  
  88. #ifdef __cplusplus
  89. extern "C" {
  90. #endif
  91.  
  92. void        _RTLENTRY abort(void);
  93.  
  94. #if !defined(__ABS_DEFINED)
  95. #define __ABS_DEFINED
  96.  
  97. int         _RTLENTRY __abs__(int);
  98. #ifdef __cplusplus
  99. inline int _RTLENTRY  abs(int __x) { return __abs__(__x); }
  100. #else
  101. int         _RTLENTRYF abs(int __x);
  102. #  define abs(x)   __abs__(x)
  103. #endif
  104.  
  105. #endif /* __ABS_DEFINED */
  106.  
  107. int         _RTLENTRY  atexit(void (_USERENTRY *__func)(void));
  108. double      _RTLENTRY  atof(const char _FAR *__s);
  109. int         _RTLENTRYF atoi(const char _FAR *__s);
  110. long        _RTLENTRYF atol(const char _FAR *__s);
  111. void _FAR * _RTLENTRYF bsearch(const void _FAR *__key, const void _FAR *__base,
  112.                            size_t __nelem, size_t __width,
  113.                            int (_USERENTRYF *fcmp)(const void _FAR *,
  114.                            const void _FAR *));
  115. void _FAR * _RTLENTRY  calloc(size_t __nitems, size_t __size);
  116. div_t       _RTLENTRY  div(int __numer, int __denom);
  117. void        _RTLENTRY  exit(int __status);
  118. void        _RTLENTRY  free(void _FAR *__block);
  119. char _FAR * _RTLENTRYF getenv(const char _FAR *__name);
  120. long        _RTLENTRY  labs(long __x);
  121. ldiv_t      _RTLENTRY  ldiv(long __numer, long __denom);
  122. void _FAR * _RTLENTRY  malloc(size_t __size);
  123. int         _RTLENTRYF _EXPFUNC mblen(const char _FAR *__s, size_t __n);
  124. size_t      _RTLENTRYF _EXPFUNC mbstowcs(wchar_t _FAR *__pwcs, const char _FAR *__s,
  125.                                     size_t __n);
  126. int         _RTLENTRYF _EXPFUNC mbtowc(wchar_t _FAR *__pwc, const char _FAR *__s, size_t __n);
  127. void        _RTLENTRYF _EXPFUNC qsort(void _FAR *__base, size_t __nelem, size_t __width,
  128.                        int _USERENTRYF (*_EXPFUNC __fcmp)(const void _FAR *, const void _FAR *));
  129. int         _RTLENTRY  rand(void);
  130. void  _FAR *_RTLENTRY  realloc(void _FAR *__block, size_t __size);
  131. void        _RTLENTRY  srand(unsigned __seed);
  132. double      _RTLENTRY  strtod(const char _FAR *__s, char _FAR *_FAR *__endptr);
  133. long        _RTLENTRY _EXPFUNC strtol(const char _FAR *__s, char _FAR *_FAR *__endptr,
  134.                                     int __radix);
  135. long double _RTLENTRY  _strtold(const char _FAR *__s, char _FAR *_FAR *__endptr);
  136. unsigned long _RTLENTRY _EXPFUNC strtoul(const char _FAR *__s, char _FAR *_FAR *__endptr,
  137.                                        int __radix);
  138. int         _RTLENTRY _EXPFUNC system(const char _FAR *__command);
  139. size_t      _RTLENTRYF _EXPFUNC wcstombs(char _FAR *__s, const wchar_t _FAR *__pwcs,
  140.                                     size_t __n);
  141. int         _RTLENTRYF _EXPFUNC wctomb(char _FAR *__s, wchar_t __wc);
  142.  
  143. #ifdef __cplusplus
  144. }
  145. #endif
  146.  
  147. extern  unsigned        _RTLENTRY _psp;
  148.  
  149. #if !defined(__STDC__) /* obsolete */
  150. #define environ  _environ
  151. #endif
  152.  
  153. extern  char          **_RTLENTRY _environ;
  154. extern  int             _RTLENTRY _fmode;
  155. extern  unsigned char   _RTLENTRY _osmajor;
  156. extern  unsigned char   _RTLENTRY _osminor;
  157. extern  unsigned int    _RTLENTRY _version;
  158.  
  159. #if !defined(__STDC__)
  160. #define sys_nerr     _sys_nerr
  161. #define sys_errlist  _sys_errlist
  162. #endif
  163.  
  164. #if defined( _RTLDLL )
  165.  
  166. #ifdef __cplusplus
  167. extern "C" {
  168. #endif
  169. extern  char far * far * far  _RTLENTRY __get_sys_errlist(void);
  170. extern  int  far              _RTLENTRY __get_sys_nerr(void);
  171. #ifdef __cplusplus
  172. }
  173. #endif
  174.  
  175. #define _sys_errlist  __get_sys_errlist()
  176. #define _sys_nerr     __get_sys_nerr()
  177.  
  178. #else
  179. extern  char      _FAR *_RTLENTRY _sys_errlist[];
  180. extern  int             _RTLENTRY _sys_nerr;
  181. #endif
  182.  
  183.  
  184. #if !defined(__STDC__) && !defined(__CODEGUARD__)
  185. #if defined(__cplusplus)
  186. inline int  _RTLENTRY atoi(const char _FAR *__s) { return (int) atol(__s); }
  187. #else
  188. #define atoi(s)     ((int) atol(s))
  189. #endif
  190. #endif
  191.  
  192. /* Constants for MSC pathname functions */
  193.  
  194. #define _MAX_PATH       80
  195. #define _MAX_DRIVE      3
  196. #define _MAX_DIR        66
  197. #define _MAX_FNAME      9
  198. #define _MAX_EXT        5
  199.  
  200. #ifdef __cplusplus
  201. extern "C" {
  202. #endif
  203.  
  204. long double    _RTLENTRY   _atold(const char _FAR *__s);
  205. unsigned char  _RTLENTRY   _crotl(unsigned char __value, int __count);
  206. unsigned char  _RTLENTRY   _crotr(unsigned char __value, int __count);
  207. char   _FAR   *_RTLENTRY   ecvt(double __value, int __ndig, int _FAR *__dec,
  208.                            int _FAR *__sign);
  209. void           _RTLENTRY   _exit(int __status);
  210. char   _FAR   *_RTLENTRY   fcvt(double __value, int __ndig, int _FAR *__dec,
  211.                            int _FAR *__sign);
  212. char _FAR     *_RTLENTRYF  _EXPFUNC _fullpath( char _FAR *__buf,
  213.                                  const char _FAR *__path,
  214.                                  size_t __maxlen );
  215. char   _FAR   *_RTLENTRY   gcvt(double __value, int __ndec, char _FAR *__buf);
  216. char   _FAR   *_RTLENTRYF  _EXPFUNC itoa(int __value, char _FAR *__string, int __radix);
  217. void   _FAR   *_RTLENTRY   _EXPFUNC lfind(const void _FAR *__key, const void _FAR *__base,
  218.                                  size_t _FAR *__num, size_t __width,
  219.                                  int _USERENTRY (*_EXPFUNC __fcmp)(const void _FAR *,
  220.                                  const void _FAR *));
  221. unsigned long  _RTLENTRY   _lrotl(unsigned long __val, int __count);
  222. unsigned long  _RTLENTRY   _lrotr(unsigned long __val, int __count);
  223.  
  224. void   _FAR   *_RTLENTRY   _EXPFUNC lsearch(const void _FAR *__key, void _FAR *__base,
  225.                                  size_t _FAR *__num, size_t __width,
  226.                            int _RTLENTRY(*_EXPFUNC __fcmp)(const void _FAR *, const void _FAR *));
  227. char _FAR     *_RTLENTRYF  _EXPFUNC ltoa(long __value, char _FAR *__string, int __radix);
  228. void           _RTLENTRY   _EXPFUNC _makepath( char _FAR *__path,
  229.                                  const char _FAR *__drive,
  230.                                  const char _FAR *__dir,
  231.                                  const char _FAR *__name,
  232.                                  const char _FAR *__ext );
  233. int            _RTLENTRY   _EXPFUNC putenv(const char _FAR *__name);
  234.  
  235. unsigned       _RTLENTRY   _rotl(unsigned __value, int __count);
  236. unsigned       _RTLENTRY   _rotr(unsigned __value, int __count);
  237.  
  238. unsigned       _RTLENTRY   __rotl__(unsigned __value, int __count);     /* intrinsic */
  239. unsigned       _RTLENTRY   __rotr__(unsigned __value, int __count);     /* intrinsic */
  240.  
  241. void           _RTLENTRY   _searchenv(const char _FAR *__file,
  242.                                  const char _FAR *__varname,
  243.                                  char _FAR *__pathname);
  244. void           _RTLENTRY   _searchstr(const char _FAR *__file,
  245.                                  const char _FAR *__ipath,
  246.                                  char _FAR *__pathname);
  247. void           _RTLENTRY   _EXPFUNC _splitpath( const char _FAR *__path,
  248.                                  char _FAR *__drive,
  249.                                  char _FAR *__dir,
  250.                                  char _FAR *__name,
  251.                                  char _FAR *__ext );
  252. void           _RTLENTRY   _EXPFUNC swab(char _FAR *__from, char _FAR *__to, int __nbytes);
  253. char _FAR     *_RTLENTRYF  _EXPFUNC ultoa(unsigned long __value, char _FAR *__string,
  254.                                  int __radix);
  255.  
  256. #ifdef __cplusplus
  257. }
  258. #endif
  259.  
  260. #ifdef __BCOPT__
  261. #define  _rotl(__value, __count)  __rotl__(__value, __count)
  262. #define  _rotr(__value, __count)  __rotr__(__value, __count)
  263. #endif
  264.  
  265.  
  266. #if !defined(__STDC__)  /* NON-ANSI */
  267.  
  268. #if defined( _RTLDLL )
  269.  
  270. #ifdef __cplusplus
  271. extern "C" {
  272. #endif
  273. int far * far _RTLENTRY __getErrno(void);
  274. int far * far _RTLENTRY __getDOSErrno(void);
  275. #ifdef __cplusplus
  276. }
  277. #endif
  278.  
  279.  
  280. #define errno (*__getErrno())
  281. #define _doserrno (*__getDOSErrno())
  282.  
  283. #else
  284.  
  285. extern  int   _RTLENTRY _doserrno;
  286. extern  int   _RTLENTRY errno;
  287.  
  288. #endif
  289.  
  290. #endif  /* !__STDC__ */
  291.  
  292. #ifdef __cplusplus
  293. inline int _RTLENTRY     random(int __num)
  294.                         { return(int)(((long)rand()*__num)/(RAND_MAX+1)); }
  295. #else /* __cplusplus */
  296. #define random(num)(int)(((long)rand()*(num))/(RAND_MAX+1))
  297. #endif
  298.  
  299.  
  300. #else  /* defined __FLAT__ */
  301.  
  302.  
  303. #ifdef __cplusplus
  304. extern "C" {
  305. #endif
  306.  
  307. void        _RTLENTRY _EXPFUNC abort(void);
  308.  
  309. #if !defined(__ABS_DEFINED)
  310. #define __ABS_DEFINED
  311.  
  312. int         _RTLENTRY __abs__(int);
  313. #ifdef __cplusplus
  314. inline int _RTLENTRY  abs(int __x) { return __abs__(__x); }
  315. #else
  316. int         _RTLENTRYF _EXPFUNC abs(int __x);
  317. #  define abs(x)   __abs__(x)
  318. #endif
  319.  
  320. #endif /* __ABS_DEFINED */
  321.  
  322. int         _RTLENTRY   _EXPFUNC atexit(void (_USERENTRY * __func)(void));
  323. double      _RTLENTRY   _EXPFUNC atof(const char * __s);
  324. int         _RTLENTRYF  _EXPFUNC atoi(const char * __s);
  325. long        _RTLENTRYF  _EXPFUNC atol(const char * __s);
  326. void *      _RTLENTRYF  _EXPFUNC bsearch(const void * __key, const void * __base,
  327.                            size_t __nelem, size_t __width,
  328.                            int (_USERENTRY *fcmp)(const void *,
  329.                            const void *));
  330. void *      _RTLENTRY _EXPFUNC   calloc(size_t __nitems, size_t __size);
  331. div_t       _RTLENTRY _EXPFUNC   div(int __numer, int __denom);
  332. void        _RTLENTRY _EXPFUNC   exit(int __status);
  333. void        _RTLENTRY _EXPFUNC   free(void * __block);
  334. char *      _RTLENTRYF _EXPFUNC  getenv(const char * __name);
  335. long        _RTLENTRY _EXPFUNC   labs(long __x);
  336. ldiv_t      _RTLENTRY _EXPFUNC   ldiv(long __numer, long __denom);
  337. void *      _RTLENTRY _EXPFUNC   malloc(size_t __size);
  338. int         _RTLENTRY _EXPFUNC   mblen(const char * __s, size_t __n);
  339. size_t      _RTLENTRY _EXPFUNC   mbstowcs(wchar_t *__pwcs, const char * __s,
  340.                            size_t __n);
  341. int         _RTLENTRY _EXPFUNC   mbtowc(wchar_t *__pwc, const char * __s, size_t __n);
  342. void        _RTLENTRYF _EXPFUNC  qsort(void * __base, size_t __nelem, size_t __width,
  343.                            int (_USERENTRY *__fcmp)(const void *, const void *));
  344. int         _RTLENTRY _EXPFUNC   rand(void);
  345. void *      _RTLENTRY _EXPFUNC   realloc(void * __block, size_t __size);
  346. void        _RTLENTRY _EXPFUNC   srand(unsigned __seed);
  347. double      _RTLENTRY _EXPFUNC   strtod(const char * __s, char * *__endptr);
  348. long        _RTLENTRY _EXPFUNC   strtol(const char * __s, char * *__endptr,
  349.                            int __radix);
  350. long double _RTLENTRY _EXPFUNC   _strtold(const char * __s, char * *__endptr);
  351. unsigned long _RTLENTRY _EXPFUNC strtoul(const char * __s, char * *__endptr,
  352.                            int __radix);
  353. int         _RTLENTRY _EXPFUNC   system(const char * __command);
  354.  
  355. size_t      _RTLENTRY _EXPFUNC   wcstombs(char * __s, const wchar_t *__pwcs,size_t __n);
  356. int         _RTLENTRY _EXPFUNC   wctomb(char * __s, wchar_t __wc);
  357. double      _RTLENTRY _EXPFUNC   _wtof(const wchar_t * __s);
  358. int         _RTLENTRY _EXPFUNC   _wtoi(const wchar_t * __s);
  359. long        _RTLENTRY _EXPFUNC   _wtol(const wchar_t * __s);
  360. long double _RTLENTRY _EXPFUNC   _wtold(const wchar_t * __s);
  361. double      _RTLENTRY _EXPFUNC   wcstod(const wchar_t * __s, wchar_t * *__endptr);
  362. long        _RTLENTRY _EXPFUNC   wcstol(const wchar_t * __s, wchar_t * *__endptr, int __radix);
  363. long double _RTLENTRY _EXPFUNC   _wcstold(const wchar_t * __s, wchar_t * *__endptr);
  364. unsigned long _RTLENTRY _EXPFUNC wcstoul(const wchar_t * __s, wchar_t * *__endptr, int __radix);
  365. wchar_t *   _RTLENTRY  _EXPFUNC  _itow(int __value, wchar_t *__string, int __radix);
  366. wchar_t *   _RTLENTRY  _EXPFUNC  _ltow(long __value, wchar_t *__string, int __radix);
  367. wchar_t *   _RTLENTRY  _EXPFUNC  _ultow(unsigned long __value, wchar_t *__string, int __radix);
  368.  
  369. #if !defined(__STDC__)
  370. __int64     _RTLENTRY   _EXPFUNC _atoi64(const char * __s);
  371. char *      _RTLENTRY   _EXPFUNC _i64toa(__int64 value, char *strP, int radix);
  372. char *      _RTLENTRY   _EXPFUNC _ui64toa(unsigned __int64 value, char *strP, int radix);
  373. __int64     _RTLENTRY   _EXPFUNC _wtoi64(const wchar_t * __s);
  374. wchar_t *   _RTLENTRY   _EXPFUNC _i64tow(__int64 value, wchar_t *strP, int radix);
  375. wchar_t *   _RTLENTRY   _EXPFUNC _ui64tow(unsigned __int64 value, wchar_t *strP, int radix);
  376.  
  377. #endif /* __STDC__ */
  378.  
  379. #ifdef __cplusplus
  380. }
  381. #endif
  382.  
  383. /* Variables */
  384.  
  385. #ifdef _MT
  386.  
  387. #ifdef __cplusplus
  388. extern "C" {
  389. #endif
  390. extern  int * _RTLENTRY _EXPFUNC __errno(void);
  391. extern  int * _RTLENTRY _EXPFUNC __doserrno(void);
  392. #ifdef  __cplusplus
  393. }
  394. #endif
  395. #define errno (*__errno())
  396. #define _doserrno (*__doserrno())
  397.  
  398. #else   /* MT */
  399.  
  400. extern  int   _RTLENTRY _EXPDATA errno;
  401. extern  int   _RTLENTRY _EXPDATA _doserrno;
  402.  
  403. #endif  /* MT */
  404.  
  405. #if !defined(__STDC__)
  406.  
  407. /* Values for _osmode */
  408.  
  409. #define _WIN_MODE    2  /* Windows 16- or 32-bit */
  410. #define _OS2_20_MODE 3  /* OS/2 32-bit */
  411. #define _DOSX32_MODE 4  /* DOS 32-bit */
  412.  
  413. #define environ  _environ
  414.  
  415. #endif /* __STDC__ */
  416.  
  417. extern  char          **_RTLENTRY _EXPDATA _environ;
  418. extern  wchar_t       **_RTLENTRY _EXPDATA _wenviron;
  419. extern  int             _RTLENTRY _EXPDATA _fileinfo;
  420. extern  int             _RTLENTRY          _fmode;
  421. extern  unsigned char   _RTLENTRY _EXPDATA _osmajor;
  422. extern  unsigned char   _RTLENTRY _EXPDATA _osminor;
  423. extern  unsigned char   _RTLENTRY _EXPDATA _osmode;
  424. extern  unsigned int    _RTLENTRY _EXPDATA _osversion;
  425.  
  426. #if !defined(__STDC__) && !defined(__CODEGUARD__)
  427. #ifdef __cplusplus
  428.    inline int _RTLENTRY atoi(const char *__s) { return (int)atol(__s); }
  429. #else
  430. #  define atoi(s)((int) atol(s))
  431. #endif
  432. #endif
  433.  
  434. #if !defined(__STDC__)
  435. #define sys_nerr     _sys_nerr
  436. #define sys_errlist  _sys_errlist
  437. #endif
  438.  
  439. extern  char          * _RTLENTRY _EXPDATA _sys_errlist[];
  440. extern  int             _RTLENTRY _EXPDATA _sys_nerr;
  441.  
  442.  
  443. /* Constants for MSC pathname functions */
  444.  
  445. #if defined(__OS2__) || defined(__WIN32__)
  446. #define _MAX_PATH       260
  447. #define _MAX_DRIVE      3
  448. #define _MAX_DIR        256
  449. #define _MAX_FNAME      256
  450. #define _MAX_EXT        256
  451. #else
  452. #define _MAX_PATH       80
  453. #define _MAX_DRIVE      3
  454. #define _MAX_DIR        66
  455. #define _MAX_FNAME      9
  456. #define _MAX_EXT        5
  457. #endif
  458.  
  459. #ifdef __cplusplus
  460. extern "C" {
  461. #endif
  462.  
  463. long double   _RTLENTRY  _EXPFUNC _atold(const char * __s);
  464.  
  465. unsigned char _RTLENTRY  _EXPFUNC _crotl(unsigned char __value, int __count);
  466. unsigned char _RTLENTRY  _EXPFUNC _crotr(unsigned char __value, int __count);
  467.  
  468. char *        _RTLENTRY  _EXPFUNC ecvt(double __value, int __ndig, int * __dec,
  469.                                        int * __sign);
  470. void          _RTLENTRY  _EXPFUNC _exit(int __status);
  471. char *        _RTLENTRY  _EXPFUNC fcvt(double __value, int __ndig, int * __dec,
  472.                                        int * __sign);
  473. char *        _RTLENTRYF _EXPFUNC _fullpath(char * __buf, const char * __path,
  474.                                             size_t __maxlen);
  475. char *        _RTLENTRY  _EXPFUNC gcvt(double __value, int __ndec,
  476.                                        char * __buf);
  477. char *        _RTLENTRYF _EXPFUNC itoa(int __value, char * __string,
  478.                                        int __radix);
  479. void *        _RTLENTRY  _EXPFUNC lfind(const void * __key,
  480.                                         const void * __base,
  481.                                         size_t *__num, size_t __width,
  482.                                         int (_USERENTRY *fcmp)(const void *, const void *));
  483.  
  484. long          _RTLENTRY  _EXPFUNC _lrand(void);
  485. unsigned long _RTLENTRY  _EXPFUNC _lrotl(unsigned long __val, int __count);
  486. unsigned long _RTLENTRY  _EXPFUNC _lrotr(unsigned long __val, int __count);
  487.  
  488. void *        _RTLENTRY  _EXPFUNC lsearch(const void * __key, void * __base,
  489.                                           size_t *__num, size_t __width,
  490.                                           int (_USERENTRY *fcmp)(const void *, const void *));
  491.  
  492. char *        _RTLENTRYF _EXPFUNC ltoa(long __value, char * __string,
  493.                                        int __radix);
  494. void          _RTLENTRY  _EXPFUNC _makepath(char * __path,
  495.                                             const char * __drive,
  496.                                             const char * __dir,
  497.                                             const char * __name,
  498.                                             const char * __ext );
  499. int           _RTLENTRY  _EXPFUNC putenv(const char * __name);
  500.  
  501. unsigned short _RTLENTRY _EXPFUNC _rotl(unsigned short __value, int __count);
  502. unsigned short _RTLENTRY _EXPFUNC _rotr(unsigned short __value, int __count);
  503.  
  504. void          _RTLENTRY  _EXPFUNC _searchenv(const char * __file,
  505.                                              const char * __varname,
  506.                                              char *__pathname);
  507. void          _RTLENTRY  _EXPFUNC _searchstr(const char * __file,
  508.                                              const char * __ipath,
  509.                                              char *__pathname);
  510. void          _RTLENTRY  _EXPFUNC _splitpath(const char * __path,
  511.                                              char * __drive,
  512.                                              char * __dir,
  513.                                              char * __name,
  514.                                              char * __ext );
  515. void          _RTLENTRY  _EXPFUNC swab(char * __from, char * __to, int __nbytes);
  516. char *        _RTLENTRYF _EXPFUNC ultoa(unsigned long __value, char * __string,
  517.                                         int __radix);
  518.  
  519. wchar_t *     _RTLENTRYF _EXPFUNC _wfullpath(wchar_t * __buf,
  520.                                              const wchar_t * __path,
  521.                                              size_t __maxlen);
  522. void          _RTLENTRY  _EXPFUNC _wmakepath(wchar_t * __path,
  523.                                              const wchar_t * __drive,
  524.                                              const wchar_t * __dir,
  525.                                              const wchar_t * __name,
  526.                                              const wchar_t * __ext );
  527. void          _RTLENTRY  _EXPFUNC _wsplitpath(const wchar_t * __path,
  528.                                               wchar_t * __drive,
  529.                                               wchar_t * __dir,
  530.                                               wchar_t * __name,
  531.                                               wchar_t * __ext );
  532.  
  533. void          _RTLENTRY  _EXPFUNC _wsearchenv(const wchar_t * __file,
  534.                                              const wchar_t * __varname,
  535.                                              wchar_t *__pathname);
  536. void          _RTLENTRY  _EXPFUNC _wsearchstr(const wchar_t * __file,
  537.                                              const wchar_t * __ipath,
  538.                                              wchar_t *__pathname);
  539. wchar_t *     _RTLENTRY _EXPFUNC  _wgetenv(const wchar_t * __name);
  540. int           _RTLENTRY _EXPFUNC  _wputenv(const wchar_t * __name);
  541. /* Intrinsic functions */
  542.  
  543. unsigned char _RTLENTRY  ___crotl__(unsigned char __value, int __count);
  544. unsigned char _RTLENTRY  ___crotr__(unsigned char __value, int __count);
  545. unsigned long _RTLENTRY  ___lrotl__(unsigned long __val, int __count);
  546. unsigned long _RTLENTRY  ___lrotr__(unsigned long __val, int __count);
  547. unsigned short _RTLENTRY ___rotl__ (unsigned short __value, int __count);
  548. unsigned short _RTLENTRY ___rotr__ (unsigned short __value, int __count);
  549.  
  550. #ifdef __cplusplus
  551. }
  552. #endif
  553.  
  554. #if !defined(__STDC__)
  555.  
  556. #if defined(__cplusplus)
  557. inline int  _RTLENTRY random(int __num)
  558.                        { return __num ? (int)(_lrand()%(__num)) : 0; }
  559. #else /* __cplusplus */
  560. #define random(num) (num ? (int)(_lrand()%(num)) : 0)
  561. #endif  /* __cplusplus  */
  562.  
  563. #endif /* __STDC__ */
  564.  
  565. #endif  /* __FLAT__ */
  566.  
  567. #if defined(__cplusplus)
  568. extern "C" long _RTLENTRY _EXPFUNC time(long _FAR *);
  569. #endif
  570.  
  571. #if !defined(__STDC__)
  572.  
  573. #if defined(__cplusplus)
  574.  
  575. /* Need prototype of time() for C++ randomize() */
  576. inline void _RTLENTRY randomize(void) { srand((unsigned) time(NULL)); }
  577.  
  578. #if defined(__MFC_COMPAT__)
  579. #if !defined( __MINMAX_DEFINED)
  580. #define __MINMAX_DEFINED
  581. #define max(a,b)    (((a) > (b)) ? (a) : (b))
  582. #define min(a,b)    (((a) < (b)) ? (a) : (b))
  583. #define __max       max
  584. #define __min       min
  585. #endif /*__MINMAX_DEFINED */
  586.  
  587. inline char * _RTLENTRY  _ecvt(double __value, int __ndig, int * __dec,
  588.                          int * __sign)
  589.                          { return ecvt (__value, __ndig, __dec, __sign); }
  590. inline char * _RTLENTRY  _fcvt(double __value, int __ndig, int * __dec,
  591.                          int * __sign)
  592.                          { return fcvt (__value, __ndig, __dec, __sign); }
  593. inline char * _RTLENTRY  _gcvt(double __value, int __ndec,
  594.                          char * __buf)
  595.                          { return gcvt(__value, __ndec, __buf); }
  596. inline char * _RTLENTRYF _itoa(int __value, char * __string,
  597.                          int __radix)
  598.                          { return itoa(__value, __string, __radix); }
  599. inline char * _RTLENTRYF _ltoa(long __value, char * __string,
  600.                          int __radix)
  601.                          { return ltoa(__value, __string, __radix); }
  602. inline char * _RTLENTRYF _ultoa(unsigned long __value, char * __string,
  603.                          int __radix)
  604.                          { return ultoa(__value, __string, __radix); }
  605. inline int    _RTLENTRY  _putenv(const char * __name) {return putenv(__name);}
  606. inline void   _RTLENTRY  _swab(char * __from, char * __to, int __nbytes)
  607.                          { swab (__from, __to, __nbytes); }
  608. #if !defined(__DLL__)
  609. extern  int           _RTLENTRY __argc;
  610. extern  char        **_RTLENTRY __argv;
  611. #endif  /* __DLL__ */
  612. #else   /* __MFC_COMPAT__ */
  613. #if !defined( __MINMAX_DEFINED) && defined(__cplusplus)
  614. #define __MINMAX_DEFINED
  615. template <class T> inline const T _FAR &min( const T _FAR &t1, const T _FAR &t2 )
  616. {
  617.     if  (t1 < t2)
  618.         return t1;
  619.     else
  620.         return t2;
  621. }
  622.  
  623. template <class T> inline const T _FAR &max( const T _FAR &t1, const T _FAR &t2 )
  624. {
  625.     if  (t1 > t2)
  626.         return t1;
  627.     else
  628.         return t2;
  629. }
  630. #endif
  631. #endif /* __MFC_COMPAT__ */
  632.  
  633. #else /* __cplusplus */
  634.  
  635. #define randomize() srand((unsigned)time(NULL))
  636. #define max(a,b)    (((a) > (b)) ? (a) : (b))
  637. #define min(a,b)    (((a) < (b)) ? (a) : (b))
  638. #endif /* __cplusplus */
  639.  
  640.  
  641. #define  MB_CUR_MAX              1
  642.  
  643. #endif /* __STDC__ */
  644.  
  645. #if defined(__MSC) && !defined(__MFC_COMPAT__)
  646. #define _itoa(__value, __string, __radix) itoa(__value, __string, __radix)
  647. #endif
  648.  
  649.  
  650. #if !defined(RC_INVOKED)
  651.  
  652. /* restore default packing */
  653. #pragma pack(pop)
  654.  
  655. #if defined(__STDC__)
  656. #pragma warn .nak
  657. #endif
  658.  
  659. #endif  /* !RC_INVOKED */
  660.  
  661.  
  662. #endif  /* __STDLIB_H */
  663.  
  664.