ICU 4.8.1.1  4.8.1.1
umachine.h
Go to the documentation of this file.
00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 1999-2011, 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 /*
00048  * platform.h is now also generated by MSVC Solution/Project files
00049  * from platform.win and should always be included unless you are
00050  * building stubdata which is built before the platform.h file is
00051  * generated.
00052  */
00053 #ifndef STUBDATA_BUILD
00054 #   include "unicode/platform.h"
00055 #endif
00056 #   include "unicode/pwin32.h"
00057 #else
00058 #   include "unicode/ptypes.h" /* platform.h is included in ptypes.h */
00059 #endif
00060 
00061 /*
00062  * ANSI C headers:
00063  * stddef.h defines wchar_t
00064  */
00065 #include <stddef.h>
00066 
00067 /*==========================================================================*/
00068 /* XP_CPLUSPLUS is a cross-platform symbol which should be defined when     */
00069 /* using C++.  It should not be defined when compiling under C.             */
00070 /*==========================================================================*/
00071 
00072 #ifdef __cplusplus
00073 #   ifndef XP_CPLUSPLUS
00074 #       define XP_CPLUSPLUS
00075 #   endif
00076 #else
00077 #   undef XP_CPLUSPLUS
00078 #endif
00079 
00080 /*==========================================================================*/
00081 /* For C wrappers, we use the symbol U_STABLE.                                */
00082 /* This works properly if the includer is C or C++.                         */
00083 /* Functions are declared   U_STABLE return-type U_EXPORT2 function-name()... */
00084 /*==========================================================================*/
00085 
00104 #ifdef XP_CPLUSPLUS
00105 #   define U_CFUNC extern "C"
00106 #   define U_CDECL_BEGIN extern "C" {
00107 #   define U_CDECL_END   }
00108 #else
00109 #   define U_CFUNC extern
00110 #   define U_CDECL_BEGIN
00111 #   define U_CDECL_END
00112 #endif
00113 
00114 #ifndef U_ATTRIBUTE_DEPRECATED
00115 
00120 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
00121 #    define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
00122 
00127 #elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
00128 #    define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
00129 #else
00130 #    define U_ATTRIBUTE_DEPRECATED
00131 #endif
00132 #endif
00133 
00135 #define U_CAPI U_CFUNC U_EXPORT
00136 
00137 #define U_STABLE U_CAPI
00138 
00139 #define U_DRAFT  U_CAPI
00140 
00141 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
00142 
00143 #define U_OBSOLETE U_CAPI
00144 
00145 #define U_INTERNAL U_CAPI
00146 
00147 /*==========================================================================*/
00148 /* limits for int32_t etc., like in POSIX inttypes.h                        */
00149 /*==========================================================================*/
00150 
00151 #ifndef INT8_MIN
00152 
00153 #   define INT8_MIN        ((int8_t)(-128))
00154 #endif
00155 #ifndef INT16_MIN
00156 
00157 #   define INT16_MIN       ((int16_t)(-32767-1))
00158 #endif
00159 #ifndef INT32_MIN
00160 
00161 #   define INT32_MIN       ((int32_t)(-2147483647-1))
00162 #endif
00163 
00164 #ifndef INT8_MAX
00165 
00166 #   define INT8_MAX        ((int8_t)(127))
00167 #endif
00168 #ifndef INT16_MAX
00169 
00170 #   define INT16_MAX       ((int16_t)(32767))
00171 #endif
00172 #ifndef INT32_MAX
00173 
00174 #   define INT32_MAX       ((int32_t)(2147483647))
00175 #endif
00176 
00177 #ifndef UINT8_MAX
00178 
00179 #   define UINT8_MAX       ((uint8_t)(255U))
00180 #endif
00181 #ifndef UINT16_MAX
00182 
00183 #   define UINT16_MAX      ((uint16_t)(65535U))
00184 #endif
00185 #ifndef UINT32_MAX
00186 
00187 #   define UINT32_MAX      ((uint32_t)(4294967295U))
00188 #endif
00189 
00190 #if defined(U_INT64_T_UNAVAILABLE)
00191 # error int64_t is required for decimal format and rule-based number format.
00192 #else
00193 # ifndef INT64_C
00194 
00199 #   define INT64_C(c) c ## LL
00200 # endif
00201 # ifndef UINT64_C
00202 
00207 #   define UINT64_C(c) c ## ULL
00208 # endif
00209 # ifndef U_INT64_MIN
00210 
00211 #     define U_INT64_MIN       ((int64_t)(INT64_C(-9223372036854775807)-1))
00212 # endif
00213 # ifndef U_INT64_MAX
00214 
00215 #     define U_INT64_MAX       ((int64_t)(INT64_C(9223372036854775807)))
00216 # endif
00217 # ifndef U_UINT64_MAX
00218 
00219 #     define U_UINT64_MAX      ((uint64_t)(UINT64_C(18446744073709551615)))
00220 # endif
00221 #endif
00222 
00223 /*==========================================================================*/
00224 /* Boolean data type                                                        */
00225 /*==========================================================================*/
00226 
00228 typedef int8_t UBool;
00229 
00230 #ifndef TRUE
00231 
00232 #   define TRUE  1
00233 #endif
00234 #ifndef FALSE
00235 
00236 #   define FALSE 0
00237 #endif
00238 
00239 
00240 /*==========================================================================*/
00241 /* Unicode data types                                                       */
00242 /*==========================================================================*/
00243 
00244 /* wchar_t-related definitions -------------------------------------------- */
00245 
00252 #ifndef U_HAVE_WCHAR_H
00253 #   define U_HAVE_WCHAR_H 1
00254 #endif
00255 
00262 #if U_SIZEOF_WCHAR_T==0
00263 #   undef U_SIZEOF_WCHAR_T
00264 #   define U_SIZEOF_WCHAR_T 4
00265 #endif
00266 
00267 /*
00268  * \def U_WCHAR_IS_UTF16
00269  * Defined if wchar_t uses UTF-16.
00270  *
00271  * @stable ICU 2.0
00272  */
00273 /*
00274  * \def U_WCHAR_IS_UTF32
00275  * Defined if wchar_t uses UTF-32.
00276  *
00277  * @stable ICU 2.0
00278  */
00279 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
00280 #   ifdef __STDC_ISO_10646__
00281 #       if (U_SIZEOF_WCHAR_T==2)
00282 #           define U_WCHAR_IS_UTF16
00283 #       elif (U_SIZEOF_WCHAR_T==4)
00284 #           define  U_WCHAR_IS_UTF32
00285 #       endif
00286 #   elif defined __UCS2__
00287 #       if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
00288 #           define U_WCHAR_IS_UTF16
00289 #       endif
00290 #   elif defined __UCS4__
00291 #       if (U_SIZEOF_WCHAR_T==4)
00292 #           define U_WCHAR_IS_UTF32
00293 #       endif
00294 #   elif defined(U_WINDOWS)
00295 #       define U_WCHAR_IS_UTF16
00296 #   endif
00297 #endif
00298 
00299 /* UChar and UChar32 definitions -------------------------------------------- */
00300 
00302 #define U_SIZEOF_UCHAR 2
00303 
00316 /* Define UChar to be compatible with wchar_t if possible. */
00317 #if U_SIZEOF_WCHAR_T==2
00318     typedef wchar_t UChar;
00319 #elif U_GNUC_UTF16_STRING
00320 #if defined _GCC_
00321     typedef __CHAR16_TYPE__ char16_t;
00322 #endif
00323     typedef char16_t UChar;
00324 #else
00325     typedef uint16_t UChar;
00326 #endif
00327 
00345 typedef int32_t UChar32;
00346 
00347 /*==========================================================================*/
00348 /* U_INLINE and U_ALIGN_CODE   Set default values if these are not already  */
00349 /*                             defined.  Definitions normally are in        */
00350 /*                             platform.h or the corresponding file for     */
00351 /*                             the OS in use.                               */
00352 /*==========================================================================*/
00353 
00354 #ifndef U_HIDE_INTERNAL_API
00355 
00362 #ifndef U_ALIGN_CODE
00363 #   define U_ALIGN_CODE(n)
00364 #endif
00365 
00366 #endif /* U_HIDE_INTERNAL_API */
00367 
00374 #ifndef U_INLINE
00375 #   ifdef XP_CPLUSPLUS
00376 #       define U_INLINE inline
00377 #   else
00378 #       define U_INLINE
00379 #   endif
00380 #endif
00381 
00382 #include "unicode/urename.h"
00383 
00384 #endif
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines