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 
00106 #define U_CAPI U_CFUNC U_EXPORT
00107 #define U_STABLE U_CAPI
00108 #define U_DRAFT  U_CAPI
00109 #define U_DEPRECATED U_CAPI
00110 #define U_OBSOLETE U_CAPI
00111 #define U_INTERNAL U_CAPI
00112 
00113 /*==========================================================================*/
00114 /* limits for int32_t etc., like in POSIX inttypes.h                        */
00115 /*==========================================================================*/
00116 
00117 #ifndef INT8_MIN
00118 
00119 #   define INT8_MIN        ((int8_t)(-128))
00120 #endif
00121 #ifndef INT16_MIN
00122 
00123 #   define INT16_MIN       ((int16_t)(-32767-1))
00124 #endif
00125 #ifndef INT32_MIN
00126 
00127 #   define INT32_MIN       ((int32_t)(-2147483647-1))
00128 #endif
00129 
00130 #ifndef INT8_MAX
00131 
00132 #   define INT8_MAX        ((int8_t)(127))
00133 #endif
00134 #ifndef INT16_MAX
00135 
00136 #   define INT16_MAX       ((int16_t)(32767))
00137 #endif
00138 #ifndef INT32_MAX
00139 
00140 #   define INT32_MAX       ((int32_t)(2147483647))
00141 #endif
00142 
00143 #ifndef UINT8_MAX
00144 
00145 #   define UINT8_MAX       ((uint8_t)(255U))
00146 #endif
00147 #ifndef UINT16_MAX
00148 
00149 #   define UINT16_MAX      ((uint16_t)(65535U))
00150 #endif
00151 #ifndef UINT32_MAX
00152 
00153 #   define UINT32_MAX      ((uint32_t)(4294967295U))
00154 #endif
00155 
00156 #if defined(U_INT64_T_UNAVAILABLE)
00157 # error int64_t is required for decimal format and rule-based number format.
00158 #else
00159 # ifndef INT64_C
00160 
00165 #   define INT64_C(c) c ## LL
00166 # endif
00167 # ifndef UINT64_C
00168 
00173 #   define UINT64_C(c) c ## ULL
00174 # endif
00175 # ifndef U_INT64_MIN
00176 
00177 #     define U_INT64_MIN       ((int64_t)(INT64_C(-9223372036854775807)-1))
00178 # endif
00179 # ifndef U_INT64_MAX
00180 
00181 #     define U_INT64_MAX       ((int64_t)(INT64_C(9223372036854775807)))
00182 # endif
00183 # ifndef U_UINT64_MAX
00184 
00185 #     define U_UINT64_MAX      ((uint64_t)(UINT64_C(18446744073709551615)))
00186 # endif
00187 #endif
00188 
00189 /*==========================================================================*/
00190 /* Boolean data type                                                        */
00191 /*==========================================================================*/
00192 
00194 typedef int8_t UBool;
00195 
00196 #ifndef TRUE
00197 
00198 #   define TRUE  1
00199 #endif
00200 #ifndef FALSE
00201 
00202 #   define FALSE 0
00203 #endif
00204 
00205 
00206 /*==========================================================================*/
00207 /* Unicode data types                                                       */
00208 /*==========================================================================*/
00209 
00210 /* wchar_t-related definitions -------------------------------------------- */
00211 
00218 #ifndef U_HAVE_WCHAR_H
00219 #   define U_HAVE_WCHAR_H 1
00220 #endif
00221 
00228 #if U_SIZEOF_WCHAR_T==0
00229 #   undef U_SIZEOF_WCHAR_T
00230 #   define U_SIZEOF_WCHAR_T 4
00231 #endif
00232 
00233 /*
00234  * \def U_WCHAR_IS_UTF16
00235  * Defined if wchar_t uses UTF-16.
00236  *
00237  * @stable ICU 2.0
00238  */
00239 /*
00240  * \def U_WCHAR_IS_UTF32
00241  * Defined if wchar_t uses UTF-32.
00242  *
00243  * @stable ICU 2.0
00244  */
00245 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32)
00246 #   ifdef __STDC_ISO_10646__ 
00247 #       if (U_SIZEOF_WCHAR_T==2)
00248 #           define U_WCHAR_IS_UTF16
00249 #       elif (U_SIZEOF_WCHAR_T==4)
00250 #           define  U_WCHAR_IS_UTF32
00251 #       endif
00252 #   elif defined __UCS2__
00253 #       if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2)
00254 #           define U_WCHAR_IS_UTF16
00255 #       endif
00256 #   elif defined __UCS4__
00257 #       if (U_SIZEOF_WCHAR_T==4)
00258 #           define U_WCHAR_IS_UTF32
00259 #       endif
00260 #   elif defined(U_WINDOWS)
00261 #       define U_WCHAR_IS_UTF16    
00262 #   endif
00263 #endif
00264 
00265 /* UChar and UChar32 definitions -------------------------------------------- */
00266 
00268 #define U_SIZEOF_UCHAR 2
00269 
00281 /* Define UChar to be compatible with wchar_t if possible. */
00282 #if U_SIZEOF_WCHAR_T==2
00283     typedef wchar_t UChar;
00284 #else
00285     typedef uint16_t UChar;
00286 #endif
00287 
00305 typedef int32_t UChar32;
00306 
00307 /*==========================================================================*/
00308 /* U_INLINE and U_ALIGN_CODE   Set default values if these are not already  */
00309 /*                             defined.  Definitions normally are in        */
00310 /*                             platform.h or the corresponding file for     */
00311 /*                             the OS in use.                               */
00312 /*==========================================================================*/
00313 
00314 #ifndef U_HIDE_INTERNAL_API
00315 
00322 #ifndef U_ALIGN_CODE
00323 #   define U_ALIGN_CODE(n)
00324 #endif
00325 
00326 #endif /* U_HIDE_INTERNAL_API */
00327 
00328 #ifndef U_INLINE
00329 #   ifdef XP_CPLUSPLUS
00330 #       define U_INLINE inline
00331 #   else
00332 #       define U_INLINE
00333 #   endif
00334 #endif
00335 
00336 #include "unicode/urename.h"
00337 
00338 #endif

Generated on Tue Oct 2 10:17:48 2007 for ICU 3.8 by  doxygen 1.5.2