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