Add a generic scalb implementation
[glibc.git] / include / stdlib.h
blob1fab78aa16c3bd9b0b8f9403f8e40501e24cfdd9
1 #ifndef _STDLIB_H
3 #ifndef _ISOMAC
4 # include <stddef.h>
5 #endif
6 #include <stdlib/stdlib.h>
8 /* Now define the internal interfaces. */
9 #if !defined _ISOMAC
10 # include <sys/stat.h>
12 extern __typeof (strtol_l) __strtol_l;
13 extern __typeof (strtoul_l) __strtoul_l;
14 extern __typeof (strtoll_l) __strtoll_l;
15 extern __typeof (strtoull_l) __strtoull_l;
16 extern __typeof (strtod_l) __strtod_l;
17 extern __typeof (strtof_l) __strtof_l;
18 extern __typeof (strtold_l) __strtold_l;
19 libc_hidden_proto (__strtol_l)
20 libc_hidden_proto (__strtoul_l)
21 libc_hidden_proto (__strtoll_l)
22 libc_hidden_proto (__strtoull_l)
23 libc_hidden_proto (__strtod_l)
24 libc_hidden_proto (__strtof_l)
25 libc_hidden_proto (__strtold_l)
27 libc_hidden_proto (exit)
28 libc_hidden_proto (abort)
29 libc_hidden_proto (getenv)
30 extern __typeof (secure_getenv) __libc_secure_getenv;
31 libc_hidden_proto (__libc_secure_getenv)
32 libc_hidden_proto (bsearch)
33 libc_hidden_proto (qsort)
34 extern __typeof (qsort_r) __qsort_r;
35 libc_hidden_proto (__qsort_r)
36 libc_hidden_proto (lrand48_r)
37 libc_hidden_proto (wctomb)
39 extern long int __random (void) attribute_hidden;
40 extern void __srandom (unsigned int __seed);
41 extern char *__initstate (unsigned int __seed, char *__statebuf,
42 size_t __statelen);
43 extern char *__setstate (char *__statebuf);
44 extern int __random_r (struct random_data *__buf, int32_t *__result)
45 attribute_hidden;
46 extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
47 attribute_hidden;
48 extern int __initstate_r (unsigned int __seed, char *__statebuf,
49 size_t __statelen, struct random_data *__buf)
50 attribute_hidden;
51 extern int __setstate_r (char *__statebuf, struct random_data *__buf)
52 attribute_hidden;
53 extern int __rand_r (unsigned int *__seed);
54 extern int __erand48_r (unsigned short int __xsubi[3],
55 struct drand48_data *__buffer, double *__result)
56 attribute_hidden;
57 extern int __nrand48_r (unsigned short int __xsubi[3],
58 struct drand48_data *__buffer,
59 long int *__result) attribute_hidden;
60 extern int __jrand48_r (unsigned short int __xsubi[3],
61 struct drand48_data *__buffer,
62 long int *__result) attribute_hidden;
63 extern int __srand48_r (long int __seedval,
64 struct drand48_data *__buffer) attribute_hidden;
65 extern int __seed48_r (unsigned short int __seed16v[3],
66 struct drand48_data *__buffer) attribute_hidden;
67 extern int __lcong48_r (unsigned short int __param[7],
68 struct drand48_data *__buffer) attribute_hidden;
70 /* Internal function to compute next state of the generator. */
71 extern int __drand48_iterate (unsigned short int __xsubi[3],
72 struct drand48_data *__buffer)
73 attribute_hidden;
75 /* Global state for non-reentrant functions. Defined in drand48-iter.c. */
76 extern struct drand48_data __libc_drand48_data attribute_hidden;
78 extern int __setenv (const char *__name, const char *__value, int __replace)
79 attribute_hidden;
80 extern int __unsetenv (const char *__name) attribute_hidden;
81 extern int __clearenv (void) attribute_hidden;
82 extern char *__mktemp (char *__template) __THROW __nonnull ((1));
83 extern char *__canonicalize_file_name (const char *__name);
84 extern char *__realpath (const char *__name, char *__resolved);
85 libc_hidden_proto (__realpath)
86 extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
87 attribute_hidden;
88 # ifndef _ISOMAC
89 extern int __ptsname_internal (int fd, char *buf, size_t buflen,
90 struct stat64 *stp) attribute_hidden;
91 # endif
92 extern int __getpt (void);
93 extern int __posix_openpt (int __oflag) attribute_hidden;
95 extern int __add_to_environ (const char *name, const char *value,
96 const char *combines, int replace)
97 attribute_hidden;
98 extern void _quicksort (void *const pbase, size_t total_elems,
99 size_t size, __compar_d_fn_t cmp, void *arg);
101 extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
103 extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
104 libc_hidden_proto (__cxa_atexit);
106 extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
107 void *d);
108 extern void __call_tls_dtors (void)
109 #ifndef SHARED
110 __attribute__ ((weak))
111 #endif
113 libc_hidden_proto (__call_tls_dtors)
115 extern void __cxa_finalize (void *d);
117 extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
119 extern void *__libc_memalign (size_t alignment, size_t size)
120 __attribute_malloc__;
122 extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
123 __THROW __attribute_warn_unused_result__;
124 libc_hidden_proto (__libc_reallocarray)
126 extern int __libc_system (const char *line);
129 extern double __strtod_internal (const char *__restrict __nptr,
130 char **__restrict __endptr, int __group)
131 __THROW __nonnull ((1)) __wur;
132 extern float __strtof_internal (const char *__restrict __nptr,
133 char **__restrict __endptr, int __group)
134 __THROW __nonnull ((1)) __wur;
135 extern long double __strtold_internal (const char *__restrict __nptr,
136 char **__restrict __endptr,
137 int __group)
138 __THROW __nonnull ((1)) __wur;
139 extern long int __strtol_internal (const char *__restrict __nptr,
140 char **__restrict __endptr,
141 int __base, int __group)
142 __THROW __nonnull ((1)) __wur;
143 extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
144 char **__restrict __endptr,
145 int __base, int __group)
146 __THROW __nonnull ((1)) __wur;
147 __extension__
148 extern long long int __strtoll_internal (const char *__restrict __nptr,
149 char **__restrict __endptr,
150 int __base, int __group)
151 __THROW __nonnull ((1)) __wur;
152 __extension__
153 extern unsigned long long int __strtoull_internal (const char *
154 __restrict __nptr,
155 char **__restrict __endptr,
156 int __base, int __group)
157 __THROW __nonnull ((1)) __wur;
158 libc_hidden_proto (__strtof_internal)
159 libc_hidden_proto (__strtod_internal)
160 libc_hidden_proto (__strtold_internal)
161 libc_hidden_proto (__strtol_internal)
162 libc_hidden_proto (__strtoll_internal)
163 libc_hidden_proto (__strtoul_internal)
164 libc_hidden_proto (__strtoull_internal)
166 extern double ____strtod_l_internal (const char *__restrict __nptr,
167 char **__restrict __endptr, int __group,
168 locale_t __loc);
169 extern float ____strtof_l_internal (const char *__restrict __nptr,
170 char **__restrict __endptr, int __group,
171 locale_t __loc);
172 extern long double ____strtold_l_internal (const char *__restrict __nptr,
173 char **__restrict __endptr,
174 int __group, locale_t __loc);
175 extern long int ____strtol_l_internal (const char *__restrict __nptr,
176 char **__restrict __endptr,
177 int __base, int __group,
178 locale_t __loc);
179 extern unsigned long int ____strtoul_l_internal (const char *
180 __restrict __nptr,
181 char **__restrict __endptr,
182 int __base, int __group,
183 locale_t __loc);
184 __extension__
185 extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
186 char **__restrict __endptr,
187 int __base, int __group,
188 locale_t __loc);
189 __extension__
190 extern unsigned long long int ____strtoull_l_internal (const char *
191 __restrict __nptr,
192 char **
193 __restrict __endptr,
194 int __base, int __group,
195 locale_t __loc);
197 libc_hidden_proto (____strtof_l_internal)
198 libc_hidden_proto (____strtod_l_internal)
199 libc_hidden_proto (____strtold_l_internal)
200 libc_hidden_proto (____strtol_l_internal)
201 libc_hidden_proto (____strtoll_l_internal)
202 libc_hidden_proto (____strtoul_l_internal)
203 libc_hidden_proto (____strtoull_l_internal)
205 #include <bits/floatn.h>
206 libc_hidden_proto (strtof)
207 libc_hidden_proto (strtod)
208 #if __LONG_DOUBLE_USES_FLOAT128 == 0
209 libc_hidden_proto (strtold)
210 #endif
211 libc_hidden_proto (strtol)
212 libc_hidden_proto (strtoll)
213 libc_hidden_proto (strtoul)
214 libc_hidden_proto (strtoull)
216 libc_hidden_proto (atoi)
218 extern float __strtof_nan (const char *, char **, char);
219 extern double __strtod_nan (const char *, char **, char);
220 extern long double __strtold_nan (const char *, char **, char);
221 extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t);
222 extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t);
223 extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t);
225 libc_hidden_proto (__strtof_nan)
226 libc_hidden_proto (__strtod_nan)
227 libc_hidden_proto (__strtold_nan)
228 libc_hidden_proto (__wcstof_nan)
229 libc_hidden_proto (__wcstod_nan)
230 libc_hidden_proto (__wcstold_nan)
232 /* Enable _FloatN bits as needed. */
233 #include <bits/floatn.h>
235 #if __HAVE_DISTINCT_FLOAT128
236 extern __typeof (strtof128_l) __strtof128_l;
238 libc_hidden_proto (__strtof128_l)
239 libc_hidden_proto (strtof128)
241 extern _Float128 __strtof128_nan (const char *, char **, char);
242 extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t);
244 libc_hidden_proto (__strtof128_nan)
245 libc_hidden_proto (__wcstof128_nan)
247 extern _Float128 __strtof128_internal (const char *__restrict __nptr,
248 char **__restrict __endptr,
249 int __group);
250 libc_hidden_proto (__strtof128_internal)
252 extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
253 char **__restrict __endptr,
254 int __group, locale_t __loc);
256 libc_hidden_proto (____strtof128_l_internal)
257 #endif
259 extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
260 int *__restrict __sign);
261 extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
262 int *__restrict __sign);
263 extern char *__gcvt (double __value, int __ndigit, char *__buf);
264 extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
265 int *__restrict __sign, char *__restrict __buf,
266 size_t __len);
267 libc_hidden_proto (__ecvt_r)
268 extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
269 int *__restrict __sign, char *__restrict __buf,
270 size_t __len);
271 libc_hidden_proto (__fcvt_r)
272 extern char *__qecvt (long double __value, int __ndigit,
273 int *__restrict __decpt, int *__restrict __sign);
274 extern char *__qfcvt (long double __value, int __ndigit,
275 int *__restrict __decpt, int *__restrict __sign);
276 extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
277 extern int __qecvt_r (long double __value, int __ndigit,
278 int *__restrict __decpt, int *__restrict __sign,
279 char *__restrict __buf, size_t __len);
280 libc_hidden_proto (__qecvt_r)
281 extern int __qfcvt_r (long double __value, int __ndigit,
282 int *__restrict __decpt, int *__restrict __sign,
283 char *__restrict __buf, size_t __len);
284 libc_hidden_proto (__qfcvt_r)
286 # if IS_IN (libc)
287 # undef MB_CUR_MAX
288 # define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
289 # endif
291 extern void *__default_morecore (ptrdiff_t) __THROW;
292 libc_hidden_proto (__default_morecore)
294 struct abort_msg_s
296 unsigned int size;
297 char msg[0];
299 extern struct abort_msg_s *__abort_msg;
300 libc_hidden_proto (__abort_msg)
302 # if IS_IN (rtld) && !defined NO_RTLD_HIDDEN
303 extern __typeof (unsetenv) unsetenv attribute_hidden;
304 extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
305 # endif
307 #endif
309 #endif /* include/stdlib.h */