Chameleon

Chameleon Svn Source Tree

Root/branches/Bungo/i386/include/inttypes.h

1/*
2 * Copyright (c) 2000, 2001, 2002, 2003, 2004 Apple Computer, Inc.
3 * All rights reserved.
4 *
5 * @APPLE_LICENSE_HEADER_START@
6 *
7 * The contents of this file constitute Original Code as defined in and
8 * are subject to the Apple Public Source License Version 1.1 (the
9 * "License"). You may not use this file except in compliance with the
10 * License. Please obtain a copy of the License at
11 * http://www.apple.com/publicsource and read it before using this file.
12 *
13 * This 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 OR NON-INFRINGEMENT. Please see the
18 * License for the specific language governing rights and limitations
19 * under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23
24/*
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
28 * and their ilk.
29 */
30
31/* "C++ implementations should define these macros only when
32 * __STDC_FORMAT_MACROS is defined before <inttypes.h> is included."
33 */
34#if (!defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)) && !defined(__STDC_FORMAT_MACROS_DEFINED)
35#define __STDC_FORMAT_MACROS_DEFINED
36
37# undef __PRI_8_LENGTH_MODIFIER__
38# undef __PRI_64_LENGTH_MODIFIER__
39# undef __SCN_64_LENGTH_MODIFIER__
40
41# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 > 1020
42# define __PRI_8_LENGTH_MODIFIER__ "hh"
43# define __PRI_64_LENGTH_MODIFIER__ "ll"
44# define __SCN_64_LENGTH_MODIFIER__ "ll"
45# else
46/* These could be "hh", "ll", and "ll" respectively, but that doesn't work on
47 10.2, and these do. Note that there's no way to use scanf to scan a
48 decimal into a 'char' argument on 10.2, so "hh" is used unconditionally
49 and programs that use it won't work on Jaguar. */
50# define __PRI_8_LENGTH_MODIFIER__ "" /* none */
51# define __PRI_64_LENGTH_MODIFIER__ "q"
52# define __SCN_64_LENGTH_MODIFIER__ "q"
53# endif
54# define __PRI_MAX_LENGTH_MODIFIER__ "j"
55# define __SCN_MAX_LENGTH_MODIFIER__ "j"
56
57# define PRId8 __PRI_8_LENGTH_MODIFIER__ "d"
58# define PRIi8 __PRI_8_LENGTH_MODIFIER__ "i"
59# define PRIo8 __PRI_8_LENGTH_MODIFIER__ "o"
60# define PRIu8 __PRI_8_LENGTH_MODIFIER__ "u"
61# define PRIx8 __PRI_8_LENGTH_MODIFIER__ "x"
62# define PRIX8 __PRI_8_LENGTH_MODIFIER__ "X"
63
64# define PRId16 "hd"
65# define PRIi16 "hi"
66# define PRIo16 "ho"
67# define PRIu16 "hu"
68# define PRIx16 "hx"
69# define PRIX16 "hX"
70
71# define PRId32 "d"
72# define PRIi32 "i"
73# define PRIo32 "o"
74# define PRIu32 "u"
75# define PRIx32 "x"
76# define PRIX32 "X"
77
78# define PRId64 __PRI_64_LENGTH_MODIFIER__ "d"
79# define PRIi64 __PRI_64_LENGTH_MODIFIER__ "i"
80# define PRIo64 __PRI_64_LENGTH_MODIFIER__ "o"
81# define PRIu64 __PRI_64_LENGTH_MODIFIER__ "u"
82# define PRIx64 __PRI_64_LENGTH_MODIFIER__ "x"
83# define PRIX64 __PRI_64_LENGTH_MODIFIER__ "X"
84
85# define PRIdLEAST8 PRId8
86# define PRIiLEAST8 PRIi8
87# define PRIoLEAST8 PRIo8
88# define PRIuLEAST8 PRIu8
89# define PRIxLEAST8 PRIx8
90# define PRIXLEAST8 PRIX8
91
92# define PRIdLEAST16 PRId16
93# define PRIiLEAST16 PRIi16
94# define PRIoLEAST16 PRIo16
95# define PRIuLEAST16 PRIu16
96# define PRIxLEAST16 PRIx16
97# define PRIXLEAST16 PRIX16
98
99# define PRIdLEAST32 PRId32
100# define PRIiLEAST32 PRIi32
101# define PRIoLEAST32 PRIo32
102# define PRIuLEAST32 PRIu32
103# define PRIxLEAST32 PRIx32
104# define PRIXLEAST32 PRIX32
105
106# define PRIdLEAST64 PRId64
107# define PRIiLEAST64 PRIi64
108# define PRIoLEAST64 PRIo64
109# define PRIuLEAST64 PRIu64
110# define PRIxLEAST64 PRIx64
111# define PRIXLEAST64 PRIX64
112
113# define PRIdFAST8 PRId8
114# define PRIiFAST8 PRIi8
115# define PRIoFAST8 PRIo8
116# define PRIuFAST8 PRIu8
117# define PRIxFAST8 PRIx8
118# define PRIXFAST8 PRIX8
119
120# define PRIdFAST16 PRId16
121# define PRIiFAST16 PRIi16
122# define PRIoFAST16 PRIo16
123# define PRIuFAST16 PRIu16
124# define PRIxFAST16 PRIx16
125# define PRIXFAST16 PRIX16
126
127# define PRIdFAST32 PRId32
128# define PRIiFAST32 PRIi32
129# define PRIoFAST32 PRIo32
130# define PRIuFAST32 PRIu32
131# define PRIxFAST32 PRIx32
132# define PRIXFAST32 PRIX32
133
134# define PRIdFAST64 PRId64
135# define PRIiFAST64 PRIi64
136# define PRIoFAST64 PRIo64
137# define PRIuFAST64 PRIu64
138# define PRIxFAST64 PRIx64
139# define PRIXFAST64 PRIX64
140
141/* int32_t is 'int', but intptr_t is 'long'. */
142# define PRIdPTR "ld"
143# define PRIiPTR "li"
144# define PRIoPTR "lo"
145# define PRIuPTR "lu"
146# define PRIxPTR "lx"
147# define PRIXPTR "lX"
148
149# define PRIdMAX __PRI_MAX_LENGTH_MODIFIER__ "d"
150# define PRIiMAX __PRI_MAX_LENGTH_MODIFIER__ "i"
151# define PRIoMAX __PRI_MAX_LENGTH_MODIFIER__ "o"
152# define PRIuMAX __PRI_MAX_LENGTH_MODIFIER__ "u"
153# define PRIxMAX __PRI_MAX_LENGTH_MODIFIER__ "x"
154# define PRIXMAX __PRI_MAX_LENGTH_MODIFIER__ "X"
155
156# if __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__-0 > 1020
157# define SCNd8 __PRI_8_LENGTH_MODIFIER__ "d"
158# define SCNi8 __PRI_8_LENGTH_MODIFIER__ "i"
159# define SCNo8 __PRI_8_LENGTH_MODIFIER__ "o"
160# define SCNu8 __PRI_8_LENGTH_MODIFIER__ "u"
161# define SCNx8 __PRI_8_LENGTH_MODIFIER__ "x"
162# else
163# define SCNd8 "hhd"
164# define SCNi8 "hhi"
165# define SCNo8 "hho"
166# define SCNu8 "hhu"
167# define SCNx8 "hhx"
168# endif
169
170# define SCNd16 "hd"
171# define SCNi16 "hi"
172# define SCNo16 "ho"
173# define SCNu16 "hu"
174# define SCNx16 "hx"
175
176# define SCNd32 "d"
177# define SCNi32 "i"
178# define SCNo32 "o"
179# define SCNu32 "u"
180# define SCNx32 "x"
181
182# define SCNd64 __SCN_64_LENGTH_MODIFIER__ "d"
183# define SCNi64 __SCN_64_LENGTH_MODIFIER__ "i"
184# define SCNo64 __SCN_64_LENGTH_MODIFIER__ "o"
185# define SCNu64 __SCN_64_LENGTH_MODIFIER__ "u"
186# define SCNx64 __SCN_64_LENGTH_MODIFIER__ "x"
187
188# define SCNdLEAST8 SCNd8
189# define SCNiLEAST8 SCNi8
190# define SCNoLEAST8 SCNo8
191# define SCNuLEAST8 SCNu8
192# define SCNxLEAST8 SCNx8
193
194# define SCNdLEAST16 SCNd16
195# define SCNiLEAST16 SCNi16
196# define SCNoLEAST16 SCNo16
197# define SCNuLEAST16 SCNu16
198# define SCNxLEAST16 SCNx16
199
200# define SCNdLEAST32 SCNd32
201# define SCNiLEAST32 SCNi32
202# define SCNoLEAST32 SCNo32
203# define SCNuLEAST32 SCNu32
204# define SCNxLEAST32 SCNx32
205
206# define SCNdLEAST64 SCNd64
207# define SCNiLEAST64 SCNi64
208# define SCNoLEAST64 SCNo64
209# define SCNuLEAST64 SCNu64
210# define SCNxLEAST64 SCNx64
211
212# define SCNdFAST8 SCNd8
213# define SCNiFAST8 SCNi8
214# define SCNoFAST8 SCNo8
215# define SCNuFAST8 SCNu8
216# define SCNxFAST8 SCNx8
217
218# define SCNdFAST16 SCNd16
219# define SCNiFAST16 SCNi16
220# define SCNoFAST16 SCNo16
221# define SCNuFAST16 SCNu16
222# define SCNxFAST16 SCNx16
223
224# define SCNdFAST32 SCNd32
225# define SCNiFAST32 SCNi32
226# define SCNoFAST32 SCNo32
227# define SCNuFAST32 SCNu32
228# define SCNxFAST32 SCNx32
229
230# define SCNdFAST64 SCNd64
231# define SCNiFAST64 SCNi64
232# define SCNoFAST64 SCNo64
233# define SCNuFAST64 SCNu64
234# define SCNxFAST64 SCNx64
235
236# define SCNdPTR "ld"
237# define SCNiPTR "li"
238# define SCNoPTR "lo"
239# define SCNuPTR "lu"
240# define SCNxPTR "lx"
241
242# define SCNdMAX __SCN_MAX_LENGTH_MODIFIER__ "d"
243# define SCNiMAX __SCN_MAX_LENGTH_MODIFIER__ "i"
244# define SCNoMAX __SCN_MAX_LENGTH_MODIFIER__ "o"
245# define SCNuMAX __SCN_MAX_LENGTH_MODIFIER__ "u"
246# define SCNxMAX __SCN_MAX_LENGTH_MODIFIER__ "x"
247
248#endif /* if C++, then __STDC_FORMAT_MACROS enables the above macros */
249
250#if !defined(_INTTYPES_H_)
251#define _INTTYPES_H_
252
253#include <sys/cdefs.h>/* For __BEGIN_DECLS and __END_DECLS */
254#include <_types.h>/* For __darwin_wchar_t */
255#include <stdint.h>
256
257#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
258 /* Translator is not ISO/IEC 9899:1999-compliant. */
259# if !defined(restrict)
260# define restrict
261# define __RESTRICT_KEYWORD_DEFINED__
262# endif
263#endif
264
265__BEGIN_DECLS
266
267 /* 7.8.2.1 */
268 extern intmax_t imaxabs(intmax_t j);
269
270 /* 7.8.2.2 */
271 typedef struct {
272 intmax_t quot;
273 intmax_t rem;
274 } imaxdiv_t;
275
276 extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
277
278 /* 7.8.2.3 */
279 extern intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base);
280 extern uintmax_t strtoumax(const char * restrict nptr, char ** restrict endptr, int base);
281
282#ifndef __cplusplus /* wchar_t is a built-in type in C++ */
283# ifndef_WCHAR_T
284# define_WCHAR_T
285 typedef__darwin_wchar_twchar_t;
286# endif /* _WCHAR_T */
287#endif /* __cplusplus */
288
289 /* 7.8.2.4 */
290 extern intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
291 extern uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
292
293/* Poison the following routines if -fshort-wchar is set */
294#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
295#pragma GCC poison wcstoimax wcstoumax
296#endif
297
298__END_DECLS
299
300#ifdef _USE_EXTENDED_LOCALES_
301#include <xlocale/_inttypes.h>
302#endif /* _USE_EXTENDED_LOCALES_ */
303
304/*
305 No need to #undef the __*_{8,64}_LENGTH_MODIFIER__ macros;
306 in fact, you can't #undef them, because later uses of any of
307 their dependents will *not* then do the intended substitution.
308 Expansion of a #define like this one:
309
310 #define x IDENT y
311
312 uses the cpp value of IDENT at the location where x is *expanded*,
313 not where it is #defined.
314*/
315
316#if defined(__RESTRICT_KEYWORD_DEFINED__)
317# undef restrict
318# undef __RESTRICT_KEYWORD_DEFINED__
319#endif
320
321#endif /* !_INTTYPES_H_ */
322

Archive Download this file

Revision: HEAD