ldso/mips: pltgot should array not address of array to dynamic info.
[uclibc-ng.git] / include / inttypes.h
blob137d3dbd41aa32fe11740f6cbbb51d0d23b2134a
1 /* Copyright (C) 1997-2001, 2004, 2007 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 Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the 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 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
17 02111-1307 USA. */
20 * ISO C99: 7.8 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>
30 #ifdef __UCLIBC_HAS_WCHAR__
31 /* Get a definition for wchar_t. But we must not define wchar_t itself. */
32 #ifndef ____gwchar_t_defined
33 # ifdef __cplusplus
34 # define __gwchar_t wchar_t
35 # elif defined __WCHAR_TYPE__
36 typedef __WCHAR_TYPE__ __gwchar_t;
37 # else
38 # define __need_wchar_t
39 # include <stddef.h>
40 typedef wchar_t __gwchar_t;
41 # endif
42 # define ____gwchar_t_defined 1
43 #endif
44 #endif
47 /* The ISO C99 standard specifies that these macros must only be
48 defined if explicitly requested. */
49 #if !defined __cplusplus || defined __STDC_FORMAT_MACROS
51 # if __WORDSIZE == 64
52 # define __PRI64_PREFIX "l"
53 # define __PRIPTR_PREFIX "l"
54 # else
55 # define __PRI64_PREFIX "ll"
56 # define __PRIPTR_PREFIX
57 # endif
59 /* Macros for printing format specifiers. */
61 /* Decimal notation. */
62 # define PRId8 "d"
63 # define PRId16 "d"
64 # define PRId32 "d"
65 # define PRId64 __PRI64_PREFIX "d"
67 # define PRIdLEAST8 "d"
68 # define PRIdLEAST16 "d"
69 # define PRIdLEAST32 "d"
70 # define PRIdLEAST64 __PRI64_PREFIX "d"
72 # define PRIdFAST8 "d"
73 # define PRIdFAST16 __PRIPTR_PREFIX "d"
74 # define PRIdFAST32 __PRIPTR_PREFIX "d"
75 # define PRIdFAST64 __PRI64_PREFIX "d"
78 # define PRIi8 "i"
79 # define PRIi16 "i"
80 # define PRIi32 "i"
81 # define PRIi64 __PRI64_PREFIX "i"
83 # define PRIiLEAST8 "i"
84 # define PRIiLEAST16 "i"
85 # define PRIiLEAST32 "i"
86 # define PRIiLEAST64 __PRI64_PREFIX "i"
88 # define PRIiFAST8 "i"
89 # define PRIiFAST16 __PRIPTR_PREFIX "i"
90 # define PRIiFAST32 __PRIPTR_PREFIX "i"
91 # define PRIiFAST64 __PRI64_PREFIX "i"
93 /* Octal notation. */
94 # define PRIo8 "o"
95 # define PRIo16 "o"
96 # define PRIo32 "o"
97 # define PRIo64 __PRI64_PREFIX "o"
99 # define PRIoLEAST8 "o"
100 # define PRIoLEAST16 "o"
101 # define PRIoLEAST32 "o"
102 # define PRIoLEAST64 __PRI64_PREFIX "o"
104 # define PRIoFAST8 "o"
105 # define PRIoFAST16 __PRIPTR_PREFIX "o"
106 # define PRIoFAST32 __PRIPTR_PREFIX "o"
107 # define PRIoFAST64 __PRI64_PREFIX "o"
109 /* Unsigned integers. */
110 # define PRIu8 "u"
111 # define PRIu16 "u"
112 # define PRIu32 "u"
113 # define PRIu64 __PRI64_PREFIX "u"
115 # define PRIuLEAST8 "u"
116 # define PRIuLEAST16 "u"
117 # define PRIuLEAST32 "u"
118 # define PRIuLEAST64 __PRI64_PREFIX "u"
120 # define PRIuFAST8 "u"
121 # define PRIuFAST16 __PRIPTR_PREFIX "u"
122 # define PRIuFAST32 __PRIPTR_PREFIX "u"
123 # define PRIuFAST64 __PRI64_PREFIX "u"
125 /* lowercase hexadecimal notation. */
126 # define PRIx8 "x"
127 # define PRIx16 "x"
128 # define PRIx32 "x"
129 # define PRIx64 __PRI64_PREFIX "x"
131 # define PRIxLEAST8 "x"
132 # define PRIxLEAST16 "x"
133 # define PRIxLEAST32 "x"
134 # define PRIxLEAST64 __PRI64_PREFIX "x"
136 # define PRIxFAST8 "x"
137 # define PRIxFAST16 __PRIPTR_PREFIX "x"
138 # define PRIxFAST32 __PRIPTR_PREFIX "x"
139 # define PRIxFAST64 __PRI64_PREFIX "x"
141 /* UPPERCASE hexadecimal notation. */
142 # define PRIX8 "X"
143 # define PRIX16 "X"
144 # define PRIX32 "X"
145 # define PRIX64 __PRI64_PREFIX "X"
147 # define PRIXLEAST8 "X"
148 # define PRIXLEAST16 "X"
149 # define PRIXLEAST32 "X"
150 # define PRIXLEAST64 __PRI64_PREFIX "X"
152 # define PRIXFAST8 "X"
153 # define PRIXFAST16 __PRIPTR_PREFIX "X"
154 # define PRIXFAST32 __PRIPTR_PREFIX "X"
155 # define PRIXFAST64 __PRI64_PREFIX "X"
158 /* Macros for printing `intmax_t' and `uintmax_t'. */
159 # define PRIdMAX __PRI64_PREFIX "d"
160 # define PRIiMAX __PRI64_PREFIX "i"
161 # define PRIoMAX __PRI64_PREFIX "o"
162 # define PRIuMAX __PRI64_PREFIX "u"
163 # define PRIxMAX __PRI64_PREFIX "x"
164 # define PRIXMAX __PRI64_PREFIX "X"
167 /* Macros for printing `intptr_t' and `uintptr_t'. */
168 # define PRIdPTR __PRIPTR_PREFIX "d"
169 # define PRIiPTR __PRIPTR_PREFIX "i"
170 # define PRIoPTR __PRIPTR_PREFIX "o"
171 # define PRIuPTR __PRIPTR_PREFIX "u"
172 # define PRIxPTR __PRIPTR_PREFIX "x"
173 # define PRIXPTR __PRIPTR_PREFIX "X"
176 /* Macros for scanning format specifiers. */
178 /* Signed decimal notation. */
179 # define SCNd8 "hhd"
180 # define SCNd16 "hd"
181 # define SCNd32 "d"
182 # define SCNd64 __PRI64_PREFIX "d"
184 # define SCNdLEAST8 "hhd"
185 # define SCNdLEAST16 "hd"
186 # define SCNdLEAST32 "d"
187 # define SCNdLEAST64 __PRI64_PREFIX "d"
189 # define SCNdFAST8 "hhd"
190 # define SCNdFAST16 __PRIPTR_PREFIX "d"
191 # define SCNdFAST32 __PRIPTR_PREFIX "d"
192 # define SCNdFAST64 __PRI64_PREFIX "d"
194 /* Signed decimal notation. */
195 # define SCNi8 "hhi"
196 # define SCNi16 "hi"
197 # define SCNi32 "i"
198 # define SCNi64 __PRI64_PREFIX "i"
200 # define SCNiLEAST8 "hhi"
201 # define SCNiLEAST16 "hi"
202 # define SCNiLEAST32 "i"
203 # define SCNiLEAST64 __PRI64_PREFIX "i"
205 # define SCNiFAST8 "hhi"
206 # define SCNiFAST16 __PRIPTR_PREFIX "i"
207 # define SCNiFAST32 __PRIPTR_PREFIX "i"
208 # define SCNiFAST64 __PRI64_PREFIX "i"
210 /* Unsigned decimal notation. */
211 # define SCNu8 "hhu"
212 # define SCNu16 "hu"
213 # define SCNu32 "u"
214 # define SCNu64 __PRI64_PREFIX "u"
216 # define SCNuLEAST8 "hhu"
217 # define SCNuLEAST16 "hu"
218 # define SCNuLEAST32 "u"
219 # define SCNuLEAST64 __PRI64_PREFIX "u"
221 # define SCNuFAST8 "hhu"
222 # define SCNuFAST16 __PRIPTR_PREFIX "u"
223 # define SCNuFAST32 __PRIPTR_PREFIX "u"
224 # define SCNuFAST64 __PRI64_PREFIX "u"
226 /* Octal notation. */
227 # define SCNo8 "hho"
228 # define SCNo16 "ho"
229 # define SCNo32 "o"
230 # define SCNo64 __PRI64_PREFIX "o"
232 # define SCNoLEAST8 "hho"
233 # define SCNoLEAST16 "ho"
234 # define SCNoLEAST32 "o"
235 # define SCNoLEAST64 __PRI64_PREFIX "o"
237 # define SCNoFAST8 "hho"
238 # define SCNoFAST16 __PRIPTR_PREFIX "o"
239 # define SCNoFAST32 __PRIPTR_PREFIX "o"
240 # define SCNoFAST64 __PRI64_PREFIX "o"
242 /* Hexadecimal notation. */
243 # define SCNx8 "hhx"
244 # define SCNx16 "hx"
245 # define SCNx32 "x"
246 # define SCNx64 __PRI64_PREFIX "x"
248 # define SCNxLEAST8 "hhx"
249 # define SCNxLEAST16 "hx"
250 # define SCNxLEAST32 "x"
251 # define SCNxLEAST64 __PRI64_PREFIX "x"
253 # define SCNxFAST8 "hhx"
254 # define SCNxFAST16 __PRIPTR_PREFIX "x"
255 # define SCNxFAST32 __PRIPTR_PREFIX "x"
256 # define SCNxFAST64 __PRI64_PREFIX "x"
259 /* Macros for scanning `intmax_t' and `uintmax_t'. */
260 # define SCNdMAX __PRI64_PREFIX "d"
261 # define SCNiMAX __PRI64_PREFIX "i"
262 # define SCNoMAX __PRI64_PREFIX "o"
263 # define SCNuMAX __PRI64_PREFIX "u"
264 # define SCNxMAX __PRI64_PREFIX "x"
266 /* Macros for scaning `intptr_t' and `uintptr_t'. */
267 # define SCNdPTR __PRIPTR_PREFIX "d"
268 # define SCNiPTR __PRIPTR_PREFIX "i"
269 # define SCNoPTR __PRIPTR_PREFIX "o"
270 # define SCNuPTR __PRIPTR_PREFIX "u"
271 # define SCNxPTR __PRIPTR_PREFIX "x"
273 #endif /* C++ && format macros */
276 __BEGIN_DECLS
278 #if __WORDSIZE == 64
280 /* We have to define the `uintmax_t' type using `ldiv_t'. */
281 typedef struct
283 long int quot; /* Quotient. */
284 long int rem; /* Remainder. */
285 } imaxdiv_t;
287 #else
289 /* We have to define the `uintmax_t' type using `lldiv_t'. */
290 typedef struct
292 long long int quot; /* Quotient. */
293 long long int rem; /* Remainder. */
294 } imaxdiv_t;
296 #endif
299 /* Compute absolute value of N. */
300 extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__));
302 /* Return the `imaxdiv_t' representation of the value of NUMER over DENOM. */
303 extern imaxdiv_t imaxdiv (intmax_t __numer, intmax_t __denom)
304 __THROW __attribute__ ((__const__));
306 /* Like `strtol' but convert to `intmax_t'. */
307 extern intmax_t strtoimax (__const char *__restrict __nptr,
308 char **__restrict __endptr, int __base) __THROW;
310 /* Like `strtoul' but convert to `uintmax_t'. */
311 extern uintmax_t strtoumax (__const char *__restrict __nptr,
312 char ** __restrict __endptr, int __base) __THROW;
314 #ifdef __UCLIBC_HAS_WCHAR__
315 /* Like `wcstol' but convert to `intmax_t'. */
316 extern intmax_t wcstoimax (__const __gwchar_t *__restrict __nptr,
317 __gwchar_t **__restrict __endptr, int __base)
318 __THROW;
320 /* Like `wcstoul' but convert to `uintmax_t'. */
321 extern uintmax_t wcstoumax (__const __gwchar_t *__restrict __nptr,
322 __gwchar_t ** __restrict __endptr, int __base)
323 __THROW;
324 #endif
326 #if 0 /*def __USE_EXTERN_INLINES*/
328 # if __WORDSIZE == 64
330 extern long int __strtol_internal (__const char *__restrict __nptr,
331 char **__restrict __endptr,
332 int __base, int __group)
333 __THROW __nonnull ((1)) __wur;
334 /* Like `strtol' but convert to `intmax_t'. */
335 __extern_inline intmax_t
336 __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
337 int base))
339 return __strtol_internal (nptr, endptr, base, 0);
342 extern unsigned long int __strtoul_internal (__const char *
343 __restrict __nptr,
344 char ** __restrict __endptr,
345 int __base, int __group)
346 __THROW __nonnull ((1)) __wur;
347 /* Like `strtoul' but convert to `uintmax_t'. */
348 __extern_inline uintmax_t
349 __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
350 int base))
352 return __strtoul_internal (nptr, endptr, base, 0);
355 extern long int __wcstol_internal (__const __gwchar_t * __restrict __nptr,
356 __gwchar_t **__restrict __endptr,
357 int __base, int __group)
358 __THROW __nonnull ((1)) __wur;
359 /* Like `wcstol' but convert to `intmax_t'. */
360 __extern_inline intmax_t
361 __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
362 __gwchar_t **__restrict endptr, int base))
364 return __wcstol_internal (nptr, endptr, base, 0);
367 extern unsigned long int __wcstoul_internal (__const __gwchar_t *
368 __restrict __nptr,
369 __gwchar_t **
370 __restrict __endptr,
371 int __base, int __group)
372 __THROW __nonnull ((1)) __wur;
373 /* Like `wcstoul' but convert to `uintmax_t'. */
374 __extern_inline uintmax_t
375 __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
376 __gwchar_t **__restrict endptr, int base))
378 return __wcstoul_internal (nptr, endptr, base, 0);
381 # else /* __WORDSIZE == 32 */
383 __extension__
384 extern long long int __strtoll_internal (__const char *__restrict __nptr,
385 char **__restrict __endptr,
386 int __base, int __group)
387 __THROW __nonnull ((1)) __wur;
388 /* Like `strtol' but convert to `intmax_t'. */
389 __extern_inline intmax_t
390 __NTH (strtoimax (__const char *__restrict nptr, char **__restrict endptr,
391 int base))
393 return __strtoll_internal (nptr, endptr, base, 0);
396 __extension__
397 extern unsigned long long int __strtoull_internal (__const char *
398 __restrict __nptr,
399 char **
400 __restrict __endptr,
401 int __base,
402 int __group)
403 __THROW __nonnull ((1)) __wur;
404 /* Like `strtoul' but convert to `uintmax_t'. */
405 __extern_inline uintmax_t
406 __NTH (strtoumax (__const char *__restrict nptr, char **__restrict endptr,
407 int base))
409 return __strtoull_internal (nptr, endptr, base, 0);
412 __extension__
413 extern long long int __wcstoll_internal (__const __gwchar_t *
414 __restrict __nptr,
415 __gwchar_t **__restrict __endptr,
416 int __base, int __group)
417 __THROW __nonnull ((1)) __wur;
418 /* Like `wcstol' but convert to `intmax_t'. */
419 __extern_inline intmax_t
420 __NTH (wcstoimax (__const __gwchar_t *__restrict nptr,
421 __gwchar_t **__restrict endptr, int base))
423 return __wcstoll_internal (nptr, endptr, base, 0);
427 __extension__
428 extern unsigned long long int __wcstoull_internal (__const __gwchar_t *
429 __restrict __nptr,
430 __gwchar_t **
431 __restrict __endptr,
432 int __base,
433 int __group)
434 __THROW __nonnull ((1)) __wur;
435 /* Like `wcstoul' but convert to `uintmax_t'. */
436 __extern_inline uintmax_t
437 __NTH (wcstoumax (__const __gwchar_t *__restrict nptr,
438 __gwchar_t **__restrict endptr, int base))
440 return __wcstoull_internal (nptr, endptr, base, 0);
443 # endif /* __WORDSIZE == 32 */
444 #endif /* Use extern inlines. */
446 __END_DECLS
448 #endif /* inttypes.h */