Rev 4874 | Rev 6099 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
4349 | Serge | 1 | /* |
2 | * stdlib.h |
||
3 | * |
||
4 | * Definitions for common types, variables, and functions. |
||
5 | */ |
||
6 | |||
7 | #ifndef _STDLIB_H_ |
||
8 | #define _STDLIB_H_ |
||
9 | |||
10 | #include |
||
11 | #include "_ansi.h" |
||
12 | |||
13 | #define __need_size_t |
||
14 | #define __need_wchar_t |
||
4921 | Serge | 15 | #define __need_NULL |
4349 | Serge | 16 | #include |
17 | |||
18 | #include |
||
19 | #include |
||
20 | #ifndef __STRICT_ANSI__ |
||
21 | #include |
||
22 | #endif |
||
23 | |||
24 | #ifdef __CYGWIN__ |
||
25 | #include |
||
26 | #endif |
||
27 | |||
28 | _BEGIN_STD_C |
||
29 | |||
30 | typedef struct |
||
31 | { |
||
32 | int quot; /* quotient */ |
||
33 | int rem; /* remainder */ |
||
34 | } div_t; |
||
35 | |||
36 | typedef struct |
||
37 | { |
||
38 | long quot; /* quotient */ |
||
39 | long rem; /* remainder */ |
||
40 | } ldiv_t; |
||
41 | |||
4921 | Serge | 42 | #if !defined(__STRICT_ANSI__) || \ |
43 | (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || \ |
||
44 | (defined(__cplusplus) && __cplusplus >= 201103L) |
||
4349 | Serge | 45 | typedef struct |
46 | { |
||
47 | long long int quot; /* quotient */ |
||
48 | long long int rem; /* remainder */ |
||
49 | } lldiv_t; |
||
50 | #endif |
||
51 | |||
4921 | Serge | 52 | #ifndef __compar_fn_t_defined |
53 | #define __compar_fn_t_defined |
||
54 | typedef int (*__compar_fn_t) (const _PTR, const _PTR); |
||
4349 | Serge | 55 | #endif |
56 | |||
57 | #define EXIT_FAILURE 1 |
||
58 | #define EXIT_SUCCESS 0 |
||
59 | |||
60 | #define RAND_MAX __RAND_MAX |
||
61 | |||
62 | int _EXFUN(__locale_mb_cur_max,(_VOID)); |
||
63 | |||
64 | #define MB_CUR_MAX __locale_mb_cur_max() |
||
65 | |||
66 | _VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((noreturn))); |
||
67 | int _EXFUN(abs,(int)); |
||
68 | int _EXFUN(atexit,(_VOID (*__func)(_VOID))); |
||
69 | double _EXFUN(atof,(const char *__nptr)); |
||
70 | #ifndef __STRICT_ANSI__ |
||
71 | float _EXFUN(atoff,(const char *__nptr)); |
||
72 | #endif |
||
73 | int _EXFUN(atoi,(const char *__nptr)); |
||
74 | int _EXFUN(_atoi_r,(struct _reent *, const char *__nptr)); |
||
75 | long _EXFUN(atol,(const char *__nptr)); |
||
76 | long _EXFUN(_atol_r,(struct _reent *, const char *__nptr)); |
||
77 | _PTR _EXFUN(bsearch,(const _PTR __key, |
||
78 | const _PTR __base, |
||
79 | size_t __nmemb, |
||
80 | size_t __size, |
||
4921 | Serge | 81 | __compar_fn_t _compar)); |
4349 | Serge | 82 | _PTR _EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size)); |
83 | div_t _EXFUN(div,(int __numer, int __denom)); |
||
84 | _VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((noreturn))); |
||
85 | _VOID _EXFUN_NOTHROW(free,(_PTR)); |
||
86 | char * _EXFUN(getenv,(const char *__string)); |
||
87 | char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); |
||
88 | char * _EXFUN(_findenv,(_CONST char *, int *)); |
||
89 | char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *)); |
||
90 | #ifndef __STRICT_ANSI__ |
||
91 | extern char *suboptarg; /* getsubopt(3) external variable */ |
||
92 | int _EXFUN(getsubopt,(char **, char * const *, char **)); |
||
93 | #endif |
||
94 | long _EXFUN(labs,(long)); |
||
95 | ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); |
||
96 | _PTR _EXFUN_NOTHROW(malloc,(size_t __size)); |
||
97 | int _EXFUN(mblen,(const char *, size_t)); |
||
98 | int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *)); |
||
4921 | Serge | 99 | int _EXFUN(mbtowc,(wchar_t *__restrict, const char *__restrict, size_t)); |
100 | int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *)); |
||
4349 | Serge | 101 | int _EXFUN(wctomb,(char *, wchar_t)); |
102 | int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, _mbstate_t *)); |
||
4921 | Serge | 103 | size_t _EXFUN(mbstowcs,(wchar_t *__restrict, const char *__restrict, size_t)); |
104 | size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *)); |
||
105 | size_t _EXFUN(wcstombs,(char *__restrict, const wchar_t *__restrict, size_t)); |
||
106 | size_t _EXFUN(_wcstombs_r,(struct _reent *, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *)); |
||
4349 | Serge | 107 | #ifndef __STRICT_ANSI__ |
108 | #ifndef _REENT_ONLY |
||
109 | char * _EXFUN(mkdtemp,(char *)); |
||
110 | int _EXFUN(mkostemp,(char *, int)); |
||
111 | int _EXFUN(mkostemps,(char *, int, int)); |
||
112 | int _EXFUN(mkstemp,(char *)); |
||
113 | int _EXFUN(mkstemps,(char *, int)); |
||
114 | char * _EXFUN(mktemp,(char *) _ATTRIBUTE ((__warning__ ("the use of `mktemp' is dangerous; use `mkstemp' instead")))); |
||
115 | #endif |
||
116 | char * _EXFUN(_mkdtemp_r, (struct _reent *, char *)); |
||
117 | int _EXFUN(_mkostemp_r, (struct _reent *, char *, int)); |
||
118 | int _EXFUN(_mkostemps_r, (struct _reent *, char *, int, int)); |
||
119 | int _EXFUN(_mkstemp_r, (struct _reent *, char *)); |
||
120 | int _EXFUN(_mkstemps_r, (struct _reent *, char *, int)); |
||
121 | char * _EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((__warning__ ("the use of `mktemp' is dangerous; use `mkstemp' instead")))); |
||
122 | #endif |
||
4921 | Serge | 123 | _VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, __compar_fn_t _compar)); |
4349 | Serge | 124 | int _EXFUN(rand,(_VOID)); |
125 | _PTR _EXFUN_NOTHROW(realloc,(_PTR __r, size_t __size)); |
||
126 | #ifndef __STRICT_ANSI__ |
||
127 | _PTR _EXFUN(reallocf,(_PTR __r, size_t __size)); |
||
4921 | Serge | 128 | char * _EXFUN(realpath, (const char *__restrict path, char *__restrict resolved_path)); |
4349 | Serge | 129 | #endif |
130 | _VOID _EXFUN(srand,(unsigned __seed)); |
||
4921 | Serge | 131 | double _EXFUN(strtod,(const char *__restrict __n, char **__restrict __end_PTR)); |
132 | double _EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR)); |
||
133 | #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) |
||
134 | float _EXFUN(strtof,(const char *__restrict __n, char **__restrict __end_PTR)); |
||
135 | #endif |
||
4349 | Serge | 136 | #ifndef __STRICT_ANSI__ |
137 | /* the following strtodf interface is deprecated...use strtof instead */ |
||
138 | # ifndef strtodf |
||
139 | # define strtodf strtof |
||
140 | # endif |
||
141 | #endif |
||
4921 | Serge | 142 | long _EXFUN(strtol,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
143 | long _EXFUN(_strtol_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
||
144 | unsigned long _EXFUN(strtoul,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
||
145 | unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
||
4349 | Serge | 146 | |
147 | int _EXFUN(system,(const char *__string)); |
||
148 | |||
149 | #ifndef __STRICT_ANSI__ |
||
150 | long _EXFUN(a64l,(const char *__input)); |
||
151 | char * _EXFUN(l64a,(long __input)); |
||
152 | char * _EXFUN(_l64a_r,(struct _reent *,long __input)); |
||
153 | int _EXFUN(on_exit,(_VOID (*__func)(int, _PTR),_PTR __arg)); |
||
154 | _VOID _EXFUN(_Exit,(int __status) _ATTRIBUTE ((noreturn))); |
||
155 | int _EXFUN(putenv,(char *__string)); |
||
156 | int _EXFUN(_putenv_r,(struct _reent *, char *__string)); |
||
157 | _PTR _EXFUN(_reallocf_r,(struct _reent *, _PTR, size_t)); |
||
158 | int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite)); |
||
159 | int _EXFUN(_setenv_r,(struct _reent *, const char *__string, const char *__value, int __overwrite)); |
||
160 | |||
161 | char * _EXFUN(gcvt,(double,int,char *)); |
||
162 | char * _EXFUN(gcvtf,(float,int,char *)); |
||
163 | char * _EXFUN(fcvt,(double,int,int *,int *)); |
||
164 | char * _EXFUN(fcvtf,(float,int,int *,int *)); |
||
165 | char * _EXFUN(ecvt,(double,int,int *,int *)); |
||
166 | char * _EXFUN(ecvtbuf,(double, int, int*, int*, char *)); |
||
167 | char * _EXFUN(fcvtbuf,(double, int, int*, int*, char *)); |
||
168 | char * _EXFUN(ecvtf,(float,int,int *,int *)); |
||
169 | char * _EXFUN(dtoa,(double, int, int, int *, int*, char**)); |
||
170 | int _EXFUN(rand_r,(unsigned *__seed)); |
||
171 | |||
172 | double _EXFUN(drand48,(_VOID)); |
||
173 | double _EXFUN(_drand48_r,(struct _reent *)); |
||
174 | double _EXFUN(erand48,(unsigned short [3])); |
||
175 | double _EXFUN(_erand48_r,(struct _reent *, unsigned short [3])); |
||
176 | long _EXFUN(jrand48,(unsigned short [3])); |
||
177 | long _EXFUN(_jrand48_r,(struct _reent *, unsigned short [3])); |
||
178 | _VOID _EXFUN(lcong48,(unsigned short [7])); |
||
179 | _VOID _EXFUN(_lcong48_r,(struct _reent *, unsigned short [7])); |
||
180 | long _EXFUN(lrand48,(_VOID)); |
||
181 | long _EXFUN(_lrand48_r,(struct _reent *)); |
||
182 | long _EXFUN(mrand48,(_VOID)); |
||
183 | long _EXFUN(_mrand48_r,(struct _reent *)); |
||
184 | long _EXFUN(nrand48,(unsigned short [3])); |
||
185 | long _EXFUN(_nrand48_r,(struct _reent *, unsigned short [3])); |
||
186 | unsigned short * |
||
187 | _EXFUN(seed48,(unsigned short [3])); |
||
188 | unsigned short * |
||
189 | _EXFUN(_seed48_r,(struct _reent *, unsigned short [3])); |
||
190 | _VOID _EXFUN(srand48,(long)); |
||
191 | _VOID _EXFUN(_srand48_r,(struct _reent *, long)); |
||
192 | long long _EXFUN(atoll,(const char *__nptr)); |
||
193 | long long _EXFUN(_atoll_r,(struct _reent *, const char *__nptr)); |
||
194 | long long _EXFUN(llabs,(long long)); |
||
195 | lldiv_t _EXFUN(lldiv,(long long __numer, long long __denom)); |
||
4921 | Serge | 196 | #endif /* ! __STRICT_ANSI__ */ |
197 | #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) |
||
198 | long long _EXFUN(strtoll,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
||
199 | #endif |
||
200 | #ifndef __STRICT_ANSI__ |
||
201 | long long _EXFUN(_strtoll_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
||
202 | #endif /* ! __STRICT_ANSI__ */ |
||
203 | #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) |
||
204 | unsigned long long _EXFUN(strtoull,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
||
205 | #endif |
||
206 | #ifndef __STRICT_ANSI__ |
||
207 | unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base)); |
||
4349 | Serge | 208 | |
209 | #ifndef __CYGWIN__ |
||
210 | _VOID _EXFUN(cfree,(_PTR)); |
||
211 | int _EXFUN(unsetenv,(const char *__string)); |
||
212 | int _EXFUN(_unsetenv_r,(struct _reent *, const char *__string)); |
||
213 | #endif |
||
214 | |||
215 | #ifdef __rtems__ |
||
216 | int _EXFUN(posix_memalign,(void **, size_t, size_t)); |
||
217 | #endif |
||
218 | |||
219 | #endif /* ! __STRICT_ANSI__ */ |
||
220 | |||
221 | char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); |
||
222 | #ifndef __CYGWIN__ |
||
223 | _PTR _EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t)); |
||
224 | _PTR _EXFUN_NOTHROW(_calloc_r,(struct _reent *, size_t, size_t)); |
||
225 | _VOID _EXFUN_NOTHROW(_free_r,(struct _reent *, _PTR)); |
||
226 | _PTR _EXFUN_NOTHROW(_realloc_r,(struct _reent *, _PTR, size_t)); |
||
227 | _VOID _EXFUN(_mstats_r,(struct _reent *, char *)); |
||
228 | #endif |
||
229 | int _EXFUN(_system_r,(struct _reent *, const char *)); |
||
230 | |||
231 | _VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); |
||
232 | |||
233 | /* On platforms where long double equals double. */ |
||
234 | #ifdef _LDBL_EQ_DBL |
||
4921 | Serge | 235 | #if !defined(__STRICT_ANSI__) || (__STDC_VERSION__ >= 199901L) || (__cplusplus >= 201103L) |
236 | extern long double strtold (const char *__restrict, char **__restrict); |
||
237 | #endif |
||
4349 | Serge | 238 | #endif /* _LDBL_EQ_DBL */ |
239 | |||
240 | _END_STD_C |
||
241 | |||
242 | #endif /* _STDLIB_H_ */ |