1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/textandloc/fontservices/textshaperplugin/IcuSource/common/unicode/umachine.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,379 @@
1.4 +/*
1.5 +******************************************************************************
1.6 +*
1.7 +* Copyright (C) 1999-2005, International Business Machines
1.8 +* Corporation and others. All Rights Reserved.
1.9 +*
1.10 +******************************************************************************
1.11 +* file name: umachine.h
1.12 +* encoding: US-ASCII
1.13 +* tab size: 8 (not used)
1.14 +* indentation:4
1.15 +*
1.16 +* created on: 1999sep13
1.17 +* created by: Markus W. Scherer
1.18 +*
1.19 +* This file defines basic types and constants for utf.h to be
1.20 +* platform-independent. umachine.h and utf.h are included into
1.21 +* utypes.h to provide all the general definitions for ICU.
1.22 +* All of these definitions used to be in utypes.h before
1.23 +* the UTF-handling macros made this unmaintainable.
1.24 +*/
1.25 +
1.26 +#ifndef __UMACHINE_H__
1.27 +#define __UMACHINE_H__
1.28 +
1.29 +
1.30 +/**
1.31 + * \file
1.32 + * \brief Basic types and constants for UTF
1.33 + *
1.34 + * <h2> Basic types and constants for UTF </h2>
1.35 + * This file defines basic types and constants for utf.h to be
1.36 + * platform-independent. umachine.h and utf.h are included into
1.37 + * utypes.h to provide all the general definitions for ICU.
1.38 + * All of these definitions used to be in utypes.h before
1.39 + * the UTF-handling macros made this unmaintainable.
1.40 + *
1.41 + */
1.42 +/*==========================================================================*/
1.43 +/* Include platform-dependent definitions */
1.44 +/* which are contained in the platform-specific file platform.h */
1.45 +/*==========================================================================*/
1.46 +
1.47 +#if defined(__SYMBIAN32__)
1.48 +#include "SymbianPlatform.h"
1.49 +#elif defined(U_PALMOS)
1.50 +# include "unicode/ppalmos.h"
1.51 +#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
1.52 +# include "unicode/pwin32.h"
1.53 +#else
1.54 +# include "unicode/platform.h"
1.55 +#endif
1.56 +
1.57 +/*
1.58 + * ANSI C headers:
1.59 + * stddef.h defines wchar_t
1.60 + */
1.61 +#include <stddef.h>
1.62 +
1.63 +/*==========================================================================*/
1.64 +/* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */
1.65 +/* using C++. It should not be defined when compiling under C. */
1.66 +/*==========================================================================*/
1.67 +
1.68 +#ifdef __cplusplus
1.69 +# ifndef XP_CPLUSPLUS
1.70 +# define XP_CPLUSPLUS
1.71 +# endif
1.72 +#else
1.73 +# undef XP_CPLUSPLUS
1.74 +#endif
1.75 +
1.76 +/*==========================================================================*/
1.77 +/* For C wrappers, we use the symbol U_STABLE. */
1.78 +/* This works properly if the includer is C or C++. */
1.79 +/* Functions are declared U_STABLE return-type U_EXPORT2 function-name()... */
1.80 +/*==========================================================================*/
1.81 +
1.82 +/**
1.83 + * \def U_CFUNC
1.84 + * This is used in a declaration of a library private ICU C function.
1.85 + * @stable ICU 2.4
1.86 + */
1.87 +
1.88 +/**
1.89 + * \def U_CDECL_BEGIN
1.90 + * This is used to begin a declaration of a library private ICU C API.
1.91 + * @stable ICU 2.4
1.92 + */
1.93 +
1.94 +/**
1.95 + * \def U_CDECL_END
1.96 + * This is used to end a declaration of a library private ICU C API
1.97 + * @stable ICU 2.4
1.98 + */
1.99 +
1.100 +#ifdef XP_CPLUSPLUS
1.101 +# define U_CFUNC extern "C"
1.102 +# define U_CDECL_BEGIN extern "C" {
1.103 +# define U_CDECL_END }
1.104 +#else
1.105 +# define U_CFUNC extern
1.106 +# define U_CDECL_BEGIN
1.107 +# define U_CDECL_END
1.108 +#endif
1.109 +
1.110 +/**
1.111 + * \def U_NAMESPACE_BEGIN
1.112 + * This is used to begin a declaration of a public ICU C++ API.
1.113 + * If the compiler doesn't support namespaces, this does nothing.
1.114 + * @stable ICU 2.4
1.115 + */
1.116 +
1.117 +/**
1.118 + * \def U_NAMESPACE_END
1.119 + * This is used to end a declaration of a public ICU C++ API
1.120 + * If the compiler doesn't support namespaces, this does nothing.
1.121 + * @stable ICU 2.4
1.122 + */
1.123 +
1.124 +/**
1.125 + * \def U_NAMESPACE_USE
1.126 + * This is used to specify that the rest of the code uses the
1.127 + * public ICU C++ API namespace.
1.128 + * If the compiler doesn't support namespaces, this does nothing.
1.129 + * @stable ICU 2.4
1.130 + */
1.131 +
1.132 +/**
1.133 + * \def U_NAMESPACE_QUALIFIER
1.134 + * This is used to qualify that a function or class is part of
1.135 + * the public ICU C++ API namespace.
1.136 + * If the compiler doesn't support namespaces, this does nothing.
1.137 + * @stable ICU 2.4
1.138 + */
1.139 +
1.140 +/* Define namespace symbols if the compiler supports it. */
1.141 +#if U_HAVE_NAMESPACE
1.142 +# define U_NAMESPACE_BEGIN namespace U_ICU_NAMESPACE {
1.143 +# define U_NAMESPACE_END }
1.144 +# define U_NAMESPACE_USE using namespace U_ICU_NAMESPACE;
1.145 +# define U_NAMESPACE_QUALIFIER U_ICU_NAMESPACE::
1.146 +#else
1.147 +# define U_NAMESPACE_BEGIN
1.148 +# define U_NAMESPACE_END
1.149 +# define U_NAMESPACE_USE
1.150 +# define U_NAMESPACE_QUALIFIER
1.151 +#endif
1.152 +
1.153 +/** This is used to declare a function as a public ICU C API @stable ICU 2.0*/
1.154 +#define U_CAPI U_CFUNC U_EXPORT
1.155 +#define U_STABLE U_CAPI
1.156 +#define U_DRAFT U_CAPI
1.157 +#define U_DEPRECATED U_CAPI
1.158 +#define U_OBSOLETE U_CAPI
1.159 +#define U_INTERNAL U_CAPI
1.160 +
1.161 +/*==========================================================================*/
1.162 +/* limits for int32_t etc., like in POSIX inttypes.h */
1.163 +/*==========================================================================*/
1.164 +
1.165 +#ifndef INT8_MIN
1.166 +/** The smallest value an 8 bit signed integer can hold @stable ICU 2.0 */
1.167 +# define INT8_MIN ((int8_t)(-128))
1.168 +#endif
1.169 +#ifndef INT16_MIN
1.170 +/** The smallest value a 16 bit signed integer can hold @stable ICU 2.0 */
1.171 +# define INT16_MIN ((int16_t)(-32767-1))
1.172 +#endif
1.173 +#ifndef INT32_MIN
1.174 +/** The smallest value a 32 bit signed integer can hold @stable ICU 2.0 */
1.175 +# define INT32_MIN ((int32_t)(-2147483647-1))
1.176 +#endif
1.177 +
1.178 +#ifndef INT8_MAX
1.179 +/** The largest value an 8 bit signed integer can hold @stable ICU 2.0 */
1.180 +# define INT8_MAX ((int8_t)(127))
1.181 +#endif
1.182 +#ifndef INT16_MAX
1.183 +/** The largest value a 16 bit signed integer can hold @stable ICU 2.0 */
1.184 +# define INT16_MAX ((int16_t)(32767))
1.185 +#endif
1.186 +#ifndef INT32_MAX
1.187 +/** The largest value a 32 bit signed integer can hold @stable ICU 2.0 */
1.188 +# define INT32_MAX ((int32_t)(2147483647))
1.189 +#endif
1.190 +
1.191 +#ifndef UINT8_MAX
1.192 +/** The largest value an 8 bit unsigned integer can hold @stable ICU 2.0 */
1.193 +# define UINT8_MAX ((uint8_t)(255U))
1.194 +#endif
1.195 +#ifndef UINT16_MAX
1.196 +/** The largest value a 16 bit unsigned integer can hold @stable ICU 2.0 */
1.197 +# define UINT16_MAX ((uint16_t)(65535U))
1.198 +#endif
1.199 +#ifndef UINT32_MAX
1.200 +/** The largest value a 32 bit unsigned integer can hold @stable ICU 2.0 */
1.201 +# define UINT32_MAX ((uint32_t)(4294967295U))
1.202 +#endif
1.203 +
1.204 +#if defined(U_INT64_T_UNAVAILABLE)
1.205 +# error int64_t is required for decimal format and rule-based number format.
1.206 +#else
1.207 +# ifndef INT64_C
1.208 +/**
1.209 + * Provides a platform independent way to specify a signed 64-bit integer constant.
1.210 + * note: may be wrong for some 64 bit platforms - ensure your compiler provides INT64_C
1.211 + * @stable ICU 2.8
1.212 + */
1.213 +# define INT64_C(c) c ## LL
1.214 +# endif
1.215 +# ifndef UINT64_C
1.216 +/**
1.217 + * Provides a platform independent way to specify an unsigned 64-bit integer constant.
1.218 + * note: may be wrong for some 64 bit platforms - ensure your compiler provides UINT64_C
1.219 + * @stable ICU 2.8
1.220 + */
1.221 +# define UINT64_C(c) c ## ULL
1.222 +# endif
1.223 +# ifndef U_INT64_MIN
1.224 +/** The smallest value a 64 bit signed integer can hold @stable ICU 2.8 */
1.225 +# define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1))
1.226 +# endif
1.227 +# ifndef U_INT64_MAX
1.228 +/** The largest value a 64 bit signed integer can hold @stable ICU 2.8 */
1.229 +# define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807)))
1.230 +# endif
1.231 +# ifndef U_UINT64_MAX
1.232 +/** The largest value a 64 bit unsigned integer can hold @stable ICU 2.8 */
1.233 +# define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615)))
1.234 +# endif
1.235 +#endif
1.236 +
1.237 +/*==========================================================================*/
1.238 +/* Boolean data type */
1.239 +/*==========================================================================*/
1.240 +
1.241 +/** The ICU boolean type @stable ICU 2.0 */
1.242 +typedef int8_t UBool;
1.243 +
1.244 +#ifndef TRUE
1.245 +/** The TRUE value of a UBool @stable ICU 2.0 */
1.246 +# define TRUE 1
1.247 +#endif
1.248 +#ifndef FALSE
1.249 +/** The FALSE value of a UBool @stable ICU 2.0 */
1.250 +# define FALSE 0
1.251 +#endif
1.252 +
1.253 +
1.254 +/*==========================================================================*/
1.255 +/* Unicode data types */
1.256 +/*==========================================================================*/
1.257 +
1.258 +/* wchar_t-related definitions -------------------------------------------- */
1.259 +
1.260 +/**
1.261 + * \def U_HAVE_WCHAR_H
1.262 + * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
1.263 + *
1.264 + * @stable ICU 2.0
1.265 + */
1.266 +#ifndef U_HAVE_WCHAR_H
1.267 +# define U_HAVE_WCHAR_H 1
1.268 +#endif
1.269 +
1.270 +/**
1.271 + * \def U_SIZEOF_WCHAR_T
1.272 + * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it)
1.273 + *
1.274 + * @stable ICU 2.0
1.275 + */
1.276 +#if U_SIZEOF_WCHAR_T==0
1.277 +# undef U_SIZEOF_WCHAR_T
1.278 +# define U_SIZEOF_WCHAR_T 4
1.279 +#endif
1.280 +
1.281 +/*
1.282 + * \def U_WCHAR_IS_UTF16
1.283 + * Defined if wchar_t uses UTF-16.
1.284 + *
1.285 + * @stable ICU 2.0
1.286 + */
1.287 +/*
1.288 + * \def U_WCHAR_IS_UTF32
1.289 + * Defined if wchar_t uses UTF-32.
1.290 + *
1.291 + * @stable ICU 2.0
1.292 + */
1.293 +#if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
1.294 +# ifdef __STDC_ISO_10646__
1.295 +# if (U_SIZEOF_WCHAR_T==2)
1.296 +# define U_WCHAR_IS_UTF16
1.297 +# elif (U_SIZEOF_WCHAR_T==4)
1.298 +# define U_WCHAR_IS_UTF32
1.299 +# endif
1.300 +# elif defined __UCS2__
1.301 +# if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
1.302 +# define U_WCHAR_IS_UTF16
1.303 +# endif
1.304 +# elif defined __UCS4__
1.305 +# if (U_SIZEOF_WCHAR_T==4)
1.306 +# define U_WCHAR_IS_UTF32
1.307 +# endif
1.308 +# elif defined(U_WINDOWS)
1.309 +# define U_WCHAR_IS_UTF16
1.310 +# endif
1.311 +#endif
1.312 +
1.313 +/* UChar and UChar32 definitions -------------------------------------------- */
1.314 +
1.315 +/** Number of bytes in a UChar. @stable ICU 2.0 */
1.316 +#define U_SIZEOF_UCHAR 2
1.317 +
1.318 +/**
1.319 + * \var UChar
1.320 + * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
1.321 + * If wchar_t is not 16 bits wide, then define UChar to be uint16_t.
1.322 + * This makes the definition of UChar platform-dependent
1.323 + * but allows direct string type compatibility with platforms with
1.324 + * 16-bit wchar_t types.
1.325 + *
1.326 + * @stable ICU 2.0
1.327 + */
1.328 +
1.329 +/* Define UChar to be compatible with wchar_t if possible. */
1.330 +#if U_SIZEOF_WCHAR_T==2
1.331 + typedef wchar_t UChar;
1.332 +#else
1.333 + typedef uint16_t UChar;
1.334 +#endif
1.335 +
1.336 +/**
1.337 + * Define UChar32 as a type for single Unicode code points.
1.338 + * UChar32 is a signed 32-bit integer (same as int32_t).
1.339 + *
1.340 + * The Unicode code point range is 0..0x10ffff.
1.341 + * All other values (negative or >=0x110000) are illegal as Unicode code points.
1.342 + * They may be used as sentinel values to indicate "done", "error"
1.343 + * or similar non-code point conditions.
1.344 + *
1.345 + * Before ICU 2.4 (Jitterbug 2146), UChar32 was defined
1.346 + * to be wchar_t if that is 32 bits wide (wchar_t may be signed or unsigned)
1.347 + * or else to be uint32_t.
1.348 + * That is, the definition of UChar32 was platform-dependent.
1.349 + *
1.350 + * @see U_SENTINEL
1.351 + * @stable ICU 2.4
1.352 + */
1.353 +typedef int32_t UChar32;
1.354 +
1.355 +/*==========================================================================*/
1.356 +/* U_INLINE and U_ALIGN_CODE Set default values if these are not already */
1.357 +/* defined. Definitions normally are in */
1.358 +/* platform.h or the corresponding file for */
1.359 +/* the OS in use. */
1.360 +/*==========================================================================*/
1.361 +
1.362 +/**
1.363 + * \def U_ALIGN_CODE
1.364 + * This is used to align code fragments to a specific byte boundary.
1.365 + * This is useful for getting consistent performance test results.
1.366 + * @internal
1.367 + */
1.368 +#ifndef U_ALIGN_CODE
1.369 +# define U_ALIGN_CODE(n)
1.370 +#endif
1.371 +
1.372 +#ifndef U_INLINE
1.373 +# ifdef XP_CPLUSPLUS
1.374 +# define U_INLINE inline
1.375 +# else
1.376 +# define U_INLINE
1.377 +# endif
1.378 +#endif
1.379 +
1.380 +#include "unicode/urename.h"
1.381 +
1.382 +#endif