ICU 50.1.2  50.1.2
umachine.h
Go to the documentation of this file.
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1999-2012, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ******************************************************************************
8 * file name: umachine.h
9 * encoding: US-ASCII
10 * tab size: 8 (not used)
11 * indentation:4
12 *
13 * created on: 1999sep13
14 * created by: Markus W. Scherer
15 *
16 * This file defines basic types and constants for utf.h to be
17 * platform-independent. umachine.h and utf.h are included into
18 * utypes.h to provide all the general definitions for ICU.
19 * All of these definitions used to be in utypes.h before
20 * the UTF-handling macros made this unmaintainable.
21 */
22 
23 #ifndef __UMACHINE_H__
24 #define __UMACHINE_H__
25 
26 
39 /*==========================================================================*/
40 /* Include platform-dependent definitions */
41 /* which are contained in the platform-specific file platform.h */
42 /*==========================================================================*/
43 
44 #include "unicode/ptypes.h" /* platform.h is included in ptypes.h */
45 
46 /*
47  * ANSI C headers:
48  * stddef.h defines wchar_t
49  */
50 #include <stddef.h>
51 
52 /*==========================================================================*/
53 /* For C wrappers, we use the symbol U_STABLE. */
54 /* This works properly if the includer is C or C++. */
55 /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */
56 /*==========================================================================*/
57 
76 #ifdef __cplusplus
77 # define U_CFUNC extern "C"
78 # define U_CDECL_BEGIN extern "C" {
79 # define U_CDECL_END }
80 #else
81 # define U_CFUNC extern
82 # define U_CDECL_BEGIN
83 # define U_CDECL_END
84 #endif
85 
86 #ifndef U_ATTRIBUTE_DEPRECATED
87 
92 #if U_GCC_MAJOR_MINOR >= 302
93 # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
94 
99 #elif defined(_MSC_VER) && (_MSC_VER >= 1400)
100 # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
101 #else
102 # define U_ATTRIBUTE_DEPRECATED
103 #endif
104 #endif
105 
107 #define U_CAPI U_CFUNC U_EXPORT
108 
109 #define U_STABLE U_CAPI
110 
111 #define U_DRAFT U_CAPI
112 
113 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
114 
115 #define U_OBSOLETE U_CAPI
116 
117 #define U_INTERNAL U_CAPI
118 
119 /*==========================================================================*/
120 /* limits for int32_t etc., like in POSIX inttypes.h */
121 /*==========================================================================*/
122 
123 #ifndef INT8_MIN
124 
125 # define INT8_MIN ((int8_t)(-128))
126 #endif
127 #ifndef INT16_MIN
128 
129 # define INT16_MIN ((int16_t)(-32767-1))
130 #endif
131 #ifndef INT32_MIN
132 
133 # define INT32_MIN ((int32_t)(-2147483647-1))
134 #endif
135 
136 #ifndef INT8_MAX
137 
138 # define INT8_MAX ((int8_t)(127))
139 #endif
140 #ifndef INT16_MAX
141 
142 # define INT16_MAX ((int16_t)(32767))
143 #endif
144 #ifndef INT32_MAX
145 
146 # define INT32_MAX ((int32_t)(2147483647))
147 #endif
148 
149 #ifndef UINT8_MAX
150 
151 # define UINT8_MAX ((uint8_t)(255U))
152 #endif
153 #ifndef UINT16_MAX
154 
155 # define UINT16_MAX ((uint16_t)(65535U))
156 #endif
157 #ifndef UINT32_MAX
158 
159 # define UINT32_MAX ((uint32_t)(4294967295U))
160 #endif
161 
162 #if defined(U_INT64_T_UNAVAILABLE)
163 # error int64_t is required for decimal format and rule-based number format.
164 #else
165 # ifndef INT64_C
166 
171 # define INT64_C(c) c ## LL
172 # endif
173 # ifndef UINT64_C
174 
179 # define UINT64_C(c) c ## ULL
180 # endif
181 # ifndef U_INT64_MIN
182 
183 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
184 # endif
185 # ifndef U_INT64_MAX
186 
187 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
188 # endif
189 # ifndef U_UINT64_MAX
190 
191 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
192 # endif
193 #endif
194 
195 /*==========================================================================*/
196 /* Boolean data type */
197 /*==========================================================================*/
198 
200 typedef int8_t UBool;
201 
202 #ifndef TRUE
203 
204 # define TRUE 1
205 #endif
206 #ifndef FALSE
207 
208 # define FALSE 0
209 #endif
210 
211 
212 /*==========================================================================*/
213 /* Unicode data types */
214 /*==========================================================================*/
215 
216 /* wchar_t-related definitions -------------------------------------------- */
217 
218 /*
219  * \def U_WCHAR_IS_UTF16
220  * Defined if wchar_t uses UTF-16.
221  *
222  * @stable ICU 2.0
223  */
224 /*
225  * \def U_WCHAR_IS_UTF32
226  * Defined if wchar_t uses UTF-32.
227  *
228  * @stable ICU 2.0
229  */
230 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
231 # ifdef __STDC_ISO_10646__
232 # if (U_SIZEOF_WCHAR_T==2)
233 # define U_WCHAR_IS_UTF16
234 # elif (U_SIZEOF_WCHAR_T==4)
235 # define U_WCHAR_IS_UTF32
236 # endif
237 # elif defined __UCS2__
238 # if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2)
239 # define U_WCHAR_IS_UTF16
240 # endif
241 # elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__))
242 # if (U_SIZEOF_WCHAR_T==4)
243 # define U_WCHAR_IS_UTF32
244 # endif
245 # elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED)
246 # define U_WCHAR_IS_UTF32
247 # elif U_PLATFORM_HAS_WIN32_API
248 # define U_WCHAR_IS_UTF16
249 # endif
250 #endif
251 
252 /* UChar and UChar32 definitions -------------------------------------------- */
253 
255 #define U_SIZEOF_UCHAR 2
256 
269 #if defined(UCHAR_TYPE)
270  typedef UCHAR_TYPE UChar;
271 /* Not #elif U_HAVE_CHAR16_T -- because that is type-incompatible with pre-C++11 callers
272  typedef char16_t UChar; */
273 #elif U_SIZEOF_WCHAR_T==2
274  typedef wchar_t UChar;
275 #elif defined(__CHAR16_TYPE__)
276  typedef __CHAR16_TYPE__ UChar;
277 #else
278  typedef uint16_t UChar;
279 #endif
280 
298 typedef int32_t UChar32;
299 
318 #define U_SENTINEL (-1)
319 
320 #include "unicode/urename.h"
321 
322 #endif
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:298
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:278
C API: Definitions of integer types of various widths.
int8_t UBool
The ICU boolean type.
Definition: umachine.h:200