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