ICU 4.8.1.1  4.8.1.1
 All Data Structures 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-2011, 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 #if defined(U_PALMOS)
45 # include "unicode/ppalmos.h"
46 #elif !defined(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64))
47 /*
48  * platform.h is now also generated by MSVC Solution/Project files
49  * from platform.win and should always be included unless you are
50  * building stubdata which is built before the platform.h file is
51  * generated.
52  */
53 #ifndef STUBDATA_BUILD
54 # include "unicode/platform.h"
55 #endif
56 # include "unicode/pwin32.h"
57 #else
58 # include "unicode/ptypes.h" /* platform.h is included in ptypes.h */
59 #endif
60 
61 /*
62  * ANSI C headers:
63  * stddef.h defines wchar_t
64  */
65 #include <stddef.h>
66 
67 /*==========================================================================*/
68 /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */
69 /* using C++. It should not be defined when compiling under C. */
70 /*==========================================================================*/
71 
72 #ifdef __cplusplus
73 # ifndef XP_CPLUSPLUS
74 # define XP_CPLUSPLUS
75 # endif
76 #else
77 # undef XP_CPLUSPLUS
78 #endif
79 
80 /*==========================================================================*/
81 /* For C wrappers, we use the symbol U_STABLE. */
82 /* This works properly if the includer is C or C++. */
83 /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */
84 /*==========================================================================*/
85 
104 #ifdef XP_CPLUSPLUS
105 # define U_CFUNC extern "C"
106 # define U_CDECL_BEGIN extern "C" {
107 # define U_CDECL_END }
108 #else
109 # define U_CFUNC extern
110 # define U_CDECL_BEGIN
111 # define U_CDECL_END
112 #endif
113 
114 #ifndef U_ATTRIBUTE_DEPRECATED
115 
120 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
121 # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
122 
127 #elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
128 # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
129 #else
130 # define U_ATTRIBUTE_DEPRECATED
131 #endif
132 #endif
133 
135 #define U_CAPI U_CFUNC U_EXPORT
136 
137 #define U_STABLE U_CAPI
138 
139 #define U_DRAFT U_CAPI
140 
141 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
142 
143 #define U_OBSOLETE U_CAPI
144 
145 #define U_INTERNAL U_CAPI
146 
147 /*==========================================================================*/
148 /* limits for int32_t etc., like in POSIX inttypes.h */
149 /*==========================================================================*/
150 
151 #ifndef INT8_MIN
152 
153 # define INT8_MIN ((int8_t)(-128))
154 #endif
155 #ifndef INT16_MIN
156 
157 # define INT16_MIN ((int16_t)(-32767-1))
158 #endif
159 #ifndef INT32_MIN
160 
161 # define INT32_MIN ((int32_t)(-2147483647-1))
162 #endif
163 
164 #ifndef INT8_MAX
165 
166 # define INT8_MAX ((int8_t)(127))
167 #endif
168 #ifndef INT16_MAX
169 
170 # define INT16_MAX ((int16_t)(32767))
171 #endif
172 #ifndef INT32_MAX
173 
174 # define INT32_MAX ((int32_t)(2147483647))
175 #endif
176 
177 #ifndef UINT8_MAX
178 
179 # define UINT8_MAX ((uint8_t)(255U))
180 #endif
181 #ifndef UINT16_MAX
182 
183 # define UINT16_MAX ((uint16_t)(65535U))
184 #endif
185 #ifndef UINT32_MAX
186 
187 # define UINT32_MAX ((uint32_t)(4294967295U))
188 #endif
189 
190 #if defined(U_INT64_T_UNAVAILABLE)
191 # error int64_t is required for decimal format and rule-based number format.
192 #else
193 # ifndef INT64_C
194 
199 # define INT64_C(c) c ## LL
200 # endif
201 # ifndef UINT64_C
202 
207 # define UINT64_C(c) c ## ULL
208 # endif
209 # ifndef U_INT64_MIN
210 
211 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
212 # endif
213 # ifndef U_INT64_MAX
214 
215 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
216 # endif
217 # ifndef U_UINT64_MAX
218 
219 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
220 # endif
221 #endif
222 
223 /*==========================================================================*/
224 /* Boolean data type */
225 /*==========================================================================*/
226 
228 typedef int8_t UBool;
229 
230 #ifndef TRUE
231 
232 # define TRUE 1
233 #endif
234 #ifndef FALSE
235 
236 # define FALSE 0
237 #endif
238 
239 
240 /*==========================================================================*/
241 /* Unicode data types */
242 /*==========================================================================*/
243 
244 /* wchar_t-related definitions -------------------------------------------- */
245 
252 #ifndef U_HAVE_WCHAR_H
253 # define U_HAVE_WCHAR_H 1
254 #endif
255 
262 #if U_SIZEOF_WCHAR_T==0
263 # undef U_SIZEOF_WCHAR_T
264 # define U_SIZEOF_WCHAR_T 4
265 #endif
266 
267 /*
268  * \def U_WCHAR_IS_UTF16
269  * Defined if wchar_t uses UTF-16.
270  *
271  * @stable ICU 2.0
272  */
273 /*
274  * \def U_WCHAR_IS_UTF32
275  * Defined if wchar_t uses UTF-32.
276  *
277  * @stable ICU 2.0
278  */
279 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
280 # ifdef __STDC_ISO_10646__
281 # if (U_SIZEOF_WCHAR_T==2)
282 # define U_WCHAR_IS_UTF16
283 # elif (U_SIZEOF_WCHAR_T==4)
284 # define U_WCHAR_IS_UTF32
285 # endif
286 # elif defined __UCS2__
287 # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
288 # define U_WCHAR_IS_UTF16
289 # endif
290 # elif defined __UCS4__
291 # if (U_SIZEOF_WCHAR_T==4)
292 # define U_WCHAR_IS_UTF32
293 # endif
294 # elif defined(U_WINDOWS)
295 # define U_WCHAR_IS_UTF16
296 # endif
297 #endif
298 
299 /* UChar and UChar32 definitions -------------------------------------------- */
300 
302 #define U_SIZEOF_UCHAR 2
303 
316 /* Define UChar to be compatible with wchar_t if possible. */
317 #if U_SIZEOF_WCHAR_T==2
318  typedef wchar_t UChar;
319 #elif U_GNUC_UTF16_STRING
320 #if defined _GCC_
321  typedef __CHAR16_TYPE__ char16_t;
322 #endif
323  typedef char16_t UChar;
324 #else
325  typedef uint16_t UChar;
326 #endif
327 
345 typedef int32_t UChar32;
346 
347 /*==========================================================================*/
348 /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */
349 /* defined. Definitions normally are in */
350 /* platform.h or the corresponding file for */
351 /* the OS in use. */
352 /*==========================================================================*/
353 
354 #ifndef U_HIDE_INTERNAL_API
355 
362 #ifndef U_ALIGN_CODE
363 # define U_ALIGN_CODE(n)
364 #endif
365 
366 #endif /* U_HIDE_INTERNAL_API */
367 
374 #ifndef U_INLINE
375 # ifdef XP_CPLUSPLUS
376 # define U_INLINE inline
377 # else
378 # define U_INLINE
379 # endif
380 #endif
381 
382 #include "unicode/urename.h"
383 
384 #endif
Configuration constants for the Windows platform.
Basic types for the platform.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
Definition: umachine.h:345
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:325
int8_t UBool
The ICU boolean type.
Definition: umachine.h:228