1 /**
2  * D header file for C99.
3  *
4  * Copyright: Public Domain
5  * License:   Public Domain
6  * Authors:   Sean Kelly
7  * Standards: ISO/IEC 9899:1999 (E)
8  */
9 module tango.stdc.inttypes;
10 
11 public import tango.stdc.stddef;
12 public import tango.stdc.stdint;
13 
14 extern (C):
15 
16 struct imaxdiv_t
17 {
18     intmax_t    quot,
19                 rem;
20 }
21 
22 version( VerboseC )
23 {
24     const char* PRId8		= "hhd";
25     const char* PRId16		= "hd";
26     const char* PRId32		= "ld";
27     const char* PRId64		= "lld";
28 
29     const char* PRIdLEAST8	= "hhd";
30     const char* PRIdLEAST16	= "hd";
31     const char* PRIdLEAST32	= "ld";
32     const char* PRIdLEAST64	= "lld";
33 
34     const char* PRIdFAST8	= "hhd";
35     const char* PRIdFAST16	= "d";
36     const char* PRIdFAST32	= "ld";
37     const char* PRIdFAST64	= "lld";
38 
39     const char* PRIi8		= "hhi";
40     const char* PRIi16		= "hi";
41     const char* PRIi32		= "li";
42     const char* PRIi64		= "lli";
43 
44     const char* PRIiLEAST8	= "hhi";
45     const char* PRIiLEAST16	= "hi";
46     const char* PRIiLEAST32	= "li";
47     const char* PRIiLEAST64	= "lli";
48 
49     const char* PRIiFAST8	= "hhi";
50     const char* PRIiFAST16	= "i";
51     const char* PRIiFAST32	= "li";
52     const char* PRIiFAST64	= "lli";
53 
54     const char* PRIo8		= "hho";
55     const char* PRIo16		= "ho";
56     const char* PRIo32		= "lo";
57     const char* PRIo64		= "llo";
58 
59     const char* PRIoLEAST8	= "hho";
60     const char* PRIoLEAST16	= "ho";
61     const char* PRIoLEAST32	= "lo";
62     const char* PRIoLEAST64	= "llo";
63 
64     const char* PRIoFAST8	= "hho";
65     const char* PRIoFAST16	= "o";
66     const char* PRIoFAST32	= "lo";
67     const char* PRIoFAST64	= "llo";
68 
69     const char* PRIu8		= "hhu";
70     const char* PRIu16		= "hu";
71     const char* PRIu32		= "lu";
72     const char* PRIu64		= "llu";
73 
74     const char* PRIuLEAST8	= "hhu";
75     const char* PRIuLEAST16	= "hu";
76     const char* PRIuLEAST32	= "lu";
77     const char* PRIuLEAST64	= "llu";
78 
79     const char* PRIuFAST8	= "hhu";
80     const char* PRIuFAST16	= "u";
81     const char* PRIuFAST32	= "lu";
82     const char* PRIuFAST64	= "llu";
83 
84     const char* PRIx8		= "hhx";
85     const char* PRIx16		= "hx";
86     const char* PRIx32		= "lx";
87     const char* PRIx64		= "llx";
88 
89     const char* PRIxLEAST8	= "hhx";
90     const char* PRIxLEAST16	= "hx";
91     const char* PRIxLEAST32	= "lx";
92     const char* PRIxLEAST64	= "llx";
93 
94     const char* PRIxFAST8	= "hhx";
95     const char* PRIxFAST16	= "x";
96     const char* PRIxFAST32	= "lx";
97     const char* PRIxFAST64	= "llx";
98 
99     const char* PRIX8		= "hhX";
100     const char* PRIX16		= "hX";
101     const char* PRIX32		= "lX";
102     const char* PRIX64		= "llX";
103 
104     const char* PRIXLEAST8	= "hhX";
105     const char* PRIXLEAST16	= "hX";
106     const char* PRIXLEAST32	= "lX";
107     const char* PRIXLEAST64	= "llX";
108 
109     const char* PRIXFAST8	= "hhX";
110     const char* PRIXFAST16	= "X";
111     const char* PRIXFAST32	= "lX";
112     const char* PRIXFAST64	= "llX";
113 
114     const char* SCNd8		= "hhd";
115     const char* SCNd16		= "hd";
116     const char* SCNd32		= "ld";
117     const char* SCNd64		= "lld";
118 
119     const char* SCNdLEAST8	= "hhd";
120     const char* SCNdLEAST16	= "hd";
121     const char* SCNdLEAST32	= "ld";
122     const char* SCNdLEAST64	= "lld";
123 
124     const char* SCNdFAST8	= "hhd";
125     const char* SCNdFAST16	= "d";
126     const char* SCNdFAST32	= "ld";
127     const char* SCNdFAST64	= "lld";
128 
129     const char* SCNi8		= "hhd";
130     const char* SCNi16		= "hi";
131     const char* SCNi32		= "li";
132     const char* SCNi64		= "lli";
133 
134     const char* SCNiLEAST8	= "hhd";
135     const char* SCNiLEAST16	= "hi";
136     const char* SCNiLEAST32	= "li";
137     const char* SCNiLEAST64	= "lli";
138 
139     const char* SCNiFAST8	= "hhd";
140     const char* SCNiFAST16	= "i";
141     const char* SCNiFAST32	= "li";
142     const char* SCNiFAST64	= "lli";
143 
144     const char* SCNo8		= "hhd";
145     const char* SCNo16		= "ho";
146     const char* SCNo32		= "lo";
147     const char* SCNo64		= "llo";
148 
149     const char* SCNoLEAST8	= "hhd";
150     const char* SCNoLEAST16	= "ho";
151     const char* SCNoLEAST32	= "lo";
152     const char* SCNoLEAST64	= "llo";
153 
154     const char* SCNoFAST8	= "hhd";
155     const char* SCNoFAST16	= "o";
156     const char* SCNoFAST32	= "lo";
157     const char* SCNoFAST64	= "llo";
158 
159     const char* SCNu8		= "hhd";
160     const char* SCNu16		= "hu";
161     const char* SCNu32		= "lu";
162     const char* SCNu64		= "llu";
163 
164     const char* SCNuLEAST8	= "hhd";
165     const char* SCNuLEAST16	= "hu";
166     const char* SCNuLEAST32	= "lu";
167     const char* SCNuLEAST64	= "llu";
168 
169     const char* SCNuFAST8	= "hhd";
170     const char* SCNuFAST16	= "u";
171     const char* SCNuFAST32	= "lu";
172     const char* SCNuFAST64	= "llu";
173 
174     const char* SCNx8		= "hhd";
175     const char* SCNx16		= "hx";
176     const char* SCNx32		= "lx";
177     const char* SCNx64		= "llx";
178 
179     const char* SCNxLEAST8	= "hhd";
180     const char* SCNxLEAST16	= "hx";
181     const char* SCNxLEAST32	= "lx";
182     const char* SCNxLEAST64	= "llx";
183 
184     const char* SCNxFAST8	= "hhd";
185     const char* SCNxFAST16	= "x";
186     const char* SCNxFAST32	= "lx";
187     const char* SCNxFAST64	= "llx";
188 
189   version( X86_64 )
190   {
191     const char* PRIdMAX		= PRId64;
192     const char* PRIiMAX		= PRIi64;
193     const char* PRIoMAX		= PRIo64;
194     const char* PRIuMAX		= PRIu64;
195     const char* PRIxMAX 	= PRIx64;
196     const char* PRIXMAX		= PRIX64;
197 
198     const char* SCNdMAX		= SCNd64;
199     const char* SCNiMAX		= SCNi64;
200     const char* SCNoMAX		= SCNo64;
201     const char* SCNuMAX		= SCNu64;
202     const char* SCNxMAX		= SCNx64;
203 
204     const char* PRIdPTR		= PRId64;
205     const char* PRIiPTR		= PRIi64;
206     const char* PRIoPTR		= PRIo64;
207     const char* PRIuPTR		= PRIu64;
208     const char* PRIxPTR		= PRIx64;
209     const char* PRIXPTR		= PRIX64;
210 
211     const char* SCNdPTR		= SCNd64;
212     const char* SCNiPTR		= SCNi64;
213     const char* SCNoPTR		= SCNo64;
214     const char* SCNuPTR		= SCNu64;
215     const char* SCNxPTR		= SCNx64;
216   }
217   else
218   {
219     const char* PRIdMAX		= PRId32;
220     const char* PRIiMAX		= PRIi32;
221     const char* PRIoMAX		= PRIo32;
222     const char* PRIuMAX		= PRIu32;
223     const char* PRIxMAX		= PRIx32;
224     const char* PRIXMAX		= PRIX32;
225 
226     const char* SCNdMAX		= SCNd32;
227     const char* SCNiMAX		= SCNi32;
228     const char* SCNoMAX		= SCNo32;
229     const char* SCNuMAX		= SCNu32;
230     const char* SCNxMAX		= SCNx32;
231 
232     const char* PRIdPTR		= PRId32;
233     const char* PRIiPTR		= PRIi32;
234     const char* PRIoPTR		= PRIo32;
235     const char* PRIuPTR		= PRIu32;
236     const char* PRIxPTR		= PRIx32;
237     const char* PRIXPTR		= PRIX32;
238 
239     const char* SCNdPTR		= SCNd32;
240     const char* SCNiPTR		= SCNi32;
241     const char* SCNoPTR		= SCNo32;
242     const char* SCNuPTR		= SCNu32;
243     const char* SCNxPTR		= SCNx32;
244   }
245 }
246 
247 intmax_t  imaxabs(intmax_t j);
248 imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
249 intmax_t  strtoimax(in char* nptr, char** endptr, int base);
250 uintmax_t strtoumax(in char* nptr, char** endptr, int base);
251 intmax_t  wcstoimax(in wchar_t* nptr, wchar_t** endptr, int base);
252 uintmax_t wcstoumax(in wchar_t* nptr, wchar_t** endptr, int base);