more stack for boot
[minix.git] / include / inttypes.h
blob31f4ec005bbdae41053a7f3c56b87f337a4d0dfc
1 /* inttypes.h - Format conversions of integer types.
2 * Author: Kees J. Bot
3 * 4 Oct 2003
4 * Assumptions and bugs the same as for <stdint.h>
5 * Bug: Wide character integer conversion functions missing.
6 */
8 #ifndef _INTTYPES_H
9 #define _INTTYPES_H
11 #ifndef _STDINT_H
12 #include <stdint.h>
13 #endif
15 #if !__cplusplus || defined(__STDC_FORMAT_MACROS)
17 /* Macros to print integers defined in <stdint.h>. The first group should
18 * not be used in code, they're merely here to build the second group.
19 * (The standard really went overboard here, only the first group is needed.)
21 #define PRI8 ""
22 #define PRILEAST8 ""
23 #define PRIFAST8 ""
24 #define PRI16 ""
25 #define PRILEAST16 ""
26 #define PRIFAST16 ""
28 #if __SIZEOF_LONG__ > 4
29 #define PRI32 ""
30 #else
31 #define PRI32 "l"
32 #endif
33 #define PRILEAST32 PRI32
34 #define PRIFAST32 PRI32
36 #if defined(__LONG_LONG_SUPPORTED)
37 #define PRI64 "ll"
38 #elif _WORD_SIZE > 2 && __L64
39 #define PRI64 "l"
40 #endif
42 #ifdef PRI64
43 #define PRILEAST64 PRI64
44 #define PRIFAST64 PRI64
45 #define PRIMAX PRI64
46 #else
47 #define PRIMAX PRI32
48 #endif
50 #if _PTR_SIZE == _WORD_SIZE
51 #define PRIPTR ""
52 #elif _PTR_SIZE == 2*_WORD_SIZE
53 #define PRIPTR "l"
54 #endif
56 /* Macros for fprintf, the ones defined by the standard. */
57 #define PRId8 PRI8"d"
58 #define PRIdLEAST8 PRILEAST8"d"
59 #define PRIdFAST8 PRIFAST8"d"
60 #define PRId16 PRI16"d"
61 #define PRIdLEAST16 PRILEAST16"d"
62 #define PRIdFAST16 PRIFAST16"d"
63 #define PRId32 PRI32"d"
64 #define PRIdLEAST32 PRILEAST32"d"
65 #define PRIdFAST32 PRIFAST32"d"
66 #ifdef PRI64
67 #define PRId64 PRI64"d"
68 #define PRIdLEAST64 PRILEAST64"d"
69 #define PRIdFAST64 PRIFAST64"d"
70 #endif
71 #define PRIdMAX PRIMAX"d"
72 #define PRIdPTR PRIPTR"d"
74 #define PRIi8 PRI8"i"
75 #define PRIiLEAST8 PRILEAST8"i"
76 #define PRIiFAST8 PRIFAST8"i"
77 #define PRIi16 PRI16"i"
78 #define PRIiLEAST16 PRILEAST16"i"
79 #define PRIiFAST16 PRIFAST16"i"
80 #define PRIi32 PRI32"i"
81 #define PRIiLEAST32 PRILEAST32"i"
82 #define PRIiFAST32 PRIFAST32"i"
83 #ifdef PRI64
84 #define PRIi64 PRI64"i"
85 #define PRIiLEAST64 PRILEAST64"i"
86 #define PRIiFAST64 PRIFAST64"i"
87 #endif
88 #define PRIiMAX PRIMAX"i"
89 #define PRIiPTR PRIPTR"i"
91 #define PRIo8 PRI8"o"
92 #define PRIoLEAST8 PRILEAST8"o"
93 #define PRIoFAST8 PRIFAST8"o"
94 #define PRIo16 PRI16"o"
95 #define PRIoLEAST16 PRILEAST16"o"
96 #define PRIoFAST16 PRIFAST16"o"
97 #define PRIo32 PRI32"o"
98 #define PRIoLEAST32 PRILEAST32"o"
99 #define PRIoFAST32 PRIFAST32"o"
100 #ifdef PRI64
101 #define PRIo64 PRI64"o"
102 #define PRIoLEAST64 PRILEAST64"o"
103 #define PRIoFAST64 PRIFAST64"o"
104 #endif
105 #define PRIoMAX PRIMAX"o"
106 #define PRIoPTR PRIPTR"o"
108 #define PRIu8 PRI8"u"
109 #define PRIuLEAST8 PRILEAST8"u"
110 #define PRIuFAST8 PRIFAST8"u"
111 #define PRIu16 PRI16"u"
112 #define PRIuLEAST16 PRILEAST16"u"
113 #define PRIuFAST16 PRIFAST16"u"
114 #define PRIu32 PRI32"u"
115 #define PRIuLEAST32 PRILEAST32"u"
116 #define PRIuFAST32 PRIFAST32"u"
117 #ifdef PRI64
118 #define PRIu64 PRI64"u"
119 #define PRIuLEAST64 PRILEAST64"u"
120 #define PRIuFAST64 PRIFAST64"u"
121 #endif
122 #define PRIuMAX PRIMAX"u"
123 #define PRIuPTR PRIPTR"u"
125 #define PRIx8 PRI8"x"
126 #define PRIxLEAST8 PRILEAST8"x"
127 #define PRIxFAST8 PRIFAST8"x"
128 #define PRIx16 PRI16"x"
129 #define PRIxLEAST16 PRILEAST16"x"
130 #define PRIxFAST16 PRIFAST16"x"
131 #define PRIx32 PRI32"x"
132 #define PRIxLEAST32 PRILEAST32"x"
133 #define PRIxFAST32 PRIFAST32"x"
134 #ifdef PRI64
135 #define PRIx64 PRI64"x"
136 #define PRIxLEAST64 PRILEAST64"x"
137 #define PRIxFAST64 PRIFAST64"x"
138 #endif
139 #define PRIxMAX PRIMAX"x"
140 #define PRIxPTR PRIPTR"x"
142 #define PRIX8 PRI8"X"
143 #define PRIXLEAST8 PRILEAST8"X"
144 #define PRIXFAST8 PRIFAST8"X"
145 #define PRIX16 PRI16"X"
146 #define PRIXLEAST16 PRILEAST16"X"
147 #define PRIXFAST16 PRIFAST16"X"
148 #define PRIX32 PRI32"X"
149 #define PRIXLEAST32 PRILEAST32"X"
150 #define PRIXFAST32 PRIFAST32"X"
151 #ifdef PRI64
152 #define PRIX64 PRI64"X"
153 #define PRIXLEAST64 PRILEAST64"X"
154 #define PRIXFAST64 PRIFAST64"X"
155 #endif
156 #define PRIXMAX PRIMAX"X"
157 #define PRIXPTR PRIPTR"X"
159 /* Macros to scan integers with fscanf(), nonstandard first group. */
160 #define SCN8 "hh"
161 #define SCNLEAST8 "hh"
162 #define SCNFAST8 ""
163 #define SCN16 "h"
164 #define SCNLEAST16 "h"
165 #define SCNFAST16 ""
166 #if _WORD_SIZE == 2
167 #define SCN32 "l"
168 #define SCNLEAST32 "l"
169 #define SCNFAST32 "l"
170 #else
171 #define SCN32 ""
172 #define SCNLEAST32 ""
173 #define SCNFAST32 ""
174 #endif
175 #if _WORD_SIZE > 2 && __L64
176 #define SCN64 "l"
177 #define SCNLEAST64 "l"
178 #define SCNFAST64 "l"
179 #endif
181 /* Macros for fscanf, the ones defined by the standard. */
182 #define SCNd8 SCN8"d"
183 #define SCNdLEAST8 SCNLEAST8"d"
184 #define SCNdFAST8 SCNFAST8"d"
185 #define SCNd16 SCN16"d"
186 #define SCNdLEAST16 SCNLEAST16"d"
187 #define SCNdFAST16 SCNFAST16"d"
188 #define SCNd32 SCN32"d"
189 #define SCNdLEAST32 SCNLEAST32"d"
190 #define SCNdFAST32 SCNFAST32"d"
191 #if _WORD_SIZE > 2 && __L64
192 #define SCNd64 SCN64"d"
193 #define SCNdLEAST64 SCNLEAST64"d"
194 #define SCNdFAST64 SCNFAST64"d"
195 #endif
197 #define SCNi8 SCN8"i"
198 #define SCNiLEAST8 SCNLEAST8"i"
199 #define SCNiFAST8 SCNFAST8"i"
200 #define SCNi16 SCN16"i"
201 #define SCNiLEAST16 SCNLEAST16"i"
202 #define SCNiFAST16 SCNFAST16"i"
203 #define SCNi32 SCN32"i"
204 #define SCNiLEAST32 SCNLEAST32"i"
205 #define SCNiFAST32 SCNFAST32"i"
206 #if _WORD_SIZE > 2 && __L64
207 #define SCNi64 SCN64"i"
208 #define SCNiLEAST64 SCNLEAST64"i"
209 #define SCNiFAST64 SCNFAST64"i"
210 #endif
212 #define SCNo8 SCN8"o"
213 #define SCNoLEAST8 SCNLEAST8"o"
214 #define SCNoFAST8 SCNFAST8"o"
215 #define SCNo16 SCN16"o"
216 #define SCNoLEAST16 SCNLEAST16"o"
217 #define SCNoFAST16 SCNFAST16"o"
218 #define SCNo32 SCN32"o"
219 #define SCNoLEAST32 SCNLEAST32"o"
220 #define SCNoFAST32 SCNFAST32"o"
221 #if _WORD_SIZE > 2 && __L64
222 #define SCNo64 SCN64"o"
223 #define SCNoLEAST64 SCNLEAST64"o"
224 #define SCNoFAST64 SCNFAST64"o"
225 #endif
227 #define SCNu8 SCN8"u"
228 #define SCNuLEAST8 SCNLEAST8"u"
229 #define SCNuFAST8 SCNFAST8"u"
230 #define SCNu16 SCN16"u"
231 #define SCNuLEAST16 SCNLEAST16"u"
232 #define SCNuFAST16 SCNFAST16"u"
233 #define SCNu32 SCN32"u"
234 #define SCNuLEAST32 SCNLEAST32"u"
235 #define SCNuFAST32 SCNFAST32"u"
236 #if _WORD_SIZE > 2 && __L64
237 #define SCNu64 SCN64"u"
238 #define SCNuLEAST64 SCNLEAST64"u"
239 #define SCNuFAST64 SCNFAST64"u"
240 #endif
242 #define SCNx8 SCN8"x"
243 #define SCNxLEAST8 SCNLEAST8"x"
244 #define SCNxFAST8 SCNFAST8"x"
245 #define SCNx16 SCN16"x"
246 #define SCNxLEAST16 SCNLEAST16"x"
247 #define SCNxFAST16 SCNFAST16"x"
248 #define SCNx32 SCN32"x"
249 #define SCNxLEAST32 SCNLEAST32"x"
250 #define SCNxFAST32 SCNFAST32"x"
251 #if _WORD_SIZE > 2 && __L64
252 #define SCNx64 SCN64"x"
253 #define SCNxLEAST64 SCNLEAST64"x"
254 #define SCNxFAST64 SCNFAST64"x"
255 #endif
256 #endif /* !__cplusplus || __STDC_FORMAT_MACROS */
258 /* Integer conversion functions for [u]intmax_t. */
259 #ifdef __LONG_LONG_SUPPORTED
260 #define stroimax(nptr, endptr, base) strtoll(nptr, endptr, base)
261 #define stroumax(nptr, endptr, base) strtoull(nptr, endptr, base)
262 #else
263 #define stroimax(nptr, endptr, base) strtol(nptr, endptr, base)
264 #define stroumax(nptr, endptr, base) strtoul(nptr, endptr, base)
265 #endif
267 #endif /* _INTTYPES_H */