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

Generated on Tue Nov 16 10:03:06 2004 for ICU 3.2 by  doxygen 1.3.9.1