umachine.h

Go to the documentation of this file.
00001 /*
00002 ******************************************************************************
00003 *
00004 *   Copyright (C) 1999-2008, 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 
00106 #if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 2))
00107 #    define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated))
00108 
00109 #elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400)
00110 #    define U_ATTRIBUTE_DEPRECATED __declspec(deprecated)
00111 #else
00112 #    define U_ATTRIBUTE_DEPRECATED
00113 #endif
00114 
00115 #define U_CAPI U_CFUNC U_EXPORT
00116 
00117 #define U_STABLE U_CAPI
00118 
00119 #define U_DRAFT  U_CAPI
00120 
00121 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED
00122 
00123 #define U_OBSOLETE U_CAPI
00124 
00125 #define U_INTERNAL U_CAPI
00126 
00127 /*==========================================================================*/
00128 /* limits for int32_t etc., like in POSIX inttypes.h                        */
00129 /*==========================================================================*/
00130 
00131 #ifndef INT8_MIN
00132 
00133 #   define INT8_MIN        ((int8_t)(-128))
00134 #endif
00135 #ifndef INT16_MIN
00136 
00137 #   define INT16_MIN       ((int16_t)(-32767-1))
00138 #endif
00139 #ifndef INT32_MIN
00140 
00141 #   define INT32_MIN       ((int32_t)(-2147483647-1))
00142 #endif
00143 
00144 #ifndef INT8_MAX
00145 
00146 #   define INT8_MAX        ((int8_t)(127))
00147 #endif
00148 #ifndef INT16_MAX
00149 
00150 #   define INT16_MAX       ((int16_t)(32767))
00151 #endif
00152 #ifndef INT32_MAX
00153 
00154 #   define INT32_MAX       ((int32_t)(2147483647))
00155 #endif
00156 
00157 #ifndef UINT8_MAX
00158 
00159 #   define UINT8_MAX       ((uint8_t)(255U))
00160 #endif
00161 #ifndef UINT16_MAX
00162 
00163 #   define UINT16_MAX      ((uint16_t)(65535U))
00164 #endif
00165 #ifndef UINT32_MAX
00166 
00167 #   define UINT32_MAX      ((uint32_t)(4294967295U))
00168 #endif
00169 
00170 #if defined(U_INT64_T_UNAVAILABLE)
00171 # error int64_t is required for decimal format and rule-based number format.
00172 #else
00173 # ifndef INT64_C
00174 
00179 #   define INT64_C(c) c ## LL
00180 # endif
00181 # ifndef UINT64_C
00182 
00187 #   define UINT64_C(c) c ## ULL
00188 # endif
00189 # ifndef U_INT64_MIN
00190 
00191 #     define U_INT64_MIN       ((int64_t)(INT64_C(-9223372036854775807)-1))
00192 # endif
00193 # ifndef U_INT64_MAX
00194 
00195 #     define U_INT64_MAX       ((int64_t)(INT64_C(9223372036854775807)))
00196 # endif
00197 # ifndef U_UINT64_MAX
00198 
00199 #     define U_UINT64_MAX      ((uint64_t)(UINT64_C(18446744073709551615)))
00200 # endif
00201 #endif
00202 
00203 /*==========================================================================*/
00204 /* Boolean data type                                                        */
00205 /*==========================================================================*/
00206 
00208 typedef int8_t UBool;
00209 
00210 #ifndef TRUE
00211 
00212 #   define TRUE  1
00213 #endif
00214 #ifndef FALSE
00215 
00216 #   define FALSE 0
00217 #endif
00218 
00219 
00220 /*==========================================================================*/
00221 /* Unicode data types                                                       */
00222 /*==========================================================================*/
00223 
00224 /* wchar_t-related definitions -------------------------------------------- */
00225 
00232 #ifndef U_HAVE_WCHAR_H
00233 #   define U_HAVE_WCHAR_H 1
00234 #endif
00235 
00242 #if U_SIZEOF_WCHAR_T==0
00243 #   undef U_SIZEOF_WCHAR_T
00244 #   define U_SIZEOF_WCHAR_T 4
00245 #endif
00246 
00247 /*
00248  * \def U_WCHAR_IS_UTF16
00249  * Defined if wchar_t uses UTF-16.
00250  *
00251  * @stable ICU 2.0
00252  */
00253 /*
00254  * \def U_WCHAR_IS_UTF32
00255  * Defined if wchar_t uses UTF-32.
00256  *
00257  * @stable ICU 2.0
00258  */
00259 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
00260 #   ifdef __STDC_ISO_10646__
00261 #       if (U_SIZEOF_WCHAR_T==2)
00262 #           define U_WCHAR_IS_UTF16
00263 #       elif (U_SIZEOF_WCHAR_T==4)
00264 #           define  U_WCHAR_IS_UTF32
00265 #       endif
00266 #   elif defined __UCS2__
00267 #       if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
00268 #           define U_WCHAR_IS_UTF16
00269 #       endif
00270 #   elif defined __UCS4__
00271 #       if (U_SIZEOF_WCHAR_T==4)
00272 #           define U_WCHAR_IS_UTF32
00273 #       endif
00274 #   elif defined(U_WINDOWS)
00275 #       define U_WCHAR_IS_UTF16
00276 #   endif
00277 #endif
00278 
00279 /* UChar and UChar32 definitions -------------------------------------------- */
00280 
00282 #define U_SIZEOF_UCHAR 2
00283 
00295 /* Define UChar to be compatible with wchar_t if possible. */
00296 #if U_SIZEOF_WCHAR_T==2
00297     typedef wchar_t UChar;
00298 #else
00299     typedef uint16_t UChar;
00300 #endif
00301 
00319 typedef int32_t UChar32;
00320 
00321 /*==========================================================================*/
00322 /* U_INLINE and U_ALIGN_CODE   Set default values if these are not already  */
00323 /*                             defined.  Definitions normally are in        */
00324 /*                             platform.h or the corresponding file for     */
00325 /*                             the OS in use.                               */
00326 /*==========================================================================*/
00327 
00328 #ifndef U_HIDE_INTERNAL_API
00329 
00336 #ifndef U_ALIGN_CODE
00337 #   define U_ALIGN_CODE(n)
00338 #endif
00339 
00340 #endif /* U_HIDE_INTERNAL_API */
00341 
00347 #ifndef U_INLINE
00348 #   ifdef XP_CPLUSPLUS
00349 #       define U_INLINE inline
00350 #   else
00351 #       define U_INLINE
00352 #   endif
00353 #endif
00354 
00355 #include "unicode/urename.h"
00356 
00357 #endif

Generated on 20 Mar 2013 for ICU 4.2.1 by  doxygen 1.4.7