1 | /* |
---|
2 | * This file is part of libtrace |
---|
3 | * |
---|
4 | * Copyright (c) 2007,2008,2009,2010 The University of Waikato, Hamilton, |
---|
5 | * New Zealand. |
---|
6 | * |
---|
7 | * Authors: Daniel Lawson |
---|
8 | * Perry Lorier |
---|
9 | * Shane Alcock |
---|
10 | * |
---|
11 | * All rights reserved. |
---|
12 | * |
---|
13 | * This code has been developed by the University of Waikato WAND |
---|
14 | * research group. For further information please see http://www.wand.net.nz/ |
---|
15 | * |
---|
16 | * libtrace is free software; you can redistribute it and/or modify |
---|
17 | * it under the terms of the GNU General Public License as published by |
---|
18 | * the Free Software Foundation; either version 2 of the License, or |
---|
19 | * (at your option) any later version. |
---|
20 | * |
---|
21 | * libtrace is distributed in the hope that it will be useful, |
---|
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
24 | * GNU General Public License for more details. |
---|
25 | * |
---|
26 | * You should have received a copy of the GNU General Public License |
---|
27 | * along with libtrace; if not, write to the Free Software |
---|
28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
29 | * |
---|
30 | * $Id$ |
---|
31 | * |
---|
32 | */ |
---|
33 | |
---|
34 | /** @file |
---|
35 | * |
---|
36 | * @brief Header that provides local definitions of the various format |
---|
37 | * identifiers used for printing various numeric types |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef LT_INTTYPES_H |
---|
41 | #define LT_INTTYPES_H 1 /**< Include Guard */ |
---|
42 | |
---|
43 | #ifndef PRIu64 |
---|
44 | /* We need PRIu64 and others, but inttypes.h either doesn't exist, or it |
---|
45 | * doesn't have these identifiers. We define them ourselves... |
---|
46 | */ |
---|
47 | |
---|
48 | /* The ISO C99 standard specifies that these macros must only be |
---|
49 | defined if explicitly requested. */ |
---|
50 | # if !defined __cplusplus || defined __STDC_FORMAT_MACROS |
---|
51 | |
---|
52 | # if __WORDSIZE == 64 |
---|
53 | # define __PRI64_PREFIX "l" |
---|
54 | # define __PRIPTR_PREFIX "l" |
---|
55 | # else |
---|
56 | # define __PRI64_PREFIX "ll" |
---|
57 | # define __PRIPTR_PREFIX |
---|
58 | # endif |
---|
59 | |
---|
60 | # define PRId8 "d" /**< Print format for an 8 bit integer */ |
---|
61 | # define PRId16 "d" /**< Print format for a 16 bit integer */ |
---|
62 | # define PRId32 "d" /**< Print format for a 32 bit integer */ |
---|
63 | # define PRId64 __PRI64_PREFIX "d" /**< Print format for a 64 bit integer */ |
---|
64 | |
---|
65 | # define PRIi8 "i" /**< Print format for an 8 bit integer */ |
---|
66 | # define PRIi16 "i" /**< Print format for a 16 bit integer */ |
---|
67 | # define PRIi32 "i" /**< Print format for a 32 bit integer */ |
---|
68 | # define PRIi64 __PRI64_PREFIX "i" /**< Print format for a 64 bit integer */ |
---|
69 | |
---|
70 | # define PRIo8 "o" /**< Print format for an 8 bit octal */ |
---|
71 | # define PRIo16 "o" /**< Print format for a 16 bit octal */ |
---|
72 | # define PRIo32 "o" /**< Print format for a 32 bit octal */ |
---|
73 | # define PRIo64 __PRI64_PREFIX "o" /**< Print format for a 64 bit octal */ |
---|
74 | |
---|
75 | # define PRIu8 "u" |
---|
76 | # define PRIu16 "u" |
---|
77 | # define PRIu32 "u" |
---|
78 | # define PRIu64 __PRI64_PREFIX "u" |
---|
79 | |
---|
80 | # define PRIx8 "x" |
---|
81 | # define PRIx16 "x" |
---|
82 | # define PRIx32 "x" |
---|
83 | # define PRIx64 __PRI64_PREFIX "x" |
---|
84 | |
---|
85 | # define PRIX8 "X" |
---|
86 | # define PRIX16 "X" |
---|
87 | # define PRIX32 "X" |
---|
88 | # define PRIX64 __PRI64_PREFIX "X" |
---|
89 | |
---|
90 | # endif |
---|
91 | |
---|
92 | # ifndef UINT64_MAX |
---|
93 | # if __WORDSIZE == 64 |
---|
94 | # define UINT64_MAX 18446744073709551615UL /**< Maximum value of a uint64_t */ |
---|
95 | # else |
---|
96 | # define UINT64_MAX 18446744073709551615ULL /**< Maximum value of a uint64_t */ |
---|
97 | # endif |
---|
98 | # endif |
---|
99 | |
---|
100 | #endif |
---|
101 | |
---|
102 | #endif |
---|