1 // © 2016 and later: Unicode, Inc. and others. 2 // License & terms of use: http://www.unicode.org/copyright.html 4 ****************************************************************************** 6 * Copyright (C) 1999-2015, International Business Machines 7 * Corporation and others. All Rights Reserved. 9 ****************************************************************************** 10 * file name: umachine.h 12 * tab size: 8 (not used) 15 * created on: 1999sep13 16 * created by: Markus W. Scherer 18 * This file defines basic types and constants for ICU to be 19 * platform-independent. umachine.h and utf.h are included into 20 * utypes.h to provide all the general definitions for ICU. 21 * All of these definitions used to be in utypes.h before 22 * the UTF-handling macros made this unmaintainable. 25 #ifndef __UMACHINE_H__ 26 #define __UMACHINE_H__ 41 /*==========================================================================*/ 42 /* Include platform-dependent definitions */ 43 /* which are contained in the platform-specific file platform.h */ 44 /*==========================================================================*/ 50 * stddef.h defines wchar_t 55 /*==========================================================================*/ 56 /* For C wrappers, we use the symbol U_CAPI. */ 57 /* This works properly if the includer is C or C++. */ 58 /* Functions are declared U_CAPI return-type U_EXPORT2 function-name()... */ 59 /*==========================================================================*/ 80 # define U_CFUNC extern "C" 81 # define U_CDECL_BEGIN extern "C" {
82 # define U_CDECL_END } 84 # define U_CFUNC extern 85 # define U_CDECL_BEGIN 89 #ifndef U_ATTRIBUTE_DEPRECATED 95 #if U_GCC_MAJOR_MINOR >= 302 96 # define U_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) 102 #elif defined(_MSC_VER) && (_MSC_VER >= 1400) 103 # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) 105 # define U_ATTRIBUTE_DEPRECATED 110 #define U_CAPI U_CFUNC U_EXPORT 112 #define U_STABLE U_CAPI 114 #define U_DRAFT U_CAPI 116 #define U_DEPRECATED U_CAPI U_ATTRIBUTE_DEPRECATED 118 #define U_OBSOLETE U_CAPI 120 #define U_INTERNAL U_CAPI 122 // Before ICU 65, function-like, multi-statement ICU macros were just defined as 123 // series of statements wrapped in { } blocks and the caller could choose to 124 // either treat them as if they were actual functions and end the invocation 125 // with a trailing ; creating an empty statement after the block or else omit 126 // this trailing ; using the knowledge that the macro would expand to { }. 128 // But doing so doesn't work well with macros that look like functions and 129 // compiler warnings about empty statements (ICU-20601) and ICU 65 therefore 130 // switches to the standard solution of wrapping such macros in do { } while. 132 // This will however break existing code that depends on being able to invoke 133 // these macros without a trailing ; so to be able to remain compatible with 134 // such code the wrapper is itself defined as macros so that it's possible to 135 // build ICU 65 and later with the old macro behaviour, like this: 137 // export CPPFLAGS='-DUPRV_BLOCK_MACRO_BEGIN="" -DUPRV_BLOCK_MACRO_END=""' 138 // runConfigureICU ... 146 #ifndef UPRV_BLOCK_MACRO_BEGIN 147 #define UPRV_BLOCK_MACRO_BEGIN do 155 #ifndef UPRV_BLOCK_MACRO_END 156 #define UPRV_BLOCK_MACRO_END while (false) 159 /*==========================================================================*/ 160 /* limits for int32_t etc., like in POSIX inttypes.h */ 161 /*==========================================================================*/ 165 # define INT8_MIN ((int8_t)(-128)) 169 # define INT16_MIN ((int16_t)(-32767-1)) 173 # define INT32_MIN ((int32_t)(-2147483647-1)) 178 # define INT8_MAX ((int8_t)(127)) 182 # define INT16_MAX ((int16_t)(32767)) 186 # define INT32_MAX ((int32_t)(2147483647)) 191 # define UINT8_MAX ((uint8_t)(255U)) 195 # define UINT16_MAX ((uint16_t)(65535U)) 199 # define UINT32_MAX ((uint32_t)(4294967295U)) 202 #if defined(U_INT64_T_UNAVAILABLE) 203 # error int64_t is required for decimal format and rule-based number format. 211 # define INT64_C(c) c ## LL 219 # define UINT64_C(c) c ## ULL 223 # define U_INT64_MIN ((int64_t)(INT64_C(-9223372036854775807)-1)) 227 # define U_INT64_MAX ((int64_t)(INT64_C(9223372036854775807))) 229 # ifndef U_UINT64_MAX 231 # define U_UINT64_MAX ((uint64_t)(UINT64_C(18446744073709551615))) 235 /*==========================================================================*/ 236 /* Boolean data type */ 237 /*==========================================================================*/ 261 #ifdef U_DEFINE_FALSE_AND_TRUE 262 // Use the predefined value. 264 // Default to avoiding collision with non-macro definitions of FALSE & TRUE. 265 # define U_DEFINE_FALSE_AND_TRUE 0 268 #if U_DEFINE_FALSE_AND_TRUE || defined(U_IN_DOXYGEN) 285 #endif// U_DEFINE_FALSE_AND_TRUE 287 /*==========================================================================*/ 288 /* Unicode data types */ 289 /*==========================================================================*/ 291 /* wchar_t-related definitions -------------------------------------------- */ 294 * \def U_WCHAR_IS_UTF16 295 * Defined if wchar_t uses UTF-16. 300 * \def U_WCHAR_IS_UTF32 301 * Defined if wchar_t uses UTF-32. 305 #if !defined(U_WCHAR_IS_UTF16) && !defined(U_WCHAR_IS_UTF32) 306 # ifdef __STDC_ISO_10646__ 307 # if (U_SIZEOF_WCHAR_T==2) 308 # define U_WCHAR_IS_UTF16 309 # elif (U_SIZEOF_WCHAR_T==4) 310 # define U_WCHAR_IS_UTF32 312 # elif defined __UCS2__ 313 # if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2) 314 # define U_WCHAR_IS_UTF16 316 # elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__)) 317 # if (U_SIZEOF_WCHAR_T==4) 318 # define U_WCHAR_IS_UTF32 320 # elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED) 321 # define U_WCHAR_IS_UTF32 322 # elif U_PLATFORM_HAS_WIN32_API 323 # define U_WCHAR_IS_UTF16 327 /* UChar and UChar32 definitions -------------------------------------------- */ 330 #define U_SIZEOF_UCHAR 2 337 #if defined(_MSC_VER) && (_MSC_VER < 1900) 338 // Versions of Visual Studio/MSVC below 2015 do not support char16_t as a real type, 339 // and instead use a typedef. https://msdn.microsoft.com/library/bb531344.aspx 340 # define U_CHAR16_IS_TYPEDEF 1 342 # define U_CHAR16_IS_TYPEDEF 0 371 // #if 1 is normal. UChar defaults to char16_t in C++. 372 // For configuration testing of UChar=uint16_t temporarily change this to #if 0. 374 # define UCHAR_TYPE uint16_t 377 #if defined(U_ALL_IMPLEMENTATION) || !defined(UCHAR_TYPE) 380 typedef UCHAR_TYPE
UChar;
402 #if U_SIZEOF_WCHAR_T==2 404 #elif defined(__CHAR16_TYPE__) 447 #define U_SENTINEL (-1) 449 #include "unicode/urename.h" C API: Definitions of integer types of various widths.
int32_t UChar32
Define UChar32 as a type for single Unicode code points.
int8_t UBool
The ICU boolean type, a signed-byte integer.
char16_t UChar
The base type for UTF-16 code units and pointers.
uint16_t OldUChar
Default ICU 58 definition of UChar.