| 1 | /* stdlib.h (emx+gcc) */ | 
|---|
| 2 |  | 
|---|
| 3 | #ifndef _STDLIB_H | 
|---|
| 4 | #define _STDLIB_H | 
|---|
| 5 |  | 
|---|
| 6 | #if defined (__cplusplus) | 
|---|
| 7 | extern "C" { | 
|---|
| 8 | #endif | 
|---|
| 9 |  | 
|---|
| 10 | #include <sys/_types.h> | 
|---|
| 11 |  | 
|---|
| 12 | #if !defined (_SIZE_T) | 
|---|
| 13 | #define _SIZE_T | 
|---|
| 14 | typedef unsigned long size_t; | 
|---|
| 15 | #endif | 
|---|
| 16 |  | 
|---|
| 17 | #if !defined (_WCHAR_T) && !defined (__cplusplus) | 
|---|
| 18 | #define _WCHAR_T | 
|---|
| 19 | typedef unsigned short wchar_t; | 
|---|
| 20 | #endif | 
|---|
| 21 |  | 
|---|
| 22 | #ifndef _INTPTR_T_DECLARED | 
|---|
| 23 | typedef __intptr_t      intptr_t; | 
|---|
| 24 | typedef __uintptr_t     uintptr_t; | 
|---|
| 25 | #define _INTPTR_T_DECLARED | 
|---|
| 26 | #endif | 
|---|
| 27 |  | 
|---|
| 28 | #if !defined (NULL) | 
|---|
| 29 | #if defined (__cplusplus) | 
|---|
| 30 | #define NULL 0 | 
|---|
| 31 | #else | 
|---|
| 32 | #define NULL ((void *)0) | 
|---|
| 33 | #endif | 
|---|
| 34 | #endif | 
|---|
| 35 |  | 
|---|
| 36 | #if !defined (_DIV_T) | 
|---|
| 37 | #define _DIV_T | 
|---|
| 38 | typedef struct _div_t | 
|---|
| 39 | { | 
|---|
| 40 | int quot; | 
|---|
| 41 | int rem; | 
|---|
| 42 | } div_t; | 
|---|
| 43 | typedef struct _ldiv_t | 
|---|
| 44 | { | 
|---|
| 45 | long quot; | 
|---|
| 46 | long rem; | 
|---|
| 47 | } ldiv_t; | 
|---|
| 48 | #endif | 
|---|
| 49 |  | 
|---|
| 50 | #if !defined (RAND_MAX) | 
|---|
| 51 | #define RAND_MAX 0x7fff | 
|---|
| 52 | #endif | 
|---|
| 53 |  | 
|---|
| 54 | #if !defined (EXIT_SUCCESS) | 
|---|
| 55 | #define EXIT_SUCCESS 0 | 
|---|
| 56 | #define EXIT_FAILURE 1 | 
|---|
| 57 | #endif | 
|---|
| 58 |  | 
|---|
| 59 | #if !defined (MB_CUR_MAX) | 
|---|
| 60 | extern int _mb_cur_max; | 
|---|
| 61 | #define MB_CUR_MAX _mb_cur_max | 
|---|
| 62 | #endif | 
|---|
| 63 |  | 
|---|
| 64 | #if !defined (_MAX_PATH) | 
|---|
| 65 | #define _MAX_PATH   260 | 
|---|
| 66 | #define _MAX_DRIVE    3 | 
|---|
| 67 | #define _MAX_DIR    256 | 
|---|
| 68 | #define _MAX_FNAME  256 | 
|---|
| 69 | #define _MAX_EXT    256 | 
|---|
| 70 | #endif | 
|---|
| 71 |  | 
|---|
| 72 |  | 
|---|
| 73 | void abort (void) __attribute__ ((__noreturn__)); | 
|---|
| 74 | int atexit (void (*)(void)); | 
|---|
| 75 | double atof (__const__ char *); | 
|---|
| 76 | int atoi (__const__ char *); | 
|---|
| 77 | long atol (__const__ char *); | 
|---|
| 78 | void *bsearch (__const__ void *, __const__ void *, size_t, size_t, | 
|---|
| 79 | int (*)(__const__ void *, __const__ void *)); | 
|---|
| 80 | div_t div (int, int); | 
|---|
| 81 | void exit (int) __attribute__ ((__noreturn__)); | 
|---|
| 82 | char *getenv (__const__ char *); | 
|---|
| 83 | ldiv_t ldiv (long, long); | 
|---|
| 84 | int mblen (__const__ char *, size_t); | 
|---|
| 85 | size_t mbstowcs (wchar_t *, __const__ char *, size_t); | 
|---|
| 86 | int mbtowc (wchar_t *, __const__ char *, size_t); | 
|---|
| 87 | void qsort (void *, size_t, size_t, | 
|---|
| 88 | int (*)(__const__ void *, __const__ void *)); | 
|---|
| 89 | int rand (void); | 
|---|
| 90 | void srand (unsigned); | 
|---|
| 91 | double strtod (__const__ char *, char **); | 
|---|
| 92 | long strtol (__const__ char *, char **, int); | 
|---|
| 93 | unsigned long strtoul (__const__ char *, char **, int); | 
|---|
| 94 | int system (__const__ char *); | 
|---|
| 95 | size_t wcstombs (char *, __const__ wchar_t *, size_t); | 
|---|
| 96 | int wctomb (char *, wchar_t); | 
|---|
| 97 |  | 
|---|
| 98 | #if !defined (_ABS)                                      /* see also math.h */ | 
|---|
| 99 | #define _ABS | 
|---|
| 100 | #if !defined (__GNUC__) || __GNUC__ >= 2 | 
|---|
| 101 | extern int abs (int); | 
|---|
| 102 | extern long labs (long); | 
|---|
| 103 | #else | 
|---|
| 104 | extern __inline__ int abs (int _n) { return (_n < 0 ? -_n : _n); } | 
|---|
| 105 | extern __inline__ long labs (long _n) { return (_n < 0 ? -_n : _n); } | 
|---|
| 106 | #endif | 
|---|
| 107 | #endif | 
|---|
| 108 |  | 
|---|
| 109 | #if !defined (__NO_C9X) | 
|---|
| 110 |  | 
|---|
| 111 | float strtof (__const__ char *, char **); | 
|---|
| 112 | long double strtold (__const__ char *, char **); | 
|---|
| 113 |  | 
|---|
| 114 | #endif | 
|---|
| 115 |  | 
|---|
| 116 |  | 
|---|
| 117 | #if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE) | 
|---|
| 118 |  | 
|---|
| 119 | #if !defined (OS2_MODE) | 
|---|
| 120 | #define DOS_MODE 0 | 
|---|
| 121 | #define OS2_MODE 1 | 
|---|
| 122 | #endif | 
|---|
| 123 |  | 
|---|
| 124 | #if !defined (_ERRNO) | 
|---|
| 125 | #define _ERRNO | 
|---|
| 126 | extern int *_errno (void); | 
|---|
| 127 | #define errno (*_errno ()) | 
|---|
| 128 | #endif | 
|---|
| 129 |  | 
|---|
| 130 | #if !defined (_ULDIV_T) | 
|---|
| 131 | #define _ULDIV_T | 
|---|
| 132 | typedef struct | 
|---|
| 133 | { | 
|---|
| 134 | unsigned long quot; | 
|---|
| 135 | unsigned long rem; | 
|---|
| 136 | } _uldiv_t; | 
|---|
| 137 | typedef struct | 
|---|
| 138 | { | 
|---|
| 139 | long long quot; | 
|---|
| 140 | long long rem; | 
|---|
| 141 | } _lldiv_t; | 
|---|
| 142 | typedef struct | 
|---|
| 143 | { | 
|---|
| 144 | unsigned long long quot; | 
|---|
| 145 | unsigned long long rem; | 
|---|
| 146 | } _ulldiv_t; | 
|---|
| 147 | #endif | 
|---|
| 148 |  | 
|---|
| 149 | extern char **environ; | 
|---|
| 150 |  | 
|---|
| 151 | extern __const__ char * __const__ sys_errlist[]; | 
|---|
| 152 | extern __const__ int sys_nerr; | 
|---|
| 153 |  | 
|---|
| 154 | extern __const__ unsigned char _osminor; | 
|---|
| 155 | extern __const__ unsigned char _osmajor; | 
|---|
| 156 |  | 
|---|
| 157 | /* No DOS support ... */ | 
|---|
| 158 | #define _osmode OS2_MODE | 
|---|
| 159 |  | 
|---|
| 160 | unsigned alarm (unsigned); | 
|---|
| 161 | int      brk(const void *); | 
|---|
| 162 | int chdir (__const__ char *); | 
|---|
| 163 | char *gcvt (double, int, char *); | 
|---|
| 164 | char *getcwd (char *, size_t); | 
|---|
| 165 | int getpagesize (void); | 
|---|
| 166 | char *getwd (char *); | 
|---|
| 167 | int mkdir (__const__ char *, long); | 
|---|
| 168 | void perror (__const__ char *); | 
|---|
| 169 | int putenv (__const__ char *); | 
|---|
| 170 | int rmdir (__const__ char *); | 
|---|
| 171 | void    *sbrk(intptr_t); | 
|---|
| 172 | unsigned sleep (unsigned); | 
|---|
| 173 | void swab (__const__ void *, void *, size_t); | 
|---|
| 174 | long ulimit (int, ...); | 
|---|
| 175 |  | 
|---|
| 176 | int heapsort (void *, size_t, size_t, | 
|---|
| 177 | int (*)(__const__ void *, __const__ void *));       /* BSD */ | 
|---|
| 178 | char *initstate (unsigned, char *, int);                /* BSD */ | 
|---|
| 179 | long random (void);                                     /* BSD */ | 
|---|
| 180 | char *setstate (char *);                                /* BSD */ | 
|---|
| 181 | void srandom (unsigned);                                /* BSD */ | 
|---|
| 182 |  | 
|---|
| 183 | #endif | 
|---|
| 184 |  | 
|---|
| 185 |  | 
|---|
| 186 | #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \ | 
|---|
| 187 | || defined (_WITH_UNDERSCORE) | 
|---|
| 188 |  | 
|---|
| 189 | extern char **_environ; | 
|---|
| 190 | extern __const__ char * __const__ _sys_errlist[]; | 
|---|
| 191 | extern __const__ int _sys_nerr; | 
|---|
| 192 |  | 
|---|
| 193 | unsigned _alarm (unsigned); | 
|---|
| 194 | int      _brk(const void *); | 
|---|
| 195 | int _chdir (__const__ char *); | 
|---|
| 196 | char *_gcvt (double, int, char *); | 
|---|
| 197 | char *_getcwd (char *, size_t); | 
|---|
| 198 | int _getpagesize (void); | 
|---|
| 199 | char *_getwd (char *); | 
|---|
| 200 | int _mkdir (__const__ char *, long); | 
|---|
| 201 | int _putenv (__const__ char *); | 
|---|
| 202 | int _rmdir (__const__ char *); | 
|---|
| 203 | void     *_sbrk(intptr_t); | 
|---|
| 204 | unsigned _sleep (unsigned); | 
|---|
| 205 | void _swab (__const__ void *, void *, size_t); | 
|---|
| 206 | long _ulimit (int, ...); | 
|---|
| 207 |  | 
|---|
| 208 | int _abspath (char *, __const__ char *, int); | 
|---|
| 209 | long long _atoll (__const__ char *); | 
|---|
| 210 | long double _atofl (__const__ char *); | 
|---|
| 211 | int _chdir2 (__const__ char *); | 
|---|
| 212 | int _chdrive (char); | 
|---|
| 213 | int _core (int); | 
|---|
| 214 | void _defext (char *, __const__ char *); | 
|---|
| 215 | void _envargs (int *, char ***, __const__ char *); | 
|---|
| 216 | int _execname (char *, size_t); | 
|---|
| 217 | void _exit (int) __attribute__ ((__noreturn__)); | 
|---|
| 218 | int _filesys (__const__ char *, char *, size_t); | 
|---|
| 219 | int _fncmp (__const__ unsigned char *, __const__ unsigned char *); | 
|---|
| 220 | char **_fnexplode (__const__ char *); | 
|---|
| 221 | void _fnexplodefree (char **); | 
|---|
| 222 | char _fngetdrive (__const__ char *); | 
|---|
| 223 | int _fnisabs (__const__ char *); | 
|---|
| 224 | int _fnisrel (__const__ char *); | 
|---|
| 225 | void _fnlwr (char *); | 
|---|
| 226 | void _fnlwr2 (char *, __const__ char *); | 
|---|
| 227 | char *_fnslashify (char *); | 
|---|
| 228 | int _fullpath (char *, __const__ char *, int); | 
|---|
| 229 | int _getcwd1 (char *, char); | 
|---|
| 230 | char *_getcwd2 (char *, int); | 
|---|
| 231 | char _getdrive (void); | 
|---|
| 232 | char *_getext (__const__ char *); | 
|---|
| 233 | char *_getext2 (__const__ char *); | 
|---|
| 234 | char *_getname (__const__ char *); | 
|---|
| 235 | int _getsockhandle (int); | 
|---|
| 236 | int _gettid (void); | 
|---|
| 237 | char *_getvol (char); | 
|---|
| 238 | char *_itoa (int, char *, int); | 
|---|
| 239 | _lldiv_t _lldiv (long long, long long); | 
|---|
| 240 | char *_lltoa (long long, char *, int); | 
|---|
| 241 | char *_ltoa (long, char *, int); | 
|---|
| 242 | void _makepath (char *, __const__ char *, __const__ char *, | 
|---|
| 243 | __const__ char *, __const__ char *); | 
|---|
| 244 | int _path (char *, __const__ char *); | 
|---|
| 245 | int _read_kbd (int, int, int); | 
|---|
| 246 | void _remext (char *); | 
|---|
| 247 | void _rfnlwr (void); | 
|---|
| 248 | void _response (int *, char ***); | 
|---|
| 249 | void _scrsize (int *); | 
|---|
| 250 | void _searchenv (__const__ char *, __const__ char *, char *); | 
|---|
| 251 | void _sfnlwr (__const__ char *); | 
|---|
| 252 | unsigned _sleep2 (unsigned); | 
|---|
| 253 | char ** _splitargs (char *, int *); | 
|---|
| 254 | void _splitpath (__const__ char *, char *, char *, char *, char *); | 
|---|
| 255 | float _strtof (__const__ char *, char **); | 
|---|
| 256 | long double _strtold (__const__ char *, char **); | 
|---|
| 257 | long long _strtoll (__const__ char *, char **, int); | 
|---|
| 258 | unsigned long long _strtoull (__const__ char *, char **, int); | 
|---|
| 259 | char _swchar (void); | 
|---|
| 260 | _uldiv_t _uldiv (unsigned long, unsigned long); | 
|---|
| 261 | _ulldiv_t _ulldiv (unsigned long long, unsigned long long); | 
|---|
| 262 | char *_ulltoa (unsigned long long, char *, int); | 
|---|
| 263 | char *_ultoa (unsigned long, char *, int); | 
|---|
| 264 | void _wildcard (int *, char ***); | 
|---|
| 265 |  | 
|---|
| 266 | int _beginthread (void (*)(void *), void *, unsigned, void *); | 
|---|
| 267 | void _endthread (void); | 
|---|
| 268 | void **_threadstore (void); | 
|---|
| 269 |  | 
|---|
| 270 | #endif | 
|---|
| 271 |  | 
|---|
| 272 |  | 
|---|
| 273 | #if defined (__cplusplus) | 
|---|
| 274 | } | 
|---|
| 275 | #endif | 
|---|
| 276 |  | 
|---|
| 277 | #include <malloc.h> | 
|---|
| 278 |  | 
|---|
| 279 | #endif /* not _STDLIB_H */ | 
|---|