1 | /* stdlib.h (emx+gcc) */
|
---|
2 |
|
---|
3 | #ifndef _EMXSTDLIB_H
|
---|
4 | #define _EMXSTDLIB_H
|
---|
5 |
|
---|
6 | #ifndef CRTWRAP
|
---|
7 | #define CRTWRAP(a) emx_##a
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | #if defined (__cplusplus)
|
---|
11 | extern "C" {
|
---|
12 | #endif
|
---|
13 |
|
---|
14 | #if !defined (_SIZE_T)
|
---|
15 | #define _SIZE_T
|
---|
16 | typedef unsigned long size_t;
|
---|
17 | #endif
|
---|
18 |
|
---|
19 | #if !defined (_WCHAR_T) && !defined (__cplusplus)
|
---|
20 | #define _WCHAR_T
|
---|
21 | typedef unsigned short wchar_t;
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #if !defined (NULL)
|
---|
25 | #if defined (__cplusplus)
|
---|
26 | #define NULL 0
|
---|
27 | #else
|
---|
28 | #define NULL ((void *)0)
|
---|
29 | #endif
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #if !defined (_DIV_T)
|
---|
33 | #define _DIV_T
|
---|
34 | typedef struct _div_t
|
---|
35 | {
|
---|
36 | int quot;
|
---|
37 | int rem;
|
---|
38 | } div_t;
|
---|
39 | typedef struct _ldiv_t
|
---|
40 | {
|
---|
41 | long quot;
|
---|
42 | long rem;
|
---|
43 | } ldiv_t;
|
---|
44 | #endif
|
---|
45 |
|
---|
46 | #if !defined (RAND_MAX)
|
---|
47 | #define RAND_MAX 0x7fff
|
---|
48 | #endif
|
---|
49 |
|
---|
50 | #if !defined (EXIT_SUCCESS)
|
---|
51 | #define EXIT_SUCCESS 0
|
---|
52 | #define EXIT_FAILURE 1
|
---|
53 | #endif
|
---|
54 |
|
---|
55 | #if !defined (MB_CUR_MAX)
|
---|
56 | extern int _mb_cur_max;
|
---|
57 | #define MB_CUR_MAX _mb_cur_max
|
---|
58 | #endif
|
---|
59 |
|
---|
60 | #if !defined (_MAX_PATH)
|
---|
61 | #define _MAX_PATH 260
|
---|
62 | #define _MAX_DRIVE 3
|
---|
63 | #define _MAX_DIR 256
|
---|
64 | #define _MAX_FNAME 256
|
---|
65 | #define _MAX_EXT 256
|
---|
66 | #endif
|
---|
67 |
|
---|
68 | #define abort CRTWRAP(abort)
|
---|
69 | #define atexit CRTWRAP(atexit)
|
---|
70 | #define atof CRTWRAP(atof)
|
---|
71 | #define atoi CRTWRAP(atoi)
|
---|
72 | #define atol CRTWRAP(atol)
|
---|
73 | #define bsearch CRTWRAP(bsearch)
|
---|
74 | #define div CRTWRAP(div)
|
---|
75 | #define exit CRTWRAP(exit)
|
---|
76 | #define getenv CRTWRAP(getenv)
|
---|
77 | #define ldiv CRTWRAP(ldiv)
|
---|
78 | #define mblen CRTWRAP(mblen)
|
---|
79 | #define mbstowcs CRTWRAP(mbstowcs)
|
---|
80 | #define mbtowc CRTWRAP(mbtowc)
|
---|
81 | #define qsort CRTWRAP(qsort)
|
---|
82 | #define rand CRTWRAP(rand)
|
---|
83 | #define srand CRTWRAP(srand)
|
---|
84 | #define strtod CRTWRAP(strtod)
|
---|
85 | #define strtol CRTWRAP(strtol)
|
---|
86 | #define strtoul CRTWRAP(strtoul)
|
---|
87 | #define system CRTWRAP(system)
|
---|
88 | #define wcstombs CRTWRAP(wcstombs)
|
---|
89 | #define wctomb CRTWRAP(wctomb)
|
---|
90 |
|
---|
91 | void abort (void) __attribute__ ((__noreturn__));
|
---|
92 | int atexit (void (*)(void));
|
---|
93 | double atof (__const__ char *);
|
---|
94 | int atoi (__const__ char *);
|
---|
95 | long atol (__const__ char *);
|
---|
96 | void *bsearch (__const__ void *, __const__ void *, size_t, size_t,
|
---|
97 | int (*)(__const__ void *, __const__ void *));
|
---|
98 | div_t div (int, int);
|
---|
99 | void exit (int) __attribute__ ((__noreturn__));
|
---|
100 | char *getenv (__const__ char *);
|
---|
101 | ldiv_t ldiv (long, long);
|
---|
102 | int mblen (__const__ char *, size_t);
|
---|
103 | size_t mbstowcs (wchar_t *, __const__ char *, size_t);
|
---|
104 | int mbtowc (wchar_t *, __const__ char *, size_t);
|
---|
105 | void qsort (void *, size_t, size_t,
|
---|
106 | int (*)(__const__ void *, __const__ void *));
|
---|
107 | int rand (void);
|
---|
108 | void srand (unsigned);
|
---|
109 | double strtod (__const__ char *, char **);
|
---|
110 | long strtol (__const__ char *, char **, int);
|
---|
111 | unsigned long strtoul (__const__ char *, char **, int);
|
---|
112 | int system (__const__ char *);
|
---|
113 | size_t wcstombs (char *, __const__ wchar_t *, size_t);
|
---|
114 | int wctomb (char *, wchar_t);
|
---|
115 |
|
---|
116 | #if !defined (_ABS) /* see also math.h */
|
---|
117 | #define _ABS
|
---|
118 | #if !defined (__GNUC__) || __GNUC__ >= 2
|
---|
119 |
|
---|
120 | #define abs CRTWRAP(abs)
|
---|
121 | #define labs CRTWRAP(labs)
|
---|
122 |
|
---|
123 | extern int abs (int);
|
---|
124 | extern long labs (long);
|
---|
125 | #else
|
---|
126 | extern __inline__ int abs (int _n) { return (_n < 0 ? -_n : _n); }
|
---|
127 | extern __inline__ long labs (long _n) { return (_n < 0 ? -_n : _n); }
|
---|
128 | #endif
|
---|
129 | #endif
|
---|
130 |
|
---|
131 | #if !defined (__NO_C9X)
|
---|
132 |
|
---|
133 | #define strtof CRTWRAP(strtof)
|
---|
134 | #define strtold CRTWRAP(strtold)
|
---|
135 |
|
---|
136 | float strtof (__const__ char *, char **);
|
---|
137 | long double strtold (__const__ char *, char **);
|
---|
138 |
|
---|
139 | #endif
|
---|
140 |
|
---|
141 |
|
---|
142 | #if !defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)
|
---|
143 |
|
---|
144 | #if !defined (OS2_MODE)
|
---|
145 | #define DOS_MODE 0
|
---|
146 | #define OS2_MODE 1
|
---|
147 | #endif
|
---|
148 |
|
---|
149 | #if !defined (_ERRNO)
|
---|
150 | #define _ERRNO
|
---|
151 | #if defined (__MT__) || defined (__ST_MT_ERRNO__)
|
---|
152 | extern int *__errno (void);
|
---|
153 | #define errno (*emx__errno ())
|
---|
154 | #else
|
---|
155 | #define errno CRTWRAP(errno)
|
---|
156 | extern int errno;
|
---|
157 | #endif
|
---|
158 | #endif
|
---|
159 |
|
---|
160 | #if !defined (_ULDIV_T)
|
---|
161 | #define _ULDIV_T
|
---|
162 | typedef struct
|
---|
163 | {
|
---|
164 | unsigned long quot;
|
---|
165 | unsigned long rem;
|
---|
166 | } _uldiv_t;
|
---|
167 | typedef struct
|
---|
168 | {
|
---|
169 | long long quot;
|
---|
170 | long long rem;
|
---|
171 | } _lldiv_t;
|
---|
172 | typedef struct
|
---|
173 | {
|
---|
174 | unsigned long long quot;
|
---|
175 | unsigned long long rem;
|
---|
176 | } _ulldiv_t;
|
---|
177 | #endif
|
---|
178 |
|
---|
179 | extern char **environ;
|
---|
180 |
|
---|
181 | extern __const__ char * __const__ sys_errlist[];
|
---|
182 | extern __const__ int sys_nerr;
|
---|
183 |
|
---|
184 | extern __const__ unsigned int _emx_vcmp;
|
---|
185 | extern __const__ unsigned int _emx_env;
|
---|
186 | extern __const__ unsigned int _emx_rev;
|
---|
187 | extern __const__ unsigned char _osminor;
|
---|
188 | extern __const__ unsigned char _osmajor;
|
---|
189 | extern __const__ unsigned char _osmode;
|
---|
190 | extern __const__ char _emx_vprt[5];
|
---|
191 |
|
---|
192 |
|
---|
193 | #define alarm CRTWRAP(alarm)
|
---|
194 | #define brk CRTWRAP(brk)
|
---|
195 | #define chdir CRTWRAP(chdir)
|
---|
196 | #define gcvt CRTWRAP(gcvt)
|
---|
197 | #define getcwd CRTWRAP(getcwd)
|
---|
198 | #define getpagesize CRTWRAP(getpagesize)
|
---|
199 | #define getwd CRTWRAP(getwd)
|
---|
200 | #define mkdir CRTWRAP(mkdir)
|
---|
201 | #define perror CRTWRAP(perror)
|
---|
202 | #define putenv CRTWRAP(putenv)
|
---|
203 | #define rmdir CRTWRAP(rmdir)
|
---|
204 | #define sbrk CRTWRAP(sbrk)
|
---|
205 | #define sleep CRTWRAP(sleep)
|
---|
206 | #define swab CRTWRAP(swab)
|
---|
207 | #define ulimit CRTWRAP(ulimit)
|
---|
208 |
|
---|
209 | unsigned alarm (unsigned);
|
---|
210 | void *brk (void *);
|
---|
211 | int chdir (__const__ char *);
|
---|
212 | char *gcvt (double, int, char *);
|
---|
213 | char *getcwd (char *, size_t);
|
---|
214 | int getpagesize (void);
|
---|
215 | char *getwd (char *);
|
---|
216 | int mkdir (__const__ char *, long);
|
---|
217 | void perror (__const__ char *);
|
---|
218 | int putenv (__const__ char *);
|
---|
219 | int rmdir (__const__ char *);
|
---|
220 | void *sbrk (int);
|
---|
221 | unsigned sleep (unsigned);
|
---|
222 | void swab (__const__ void *, void *, size_t);
|
---|
223 | long ulimit (int, ...);
|
---|
224 |
|
---|
225 | #define heapsort CRTWRAP(heapsort)
|
---|
226 | #define initstate CRTWRAP(initstate)
|
---|
227 | #define random CRTWRAP(random)
|
---|
228 | #define setstate CRTWRAP(setstate)
|
---|
229 | #define srandom CRTWRAP(srandom)
|
---|
230 |
|
---|
231 | int heapsort (void *, size_t, size_t,
|
---|
232 | int (*)(__const__ void *, __const__ void *)); /* BSD */
|
---|
233 | char *initstate (unsigned, char *, int); /* BSD */
|
---|
234 | long random (void); /* BSD */
|
---|
235 | char *setstate (char *); /* BSD */
|
---|
236 | void srandom (unsigned); /* BSD */
|
---|
237 |
|
---|
238 | #endif
|
---|
239 |
|
---|
240 |
|
---|
241 | #if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
|
---|
242 | || defined (_WITH_UNDERSCORE)
|
---|
243 |
|
---|
244 | extern char **_environ;
|
---|
245 | extern __const__ char * __const__ _sys_errlist[];
|
---|
246 | extern __const__ int _sys_nerr;
|
---|
247 |
|
---|
248 | #define _alarm CRTWRAP(_alarm)
|
---|
249 | #define _brk CRTWRAP(_brk)
|
---|
250 | #define _chdir CRTWRAP(_chdir)
|
---|
251 | #define _gcvt CRTWRAP(_gcvt)
|
---|
252 | #define _getcwd CRTWRAP(_getcwd)
|
---|
253 | #define _getpagesize CRTWRAP(_getpagesize)
|
---|
254 | #define _getwd CRTWRAP(_getwd)
|
---|
255 | #define _mkdir CRTWRAP(_mkdir)
|
---|
256 | #define _perror CRTWRAP(_perror)
|
---|
257 | #define _putenv CRTWRAP(_putenv)
|
---|
258 | #define _rmdir CRTWRAP(_rmdir)
|
---|
259 | #define _sbrk CRTWRAP(_sbrk)
|
---|
260 | #define _sleep CRTWRAP(_sleep)
|
---|
261 | #define _swab CRTWRAP(_swab)
|
---|
262 | #define _ulimit CRTWRAP(_ulimit)
|
---|
263 |
|
---|
264 | unsigned _alarm (unsigned);
|
---|
265 | void *_brk (void *);
|
---|
266 | int _chdir (__const__ char *);
|
---|
267 | char *_gcvt (double, int, char *);
|
---|
268 | char *_getcwd (char *, size_t);
|
---|
269 | int _getpagesize (void);
|
---|
270 | char *_getwd (char *);
|
---|
271 | int _mkdir (__const__ char *, long);
|
---|
272 | int _putenv (__const__ char *);
|
---|
273 | int _rmdir (__const__ char *);
|
---|
274 | void *_sbrk (int);
|
---|
275 | unsigned _sleep (unsigned);
|
---|
276 | void _swab (__const__ void *, void *, size_t);
|
---|
277 | long _ulimit (int, ...);
|
---|
278 |
|
---|
279 | #define _abspath CRTWRAP(_abspath)
|
---|
280 | #define _atoll CRTWRAP(_atoll)
|
---|
281 | #define _atofl CRTWRAP(_atofl)
|
---|
282 | #define _chdir2 CRTWRAP(_chdir2)
|
---|
283 | #define _chdrive CRTWRAP(_chdrive)
|
---|
284 | #define _core CRTWRAP(_core)
|
---|
285 | #define _defext CRTWRAP(_defext)
|
---|
286 | #define _envargs CRTWRAP(_envargs)
|
---|
287 | #define _execname CRTWRAP(_execname)
|
---|
288 | #define _exit CRTWRAP(_exit)
|
---|
289 | #define _filesys CRTWRAP(_filesys)
|
---|
290 | #define _fncmp CRTWRAP(_fncmp)
|
---|
291 | #define _fnexplode CRTWRAP(_fnexplode)
|
---|
292 | #define _fnexplodefree CRTWRAP(_fnexplodefree)
|
---|
293 | #define _fngetdrive CRTWRAP(_fngetdrive)
|
---|
294 | #define _fnisabs CRTWRAP(_fnisabs)
|
---|
295 | #define _fnisrel CRTWRAP(_fnisrel)
|
---|
296 | #define _fnlwr CRTWRAP(_fnlwr)
|
---|
297 | #define _fnlwr2 CRTWRAP(_fnlwr2)
|
---|
298 | #define _fnslashify CRTWRAP(_fnslashify)
|
---|
299 | #define _fullpath CRTWRAP(_fullpath)
|
---|
300 | #define _getcwd1 CRTWRAP(_getcwd1)
|
---|
301 | #define _getcwd2 CRTWRAP(_getcwd2)
|
---|
302 | #define _getdrive CRTWRAP(_getdrive)
|
---|
303 | #define _getext CRTWRAP(_getext)
|
---|
304 | #define _getext2 CRTWRAP(_getext2)
|
---|
305 | #define _getname CRTWRAP(_getname)
|
---|
306 | #define _getsockhandle CRTWRAP(_getsockhandle)
|
---|
307 | #define _gettid CRTWRAP(_gettid)
|
---|
308 | #define _getvol CRTWRAP(_getvol)
|
---|
309 | #define _itoa CRTWRAP(_itoa)
|
---|
310 | #define _lldiv CRTWRAP(_lldiv)
|
---|
311 | #define _lltoa CRTWRAP(_lltoa)
|
---|
312 | #define _ltoa CRTWRAP(_ltoa)
|
---|
313 | #define _makepath CRTWRAP(_makepath)
|
---|
314 | #define _path CRTWRAP(_path)
|
---|
315 | #define _read_kbd CRTWRAP(_read_kbd)
|
---|
316 | #define _remext CRTWRAP(_remext)
|
---|
317 | #define _rfnlwr CRTWRAP(_rfnlwr)
|
---|
318 | #define _response CRTWRAP(_response)
|
---|
319 | #define _scrsize CRTWRAP(_scrsize)
|
---|
320 | #define _searchenv CRTWRAP(_searchenv)
|
---|
321 | #define _setsyserrno CRTWRAP(_setsyserrno)
|
---|
322 | #define _sfnlwr CRTWRAP(_sfnlwr)
|
---|
323 | #define _sleep2 CRTWRAP(_sleep2)
|
---|
324 | #define _splitargs CRTWRAP(_splitargs)
|
---|
325 | #define _splitpath CRTWRAP(_splitpath)
|
---|
326 | #define _strtof CRTWRAP(_strtof)
|
---|
327 | #define _strtold CRTWRAP(_strtold)
|
---|
328 | #define _strtoll CRTWRAP(_strtoll)
|
---|
329 | #define _strtoull CRTWRAP(_strtoull)
|
---|
330 | #define _swchar CRTWRAP(_swchar)
|
---|
331 | #define _syserrno CRTWRAP(_syserrno)
|
---|
332 | #define _uldiv CRTWRAP(_uldiv)
|
---|
333 | #define _ulldiv CRTWRAP(_ulldiv)
|
---|
334 | #define _ulltoa CRTWRAP(_ulltoa)
|
---|
335 | #define _ultoa CRTWRAP(_ultoa)
|
---|
336 | #define _wildcard CRTWRAP(_wildcard)
|
---|
337 |
|
---|
338 | int _abspath (char *, __const__ char *, int);
|
---|
339 | long long _atoll (__const__ char *);
|
---|
340 | long double _atofl (__const__ char *);
|
---|
341 | int _chdir2 (__const__ char *);
|
---|
342 | int _chdrive (char);
|
---|
343 | int _core (int);
|
---|
344 | void _defext (char *, __const__ char *);
|
---|
345 | void _envargs (int *, char ***, __const__ char *);
|
---|
346 | int _execname (char *, size_t);
|
---|
347 | void _exit (int) __attribute__ ((__noreturn__));
|
---|
348 | int _filesys (__const__ char *, char *, size_t);
|
---|
349 | int _fncmp (__const__ unsigned char *, __const__ unsigned char *);
|
---|
350 | char **_fnexplode (__const__ char *);
|
---|
351 | void _fnexplodefree (char **);
|
---|
352 | char _fngetdrive (__const__ char *);
|
---|
353 | int _fnisabs (__const__ char *);
|
---|
354 | int _fnisrel (__const__ char *);
|
---|
355 | void _fnlwr (char *);
|
---|
356 | void _fnlwr2 (char *, __const__ char *);
|
---|
357 | char *_fnslashify (char *);
|
---|
358 | int _fullpath (char *, __const__ char *, int);
|
---|
359 | int _getcwd1 (char *, char);
|
---|
360 | char *_getcwd2 (char *, int);
|
---|
361 | char _getdrive (void);
|
---|
362 | char *_getext (__const__ char *);
|
---|
363 | char *_getext2 (__const__ char *);
|
---|
364 | char *_getname (__const__ char *);
|
---|
365 | int _getsockhandle (int);
|
---|
366 | int _gettid (void);
|
---|
367 | char *_getvol (char);
|
---|
368 | char *_itoa (int, char *, int);
|
---|
369 | _lldiv_t _lldiv (long long, long long);
|
---|
370 | char *_lltoa (long long, char *, int);
|
---|
371 | char *_ltoa (long, char *, int);
|
---|
372 | void _makepath (char *, __const__ char *, __const__ char *,
|
---|
373 | __const__ char *, __const__ char *);
|
---|
374 | int _path (char *, __const__ char *);
|
---|
375 | int _read_kbd (int, int, int);
|
---|
376 | void _remext (char *);
|
---|
377 | void _rfnlwr (void);
|
---|
378 | void _response (int *, char ***);
|
---|
379 | void _scrsize (int *);
|
---|
380 | void _searchenv (__const__ char *, __const__ char *, char *);
|
---|
381 | int _setsyserrno (int);
|
---|
382 | void _sfnlwr (__const__ char *);
|
---|
383 | unsigned _sleep2 (unsigned);
|
---|
384 | char ** _splitargs (char *, int *);
|
---|
385 | void _splitpath (__const__ char *, char *, char *, char *, char *);
|
---|
386 | float _strtof (__const__ char *, char **);
|
---|
387 | long double _strtold (__const__ char *, char **);
|
---|
388 | long long _strtoll (__const__ char *, char **, int);
|
---|
389 | unsigned long long _strtoull (__const__ char *, char **, int);
|
---|
390 | char _swchar (void);
|
---|
391 | int _syserrno (void);
|
---|
392 | _uldiv_t _uldiv (unsigned long, unsigned long);
|
---|
393 | _ulldiv_t _ulldiv (unsigned long long, unsigned long long);
|
---|
394 | char *_ulltoa (unsigned long long, char *, int);
|
---|
395 | char *_ultoa (unsigned long, char *, int);
|
---|
396 | void _wildcard (int *, char ***);
|
---|
397 |
|
---|
398 | #if defined (__MT__)
|
---|
399 | /* Prefix it to prevent using ;) */
|
---|
400 | int _emx_beginthread (void (*)(void *), void *, unsigned, void *);
|
---|
401 | void _emx_endthread (void);
|
---|
402 | void **_emx_threadstore (void);
|
---|
403 | #endif
|
---|
404 |
|
---|
405 | #endif
|
---|
406 |
|
---|
407 |
|
---|
408 | #if defined (__cplusplus)
|
---|
409 | }
|
---|
410 | #endif
|
---|
411 |
|
---|
412 | #include <malloc.h>
|
---|
413 |
|
---|
414 | #endif /* not _STDLIB_H */
|
---|