1 | /* 7.8 Format conversion of integer types <inttypes.h> */
|
---|
2 |
|
---|
3 | #ifndef _INTTYPES_H_
|
---|
4 | #define _INTTYPES_H_
|
---|
5 |
|
---|
6 | #include <_mingw.h>
|
---|
7 | #include <stdint.h>
|
---|
8 | #define __need_wchar_t
|
---|
9 | #include <stddef.h>
|
---|
10 |
|
---|
11 | _BEGIN_C_DECLS
|
---|
12 |
|
---|
13 | typedef struct {
|
---|
14 | intmax_t quot;
|
---|
15 | intmax_t rem;
|
---|
16 | } imaxdiv_t;
|
---|
17 |
|
---|
18 | #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
|
---|
19 |
|
---|
20 | /* 7.8.1 Macros for format specifiers
|
---|
21 | *
|
---|
22 | * MS runtime does not yet understand C9x standard "ll"
|
---|
23 | * length specifier. It appears to treat "ll" as "l".
|
---|
24 | * The non-standard I64 length specifier causes warning in GCC,
|
---|
25 | * but understood by MS runtime functions.
|
---|
26 | */
|
---|
27 |
|
---|
28 | /* fprintf macros for signed types */
|
---|
29 | #define PRId8 "d"
|
---|
30 | #define PRId16 "d"
|
---|
31 | #define PRId32 "d"
|
---|
32 | #define PRId64 "I64d"
|
---|
33 |
|
---|
34 | #define PRIdLEAST8 "d"
|
---|
35 | #define PRIdLEAST16 "d"
|
---|
36 | #define PRIdLEAST32 "d"
|
---|
37 | #define PRIdLEAST64 "I64d"
|
---|
38 |
|
---|
39 | #define PRIdFAST8 "d"
|
---|
40 | #define PRIdFAST16 "d"
|
---|
41 | #define PRIdFAST32 "d"
|
---|
42 | #define PRIdFAST64 "I64d"
|
---|
43 |
|
---|
44 | #define PRIdMAX "I64d"
|
---|
45 | #define PRIdPTR "d"
|
---|
46 |
|
---|
47 | #define PRIi8 "i"
|
---|
48 | #define PRIi16 "i"
|
---|
49 | #define PRIi32 "i"
|
---|
50 | #define PRIi64 "I64i"
|
---|
51 |
|
---|
52 | #define PRIiLEAST8 "i"
|
---|
53 | #define PRIiLEAST16 "i"
|
---|
54 | #define PRIiLEAST32 "i"
|
---|
55 | #define PRIiLEAST64 "I64i"
|
---|
56 |
|
---|
57 | #define PRIiFAST8 "i"
|
---|
58 | #define PRIiFAST16 "i"
|
---|
59 | #define PRIiFAST32 "i"
|
---|
60 | #define PRIiFAST64 "I64i"
|
---|
61 |
|
---|
62 | #define PRIiMAX "I64i"
|
---|
63 | #define PRIiPTR "i"
|
---|
64 |
|
---|
65 | #define PRIo8 "o"
|
---|
66 | #define PRIo16 "o"
|
---|
67 | #define PRIo32 "o"
|
---|
68 | #define PRIo64 "I64o"
|
---|
69 |
|
---|
70 | #define PRIoLEAST8 "o"
|
---|
71 | #define PRIoLEAST16 "o"
|
---|
72 | #define PRIoLEAST32 "o"
|
---|
73 | #define PRIoLEAST64 "I64o"
|
---|
74 |
|
---|
75 | #define PRIoFAST8 "o"
|
---|
76 | #define PRIoFAST16 "o"
|
---|
77 | #define PRIoFAST32 "o"
|
---|
78 | #define PRIoFAST64 "I64o"
|
---|
79 |
|
---|
80 | #define PRIoMAX "I64o"
|
---|
81 |
|
---|
82 | #define PRIoPTR "o"
|
---|
83 |
|
---|
84 | /* fprintf macros for unsigned types */
|
---|
85 | #define PRIu8 "u"
|
---|
86 | #define PRIu16 "u"
|
---|
87 | #define PRIu32 "u"
|
---|
88 | #define PRIu64 "I64u"
|
---|
89 |
|
---|
90 |
|
---|
91 | #define PRIuLEAST8 "u"
|
---|
92 | #define PRIuLEAST16 "u"
|
---|
93 | #define PRIuLEAST32 "u"
|
---|
94 | #define PRIuLEAST64 "I64u"
|
---|
95 |
|
---|
96 | #define PRIuFAST8 "u"
|
---|
97 | #define PRIuFAST16 "u"
|
---|
98 | #define PRIuFAST32 "u"
|
---|
99 | #define PRIuFAST64 "I64u"
|
---|
100 |
|
---|
101 | #define PRIuMAX "I64u"
|
---|
102 | #define PRIuPTR "u"
|
---|
103 |
|
---|
104 | #define PRIx8 "x"
|
---|
105 | #define PRIx16 "x"
|
---|
106 | #define PRIx32 "x"
|
---|
107 | #define PRIx64 "I64x"
|
---|
108 |
|
---|
109 | #define PRIxLEAST8 "x"
|
---|
110 | #define PRIxLEAST16 "x"
|
---|
111 | #define PRIxLEAST32 "x"
|
---|
112 | #define PRIxLEAST64 "I64x"
|
---|
113 |
|
---|
114 | #define PRIxFAST8 "x"
|
---|
115 | #define PRIxFAST16 "x"
|
---|
116 | #define PRIxFAST32 "x"
|
---|
117 | #define PRIxFAST64 "I64x"
|
---|
118 |
|
---|
119 | #define PRIxMAX "I64x"
|
---|
120 | #define PRIxPTR "x"
|
---|
121 |
|
---|
122 | #define PRIX8 "X"
|
---|
123 | #define PRIX16 "X"
|
---|
124 | #define PRIX32 "X"
|
---|
125 | #define PRIX64 "I64X"
|
---|
126 |
|
---|
127 | #define PRIXLEAST8 "X"
|
---|
128 | #define PRIXLEAST16 "X"
|
---|
129 | #define PRIXLEAST32 "X"
|
---|
130 | #define PRIXLEAST64 "I64X"
|
---|
131 |
|
---|
132 | #define PRIXFAST8 "X"
|
---|
133 | #define PRIXFAST16 "X"
|
---|
134 | #define PRIXFAST32 "X"
|
---|
135 | #define PRIXFAST64 "I64X"
|
---|
136 |
|
---|
137 | #define PRIXMAX "I64X"
|
---|
138 | #define PRIXPTR "X"
|
---|
139 |
|
---|
140 | /*
|
---|
141 | * fscanf macros for signed int types
|
---|
142 | * NOTE: if 32-bit int is used for int_fast8_t and int_fast16_t
|
---|
143 | * (see stdint.h, 7.18.1.3), FAST8 and FAST16 should have
|
---|
144 | * no length identifiers
|
---|
145 | */
|
---|
146 |
|
---|
147 | #define SCNd16 "hd"
|
---|
148 | #define SCNd32 "d"
|
---|
149 | #define SCNd64 "I64d"
|
---|
150 |
|
---|
151 | #define SCNdLEAST16 "hd"
|
---|
152 | #define SCNdLEAST32 "d"
|
---|
153 | #define SCNdLEAST64 "I64d"
|
---|
154 |
|
---|
155 | #define SCNdFAST16 "hd"
|
---|
156 | #define SCNdFAST32 "d"
|
---|
157 | #define SCNdFAST64 "I64d"
|
---|
158 |
|
---|
159 | #define SCNdMAX "I64d"
|
---|
160 | #define SCNdPTR "d"
|
---|
161 |
|
---|
162 | #define SCNi16 "hi"
|
---|
163 | #define SCNi32 "i"
|
---|
164 | #define SCNi64 "I64i"
|
---|
165 |
|
---|
166 | #define SCNiLEAST16 "hi"
|
---|
167 | #define SCNiLEAST32 "i"
|
---|
168 | #define SCNiLEAST64 "I64i"
|
---|
169 |
|
---|
170 | #define SCNiFAST16 "hi"
|
---|
171 | #define SCNiFAST32 "i"
|
---|
172 | #define SCNiFAST64 "I64i"
|
---|
173 |
|
---|
174 | #define SCNiMAX "I64i"
|
---|
175 | #define SCNiPTR "i"
|
---|
176 |
|
---|
177 | #define SCNo16 "ho"
|
---|
178 | #define SCNo32 "o"
|
---|
179 | #define SCNo64 "I64o"
|
---|
180 |
|
---|
181 | #define SCNoLEAST16 "ho"
|
---|
182 | #define SCNoLEAST32 "o"
|
---|
183 | #define SCNoLEAST64 "I64o"
|
---|
184 |
|
---|
185 | #define SCNoFAST16 "ho"
|
---|
186 | #define SCNoFAST32 "o"
|
---|
187 | #define SCNoFAST64 "I64o"
|
---|
188 |
|
---|
189 | #define SCNoMAX "I64o"
|
---|
190 | #define SCNoPTR "o"
|
---|
191 |
|
---|
192 | #define SCNx16 "hx"
|
---|
193 | #define SCNx32 "x"
|
---|
194 | #define SCNx64 "I64x"
|
---|
195 |
|
---|
196 | #define SCNxLEAST16 "hx"
|
---|
197 | #define SCNxLEAST32 "x"
|
---|
198 | #define SCNxLEAST64 "I64x"
|
---|
199 |
|
---|
200 | #define SCNxFAST16 "hx"
|
---|
201 | #define SCNxFAST32 "x"
|
---|
202 | #define SCNxFAST64 "I64x"
|
---|
203 |
|
---|
204 | #define SCNxMAX "I64x"
|
---|
205 | #define SCNxPTR "x"
|
---|
206 |
|
---|
207 |
|
---|
208 | /* fscanf macros for unsigned int types */
|
---|
209 |
|
---|
210 | #define SCNu16 "hu"
|
---|
211 | #define SCNu32 "u"
|
---|
212 | #define SCNu64 "I64u"
|
---|
213 |
|
---|
214 | #define SCNuLEAST16 "hu"
|
---|
215 | #define SCNuLEAST32 "u"
|
---|
216 | #define SCNuLEAST64 "I64u"
|
---|
217 |
|
---|
218 | #define SCNuFAST16 "hu"
|
---|
219 | #define SCNuFAST32 "u"
|
---|
220 | #define SCNuFAST64 "I64u"
|
---|
221 |
|
---|
222 | #define SCNuMAX "I64u"
|
---|
223 | #define SCNuPTR "u"
|
---|
224 |
|
---|
225 | #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
---|
226 | /*
|
---|
227 | * no length modifier for char types prior to C9x
|
---|
228 | * MS runtime scanf appears to treat "hh" as "h"
|
---|
229 | */
|
---|
230 |
|
---|
231 | /* signed char */
|
---|
232 | #define SCNd8 "hhd"
|
---|
233 | #define SCNdLEAST8 "hhd"
|
---|
234 | #define SCNdFAST8 "hhd"
|
---|
235 |
|
---|
236 | #define SCNi8 "hhi"
|
---|
237 | #define SCNiLEAST8 "hhi"
|
---|
238 | #define SCNiFAST8 "hhi"
|
---|
239 |
|
---|
240 | #define SCNo8 "hho"
|
---|
241 | #define SCNoLEAST8 "hho"
|
---|
242 | #define SCNoFAST8 "hho"
|
---|
243 |
|
---|
244 | #define SCNx8 "hhx"
|
---|
245 | #define SCNxLEAST8 "hhx"
|
---|
246 | #define SCNxFAST8 "hhx"
|
---|
247 |
|
---|
248 | /* unsigned char */
|
---|
249 | #define SCNu8 "hhu"
|
---|
250 | #define SCNuLEAST8 "hhu"
|
---|
251 | #define SCNuFAST8 "hhu"
|
---|
252 | #endif /* __STDC_VERSION__ >= 199901 */
|
---|
253 |
|
---|
254 | #endif /* !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) */
|
---|
255 |
|
---|
256 | intmax_t __cdecl __MINGW_NOTHROW imaxabs (intmax_t j);
|
---|
257 | #ifndef __NO_INLINE__
|
---|
258 | __CRT_INLINE __LIBIMPL__(( FUNCTION = imaxabs ))
|
---|
259 | intmax_t __cdecl __MINGW_NOTHROW imaxabs (intmax_t __j)
|
---|
260 | { return __j >= 0 ? __j : -__j; }
|
---|
261 |
|
---|
262 | /* Since intmax_t is effectively analogous to long long, the preceding
|
---|
263 | * implementation will serve admirably as the external representation of
|
---|
264 | * both imaxabs() and llabs(); declare so here, by providing a prototype
|
---|
265 | * only, with the corresponding inline implementation in stdlib.h
|
---|
266 | */
|
---|
267 | __CRT_INLINE __LIBIMPL__(( ALIAS = imaxabs ))
|
---|
268 | long long llabs (long long);
|
---|
269 | #endif
|
---|
270 |
|
---|
271 | imaxdiv_t __cdecl __MINGW_NOTHROW imaxdiv (intmax_t numer, intmax_t denom);
|
---|
272 |
|
---|
273 | /* 7.8.2 Conversion functions for greatest-width integer types */
|
---|
274 |
|
---|
275 | intmax_t __cdecl __MINGW_NOTHROW strtoimax (const char* __restrict__ nptr,
|
---|
276 | char** __restrict__ endptr, int base);
|
---|
277 | uintmax_t __cdecl __MINGW_NOTHROW strtoumax (const char* __restrict__ nptr,
|
---|
278 | char** __restrict__ endptr, int base);
|
---|
279 |
|
---|
280 | intmax_t __cdecl __MINGW_NOTHROW wcstoimax (const wchar_t* __restrict__ nptr,
|
---|
281 | wchar_t** __restrict__ endptr, int base);
|
---|
282 | uintmax_t __cdecl __MINGW_NOTHROW wcstoumax (const wchar_t* __restrict__ nptr,
|
---|
283 | wchar_t** __restrict__ endptr, int base);
|
---|
284 |
|
---|
285 | _END_C_DECLS
|
---|
286 |
|
---|
287 | #endif /* ndef _INTTYPES_H */
|
---|