ICU 4.8 4.8
|
00001 /* 00002 ****************************************************************************** 00003 * 00004 * Copyright (C) 1999-2011, International Business Machines 00005 * Corporation and others. All Rights Reserved. 00006 * 00007 ****************************************************************************** 00008 * file name: umachine.h 00009 * encoding: US-ASCII 00010 * tab size: 8 (not used) 00011 * indentation:4 00012 * 00013 * created on: 1999sep13 00014 * created by: Markus W. Scherer 00015 * 00016 * This file defines basic types and constants for utf.h to be 00017 * platform-independent. umachine.h and utf.h are included into 00018 * utypes.h to provide all the general definitions for ICU. 00019 * All of these definitions used to be in utypes.h before 00020 * the UTF-handling macros made this unmaintainable. 00021 */ 00022 00023 #ifndef __UMACHINE_H__ 00024 #define __UMACHINE_H__ 00025 00026 00039 /*==========================================================================*/ 00040 /* Include platform-dependent definitions */ 00041 /* which are contained in the platform-specific file platform.h */ 00042 /*==========================================================================*/ 00043 00044 #if defined(U_PALMOS) 00045 # include "unicode/ppalmos.h" 00046 #elif (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) 00047 /* 00048 * platform.h is now also generated by MSVC Solution/Project files 00049 * from platform.win and should always be included unless you are 00050 * building stubdata which is built before the platform.h file is 00051 * generated. 00052 */ 00053 #ifndef STUBDATA_BUILD 00054 # include "unicode/platform.h" 00055 #endif 00056 # include "unicode/pwin32.h" 00057 #else 00058 # include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ 00059 #endif 00060 00061 /* 00062 * ANSI C headers: 00063 * stddef.h defines wchar_t 00064 */ 00065 #include <stddef.h> 00066 00067 /*==========================================================================*/ 00068 /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ 00069 /* using C++. It should not be defined when compiling under C. */ 00070 /*==========================================================================*/ 00071 00072 #ifdef __cplusplus 00073 # ifndef XP_CPLUSPLUS 00074 # define XP_CPLUSPLUS 00075 # endif 00076 #else 00077 # undef XP_CPLUSPLUS 00078 #endif 00079 00080 /*==========================================================================*/ 00081 /* For C wrappers, we use the symbol U_STABLE. */ 00082 /* This works properly if the includer is C or C++. */ 00083 /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ 00084 /*==========================================================================*/ 00085 00104 #ifdef XP_CPLUSPLUS 00105 # define U_CFUNC extern "C" 00106 # define U_CDECL_BEGIN extern "C" { 00107 # define U_CDECL_END } 00108 #else 00109 # define U_CFUNC extern 00110 # define U_CDECL_BEGIN 00111 # define U_CDECL_END 00112 #endif 00113 00119 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) 00120 # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) 00121 00126 #elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400) 00127 # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) 00128 #else 00129 # define U_ATTRIBUTE_DEPRECATED 00130 #endif 00131 00132 #define U_CAPI U_CFUNC U_EXPORT 00133 00134 #define U_STABLE U_CAPI 00135 00136 #define U_DRAFT U_CAPI 00137 00138 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED 00139 00140 #define U_OBSOLETE U_CAPI 00141 00142 #define U_INTERNAL U_CAPI 00143 00144 /*==========================================================================*/ 00145 /* limits for int32_t etc., like in POSIX inttypes.h */ 00146 /*==========================================================================*/ 00147 00148 #ifndef INT8_MIN 00149 00150 # define INT8_MIN ((int8_t)(-128)) 00151 #endif 00152 #ifndef INT16_MIN 00153 00154 # define INT16_MIN ((int16_t)(-32767-1)) 00155 #endif 00156 #ifndef INT32_MIN 00157 00158 # define INT32_MIN ((int32_t)(-2147483647-1)) 00159 #endif 00160 00161 #ifndef INT8_MAX 00162 00163 # define INT8_MAX ((int8_t)(127)) 00164 #endif 00165 #ifndef INT16_MAX 00166 00167 # define INT16_MAX ((int16_t)(32767)) 00168 #endif 00169 #ifndef INT32_MAX 00170 00171 # define INT32_MAX ((int32_t)(2147483647)) 00172 #endif 00173 00174 #ifndef UINT8_MAX 00175 00176 # define UINT8_MAX ((uint8_t)(255U)) 00177 #endif 00178 #ifndef UINT16_MAX 00179 00180 # define UINT16_MAX ((uint16_t)(65535U)) 00181 #endif 00182 #ifndef UINT32_MAX 00183 00184 # define UINT32_MAX ((uint32_t)(4294967295U)) 00185 #endif 00186 00187 #if defined(U_INT64_T_UNAVAILABLE) 00188 # error int64_t is required for decimal format and rule-based number format. 00189 #else 00190 # ifndef INT64_C 00191 00196 # define INT64_C(c) c ## LL 00197 # endif 00198 # ifndef UINT64_C 00199 00204 # define UINT64_C(c) c ## ULL 00205 # endif 00206 # ifndef U_INT64_MIN 00207 00208 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) 00209 # endif 00210 # ifndef U_INT64_MAX 00211 00212 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) 00213 # endif 00214 # ifndef U_UINT64_MAX 00215 00216 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) 00217 # endif 00218 #endif 00219 00220 /*==========================================================================*/ 00221 /* Boolean data type */ 00222 /*==========================================================================*/ 00223 00225 typedef int8_t UBool; 00226 00227 #ifndef TRUE 00228 00229 # define TRUE 1 00230 #endif 00231 #ifndef FALSE 00232 00233 # define FALSE 0 00234 #endif 00235 00236 00237 /*==========================================================================*/ 00238 /* Unicode data types */ 00239 /*==========================================================================*/ 00240 00241 /* wchar_t-related definitions -------------------------------------------- */ 00242 00249 #ifndef U_HAVE_WCHAR_H 00250 # define U_HAVE_WCHAR_H 1 00251 #endif 00252 00259 #if U_SIZEOF_WCHAR_T==0 00260 # undef U_SIZEOF_WCHAR_T 00261 # define U_SIZEOF_WCHAR_T 4 00262 #endif 00263 00264 /* 00265 * \def U_WCHAR_IS_UTF16 00266 * Defined if wchar_t uses UTF-16. 00267 * 00268 * @stable ICU 2.0 00269 */ 00270 /* 00271 * \def U_WCHAR_IS_UTF32 00272 * Defined if wchar_t uses UTF-32. 00273 * 00274 * @stable ICU 2.0 00275 */ 00276 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) 00277 # ifdef __STDC_ISO_10646__ 00278 # if (U_SIZEOF_WCHAR_T==2) 00279 # define U_WCHAR_IS_UTF16 00280 # elif (U_SIZEOF_WCHAR_T==4) 00281 # define U_WCHAR_IS_UTF32 00282 # endif 00283 # elif defined __UCS2__ 00284 # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) 00285 # define U_WCHAR_IS_UTF16 00286 # endif 00287 # elif defined __UCS4__ 00288 # if (U_SIZEOF_WCHAR_T==4) 00289 # define U_WCHAR_IS_UTF32 00290 # endif 00291 # elif defined(U_WINDOWS) 00292 # define U_WCHAR_IS_UTF16 00293 # endif 00294 #endif 00295 00296 /* UChar and UChar32 definitions -------------------------------------------- */ 00297 00299 #define U_SIZEOF_UCHAR 2 00300 00313 /* Define UChar to be compatible with wchar_t if possible. */ 00314 #if U_SIZEOF_WCHAR_T==2 00315 typedef wchar_t UChar; 00316 #elif U_GNUC_UTF16_STRING 00317 #if defined _GCC_ 00318 typedef __CHAR16_TYPE__ char16_t; 00319 #endif 00320 typedef char16_t UChar; 00321 #else 00322 typedef uint16_t UChar; 00323 #endif 00324 00342 typedef int32_t UChar32; 00343 00344 /*==========================================================================*/ 00345 /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */ 00346 /* defined. Definitions normally are in */ 00347 /* platform.h or the corresponding file for */ 00348 /* the OS in use. */ 00349 /*==========================================================================*/ 00350 00351 #ifndef U_HIDE_INTERNAL_API 00352 00359 #ifndef U_ALIGN_CODE 00360 # define U_ALIGN_CODE(n) 00361 #endif 00362 00363 #endif /* U_HIDE_INTERNAL_API */ 00364 00371 #ifndef U_INLINE 00372 # ifdef XP_CPLUSPLUS 00373 # define U_INLINE inline 00374 # else 00375 # define U_INLINE 00376 # endif 00377 #endif 00378 00379 #include "unicode/urename.h" 00380 00381 #endif