| 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 | ldiv_t ldiv (long, long);
|
|---|
| 82 | void exit (int) __attribute__ ((__noreturn__));
|
|---|
| 83 | char *getenv (__const__ char *);
|
|---|
| 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__ unsigned char _osminor;
|
|---|
| 152 | extern __const__ unsigned char _osmajor;
|
|---|
| 153 |
|
|---|
| 154 | /* No DOS support ... */
|
|---|
| 155 | #define _osmode OS2_MODE
|
|---|
| 156 |
|
|---|
| 157 | unsigned alarm (unsigned);
|
|---|
| 158 | int brk(const void *);
|
|---|
| 159 | int chdir (__const__ char *);
|
|---|
| 160 | char *gcvt (double, int, char *);
|
|---|
| 161 | char *getcwd (char *, size_t);
|
|---|
| 162 | int getpagesize (void);
|
|---|
| 163 | char *getwd (char *);
|
|---|
| 164 | int mkdir (__const__ char *, long);
|
|---|
| 165 | void perror (__const__ char *);
|
|---|
| 166 | int putenv (__const__ char *);
|
|---|
| 167 | int rmdir (__const__ char *);
|
|---|
| 168 | void *sbrk(intptr_t);
|
|---|
| 169 | unsigned sleep (unsigned);
|
|---|
| 170 | void swab (__const__ void *, void *, size_t);
|
|---|
| 171 | long ulimit (int, ...);
|
|---|
| 172 |
|
|---|
| 173 | int heapsort (void *, size_t, size_t,
|
|---|
| 174 | int (*)(__const__ void *, __const__ void *)); /* BSD */
|
|---|
| 175 | char *initstate (unsigned, char *, int); /* BSD */
|
|---|
| 176 | long random (void); /* BSD */
|
|---|
| 177 | char *setstate (char *); /* BSD */
|
|---|
| 178 | void srandom (unsigned); /* BSD */
|
|---|
| 179 |
|
|---|
| 180 | char *itoa (int, char *, int);
|
|---|
| 181 | char *ltoa (long, char *, int);
|
|---|
| 182 | char *ultoa (unsigned long, char *, int);
|
|---|
| 183 | char *lltoa (long long, char *, int);
|
|---|
| 184 | char *ulltoa (unsigned long long, char *, int);
|
|---|
| 185 |
|
|---|
| 186 | #endif
|
|---|
| 187 |
|
|---|
| 188 |
|
|---|
| 189 | #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
|
|---|
| 190 | || defined (_WITH_UNDERSCORE)
|
|---|
| 191 |
|
|---|
| 192 | extern char **_environ;
|
|---|
| 193 |
|
|---|
| 194 | unsigned _alarm (unsigned);
|
|---|
| 195 | int _brk(const void *);
|
|---|
| 196 | int _chdir (__const__ char *);
|
|---|
| 197 | char *_gcvt (double, int, char *);
|
|---|
| 198 | char *_getcwd (char *, size_t);
|
|---|
| 199 | int _getpagesize (void);
|
|---|
| 200 | char *_getwd (char *);
|
|---|
| 201 | int _mkdir (__const__ char *, long);
|
|---|
| 202 | int _putenv (__const__ char *);
|
|---|
| 203 | int _rmdir (__const__ char *);
|
|---|
| 204 | void *_sbrk(intptr_t);
|
|---|
| 205 | unsigned _sleep (unsigned);
|
|---|
| 206 | void _swab (__const__ void *, void *, size_t);
|
|---|
| 207 | long _ulimit (int, ...);
|
|---|
| 208 |
|
|---|
| 209 | int _abspath (char *, __const__ char *, int);
|
|---|
| 210 | long long _atoll (__const__ char *);
|
|---|
| 211 | long double _atofl (__const__ char *);
|
|---|
| 212 | int _chdir2 (__const__ char *);
|
|---|
| 213 | int _chdrive (char);
|
|---|
| 214 | int _core (int);
|
|---|
| 215 | void _defext (char *, __const__ char *);
|
|---|
| 216 | void _envargs (int *, char ***, __const__ char *);
|
|---|
| 217 | int _execname (char *, size_t);
|
|---|
| 218 | void _exit (int) __attribute__ ((__noreturn__));
|
|---|
| 219 | int _filesys (__const__ char *, char *, size_t);
|
|---|
| 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 | _uldiv_t _uldiv (unsigned long, unsigned long);
|
|---|
| 242 | _ulldiv_t _ulldiv (unsigned long long, unsigned long long);
|
|---|
| 243 | char *_itoa (int, char *, int);
|
|---|
| 244 | char *_ltoa (long, char *, int);
|
|---|
| 245 | char *_ultoa (unsigned long, char *, int);
|
|---|
| 246 | char *_lltoa (long long, char *, int);
|
|---|
| 247 | char *_ulltoa (unsigned long long, char *, int);
|
|---|
| 248 | void _makepath (char *, __const__ char *, __const__ char *,
|
|---|
| 249 | __const__ char *, __const__ char *);
|
|---|
| 250 | int _path (char *, __const__ char *);
|
|---|
| 251 | int _read_kbd (int, int, int);
|
|---|
| 252 | void _remext (char *);
|
|---|
| 253 | void _rfnlwr (void);
|
|---|
| 254 | void _response (int *, char ***);
|
|---|
| 255 | void _scrsize (int *);
|
|---|
| 256 | void _searchenv (__const__ char *, __const__ char *, char *);
|
|---|
| 257 | void _sfnlwr (__const__ char *);
|
|---|
| 258 | unsigned _sleep2 (unsigned);
|
|---|
| 259 | char ** _splitargs (char *, int *);
|
|---|
| 260 | void _splitpath (__const__ char *, char *, char *, char *, char *);
|
|---|
| 261 | float _strtof (__const__ char *, char **);
|
|---|
| 262 | long double _strtold (__const__ char *, char **);
|
|---|
| 263 | long long _strtoll (__const__ char *, char **, int);
|
|---|
| 264 | unsigned long long _strtoull (__const__ char *, char **, int);
|
|---|
| 265 | char _swchar (void);
|
|---|
| 266 | void _wildcard (int *, char ***);
|
|---|
| 267 |
|
|---|
| 268 | int _beginthread (void (*)(void *), void *, unsigned, void *);
|
|---|
| 269 | void _endthread (void);
|
|---|
| 270 | void **_threadstore (void);
|
|---|
| 271 |
|
|---|
| 272 | #endif
|
|---|
| 273 |
|
|---|
| 274 |
|
|---|
| 275 | #if defined (__cplusplus)
|
|---|
| 276 | }
|
|---|
| 277 | #endif
|
|---|
| 278 |
|
|---|
| 279 | #include <malloc.h>
|
|---|
| 280 |
|
|---|
| 281 | #endif /* not _STDLIB_H */
|
|---|