ICU 54.1 54.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
umachine.h
Go to the documentation of this file.
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1999-2014, 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 ICU 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
135 #if defined(__cplusplus) && __cplusplus>=201103L
136 /* C++11 */
137 #ifndef U_OVERRIDE
138 #define U_OVERRIDE override
139 #endif
140 #ifndef U_FINAL
141 #define U_FINAL final
142 #endif
143 #else
144 /* not C++11 - define to nothing */
145 #ifndef U_OVERRIDE
146 #define U_OVERRIDE
147 #endif
148 #ifndef U_FINAL
149 #define U_FINAL
150 #endif
151 #endif
152
153 /*==========================================================================*/
154 /* limits for int32_t etc., like in POSIX inttypes.h */
155 /*==========================================================================*/
156
157 #ifndef INT8_MIN
158
159 # define INT8_MIN ((int8_t)(-128))
160 #endif
161 #ifndef INT16_MIN
162
163 # define INT16_MIN ((int16_t)(-32767-1))
164 #endif
165 #ifndef INT32_MIN
166
167 # define INT32_MIN ((int32_t)(-2147483647-1))
168 #endif
169
170 #ifndef INT8_MAX
171
172 # define INT8_MAX ((int8_t)(127))
173 #endif
174 #ifndef INT16_MAX
175
176 # define INT16_MAX ((int16_t)(32767))
177 #endif
178 #ifndef INT32_MAX
179
180 # define INT32_MAX ((int32_t)(2147483647))
181 #endif
182
183 #ifndef UINT8_MAX
184
185 # define UINT8_MAX ((uint8_t)(255U))
186 #endif
187 #ifndef UINT16_MAX
188
189 # define UINT16_MAX ((uint16_t)(65535U))
190 #endif
191 #ifndef UINT32_MAX
192
193 # define UINT32_MAX ((uint32_t)(4294967295U))
194 #endif
195
196 #if defined(U_INT64_T_UNAVAILABLE)
197 # error int64_t is required for decimal format and rule-based number format.
198 #else
199 # ifndef INT64_C
200
205 # define INT64_C(c) c ## LL
206 # endif
207 # ifndef UINT64_C
208
213 # define UINT64_C(c) c ## ULL
214 # endif
215 # ifndef U_INT64_MIN
216
217 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
218 # endif
219 # ifndef U_INT64_MAX
220
221 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
222 # endif
223 # ifndef U_UINT64_MAX
224
225 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
226 # endif
227 #endif
228
229 /*==========================================================================*/
230 /* Boolean data type */
231 /*==========================================================================*/
232
234 typedef int8_t UBool;
235
236 #ifndef TRUE
237
238 # define TRUE 1
239 #endif
240 #ifndef FALSE
241
242 # define FALSE 0
243 #endif
244
245
246 /*==========================================================================*/
247 /* Unicode data types */
248 /*==========================================================================*/
249
250 /* wchar_t-related definitions -------------------------------------------- */
251
252 /*
253 * \def U_WCHAR_IS_UTF16
254 * Defined if wchar_t uses UTF-16.
255 *
256 * @stable ICU 2.0
257 */
258 /*
259 * \def U_WCHAR_IS_UTF32
260 * Defined if wchar_t uses UTF-32.
261 *
262 * @stable ICU 2.0
263 */
264 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
265 # ifdef __STDC_ISO_10646__
266 # if (U_SIZEOF_WCHAR_T==2)
267 # define U_WCHAR_IS_UTF16
268 # elif (U_SIZEOF_WCHAR_T==4)
269 # define U_WCHAR_IS_UTF32
270 # endif
271 # elif defined __UCS2__
272 # if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2)
273 # define U_WCHAR_IS_UTF16
274 # endif
275 # elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__))
276 # if (U_SIZEOF_WCHAR_T==4)
277 # define U_WCHAR_IS_UTF32
278 # endif
279 # elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED)
280 # define U_WCHAR_IS_UTF32
281 # elif U_PLATFORM_HAS_WIN32_API
282 # define U_WCHAR_IS_UTF16
283 # endif
284 #endif
285
286 /* UChar and UChar32 definitions -------------------------------------------- */
287
289 #define U_SIZEOF_UCHAR 2
290
303 #if defined(UCHAR_TYPE)
304 typedef UCHAR_TYPE UChar;
305 /* Not #elif U_HAVE_CHAR16_T -- because that is type-incompatible with pre-C++11 callers
306 typedef char16_t UChar; */
307 #elif U_SIZEOF_WCHAR_T==2
308 typedef wchar_t UChar;
309 #elif defined(__CHAR16_TYPE__)
310 typedef __CHAR16_TYPE__ UChar;
311 #else
312 typedef uint16_t UChar;
313 #endif
314
332 typedef int32_t UChar32;
333
352 #define U_SENTINEL (-1)
353
354 #include "unicode/urename.h"
355
356 #endif