Tizen RT Libs&Environment  v1.0 D5
inttypes.h
Go to the documentation of this file.
1 /****************************************************************************
2  *
3  * Copyright 2016 Samsung Electronics All Rights Reserved.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing,
12  * software distributed under the License is distributed on an
13  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
14  * either express or implied. See the License for the specific
15  * language governing permissions and limitations under the License.
16  *
17  ****************************************************************************/
18 /****************************************************************************
19  * include/inttypes.h
20  *
21  * Copyright (C) 2010 Gregory Nutt. All rights reserved.
22  * Author: Gregory Nutt <gnutt@nuttx.org>
23  *
24  * Redistribution and use in source and binary forms, with or without
25  * modification, are permitted provided that the following conditions
26  * are met:
27  *
28  * 1. Redistributions of source code must retain the above copyright
29  * notice, this list of conditions and the following disclaimer.
30  * 2. Redistributions in binary form must reproduce the above copyright
31  * notice, this list of conditions and the following disclaimer in
32  * the documentation and/or other materials provided with the
33  * distribution.
34  * 3. Neither the name NuttX nor the names of its contributors may be
35  * used to endorse or promote products derived from this software
36  * without specific prior written permission.
37  *
38  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
41  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
42  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
43  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
44  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
45  * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
46  * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
47  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
48  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49  * POSSIBILITY OF SUCH DAMAGE.
50  *
51  ****************************************************************************/
59 
62 #ifndef __INCLUDE_INTTYPES_H
63 #define __INCLUDE_INTTYPES_H
64 
65 /****************************************************************************
66  * Included Files
67  ****************************************************************************/
68 
69 #include <stddef.h> /* for wchar_t */
70 
71 /* Notes from www.opengroup.org:
72  *
73  * "The <inttypes.h> header shall include the <stdint.h> header."
74  */
75 
76 #include <stdint.h>
77 
78 /****************************************************************************
79  * Pre-processor Definitions
80  ****************************************************************************/
81 
82 /* "The following macros shall be defined. Each expands to a character string
83  * literal containing a conversion specifier, possibly modified by a lengt
84  * modifier, suitable for use within the format argument of a formatted
85  * input/output function when converting the corresponding integer type.
86  * These macros have the general form of PRI (character string literals for
87  * the fprintf() and fwprintf() family of functions) or SCN (character string
88  * literals for the fscanf() and fwscanf() family of functions), followed by
89  * the conversion specifier, followed by a name corresponding to a similar
90  * type name in <stdint.h>. In these names, N represents the width of the
91  * type as described in <stdint.h>. For example, PRIdFAST32 can be used in a
92  * format string to print the value of an integer of type int_fast32_t.
93  *
94  * "The fprintf() macros for signed integers are:
95  *
96  * PRIdN
97  * PRIdLEASTN
98  * PRIdFASTN
99  * PRIdMAX
100  * PRIdPTR
101  *
102  * PRIiN
103  * PRIiLEASTN
104  * PRIiFASTN
105  * PRIiMAX
106  * PRIiPTR
107  *
108  * "The fprintf() macros for unsigned integers are:
109  *
110  * PRIoN
111  * PRIoLEASTN
112  * PRIoFASTN
113  * PRIoMAX
114  * PRIoPTR
115  *
116  * PRIuN
117  * PRIuLEASTN
118  * PRIuFASTN
119  * PRIuMAX
120  * PRIuPTR
121  *
122  * PRIxN
123  * PRIxLEASTN
124  * PRIxFASTN
125  * PRIxMAX
126  * PRIxPTR
127  *
128  * PRIXN
129  * PRIXLEASTN
130  * PRIXFASTN
131  * PRIXMAX
132  * PRIXPTR
133  *
134  * "The fscanf() macros for signed integers are:
135  *
136  * SCNdN
137  * SCNdLEASTN
138  * SCNdFASTN
139  * SCNdMAX
140  * SCNdPTR
141  *
142  * SCNiN
143  * SCNiLEASTN
144  * SCNiFASTN
145  * SCNiMAX
146  * SCNiPTR
147  *
148  * "The fscanf() macros for unsigned integers are:
149  *
150  * SCNoN
151  * SCNoLEASTN
152  * SCNoFASTN
153  * SCNoMAX
154  * SCNoPTR
155  *
156  * SCNuN
157  * SCNuLEASTN
158  * SCNuFASTN
159  * SCNuMAX
160  * SCNuPTR
161  *
162  * SCNxN
163  * SCNxLEASTN
164  * SCNxFASTN
165  * SCNxMAX
166  * SCNxPTR
167  *
168  * "For each type that the implementation provides in <stdint.h>, the
169  * corresponding fprintf() and fwprintf() macros shall be defined and the
170  * corresponding fscanf() and fwscanf() macros shall be defined unless the
171  * implementation does not have a suitable modifier for the type.
172  */
173 
174 /****************************************************************************
175  * Type Definitions
176  ****************************************************************************/
177 
178 /* "The <inttypes.h> header shall include a definition of at least the
179  * following type:
180  *
181  * imaxdiv_t
182  * Structure type that is the type of the value returned by the imaxdiv()
183  * function.
184  */
185 
186 typedef void *imaxdiv_t; /* Dummy type since imaxdiv is not yet supported */
187 
188 /****************************************************************************
189  * Public Function Prototypes
190  ****************************************************************************/
191 
192 #ifdef __cplusplus
193 #define EXTERN extern "C"
194 extern "C" {
195 #else
196 #define EXTERN extern
197 #endif
198 
199 /* "The following shall be declared as functions and may also be defined as
200  * macros. Function prototypes shall be provided."
201  */
202 
207 intmax_t imaxabs(intmax_t);
212 imaxdiv_t imaxdiv(intmax_t, intmax_t);
216 intmax_t strtoimax(const char *, char **, int);
220 uintmax_t strtoumax(const char *, char **, int);
224 intmax_t wcstoimax(const wchar_t *, wchar_t **, int);
228 uintmax_t wcstoumax(const wchar_t *, wchar_t **, int);
229 
230 #if __WORDSIZE == 64
231 #define __PRI64_PREFIX "l"
232 #define __PRIPTR_PREFIX "l"
233 #else
234 #define __PRI64_PREFIX "ll"
235 #define __PRIPTR_PREFIX
236 #endif
237 
238 #define PRId64 __PRI64_PREFIX "d"
239 
243 #undef EXTERN
244 #ifdef __cplusplus
245 }
246 #endif
247 
248 #endif /* __INCLUDE_INTTYPES_H */
249 
void * imaxdiv_t
Definition: inttypes.h:186
intmax_t imaxabs(intmax_t)
POSIX APIs (refer to : http://pubs.opengroup.org/onlinepubs/9699919799/)