ICU 49.1.1
49.1.1
|
00001 /* 00002 ****************************************************************************** 00003 * 00004 * Copyright (C) 1999-2012, 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 #include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ 00045 00046 /* 00047 * ANSI C headers: 00048 * stddef.h defines wchar_t 00049 */ 00050 #include <stddef.h> 00051 00052 /*==========================================================================*/ 00053 /* For C wrappers, we use the symbol U_STABLE. */ 00054 /* This works properly if the includer is C or C++. */ 00055 /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ 00056 /*==========================================================================*/ 00057 00076 #ifdef __cplusplus 00077 # define U_CFUNC extern "C" 00078 # define U_CDECL_BEGIN extern "C" { 00079 # define U_CDECL_END } 00080 #else 00081 # define U_CFUNC extern 00082 # define U_CDECL_BEGIN 00083 # define U_CDECL_END 00084 #endif 00085 00086 #ifndef U_ATTRIBUTE_DEPRECATED 00087 00092 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) 00093 # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) 00094 00099 #elif defined(_MSC_VER) && (_MSC_VER >= 1400) 00100 # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) 00101 #else 00102 # define U_ATTRIBUTE_DEPRECATED 00103 #endif 00104 #endif 00105 00107 #define U_CAPI U_CFUNC U_EXPORT 00108 00109 #define U_STABLE U_CAPI 00110 00111 #define U_DRAFT U_CAPI 00112 00113 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED 00114 00115 #define U_OBSOLETE U_CAPI 00116 00117 #define U_INTERNAL U_CAPI 00118 00119 /*==========================================================================*/ 00120 /* limits for int32_t etc., like in POSIX inttypes.h */ 00121 /*==========================================================================*/ 00122 00123 #ifndef INT8_MIN 00124 00125 # define INT8_MIN ((int8_t)(-128)) 00126 #endif 00127 #ifndef INT16_MIN 00128 00129 # define INT16_MIN ((int16_t)(-32767-1)) 00130 #endif 00131 #ifndef INT32_MIN 00132 00133 # define INT32_MIN ((int32_t)(-2147483647-1)) 00134 #endif 00135 00136 #ifndef INT8_MAX 00137 00138 # define INT8_MAX ((int8_t)(127)) 00139 #endif 00140 #ifndef INT16_MAX 00141 00142 # define INT16_MAX ((int16_t)(32767)) 00143 #endif 00144 #ifndef INT32_MAX 00145 00146 # define INT32_MAX ((int32_t)(2147483647)) 00147 #endif 00148 00149 #ifndef UINT8_MAX 00150 00151 # define UINT8_MAX ((uint8_t)(255U)) 00152 #endif 00153 #ifndef UINT16_MAX 00154 00155 # define UINT16_MAX ((uint16_t)(65535U)) 00156 #endif 00157 #ifndef UINT32_MAX 00158 00159 # define UINT32_MAX ((uint32_t)(4294967295U)) 00160 #endif 00161 00162 #if defined(U_INT64_T_UNAVAILABLE) 00163 # error int64_t is required for decimal format and rule-based number format. 00164 #else 00165 # ifndef INT64_C 00166 00171 # define INT64_C(c) c ## LL 00172 # endif 00173 # ifndef UINT64_C 00174 00179 # define UINT64_C(c) c ## ULL 00180 # endif 00181 # ifndef U_INT64_MIN 00182 00183 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) 00184 # endif 00185 # ifndef U_INT64_MAX 00186 00187 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) 00188 # endif 00189 # ifndef U_UINT64_MAX 00190 00191 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) 00192 # endif 00193 #endif 00194 00195 /*==========================================================================*/ 00196 /* Boolean data type */ 00197 /*==========================================================================*/ 00198 00200 typedef int8_t UBool; 00201 00202 #ifndef TRUE 00203 00204 # define TRUE 1 00205 #endif 00206 #ifndef FALSE 00207 00208 # define FALSE 0 00209 #endif 00210 00211 00212 /*==========================================================================*/ 00213 /* Unicode data types */ 00214 /*==========================================================================*/ 00215 00216 /* wchar_t-related definitions -------------------------------------------- */ 00217 00218 /* 00219 * \def U_WCHAR_IS_UTF16 00220 * Defined if wchar_t uses UTF-16. 00221 * 00222 * @stable ICU 2.0 00223 */ 00224 /* 00225 * \def U_WCHAR_IS_UTF32 00226 * Defined if wchar_t uses UTF-32. 00227 * 00228 * @stable ICU 2.0 00229 */ 00230 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) 00231 # ifdef __STDC_ISO_10646__ 00232 # if (U_SIZEOF_WCHAR_T==2) 00233 # define U_WCHAR_IS_UTF16 00234 # elif (U_SIZEOF_WCHAR_T==4) 00235 # define U_WCHAR_IS_UTF32 00236 # endif 00237 # elif defined __UCS2__ 00238 # if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2) 00239 # define U_WCHAR_IS_UTF16 00240 # endif 00241 # elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__)) 00242 # if (U_SIZEOF_WCHAR_T==4) 00243 # define U_WCHAR_IS_UTF32 00244 # endif 00245 # elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED) 00246 # define U_WCHAR_IS_UTF32 00247 # elif U_PLATFORM_HAS_WIN32_API 00248 # define U_WCHAR_IS_UTF16 00249 # endif 00250 #endif 00251 00252 /* UChar and UChar32 definitions -------------------------------------------- */ 00253 00255 #define U_SIZEOF_UCHAR 2 00256 00270 /* Define UChar to be compatible with char16_t or wchar_t if possible. */ 00271 #if U_HAVE_CHAR16_T 00272 typedef char16_t UChar; 00273 #elif U_SIZEOF_WCHAR_T==2 00274 typedef wchar_t UChar; 00275 #elif defined(__CHAR16_TYPE__) 00276 typedef __CHAR16_TYPE__ UChar; 00277 #else 00278 typedef uint16_t UChar; 00279 #endif 00280 00298 typedef int32_t UChar32; 00299 00318 #define U_SENTINEL (-1) 00319 00320 #include "unicode/urename.h" 00321 00322 #endif