1 /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
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 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
20 * ISO C 9X: 7.4 Integral types <inttypes.h>
27 /* Get the type definitions. */
31 /* The ISO C 9X standard specifies that these macros must only be
32 defined if explicitly requested. */
33 #if !defined __cplusplus || defined __STDC_FORMAT_MACROS
35 /* Macros for printing format specifiers. */
37 /* Decimal notation. */
43 # define PRIdLEAST8 "d"
44 # define PRIdLEAST16 "d"
45 # define PRIdLEAST32 "d"
46 # define PRIdLEAST64 "ld"
48 # define PRIdFAST8 "d"
49 # define PRIdFAST16 "d"
50 # define PRIdFAST32 "d"
51 # define PRIdFAST64 "ld"
59 # define PRIiLEAST8 "i"
60 # define PRIiLEAST16 "i"
61 # define PRIiLEAST32 "i"
62 # define PRIiLEAST64 "li"
64 # define PRIiFAST8 "i"
65 # define PRIiFAST16 "i"
66 # define PRIiFAST32 "i"
67 # define PRIiFAST64 "li"
75 # define PRIoLEAST8 "o"
76 # define PRIoLEAST16 "o"
77 # define PRIoLEAST32 "o"
78 # define PRIoLEAST64 "lo"
80 # define PRIoFAST8 "o"
81 # define PRIoFAST16 "o"
82 # define PRIoFAST32 "o"
83 # define PRIoFAST64 "lo"
85 /* lowercase hexadecimal notation. */
91 # define PRIxLEAST8 "x"
92 # define PRIxLEAST16 "x"
93 # define PRIxLEAST32 "x"
94 # define PRIxLEAST64 "lx"
96 # define PRIxFAST8 "x"
97 # define PRIxFAST16 "x"
98 # define PRIxFAST32 "x"
99 # define PRIxFAST64 "lx"
101 /* UPPERCASE hexadecimal notation. */
107 # define PRIXLEAST8 "X"
108 # define PRIXLEAST16 "X"
109 # define PRIXLEAST32 "X"
110 # define PRIXLEAST64 "lX"
112 # define PRIXFAST8 "X"
113 # define PRIXFAST16 "X"
114 # define PRIXFAST32 "X"
115 # define PRIXFAST64 "lX"
118 /* Unsigned integers. */
124 # define PRIuLEAST8 "u"
125 # define PRIuLEAST16 "u"
126 # define PRIuLEAST32 "u"
127 # define PRIuLEAST64 "lu"
129 # define PRIuFAST8 "u"
130 # define PRIuFAST16 "u"
131 # define PRIuFAST32 "u"
132 # define PRIuFAST64 "lu"
135 /* Macros for printing `intmax_t' and `uintmax_t'. */
136 # define PRIdMAX "ld"
137 # define PRIoMAX "lo"
138 # define PRIxMAX "lx"
139 # define PRIuMAX "lu"
142 /* Macros for printing `intptr_t' and `uintptr_t'. */
143 # define PRIdPTR "ld"
144 # define PRIoPTR "lo"
145 # define PRIxPTR "lx"
146 # define PRIuPTR "lu"
149 /* Macros for printing format specifiers. */
151 /* Decimal notation. */
167 /* Octal notation. */
173 /* Hexadecimal notation. */
180 /* Macros for scaning `intfast_t' and `uintfast_t'. */
181 # define SCNdFAST "ld"
182 # define SCNiFAST "li"
183 # define SCNoFAST "lo"
184 # define SCNxFAST "lx"
186 /* Macros for scaning `intptr_t' and `uintptr_t'. */
187 # define SCNdPTR "ld"
188 # define SCNiPTR "li"
189 # define SCNoPTR "lo"
190 # define SCNxPTR "lx"
192 #endif /* C++ && format macros */
197 /* Like `strtol' but convert to `intmax_t'. */
198 extern intmax_t strtoimax
__P ((__const
char *__restrict __nptr
,
199 char **__restrict __endptr
, int __base
));
201 /* Like `strtoul' but convert to `uintmax_t'. */
202 extern uintmax_t strtoumax
__P ((__const
char * __restrict __nptr
,
203 char ** __restrict __endptr
, int __base
));
205 /* Like `wcstol' but convert to `intmax_t'. */
206 extern intmax_t wcstoimax
__P ((__const
wchar_t * __restrict __nptr
,
207 wchar_t **__restrict __endptr
, int __base
));
209 /* Like `wcstoul' but convert to `uintmax_t'. */
210 extern uintmax_t wcstoumax
__P ((__const
wchar_t * __restrict __nptr
,
211 wchar_t ** __restrict __endptr
, int __base
));
213 #if defined __GNUC__ && __GNUC__ >= 2 && defined __OPTIMIZE__
215 /* Like `strtol' but convert to `intmax_t'. */
216 # ifndef __strtol_internal_defined
217 extern long int __strtol_internal
__P ((__const
char *__restrict __nptr
,
218 char **__restrict __endptr
,
219 int __base
, int __group
));
220 # define __strtol_internal_defined 1
222 extern __inline
intmax_t
223 strtoimax (__const
char *__restrict nptr
, char **__restrict endptr
, int base
)
225 return __strtol_internal (nptr
, endptr
, base
, 0);
228 /* Like `strtoul' but convert to `uintmax_t'. */
229 # ifndef __strtoul_internal_defined
230 extern unsigned long int __strtoul_internal
__P ((__const
char *
232 char ** __restrict __endptr
,
233 int __base
, int __group
));
234 # define __strtoul_internal_defined 1
236 extern __inline
uintmax_t
237 strtoumax (__const
char *__restrict nptr
, char **__restrict endptr
, int base
)
239 return __strtoul_internal (nptr
, endptr
, base
, 0);
242 /* Like `wcstol' but convert to `intmax_t'. */
243 # ifndef __wcstol_internal_defined
244 extern long int __wcstol_internal
__P ((__const
wchar_t * __restrict __nptr
,
245 wchar_t **__restrict __endptr
,
246 int __base
, int __group
));
247 # define __wcstol_internal_defined 1
249 extern __inline
intmax_t
250 wcstoimax (__const
wchar_t *__restrict nptr
, wchar_t **__restrict endptr
,
253 return __wcstol_internal (nptr
, endptr
, base
, 0);
257 /* Like `wcstoul' but convert to `uintmax_t'. */
258 # ifndef __wcstoul_internal_defined
259 extern unsigned long int __wcstoul_internal
__P ((__const
wchar_t *
263 int __base
, int __group
));
264 # define __wcstoul_internal_defined 1
266 extern __inline
uintmax_t
267 wcstoumax (__const
wchar_t *__restrict nptr
, wchar_t **__restrict endptr
,
270 return __wcstoul_internal (nptr
, endptr
, base
, 0);
272 #endif /* GCC and Optimization. */
276 #endif /* inttypes.h */