132
|
1 /**
|
|
2 * D header file for POSIX.
|
|
3 *
|
|
4 * Copyright: Public Domain
|
|
5 * License: Public Domain
|
|
6 * Authors: Sean Kelly
|
|
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
|
|
8 */
|
|
9 module tango.stdc.posix.stdlib;
|
|
10
|
|
11 private import tango.stdc.posix.config;
|
|
12 public import tango.stdc.stdlib;
|
|
13 public import tango.stdc.posix.sys.wait;
|
|
14
|
|
15 extern (C):
|
|
16
|
|
17 //
|
|
18 // Required (defined in tango.stdc.stdlib)
|
|
19 //
|
|
20 /*
|
|
21 EXIT_FAILURE
|
|
22 EXIT_SUCCESS
|
|
23 NULL
|
|
24 RAND_MAX
|
|
25 MB_CUR_MAX
|
|
26 div_t
|
|
27 ldiv_t
|
|
28 lldiv_t
|
|
29 size_t
|
|
30 wchar_t
|
|
31
|
|
32 void _Exit(int);
|
|
33 void abort();
|
|
34 int abs(int);
|
|
35 int atexit(void function());
|
|
36 double atof(char*);
|
|
37 int atoi(char*);
|
|
38 c_long atol(char*);
|
|
39 long atoll(char*);
|
|
40 void* bsearch(void*, void*, size_t, size_t, int function(void*, void*));
|
|
41 void* calloc(size_t, size_t);
|
|
42 div_t div(int, int);
|
|
43 void exit(int);
|
|
44 void free(void*);
|
|
45 char* getenv(char*);
|
|
46 c_long labs(c_long);
|
|
47 ldiv_t ldiv(c_long, c_long);
|
|
48 long llabs(long);
|
|
49 lldiv_t lldiv(long, long);
|
|
50 void* malloc(size_t);
|
|
51 int mblen(char*, size_t);
|
|
52 size_t mbstowcs(wchar_t*, char*, size_t);
|
|
53 int mbtowc(wchar_t*, char*, size_t);
|
|
54 void qsort(void*, size_t, size_t, int function(void*, void*));
|
|
55 int rand();
|
|
56 void* realloc(void*, size_t);
|
|
57 void srand(uint);
|
|
58 double strtod(char*, char**);
|
|
59 float strtof(char*, char**);
|
|
60 c_long strtol(char*, char**, int);
|
|
61 real strtold(char*, char**);
|
|
62 long strtoll(char*, char**, int);
|
|
63 c_ulong strtoul(char*, char**, int);
|
|
64 ulong strtoull(char*, char**, int);
|
|
65 int system(char*);
|
|
66 size_t wcstombs(char*, wchar_t*, size_t);
|
|
67 int wctomb(char*, wchar_t);
|
|
68 */
|
|
69
|
|
70 //
|
|
71 // Advisory Information (ADV)
|
|
72 //
|
|
73 /*
|
|
74 int posix_memalign(void**, size_t, size_t);
|
|
75 */
|
|
76
|
|
77 version( linux )
|
|
78 {
|
|
79 int posix_memalign(void**, size_t, size_t);
|
|
80 }
|
|
81
|
|
82 //
|
|
83 // C Extension (CX)
|
|
84 //
|
|
85 /*
|
|
86 int setenv(char*, char*, int);
|
|
87 int unsetenv(char*);
|
|
88 */
|
|
89
|
|
90 version( linux )
|
|
91 {
|
|
92 int setenv(char*, char*, int);
|
|
93 int unsetenv(char*);
|
|
94
|
|
95 void* valloc(size_t); // LEGACY non-standard
|
|
96 }
|
|
97 else version( darwin )
|
|
98 {
|
|
99 int setenv(char*, char*, int);
|
|
100 int unsetenv(char*);
|
|
101
|
|
102 void* valloc(size_t); // LEGACY non-standard
|
|
103 }
|
|
104
|
|
105 //
|
|
106 // Thread-Safe Functions (TSF)
|
|
107 //
|
|
108 /*
|
|
109 int rand_r(uint*);
|
|
110 */
|
|
111
|
|
112 version( linux )
|
|
113 {
|
|
114 int rand_r(uint*);
|
|
115 }
|
|
116 else version( darwin )
|
|
117 {
|
|
118 int rand_r(uint*);
|
|
119 }
|
|
120
|
|
121 //
|
|
122 // XOpen (XSI)
|
|
123 //
|
|
124 /*
|
|
125 WNOHANG (defined in tango.stdc.posix.sys.wait)
|
|
126 WUNTRACED (defined in tango.stdc.posix.sys.wait)
|
|
127 WEXITSTATUS (defined in tango.stdc.posix.sys.wait)
|
|
128 WIFEXITED (defined in tango.stdc.posix.sys.wait)
|
|
129 WIFSIGNALED (defined in tango.stdc.posix.sys.wait)
|
|
130 WIFSTOPPED (defined in tango.stdc.posix.sys.wait)
|
|
131 WSTOPSIG (defined in tango.stdc.posix.sys.wait)
|
|
132 WTERMSIG (defined in tango.stdc.posix.sys.wait)
|
|
133
|
|
134 c_long a64l(char*);
|
|
135 double drand48();
|
|
136 char* ecvt(double, int, int *, int *); // LEGACY
|
|
137 double erand48(ushort[3]);
|
|
138 char* fcvt(double, int, int *, int *); // LEGACY
|
|
139 char* gcvt(double, int, char*); // LEGACY
|
|
140 int getsubopt(char**, char**, char**);
|
|
141 int grantpt(int);
|
|
142 char* initstate(uint, char*, size_t);
|
|
143 c_long jrand48(ushort[3]);
|
|
144 char* l64a(c_long);
|
|
145 void lcong48(ushort[7]);
|
|
146 c_long lrand48();
|
|
147 char* mktemp(char*); // LEGACY
|
|
148 int mkstemp(char*);
|
|
149 c_long mrand48();
|
|
150 c_long nrand48(ushort[3]);
|
|
151 int posix_openpt(int);
|
|
152 char* ptsname(int);
|
|
153 int putenv(char*);
|
|
154 c_long random();
|
|
155 char* realpath(char*, char*);
|
|
156 ushort seed48(ushort[3]);
|
|
157 void setkey(char*);
|
|
158 char* setstate(char*);
|
|
159 void srand48(c_long);
|
|
160 void srandom(uint);
|
|
161 int unlockpt(int);
|
|
162 */
|
|
163
|
|
164 version( linux )
|
|
165 {
|
|
166 //WNOHANG (defined in tango.stdc.posix.sys.wait)
|
|
167 //WUNTRACED (defined in tango.stdc.posix.sys.wait)
|
|
168 //WEXITSTATUS (defined in tango.stdc.posix.sys.wait)
|
|
169 //WIFEXITED (defined in tango.stdc.posix.sys.wait)
|
|
170 //WIFSIGNALED (defined in tango.stdc.posix.sys.wait)
|
|
171 //WIFSTOPPED (defined in tango.stdc.posix.sys.wait)
|
|
172 //WSTOPSIG (defined in tango.stdc.posix.sys.wait)
|
|
173 //WTERMSIG (defined in tango.stdc.posix.sys.wait)
|
|
174
|
|
175 c_long a64l(char*);
|
|
176 double drand48();
|
|
177 char* ecvt(double, int, int *, int *); // LEGACY
|
|
178 double erand48(ushort[3]);
|
|
179 char* fcvt(double, int, int *, int *); // LEGACY
|
|
180 char* gcvt(double, int, char*); // LEGACY
|
|
181 int getsubopt(char**, char**, char**);
|
|
182 int grantpt(int);
|
|
183 char* initstate(uint, char*, size_t);
|
|
184 c_long jrand48(ushort[3]);
|
|
185 char* l64a(c_long);
|
|
186 void lcong48(ushort[7]);
|
|
187 c_long lrand48();
|
|
188 char* mktemp(char*); // LEGACY
|
|
189 int mkstemp(char*);
|
|
190 c_long mrand48();
|
|
191 c_long nrand48(ushort[3]);
|
|
192 int posix_openpt(int);
|
|
193 char* ptsname(int);
|
|
194 int putenv(char*);
|
|
195 c_long random();
|
|
196 char* realpath(char*, char*);
|
|
197 ushort seed48(ushort[3]);
|
|
198 void setkey(char*);
|
|
199 char* setstate(char*);
|
|
200 void srand48(c_long);
|
|
201 void srandom(uint);
|
|
202 int unlockpt(int);
|
|
203 }
|
|
204 else version( darwin )
|
|
205 {
|
|
206 //WNOHANG (defined in tango.stdc.posix.sys.wait)
|
|
207 //WUNTRACED (defined in tango.stdc.posix.sys.wait)
|
|
208 //WEXITSTATUS (defined in tango.stdc.posix.sys.wait)
|
|
209 //WIFEXITED (defined in tango.stdc.posix.sys.wait)
|
|
210 //WIFSIGNALED (defined in tango.stdc.posix.sys.wait)
|
|
211 //WIFSTOPPED (defined in tango.stdc.posix.sys.wait)
|
|
212 //WSTOPSIG (defined in tango.stdc.posix.sys.wait)
|
|
213 //WTERMSIG (defined in tango.stdc.posix.sys.wait)
|
|
214
|
|
215 c_long a64l(char*);
|
|
216 double drand48();
|
|
217 char* ecvt(double, int, int *, int *); // LEGACY
|
|
218 double erand48(ushort[3]);
|
|
219 char* fcvt(double, int, int *, int *); // LEGACY
|
|
220 char* gcvt(double, int, char*); // LEGACY
|
|
221 int getsubopt(char**, char**, char**);
|
|
222 int grantpt(int);
|
|
223 char* initstate(uint, char*, size_t);
|
|
224 c_long jrand48(ushort[3]);
|
|
225 char* l64a(c_long);
|
|
226 void lcong48(ushort[7]);
|
|
227 c_long lrand48();
|
|
228 char* mktemp(char*); // LEGACY
|
|
229 int mkstemp(char*);
|
|
230 c_long mrand48();
|
|
231 c_long nrand48(ushort[3]);
|
|
232 int posix_openpt(int);
|
|
233 char* ptsname(int);
|
|
234 int putenv(char*);
|
|
235 c_long random();
|
|
236 char* realpath(char*, char*);
|
|
237 ushort seed48(ushort[3]);
|
|
238 void setkey(char*);
|
|
239 char* setstate(char*);
|
|
240 void srand48(c_long);
|
|
241 void srandom(uint);
|
|
242 int unlockpt(int);
|
|
243 }
|