1 /* Copyright (C) 1997-2001, 2004 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3 
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; If not, see <http://www.gnu.org/licenses/>.  */
16 
17 /*
18  *	ISO C99: 7.8 Format conversion of integer types	<inttypes.h>
19  */
20 
21 #ifndef _XEN_INTTYPES_H
22 #define _XEN_INTTYPES_H	1
23 
24 #include <xen/types.h>
25 
26 # if BITS_PER_LONG == 64
27 #  define __PRI64_PREFIX	"l"
28 #  define __PRIPTR_PREFIX	"l"
29 # else
30 #  define __PRI64_PREFIX	"ll"
31 #  define __PRIPTR_PREFIX
32 # endif
33 
34 /* Macros for printing format specifiers.  */
35 
36 /* Decimal notation.  */
37 # define PRId8		"d"
38 # define PRId16		"d"
39 # define PRId32		"d"
40 # define PRId64		__PRI64_PREFIX "d"
41 
42 # define PRIdLEAST8	"d"
43 # define PRIdLEAST16	"d"
44 # define PRIdLEAST32	"d"
45 # define PRIdLEAST64	__PRI64_PREFIX "d"
46 
47 # define PRIdFAST8	"d"
48 # define PRIdFAST16	__PRIPTR_PREFIX "d"
49 # define PRIdFAST32	__PRIPTR_PREFIX "d"
50 # define PRIdFAST64	__PRI64_PREFIX "d"
51 
52 
53 # define PRIi8		"i"
54 # define PRIi16		"i"
55 # define PRIi32		"i"
56 # define PRIi64		__PRI64_PREFIX "i"
57 
58 # define PRIiLEAST8	"i"
59 # define PRIiLEAST16	"i"
60 # define PRIiLEAST32	"i"
61 # define PRIiLEAST64	__PRI64_PREFIX "i"
62 
63 # define PRIiFAST8	"i"
64 # define PRIiFAST16	__PRIPTR_PREFIX "i"
65 # define PRIiFAST32	__PRIPTR_PREFIX "i"
66 # define PRIiFAST64	__PRI64_PREFIX "i"
67 
68 /* Octal notation.  */
69 # define PRIo8		"o"
70 # define PRIo16		"o"
71 # define PRIo32		"o"
72 # define PRIo64		__PRI64_PREFIX "o"
73 
74 # define PRIoLEAST8	"o"
75 # define PRIoLEAST16	"o"
76 # define PRIoLEAST32	"o"
77 # define PRIoLEAST64	__PRI64_PREFIX "o"
78 
79 # define PRIoFAST8	"o"
80 # define PRIoFAST16	__PRIPTR_PREFIX "o"
81 # define PRIoFAST32	__PRIPTR_PREFIX "o"
82 # define PRIoFAST64	__PRI64_PREFIX "o"
83 
84 /* Unsigned integers.  */
85 # define PRIu8		"u"
86 # define PRIu16		"u"
87 # define PRIu32		"u"
88 # define PRIu64		__PRI64_PREFIX "u"
89 
90 # define PRIuLEAST8	"u"
91 # define PRIuLEAST16	"u"
92 # define PRIuLEAST32	"u"
93 # define PRIuLEAST64	__PRI64_PREFIX "u"
94 
95 # define PRIuFAST8	"u"
96 # define PRIuFAST16	__PRIPTR_PREFIX "u"
97 # define PRIuFAST32	__PRIPTR_PREFIX "u"
98 # define PRIuFAST64	__PRI64_PREFIX "u"
99 
100 /* lowercase hexadecimal notation.  */
101 # define PRIx8		"x"
102 # define PRIx16		"x"
103 # define PRIx32		"x"
104 # define PRIx64		__PRI64_PREFIX "x"
105 
106 # define PRIxLEAST8	"x"
107 # define PRIxLEAST16	"x"
108 # define PRIxLEAST32	"x"
109 # define PRIxLEAST64	__PRI64_PREFIX "x"
110 
111 # define PRIxFAST8	"x"
112 # define PRIxFAST16	__PRIPTR_PREFIX "x"
113 # define PRIxFAST32	__PRIPTR_PREFIX "x"
114 # define PRIxFAST64	__PRI64_PREFIX "x"
115 
116 /* UPPERCASE hexadecimal notation.  */
117 # define PRIX8		"X"
118 # define PRIX16		"X"
119 # define PRIX32		"X"
120 # define PRIX64		__PRI64_PREFIX "X"
121 
122 # define PRIXLEAST8	"X"
123 # define PRIXLEAST16	"X"
124 # define PRIXLEAST32	"X"
125 # define PRIXLEAST64	__PRI64_PREFIX "X"
126 
127 # define PRIXFAST8	"X"
128 # define PRIXFAST16	__PRIPTR_PREFIX "X"
129 # define PRIXFAST32	__PRIPTR_PREFIX "X"
130 # define PRIXFAST64	__PRI64_PREFIX "X"
131 
132 
133 /* Macros for printing `intmax_t' and `uintmax_t'.  */
134 # define PRIdMAX	__PRI64_PREFIX "d"
135 # define PRIiMAX	__PRI64_PREFIX "i"
136 # define PRIoMAX	__PRI64_PREFIX "o"
137 # define PRIuMAX	__PRI64_PREFIX "u"
138 # define PRIxMAX	__PRI64_PREFIX "x"
139 # define PRIXMAX	__PRI64_PREFIX "X"
140 
141 
142 /* Macros for printing `intptr_t' and `uintptr_t'.  */
143 # define PRIdPTR	__PRIPTR_PREFIX "d"
144 # define PRIiPTR	__PRIPTR_PREFIX "i"
145 # define PRIoPTR	__PRIPTR_PREFIX "o"
146 # define PRIuPTR	__PRIPTR_PREFIX "u"
147 # define PRIxPTR	__PRIPTR_PREFIX "x"
148 # define PRIXPTR	__PRIPTR_PREFIX "X"
149 
150 
151 /* Macros for scanning format specifiers.  */
152 
153 /* Signed decimal notation.  */
154 # define SCNd8		"hhd"
155 # define SCNd16		"hd"
156 # define SCNd32		"d"
157 # define SCNd64		__PRI64_PREFIX "d"
158 
159 # define SCNdLEAST8	"hhd"
160 # define SCNdLEAST16	"hd"
161 # define SCNdLEAST32	"d"
162 # define SCNdLEAST64	__PRI64_PREFIX "d"
163 
164 # define SCNdFAST8	"hhd"
165 # define SCNdFAST16	__PRIPTR_PREFIX "d"
166 # define SCNdFAST32	__PRIPTR_PREFIX "d"
167 # define SCNdFAST64	__PRI64_PREFIX "d"
168 
169 /* Signed decimal notation.  */
170 # define SCNi8		"hhi"
171 # define SCNi16		"hi"
172 # define SCNi32		"i"
173 # define SCNi64		__PRI64_PREFIX "i"
174 
175 # define SCNiLEAST8	"hhi"
176 # define SCNiLEAST16	"hi"
177 # define SCNiLEAST32	"i"
178 # define SCNiLEAST64	__PRI64_PREFIX "i"
179 
180 # define SCNiFAST8	"hhi"
181 # define SCNiFAST16	__PRIPTR_PREFIX "i"
182 # define SCNiFAST32	__PRIPTR_PREFIX "i"
183 # define SCNiFAST64	__PRI64_PREFIX "i"
184 
185 /* Unsigned decimal notation.  */
186 # define SCNu8		"hhu"
187 # define SCNu16		"hu"
188 # define SCNu32		"u"
189 # define SCNu64		__PRI64_PREFIX "u"
190 
191 # define SCNuLEAST8	"hhu"
192 # define SCNuLEAST16	"hu"
193 # define SCNuLEAST32	"u"
194 # define SCNuLEAST64	__PRI64_PREFIX "u"
195 
196 # define SCNuFAST8	"hhu"
197 # define SCNuFAST16	__PRIPTR_PREFIX "u"
198 # define SCNuFAST32	__PRIPTR_PREFIX "u"
199 # define SCNuFAST64	__PRI64_PREFIX "u"
200 
201 /* Octal notation.  */
202 # define SCNo8		"hho"
203 # define SCNo16		"ho"
204 # define SCNo32		"o"
205 # define SCNo64		__PRI64_PREFIX "o"
206 
207 # define SCNoLEAST8	"hho"
208 # define SCNoLEAST16	"ho"
209 # define SCNoLEAST32	"o"
210 # define SCNoLEAST64	__PRI64_PREFIX "o"
211 
212 # define SCNoFAST8	"hho"
213 # define SCNoFAST16	__PRIPTR_PREFIX "o"
214 # define SCNoFAST32	__PRIPTR_PREFIX "o"
215 # define SCNoFAST64	__PRI64_PREFIX "o"
216 
217 /* Hexadecimal notation.  */
218 # define SCNx8		"hhx"
219 # define SCNx16		"hx"
220 # define SCNx32		"x"
221 # define SCNx64		__PRI64_PREFIX "x"
222 
223 # define SCNxLEAST8	"hhx"
224 # define SCNxLEAST16	"hx"
225 # define SCNxLEAST32	"x"
226 # define SCNxLEAST64	__PRI64_PREFIX "x"
227 
228 # define SCNxFAST8	"hhx"
229 # define SCNxFAST16	__PRIPTR_PREFIX "x"
230 # define SCNxFAST32	__PRIPTR_PREFIX "x"
231 # define SCNxFAST64	__PRI64_PREFIX "x"
232 
233 
234 /* Macros for scanning `intmax_t' and `uintmax_t'.  */
235 # define SCNdMAX	__PRI64_PREFIX "d"
236 # define SCNiMAX	__PRI64_PREFIX "i"
237 # define SCNoMAX	__PRI64_PREFIX "o"
238 # define SCNuMAX	__PRI64_PREFIX "u"
239 # define SCNxMAX	__PRI64_PREFIX "x"
240 
241 /* Macros for scaning `intptr_t' and `uintptr_t'.  */
242 # define SCNdPTR	__PRIPTR_PREFIX "d"
243 # define SCNiPTR	__PRIPTR_PREFIX "i"
244 # define SCNoPTR	__PRIPTR_PREFIX "o"
245 # define SCNuPTR	__PRIPTR_PREFIX "u"
246 # define SCNxPTR	__PRIPTR_PREFIX "x"
247 
248 #endif /* _XEN_INTTYPES_H */
249