ICU 4.6 4.6
|
00001 /* 00002 ****************************************************************************** 00003 * 00004 * Copyright (C) 1999-2010, 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(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) 00047 #ifdef CYGWINMSVC 00048 # include "unicode/platform.h" 00049 #endif 00050 # include "unicode/pwin32.h" 00051 #else 00052 # include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ 00053 #endif 00054 00055 /* 00056 * ANSI C headers: 00057 * stddef.h defines wchar_t 00058 */ 00059 #include <stddef.h> 00060 00061 /*==========================================================================*/ 00062 /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ 00063 /* using C++. It should not be defined when compiling under C. */ 00064 /*==========================================================================*/ 00065 00066 #ifdef __cplusplus 00067 # ifndef XP_CPLUSPLUS 00068 # define XP_CPLUSPLUS 00069 # endif 00070 #else 00071 # undef XP_CPLUSPLUS 00072 #endif 00073 00074 /*==========================================================================*/ 00075 /* For C wrappers, we use the symbol U_STABLE. */ 00076 /* This works properly if the includer is C or C++. */ 00077 /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ 00078 /*==========================================================================*/ 00079 00098 #ifdef XP_CPLUSPLUS 00099 # define U_CFUNC extern "C" 00100 # define U_CDECL_BEGIN extern "C" { 00101 # define U_CDECL_END } 00102 #else 00103 # define U_CFUNC extern 00104 # define U_CDECL_BEGIN 00105 # define U_CDECL_END 00106 #endif 00107 00113 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2)) 00114 # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) 00115 00120 #elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400) 00121 # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) 00122 #else 00123 # define U_ATTRIBUTE_DEPRECATED 00124 #endif 00125 00126 #define U_CAPI U_CFUNC U_EXPORT 00127 00128 #define U_STABLE U_CAPI 00129 00130 #define U_DRAFT U_CAPI 00131 00132 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED 00133 00134 #define U_OBSOLETE U_CAPI 00135 00136 #define U_INTERNAL U_CAPI 00137 00138 /*==========================================================================*/ 00139 /* limits for int32_t etc., like in POSIX inttypes.h */ 00140 /*==========================================================================*/ 00141 00142 #ifndef INT8_MIN 00143 00144 # define INT8_MIN ((int8_t)(-128)) 00145 #endif 00146 #ifndef INT16_MIN 00147 00148 # define INT16_MIN ((int16_t)(-32767-1)) 00149 #endif 00150 #ifndef INT32_MIN 00151 00152 # define INT32_MIN ((int32_t)(-2147483647-1)) 00153 #endif 00154 00155 #ifndef INT8_MAX 00156 00157 # define INT8_MAX ((int8_t)(127)) 00158 #endif 00159 #ifndef INT16_MAX 00160 00161 # define INT16_MAX ((int16_t)(32767)) 00162 #endif 00163 #ifndef INT32_MAX 00164 00165 # define INT32_MAX ((int32_t)(2147483647)) 00166 #endif 00167 00168 #ifndef UINT8_MAX 00169 00170 # define UINT8_MAX ((uint8_t)(255U)) 00171 #endif 00172 #ifndef UINT16_MAX 00173 00174 # define UINT16_MAX ((uint16_t)(65535U)) 00175 #endif 00176 #ifndef UINT32_MAX 00177 00178 # define UINT32_MAX ((uint32_t)(4294967295U)) 00179 #endif 00180 00181 #if defined(U_INT64_T_UNAVAILABLE) 00182 # error int64_t is required for decimal format and rule-based number format. 00183 #else 00184 # ifndef INT64_C 00185 00190 # define INT64_C(c) c ## LL 00191 # endif 00192 # ifndef UINT64_C 00193 00198 # define UINT64_C(c) c ## ULL 00199 # endif 00200 # ifndef U_INT64_MIN 00201 00202 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) 00203 # endif 00204 # ifndef U_INT64_MAX 00205 00206 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) 00207 # endif 00208 # ifndef U_UINT64_MAX 00209 00210 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) 00211 # endif 00212 #endif 00213 00214 /*==========================================================================*/ 00215 /* Boolean data type */ 00216 /*==========================================================================*/ 00217 00219 typedef int8_t UBool; 00220 00221 #ifndef TRUE 00222 00223 # define TRUE 1 00224 #endif 00225 #ifndef FALSE 00226 00227 # define FALSE 0 00228 #endif 00229 00230 00231 /*==========================================================================*/ 00232 /* Unicode data types */ 00233 /*==========================================================================*/ 00234 00235 /* wchar_t-related definitions -------------------------------------------- */ 00236 00243 #ifndef U_HAVE_WCHAR_H 00244 # define U_HAVE_WCHAR_H 1 00245 #endif 00246 00253 #if U_SIZEOF_WCHAR_T==0 00254 # undef U_SIZEOF_WCHAR_T 00255 # define U_SIZEOF_WCHAR_T 4 00256 #endif 00257 00258 /* 00259 * \def U_WCHAR_IS_UTF16 00260 * Defined if wchar_t uses UTF-16. 00261 * 00262 * @stable ICU 2.0 00263 */ 00264 /* 00265 * \def U_WCHAR_IS_UTF32 00266 * Defined if wchar_t uses UTF-32. 00267 * 00268 * @stable ICU 2.0 00269 */ 00270 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) 00271 # ifdef __STDC_ISO_10646__ 00272 # if (U_SIZEOF_WCHAR_T==2) 00273 # define U_WCHAR_IS_UTF16 00274 # elif (U_SIZEOF_WCHAR_T==4) 00275 # define U_WCHAR_IS_UTF32 00276 # endif 00277 # elif defined __UCS2__ 00278 # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) 00279 # define U_WCHAR_IS_UTF16 00280 # endif 00281 # elif defined __UCS4__ 00282 # if (U_SIZEOF_WCHAR_T==4) 00283 # define U_WCHAR_IS_UTF32 00284 # endif 00285 # elif defined(U_WINDOWS) 00286 # define U_WCHAR_IS_UTF16 00287 # endif 00288 #endif 00289 00290 /* UChar and UChar32 definitions -------------------------------------------- */ 00291 00293 #define U_SIZEOF_UCHAR 2 00294 00307 /* Define UChar to be compatible with wchar_t if possible. */ 00308 #if U_SIZEOF_WCHAR_T==2 00309 typedef wchar_t UChar; 00310 #elif U_GNUC_UTF16_STRING 00311 #if defined _GCC_ 00312 typedef __CHAR16_TYPE__ char16_t; 00313 #endif 00314 typedef char16_t UChar; 00315 #else 00316 typedef uint16_t UChar; 00317 #endif 00318 00336 typedef int32_t UChar32; 00337 00338 /*==========================================================================*/ 00339 /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */ 00340 /* defined. Definitions normally are in */ 00341 /* platform.h or the corresponding file for */ 00342 /* the OS in use. */ 00343 /*==========================================================================*/ 00344 00345 #ifndef U_HIDE_INTERNAL_API 00346 00353 #ifndef U_ALIGN_CODE 00354 # define U_ALIGN_CODE(n) 00355 #endif 00356 00357 #endif /* U_HIDE_INTERNAL_API */ 00358 00364 #ifndef U_INLINE 00365 # ifdef XP_CPLUSPLUS 00366 # define U_INLINE inline 00367 # else 00368 # define U_INLINE 00369 # endif 00370 #endif 00371 00372 #include "unicode/urename.h" 00373 00374 #endif