source: trunk/minix/include/inttypes.h@ 20

Last change on this file since 20 was 9, checked in by Mattia Monga, 14 years ago

Minix 3.1.2a

File size: 6.0 KB
Line 
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 */
7
8#ifndef _INTTYPES_H
9#define _INTTYPES_H
10
11#ifndef _STDINT_H
12#include <stdint.h>
13#endif
14
15#if !__cplusplus || defined(__STDC_FORMAT_MACROS)
16
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.)
20 */
21#define PRI8 ""
22#define PRILEAST8 ""
23#define PRIFAST8 ""
24#define PRI16 ""
25#define PRILEAST16 ""
26#define PRIFAST16 ""
27#if _WORD_SIZE == 2
28#define PRI32 "l"
29#define PRILEAST32 "l"
30#define PRIFAST32 "l"
31#else
32#define PRI32 ""
33#define PRILEAST32 ""
34#define PRIFAST32 ""
35#endif
36#if _WORD_SIZE > 2 && __L64
37#define PRI64 "l"
38#define PRILEAST64 "l"
39#define PRIFAST64 "l"
40#endif
41
42/* Macros for fprintf, the ones defined by the standard. */
43#define PRId8 PRI8"d"
44#define PRIdLEAST8 PRILEAST8"d"
45#define PRIdFAST8 PRIFAST8"d"
46#define PRId16 PRI16"d"
47#define PRIdLEAST16 PRILEAST16"d"
48#define PRIdFAST16 PRIFAST16"d"
49#define PRId32 PRI32"d"
50#define PRIdLEAST32 PRILEAST32"d"
51#define PRIdFAST32 PRIFAST32"d"
52#if _WORD_SIZE > 2 && __L64
53#define PRId64 PRI64"d"
54#define PRIdLEAST64 PRILEAST64"d"
55#define PRIdFAST64 PRIFAST64"d"
56#endif
57
58#define PRIi8 PRI8"i"
59#define PRIiLEAST8 PRILEAST8"i"
60#define PRIiFAST8 PRIFAST8"i"
61#define PRIi16 PRI16"i"
62#define PRIiLEAST16 PRILEAST16"i"
63#define PRIiFAST16 PRIFAST16"i"
64#define PRIi32 PRI32"i"
65#define PRIiLEAST32 PRILEAST32"i"
66#define PRIiFAST32 PRIFAST32"i"
67#if _WORD_SIZE > 2 && __L64
68#define PRIi64 PRI64"i"
69#define PRIiLEAST64 PRILEAST64"i"
70#define PRIiFAST64 PRIFAST64"i"
71#endif
72
73#define PRIo8 PRI8"o"
74#define PRIoLEAST8 PRILEAST8"o"
75#define PRIoFAST8 PRIFAST8"o"
76#define PRIo16 PRI16"o"
77#define PRIoLEAST16 PRILEAST16"o"
78#define PRIoFAST16 PRIFAST16"o"
79#define PRIo32 PRI32"o"
80#define PRIoLEAST32 PRILEAST32"o"
81#define PRIoFAST32 PRIFAST32"o"
82#if _WORD_SIZE > 2 && __L64
83#define PRIo64 PRI64"o"
84#define PRIoLEAST64 PRILEAST64"o"
85#define PRIoFAST64 PRIFAST64"o"
86#endif
87
88#define PRIu8 PRI8"u"
89#define PRIuLEAST8 PRILEAST8"u"
90#define PRIuFAST8 PRIFAST8"u"
91#define PRIu16 PRI16"u"
92#define PRIuLEAST16 PRILEAST16"u"
93#define PRIuFAST16 PRIFAST16"u"
94#define PRIu32 PRI32"u"
95#define PRIuLEAST32 PRILEAST32"u"
96#define PRIuFAST32 PRIFAST32"u"
97#if _WORD_SIZE > 2 && __L64
98#define PRIu64 PRI64"u"
99#define PRIuLEAST64 PRILEAST64"u"
100#define PRIuFAST64 PRIFAST64"u"
101#endif
102
103#define PRIx8 PRI8"x"
104#define PRIxLEAST8 PRILEAST8"x"
105#define PRIxFAST8 PRIFAST8"x"
106#define PRIx16 PRI16"x"
107#define PRIxLEAST16 PRILEAST16"x"
108#define PRIxFAST16 PRIFAST16"x"
109#define PRIx32 PRI32"x"
110#define PRIxLEAST32 PRILEAST32"x"
111#define PRIxFAST32 PRIFAST32"x"
112#if _WORD_SIZE > 2 && __L64
113#define PRIx64 PRI64"x"
114#define PRIxLEAST64 PRILEAST64"x"
115#define PRIxFAST64 PRIFAST64"x"
116#endif
117
118#define PRIX8 PRI8"X"
119#define PRIXLEAST8 PRILEAST8"X"
120#define PRIXFAST8 PRIFAST8"X"
121#define PRIX16 PRI16"X"
122#define PRIXLEAST16 PRILEAST16"X"
123#define PRIXFAST16 PRIFAST16"X"
124#define PRIX32 PRI32"X"
125#define PRIXLEAST32 PRILEAST32"X"
126#define PRIXFAST32 PRIFAST32"X"
127#if _WORD_SIZE > 2 && __L64
128#define PRIX64 PRI64"X"
129#define PRIXLEAST64 PRILEAST64"X"
130#define PRIXFAST64 PRIFAST64"X"
131#endif
132
133/* Macros to scan integers with fscanf(), nonstandard first group. */
134#define SCN8 "hh"
135#define SCNLEAST8 "hh"
136#define SCNFAST8 ""
137#define SCN16 "h"
138#define SCNLEAST16 "h"
139#define SCNFAST16 ""
140#if _WORD_SIZE == 2
141#define SCN32 "l"
142#define SCNLEAST32 "l"
143#define SCNFAST32 "l"
144#else
145#define SCN32 ""
146#define SCNLEAST32 ""
147#define SCNFAST32 ""
148#endif
149#if _WORD_SIZE > 2 && __L64
150#define SCN64 "l"
151#define SCNLEAST64 "l"
152#define SCNFAST64 "l"
153#endif
154
155/* Macros for fscanf, the ones defined by the standard. */
156#define SCNd8 SCN8"d"
157#define SCNdLEAST8 SCNLEAST8"d"
158#define SCNdFAST8 SCNFAST8"d"
159#define SCNd16 SCN16"d"
160#define SCNdLEAST16 SCNLEAST16"d"
161#define SCNdFAST16 SCNFAST16"d"
162#define SCNd32 SCN32"d"
163#define SCNdLEAST32 SCNLEAST32"d"
164#define SCNdFAST32 SCNFAST32"d"
165#if _WORD_SIZE > 2 && __L64
166#define SCNd64 SCN64"d"
167#define SCNdLEAST64 SCNLEAST64"d"
168#define SCNdFAST64 SCNFAST64"d"
169#endif
170
171#define SCNi8 SCN8"i"
172#define SCNiLEAST8 SCNLEAST8"i"
173#define SCNiFAST8 SCNFAST8"i"
174#define SCNi16 SCN16"i"
175#define SCNiLEAST16 SCNLEAST16"i"
176#define SCNiFAST16 SCNFAST16"i"
177#define SCNi32 SCN32"i"
178#define SCNiLEAST32 SCNLEAST32"i"
179#define SCNiFAST32 SCNFAST32"i"
180#if _WORD_SIZE > 2 && __L64
181#define SCNi64 SCN64"i"
182#define SCNiLEAST64 SCNLEAST64"i"
183#define SCNiFAST64 SCNFAST64"i"
184#endif
185
186#define SCNo8 SCN8"o"
187#define SCNoLEAST8 SCNLEAST8"o"
188#define SCNoFAST8 SCNFAST8"o"
189#define SCNo16 SCN16"o"
190#define SCNoLEAST16 SCNLEAST16"o"
191#define SCNoFAST16 SCNFAST16"o"
192#define SCNo32 SCN32"o"
193#define SCNoLEAST32 SCNLEAST32"o"
194#define SCNoFAST32 SCNFAST32"o"
195#if _WORD_SIZE > 2 && __L64
196#define SCNo64 SCN64"o"
197#define SCNoLEAST64 SCNLEAST64"o"
198#define SCNoFAST64 SCNFAST64"o"
199#endif
200
201#define SCNu8 SCN8"u"
202#define SCNuLEAST8 SCNLEAST8"u"
203#define SCNuFAST8 SCNFAST8"u"
204#define SCNu16 SCN16"u"
205#define SCNuLEAST16 SCNLEAST16"u"
206#define SCNuFAST16 SCNFAST16"u"
207#define SCNu32 SCN32"u"
208#define SCNuLEAST32 SCNLEAST32"u"
209#define SCNuFAST32 SCNFAST32"u"
210#if _WORD_SIZE > 2 && __L64
211#define SCNu64 SCN64"u"
212#define SCNuLEAST64 SCNLEAST64"u"
213#define SCNuFAST64 SCNFAST64"u"
214#endif
215
216#define SCNx8 SCN8"x"
217#define SCNxLEAST8 SCNLEAST8"x"
218#define SCNxFAST8 SCNFAST8"x"
219#define SCNx16 SCN16"x"
220#define SCNxLEAST16 SCNLEAST16"x"
221#define SCNxFAST16 SCNFAST16"x"
222#define SCNx32 SCN32"x"
223#define SCNxLEAST32 SCNLEAST32"x"
224#define SCNxFAST32 SCNFAST32"x"
225#if _WORD_SIZE > 2 && __L64
226#define SCNx64 SCN64"x"
227#define SCNxLEAST64 SCNLEAST64"x"
228#define SCNxFAST64 SCNFAST64"x"
229#endif
230#endif /* !__cplusplus || __STDC_FORMAT_MACROS */
231
232/* Integer conversion functions for [u]intmax_t. */
233#define stroimax(nptr, endptr, base) strtol(nptr, endptr, base)
234#define stroumax(nptr, endptr, base) strtoul(nptr, endptr, base)
235
236#endif /* _INTTYPES_H */
Note: See TracBrowser for help on using the repository browser.