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