]>
git.saurik.com Git - apple/libc.git/blob - include/inttypes.h
2 * Copyright (c) 2000-2004, 2013 Apple Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
21 * @APPLE_LICENSE_HEADER_END@
25 * <inttypes.h> -- Standard C header, defined in ISO/IEC 9899:1999
26 * (aka "C99"), section 7.8. This defines format string conversion
27 * specifiers suitable for use within arguments to fprintf and fscanf
31 #if !defined(_INTTYPES_H_)
34 # define __PRI_8_LENGTH_MODIFIER__ "hh"
35 # define __PRI_64_LENGTH_MODIFIER__ "ll"
36 # define __SCN_64_LENGTH_MODIFIER__ "ll"
37 # define __PRI_MAX_LENGTH_MODIFIER__ "j"
38 # define __SCN_MAX_LENGTH_MODIFIER__ "j"
40 # define PRId8 __PRI_8_LENGTH_MODIFIER__ "d"
41 # define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i"
42 # define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o"
43 # define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u"
44 # define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x"
45 # define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X"
61 # define PRId64 __PRI_64_LENGTH_MODIFIER__ "d"
62 # define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i"
63 # define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o"
64 # define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u"
65 # define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x"
66 # define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X"
68 # define PRIdLEAST8 PRId8
69 # define PRIiLEAST8 PRIi8
70 # define PRIoLEAST8 PRIo8
71 # define PRIuLEAST8 PRIu8
72 # define PRIxLEAST8 PRIx8
73 # define PRIXLEAST8 PRIX8
75 # define PRIdLEAST16 PRId16
76 # define PRIiLEAST16 PRIi16
77 # define PRIoLEAST16 PRIo16
78 # define PRIuLEAST16 PRIu16
79 # define PRIxLEAST16 PRIx16
80 # define PRIXLEAST16 PRIX16
82 # define PRIdLEAST32 PRId32
83 # define PRIiLEAST32 PRIi32
84 # define PRIoLEAST32 PRIo32
85 # define PRIuLEAST32 PRIu32
86 # define PRIxLEAST32 PRIx32
87 # define PRIXLEAST32 PRIX32
89 # define PRIdLEAST64 PRId64
90 # define PRIiLEAST64 PRIi64
91 # define PRIoLEAST64 PRIo64
92 # define PRIuLEAST64 PRIu64
93 # define PRIxLEAST64 PRIx64
94 # define PRIXLEAST64 PRIX64
96 # define PRIdFAST8 PRId8
97 # define PRIiFAST8 PRIi8
98 # define PRIoFAST8 PRIo8
99 # define PRIuFAST8 PRIu8
100 # define PRIxFAST8 PRIx8
101 # define PRIXFAST8 PRIX8
103 # define PRIdFAST16 PRId16
104 # define PRIiFAST16 PRIi16
105 # define PRIoFAST16 PRIo16
106 # define PRIuFAST16 PRIu16
107 # define PRIxFAST16 PRIx16
108 # define PRIXFAST16 PRIX16
110 # define PRIdFAST32 PRId32
111 # define PRIiFAST32 PRIi32
112 # define PRIoFAST32 PRIo32
113 # define PRIuFAST32 PRIu32
114 # define PRIxFAST32 PRIx32
115 # define PRIXFAST32 PRIX32
117 # define PRIdFAST64 PRId64
118 # define PRIiFAST64 PRIi64
119 # define PRIoFAST64 PRIo64
120 # define PRIuFAST64 PRIu64
121 # define PRIxFAST64 PRIx64
122 # define PRIXFAST64 PRIX64
124 /* int32_t is 'int', but intptr_t is 'long'. */
125 # define PRIdPTR "ld"
126 # define PRIiPTR "li"
127 # define PRIoPTR "lo"
128 # define PRIuPTR "lu"
129 # define PRIxPTR "lx"
130 # define PRIXPTR "lX"
132 # define PRIdMAX __PRI_MAX_LENGTH_MODIFIER__ "d"
133 # define PRIiMAX __PRI_MAX_LENGTH_MODIFIER__ "i"
134 # define PRIoMAX __PRI_MAX_LENGTH_MODIFIER__ "o"
135 # define PRIuMAX __PRI_MAX_LENGTH_MODIFIER__ "u"
136 # define PRIxMAX __PRI_MAX_LENGTH_MODIFIER__ "x"
137 # define PRIXMAX __PRI_MAX_LENGTH_MODIFIER__ "X"
139 # define SCNd8 __PRI_8_LENGTH_MODIFIER__ "d"
140 # define SCNi8 __PRI_8_LENGTH_MODIFIER__ "i"
141 # define SCNo8 __PRI_8_LENGTH_MODIFIER__ "o"
142 # define SCNu8 __PRI_8_LENGTH_MODIFIER__ "u"
143 # define SCNx8 __PRI_8_LENGTH_MODIFIER__ "x"
157 # define SCNd64 __SCN_64_LENGTH_MODIFIER__ "d"
158 # define SCNi64 __SCN_64_LENGTH_MODIFIER__ "i"
159 # define SCNo64 __SCN_64_LENGTH_MODIFIER__ "o"
160 # define SCNu64 __SCN_64_LENGTH_MODIFIER__ "u"
161 # define SCNx64 __SCN_64_LENGTH_MODIFIER__ "x"
163 # define SCNdLEAST8 SCNd8
164 # define SCNiLEAST8 SCNi8
165 # define SCNoLEAST8 SCNo8
166 # define SCNuLEAST8 SCNu8
167 # define SCNxLEAST8 SCNx8
169 # define SCNdLEAST16 SCNd16
170 # define SCNiLEAST16 SCNi16
171 # define SCNoLEAST16 SCNo16
172 # define SCNuLEAST16 SCNu16
173 # define SCNxLEAST16 SCNx16
175 # define SCNdLEAST32 SCNd32
176 # define SCNiLEAST32 SCNi32
177 # define SCNoLEAST32 SCNo32
178 # define SCNuLEAST32 SCNu32
179 # define SCNxLEAST32 SCNx32
181 # define SCNdLEAST64 SCNd64
182 # define SCNiLEAST64 SCNi64
183 # define SCNoLEAST64 SCNo64
184 # define SCNuLEAST64 SCNu64
185 # define SCNxLEAST64 SCNx64
187 # define SCNdFAST8 SCNd8
188 # define SCNiFAST8 SCNi8
189 # define SCNoFAST8 SCNo8
190 # define SCNuFAST8 SCNu8
191 # define SCNxFAST8 SCNx8
193 # define SCNdFAST16 SCNd16
194 # define SCNiFAST16 SCNi16
195 # define SCNoFAST16 SCNo16
196 # define SCNuFAST16 SCNu16
197 # define SCNxFAST16 SCNx16
199 # define SCNdFAST32 SCNd32
200 # define SCNiFAST32 SCNi32
201 # define SCNoFAST32 SCNo32
202 # define SCNuFAST32 SCNu32
203 # define SCNxFAST32 SCNx32
205 # define SCNdFAST64 SCNd64
206 # define SCNiFAST64 SCNi64
207 # define SCNoFAST64 SCNo64
208 # define SCNuFAST64 SCNu64
209 # define SCNxFAST64 SCNx64
211 # define SCNdPTR "ld"
212 # define SCNiPTR "li"
213 # define SCNoPTR "lo"
214 # define SCNuPTR "lu"
215 # define SCNxPTR "lx"
217 # define SCNdMAX __SCN_MAX_LENGTH_MODIFIER__ "d"
218 # define SCNiMAX __SCN_MAX_LENGTH_MODIFIER__ "i"
219 # define SCNoMAX __SCN_MAX_LENGTH_MODIFIER__ "o"
220 # define SCNuMAX __SCN_MAX_LENGTH_MODIFIER__ "u"
221 # define SCNxMAX __SCN_MAX_LENGTH_MODIFIER__ "x"
223 #include <sys/cdefs.h>
224 #include <Availability.h>
227 #include <sys/_types/_wchar_t.h>
234 __OSX_AVAILABLE_STARTING(__MAC_10_4
, __IPHONE_2_0
)
244 __OSX_AVAILABLE_STARTING(__MAC_10_4
, __IPHONE_2_0
)
246 imaxdiv(intmax_t __numer
, intmax_t __denom
);
249 __OSX_AVAILABLE_STARTING(__MAC_10_4
, __IPHONE_2_0
)
251 strtoimax(const char * __restrict __nptr
,
252 char ** __restrict __endptr
,
255 __OSX_AVAILABLE_STARTING(__MAC_10_4
, __IPHONE_2_0
)
257 strtoumax(const char * __restrict __nptr
,
258 char ** __restrict __endptr
,
262 __OSX_AVAILABLE_STARTING(__MAC_10_4
, __IPHONE_2_0
)
264 wcstoimax(const wchar_t * __restrict __nptr
,
265 wchar_t ** __restrict __endptr
,
268 __OSX_AVAILABLE_STARTING(__MAC_10_4
, __IPHONE_2_0
)
270 wcstoumax(const wchar_t * __restrict __nptr
,
271 wchar_t ** __restrict __endptr
,
274 /* Poison the following routines if -fshort-wchar is set */
275 #if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
276 #pragma GCC poison wcstoimax wcstoumax
281 #ifdef _USE_EXTENDED_LOCALES_
282 #include <xlocale/_inttypes.h>
283 #endif /* _USE_EXTENDED_LOCALES_ */
286 No need to #undef the __*_{8,64}_LENGTH_MODIFIER__ macros;
287 in fact, you can't #undef them, because later uses of any of
288 their dependents will *not* then do the intended substitution.
289 Expansion of a #define like this one:
293 uses the cpp value of IDENT at the location where x is *expanded*,
294 not where it is #defined.
297 #endif /* !_INTTYPES_H_ */