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