ICU 4.2.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-2008, 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(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
47 # include "unicode/pwin32.h"
48 #else
49 # include "unicode/platform.h"
50 #endif
51 
52 /*
53  * ANSI C headers:
54  * stddef.h defines wchar_t
55  */
56 #include <stddef.h>
57 
58 /*==========================================================================*/
59 /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */
60 /* using C++. It should not be defined when compiling under C. */
61 /*==========================================================================*/
62 
63 #ifdef __cplusplus
64 # ifndef XP_CPLUSPLUS
65 # define XP_CPLUSPLUS
66 # endif
67 #else
68 # undef XP_CPLUSPLUS
69 #endif
70 
71 /*==========================================================================*/
72 /* For C wrappers, we use the symbol U_STABLE. */
73 /* This works properly if the includer is C or C++. */
74 /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */
75 /*==========================================================================*/
76 
95 #ifdef XP_CPLUSPLUS
96 # define U_CFUNC extern "C"
97 # define U_CDECL_BEGIN extern "C" {
98 # define U_CDECL_END }
99 #else
100 # define U_CFUNC extern
101 # define U_CDECL_BEGIN
102 # define U_CDECL_END
103 #endif
104 
106 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
107 # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
108 
109 #elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
110 # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
111 #else
112 # define U_ATTRIBUTE_DEPRECATED
113 #endif
114 
115 #define U_CAPI U_CFUNC U_EXPORT
116 
117 #define U_STABLE U_CAPI
118 
119 #define U_DRAFT U_CAPI
120 
121 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
122 
123 #define U_OBSOLETE U_CAPI
124 
125 #define U_INTERNAL U_CAPI
126 
127 /*==========================================================================*/
128 /* limits for int32_t etc., like in POSIX inttypes.h */
129 /*==========================================================================*/
130 
131 #ifndef INT8_MIN
132 
133 # define INT8_MIN ((int8_t)(-128))
134 #endif
135 #ifndef INT16_MIN
136 
137 # define INT16_MIN ((int16_t)(-32767-1))
138 #endif
139 #ifndef INT32_MIN
140 
141 # define INT32_MIN ((int32_t)(-2147483647-1))
142 #endif
143 
144 #ifndef INT8_MAX
145 
146 # define INT8_MAX ((int8_t)(127))
147 #endif
148 #ifndef INT16_MAX
149 
150 # define INT16_MAX ((int16_t)(32767))
151 #endif
152 #ifndef INT32_MAX
153 
154 # define INT32_MAX ((int32_t)(2147483647))
155 #endif
156 
157 #ifndef UINT8_MAX
158 
159 # define UINT8_MAX ((uint8_t)(255U))
160 #endif
161 #ifndef UINT16_MAX
162 
163 # define UINT16_MAX ((uint16_t)(65535U))
164 #endif
165 #ifndef UINT32_MAX
166 
167 # define UINT32_MAX ((uint32_t)(4294967295U))
168 #endif
169 
170 #if defined(U_INT64_T_UNAVAILABLE)
171 # error int64_t is required for decimal format and rule-based number format.
172 #else
173 # ifndef INT64_C
174 
179 # define INT64_C(c) c ## LL
180 # endif
181 # ifndef UINT64_C
182 
187 # define UINT64_C(c) c ## ULL
188 # endif
189 # ifndef U_INT64_MIN
190 
191 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
192 # endif
193 # ifndef U_INT64_MAX
194 
195 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
196 # endif
197 # ifndef U_UINT64_MAX
198 
199 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
200 # endif
201 #endif
202 
203 /*==========================================================================*/
204 /* Boolean data type */
205 /*==========================================================================*/
206 
208 typedef int8_t UBool;
209 
210 #ifndef TRUE
211 
212 # define TRUE 1
213 #endif
214 #ifndef FALSE
215 
216 # define FALSE 0
217 #endif
218 
219 
220 /*==========================================================================*/
221 /* Unicode data types */
222 /*==========================================================================*/
223 
224 /* wchar_t-related definitions -------------------------------------------- */
225 
232 #ifndef U_HAVE_WCHAR_H
233 # define U_HAVE_WCHAR_H 1
234 #endif
235 
242 #if U_SIZEOF_WCHAR_T==0
243 # undef U_SIZEOF_WCHAR_T
244 # define U_SIZEOF_WCHAR_T 4
245 #endif
246 
247 /*
248  * \def U_WCHAR_IS_UTF16
249  * Defined if wchar_t uses UTF-16.
250  *
251  * @stable ICU 2.0
252  */
253 /*
254  * \def U_WCHAR_IS_UTF32
255  * Defined if wchar_t uses UTF-32.
256  *
257  * @stable ICU 2.0
258  */
259 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
260 # ifdef __STDC_ISO_10646__
261 # if (U_SIZEOF_WCHAR_T==2)
262 # define U_WCHAR_IS_UTF16
263 # elif (U_SIZEOF_WCHAR_T==4)
264 # define U_WCHAR_IS_UTF32
265 # endif
266 # elif defined __UCS2__
267 # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
268 # define U_WCHAR_IS_UTF16
269 # endif
270 # elif defined __UCS4__
271 # if (U_SIZEOF_WCHAR_T==4)
272 # define U_WCHAR_IS_UTF32
273 # endif
274 # elif defined(U_WINDOWS)
275 # define U_WCHAR_IS_UTF16
276 # endif
277 #endif
278 
279 /* UChar and UChar32 definitions -------------------------------------------- */
280 
282 #define U_SIZEOF_UCHAR 2
283 
295 /* Define UChar to be compatible with wchar_t if possible. */
296 #if U_SIZEOF_WCHAR_T==2
297  typedef wchar_t UChar;
298 #else
299  typedef uint16_t UChar;
300 #endif
301 
319 typedef int32_t UChar32;
320 
321 /*==========================================================================*/
322 /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */
323 /* defined. Definitions normally are in */
324 /* platform.h or the corresponding file for */
325 /* the OS in use. */
326 /*==========================================================================*/
327 
328 #ifndef U_HIDE_INTERNAL_API
329 
336 #ifndef U_ALIGN_CODE
337 # define U_ALIGN_CODE(n)
338 #endif
339 
340 #endif /* U_HIDE_INTERNAL_API */
341 
347 #ifndef U_INLINE
348 # ifdef XP_CPLUSPLUS
349 # define U_INLINE inline
350 # else
351 # define U_INLINE
352 # endif
353 #endif
354 
355 #include "unicode/urename.h"
356 
357 #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:319
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:299
signed char int8_t
Define 64 bit limits.
Definition: pwin32.h:127
unsigned short uint16_t
Define 64 bit limits.
Definition: pwin32.h:139
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208