add significand[fl] math functions
[musl] / include / stdlib.h
1 #ifndef _STDLIB_H
2 #define _STDLIB_H
3
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7
8 #undef NULL
9 #ifdef __cplusplus
10 #define NULL 0
11 #else
12 #define NULL ((void*)0)
13 #endif
14
15 #define __NEED_size_t
16 #define __NEED_wchar_t
17
18 #include <bits/alltypes.h>
19
20 int atoi (const char *);
21 long atol (const char *);
22 long long atoll (const char *);
23 double atof (const char *);
24
25 float strtof (const char *, char **);
26 double strtod (const char *, char **);
27 long double strtold (const char *, char **);
28
29 long strtol (const char *, char **, int);
30 unsigned long strtoul (const char *, char **, int);
31 long long strtoll (const char *, char **, int);
32 unsigned long long strtoull (const char *, char **, int);
33
34 int rand (void);
35 void srand (unsigned);
36
37 void *malloc (size_t);
38 void *calloc (size_t, size_t);
39 void *realloc (void *, size_t);
40 void free (void *);
41
42 void abort (void);
43 int atexit (void (*) (void));
44 void exit (int);
45 void _Exit (int);
46
47 char *getenv (const char *);
48
49 int system (const char *);
50
51 void *bsearch (const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
52 void qsort (void *, size_t, size_t, int (*)(const void *, const void *));
53
54 int abs (int);
55 long labs (long);
56 long long llabs (long long);
57
58 typedef struct { int quot, rem; } div_t;
59 typedef struct { long quot, rem; } ldiv_t;
60 typedef struct { long long quot, rem; } lldiv_t;
61
62 div_t div (int, int);
63 ldiv_t ldiv (long, long);
64 lldiv_t lldiv (long long, long long);
65
66 int mblen (const char *, size_t);
67 int mbtowc (wchar_t *, const char *, size_t);
68 int wctomb (char *, wchar_t);
69 size_t mbstowcs (wchar_t *, const char *, size_t);
70 size_t wcstombs (char *, const wchar_t *, size_t);
71
72 #define EXIT_FAILURE 1
73 #define EXIT_SUCCESS 0
74
75 #define MB_CUR_MAX ((size_t)+4)
76
77 #define RAND_MAX (0x7fffffff)
78
79
80 #if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
81  || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
82  || defined(_BSD_SOURCE)
83
84 #ifndef WEXITSTATUS
85 #define WEXITSTATUS(s) (((s) & 0xff00) >> 8)
86 #define WTERMSIG(s) ((s) & 0x7f)
87 #define WSTOPSIG(s) WEXITSTATUS(s)
88 #define WCOREDUMP(s) ((s) & 0x80)
89 #define WIFEXITED(s) (!WTERMSIG(s))
90 #define WIFSTOPPED(s) (((s) & 0xff) == 0x7f)
91 #define WIFSIGNALED(s) (((signed char) (((s) & 0x7f) + 1) >> 1) > 0)
92 #define WIFCONTINUED(s) ((s) == 0xffff)
93 #endif
94
95 int posix_memalign (void **, size_t, size_t);
96 int setenv (const char *, const char *, int);
97 int unsetenv (const char *);
98 int mkstemp (char *);
99 char *mkdtemp (char *);
100 int getsubopt (char **, char *const *, char **);
101 int rand_r (unsigned *);
102
103 #endif
104
105
106 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE) \
107  || defined(_BSD_SOURCE)
108 char *realpath (const char *, char *);
109 long int random (void);
110 void srandom (unsigned int);
111 char *initstate (unsigned int, char *, size_t);
112 char *setstate (char *);
113 #endif
114
115 #if defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
116 int putenv (char *);
117 int posix_openpt (int);
118 int grantpt (int);
119 int unlockpt (int);
120 char *ptsname (int);
121 char *l64a (long);
122 long a64l (const char *);
123 void setkey (const char *);
124 double drand48 (void);
125 double erand48 (unsigned short [3]);
126 long int lrand48 (void);
127 long int nrand48 (unsigned short [3]);
128 long mrand48 (void);
129 long jrand48 (unsigned short [3]);
130 void srand48 (long);
131 unsigned short *seed48 (unsigned short [3]);
132 void lcong48 (unsigned short [7]);
133 #endif
134
135 #if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
136 #include <alloca.h>
137 char *mktemp (char *);
138 void *valloc (size_t);
139 void *memalign(size_t, size_t);
140 #endif
141
142 #ifdef _GNU_SOURCE
143 int clearenv(void);
144 int ptsname_r(int, char *, size_t);
145 char *ecvt(double, int, int *, int *);
146 char *fcvt(double, int, int *, int *);
147 char *gcvt(double, int, char *);
148 #endif
149
150 #if defined(_LARGEFILE64_SOURCE) || defined(_GNU_SOURCE)
151 #define mkstemp64 mkstemp
152 #endif
153
154 #ifdef __cplusplus
155 }
156 #endif
157
158 #endif