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