int_fmtio.h revision 1.3
11.3Smatt/*	$NetBSD: int_fmtio.h,v 1.3 2014/08/13 19:48:17 matt Exp $	*/
21.1Scherry
31.1Scherry/*-
41.1Scherry * Copyright (c) 2001 The NetBSD Foundation, Inc.
51.1Scherry * All rights reserved.
61.1Scherry *
71.1Scherry * This code is derived from software contributed to The NetBSD Foundation
81.1Scherry * by Klaus Klein.
91.1Scherry *
101.1Scherry * Redistribution and use in source and binary forms, with or without
111.1Scherry * modification, are permitted provided that the following conditions
121.1Scherry * are met:
131.1Scherry * 1. Redistributions of source code must retain the above copyright
141.1Scherry *    notice, this list of conditions and the following disclaimer.
151.1Scherry * 2. Redistributions in binary form must reproduce the above copyright
161.1Scherry *    notice, this list of conditions and the following disclaimer in the
171.1Scherry *    documentation and/or other materials provided with the distribution.
181.1Scherry *
191.1Scherry * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
201.1Scherry * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
211.1Scherry * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
221.1Scherry * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
231.1Scherry * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
241.1Scherry * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
251.1Scherry * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
261.1Scherry * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
271.1Scherry * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
281.1Scherry * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
291.1Scherry * POSSIBILITY OF SUCH DAMAGE.
301.1Scherry */
311.1Scherry
321.1Scherry#ifndef _IA64_INT_FMTIO_H_
331.1Scherry#define _IA64_INT_FMTIO_H_
341.1Scherry
351.3Smatt#ifdef __INTPTR_FMTd__
361.3Smatt#include <sys/common_int_fmtio.h>
371.3Smatt#else
381.1Scherry/*
391.1Scherry * 7.8.1 Macros for format specifiers
401.1Scherry */
411.1Scherry
421.1Scherry/* fprintf macros for signed integers */
431.1Scherry
441.1Scherry#define	PRId8		"d"	/* int8_t		*/
451.1Scherry#define	PRId16		"d"	/* int16_t		*/
461.1Scherry#define	PRId32		"d"	/* int32_t		*/
471.1Scherry#define	PRId64		"ld"	/* int64_t		*/
481.1Scherry#define	PRIdLEAST8	"d"	/* int_least8_t		*/
491.1Scherry#define	PRIdLEAST16	"d"	/* int_least16_t	*/
501.1Scherry#define	PRIdLEAST32	"d"	/* int_least32_t	*/
511.1Scherry#define	PRIdLEAST64	"ld"	/* int_least64_t	*/
521.1Scherry#define	PRIdFAST8	"d"	/* int_fast8_t		*/
531.1Scherry#define	PRIdFAST16	"d"	/* int_fast16_t		*/
541.1Scherry#define	PRIdFAST32	"d"	/* int_fast32_t		*/
551.1Scherry#define	PRIdFAST64	"ld"	/* int_fast64_t		*/
561.1Scherry#define	PRIdMAX		"ld"	/* intmax_t		*/
571.1Scherry#define	PRIdPTR		"ld"	/* intptr_t		*/
581.1Scherry
591.1Scherry#define	PRIi8		"i"	/* int8_t		*/
601.1Scherry#define	PRIi16		"i"	/* int16_t		*/
611.1Scherry#define	PRIi32		"i"	/* int32_t		*/
621.1Scherry#define	PRIi64		"li"	/* int64_t		*/
631.1Scherry#define	PRIiLEAST8	"i"	/* int_least8_t		*/
641.1Scherry#define	PRIiLEAST16	"i"	/* int_least16_t	*/
651.1Scherry#define	PRIiLEAST32	"i"	/* int_least32_t	*/
661.1Scherry#define	PRIiLEAST64	"li"	/* int_least64_t	*/
671.1Scherry#define	PRIiFAST8	"i"	/* int_fast8_t		*/
681.1Scherry#define	PRIiFAST16	"i"	/* int_fast16_t		*/
691.1Scherry#define	PRIiFAST32	"i"	/* int_fast32_t		*/
701.1Scherry#define	PRIiFAST64	"li"	/* int_fast64_t		*/
711.1Scherry#define	PRIiMAX		"li"	/* intmax_t		*/
721.1Scherry#define	PRIiPTR		"li"	/* intptr_t		*/
731.1Scherry
741.1Scherry/* fprintf macros for unsigned integers */
751.1Scherry
761.1Scherry#define	PRIo8		"o"	/* uint8_t		*/
771.1Scherry#define	PRIo16		"o"	/* uint16_t		*/
781.1Scherry#define	PRIo32		"o"	/* uint32_t		*/
791.1Scherry#define	PRIo64		"lo"	/* uint64_t		*/
801.1Scherry#define	PRIoLEAST8	"o"	/* uint_least8_t	*/
811.1Scherry#define	PRIoLEAST16	"o"	/* uint_least16_t	*/
821.1Scherry#define	PRIoLEAST32	"o"	/* uint_least32_t	*/
831.1Scherry#define	PRIoLEAST64	"lo"	/* uint_least64_t	*/
841.1Scherry#define	PRIoFAST8	"o"	/* uint_fast8_t		*/
851.1Scherry#define	PRIoFAST16	"o"	/* uint_fast16_t	*/
861.1Scherry#define	PRIoFAST32	"o"	/* uint_fast32_t	*/
871.1Scherry#define	PRIoFAST64	"lo"	/* uint_fast64_t	*/
881.1Scherry#define	PRIoMAX		"lo"	/* uintmax_t		*/
891.1Scherry#define	PRIoPTR		"lo"	/* uintptr_t		*/
901.1Scherry
911.1Scherry#define	PRIu8		"u"	/* uint8_t		*/
921.1Scherry#define	PRIu16		"u"	/* uint16_t		*/
931.1Scherry#define	PRIu32		"u"	/* uint32_t		*/
941.1Scherry#define	PRIu64		"lu"	/* uint64_t		*/
951.1Scherry#define	PRIuLEAST8	"u"	/* uint_least8_t	*/
961.1Scherry#define	PRIuLEAST16	"u"	/* uint_least16_t	*/
971.1Scherry#define	PRIuLEAST32	"u"	/* uint_least32_t	*/
981.1Scherry#define	PRIuLEAST64	"lu"	/* uint_least64_t	*/
991.1Scherry#define	PRIuFAST8	"u"	/* uint_fast8_t		*/
1001.1Scherry#define	PRIuFAST16	"u"	/* uint_fast16_t	*/
1011.1Scherry#define	PRIuFAST32	"u"	/* uint_fast32_t	*/
1021.1Scherry#define	PRIuFAST64	"lu"	/* uint_fast64_t	*/
1031.1Scherry#define	PRIuMAX		"lu"	/* uintmax_t		*/
1041.1Scherry#define	PRIuPTR		"lu"	/* uintptr_t		*/
1051.1Scherry
1061.1Scherry#define	PRIx8		"x"	/* uint8_t		*/
1071.1Scherry#define	PRIx16		"x"	/* uint16_t		*/
1081.1Scherry#define	PRIx32		"x"	/* uint32_t		*/
1091.1Scherry#define	PRIx64		"lx"	/* uint64_t		*/
1101.1Scherry#define	PRIxLEAST8	"x"	/* uint_least8_t	*/
1111.1Scherry#define	PRIxLEAST16	"x"	/* uint_least16_t	*/
1121.1Scherry#define	PRIxLEAST32	"x"	/* uint_least32_t	*/
1131.1Scherry#define	PRIxLEAST64	"lx"	/* uint_least64_t	*/
1141.1Scherry#define	PRIxFAST8	"x"	/* uint_fast8_t		*/
1151.1Scherry#define	PRIxFAST16	"x"	/* uint_fast16_t	*/
1161.1Scherry#define	PRIxFAST32	"x"	/* uint_fast32_t	*/
1171.1Scherry#define	PRIxFAST64	"lx"	/* uint_fast64_t	*/
1181.1Scherry#define	PRIxMAX		"lx"	/* uintmax_t		*/
1191.1Scherry#define	PRIxPTR		"lx"	/* uintptr_t		*/
1201.1Scherry
1211.1Scherry#define	PRIX8		"X"	/* uint8_t		*/
1221.1Scherry#define	PRIX16		"X"	/* uint16_t		*/
1231.1Scherry#define	PRIX32		"X"	/* uint32_t		*/
1241.1Scherry#define	PRIX64		"lX"	/* uint64_t		*/
1251.1Scherry#define	PRIXLEAST8	"X"	/* uint_least8_t	*/
1261.1Scherry#define	PRIXLEAST16	"X"	/* uint_least16_t	*/
1271.1Scherry#define	PRIXLEAST32	"X"	/* uint_least32_t	*/
1281.1Scherry#define	PRIXLEAST64	"lX"	/* uint_least64_t	*/
1291.1Scherry#define	PRIXFAST8	"X"	/* uint_fast8_t		*/
1301.1Scherry#define	PRIXFAST16	"X"	/* uint_fast16_t	*/
1311.1Scherry#define	PRIXFAST32	"X"	/* uint_fast32_t	*/
1321.1Scherry#define	PRIXFAST64	"lX"	/* uint_fast64_t	*/
1331.1Scherry#define	PRIXMAX		"lX"	/* uintmax_t		*/
1341.1Scherry#define	PRIXPTR		"lX"	/* uintptr_t		*/
1351.1Scherry
1361.1Scherry/* fscanf macros for signed integers */
1371.1Scherry
1381.1Scherry#define	SCNd8		"hhd"	/* int8_t		*/
1391.1Scherry#define	SCNd16		"hd"	/* int16_t		*/
1401.1Scherry#define	SCNd32		"d"	/* int32_t		*/
1411.1Scherry#define	SCNd64		"ld"	/* int64_t		*/
1421.1Scherry#define	SCNdLEAST8	"hhd"	/* int_least8_t		*/
1431.1Scherry#define	SCNdLEAST16	"hd"	/* int_least16_t	*/
1441.1Scherry#define	SCNdLEAST32	"d"	/* int_least32_t	*/
1451.1Scherry#define	SCNdLEAST64	"ld"	/* int_least64_t	*/
1461.1Scherry#define	SCNdFAST8	"d"	/* int_fast8_t		*/
1471.1Scherry#define	SCNdFAST16	"d"	/* int_fast16_t		*/
1481.1Scherry#define	SCNdFAST32	"d"	/* int_fast32_t		*/
1491.1Scherry#define	SCNdFAST64	"ld"	/* int_fast64_t		*/
1501.1Scherry#define	SCNdMAX		"ld"	/* intmax_t		*/
1511.1Scherry#define	SCNdPTR		"ld"	/* intptr_t		*/
1521.1Scherry
1531.1Scherry#define	SCNi8		"hhi"	/* int8_t		*/
1541.1Scherry#define	SCNi16		"hi"	/* int16_t		*/
1551.1Scherry#define	SCNi32		"i"	/* int32_t		*/
1561.1Scherry#define	SCNi64		"li"	/* int64_t		*/
1571.1Scherry#define	SCNiLEAST8	"hhi"	/* int_least8_t		*/
1581.1Scherry#define	SCNiLEAST16	"hi"	/* int_least16_t	*/
1591.1Scherry#define	SCNiLEAST32	"i"	/* int_least32_t	*/
1601.1Scherry#define	SCNiLEAST64	"li"	/* int_least64_t	*/
1611.1Scherry#define	SCNiFAST8	"i"	/* int_fast8_t		*/
1621.1Scherry#define	SCNiFAST16	"i"	/* int_fast16_t		*/
1631.1Scherry#define	SCNiFAST32	"i"	/* int_fast32_t		*/
1641.1Scherry#define	SCNiFAST64	"li"	/* int_fast64_t		*/
1651.1Scherry#define	SCNiMAX		"li"	/* intmax_t		*/
1661.1Scherry#define	SCNiPTR		"li"	/* intptr_t		*/
1671.1Scherry
1681.1Scherry/* fscanf macros for unsigned integers */
1691.1Scherry
1701.1Scherry#define	SCNo8		"hho"	/* uint8_t		*/
1711.1Scherry#define	SCNo16		"ho"	/* uint16_t		*/
1721.1Scherry#define	SCNo32		"o"	/* uint32_t		*/
1731.1Scherry#define	SCNo64		"lo"	/* uint64_t		*/
1741.1Scherry#define	SCNoLEAST8	"hho"	/* uint_least8_t	*/
1751.1Scherry#define	SCNoLEAST16	"ho"	/* uint_least16_t	*/
1761.1Scherry#define	SCNoLEAST32	"o"	/* uint_least32_t	*/
1771.1Scherry#define	SCNoLEAST64	"lo"	/* uint_least64_t	*/
1781.1Scherry#define	SCNoFAST8	"o"	/* uint_fast8_t		*/
1791.1Scherry#define	SCNoFAST16	"o"	/* uint_fast16_t	*/
1801.1Scherry#define	SCNoFAST32	"o"	/* uint_fast32_t	*/
1811.1Scherry#define	SCNoFAST64	"lo"	/* uint_fast64_t	*/
1821.1Scherry#define	SCNoMAX		"lo"	/* uintmax_t		*/
1831.1Scherry#define	SCNoPTR		"lo"	/* uintptr_t		*/
1841.1Scherry
1851.1Scherry#define	SCNu8		"hhu"	/* uint8_t		*/
1861.1Scherry#define	SCNu16		"hu"	/* uint16_t		*/
1871.1Scherry#define	SCNu32		"u"	/* uint32_t		*/
1881.1Scherry#define	SCNu64		"lu"	/* uint64_t		*/
1891.1Scherry#define	SCNuLEAST8	"hhu"	/* uint_least8_t	*/
1901.1Scherry#define	SCNuLEAST16	"hu"	/* uint_least16_t	*/
1911.1Scherry#define	SCNuLEAST32	"u"	/* uint_least32_t	*/
1921.1Scherry#define	SCNuLEAST64	"lu"	/* uint_least64_t	*/
1931.1Scherry#define	SCNuFAST8	"u"	/* uint_fast8_t		*/
1941.1Scherry#define	SCNuFAST16	"u"	/* uint_fast16_t	*/
1951.1Scherry#define	SCNuFAST32	"u"	/* uint_fast32_t	*/
1961.1Scherry#define	SCNuFAST64	"lu"	/* uint_fast64_t	*/
1971.1Scherry#define	SCNuMAX		"lu"	/* uintmax_t		*/
1981.1Scherry#define	SCNuPTR		"lu"	/* uintptr_t		*/
1991.1Scherry
2001.1Scherry#define	SCNx8		"hhx"	/* uint8_t		*/
2011.1Scherry#define	SCNx16		"hx"	/* uint16_t		*/
2021.1Scherry#define	SCNx32		"x"	/* uint32_t		*/
2031.1Scherry#define	SCNx64		"lx"	/* uint64_t		*/
2041.1Scherry#define	SCNxLEAST8	"hhx"	/* uint_least8_t	*/
2051.1Scherry#define	SCNxLEAST16	"hx"	/* uint_least16_t	*/
2061.1Scherry#define	SCNxLEAST32	"x"	/* uint_least32_t	*/
2071.1Scherry#define	SCNxLEAST64	"lx"	/* uint_least64_t	*/
2081.1Scherry#define	SCNxFAST8	"x"	/* uint_fast8_t		*/
2091.1Scherry#define	SCNxFAST16	"x"	/* uint_fast16_t	*/
2101.1Scherry#define	SCNxFAST32	"x"	/* uint_fast32_t	*/
2111.1Scherry#define	SCNxFAST64	"lx"	/* uint_fast64_t	*/
2121.1Scherry#define	SCNxMAX		"lx"	/* uintmax_t		*/
2131.1Scherry#define	SCNxPTR		"lx"	/* uintptr_t		*/
2141.1Scherry
2151.3Smatt#endif /* !__INTPTR_FMTd__ */
2161.3Smatt
2171.1Scherry#endif /* !_IA64_INT_FMTIO_H_ */
218