comparison druntime/import/core/sys/posix/stdlib.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * D header file for POSIX.
3 *
4 * Copyright: Copyright Sean Kelly 2005 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Sean Kelly
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8 *
9 * Copyright Sean Kelly 2005 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 * (See accompanying file LICENSE_1_0.txt or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
13 */
14 module core.sys.posix.stdlib;
15
16 private import core.sys.posix.config;
17 public import core.stdc.stdlib;
18 public import core.sys.posix.sys.wait;
19
20 extern (C):
21
22 //
23 // Required (defined in core.stdc.stdlib)
24 //
25 /*
26 EXIT_FAILURE
27 EXIT_SUCCESS
28 NULL
29 RAND_MAX
30 MB_CUR_MAX
31 div_t
32 ldiv_t
33 lldiv_t
34 size_t
35 wchar_t
36
37 void _Exit(int);
38 void abort();
39 int abs(int);
40 int atexit(void function());
41 double atof(in char*);
42 int atoi(in char*);
43 c_long atol(in char*);
44 long atoll(in char*);
45 void* bsearch(in void*, in void*, size_t, size_t, int function(in void*, in void*));
46 void* calloc(size_t, size_t);
47 div_t div(int, int);
48 void exit(int);
49 void free(void*);
50 char* getenv(in char*);
51 c_long labs(c_long);
52 ldiv_t ldiv(c_long, c_long);
53 long llabs(long);
54 lldiv_t lldiv(long, long);
55 void* malloc(size_t);
56 int mblen(in char*, size_t);
57 size_t mbstowcs(wchar_t*, in char*, size_t);
58 int mbtowc(wchar_t*, in char*, size_t);
59 void qsort(void*, size_t, size_t, int function(in void*, in void*));
60 int rand();
61 void* realloc(void*, size_t);
62 void srand(uint);
63 double strtod(in char*, char**);
64 float strtof(in char*, char**);
65 c_long strtol(in char*, char**, int);
66 real strtold(in char*, char**);
67 long strtoll(in char*, char**, int);
68 c_ulong strtoul(in char*, char**, int);
69 ulong strtoull(in char*, char**, int);
70 int system(in char*);
71 size_t wcstombs(char*, in wchar_t*, size_t);
72 int wctomb(char*, wchar_t);
73 */
74
75 //
76 // Advisory Information (ADV)
77 //
78 /*
79 int posix_memalign(void**, size_t, size_t);
80 */
81
82 version( linux )
83 {
84 int posix_memalign(void**, size_t, size_t);
85 }
86
87 //
88 // C Extension (CX)
89 //
90 /*
91 int setenv(in char*, in char*, int);
92 int unsetenv(in char*);
93 */
94
95 version( linux )
96 {
97 int setenv(in char*, in char*, int);
98 int unsetenv(in char*);
99
100 void* valloc(size_t); // LEGACY non-standard
101 }
102 else version( OSX )
103 {
104 int setenv(in char*, in char*, int);
105 int unsetenv(in char*);
106
107 void* valloc(size_t); // LEGACY non-standard
108 }
109 else version( freebsd )
110 {
111 int setenv(in char*, in char*, int);
112 int unsetenv(in char*);
113
114 void* valloc(size_t); // LEGACY non-standard
115 }
116
117 //
118 // Thread-Safe Functions (TSF)
119 //
120 /*
121 int rand_r(uint*);
122 */
123
124 version( linux )
125 {
126 int rand_r(uint*);
127 }
128 else version( OSX )
129 {
130 int rand_r(uint*);
131 }
132 else version( freebsd )
133 {
134 int rand_r(uint*);
135 }
136
137 //
138 // XOpen (XSI)
139 //
140 /*
141 WNOHANG (defined in core.sys.posix.sys.wait)
142 WUNTRACED (defined in core.sys.posix.sys.wait)
143 WEXITSTATUS (defined in core.sys.posix.sys.wait)
144 WIFEXITED (defined in core.sys.posix.sys.wait)
145 WIFSIGNALED (defined in core.sys.posix.sys.wait)
146 WIFSTOPPED (defined in core.sys.posix.sys.wait)
147 WSTOPSIG (defined in core.sys.posix.sys.wait)
148 WTERMSIG (defined in core.sys.posix.sys.wait)
149
150 c_long a64l(in char*);
151 double drand48();
152 char* ecvt(double, int, int *, int *); // LEGACY
153 double erand48(ushort[3]);
154 char* fcvt(double, int, int *, int *); // LEGACY
155 char* gcvt(double, int, char*); // LEGACY
156 // per spec: int getsubopt(char** char* const*, char**);
157 int getsubopt(char**, in char**, char**);
158 int grantpt(int);
159 char* initstate(uint, char*, size_t);
160 c_long jrand48(ushort[3]);
161 char* l64a(c_long);
162 void lcong48(ushort[7]);
163 c_long lrand48();
164 char* mktemp(char*); // LEGACY
165 int mkstemp(char*);
166 c_long mrand48();
167 c_long nrand48(ushort[3]);
168 int posix_openpt(int);
169 char* ptsname(int);
170 int putenv(char*);
171 c_long random();
172 char* realpath(in char*, char*);
173 ushort seed48(ushort[3]);
174 void setkey(in char*);
175 char* setstate(in char*);
176 void srand48(c_long);
177 void srandom(uint);
178 int unlockpt(int);
179 */
180
181 version( linux )
182 {
183 //WNOHANG (defined in core.sys.posix.sys.wait)
184 //WUNTRACED (defined in core.sys.posix.sys.wait)
185 //WEXITSTATUS (defined in core.sys.posix.sys.wait)
186 //WIFEXITED (defined in core.sys.posix.sys.wait)
187 //WIFSIGNALED (defined in core.sys.posix.sys.wait)
188 //WIFSTOPPED (defined in core.sys.posix.sys.wait)
189 //WSTOPSIG (defined in core.sys.posix.sys.wait)
190 //WTERMSIG (defined in core.sys.posix.sys.wait)
191
192 c_long a64l(in char*);
193 double drand48();
194 char* ecvt(double, int, int *, int *); // LEGACY
195 double erand48(ushort[3]);
196 char* fcvt(double, int, int *, int *); // LEGACY
197 char* gcvt(double, int, char*); // LEGACY
198 int getsubopt(char**, in char**, char**);
199 int grantpt(int);
200 char* initstate(uint, char*, size_t);
201 c_long jrand48(ushort[3]);
202 char* l64a(c_long);
203 void lcong48(ushort[7]);
204 c_long lrand48();
205 char* mktemp(char*); // LEGACY
206 //int mkstemp(char*);
207 c_long mrand48();
208 c_long nrand48(ushort[3]);
209 int posix_openpt(int);
210 char* ptsname(int);
211 int putenv(char*);
212 c_long random();
213 char* realpath(in char*, char*);
214 ushort seed48(ushort[3]);
215 void setkey(in char*);
216 char* setstate(in char*);
217 void srand48(c_long);
218 void srandom(uint);
219 int unlockpt(int);
220
221 static if( __USE_LARGEFILE64 )
222 {
223 int mkstemp64(char*);
224 alias mkstemp64 mkstemp;
225 }
226 else
227 {
228 int mkstemp(char*);
229 }
230 }
231 else version( OSX )
232 {
233 //WNOHANG (defined in core.sys.posix.sys.wait)
234 //WUNTRACED (defined in core.sys.posix.sys.wait)
235 //WEXITSTATUS (defined in core.sys.posix.sys.wait)
236 //WIFEXITED (defined in core.sys.posix.sys.wait)
237 //WIFSIGNALED (defined in core.sys.posix.sys.wait)
238 //WIFSTOPPED (defined in core.sys.posix.sys.wait)
239 //WSTOPSIG (defined in core.sys.posix.sys.wait)
240 //WTERMSIG (defined in core.sys.posix.sys.wait)
241
242 c_long a64l(in char*);
243 double drand48();
244 char* ecvt(double, int, int *, int *); // LEGACY
245 double erand48(ushort[3]);
246 char* fcvt(double, int, int *, int *); // LEGACY
247 char* gcvt(double, int, char*); // LEGACY
248 int getsubopt(char**, in char**, char**);
249 int grantpt(int);
250 char* initstate(uint, char*, size_t);
251 c_long jrand48(ushort[3]);
252 char* l64a(c_long);
253 void lcong48(ushort[7]);
254 c_long lrand48();
255 char* mktemp(char*); // LEGACY
256 int mkstemp(char*);
257 c_long mrand48();
258 c_long nrand48(ushort[3]);
259 int posix_openpt(int);
260 char* ptsname(int);
261 int putenv(char*);
262 c_long random();
263 char* realpath(in char*, char*);
264 ushort seed48(ushort[3]);
265 void setkey(in char*);
266 char* setstate(in char*);
267 void srand48(c_long);
268 void srandom(uint);
269 int unlockpt(int);
270 }
271 else version( freebsd )
272 {
273 //WNOHANG (defined in core.sys.posix.sys.wait)
274 //WUNTRACED (defined in core.sys.posix.sys.wait)
275 //WEXITSTATUS (defined in core.sys.posix.sys.wait)
276 //WIFEXITED (defined in core.sys.posix.sys.wait)
277 //WIFSIGNALED (defined in core.sys.posix.sys.wait)
278 //WIFSTOPPED (defined in core.sys.posix.sys.wait)
279 //WSTOPSIG (defined in core.sys.posix.sys.wait)
280 //WTERMSIG (defined in core.sys.posix.sys.wait)
281
282 c_long a64l(in char*);
283 double drand48();
284 //char* ecvt(double, int, int *, int *); // LEGACY
285 double erand48(ushort[3]);
286 //char* fcvt(double, int, int *, int *); // LEGACY
287 //char* gcvt(double, int, char*); // LEGACY
288 int getsubopt(char**, in char**, char**);
289 int grantpt(int);
290 char* initstate(uint, char*, size_t);
291 c_long jrand48(ushort[3]);
292 char* l64a(c_long);
293 void lcong48(ushort[7]);
294 c_long lrand48();
295 char* mktemp(char*); // LEGACY
296 int mkstemp(char*);
297 c_long mrand48();
298 c_long nrand48(ushort[3]);
299 int posix_openpt(int);
300 char* ptsname(int);
301 int putenv(char*);
302 c_long random();
303 char* realpath(in char*, char*);
304 ushort seed48(ushort[3]);
305 void setkey(in char*);
306 char* setstate(in char*);
307 void srand48(c_long);
308 void srandom(uint);
309 int unlockpt(int);
310 }