]> git.sur5r.net Git - cc65/blob - include/inttypes.h
Merge pull request #849 from polluks/patch-4
[cc65] / include / inttypes.h
1 /*****************************************************************************/
2 /*                                                                           */
3 /*                                inttypes.h                                 */
4 /*                                                                           */
5 /*                    Format conversion of integer types                     */
6 /*                                                                           */
7 /*                                                                           */
8 /*                                                                           */
9 /* (C) 2002-2011, Ullrich von Bassewitz                                      */
10 /*                Roemerstrasse 52                                           */
11 /*                D-70794 Filderstadt                                        */
12 /* EMail:         uz@cc65.org                                                */
13 /*                                                                           */
14 /*                                                                           */
15 /* This software is provided 'as-is', without any expressed or implied       */
16 /* warranty.  In no event will the authors be held liable for any damages    */
17 /* arising from the use of this software.                                    */
18 /*                                                                           */
19 /* Permission is granted to anyone to use this software for any purpose,     */
20 /* including commercial applications, and to alter it and redistribute it    */
21 /* freely, subject to the following restrictions:                            */
22 /*                                                                           */
23 /* 1. The origin of this software must not be misrepresented; you must not   */
24 /*    claim that you wrote the original software. If you use this software   */
25 /*    in a product, an acknowledgment in the product documentation would be  */
26 /*    appreciated but is not required.                                       */
27 /* 2. Altered source versions must be plainly marked as such, and must not   */
28 /*    be misrepresented as being the original software.                      */
29 /* 3. This notice may not be removed or altered from any source              */
30 /*    distribution.                                                          */
31 /*                                                                           */
32 /*****************************************************************************/
33
34
35
36 /* Note: This file is not fully ISO 9899-1999 compliant because cc65 lacks
37 ** a 64 bit data types and is not able to return structs > 4 bytes. The
38 ** declarations have been adjusted accordingly or left out.
39 */
40
41
42
43 #ifndef _INTTYPES_H
44 #define _INTTYPES_H
45
46
47
48 /* inttypes.h must always include stdint.h */
49 #ifndef _STDINT_H
50 #include <stdint.h>
51 #endif
52
53
54
55 /* Standard functions */
56 intmax_t __fastcall__ imaxabs (intmax_t val);
57 intmax_t __fastcall__ strtoimax (const char* nptr, char** endptr, int base);
58 uintmax_t __fastcall__ strtoumax (const char* nptr, char** endptr, int base);
59
60
61
62 /* printf() macros for signed integers */
63 #define PRId8                   "d"
64 #define PRId16                  "d"
65 #define PRId32                  "ld"
66
67 #define PRIdLEAST8              "d"
68 #define PRIdLEAST16             "d"
69 #define PRIdLEAST32             "ld"
70
71 #define PRIdFAST8               "d"
72 #define PRIdFAST16              "d"
73 #define PRIdFAST32              "ld"
74
75 #define PRIdMAX                 "ld"
76 #define PRIdPTR                 "d"
77
78 #define PRIi8                   "i"
79 #define PRIi16                  "i"
80 #define PRIi32                  "li"
81
82 #define PRIiLEAST8              "i"
83 #define PRIiLEAST16             "i"
84 #define PRIiLEAST32             "li"
85
86 #define PRIiFAST8               "i"
87 #define PRIiFAST16              "i"
88 #define PRIiFAST32              "li"
89
90 #define PRIiMAX                 "li"
91 #define PRIiPTR                 "i"
92
93 /* fprintf() macros for unsigned integers */
94 #define PRIo8                   "o"
95 #define PRIo16                  "o"
96 #define PRIo32                  "lo"
97
98 #define PRIoLEAST8              "o"
99 #define PRIoLEAST16             "o"
100 #define PRIoLEAST32             "lo"
101
102 #define PRIoFAST8               "o"
103 #define PRIoFAST16              "o"
104 #define PRIoFAST32              "lo"
105
106 #define PRIoMAX                 "lo"
107 #define PRIoPTR                 "o"
108
109 #define PRIu8                   "u"
110 #define PRIu16                  "u"
111 #define PRIu32                  "lu"
112
113 #define PRIuLEAST8              "u"
114 #define PRIuLEAST16             "u"
115 #define PRIuLEAST32             "lu"
116
117 #define PRIuFAST8               "u"
118 #define PRIuFAST16              "u"
119 #define PRIuFAST32              "lu"
120
121 #define PRIuMAX                 "lu"
122 #define PRIuPTR                 "u"
123
124 #define PRIx8                   "x"
125 #define PRIx16                  "x"
126 #define PRIx32                  "lx"
127
128 #define PRIxLEAST8              "x"
129 #define PRIxLEAST16             "x"
130 #define PRIxLEAST32             "lx"
131
132 #define PRIxFAST8               "x"
133 #define PRIxFAST16              "x"
134 #define PRIxFAST32              "lx"
135
136 #define PRIxMAX                 "lx"
137 #define PRIxPTR                 "x"
138
139 #define PRIX8                   "X"
140 #define PRIX16                  "X"
141 #define PRIX32                  "lX"
142
143 #define PRIXLEAST8              "X"
144 #define PRIXLEAST16             "X"
145 #define PRIXLEAST32             "lX"
146
147 #define PRIXFAST8               "X"
148 #define PRIXFAST16              "X"
149 #define PRIXFAST32              "lX"
150
151 #define PRIXMAX                 "lX"
152 #define PRIXPTR                 "X"
153
154 /* fscanf() macros for signed integers */
155 #define SCNd8                   "hd"
156 #define SCNd16                  "d"
157 #define SCNd32                  "ld"
158
159 #define SCNdLEAST8              "hd"
160 #define SCNdLEAST16             "d"
161 #define SCNdLEAST32             "ld"
162
163 #define SCNdFAST8               "hd"
164 #define SCNdFAST16              "d"
165 #define SCNdFAST32              "ld"
166
167 #define SCNdMAX                 "ld"
168 #define SCNdPTR                 "d"
169
170 #define SCNi8                   "hi"
171 #define SCNi16                  "i"
172 #define SCNi32                  "li"
173
174 #define SCNiLEAST8              "hi"
175 #define SCNiLEAST16             "i"
176 #define SCNiLEAST32             "li"
177
178 #define SCNiFAST8               "hi"
179 #define SCNiFAST16              "i"
180 #define SCNiFAST32              "li"
181
182 #define SCNiMAX                 "li"
183 #define SCNiPTR                 "i"
184
185 /* fscanf() macros for unsigned integers */
186 #define SCNo8                   "ho"
187 #define SCNo16                  "o"
188 #define SCNo32                  "lo"
189
190 #define SCNoLEAST8              "ho"
191 #define SCNoLEAST16             "o"
192 #define SCNoLEAST32             "lo"
193
194 #define SCNoFAST8               "ho"
195 #define SCNoFAST16              "o"
196 #define SCNoFAST32              "lo"
197
198 #define SCNoMAX                 "lo"
199 #define SCNoPTR                 "o"
200
201 #define SCNu8                   "hu"
202 #define SCNu16                  "u"
203 #define SCNu32                  "lu"
204
205 #define SCNuLEAST8              "hu"
206 #define SCNuLEAST16             "u"
207 #define SCNuLEAST32             "lu"
208
209 #define SCNuFAST8               "hu"
210 #define SCNuFAST16              "u"
211 #define SCNuFAST32              "lu"
212
213 #define SCNuMAX                 "lu"
214 #define SCNuPTR                 "u"
215
216 #define SCNx8                   "hx"
217 #define SCNx16                  "x"
218 #define SCNx32                  "lx"
219
220 #define SCNxLEAST8              "hx"
221 #define SCNxLEAST16             "x"
222 #define SCNxLEAST32             "lx"
223
224 #define SCNxFAST8               "hx"
225 #define SCNxFAST16              "x"
226 #define SCNxFAST32              "lx"
227
228 #define SCNxMAX                 "lx"
229 #define SCNxPTR                 "x"
230
231
232
233 /* End of inttypes.h */
234 #endif
235
236
237