source: trunk/include/emxruntime/stdlib.h@ 9969

Last change on this file since 9969 was 9969, checked in by sandervl, 22 years ago

PF: Added modified emx runtime headers + header updates

File size: 11.0 KB
Line 
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)
11extern "C" {
12#endif
13
14#if !defined (_SIZE_T)
15#define _SIZE_T
16typedef unsigned long size_t;
17#endif
18
19#if !defined (_WCHAR_T) && !defined (__cplusplus)
20#define _WCHAR_T
21typedef 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
34typedef struct _div_t
35{
36 int quot;
37 int rem;
38} div_t;
39typedef 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)
56extern 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
91void abort (void) __attribute__ ((__noreturn__));
92int atexit (void (*)(void));
93double atof (__const__ char *);
94int atoi (__const__ char *);
95long atol (__const__ char *);
96void *bsearch (__const__ void *, __const__ void *, size_t, size_t,
97 int (*)(__const__ void *, __const__ void *));
98div_t div (int, int);
99void exit (int) __attribute__ ((__noreturn__));
100char *getenv (__const__ char *);
101ldiv_t ldiv (long, long);
102int mblen (__const__ char *, size_t);
103size_t mbstowcs (wchar_t *, __const__ char *, size_t);
104int mbtowc (wchar_t *, __const__ char *, size_t);
105void qsort (void *, size_t, size_t,
106 int (*)(__const__ void *, __const__ void *));
107int rand (void);
108void srand (unsigned);
109double strtod (__const__ char *, char **);
110long strtol (__const__ char *, char **, int);
111unsigned long strtoul (__const__ char *, char **, int);
112int system (__const__ char *);
113size_t wcstombs (char *, __const__ wchar_t *, size_t);
114int 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
123extern int abs (int);
124extern long labs (long);
125#else
126extern __inline__ int abs (int _n) { return (_n < 0 ? -_n : _n); }
127extern __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
136float strtof (__const__ char *, char **);
137long 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__)
152extern int *__errno (void);
153#define errno (*emx__errno ())
154#else
155#define errno CRTWRAP(errno)
156extern int errno;
157#endif
158#endif
159
160#if !defined (_ULDIV_T)
161#define _ULDIV_T
162typedef struct
163{
164 unsigned long quot;
165 unsigned long rem;
166} _uldiv_t;
167typedef struct
168{
169 long long quot;
170 long long rem;
171} _lldiv_t;
172typedef struct
173{
174 unsigned long long quot;
175 unsigned long long rem;
176} _ulldiv_t;
177#endif
178
179extern char **environ;
180
181extern __const__ char * __const__ sys_errlist[];
182extern __const__ int sys_nerr;
183
184extern __const__ unsigned int _emx_vcmp;
185extern __const__ unsigned int _emx_env;
186extern __const__ unsigned int _emx_rev;
187extern __const__ unsigned char _osminor;
188extern __const__ unsigned char _osmajor;
189extern __const__ unsigned char _osmode;
190extern __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
209unsigned alarm (unsigned);
210void *brk (void *);
211int chdir (__const__ char *);
212char *gcvt (double, int, char *);
213char *getcwd (char *, size_t);
214int getpagesize (void);
215char *getwd (char *);
216int mkdir (__const__ char *, long);
217void perror (__const__ char *);
218int putenv (__const__ char *);
219int rmdir (__const__ char *);
220void *sbrk (int);
221unsigned sleep (unsigned);
222void swab (__const__ void *, void *, size_t);
223long 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
231int heapsort (void *, size_t, size_t,
232 int (*)(__const__ void *, __const__ void *)); /* BSD */
233char *initstate (unsigned, char *, int); /* BSD */
234long random (void); /* BSD */
235char *setstate (char *); /* BSD */
236void srandom (unsigned); /* BSD */
237
238#endif
239
240
241#if (!defined (__STRICT_ANSI__) && !defined (_POSIX_SOURCE)) \
242 || defined (_WITH_UNDERSCORE)
243
244extern char **_environ;
245extern __const__ char * __const__ _sys_errlist[];
246extern __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
264unsigned _alarm (unsigned);
265void *_brk (void *);
266int _chdir (__const__ char *);
267char *_gcvt (double, int, char *);
268char *_getcwd (char *, size_t);
269int _getpagesize (void);
270char *_getwd (char *);
271int _mkdir (__const__ char *, long);
272int _putenv (__const__ char *);
273int _rmdir (__const__ char *);
274void *_sbrk (int);
275unsigned _sleep (unsigned);
276void _swab (__const__ void *, void *, size_t);
277long _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
338int _abspath (char *, __const__ char *, int);
339long long _atoll (__const__ char *);
340long double _atofl (__const__ char *);
341int _chdir2 (__const__ char *);
342int _chdrive (char);
343int _core (int);
344void _defext (char *, __const__ char *);
345void _envargs (int *, char ***, __const__ char *);
346int _execname (char *, size_t);
347void _exit (int) __attribute__ ((__noreturn__));
348int _filesys (__const__ char *, char *, size_t);
349int _fncmp (__const__ unsigned char *, __const__ unsigned char *);
350char **_fnexplode (__const__ char *);
351void _fnexplodefree (char **);
352char _fngetdrive (__const__ char *);
353int _fnisabs (__const__ char *);
354int _fnisrel (__const__ char *);
355void _fnlwr (char *);
356void _fnlwr2 (char *, __const__ char *);
357char *_fnslashify (char *);
358int _fullpath (char *, __const__ char *, int);
359int _getcwd1 (char *, char);
360char *_getcwd2 (char *, int);
361char _getdrive (void);
362char *_getext (__const__ char *);
363char *_getext2 (__const__ char *);
364char *_getname (__const__ char *);
365int _getsockhandle (int);
366int _gettid (void);
367char *_getvol (char);
368char *_itoa (int, char *, int);
369_lldiv_t _lldiv (long long, long long);
370char *_lltoa (long long, char *, int);
371char *_ltoa (long, char *, int);
372void _makepath (char *, __const__ char *, __const__ char *,
373 __const__ char *, __const__ char *);
374int _path (char *, __const__ char *);
375int _read_kbd (int, int, int);
376void _remext (char *);
377void _rfnlwr (void);
378void _response (int *, char ***);
379void _scrsize (int *);
380void _searchenv (__const__ char *, __const__ char *, char *);
381int _setsyserrno (int);
382void _sfnlwr (__const__ char *);
383unsigned _sleep2 (unsigned);
384char ** _splitargs (char *, int *);
385void _splitpath (__const__ char *, char *, char *, char *, char *);
386float _strtof (__const__ char *, char **);
387long double _strtold (__const__ char *, char **);
388long long _strtoll (__const__ char *, char **, int);
389unsigned long long _strtoull (__const__ char *, char **, int);
390char _swchar (void);
391int _syserrno (void);
392_uldiv_t _uldiv (unsigned long, unsigned long);
393_ulldiv_t _ulldiv (unsigned long long, unsigned long long);
394char *_ulltoa (unsigned long long, char *, int);
395char *_ultoa (unsigned long, char *, int);
396void _wildcard (int *, char ***);
397
398#if defined (__MT__)
399/* Prefix it to prevent using ;) */
400int _emx_beginthread (void (*)(void *), void *, unsigned, void *);
401void _emx_endthread (void);
402void **_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 */
Note: See TracBrowser for help on using the repository browser.