umachine.h

Go to the documentation of this file.
00001 /* 00002 ****************************************************************************** 00003 * 00004 * Copyright (C) 1999-2004, 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(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 00045 # include "unicode/pwin32.h" 00046 #elif defined(__OS400__) 00047 # include "unicode/pos400.h" 00048 #elif defined(__MWERKS__) 00049 # include "unicode/pmacos.h" 00050 #else 00051 # include "unicode/platform.h" 00052 #endif 00053 00054 /* 00055 * ANSI C headers: 00056 * stddef.h defines wchar_t 00057 */ 00058 #include <stddef.h> 00059 00060 /*==========================================================================*/ 00061 /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ 00062 /* using C++. It should not be defined when compiling under C. */ 00063 /*==========================================================================*/ 00064 00065 #ifdef __cplusplus 00066 # ifndef XP_CPLUSPLUS 00067 # define XP_CPLUSPLUS 00068 # endif 00069 #else 00070 # undef XP_CPLUSPLUS 00071 #endif 00072 00073 /*==========================================================================*/ 00074 /* For C wrappers, we use the symbol U_STABLE. */ 00075 /* This works properly if the includer is C or C++. */ 00076 /* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */ 00077 /*==========================================================================*/ 00078 00097 #ifdef XP_CPLUSPLUS 00098 # define U_CFUNC extern "C" 00099 # define U_CDECL_BEGIN extern "C" { 00100 # define U_CDECL_END } 00101 #else 00102 # define U_CFUNC extern 00103 # define U_CDECL_BEGIN 00104 # define U_CDECL_END 00105 #endif 00106 00137 /* Define namespace symbols if the compiler supports it. */ 00138 #if U_HAVE_NAMESPACE 00139 # define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE { 00140 # define U_NAMESPACE_END } 00141 # define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE; 00142 # define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE:: 00143 #else 00144 # define U_NAMESPACE_BEGIN 00145 # define U_NAMESPACE_END 00146 # define U_NAMESPACE_USE 00147 # define U_NAMESPACE_QUALIFIER 00148 #endif 00149 00151 #define U_CAPI U_CFUNC U_EXPORT 00152 #define U_STABLE U_CAPI 00153 #define U_DRAFT U_CAPI 00154 #define U_DEPRECATED U_CAPI 00155 #define U_OBSOLETE U_CAPI 00156 #define U_INTERNAL U_CAPI 00157 00158 /*==========================================================================*/ 00159 /* limits for int32_t etc., like in POSIX inttypes.h */ 00160 /*==========================================================================*/ 00161 00162 #ifndef INT8_MIN 00163 00164 # define INT8_MIN ((int8_t)(-128)) 00165 #endif 00166 #ifndef INT16_MIN 00167 00168 # define INT16_MIN ((int16_t)(-32767-1)) 00169 #endif 00170 #ifndef INT32_MIN 00171 00172 # define INT32_MIN ((int32_t)(-2147483647-1)) 00173 #endif 00174 00175 #ifndef INT8_MAX 00176 00177 # define INT8_MAX ((int8_t)(127)) 00178 #endif 00179 #ifndef INT16_MAX 00180 00181 # define INT16_MAX ((int16_t)(32767)) 00182 #endif 00183 #ifndef INT32_MAX 00184 00185 # define INT32_MAX ((int32_t)(2147483647)) 00186 #endif 00187 00188 #ifndef UINT8_MAX 00189 00190 # define UINT8_MAX ((uint8_t)(255U)) 00191 #endif 00192 #ifndef UINT16_MAX 00193 00194 # define UINT16_MAX ((uint16_t)(65535U)) 00195 #endif 00196 #ifndef UINT32_MAX 00197 00198 # define UINT32_MAX ((uint32_t)(4294967295U)) 00199 #endif 00200 00201 #if defined(U_INT64_T_UNAVAILABLE) 00202 # error int64_t is required for decimal format and rule-based number format. 00203 #else 00204 # ifndef INT64_C 00205 00210 # define INT64_C(c) c ## LL 00211 # endif 00212 # ifndef UINT64_C 00213 00218 # define UINT64_C(c) c ## ULL 00219 # endif 00220 # ifndef U_INT64_MIN 00221 00222 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) 00223 # endif 00224 # ifndef U_INT64_MAX 00225 00226 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) 00227 # endif 00228 # ifndef U_UINT64_MAX 00229 00230 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) 00231 # endif 00232 #endif 00233 00234 /*==========================================================================*/ 00235 /* Boolean data type */ 00236 /*==========================================================================*/ 00237 00239 typedef int8_t UBool; 00240 00241 #ifndef TRUE 00242 00243 # define TRUE 1 00244 #endif 00245 #ifndef FALSE 00246 00247 # define FALSE 0 00248 #endif 00249 00250 00251 /*==========================================================================*/ 00252 /* Unicode data types */ 00253 /*==========================================================================*/ 00254 00255 /* wchar_t-related definitions -------------------------------------------- */ 00256 00263 #ifndef U_HAVE_WCHAR_H 00264 # define U_HAVE_WCHAR_H 1 00265 #endif 00266 00273 #if U_SIZEOF_WCHAR_T==0 00274 # undef U_SIZEOF_WCHAR_T 00275 # define U_SIZEOF_WCHAR_T 4 00276 #endif 00277 00278 /* 00279 * \def U_WCHAR_IS_UTF16 00280 * Defined if wchar_t uses UTF-16. 00281 * 00282 * @stable ICU 2.0 00283 */ 00284 /* 00285 * \def U_WCHAR_IS_UTF32 00286 * Defined if wchar_t uses UTF-32. 00287 * 00288 * @stable ICU 2.0 00289 */ 00290 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) 00291 # ifdef __STDC_ISO_10646__ 00292 # if (U_SIZEOF_WCHAR_T==2) 00293 # define U_WCHAR_IS_UTF16 00294 # elif (U_SIZEOF_WCHAR_T==4) 00295 # define U_WCHAR_IS_UTF32 00296 # endif 00297 # elif defined __UCS2__ 00298 # if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) 00299 # define U_WCHAR_IS_UTF16 00300 # endif 00301 # elif defined __UCS4__ 00302 # if (U_SIZEOF_WCHAR_T==4) 00303 # define U_WCHAR_IS_UTF32 00304 # endif 00305 # elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 00306 # define U_WCHAR_IS_UTF16 00307 # endif 00308 #endif 00309 00310 /* UChar and UChar32 definitions -------------------------------------------- */ 00311 00313 #define U_SIZEOF_UCHAR 2 00314 00326 /* Define UChar to be compatible with wchar_t if possible. */ 00327 #if U_SIZEOF_WCHAR_T==2 00328 typedef wchar_t UChar; 00329 #else 00330 typedef uint16_t UChar; 00331 #endif 00332 00350 typedef int32_t UChar32; 00351 00352 /*==========================================================================*/ 00353 /* U_INLINE and U_ALIGN_CODE Set default values if these are not already */ 00354 /* defined. Definitions normally are in */ 00355 /* platform.h or the corresponding file for */ 00356 /* the OS in use. */ 00357 /*==========================================================================*/ 00358 00365 #ifndef U_ALIGN_CODE 00366 # define U_ALIGN_CODE(n) 00367 #endif 00368 00369 #ifndef U_INLINE 00370 # define U_INLINE 00371 #endif 00372 00373 #include "unicode/urename.h" 00374 00375 #endif

Generated on Fri Jun 18 12:36:01 2004 for ICU by doxygen 1.3.7