Update.
[glibc.git] / sysdeps / wordsize-32 / inttypes.h
blob5897fdab19f160d89fdc5798547eda36b9245816
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.5 Format conversion of integer types <inttypes.h>
23 #ifndef _INTTYPES_H
24 #define _INTTYPES_H 1
26 #include <features.h>
27 /* Get the type definitions. */
28 #include <stdint.h>
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. */
38 # define PRId8 "d"
39 # define PRId16 "d"
40 # define PRId32 "d"
41 # define PRId64 "lld"
43 # define PRIdLEAST8 "d"
44 # define PRIdLEAST16 "d"
45 # define PRIdLEAST32 "d"
46 # define PRIdLEAST64 "lld"
48 # define PRIdFAST8 "d"
49 # define PRIdFAST16 "d"
50 # define PRIdFAST32 "d"
51 # define PRIdFAST64 "lld"
54 # define PRIi8 "i"
55 # define PRIi16 "i"
56 # define PRIi32 "i"
57 # define PRIi64 "lli"
59 # define PRIiLEAST8 "i"
60 # define PRIiLEAST16 "i"
61 # define PRIiLEAST32 "i"
62 # define PRIiLEAST64 "lli"
64 # define PRIiFAST8 "i"
65 # define PRIiFAST16 "i"
66 # define PRIiFAST32 "i"
67 # define PRIiFAST64 "lli"
69 /* Octal notation. */
70 # define PRIo8 "o"
71 # define PRIo16 "o"
72 # define PRIo32 "o"
73 # define PRIo64 "llo"
75 # define PRIoLEAST8 "o"
76 # define PRIoLEAST16 "o"
77 # define PRIoLEAST32 "o"
78 # define PRIoLEAST64 "llo"
80 # define PRIoFAST8 "o"
81 # define PRIoFAST16 "o"
82 # define PRIoFAST32 "o"
83 # define PRIoFAST64 "llo"
85 /* Unsigned integers. */
86 # define PRIu8 "u"
87 # define PRIu16 "u"
88 # define PRIu32 "u"
89 # define PRIu64 "llu"
91 # define PRIuLEAST8 "u"
92 # define PRIuLEAST16 "u"
93 # define PRIuLEAST32 "u"
94 # define PRIuLEAST64 "llu"
96 # define PRIuFAST8 "u"
97 # define PRIuFAST16 "u"
98 # define PRIuFAST32 "u"
99 # define PRIuFAST64 "llu"
101 /* lowercase hexadecimal notation. */
102 # define PRIx8 "x"
103 # define PRIx16 "x"
104 # define PRIx32 "x"
105 # define PRIx64 "llx"
107 # define PRIxLEAST8 "x"
108 # define PRIxLEAST16 "x"
109 # define PRIxLEAST32 "x"
110 # define PRIxLEAST64 "llx"
112 # define PRIxFAST8 "x"
113 # define PRIxFAST16 "x"
114 # define PRIxFAST32 "x"
115 # define PRIxFAST64 "llx"
117 /* UPPERCASE hexadecimal notation. */
118 # define PRIX8 "X"
119 # define PRIX16 "X"
120 # define PRIX32 "X"
121 # define PRIX64 "llX"
123 # define PRIXLEAST8 "X"
124 # define PRIXLEAST16 "X"
125 # define PRIXLEAST32 "X"
126 # define PRIXLEAST64 "llX"
128 # define PRIXFAST8 "X"
129 # define PRIXFAST16 "X"
130 # define PRIXFAST32 "X"
131 # define PRIXFAST64 "llX"
134 /* Macros for printing `intmax_t' and `uintmax_t'. */
135 # define PRIdMAX "lld"
136 # define PRIiMAX "lli"
137 # define PRIoMAX "llo"
138 # define PRIuMAX "llu"
139 # define PRIxMAX "llx"
140 # define PRIXMAX "llX"
143 /* Macros for printing `intptr_t' and `uintptr_t'. */
144 # define PRIdPTR "d"
145 # define PRIiPTR "i"
146 # define PRIoPTR "o"
147 # define PRIuPTR "u"
148 # define PRIxPTR "x"
149 # define PRIXPTR "X"
152 /* Macros for scanning format specifiers. */
154 /* Signed decimal notation. */
155 # define SCNd8 "hhd"
156 # define SCNd16 "hd"
157 # define SCNd32 "d"
158 # define SCNd64 "lld"
160 # define SCNdLEAST8 "hhd"
161 # define SCNdLEAST16 "hd"
162 # define SCNdLEAST32 "d"
163 # define SCNdLEAST64 "lld"
165 # define SCNdFAST8 "hhd"
166 # define SCNdFAST16 "d"
167 # define SCNdFAST32 "d"
168 # define SCNdFAST64 "lld"
170 /* Signed decimal notation. */
171 # define SCNi8 "hhi"
172 # define SCNi16 "hi"
173 # define SCNi32 "i"
174 # define SCNi64 "lli"
176 # define SCNiLEAST8 "hhi"
177 # define SCNiLEAST16 "hi"
178 # define SCNiLEAST32 "i"
179 # define SCNiLEAST64 "lli"
181 # define SCNiFAST8 "hhi"
182 # define SCNiFAST16 "i"
183 # define SCNiFAST32 "i"
184 # define SCNiFAST64 "lli"
186 /* Unsigned decimal notation. */
187 # define SCNu8 "hhu"
188 # define SCNu16 "hu"
189 # define SCNu32 "u"
190 # define SCNu64 "llu"
192 # define SCNuLEAST8 "hhu"
193 # define SCNuLEAST16 "hu"
194 # define SCNuLEAST32 "u"
195 # define SCNuLEAST64 "llu"
197 # define SCNuFAST8 "hhu"
198 # define SCNuFAST16 "u"
199 # define SCNuFAST32 "u"
200 # define SCNuFAST64 "llu"
202 /* Octal notation. */
203 # define SCNo8 "hho"
204 # define SCNo16 "ho"
205 # define SCNo32 "o"
206 # define SCNo64 "llo"
208 # define SCNoLEAST8 "hho"
209 # define SCNoLEAST16 "ho"
210 # define SCNoLEAST32 "o"
211 # define SCNoLEAST64 "llo"
213 # define SCNoFAST8 "hho"
214 # define SCNoFAST16 "o"
215 # define SCNoFAST32 "o"
216 # define SCNoFAST64 "llo"
218 /* Hexadecimal notation. */
219 # define SCNx8 "hhx"
220 # define SCNx16 "hx"
221 # define SCNx32 "x"
222 # define SCNx64 "llx"
224 # define SCNxLEAST8 "hhx"
225 # define SCNxLEAST16 "hx"
226 # define SCNxLEAST32 "x"
227 # define SCNxLEAST64 "llx"
229 # define SCNxFAST8 "hhx"
230 # define SCNxFAST16 "x"
231 # define SCNxFAST32 "x"
232 # define SCNxFAST64 "llx"
235 /* Macros for scanning `intmax_t' and `uintmax_t'. */
236 # define SCNdMAX "lld"
237 # define SCNiMAX "lli"
238 # define SCNoMAX "llo"
239 # define SCNuMAX "llu"
240 # define SCNxMAX "llx"
242 /* Macros for scaning `intptr_t' and `uintptr_t'. */
243 # define SCNdPTR "d"
244 # define SCNiPTR "i"
245 # define SCNoPTR "o"
246 # define SCNuPTR "u"
247 # define SCNxPTR "x"
249 #endif /* C++ && format macros */
252 __BEGIN_DECLS
254 /* Like `strtol' but convert to `intmax_t'. */
255 extern intmax_t strtoimax __P ((__const char *__restrict __nptr,
256 char **__restrict __endptr, int __base));
258 /* Like `strtoul' but convert to `uintmax_t'. */
259 extern uintmax_t strtoumax __P ((__const char * __restrict __nptr,
260 char ** __restrict __endptr, int __base));
262 /* Like `wcstol' but convert to `intmax_t'. */
263 extern intmax_t wcstoimax __P ((__const wchar_t * __restrict __nptr,
264 wchar_t **__restrict __endptr, int __base));
266 /* Like `wcstoul' but convert to `uintmax_t'. */
267 extern uintmax_t wcstoumax __P ((__const wchar_t * __restrict __nptr,
268 wchar_t ** __restrict __endptr, int __base));
270 #ifdef __USE_EXTERN_INLINES
272 /* Like `strtol' but convert to `intmax_t'. */
273 # ifndef __strtoll_internal_defined
274 __extension__
275 extern long long int __strtoll_internal __P ((__const char *__restrict __nptr,
276 char **__restrict __endptr,
277 int __base, int __group));
278 # define __strtoll_internal_defined 1
279 # endif
280 extern __inline intmax_t
281 strtoimax (__const char *__restrict nptr, char **__restrict endptr,
282 int base) __THROW
284 return __strtoll_internal (nptr, endptr, base, 0);
287 /* Like `strtoul' but convert to `uintmax_t'. */
288 # ifndef __strtoull_internal_defined
289 __extension__
290 extern unsigned long long int __strtoull_internal __P ((__const char *
291 __restrict __nptr,
292 char **
293 __restrict __endptr,
294 int __base,
295 int __group));
296 # define __strtoull_internal_defined 1
297 # endif
298 extern __inline uintmax_t
299 strtoumax (__const char *__restrict nptr, char **__restrict endptr,
300 int base) __THROW
302 return __strtoull_internal (nptr, endptr, base, 0);
305 /* Like `wcstol' but convert to `intmax_t'. */
306 # ifndef __wcstoll_internal_defined
307 __extension__
308 extern long long int __wcstoll_internal __P ((__const wchar_t *
309 __restrict __nptr,
310 wchar_t **__restrict __endptr,
311 int __base, int __group));
312 # define __wcstoll_internal_defined 1
313 # endif
314 extern __inline intmax_t
315 wcstoimax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
316 int base) __THROW
318 return __wcstoll_internal (nptr, endptr, base, 0);
322 /* Like `wcstoul' but convert to `uintmax_t'. */
323 # ifndef __wcstoull_internal_defined
324 __extension__
325 extern unsigned long long int __wcstoull_internal __P ((__const wchar_t *
326 __restrict __nptr,
327 wchar_t **
328 __restrict __endptr,
329 int __base,
330 int __group));
331 # define __wcstoull_internal_defined 1
332 # endif
333 extern __inline uintmax_t
334 wcstoumax (__const wchar_t *__restrict nptr, wchar_t **__restrict endptr,
335 int base) __THROW
337 return __wcstoull_internal (nptr, endptr, base, 0);
339 #endif /* Use extern inlines. */
341 __END_DECLS
343 #endif /* inttypes.h */