umachine.h

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

Generated on Mon Aug 13 07:17:24 2007 for ICU 3.6 by  doxygen 1.5.2