The OpenD Programming Language

1 /**
2  * D header file for C99.
3  *
4  * $(C_HEADER_DESCRIPTION pubs.opengroup.org/onlinepubs/009695399/basedefs/_inttypes.h.html, _inttypes.h)
5  *
6  * Copyright: Copyright Sean Kelly 2005 - 2009.
7  * License: Distributed under the
8  *      $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
9  *    (See accompanying file LICENSE)
10  * Authors:   Sean Kelly
11  * Source:    $(DRUNTIMESRC core/stdc/_inttypes.d)
12  * Standards: ISO/IEC 9899:1999 (E)
13  */
14 
15 module core.stdc.inttypes;
16 
17 public import core.stdc.stddef; // for wchar_t
18 public import core.stdc.stdint; // required by spec
19 
20 extern (C):
21 @trusted: // Types and constants only.
22 nothrow:
23 @nogc:
24 
25 ///
26 struct imaxdiv_t
27 {
28     intmax_t    quot,
29                 rem;
30 }
31 
32 private alias immutable(char)* _cstr;
33 
34 ///
35 enum _cstr PRId8            = "hhd";
36 ///
37 enum _cstr PRId16           = "hd";
38 ///
39 enum _cstr PRId32           = "ld";
40 ///
41 enum _cstr PRId64           = "lld";
42 
43 ///
44 enum _cstr PRIdLEAST8       = "hhd";
45 ///
46 enum _cstr PRIdLEAST16      = "hd";
47 ///
48 enum _cstr PRIdLEAST32      = "ld";
49 ///
50 enum _cstr PRIdLEAST64      = "lld";
51 
52 ///
53 enum _cstr PRIdFAST8        = "hhd";
54 ///
55 enum _cstr PRIdFAST16       = "d";
56 ///
57 enum _cstr PRIdFAST32       = "ld";
58 ///
59 enum _cstr PRIdFAST64       = "lld";
60 
61 ///
62 enum _cstr PRIi8            = "hhi";
63 ///
64 enum _cstr PRIi16           = "hi";
65 ///
66 enum _cstr PRIi32           = "li";
67 ///
68 enum _cstr PRIi64           = "lli";
69 
70 ///
71 enum _cstr PRIiLEAST8       = "hhi";
72 ///
73 enum _cstr PRIiLEAST16      = "hi";
74 ///
75 enum _cstr PRIiLEAST32      = "li";
76 ///
77 enum _cstr PRIiLEAST64      = "lli";
78 
79 ///
80 enum _cstr PRIiFAST8        = "hhi";
81 ///
82 enum _cstr PRIiFAST16       = "i";
83 ///
84 enum _cstr PRIiFAST32       = "li";
85 ///
86 enum _cstr PRIiFAST64       = "lli";
87 
88 ///
89 enum _cstr PRIo8            = "hho";
90 ///
91 enum _cstr PRIo16           = "ho";
92 ///
93 enum _cstr PRIo32           = "lo";
94 ///
95 enum _cstr PRIo64           = "llo";
96 
97 ///
98 enum _cstr PRIoLEAST8       = "hho";
99 ///
100 enum _cstr PRIoLEAST16      = "ho";
101 ///
102 enum _cstr PRIoLEAST32      = "lo";
103 ///
104 enum _cstr PRIoLEAST64      = "llo";
105 
106 ///
107 enum _cstr PRIoFAST8        = "hho";
108 ///
109 enum _cstr PRIoFAST16       = "o";
110 ///
111 enum _cstr PRIoFAST32       = "lo";
112 ///
113 enum _cstr PRIoFAST64       = "llo";
114 
115 ///
116 enum _cstr PRIu8            = "hhu";
117 ///
118 enum _cstr PRIu16           = "hu";
119 ///
120 enum _cstr PRIu32           = "lu";
121 ///
122 enum _cstr PRIu64           = "llu";
123 
124 ///
125 enum _cstr PRIuLEAST8       = "hhu";
126 ///
127 enum _cstr PRIuLEAST16      = "hu";
128 ///
129 enum _cstr PRIuLEAST32      = "lu";
130 ///
131 enum _cstr PRIuLEAST64      = "llu";
132 
133 ///
134 enum _cstr PRIuFAST8        = "hhu";
135 ///
136 enum _cstr PRIuFAST16       = "u";
137 ///
138 enum _cstr PRIuFAST32       = "lu";
139 ///
140 enum _cstr PRIuFAST64       = "llu";
141 
142 ///
143 enum _cstr PRIx8            = "hhx";
144 ///
145 enum _cstr PRIx16           = "hx";
146 ///
147 enum _cstr PRIx32           = "lx";
148 ///
149 enum _cstr PRIx64           = "llx";
150 
151 ///
152 enum _cstr PRIxLEAST8       = "hhx";
153 ///
154 enum _cstr PRIxLEAST16      = "hx";
155 ///
156 enum _cstr PRIxLEAST32      = "lx";
157 ///
158 enum _cstr PRIxLEAST64      = "llx";
159 
160 ///
161 enum _cstr PRIxFAST8        = "hhx";
162 ///
163 enum _cstr PRIxFAST16       = "x";
164 ///
165 enum _cstr PRIxFAST32       = "lx";
166 ///
167 enum _cstr PRIxFAST64       = "llx";
168 
169 ///
170 enum _cstr PRIX8            = "hhX";
171 ///
172 enum _cstr PRIX16           = "hX";
173 ///
174 enum _cstr PRIX32           = "lX";
175 ///
176 enum _cstr PRIX64           = "llX";
177 
178 ///
179 enum _cstr PRIXLEAST8       = "hhX";
180 ///
181 enum _cstr PRIXLEAST16      = "hX";
182 ///
183 enum _cstr PRIXLEAST32      = "lX";
184 ///
185 enum _cstr PRIXLEAST64      = "llX";
186 
187 ///
188 enum _cstr PRIXFAST8        = "hhX";
189 ///
190 enum _cstr PRIXFAST16       = "X";
191 ///
192 enum _cstr PRIXFAST32       = "lX";
193 ///
194 enum _cstr PRIXFAST64       = "llX";
195 
196 ///
197 enum _cstr SCNd8            = "hhd";
198 ///
199 enum _cstr SCNd16           = "hd";
200 ///
201 enum _cstr SCNd32           = "ld";
202 ///
203 enum _cstr SCNd64           = "lld";
204 
205 ///
206 enum _cstr SCNdLEAST8       = "hhd";
207 ///
208 enum _cstr SCNdLEAST16      = "hd";
209 ///
210 enum _cstr SCNdLEAST32      = "ld";
211 ///
212 enum _cstr SCNdLEAST64      = "lld";
213 
214 ///
215 enum _cstr SCNdFAST8        = "hhd";
216 ///
217 enum _cstr SCNdFAST16       = "d";
218 ///
219 enum _cstr SCNdFAST32       = "ld";
220 ///
221 enum _cstr SCNdFAST64       = "lld";
222 
223 ///
224 enum _cstr SCNi8            = "hhd";
225 ///
226 enum _cstr SCNi16           = "hi";
227 ///
228 enum _cstr SCNi32           = "li";
229 ///
230 enum _cstr SCNi64           = "lli";
231 
232 ///
233 enum _cstr SCNiLEAST8       = "hhd";
234 ///
235 enum _cstr SCNiLEAST16      = "hi";
236 ///
237 enum _cstr SCNiLEAST32      = "li";
238 ///
239 enum _cstr SCNiLEAST64      = "lli";
240 
241 ///
242 enum _cstr SCNiFAST8        = "hhd";
243 ///
244 enum _cstr SCNiFAST16       = "i";
245 ///
246 enum _cstr SCNiFAST32       = "li";
247 ///
248 enum _cstr SCNiFAST64       = "lli";
249 
250 ///
251 enum _cstr SCNo8            = "hhd";
252 ///
253 enum _cstr SCNo16           = "ho";
254 ///
255 enum _cstr SCNo32           = "lo";
256 ///
257 enum _cstr SCNo64           = "llo";
258 
259 ///
260 enum _cstr SCNoLEAST8       = "hhd";
261 ///
262 enum _cstr SCNoLEAST16      = "ho";
263 ///
264 enum _cstr SCNoLEAST32      = "lo";
265 ///
266 enum _cstr SCNoLEAST64      = "llo";
267 
268 ///
269 enum _cstr SCNoFAST8        = "hhd";
270 ///
271 enum _cstr SCNoFAST16       = "o";
272 ///
273 enum _cstr SCNoFAST32       = "lo";
274 ///
275 enum _cstr SCNoFAST64       = "llo";
276 
277 ///
278 enum _cstr SCNu8            = "hhd";
279 ///
280 enum _cstr SCNu16           = "hu";
281 ///
282 enum _cstr SCNu32           = "lu";
283 ///
284 enum _cstr SCNu64           = "llu";
285 
286 ///
287 enum _cstr SCNuLEAST8       = "hhd";
288 ///
289 enum _cstr SCNuLEAST16      = "hu";
290 ///
291 enum _cstr SCNuLEAST32      = "lu";
292 ///
293 enum _cstr SCNuLEAST64      = "llu";
294 
295 ///
296 enum _cstr SCNuFAST8        = "hhd";
297 ///
298 enum _cstr SCNuFAST16       = "u";
299 ///
300 enum _cstr SCNuFAST32       = "lu";
301 ///
302 enum _cstr SCNuFAST64       = "llu";
303 
304 ///
305 enum _cstr SCNx8            = "hhd";
306 ///
307 enum _cstr SCNx16           = "hx";
308 ///
309 enum _cstr SCNx32           = "lx";
310 ///
311 enum _cstr SCNx64           = "llx";
312 
313 ///
314 enum _cstr SCNxLEAST8       = "hhd";
315 ///
316 enum _cstr SCNxLEAST16      = "hx";
317 ///
318 enum _cstr SCNxLEAST32      = "lx";
319 ///
320 enum _cstr SCNxLEAST64      = "llx";
321 
322 ///
323 enum _cstr SCNxFAST8        = "hhd";
324 ///
325 enum _cstr SCNxFAST16       = "x";
326 ///
327 enum _cstr SCNxFAST32       = "lx";
328 ///
329 enum _cstr SCNxFAST64       = "llx";
330 
331 version (D_LP64)
332 {
333     ///
334     enum _cstr PRIdMAX      = PRId64;
335     ///
336     enum _cstr PRIiMAX      = PRIi64;
337     ///
338     enum _cstr PRIoMAX      = PRIo64;
339     ///
340     enum _cstr PRIuMAX      = PRIu64;
341     ///
342     enum _cstr PRIxMAX      = PRIx64;
343     ///
344     enum _cstr PRIXMAX      = PRIX64;
345 
346     ///
347     enum _cstr SCNdMAX      = SCNd64;
348     ///
349     enum _cstr SCNiMAX      = SCNi64;
350     ///
351     enum _cstr SCNoMAX      = SCNo64;
352     ///
353     enum _cstr SCNuMAX      = SCNu64;
354     ///
355     enum _cstr SCNxMAX      = SCNx64;
356 
357     ///
358     enum _cstr PRIdPTR      = PRId64;
359     ///
360     enum _cstr PRIiPTR      = PRIi64;
361     ///
362     enum _cstr PRIoPTR      = PRIo64;
363     ///
364     enum _cstr PRIuPTR      = PRIu64;
365     ///
366     enum _cstr PRIxPTR      = PRIx64;
367     ///
368     enum _cstr PRIXPTR      = PRIX64;
369 
370     ///
371     enum _cstr SCNdPTR      = SCNd64;
372     ///
373     enum _cstr SCNiPTR      = SCNi64;
374     ///
375     enum _cstr SCNoPTR      = SCNo64;
376     ///
377     enum _cstr SCNuPTR      = SCNu64;
378     ///
379     enum _cstr SCNxPTR      = SCNx64;
380 }
381 else
382 {
383     ///
384     enum _cstr PRIdMAX      = PRId32;
385     ///
386     enum _cstr PRIiMAX      = PRIi32;
387     ///
388     enum _cstr PRIoMAX      = PRIo32;
389     ///
390     enum _cstr PRIuMAX      = PRIu32;
391     ///
392     enum _cstr PRIxMAX      = PRIx32;
393     ///
394     enum _cstr PRIXMAX      = PRIX32;
395 
396     ///
397     enum _cstr SCNdMAX      = SCNd32;
398     ///
399     enum _cstr SCNiMAX      = SCNi32;
400     ///
401     enum _cstr SCNoMAX      = SCNo32;
402     ///
403     enum _cstr SCNuMAX      = SCNu32;
404     ///
405     enum _cstr SCNxMAX      = SCNx32;
406 
407     ///
408     enum _cstr PRIdPTR      = PRId32;
409     ///
410     enum _cstr PRIiPTR      = PRIi32;
411     ///
412     enum _cstr PRIoPTR      = PRIo32;
413     ///
414     enum _cstr PRIuPTR      = PRIu32;
415     ///
416     enum _cstr PRIxPTR      = PRIx32;
417     ///
418     enum _cstr PRIXPTR      = PRIX32;
419 
420     ///
421     enum _cstr SCNdPTR      = SCNd32;
422     ///
423     enum _cstr SCNiPTR      = SCNi32;
424     ///
425     enum _cstr SCNoPTR      = SCNo32;
426     ///
427     enum _cstr SCNuPTR      = SCNu32;
428     ///
429     enum _cstr SCNxPTR      = SCNx32;
430 }
431 
432 ///
433 intmax_t  imaxabs(intmax_t j);
434 ///
435 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
436 ///
437 intmax_t  strtoimax(const scope char* nptr, char** endptr, int base);
438 ///
439 uintmax_t strtoumax(const scope char* nptr, char** endptr, int base);
440 ///
441 intmax_t  wcstoimax(const scope wchar_t* nptr, wchar_t** endptr, int base);
442 ///
443 uintmax_t wcstoumax(const scope wchar_t* nptr, wchar_t** endptr, int base);