]>
Commit | Line | Data |
---|---|---|
b75a7d8f A |
1 | /* |
2 | ****************************************************************************** | |
3 | * | |
4 | * Copyright (C) 1999-2002, 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(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) | |
45 | # include "unicode/pwin32.h" | |
46 | #elif defined(__OS400__) | |
47 | # include "unicode/pos400.h" | |
48 | #elif defined(__MWERKS__) | |
49 | # include "unicode/pmacos.h" | |
50 | #else | |
51 | # include "unicode/platform.h" | |
52 | #endif | |
53 | ||
54 | /*==========================================================================*/ | |
55 | /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ | |
56 | /* using C++. It should not be defined when compiling under C. */ | |
57 | /*==========================================================================*/ | |
58 | ||
59 | #ifdef __cplusplus | |
60 | # ifndef XP_CPLUSPLUS | |
61 | # define XP_CPLUSPLUS | |
62 | # endif | |
63 | #else | |
64 | # undef XP_CPLUSPLUS | |
65 | #endif | |
66 | ||
67 | /*==========================================================================*/ | |
68 | /* For C wrappers, we use the symbol U_CAPI. */ | |
69 | /* This works properly if the includer is C or C++. */ | |
70 | /* Functions are declared U_CAPI return-type U_EXPORT2 function-name()... */ | |
71 | /*==========================================================================*/ | |
72 | ||
73 | /** | |
74 | * \def U_CFUNC | |
75 | * This is used in a declaration of a library private ICU C function. | |
76 | * @stable ICU 2.4 | |
77 | */ | |
78 | ||
79 | /** | |
80 | * \def U_CDECL_BEGIN | |
81 | * This is used to begin a declaration of a library private ICU C API. | |
82 | * @stable ICU 2.4 | |
83 | */ | |
84 | ||
85 | /** | |
86 | * \def U_CDECL_END | |
87 | * This is used to end a declaration of a library private ICU C API | |
88 | * @stable ICU 2.4 | |
89 | */ | |
90 | ||
91 | #ifdef XP_CPLUSPLUS | |
92 | # define U_CFUNC extern "C" | |
93 | # define U_CDECL_BEGIN extern "C" { | |
94 | # define U_CDECL_END } | |
95 | #else | |
96 | # define U_CFUNC extern | |
97 | # define U_CDECL_BEGIN | |
98 | # define U_CDECL_END | |
99 | #endif | |
100 | ||
101 | /** | |
102 | * \def U_NAMESPACE_BEGIN | |
103 | * This is used to begin a declaration of a public ICU C++ API. | |
104 | * If the compiler doesn't support namespaces, this does nothing. | |
105 | * @stable ICU 2.4 | |
106 | */ | |
107 | ||
108 | /** | |
109 | * \def U_NAMESPACE_END | |
110 | * This is used to end a declaration of a public ICU C++ API | |
111 | * If the compiler doesn't support namespaces, this does nothing. | |
112 | * @stable ICU 2.4 | |
113 | */ | |
114 | ||
115 | /** | |
116 | * \def U_NAMESPACE_USE | |
117 | * This is used to specify that the rest of the code uses the | |
118 | * public ICU C++ API namespace. | |
119 | * If the compiler doesn't support namespaces, this does nothing. | |
120 | * @stable ICU 2.4 | |
121 | */ | |
122 | ||
123 | /** | |
124 | * \def U_NAMESPACE_QUALIFIER | |
125 | * This is used to qualify that a function or class is part of | |
126 | * the public ICU C++ API namespace. | |
127 | * If the compiler doesn't support namespaces, this does nothing. | |
128 | * @stable ICU 2.4 | |
129 | */ | |
130 | ||
131 | /* Define namespace symbols if the compiler supports it. */ | |
132 | #if U_HAVE_NAMESPACE | |
133 | # define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE { | |
134 | # define U_NAMESPACE_END } | |
135 | # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; | |
136 | # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: | |
137 | #else | |
138 | # define U_NAMESPACE_BEGIN | |
139 | # define U_NAMESPACE_END | |
140 | # define U_NAMESPACE_USE | |
141 | # define U_NAMESPACE_QUALIFIER | |
142 | #endif | |
143 | ||
144 | /** This is used to declare a function as a public ICU C API @stable ICU 2.0*/ | |
145 | #define U_CAPI U_CFUNC U_EXPORT | |
146 | ||
147 | /*==========================================================================*/ | |
148 | /* limits for int32_t etc., like in POSIX inttypes.h */ | |
149 | /*==========================================================================*/ | |
150 | ||
151 | #ifndef INT8_MIN | |
152 | /** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */ | |
153 | # define INT8_MIN ((int8_t)(-128)) | |
154 | #endif | |
155 | #ifndef INT16_MIN | |
156 | /** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */ | |
157 | # define INT16_MIN ((int16_t)(-32767-1)) | |
158 | #endif | |
159 | #ifndef INT32_MIN | |
160 | /** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */ | |
161 | # define INT32_MIN ((int32_t)(-2147483647-1)) | |
162 | #endif | |
163 | ||
164 | #ifndef INT8_MAX | |
165 | /** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */ | |
166 | # define INT8_MAX ((int8_t)(127)) | |
167 | #endif | |
168 | #ifndef INT16_MAX | |
169 | /** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */ | |
170 | # define INT16_MAX ((int16_t)(32767)) | |
171 | #endif | |
172 | #ifndef INT32_MAX | |
173 | /** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */ | |
174 | # define INT32_MAX ((int32_t)(2147483647)) | |
175 | #endif | |
176 | ||
177 | #ifndef UINT8_MAX | |
178 | /** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */ | |
179 | # define UINT8_MAX ((uint8_t)(255U)) | |
180 | #endif | |
181 | #ifndef UINT16_MAX | |
182 | /** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */ | |
183 | # define UINT16_MAX ((uint16_t)(65535U)) | |
184 | #endif | |
185 | #ifndef UINT32_MAX | |
186 | /** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */ | |
187 | # define UINT32_MAX ((uint32_t)(4294967295U)) | |
188 | #endif | |
189 | ||
190 | #if defined(U_INT64_T_UNAVAILABLE) | |
191 | # ifndef INTMAX_MIN | |
192 | # define INTMAX_MIN INT32_MIN | |
193 | # endif | |
194 | # ifndef INTMAX_MAX | |
195 | # define INTMAX_MAX INT32_MAX | |
196 | # endif | |
197 | # ifndef UINTMAX_MAX | |
198 | # define UINTMAX_MAX UINT32_MAX | |
199 | # endif | |
200 | #else | |
201 | # ifndef INT64_MIN | |
202 | /** The smallest value a 64 bit signed integer can hold @stable ICU 2.0 */ | |
203 | # define INT64_MIN ((int64_t)(-9223372036854775807-1)) | |
204 | # endif | |
205 | # ifndef INT64_MAX | |
206 | /** The largest value a 64 bit signed integer can hold @stable ICU 2.0 */ | |
207 | # define INT64_MAX ((int64_t)(9223372036854775807)) | |
208 | # endif | |
209 | # ifndef UINT64_MAX | |
210 | /** The largest value a 64 bit unsigned integer can hold @stable ICU 2.0 */ | |
211 | # define UINT64_MAX ((uint64_t)(18446744073709551615)) | |
212 | # endif | |
213 | # ifndef INTMAX_MIN | |
214 | # define INTMAX_MIN INT64_MIN | |
215 | # endif | |
216 | # ifndef INTMAX_MAX | |
217 | # define INTMAX_MAX INT64_MAX | |
218 | # endif | |
219 | # ifndef UINTMAX_MAX | |
220 | # define UINTMAX_MAX UINT64_MAX | |
221 | # endif | |
222 | #endif | |
223 | ||
224 | /*==========================================================================*/ | |
225 | /* Boolean data type */ | |
226 | /*==========================================================================*/ | |
227 | ||
228 | /** The ICU boolean type @stable ICU 2.0 */ | |
229 | typedef int8_t UBool; | |
230 | ||
231 | #ifndef TRUE | |
232 | /** The TRUE value of a UBool @stable ICU 2.0 */ | |
233 | # define TRUE 1 | |
234 | #endif | |
235 | #ifndef FALSE | |
236 | /** The FALSE value of a UBool @stable ICU 2.0 */ | |
237 | # define FALSE 0 | |
238 | #endif | |
239 | ||
240 | ||
241 | /*==========================================================================*/ | |
242 | /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */ | |
243 | /* defined. Definitions normally are in */ | |
244 | /* platform.h or the corresponding file for */ | |
245 | /* the OS in use. */ | |
246 | /*==========================================================================*/ | |
247 | ||
248 | /** | |
249 | * \def U_ALIGN_CODE | |
250 | * This is used to align code fragments to a specific byte boundary. | |
251 | * This is useful for getting consistent performance test results. | |
252 | * @internal | |
253 | */ | |
254 | #ifndef U_ALIGN_CODE | |
255 | # define U_ALIGN_CODE(n) | |
256 | #endif | |
257 | ||
258 | #ifndef U_INLINE | |
259 | # define U_INLINE | |
260 | #endif | |
261 | ||
262 | #include "unicode/urename.h" | |
263 | ||
264 | #endif |