xref: /minix3/sys/arch/i386/include/int_fmtio.h (revision f6aac1c3b5ca21b829888677e8ee6bc9cda07e52)
1*f6aac1c3SLionel Sambuc /*	$NetBSD: int_fmtio.h,v 1.7 2008/04/28 20:23:24 martin Exp $	*/
2*f6aac1c3SLionel Sambuc 
3*f6aac1c3SLionel Sambuc /*-
4*f6aac1c3SLionel Sambuc  * Copyright (c) 2001 The NetBSD Foundation, Inc.
5*f6aac1c3SLionel Sambuc  * All rights reserved.
6*f6aac1c3SLionel Sambuc  *
7*f6aac1c3SLionel Sambuc  * This code is derived from software contributed to The NetBSD Foundation
8*f6aac1c3SLionel Sambuc  * by Klaus Klein.
9*f6aac1c3SLionel Sambuc  *
10*f6aac1c3SLionel Sambuc  * Redistribution and use in source and binary forms, with or without
11*f6aac1c3SLionel Sambuc  * modification, are permitted provided that the following conditions
12*f6aac1c3SLionel Sambuc  * are met:
13*f6aac1c3SLionel Sambuc  * 1. Redistributions of source code must retain the above copyright
14*f6aac1c3SLionel Sambuc  *    notice, this list of conditions and the following disclaimer.
15*f6aac1c3SLionel Sambuc  * 2. Redistributions in binary form must reproduce the above copyright
16*f6aac1c3SLionel Sambuc  *    notice, this list of conditions and the following disclaimer in the
17*f6aac1c3SLionel Sambuc  *    documentation and/or other materials provided with the distribution.
18*f6aac1c3SLionel Sambuc  *
19*f6aac1c3SLionel Sambuc  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20*f6aac1c3SLionel Sambuc  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21*f6aac1c3SLionel Sambuc  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22*f6aac1c3SLionel Sambuc  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23*f6aac1c3SLionel Sambuc  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24*f6aac1c3SLionel Sambuc  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25*f6aac1c3SLionel Sambuc  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26*f6aac1c3SLionel Sambuc  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27*f6aac1c3SLionel Sambuc  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28*f6aac1c3SLionel Sambuc  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29*f6aac1c3SLionel Sambuc  * POSSIBILITY OF SUCH DAMAGE.
30*f6aac1c3SLionel Sambuc  */
31*f6aac1c3SLionel Sambuc 
32*f6aac1c3SLionel Sambuc #ifndef _I386_INT_FMTIO_H_
33*f6aac1c3SLionel Sambuc #define _I386_INT_FMTIO_H_
34*f6aac1c3SLionel Sambuc 
35*f6aac1c3SLionel Sambuc /*
36*f6aac1c3SLionel Sambuc  * 7.8.1 Macros for format specifiers
37*f6aac1c3SLionel Sambuc  */
38*f6aac1c3SLionel Sambuc 
39*f6aac1c3SLionel Sambuc /* fprintf macros for signed integers */
40*f6aac1c3SLionel Sambuc 
41*f6aac1c3SLionel Sambuc #define	PRId8		"d"	/* int8_t		*/
42*f6aac1c3SLionel Sambuc #define	PRId16		"d"	/* int16_t		*/
43*f6aac1c3SLionel Sambuc #define	PRId32		"d"	/* int32_t		*/
44*f6aac1c3SLionel Sambuc #define	PRId64		"lld"	/* int64_t		*/
45*f6aac1c3SLionel Sambuc #define	PRIdLEAST8	"d"	/* int_least8_t		*/
46*f6aac1c3SLionel Sambuc #define	PRIdLEAST16	"d"	/* int_least16_t	*/
47*f6aac1c3SLionel Sambuc #define	PRIdLEAST32	"d"	/* int_least32_t	*/
48*f6aac1c3SLionel Sambuc #define	PRIdLEAST64	"lld"	/* int_least64_t	*/
49*f6aac1c3SLionel Sambuc #define	PRIdFAST8	"d"	/* int_fast8_t		*/
50*f6aac1c3SLionel Sambuc #define	PRIdFAST16	"d"	/* int_fast16_t		*/
51*f6aac1c3SLionel Sambuc #define	PRIdFAST32	"d"	/* int_fast32_t		*/
52*f6aac1c3SLionel Sambuc #define	PRIdFAST64	"lld"	/* int_fast64_t		*/
53*f6aac1c3SLionel Sambuc #define	PRIdMAX		"lld"	/* intmax_t		*/
54*f6aac1c3SLionel Sambuc #define	PRIdPTR		"d"	/* intptr_t		*/
55*f6aac1c3SLionel Sambuc 
56*f6aac1c3SLionel Sambuc #define	PRIi8		"i"	/* int8_t		*/
57*f6aac1c3SLionel Sambuc #define	PRIi16		"i"	/* int16_t		*/
58*f6aac1c3SLionel Sambuc #define	PRIi32		"i"	/* int32_t		*/
59*f6aac1c3SLionel Sambuc #define	PRIi64		"lli"	/* int64_t		*/
60*f6aac1c3SLionel Sambuc #define	PRIiLEAST8	"i"	/* int_least8_t		*/
61*f6aac1c3SLionel Sambuc #define	PRIiLEAST16	"i"	/* int_least16_t	*/
62*f6aac1c3SLionel Sambuc #define	PRIiLEAST32	"i"	/* int_least32_t	*/
63*f6aac1c3SLionel Sambuc #define	PRIiLEAST64	"lli"	/* int_least64_t	*/
64*f6aac1c3SLionel Sambuc #define	PRIiFAST8	"i"	/* int_fast8_t		*/
65*f6aac1c3SLionel Sambuc #define	PRIiFAST16	"i"	/* int_fast16_t		*/
66*f6aac1c3SLionel Sambuc #define	PRIiFAST32	"i"	/* int_fast32_t		*/
67*f6aac1c3SLionel Sambuc #define	PRIiFAST64	"lli"	/* int_fast64_t		*/
68*f6aac1c3SLionel Sambuc #define	PRIiMAX		"lli"	/* intmax_t		*/
69*f6aac1c3SLionel Sambuc #define	PRIiPTR		"i"	/* intptr_t		*/
70*f6aac1c3SLionel Sambuc 
71*f6aac1c3SLionel Sambuc /* fprintf macros for unsigned integers */
72*f6aac1c3SLionel Sambuc 
73*f6aac1c3SLionel Sambuc #define	PRIo8		"o"	/* uint8_t		*/
74*f6aac1c3SLionel Sambuc #define	PRIo16		"o"	/* uint16_t		*/
75*f6aac1c3SLionel Sambuc #define	PRIo32		"o"	/* uint32_t		*/
76*f6aac1c3SLionel Sambuc #define	PRIo64		"llo"	/* uint64_t		*/
77*f6aac1c3SLionel Sambuc #define	PRIoLEAST8	"o"	/* uint_least8_t	*/
78*f6aac1c3SLionel Sambuc #define	PRIoLEAST16	"o"	/* uint_least16_t	*/
79*f6aac1c3SLionel Sambuc #define	PRIoLEAST32	"o"	/* uint_least32_t	*/
80*f6aac1c3SLionel Sambuc #define	PRIoLEAST64	"llo"	/* uint_least64_t	*/
81*f6aac1c3SLionel Sambuc #define	PRIoFAST8	"o"	/* uint_fast8_t		*/
82*f6aac1c3SLionel Sambuc #define	PRIoFAST16	"o"	/* uint_fast16_t	*/
83*f6aac1c3SLionel Sambuc #define	PRIoFAST32	"o"	/* uint_fast32_t	*/
84*f6aac1c3SLionel Sambuc #define	PRIoFAST64	"llo"	/* uint_fast64_t	*/
85*f6aac1c3SLionel Sambuc #define	PRIoMAX		"llo"	/* uintmax_t		*/
86*f6aac1c3SLionel Sambuc #define	PRIoPTR		"o"	/* uintptr_t		*/
87*f6aac1c3SLionel Sambuc 
88*f6aac1c3SLionel Sambuc #define	PRIu8		"u"	/* uint8_t		*/
89*f6aac1c3SLionel Sambuc #define	PRIu16		"u"	/* uint16_t		*/
90*f6aac1c3SLionel Sambuc #define	PRIu32		"u"	/* uint32_t		*/
91*f6aac1c3SLionel Sambuc #define	PRIu64		"llu"	/* uint64_t		*/
92*f6aac1c3SLionel Sambuc #define	PRIuLEAST8	"u"	/* uint_least8_t	*/
93*f6aac1c3SLionel Sambuc #define	PRIuLEAST16	"u"	/* uint_least16_t	*/
94*f6aac1c3SLionel Sambuc #define	PRIuLEAST32	"u"	/* uint_least32_t	*/
95*f6aac1c3SLionel Sambuc #define	PRIuLEAST64	"llu"	/* uint_least64_t	*/
96*f6aac1c3SLionel Sambuc #define	PRIuFAST8	"u"	/* uint_fast8_t		*/
97*f6aac1c3SLionel Sambuc #define	PRIuFAST16	"u"	/* uint_fast16_t	*/
98*f6aac1c3SLionel Sambuc #define	PRIuFAST32	"u"	/* uint_fast32_t	*/
99*f6aac1c3SLionel Sambuc #define	PRIuFAST64	"llu"	/* uint_fast64_t	*/
100*f6aac1c3SLionel Sambuc #define	PRIuMAX		"llu"	/* uintmax_t		*/
101*f6aac1c3SLionel Sambuc #define	PRIuPTR		"u"	/* uintptr_t		*/
102*f6aac1c3SLionel Sambuc 
103*f6aac1c3SLionel Sambuc #define	PRIx8		"x"	/* uint8_t		*/
104*f6aac1c3SLionel Sambuc #define	PRIx16		"x"	/* uint16_t		*/
105*f6aac1c3SLionel Sambuc #define	PRIx32		"x"	/* uint32_t		*/
106*f6aac1c3SLionel Sambuc #define	PRIx64		"llx"	/* uint64_t		*/
107*f6aac1c3SLionel Sambuc #define	PRIxLEAST8	"x"	/* uint_least8_t	*/
108*f6aac1c3SLionel Sambuc #define	PRIxLEAST16	"x"	/* uint_least16_t	*/
109*f6aac1c3SLionel Sambuc #define	PRIxLEAST32	"x"	/* uint_least32_t	*/
110*f6aac1c3SLionel Sambuc #define	PRIxLEAST64	"llx"	/* uint_least64_t	*/
111*f6aac1c3SLionel Sambuc #define	PRIxFAST8	"x"	/* uint_fast8_t		*/
112*f6aac1c3SLionel Sambuc #define	PRIxFAST16	"x"	/* uint_fast16_t	*/
113*f6aac1c3SLionel Sambuc #define	PRIxFAST32	"x"	/* uint_fast32_t	*/
114*f6aac1c3SLionel Sambuc #define	PRIxFAST64	"llx"	/* uint_fast64_t	*/
115*f6aac1c3SLionel Sambuc #define	PRIxMAX		"llx"	/* uintmax_t		*/
116*f6aac1c3SLionel Sambuc #define	PRIxPTR		"x"	/* uintptr_t		*/
117*f6aac1c3SLionel Sambuc 
118*f6aac1c3SLionel Sambuc #define	PRIX8		"X"	/* uint8_t		*/
119*f6aac1c3SLionel Sambuc #define	PRIX16		"X"	/* uint16_t		*/
120*f6aac1c3SLionel Sambuc #define	PRIX32		"X"	/* uint32_t		*/
121*f6aac1c3SLionel Sambuc #define	PRIX64		"llX"	/* uint64_t		*/
122*f6aac1c3SLionel Sambuc #define	PRIXLEAST8	"X"	/* uint_least8_t	*/
123*f6aac1c3SLionel Sambuc #define	PRIXLEAST16	"X"	/* uint_least16_t	*/
124*f6aac1c3SLionel Sambuc #define	PRIXLEAST32	"X"	/* uint_least32_t	*/
125*f6aac1c3SLionel Sambuc #define	PRIXLEAST64	"llX"	/* uint_least64_t	*/
126*f6aac1c3SLionel Sambuc #define	PRIXFAST8	"X"	/* uint_fast8_t		*/
127*f6aac1c3SLionel Sambuc #define	PRIXFAST16	"X"	/* uint_fast16_t	*/
128*f6aac1c3SLionel Sambuc #define	PRIXFAST32	"X"	/* uint_fast32_t	*/
129*f6aac1c3SLionel Sambuc #define	PRIXFAST64	"llX"	/* uint_fast64_t	*/
130*f6aac1c3SLionel Sambuc #define	PRIXMAX		"llX"	/* uintmax_t		*/
131*f6aac1c3SLionel Sambuc #define	PRIXPTR		"X"	/* uintptr_t		*/
132*f6aac1c3SLionel Sambuc 
133*f6aac1c3SLionel Sambuc /* fscanf macros for signed integers */
134*f6aac1c3SLionel Sambuc 
135*f6aac1c3SLionel Sambuc #define	SCNd8		"hhd"	/* int8_t		*/
136*f6aac1c3SLionel Sambuc #define	SCNd16		"hd"	/* int16_t		*/
137*f6aac1c3SLionel Sambuc #define	SCNd32		"d"	/* int32_t		*/
138*f6aac1c3SLionel Sambuc #define	SCNd64		"lld"	/* int64_t		*/
139*f6aac1c3SLionel Sambuc #define	SCNdLEAST8	"hhd"	/* int_least8_t		*/
140*f6aac1c3SLionel Sambuc #define	SCNdLEAST16	"hd"	/* int_least16_t	*/
141*f6aac1c3SLionel Sambuc #define	SCNdLEAST32	"d"	/* int_least32_t	*/
142*f6aac1c3SLionel Sambuc #define	SCNdLEAST64	"lld"	/* int_least64_t	*/
143*f6aac1c3SLionel Sambuc #define	SCNdFAST8	"hhd"	/* int_fast8_t		*/
144*f6aac1c3SLionel Sambuc #define	SCNdFAST16	"d"	/* int_fast16_t		*/
145*f6aac1c3SLionel Sambuc #define	SCNdFAST32	"d"	/* int_fast32_t		*/
146*f6aac1c3SLionel Sambuc #define	SCNdFAST64	"lld"	/* int_fast64_t		*/
147*f6aac1c3SLionel Sambuc #define	SCNdMAX		"lld"	/* intmax_t		*/
148*f6aac1c3SLionel Sambuc #define	SCNdPTR		"d"	/* intptr_t		*/
149*f6aac1c3SLionel Sambuc 
150*f6aac1c3SLionel Sambuc #define	SCNi8		"hhi"	/* int8_t		*/
151*f6aac1c3SLionel Sambuc #define	SCNi16		"hi"	/* int16_t		*/
152*f6aac1c3SLionel Sambuc #define	SCNi32		"i"	/* int32_t		*/
153*f6aac1c3SLionel Sambuc #define	SCNi64		"lli"	/* int64_t		*/
154*f6aac1c3SLionel Sambuc #define	SCNiLEAST8	"hhi"	/* int_least8_t		*/
155*f6aac1c3SLionel Sambuc #define	SCNiLEAST16	"hi"	/* int_least16_t	*/
156*f6aac1c3SLionel Sambuc #define	SCNiLEAST32	"i"	/* int_least32_t	*/
157*f6aac1c3SLionel Sambuc #define	SCNiLEAST64	"lli"	/* int_least64_t	*/
158*f6aac1c3SLionel Sambuc #define	SCNiFAST8	"hhi"	/* int_fast8_t		*/
159*f6aac1c3SLionel Sambuc #define	SCNiFAST16	"i"	/* int_fast16_t		*/
160*f6aac1c3SLionel Sambuc #define	SCNiFAST32	"i"	/* int_fast32_t		*/
161*f6aac1c3SLionel Sambuc #define	SCNiFAST64	"lli"	/* int_fast64_t		*/
162*f6aac1c3SLionel Sambuc #define	SCNiMAX		"lli"	/* intmax_t		*/
163*f6aac1c3SLionel Sambuc #define	SCNiPTR		"i"	/* intptr_t		*/
164*f6aac1c3SLionel Sambuc 
165*f6aac1c3SLionel Sambuc /* fscanf macros for unsigned integers */
166*f6aac1c3SLionel Sambuc 
167*f6aac1c3SLionel Sambuc #define	SCNo8		"hho"	/* uint8_t		*/
168*f6aac1c3SLionel Sambuc #define	SCNo16		"ho"	/* uint16_t		*/
169*f6aac1c3SLionel Sambuc #define	SCNo32		"o"	/* uint32_t		*/
170*f6aac1c3SLionel Sambuc #define	SCNo64		"llo"	/* uint64_t		*/
171*f6aac1c3SLionel Sambuc #define	SCNoLEAST8	"hho"	/* uint_least8_t	*/
172*f6aac1c3SLionel Sambuc #define	SCNoLEAST16	"ho"	/* uint_least16_t	*/
173*f6aac1c3SLionel Sambuc #define	SCNoLEAST32	"o"	/* uint_least32_t	*/
174*f6aac1c3SLionel Sambuc #define	SCNoLEAST64	"llo"	/* uint_least64_t	*/
175*f6aac1c3SLionel Sambuc #define	SCNoFAST8	"hho"	/* uint_fast8_t		*/
176*f6aac1c3SLionel Sambuc #define	SCNoFAST16	"o"	/* uint_fast16_t	*/
177*f6aac1c3SLionel Sambuc #define	SCNoFAST32	"o"	/* uint_fast32_t	*/
178*f6aac1c3SLionel Sambuc #define	SCNoFAST64	"llo"	/* uint_fast64_t	*/
179*f6aac1c3SLionel Sambuc #define	SCNoMAX		"llo"	/* uintmax_t		*/
180*f6aac1c3SLionel Sambuc #define	SCNoPTR		"o"	/* uintptr_t		*/
181*f6aac1c3SLionel Sambuc 
182*f6aac1c3SLionel Sambuc #define	SCNu8		"hhu"	/* uint8_t		*/
183*f6aac1c3SLionel Sambuc #define	SCNu16		"hu"	/* uint16_t		*/
184*f6aac1c3SLionel Sambuc #define	SCNu32		"u"	/* uint32_t		*/
185*f6aac1c3SLionel Sambuc #define	SCNu64		"llu"	/* uint64_t		*/
186*f6aac1c3SLionel Sambuc #define	SCNuLEAST8	"hhu"	/* uint_least8_t	*/
187*f6aac1c3SLionel Sambuc #define	SCNuLEAST16	"hu"	/* uint_least16_t	*/
188*f6aac1c3SLionel Sambuc #define	SCNuLEAST32	"u"	/* uint_least32_t	*/
189*f6aac1c3SLionel Sambuc #define	SCNuLEAST64	"llu"	/* uint_least64_t	*/
190*f6aac1c3SLionel Sambuc #define	SCNuFAST8	"hhu"	/* uint_fast8_t		*/
191*f6aac1c3SLionel Sambuc #define	SCNuFAST16	"u"	/* uint_fast16_t	*/
192*f6aac1c3SLionel Sambuc #define	SCNuFAST32	"u"	/* uint_fast32_t	*/
193*f6aac1c3SLionel Sambuc #define	SCNuFAST64	"llu"	/* uint_fast64_t	*/
194*f6aac1c3SLionel Sambuc #define	SCNuMAX		"llu"	/* uintmax_t		*/
195*f6aac1c3SLionel Sambuc #define	SCNuPTR		"u"	/* uintptr_t		*/
196*f6aac1c3SLionel Sambuc 
197*f6aac1c3SLionel Sambuc #define	SCNx8		"hhx"	/* uint8_t		*/
198*f6aac1c3SLionel Sambuc #define	SCNx16		"hx"	/* uint16_t		*/
199*f6aac1c3SLionel Sambuc #define	SCNx32		"x"	/* uint32_t		*/
200*f6aac1c3SLionel Sambuc #define	SCNx64		"llx"	/* uint64_t		*/
201*f6aac1c3SLionel Sambuc #define	SCNxLEAST8	"hhx"	/* uint_least8_t	*/
202*f6aac1c3SLionel Sambuc #define	SCNxLEAST16	"hx"	/* uint_least16_t	*/
203*f6aac1c3SLionel Sambuc #define	SCNxLEAST32	"x"	/* uint_least32_t	*/
204*f6aac1c3SLionel Sambuc #define	SCNxLEAST64	"llx"	/* uint_least64_t	*/
205*f6aac1c3SLionel Sambuc #define	SCNxFAST8	"hhx"	/* uint_fast8_t		*/
206*f6aac1c3SLionel Sambuc #define	SCNxFAST16	"x"	/* uint_fast16_t	*/
207*f6aac1c3SLionel Sambuc #define	SCNxFAST32	"x"	/* uint_fast32_t	*/
208*f6aac1c3SLionel Sambuc #define	SCNxFAST64	"llx"	/* uint_fast64_t	*/
209*f6aac1c3SLionel Sambuc #define	SCNxMAX		"llx"	/* uintmax_t		*/
210*f6aac1c3SLionel Sambuc #define	SCNxPTR		"x"	/* uintptr_t		*/
211*f6aac1c3SLionel Sambuc 
212*f6aac1c3SLionel Sambuc #endif /* !_I386_INT_FMTIO_H_ */
213