OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [linux/] [uClibc/] [include/] [inttypes.h] - Blame information for rev 1771

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 1325 phoenix
/* Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
2
   This file is part of the GNU C Library.
3
 
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.
8
 
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.
13
 
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.  */
18
 
19
/*
20
 *      ISO C99: 7.8 Format conversion of integer types <inttypes.h>
21
 */
22
 
23
#ifndef _INTTYPES_H
24
#define _INTTYPES_H     1
25
 
26
#include <features.h>
27
/* Get the type definitions.  */
28
#include <stdint.h>
29
 
30
#if __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
45
 
46
 
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
50
 
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
58
 
59
/* Macros for printing format specifiers.  */
60
 
61
/* Decimal notation.  */
62
# define PRId8          "d"
63
# define PRId16         "d"
64
# define PRId32         "d"
65
# define PRId64         __PRI64_PREFIX "d"
66
 
67
# define PRIdLEAST8     "d"
68
# define PRIdLEAST16    "d"
69
# define PRIdLEAST32    "d"
70
# define PRIdLEAST64    __PRI64_PREFIX "d"
71
 
72
# define PRIdFAST8      "d"
73
# define PRIdFAST16     "d"
74
# define PRIdFAST32     "d"
75
# define PRIdFAST64     __PRI64_PREFIX "d"
76
 
77
 
78
# define PRIi8          "i"
79
# define PRIi16         "i"
80
# define PRIi32         "i"
81
# define PRIi64         __PRI64_PREFIX "i"
82
 
83
# define PRIiLEAST8     "i"
84
# define PRIiLEAST16    "i"
85
# define PRIiLEAST32    "i"
86
# define PRIiLEAST64    __PRI64_PREFIX "i"
87
 
88
# define PRIiFAST8      "i"
89
# define PRIiFAST16     "i"
90
# define PRIiFAST32     "i"
91
# define PRIiFAST64     __PRI64_PREFIX "i"
92
 
93
/* Octal notation.  */
94
# define PRIo8          "o"
95
# define PRIo16         "o"
96
# define PRIo32         "o"
97
# define PRIo64         __PRI64_PREFIX "o"
98
 
99
# define PRIoLEAST8     "o"
100
# define PRIoLEAST16    "o"
101
# define PRIoLEAST32    "o"
102
# define PRIoLEAST64    __PRI64_PREFIX "o"
103
 
104
# define PRIoFAST8      "o"
105
# define PRIoFAST16     "o"
106
# define PRIoFAST32     "o"
107
# define PRIoFAST64     __PRI64_PREFIX "o"
108
 
109
/* Unsigned integers.  */
110
# define PRIu8          "u"
111
# define PRIu16         "u"
112
# define PRIu32         "u"
113
# define PRIu64         __PRI64_PREFIX "u"
114
 
115
# define PRIuLEAST8     "u"
116
# define PRIuLEAST16    "u"
117
# define PRIuLEAST32    "u"
118
# define PRIuLEAST64    __PRI64_PREFIX "u"
119
 
120
# define PRIuFAST8      "u"
121
# define PRIuFAST16     "u"
122
# define PRIuFAST32     "u"
123
# define PRIuFAST64     __PRI64_PREFIX "u"
124
 
125
/* lowercase hexadecimal notation.  */
126
# define PRIx8          "x"
127
# define PRIx16         "x"
128
# define PRIx32         "x"
129
# define PRIx64         __PRI64_PREFIX "x"
130
 
131
# define PRIxLEAST8     "x"
132
# define PRIxLEAST16    "x"
133
# define PRIxLEAST32    "x"
134
# define PRIxLEAST64    __PRI64_PREFIX "x"
135
 
136
# define PRIxFAST8      "x"
137
# define PRIxFAST16     "x"
138
# define PRIxFAST32     "x"
139
# define PRIxFAST64     __PRI64_PREFIX "x"
140
 
141
/* UPPERCASE hexadecimal notation.  */
142
# define PRIX8          "X"
143
# define PRIX16         "X"
144
# define PRIX32         "X"
145
# define PRIX64         __PRI64_PREFIX "X"
146
 
147
# define PRIXLEAST8     "X"
148
# define PRIXLEAST16    "X"
149
# define PRIXLEAST32    "X"
150
# define PRIXLEAST64    __PRI64_PREFIX "X"
151
 
152
# define PRIXFAST8      "X"
153
# define PRIXFAST16     "X"
154
# define PRIXFAST32     "X"
155
# define PRIXFAST64     __PRI64_PREFIX "X"
156
 
157
 
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"
165
 
166
 
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"
174
 
175
 
176
/* Macros for scanning format specifiers.  */
177
 
178
/* Signed decimal notation.  */
179
# define SCNd8          "hhd"
180
# define SCNd16         "hd"
181
# define SCNd32         "d"
182
# define SCNd64         __PRI64_PREFIX "d"
183
 
184
# define SCNdLEAST8     "hhd"
185
# define SCNdLEAST16    "hd"
186
# define SCNdLEAST32    "d"
187
# define SCNdLEAST64    __PRI64_PREFIX "d"
188
 
189
# define SCNdFAST8      "hhd"
190
# define SCNdFAST16     __PRIPTR_PREFIX "d"
191
# define SCNdFAST32     __PRIPTR_PREFIX "d"
192
# define SCNdFAST64     __PRI64_PREFIX "d"
193
 
194
/* Signed decimal notation.  */
195
# define SCNi8          "hhi"
196
# define SCNi16         "hi"
197
# define SCNi32         "i"
198
# define SCNi64         __PRI64_PREFIX "i"
199
 
200
# define SCNiLEAST8     "hhi"
201
# define SCNiLEAST16    "hi"
202
# define SCNiLEAST32    "i"
203
# define SCNiLEAST64    __PRI64_PREFIX "i"
204
 
205
# define SCNiFAST8      "hhi"
206
# define SCNiFAST16     __PRIPTR_PREFIX "i"
207
# define SCNiFAST32     __PRIPTR_PREFIX "i"
208
# define SCNiFAST64     __PRI64_PREFIX "i"
209
 
210
/* Unsigned decimal notation.  */
211
# define SCNu8          "hhu"
212
# define SCNu16         "hu"
213
# define SCNu32         "u"
214
# define SCNu64         __PRI64_PREFIX "u"
215
 
216
# define SCNuLEAST8     "hhu"
217
# define SCNuLEAST16    "hu"
218
# define SCNuLEAST32    "u"
219
# define SCNuLEAST64    __PRI64_PREFIX "u"
220
 
221
# define SCNuFAST8      "hhu"
222
# define SCNuFAST16     __PRIPTR_PREFIX "u"
223
# define SCNuFAST32     __PRIPTR_PREFIX "u"
224
# define SCNuFAST64     __PRI64_PREFIX "u"
225
 
226
/* Octal notation.  */
227
# define SCNo8          "hho"
228
# define SCNo16         "ho"
229
# define SCNo32         "o"
230
# define SCNo64         __PRI64_PREFIX "o"
231
 
232
# define SCNoLEAST8     "hho"
233
# define SCNoLEAST16    "ho"
234
# define SCNoLEAST32    "o"
235
# define SCNoLEAST64    __PRI64_PREFIX "o"
236
 
237
# define SCNoFAST8      "hho"
238
# define SCNoFAST16     __PRIPTR_PREFIX "o"
239
# define SCNoFAST32     __PRIPTR_PREFIX "o"
240
# define SCNoFAST64     __PRI64_PREFIX "o"
241
 
242
/* Hexadecimal notation.  */
243
# define SCNx8          "hhx"
244
# define SCNx16         "hx"
245
# define SCNx32         "x"
246
# define SCNx64         __PRI64_PREFIX "x"
247
 
248
# define SCNxLEAST8     "hhx"
249
# define SCNxLEAST16    "hx"
250
# define SCNxLEAST32    "x"
251
# define SCNxLEAST64    __PRI64_PREFIX "x"
252
 
253
# define SCNxFAST8      "hhx"
254
# define SCNxFAST16     __PRIPTR_PREFIX "x"
255
# define SCNxFAST32     __PRIPTR_PREFIX "x"
256
# define SCNxFAST64     __PRI64_PREFIX "x"
257
 
258
 
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"
265
 
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"
272
 
273
#endif  /* C++ && format macros */
274
 
275
 
276
__BEGIN_DECLS
277
 
278
#if __WORDSIZE == 64
279
 
280
/* We have to define the `uintmax_t' type using `ldiv_t'.  */
281
typedef struct
282
  {
283
    long int quot;              /* Quotient.  */
284
    long int rem;               /* Remainder.  */
285
  } imaxdiv_t;
286
 
287
#else
288
 
289
/* We have to define the `uintmax_t' type using `lldiv_t'.  */
290
typedef struct
291
  {
292
    long long int quot;         /* Quotient.  */
293
    long long int rem;          /* Remainder.  */
294
  } imaxdiv_t;
295
 
296
#endif
297
 
298
 
299
/* Compute absolute value of N.  */
300
extern intmax_t imaxabs (intmax_t __n) __THROW __attribute__ ((__const__));
301
 
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__));
305
 
306
/* Like `strtol' but convert to `intmax_t'.  */
307
extern intmax_t strtoimax (__const char *__restrict __nptr,
308
                           char **__restrict __endptr, int __base) __THROW;
309
 
310
/* Like `strtoul' but convert to `uintmax_t'.  */
311
extern uintmax_t strtoumax (__const char *__restrict __nptr,
312
                            char ** __restrict __endptr, int __base) __THROW;
313
 
314
#if __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;
319
 
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
325
 
326
#if 0   /* disabled for uClibc */
327
#ifdef __USE_EXTERN_INLINES
328
 
329
# if __WORDSIZE == 64
330
 
331
/* Like `strtol' but convert to `intmax_t'.  */
332
#  ifndef __strtol_internal_defined
333
extern long int __strtol_internal (__const char *__restrict __nptr,
334
                                   char **__restrict __endptr,
335
                                   int __base, int __group) __THROW;
336
#   define __strtol_internal_defined    1
337
#  endif
338
extern __inline intmax_t
339
strtoimax (__const char *__restrict nptr, char **__restrict endptr,
340
           int base) __THROW
341
{
342
  return __strtol_internal (nptr, endptr, base, 0);
343
}
344
 
345
/* Like `strtoul' but convert to `uintmax_t'.  */
346
#  ifndef __strtoul_internal_defined
347
extern unsigned long int __strtoul_internal (__const char *
348
                                             __restrict __nptr,
349
                                             char ** __restrict __endptr,
350
                                             int __base, int __group) __THROW;
351
#   define __strtoul_internal_defined   1
352
#  endif
353
extern __inline uintmax_t
354
strtoumax (__const char *__restrict nptr, char **__restrict endptr,
355
           int base) __THROW
356
{
357
  return __strtoul_internal (nptr, endptr, base, 0);
358
}
359
 
360
/* Like `wcstol' but convert to `intmax_t'.  */
361
#  ifndef __wcstol_internal_defined
362
extern long int __wcstol_internal (__const __gwchar_t * __restrict __nptr,
363
                                   __gwchar_t **__restrict __endptr,
364
                                   int __base, int __group) __THROW;
365
#   define __wcstol_internal_defined    1
366
#  endif
367
extern __inline intmax_t
368
wcstoimax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
369
           int base) __THROW
370
{
371
  return __wcstol_internal (nptr, endptr, base, 0);
372
}
373
 
374
 
375
/* Like `wcstoul' but convert to `uintmax_t'.  */
376
#  ifndef __wcstoul_internal_defined
377
extern unsigned long int __wcstoul_internal (__const __gwchar_t *
378
                                             __restrict __nptr,
379
                                             __gwchar_t **
380
                                             __restrict __endptr,
381
                                             int __base, int __group) __THROW;
382
#   define __wcstoul_internal_defined   1
383
#  endif
384
extern __inline uintmax_t
385
wcstoumax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
386
           int base) __THROW
387
{
388
  return __wcstoul_internal (nptr, endptr, base, 0);
389
}
390
 
391
# else /* __WORDSIZE == 32 */
392
 
393
/* Like `strtol' but convert to `intmax_t'.  */
394
#  ifndef __strtoll_internal_defined
395
__extension__
396
extern long long int __strtoll_internal (__const char *__restrict __nptr,
397
                                         char **__restrict __endptr,
398
                                         int __base, int __group) __THROW;
399
#   define __strtoll_internal_defined   1
400
#  endif
401
extern __inline intmax_t
402
strtoimax (__const char *__restrict nptr, char **__restrict endptr,
403
           int base) __THROW
404
{
405
  return __strtoll_internal (nptr, endptr, base, 0);
406
}
407
 
408
/* Like `strtoul' but convert to `uintmax_t'.  */
409
#  ifndef __strtoull_internal_defined
410
__extension__
411
extern unsigned long long int __strtoull_internal (__const char *
412
                                                   __restrict __nptr,
413
                                                   char **
414
                                                   __restrict __endptr,
415
                                                   int __base,
416
                                                   int __group) __THROW;
417
#   define __strtoull_internal_defined  1
418
#  endif
419
extern __inline uintmax_t
420
strtoumax (__const char *__restrict nptr, char **__restrict endptr,
421
           int base) __THROW
422
{
423
  return __strtoull_internal (nptr, endptr, base, 0);
424
}
425
 
426
/* Like `wcstol' but convert to `intmax_t'.  */
427
#  ifndef __wcstoll_internal_defined
428
__extension__
429
extern long long int __wcstoll_internal (__const __gwchar_t *
430
                                         __restrict __nptr,
431
                                         __gwchar_t **__restrict __endptr,
432
                                         int __base, int __group) __THROW;
433
#   define __wcstoll_internal_defined   1
434
#  endif
435
extern __inline intmax_t
436
wcstoimax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
437
           int base) __THROW
438
{
439
  return __wcstoll_internal (nptr, endptr, base, 0);
440
}
441
 
442
 
443
/* Like `wcstoul' but convert to `uintmax_t'.  */
444
#  ifndef __wcstoull_internal_defined
445
__extension__
446
extern unsigned long long int __wcstoull_internal (__const __gwchar_t *
447
                                                   __restrict __nptr,
448
                                                   __gwchar_t **
449
                                                   __restrict __endptr,
450
                                                   int __base,
451
                                                   int __group) __THROW;
452
#   define __wcstoull_internal_defined  1
453
#  endif
454
extern __inline uintmax_t
455
wcstoumax (__const __gwchar_t *__restrict nptr, __gwchar_t **__restrict endptr,
456
           int base) __THROW
457
{
458
  return __wcstoull_internal (nptr, endptr, base, 0);
459
}
460
# endif /* __WORDSIZE == 32     */
461
#endif  /* Use extern inlines.  */
462
#endif  /* disabled for uClibc */
463
 
464
 
465
__END_DECLS
466
 
467
#endif /* inttypes.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.