Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/modules/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#if !defined(_INTTYPES_H_)
32#define _INTTYPES_H_
33
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"
39
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"
46
47# define PRId16 "hd"
48# define PRIi16 "hi"
49# define PRIo16 "ho"
50# define PRIu16 "hu"
51# define PRIx16 "hx"
52# define PRIX16 "hX"
53
54# define PRId32 "d"
55# define PRIi32 "i"
56# define PRIo32 "o"
57# define PRIu32 "u"
58# define PRIx32 "x"
59# define PRIX32 "X"
60
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"
67
68# define PRIdLEAST8 PRId8
69# define PRIiLEAST8 PRIi8
70# define PRIoLEAST8 PRIo8
71# define PRIuLEAST8 PRIu8
72# define PRIxLEAST8 PRIx8
73# define PRIXLEAST8 PRIX8
74
75# define PRIdLEAST16 PRId16
76# define PRIiLEAST16 PRIi16
77# define PRIoLEAST16 PRIo16
78# define PRIuLEAST16 PRIu16
79# define PRIxLEAST16 PRIx16
80# define PRIXLEAST16 PRIX16
81
82# define PRIdLEAST32 PRId32
83# define PRIiLEAST32 PRIi32
84# define PRIoLEAST32 PRIo32
85# define PRIuLEAST32 PRIu32
86# define PRIxLEAST32 PRIx32
87# define PRIXLEAST32 PRIX32
88
89# define PRIdLEAST64 PRId64
90# define PRIiLEAST64 PRIi64
91# define PRIoLEAST64 PRIo64
92# define PRIuLEAST64 PRIu64
93# define PRIxLEAST64 PRIx64
94# define PRIXLEAST64 PRIX64
95
96# define PRIdFAST8 PRId8
97# define PRIiFAST8 PRIi8
98# define PRIoFAST8 PRIo8
99# define PRIuFAST8 PRIu8
100# define PRIxFAST8 PRIx8
101# define PRIXFAST8 PRIX8
102
103# define PRIdFAST16 PRId16
104# define PRIiFAST16 PRIi16
105# define PRIoFAST16 PRIo16
106# define PRIuFAST16 PRIu16
107# define PRIxFAST16 PRIx16
108# define PRIXFAST16 PRIX16
109
110# define PRIdFAST32 PRId32
111# define PRIiFAST32 PRIi32
112# define PRIoFAST32 PRIo32
113# define PRIuFAST32 PRIu32
114# define PRIxFAST32 PRIx32
115# define PRIXFAST32 PRIX32
116
117# define PRIdFAST64 PRId64
118# define PRIiFAST64 PRIi64
119# define PRIoFAST64 PRIo64
120# define PRIuFAST64 PRIu64
121# define PRIxFAST64 PRIx64
122# define PRIXFAST64 PRIX64
123
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"
131
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"
138
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"
144
145# define SCNd16 "hd"
146# define SCNi16 "hi"
147# define SCNo16 "ho"
148# define SCNu16 "hu"
149# define SCNx16 "hx"
150
151# define SCNd32 "d"
152# define SCNi32 "i"
153# define SCNo32 "o"
154# define SCNu32 "u"
155# define SCNx32 "x"
156
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"
162
163# define SCNdLEAST8 SCNd8
164# define SCNiLEAST8 SCNi8
165# define SCNoLEAST8 SCNo8
166# define SCNuLEAST8 SCNu8
167# define SCNxLEAST8 SCNx8
168
169# define SCNdLEAST16 SCNd16
170# define SCNiLEAST16 SCNi16
171# define SCNoLEAST16 SCNo16
172# define SCNuLEAST16 SCNu16
173# define SCNxLEAST16 SCNx16
174
175# define SCNdLEAST32 SCNd32
176# define SCNiLEAST32 SCNi32
177# define SCNoLEAST32 SCNo32
178# define SCNuLEAST32 SCNu32
179# define SCNxLEAST32 SCNx32
180
181# define SCNdLEAST64 SCNd64
182# define SCNiLEAST64 SCNi64
183# define SCNoLEAST64 SCNo64
184# define SCNuLEAST64 SCNu64
185# define SCNxLEAST64 SCNx64
186
187# define SCNdFAST8 SCNd8
188# define SCNiFAST8 SCNi8
189# define SCNoFAST8 SCNo8
190# define SCNuFAST8 SCNu8
191# define SCNxFAST8 SCNx8
192
193# define SCNdFAST16 SCNd16
194# define SCNiFAST16 SCNi16
195# define SCNoFAST16 SCNo16
196# define SCNuFAST16 SCNu16
197# define SCNxFAST16 SCNx16
198
199# define SCNdFAST32 SCNd32
200# define SCNiFAST32 SCNi32
201# define SCNoFAST32 SCNo32
202# define SCNuFAST32 SCNu32
203# define SCNxFAST32 SCNx32
204
205# define SCNdFAST64 SCNd64
206# define SCNiFAST64 SCNi64
207# define SCNoFAST64 SCNo64
208# define SCNuFAST64 SCNu64
209# define SCNxFAST64 SCNx64
210
211# define SCNdPTR "ld"
212# define SCNiPTR "li"
213# define SCNoPTR "lo"
214# define SCNuPTR "lu"
215# define SCNxPTR "lx"
216
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"
222
223#include <sys/cdefs.h>/* For __BEGIN_DECLS and __END_DECLS */
224#include <_types.h>/* For __darwin_wchar_t */
225#include <stdint.h>
226
227#if !defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L)
228 /* Translator is not ISO/IEC 9899:1999-compliant. */
229# if !defined(restrict)
230# define restrict
231# define __RESTRICT_KEYWORD_DEFINED__
232# endif
233#endif
234
235__BEGIN_DECLS
236
237 /* 7.8.2.1 */
238 extern intmax_t imaxabs(intmax_t j);
239
240 /* 7.8.2.2 */
241 typedef struct {
242 intmax_t quot;
243 intmax_t rem;
244 } imaxdiv_t;
245
246 extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom);
247
248 /* 7.8.2.3 */
249 extern intmax_t strtoimax(const char * restrict nptr, char ** restrict endptr, int base);
250 extern uintmax_t strtoumax(const char * restrict nptr, char ** restrict endptr, int base);
251
252#ifndef __cplusplus /* wchar_t is a built-in type in C++ */
253# ifndef_WCHAR_T
254# define_WCHAR_T
255 typedef__darwin_wchar_twchar_t;
256# endif /* _WCHAR_T */
257#endif /* __cplusplus */
258
259 /* 7.8.2.4 */
260 extern intmax_t wcstoimax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
261 extern uintmax_t wcstoumax(const wchar_t * restrict nptr, wchar_t ** restrict endptr, int base);
262
263/* Poison the following routines if -fshort-wchar is set */
264#if !defined(__cplusplus) && defined(__WCHAR_MAX__) && __WCHAR_MAX__ <= 0xffffU
265#pragma GCC poison wcstoimax wcstoumax
266#endif
267
268__END_DECLS
269
270#ifdef _USE_EXTENDED_LOCALES_
271#include <xlocale/_inttypes.h>
272#endif /* _USE_EXTENDED_LOCALES_ */
273
274/*
275 No need to #undef the __*_{8,64}_LENGTH_MODIFIER__ macros;
276 in fact, you can't #undef them, because later uses of any of
277 their dependents will *not* then do the intended substitution.
278 Expansion of a #define like this one:
279
280 #define x IDENT y
281
282 uses the cpp value of IDENT at the location where x is *expanded*,
283 not where it is #defined.
284*/
285
286#if defined(__RESTRICT_KEYWORD_DEFINED__)
287# undef restrict
288# undef __RESTRICT_KEYWORD_DEFINED__
289#endif
290
291#endif /* !_INTTYPES_H_ */
292

Archive Download this file

Revision: 2182