- support of [Strings.LanguageID]-sections for inf-files added in setupapi
[reactos.git] / reactos / lib / 3rdparty / icu4ros / icu / source / common / unicode / umachine.h
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1999-2006, 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
27 /**
28 * \file
29 * \brief Basic types and constants for UTF
30 *
31 * <h2> Basic types and constants for UTF </h2>
32 * This file defines basic types and constants for utf.h to be
33 * platform-independent. umachine.h and utf.h are included into
34 * utypes.h to provide all the general definitions for ICU.
35 * All of these definitions used to be in utypes.h before
36 * the UTF-handling macros made this unmaintainable.
37 *
38 */
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
77 /**
78 * \def U_CFUNC
79 * This is used in a declaration of a library private ICU C function.
80 * @stable ICU 2.4
81 */
82
83 /**
84 * \def U_CDECL_BEGIN
85 * This is used to begin a declaration of a library private ICU C API.
86 * @stable ICU 2.4
87 */
88
89 /**
90 * \def U_CDECL_END
91 * This is used to end a declaration of a library private ICU C API
92 * @stable ICU 2.4
93 */
94
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
105 /** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
106 #define U_CAPI U_CFUNC U_EXPORT
107 #define U_STABLE U_CAPI
108 #define U_DRAFT U_CAPI
109 #define U_DEPRECATED U_CAPI
110 #define U_OBSOLETE U_CAPI
111 #define U_INTERNAL U_CAPI
112
113 /*==========================================================================*/
114 /* limits for int32_t etc., like in POSIX inttypes.h */
115 /*==========================================================================*/
116
117 #ifndef INT8_MIN
118 /** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */
119 # define INT8_MIN ((int8_t)(-128))
120 #endif
121 #ifndef INT16_MIN
122 /** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */
123 # define INT16_MIN ((int16_t)(-32767-1))
124 #endif
125 #ifndef INT32_MIN
126 /** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */
127 # define INT32_MIN ((int32_t)(-2147483647-1))
128 #endif
129
130 #ifndef INT8_MAX
131 /** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */
132 # define INT8_MAX ((int8_t)(127))
133 #endif
134 #ifndef INT16_MAX
135 /** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */
136 # define INT16_MAX ((int16_t)(32767))
137 #endif
138 #ifndef INT32_MAX
139 /** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */
140 # define INT32_MAX ((int32_t)(2147483647))
141 #endif
142
143 #ifndef UINT8_MAX
144 /** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */
145 # define UINT8_MAX ((uint8_t)(255U))
146 #endif
147 #ifndef UINT16_MAX
148 /** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */
149 # define UINT16_MAX ((uint16_t)(65535U))
150 #endif
151 #ifndef UINT32_MAX
152 /** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */
153 # define UINT32_MAX ((uint32_t)(4294967295U))
154 #endif
155
156 #if defined(U_INT64_T_UNAVAILABLE)
157 # error int64_t is required for decimal format and rule-based number format.
158 #else
159 # ifndef INT64_C
160 /**
161 * Provides a platform independent way to specify a signed 64-bit integer constant.
162 * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
163 * @stable ICU 2.8
164 */
165 # define INT64_C(c) c ## LL
166 # endif
167 # ifndef UINT64_C
168 /**
169 * Provides a platform independent way to specify an unsigned 64-bit integer constant.
170 * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
171 * @stable ICU 2.8
172 */
173 # define UINT64_C(c) c ## ULL
174 # endif
175 # ifndef U_INT64_MIN
176 /** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */
177 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
178 # endif
179 # ifndef U_INT64_MAX
180 /** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */
181 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
182 # endif
183 # ifndef U_UINT64_MAX
184 /** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */
185 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
186 # endif
187 #endif
188
189 /*==========================================================================*/
190 /* Boolean data type */
191 /*==========================================================================*/
192
193 /** The ICU boolean type @stable ICU 2.0 */
194 typedef int8_t UBool;
195
196 #ifndef TRUE
197 /** The TRUE value of a UBool @stable ICU 2.0 */
198 # define TRUE 1
199 #endif
200 #ifndef FALSE
201 /** The FALSE value of a UBool @stable ICU 2.0 */
202 # define FALSE 0
203 #endif
204
205
206 /*==========================================================================*/
207 /* Unicode data types */
208 /*==========================================================================*/
209
210 /* wchar_t-related definitions -------------------------------------------- */
211
212 /**
213 * \def U_HAVE_WCHAR_H
214 * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
215 *
216 * @stable ICU 2.0
217 */
218 #ifndef U_HAVE_WCHAR_H
219 # define U_HAVE_WCHAR_H 1
220 #endif
221
222 /**
223 * \def U_SIZEOF_WCHAR_T
224 * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it)
225 *
226 * @stable ICU 2.0
227 */
228 #if U_SIZEOF_WCHAR_T==0
229 # undef U_SIZEOF_WCHAR_T
230 # define U_SIZEOF_WCHAR_T 4
231 #endif
232
233 /*
234 * \def U_WCHAR_IS_UTF16
235 * Defined if wchar_t uses UTF-16.
236 *
237 * @stable ICU 2.0
238 */
239 /*
240 * \def U_WCHAR_IS_UTF32
241 * Defined if wchar_t uses UTF-32.
242 *
243 * @stable ICU 2.0
244 */
245 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
246 # ifdef __STDC_ISO_10646__
247 # if (U_SIZEOF_WCHAR_T==2)
248 # define U_WCHAR_IS_UTF16
249 # elif (U_SIZEOF_WCHAR_T==4)
250 # define U_WCHAR_IS_UTF32
251 # endif
252 # elif defined __UCS2__
253 # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
254 # define U_WCHAR_IS_UTF16
255 # endif
256 # elif defined __UCS4__
257 # if (U_SIZEOF_WCHAR_T==4)
258 # define U_WCHAR_IS_UTF32
259 # endif
260 # elif defined(U_WINDOWS)
261 # define U_WCHAR_IS_UTF16
262 # endif
263 #endif
264
265 /* UChar and UChar32 definitions -------------------------------------------- */
266
267 /** Number of bytes in a UChar. @stable ICU 2.0 */
268 #define U_SIZEOF_UCHAR 2
269
270 /**
271 * \var UChar
272 * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
273 * If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
274 * This makes the definition of UChar platform-dependent
275 * but allows direct string type compatibility with platforms with
276 * 16-bit wchar_t types.
277 *
278 * @stable ICU 2.0
279 */
280
281 /* Define UChar to be compatible with wchar_t if possible. */
282 #if U_SIZEOF_WCHAR_T==2
283 typedef wchar_t UChar;
284 #else
285 typedef uint16_t UChar;
286 #endif
287
288 /**
289 * Define UChar32 as a type for single Unicode code points.
290 * UChar32 is a signed 32-bit integer (same as int32_t).
291 *
292 * The Unicode code point range is 0..0x10ffff.
293 * All other values (negative or >=0x110000) are illegal as Unicode code points.
294 * They may be used as sentinel values to indicate "done", "error"
295 * or similar non-code point conditions.
296 *
297 * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined
298 * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned)
299 * or else to be uint32_t.
300 * That is, the definition of UChar32 was platform-dependent.
301 *
302 * @see U_SENTINEL
303 * @stable ICU 2.4
304 */
305 typedef int32_t UChar32;
306
307 /*==========================================================================*/
308 /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */
309 /* defined. Definitions normally are in */
310 /* platform.h or the corresponding file for */
311 /* the OS in use. */
312 /*==========================================================================*/
313
314 #ifndef U_HIDE_INTERNAL_API
315
316 /**
317 * \def U_ALIGN_CODE
318 * This is used to align code fragments to a specific byte boundary.
319 * This is useful for getting consistent performance test results.
320 * @internal
321 */
322 #ifndef U_ALIGN_CODE
323 # define U_ALIGN_CODE(n)
324 #endif
325
326 #endif /* U_HIDE_INTERNAL_API */
327
328 #ifndef U_INLINE
329 # ifdef XP_CPLUSPLUS
330 # define U_INLINE inline
331 # else
332 # define U_INLINE
333 # endif
334 #endif
335
336 #include "unicode/urename.h"
337
338 #endif