Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/native/common/unicode/platform.h
38827 views
/*1******************************************************************************2*3* Copyright (C) 1997-2016, International Business Machines4* Corporation and others. All Rights Reserved.5*6******************************************************************************7*8* FILE NAME : platform.h9*10* Date Name Description11* 05/13/98 nos Creation (content moved here from ptypes.h).12* 03/02/99 stephen Added AS400 support.13* 03/30/99 stephen Added Linux support.14* 04/13/99 stephen Reworked for autoconf.15******************************************************************************16*/1718#ifndef _PLATFORM_H19#define _PLATFORM_H2021#include "unicode/uconfig.h"22#include "unicode/uvernum.h"2324/**25* \file26* \brief Basic types for the platform.27*28* This file used to be generated by autoconf/configure.29* Starting with ICU 49, platform.h is a normal source file,30* to simplify cross-compiling and working with non-autoconf/make build systems.31*32* When a value in this file does not work on a platform, then please33* try to derive it from the U_PLATFORM value34* (for which we might need a new value constant in rare cases)35* and/or from other macros that are predefined by the compiler36* or defined in standard (POSIX or platform or compiler) headers.37*38* As a temporary workaround, you can add an explicit <code>#define</code> for some macros39* before it is first tested, or add an equivalent -D macro definition40* to the compiler's command line.41*42* Note: Some compilers provide ways to show the predefined macros.43* For example, with gcc you can compile an empty .c file and have the compiler44* print the predefined macros with45* \code46* gcc -E -dM -x c /dev/null | sort47* \endcode48* (You can provide an actual empty .c file rather than /dev/null.49* <code>-x c++</code> is for C++.)50*/5152/**53* Define some things so that they can be documented.54* @internal55*/56#ifdef U_IN_DOXYGEN57/*58* Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented.59* Solution: #define any defines for non @internal API here, so that they are visible in the docs. If you just set PREDEFINED in Doxyfile.in, they won't be documented.60*/6162/* None for now. */63#endif6465/**66* \def U_PLATFORM67* The U_PLATFORM macro defines the platform we're on.68*69* We used to define one different, value-less macro per platform.70* That made it hard to know the set of relevant platforms and macros,71* and hard to deal with variants of platforms.72*73* Starting with ICU 49, we define platforms as numeric macros,74* with ranges of values for related platforms and their variants.75* The U_PLATFORM macro is set to one of these values.76*77* Historical note from the Solaris Wikipedia article:78* AT&T and Sun collaborated on a project to merge the most popular Unix variants79* on the market at that time: BSD, System V, and Xenix.80* This became Unix System V Release 4 (SVR4).81*82* @internal83*/8485/** Unknown platform. @internal */86#define U_PF_UNKNOWN 087/** Windows @internal */88#define U_PF_WINDOWS 100089/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */90#define U_PF_MINGW 180091/**92* Cygwin. Windows, calls to cygwin1.dll for Posix functions,93* using MSVC or GNU gcc and binutils.94* @internal95*/96#define U_PF_CYGWIN 190097/* Reserve 2000 for U_PF_UNIX? */98/** HP-UX is based on UNIX System V. @internal */99#define U_PF_HPUX 2100100/** Solaris is a Unix operating system based on SVR4. @internal */101#define U_PF_SOLARIS 2600102/** BSD is a UNIX operating system derivative. @internal */103#define U_PF_BSD 3000104/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */105#define U_PF_AIX 3100106/** IRIX is based on UNIX System V with BSD extensions. @internal */107#define U_PF_IRIX 3200108/**109* Darwin is a POSIX-compliant operating system, composed of code developed by Apple,110* as well as code derived from NeXTSTEP, BSD, and other projects,111* built around the Mach kernel.112* Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.113* (Original description modified from WikiPedia.)114* @internal115*/116#define U_PF_DARWIN 3500117/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */118#define U_PF_IPHONE 3550119/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */120#define U_PF_QNX 3700121/** Linux is a Unix-like operating system. @internal */122#define U_PF_LINUX 4000123/**124* Native Client is pretty close to Linux.125* See https://developer.chrome.com/native-client and126* http://www.chromium.org/nativeclient127* @internal128*/129#define U_PF_BROWSER_NATIVE_CLIENT 4020130/** Android is based on Linux. @internal */131#define U_PF_ANDROID 4050132/* Maximum value for Linux-based platform is 4499 */133/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */134#define U_PF_OS390 9000135/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */136#define U_PF_OS400 9400137138#ifdef U_PLATFORM139/* Use the predefined value. */140#elif defined(__MINGW32__)141# define U_PLATFORM U_PF_MINGW142#elif defined(__CYGWIN__)143# define U_PLATFORM U_PF_CYGWIN144#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)145# define U_PLATFORM U_PF_WINDOWS146#elif defined(__ANDROID__)147# define U_PLATFORM U_PF_ANDROID148/* Android wchar_t support depends on the API level. */149# include <android/api-level.h>150#elif defined(__native_client__)151# define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT152#elif defined(linux) || defined(__linux__) || defined(__linux)153# define U_PLATFORM U_PF_LINUX154#elif defined(__APPLE__) && defined(__MACH__)155# include <TargetConditionals.h>156# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */157# define U_PLATFORM U_PF_IPHONE158# else159# define U_PLATFORM U_PF_DARWIN160# endif161#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)162# if defined(__FreeBSD__)163# include <sys/endian.h>164# endif165# define U_PLATFORM U_PF_BSD166#elif defined(sun) || defined(__sun)167/* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */168# define U_PLATFORM U_PF_SOLARIS169# if defined(__GNUC__)170/* Solaris/GCC needs this header file to get the proper endianness. Normally, this171* header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h172* is included which does not include this header file.173*/174# include <sys/isa_defs.h>175# endif176#elif defined(_AIX) || defined(__TOS_AIX__)177# define U_PLATFORM U_PF_AIX178#elif defined(_hpux) || defined(hpux) || defined(__hpux)179# define U_PLATFORM U_PF_HPUX180#elif defined(sgi) || defined(__sgi)181# define U_PLATFORM U_PF_IRIX182#elif defined(__QNX__) || defined(__QNXNTO__)183# define U_PLATFORM U_PF_QNX184#elif defined(__TOS_MVS__)185# define U_PLATFORM U_PF_OS390186#elif defined(__OS400__) || defined(__TOS_OS400__)187# define U_PLATFORM U_PF_OS400188#else189# define U_PLATFORM U_PF_UNKNOWN190#endif191192/**193* \def CYGWINMSVC194* Defined if this is Windows with Cygwin, but using MSVC rather than gcc.195* Otherwise undefined.196* @internal197*/198/* Commented out because this is already set in mh-cygwin-msvc199#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)200# define CYGWINMSVC201#endif202*/203204/**205* \def U_PLATFORM_USES_ONLY_WIN32_API206* Defines whether the platform uses only the Win32 API.207* Set to 1 for Windows/MSVC and MinGW but not Cygwin.208* @internal209*/210#ifdef U_PLATFORM_USES_ONLY_WIN32_API211/* Use the predefined value. */212#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)213# define U_PLATFORM_USES_ONLY_WIN32_API 1214#else215/* Cygwin implements POSIX. */216# define U_PLATFORM_USES_ONLY_WIN32_API 0217#endif218219/**220* \def U_PLATFORM_HAS_WIN32_API221* Defines whether the Win32 API is available on the platform.222* Set to 1 for Windows/MSVC, MinGW and Cygwin.223* @internal224*/225#ifdef U_PLATFORM_HAS_WIN32_API226/* Use the predefined value. */227#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN228# define U_PLATFORM_HAS_WIN32_API 1229#else230# define U_PLATFORM_HAS_WIN32_API 0231#endif232233/**234* \def U_PLATFORM_IMPLEMENTS_POSIX235* Defines whether the platform implements (most of) the POSIX API.236* Set to 1 for Cygwin and most other platforms.237* @internal238*/239#ifdef U_PLATFORM_IMPLEMENTS_POSIX240/* Use the predefined value. */241#elif U_PLATFORM_USES_ONLY_WIN32_API242# define U_PLATFORM_IMPLEMENTS_POSIX 0243#else244# define U_PLATFORM_IMPLEMENTS_POSIX 1245#endif246247/**248* \def U_PLATFORM_IS_LINUX_BASED249* Defines whether the platform is Linux or one of its derivatives.250* @internal251*/252#ifdef U_PLATFORM_IS_LINUX_BASED253/* Use the predefined value. */254#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499255# define U_PLATFORM_IS_LINUX_BASED 1256#else257# define U_PLATFORM_IS_LINUX_BASED 0258#endif259260/**261* \def U_PLATFORM_IS_DARWIN_BASED262* Defines whether the platform is Darwin or one of its derivatives.263* @internal264*/265#ifdef U_PLATFORM_IS_DARWIN_BASED266/* Use the predefined value. */267#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE268# define U_PLATFORM_IS_DARWIN_BASED 1269#else270# define U_PLATFORM_IS_DARWIN_BASED 0271#endif272273/**274* \def U_HAVE_STDINT_H275* Defines whether stdint.h is available. It is a C99 standard header.276* We used to include inttypes.h which includes stdint.h but we usually do not need277* the additional definitions from inttypes.h.278* @internal279*/280#ifdef U_HAVE_STDINT_H281/* Use the predefined value. */282#elif U_PLATFORM_USES_ONLY_WIN32_API283# if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600)284/* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */285# define U_HAVE_STDINT_H 1286# else287# define U_HAVE_STDINT_H 0288# endif289#elif U_PLATFORM == U_PF_SOLARIS290/* Solaris has inttypes.h but not stdint.h. */291# define U_HAVE_STDINT_H 0292#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)293/* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */294# define U_HAVE_STDINT_H 0295#else296# define U_HAVE_STDINT_H 1297#endif298299/**300* \def U_HAVE_INTTYPES_H301* Defines whether inttypes.h is available. It is a C99 standard header.302* We include inttypes.h where it is available but stdint.h is not.303* @internal304*/305#ifdef U_HAVE_INTTYPES_H306/* Use the predefined value. */307#elif U_PLATFORM == U_PF_SOLARIS308/* Solaris has inttypes.h but not stdint.h. */309# define U_HAVE_INTTYPES_H 1310#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)311/* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */312# define U_HAVE_INTTYPES_H 1313#else314/* Most platforms have both inttypes.h and stdint.h, or neither. */315# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H316#endif317318/**319* \def U_IOSTREAM_SOURCE320* Defines what support for C++ streams is available.321*322* If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available323* (the ISO/IEC C++ FDIS was published in November 1997), and then324* one should qualify streams using the std namespace in ICU header325* files.326* Starting with ICU 49, this is the only supported version.327*328* If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is329* available instead (in June 1985 Stroustrup published330* "An Extensible I/O Facility for C++" at the summer USENIX conference).331* Starting with ICU 49, this version is not supported any more.332*333* If U_IOSTREAM_SOURCE is 0 (or any value less than 199711),334* then C++ streams are not available and335* support for them will be silently suppressed in ICU.336*337* @internal338*/339#ifndef U_IOSTREAM_SOURCE340#define U_IOSTREAM_SOURCE 199711341#endif342343/**344* \def U_HAVE_STD_STRING345* Defines whether the standard C++ (STL) <string> header is available.346* @internal347*/348#ifdef U_HAVE_STD_STRING349/* Use the predefined value. */350#else351# define U_HAVE_STD_STRING 1352#endif353354/*===========================================================================*/355/** @{ Compiler and environment features */356/*===========================================================================*/357358/**359* \def U_GCC_MAJOR_MINOR360* Indicates whether the compiler is gcc (test for != 0),361* and if so, contains its major (times 100) and minor version numbers.362* If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.363*364* For example, for testing for whether we have gcc, and whether it's 4.6 or higher,365* use "#if U_GCC_MAJOR_MINOR >= 406".366* @internal367*/368#ifdef __GNUC__369# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)370#else371# define U_GCC_MAJOR_MINOR 0372#endif373374/**375* \def U_IS_BIG_ENDIAN376* Determines the endianness of the platform.377* @internal378*/379#ifdef U_IS_BIG_ENDIAN380/* Use the predefined value. */381#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)382# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)383#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)384/* gcc */385# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)386#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)387# define U_IS_BIG_ENDIAN 1388#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)389# define U_IS_BIG_ENDIAN 0390#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__)391/* These platforms do not appear to predefine any endianness macros. */392# define U_IS_BIG_ENDIAN 1393#elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0)394/* HPPA do not appear to predefine any endianness macros. */395# define U_IS_BIG_ENDIAN 1396#elif defined(sparc) || defined(__sparc) || defined(__sparc__)397/* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */398# define U_IS_BIG_ENDIAN 1399#else400# define U_IS_BIG_ENDIAN 0401#endif402403/**404* \def U_HAVE_PLACEMENT_NEW405* Determines whether to override placement new and delete for STL.406* @stable ICU 2.6407*/408#ifdef U_HAVE_PLACEMENT_NEW409/* Use the predefined value. */410#elif defined(__BORLANDC__)411# define U_HAVE_PLACEMENT_NEW 0412#else413# define U_HAVE_PLACEMENT_NEW 1414#endif415416/**417* \def U_HAVE_DEBUG_LOCATION_NEW418* Define this to define the MFC debug version of the operator new.419*420* @stable ICU 3.4421*/422#ifdef U_HAVE_DEBUG_LOCATION_NEW423/* Use the predefined value. */424#elif defined(_MSC_VER)425# define U_HAVE_DEBUG_LOCATION_NEW 1426#else427# define U_HAVE_DEBUG_LOCATION_NEW 0428#endif429430/* Compatibility with non clang compilers: http://clang.llvm.org/docs/LanguageExtensions.html */431#ifndef __has_attribute432# define __has_attribute(x) 0433#endif434#ifndef __has_cpp_attribute435# define __has_cpp_attribute(x) 0436#endif437#ifndef __has_builtin438# define __has_builtin(x) 0439#endif440#ifndef __has_feature441# define __has_feature(x) 0442#endif443#ifndef __has_extension444# define __has_extension(x) 0445#endif446#ifndef __has_warning447# define __has_warning(x) 0448#endif449450/**451* \def U_MALLOC_ATTR452* Attribute to mark functions as malloc-like453* @internal454*/455#if defined(__GNUC__) && __GNUC__>=3456# define U_MALLOC_ATTR __attribute__ ((__malloc__))457#else458# define U_MALLOC_ATTR459#endif460461/**462* \def U_ALLOC_SIZE_ATTR463* Attribute to specify the size of the allocated buffer for malloc-like functions464* @internal465*/466#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size)467# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))468# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))469#else470# define U_ALLOC_SIZE_ATTR(X)471# define U_ALLOC_SIZE_ATTR2(X,Y)472#endif473474/**475* \def U_CPLUSPLUS_VERSION476* 0 if no C++; 1, 11, 14, ... if C++.477* Support for specific features cannot always be determined by the C++ version alone.478* @internal479*/480#ifdef U_CPLUSPLUS_VERSION481# if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus)482# undef U_CPLUSPLUS_VERSION483# define U_CPLUSPLUS_VERSION 0484# endif485/* Otherwise use the predefined value. */486#elif !defined(__cplusplus)487# define U_CPLUSPLUS_VERSION 0488#elif __cplusplus >= 201402L489# define U_CPLUSPLUS_VERSION 14490#elif __cplusplus >= 201103L491# define U_CPLUSPLUS_VERSION 11492#else493// C++98 or C++03494# define U_CPLUSPLUS_VERSION 1495#endif496497/**498* \def U_HAVE_RVALUE_REFERENCES499* Set to 1 if the compiler supports rvalue references.500* C++11 feature, necessary for move constructor & move assignment.501* @internal502*/503#ifdef U_HAVE_RVALUE_REFERENCES504/* Use the predefined value. */505#elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_rvalue_references) \506|| defined(__GXX_EXPERIMENTAL_CXX0X__) \507|| (defined(_MSC_VER) && _MSC_VER >= 1600) /* Visual Studio 2010 */508# define U_HAVE_RVALUE_REFERENCES 1509#else510# define U_HAVE_RVALUE_REFERENCES 0511#endif512513/**514* \def U_NOEXCEPT515* "noexcept" if supported, otherwise empty.516* Some code, especially STL containers, uses move semantics of objects only517* if the move constructor and the move operator are declared as not throwing exceptions.518* @internal519*/520#ifdef U_NOEXCEPT521/* Use the predefined value. */522#elif defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS /* Visual Studio */523# define U_NOEXCEPT524#elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_noexcept) || __has_extension(cxx_noexcept) \525|| (defined(_MSC_VER) && _MSC_VER >= 1900) /* Visual Studio 2015 */526# define U_NOEXCEPT noexcept527#else528# define U_NOEXCEPT529#endif530531/**532* \def U_FALLTHROUGH533* Annotate intentional fall-through between switch labels.534* http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough535* @internal536*/537#ifdef __cplusplus538# if __has_cpp_attribute(clang::fallthrough) || \539(__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough"))540# define U_FALLTHROUGH [[clang::fallthrough]]541# else542# define U_FALLTHROUGH543# endif544#else545# define U_FALLTHROUGH546#endif547548549/** @} */550551/*===========================================================================*/552/** @{ Character data types */553/*===========================================================================*/554555/**556* U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.557* @stable ICU 2.0558*/559#define U_ASCII_FAMILY 0560561/**562* U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.563* @stable ICU 2.0564*/565#define U_EBCDIC_FAMILY 1566567/**568* \def U_CHARSET_FAMILY569*570* <p>These definitions allow to specify the encoding of text571* in the char data type as defined by the platform and the compiler.572* It is enough to determine the code point values of "invariant characters",573* which are the ones shared by all encodings that are in use574* on a given platform.</p>575*576* <p>Those "invariant characters" should be all the uppercase and lowercase577* latin letters, the digits, the space, and "basic punctuation".578* Also, '\\n', '\\r', '\\t' should be available.</p>579*580* <p>The list of "invariant characters" is:<br>581* \code582* A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _583* \endcode584* <br>585* (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>586*587* <p>This matches the IBM Syntactic Character Set (CS 640).</p>588*589* <p>In other words, all the graphic characters in 7-bit ASCII should590* be safely accessible except the following:</p>591*592* \code593* '\' <backslash>594* '[' <left bracket>595* ']' <right bracket>596* '{' <left brace>597* '}' <right brace>598* '^' <circumflex>599* '~' <tilde>600* '!' <exclamation mark>601* '#' <number sign>602* '|' <vertical line>603* '$' <dollar sign>604* '@' <commercial at>605* '`' <grave accent>606* \endcode607* @stable ICU 2.0608*/609#ifdef U_CHARSET_FAMILY610/* Use the predefined value. */611#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)612# define U_CHARSET_FAMILY U_EBCDIC_FAMILY613#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)614# define U_CHARSET_FAMILY U_EBCDIC_FAMILY615#else616# define U_CHARSET_FAMILY U_ASCII_FAMILY617#endif618619/**620* \def U_CHARSET_IS_UTF8621*622* Hardcode the default charset to UTF-8.623*624* If this is set to 1, then625* - ICU will assume that all non-invariant char*, StringPiece, std::string etc.626* contain UTF-8 text, regardless of what the system API uses627* - some ICU code will use fast functions like u_strFromUTF8()628* rather than the more general and more heavy-weight conversion API (ucnv.h)629* - ucnv_getDefaultName() always returns "UTF-8"630* - ucnv_setDefaultName() is disabled and will not change the default charset631* - static builds of ICU are smaller632* - more functionality is available with the UCONFIG_NO_CONVERSION build-time633* configuration option (see unicode/uconfig.h)634* - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable635*636* @stable ICU 4.2637* @see UCONFIG_NO_CONVERSION638*/639#ifdef U_CHARSET_IS_UTF8640/* Use the predefined value. */641#elif U_PLATFORM == U_PF_ANDROID || U_PLATFORM_IS_DARWIN_BASED642# define U_CHARSET_IS_UTF8 1643#elif U_PLATFORM_IS_LINUX_BASED644/*645* Google-specific: Set to 1 to match the google3 execution environment's646* use of UTF-8, on both Linux server and workstation machines.647*/648# define U_CHARSET_IS_UTF8 1649#else650# define U_CHARSET_IS_UTF8 0651#endif652653/** @} */654655/*===========================================================================*/656/** @{ Information about wchar support */657/*===========================================================================*/658659/**660* \def U_HAVE_WCHAR_H661* Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.662*663* @stable ICU 2.0664*/665#ifdef U_HAVE_WCHAR_H666/* Use the predefined value. */667#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9668/*669* Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.670* The type and header existed, but the library functions did not work as expected.671* The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.672*/673# define U_HAVE_WCHAR_H 0674#else675# define U_HAVE_WCHAR_H 1676#endif677678/**679* \def U_SIZEOF_WCHAR_T680* U_SIZEOF_WCHAR_T==sizeof(wchar_t)681*682* @stable ICU 2.0683*/684#ifdef U_SIZEOF_WCHAR_T685/* Use the predefined value. */686#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9)687/*688* Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.689* Newer Mac OS X has size 4.690*/691# define U_SIZEOF_WCHAR_T 1692#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN693# define U_SIZEOF_WCHAR_T 2694#elif U_PLATFORM == U_PF_AIX695/*696* AIX 6.1 information, section "Wide character data representation":697* "... the wchar_t datatype is 32-bit in the 64-bit environment and698* 16-bit in the 32-bit environment."699* and700* "All locales use Unicode for their wide character code values (process code),701* except the IBM-eucTW codeset."702*/703# ifdef __64BIT__704# define U_SIZEOF_WCHAR_T 4705# else706# define U_SIZEOF_WCHAR_T 2707# endif708#elif U_PLATFORM == U_PF_OS390709/*710* z/OS V1R11 information center, section "LP64 | ILP32":711* "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.712* Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."713*/714# ifdef _LP64715# define U_SIZEOF_WCHAR_T 4716# else717# define U_SIZEOF_WCHAR_T 2718# endif719#elif U_PLATFORM == U_PF_OS400720# if defined(__UTF32__)721/*722* LOCALETYPE(*LOCALEUTF) is specified.723* Wide-character strings are in UTF-32,724* narrow-character strings are in UTF-8.725*/726# define U_SIZEOF_WCHAR_T 4727# elif defined(__UCS2__)728/*729* LOCALETYPE(*LOCALEUCS2) is specified.730* Wide-character strings are in UCS-2,731* narrow-character strings are in EBCDIC.732*/733# define U_SIZEOF_WCHAR_T 2734#else735/*736* LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.737* Wide-character strings are in 16-bit EBCDIC,738* narrow-character strings are in EBCDIC.739*/740# define U_SIZEOF_WCHAR_T 2741# endif742#else743# define U_SIZEOF_WCHAR_T 4744#endif745746#ifndef U_HAVE_WCSCPY747#define U_HAVE_WCSCPY U_HAVE_WCHAR_H748#endif749750/** @} */751752/**753* \def U_HAVE_CHAR16_T754* Defines whether the char16_t type is available for UTF-16755* and u"abc" UTF-16 string literals are supported.756* This is a new standard type and standard string literal syntax in C++0x757* but has been available in some compilers before.758* @internal759*/760#ifdef U_HAVE_CHAR16_T761/* Use the predefined value. */762#else763/*764* Notes:765* Visual Studio 10 (_MSC_VER>=1600) defines char16_t but766* does not support u"abc" string literals.767* gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but768* does not support u"abc" string literals.769* C++11 and C11 require support for UTF-16 literals770*/771# if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)772# define U_HAVE_CHAR16_T 1773# else774# define U_HAVE_CHAR16_T 0775# endif776#endif777778/**779* @{780* \def U_DECLARE_UTF16781* Do not use this macro because it is not defined on all platforms.782* Use the UNICODE_STRING or U_STRING_DECL macros instead.783* @internal784*/785#ifdef U_DECLARE_UTF16786/* Use the predefined value. */787#elif U_HAVE_CHAR16_T \788|| (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \789|| (defined(__HP_aCC) && __HP_aCC >= 035000) \790|| (defined(__HP_cc) && __HP_cc >= 111106)791# define U_DECLARE_UTF16(string) u ## string792#elif U_SIZEOF_WCHAR_T == 2 \793&& (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))794# define U_DECLARE_UTF16(string) L ## string795#else796/* Leave U_DECLARE_UTF16 undefined. See unistr.h. */797#endif798799/** @} */800801/*===========================================================================*/802/** @{ Symbol import-export control */803/*===========================================================================*/804805#ifdef U_EXPORT806/* Use the predefined value. */807#elif defined(U_STATIC_IMPLEMENTATION)808# define U_EXPORT809#elif defined(__GNUC__)810# define U_EXPORT __attribute__((visibility("default")))811#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \812|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)813# define U_EXPORT __global814/*#elif defined(__HP_aCC) || defined(__HP_cc)815# define U_EXPORT __declspec(dllexport)*/816#elif defined(_MSC_VER)817# define U_EXPORT __declspec(dllexport)818#else819# define U_EXPORT820#endif821822/* U_CALLCONV is releated to U_EXPORT2 */823#ifdef U_EXPORT2824/* Use the predefined value. */825#elif defined(_MSC_VER)826# define U_EXPORT2 __cdecl827#else828# define U_EXPORT2829#endif830831#ifdef U_IMPORT832/* Use the predefined value. */833#elif defined(_MSC_VER)834/* Windows needs to export/import data. */835# define U_IMPORT __declspec(dllimport)836#else837# define U_IMPORT838#endif839840/**841* \def U_CALLCONV842* Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary843* in callback function typedefs to make sure that the calling convention844* is compatible.845*846* This is only used for non-ICU-API functions.847* When a function is a public ICU API,848* you must use the U_CAPI and U_EXPORT2 qualifiers.849* @stable ICU 2.0850*/851#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)852# define U_CALLCONV __cdecl853#else854# define U_CALLCONV U_EXPORT2855#endif856857/* @} */858859#endif860861862