Path: blob/jdk8u272-b10-aarch32-20201026/jdk/src/share/native/common/unicode/platform.h
48773 views
// © 2016 and later: Unicode, Inc. and others.1// License & terms of use: http://www.unicode.org/copyright.html2/*3******************************************************************************4*5* Copyright (C) 1997-2016, International Business Machines6* Corporation and others. All Rights Reserved.7*8******************************************************************************9*10* FILE NAME : platform.h11*12* Date Name Description13* 05/13/98 nos Creation (content moved here from ptypes.h).14* 03/02/99 stephen Added AS400 support.15* 03/30/99 stephen Added Linux support.16* 04/13/99 stephen Reworked for autoconf.17******************************************************************************18*/1920#ifndef _PLATFORM_H21#define _PLATFORM_H2223#include "unicode/uconfig.h"24#include "unicode/uvernum.h"2526/**27* \file28* \brief Basic types for the platform.29*30* This file used to be generated by autoconf/configure.31* Starting with ICU 49, platform.h is a normal source file,32* to simplify cross-compiling and working with non-autoconf/make build systems.33*34* When a value in this file does not work on a platform, then please35* try to derive it from the U_PLATFORM value36* (for which we might need a new value constant in rare cases)37* and/or from other macros that are predefined by the compiler38* or defined in standard (POSIX or platform or compiler) headers.39*40* As a temporary workaround, you can add an explicit \#define for some macros41* before it is first tested, or add an equivalent -D macro definition42* to the compiler's command line.43*44* Note: Some compilers provide ways to show the predefined macros.45* For example, with gcc you can compile an empty .c file and have the compiler46* print the predefined macros with47* \code48* gcc -E -dM -x c /dev/null | sort49* \endcode50* (You can provide an actual empty .c file rather than /dev/null.51* <code>-x c++</code> is for C++.)52*/5354/**55* Define some things so that they can be documented.56* @internal57*/58#ifdef U_IN_DOXYGEN59/*60* Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented.61* 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.62*/6364/* None for now. */65#endif6667/**68* \def U_PLATFORM69* The U_PLATFORM macro defines the platform we're on.70*71* We used to define one different, value-less macro per platform.72* That made it hard to know the set of relevant platforms and macros,73* and hard to deal with variants of platforms.74*75* Starting with ICU 49, we define platforms as numeric macros,76* with ranges of values for related platforms and their variants.77* The U_PLATFORM macro is set to one of these values.78*79* Historical note from the Solaris Wikipedia article:80* AT&T and Sun collaborated on a project to merge the most popular Unix variants81* on the market at that time: BSD, System V, and Xenix.82* This became Unix System V Release 4 (SVR4).83*84* @internal85*/8687/** Unknown platform. @internal */88#define U_PF_UNKNOWN 089/** Windows @internal */90#define U_PF_WINDOWS 100091/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */92#define U_PF_MINGW 180093/**94* Cygwin. Windows, calls to cygwin1.dll for Posix functions,95* using MSVC or GNU gcc and binutils.96* @internal97*/98#define U_PF_CYGWIN 190099/* Reserve 2000 for U_PF_UNIX? */100/** HP-UX is based on UNIX System V. @internal */101#define U_PF_HPUX 2100102/** Solaris is a Unix operating system based on SVR4. @internal */103#define U_PF_SOLARIS 2600104/** BSD is a UNIX operating system derivative. @internal */105#define U_PF_BSD 3000106/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */107#define U_PF_AIX 3100108/** IRIX is based on UNIX System V with BSD extensions. @internal */109#define U_PF_IRIX 3200110/**111* Darwin is a POSIX-compliant operating system, composed of code developed by Apple,112* as well as code derived from NeXTSTEP, BSD, and other projects,113* built around the Mach kernel.114* Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.115* (Original description modified from WikiPedia.)116* @internal117*/118#define U_PF_DARWIN 3500119/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */120#define U_PF_IPHONE 3550121/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */122#define U_PF_QNX 3700123/** Linux is a Unix-like operating system. @internal */124#define U_PF_LINUX 4000125/**126* Native Client is pretty close to Linux.127* See https://developer.chrome.com/native-client and128* http://www.chromium.org/nativeclient129* @internal130*/131#define U_PF_BROWSER_NATIVE_CLIENT 4020132/** Android is based on Linux. @internal */133#define U_PF_ANDROID 4050134/** Fuchsia is a POSIX-ish platform. @internal */135#define U_PF_FUCHSIA 4100136/* Maximum value for Linux-based platform is 4499 */137/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */138#define U_PF_OS390 9000139/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */140#define U_PF_OS400 9400141142#ifdef U_PLATFORM143/* Use the predefined value. */144#elif defined(__MINGW32__)145# define U_PLATFORM U_PF_MINGW146#elif defined(__CYGWIN__)147# define U_PLATFORM U_PF_CYGWIN148#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)149# define U_PLATFORM U_PF_WINDOWS150#elif defined(__ANDROID__)151# define U_PLATFORM U_PF_ANDROID152/* Android wchar_t support depends on the API level. */153# include <android/api-level.h>154#elif defined(__pnacl__) || defined(__native_client__)155# define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT156#elif defined(__Fuchsia__)157# define U_PLATFORM U_PF_FUCHSIA158#elif defined(linux) || defined(__linux__) || defined(__linux)159# define U_PLATFORM U_PF_LINUX160#elif defined(__APPLE__) && defined(__MACH__)161# include <TargetConditionals.h>162# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */163# define U_PLATFORM U_PF_IPHONE164# else165# define U_PLATFORM U_PF_DARWIN166# endif167#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)168# if defined(__FreeBSD__)169# include <sys/endian.h>170# endif171# define U_PLATFORM U_PF_BSD172#elif defined(sun) || defined(__sun)173/* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */174# define U_PLATFORM U_PF_SOLARIS175# if defined(__GNUC__)176/* Solaris/GCC needs this header file to get the proper endianness. Normally, this177* header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h178* is included which does not include this header file.179*/180# include <sys/isa_defs.h>181# endif182#elif defined(_AIX) || defined(__TOS_AIX__)183# define U_PLATFORM U_PF_AIX184#elif defined(_hpux) || defined(hpux) || defined(__hpux)185# define U_PLATFORM U_PF_HPUX186#elif defined(sgi) || defined(__sgi)187# define U_PLATFORM U_PF_IRIX188#elif defined(__QNX__) || defined(__QNXNTO__)189# define U_PLATFORM U_PF_QNX190#elif defined(__TOS_MVS__)191# define U_PLATFORM U_PF_OS390192#elif defined(__OS400__) || defined(__TOS_OS400__)193# define U_PLATFORM U_PF_OS400194#else195# define U_PLATFORM U_PF_UNKNOWN196#endif197198/**199* \def CYGWINMSVC200* Defined if this is Windows with Cygwin, but using MSVC rather than gcc.201* Otherwise undefined.202* @internal203*/204/* Commented out because this is already set in mh-cygwin-msvc205#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)206# define CYGWINMSVC207#endif208*/209#ifdef U_IN_DOXYGEN210# define CYGWINMSVC211#endif212213/**214* \def U_PLATFORM_USES_ONLY_WIN32_API215* Defines whether the platform uses only the Win32 API.216* Set to 1 for Windows/MSVC and MinGW but not Cygwin.217* @internal218*/219#ifdef U_PLATFORM_USES_ONLY_WIN32_API220/* Use the predefined value. */221#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)222# define U_PLATFORM_USES_ONLY_WIN32_API 1223#else224/* Cygwin implements POSIX. */225# define U_PLATFORM_USES_ONLY_WIN32_API 0226#endif227228/**229* \def U_PLATFORM_HAS_WIN32_API230* Defines whether the Win32 API is available on the platform.231* Set to 1 for Windows/MSVC, MinGW and Cygwin.232* @internal233*/234#ifdef U_PLATFORM_HAS_WIN32_API235/* Use the predefined value. */236#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN237# define U_PLATFORM_HAS_WIN32_API 1238#else239# define U_PLATFORM_HAS_WIN32_API 0240#endif241242/**243* \def U_PLATFORM_HAS_WINUWP_API244* Defines whether target is intended for Universal Windows Platform API245* Set to 1 for Windows10 Release Solution Configuration246* @internal247*/248#ifdef U_PLATFORM_HAS_WINUWP_API249/* Use the predefined value. */250#else251# define U_PLATFORM_HAS_WINUWP_API 0252#endif253254/**255* \def U_PLATFORM_IMPLEMENTS_POSIX256* Defines whether the platform implements (most of) the POSIX API.257* Set to 1 for Cygwin and most other platforms.258* @internal259*/260#ifdef U_PLATFORM_IMPLEMENTS_POSIX261/* Use the predefined value. */262#elif U_PLATFORM_USES_ONLY_WIN32_API263# define U_PLATFORM_IMPLEMENTS_POSIX 0264#else265# define U_PLATFORM_IMPLEMENTS_POSIX 1266#endif267268/**269* \def U_PLATFORM_IS_LINUX_BASED270* Defines whether the platform is Linux or one of its derivatives.271* @internal272*/273#ifdef U_PLATFORM_IS_LINUX_BASED274/* Use the predefined value. */275#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499276# define U_PLATFORM_IS_LINUX_BASED 1277#else278# define U_PLATFORM_IS_LINUX_BASED 0279#endif280281/**282* \def U_PLATFORM_IS_DARWIN_BASED283* Defines whether the platform is Darwin or one of its derivatives.284* @internal285*/286#ifdef U_PLATFORM_IS_DARWIN_BASED287/* Use the predefined value. */288#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE289# define U_PLATFORM_IS_DARWIN_BASED 1290#else291# define U_PLATFORM_IS_DARWIN_BASED 0292#endif293294/**295* \def U_HAVE_STDINT_H296* Defines whether stdint.h is available. It is a C99 standard header.297* We used to include inttypes.h which includes stdint.h but we usually do not need298* the additional definitions from inttypes.h.299* @internal300*/301#ifdef U_HAVE_STDINT_H302/* Use the predefined value. */303#elif U_PLATFORM_USES_ONLY_WIN32_API304# if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600)305/* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */306# define U_HAVE_STDINT_H 1307# else308# define U_HAVE_STDINT_H 0309# endif310#elif U_PLATFORM == U_PF_SOLARIS311/* Solaris has inttypes.h but not stdint.h. */312# define U_HAVE_STDINT_H 0313#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)314/* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */315# define U_HAVE_STDINT_H 0316#else317# define U_HAVE_STDINT_H 1318#endif319320/**321* \def U_HAVE_INTTYPES_H322* Defines whether inttypes.h is available. It is a C99 standard header.323* We include inttypes.h where it is available but stdint.h is not.324* @internal325*/326#ifdef U_HAVE_INTTYPES_H327/* Use the predefined value. */328#elif U_PLATFORM == U_PF_SOLARIS329/* Solaris has inttypes.h but not stdint.h. */330# define U_HAVE_INTTYPES_H 1331#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)332/* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */333# define U_HAVE_INTTYPES_H 1334#else335/* Most platforms have both inttypes.h and stdint.h, or neither. */336# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H337#endif338339/*===========================================================================*/340/** @{ Compiler and environment features */341/*===========================================================================*/342343/**344* \def U_GCC_MAJOR_MINOR345* Indicates whether the compiler is gcc (test for != 0),346* and if so, contains its major (times 100) and minor version numbers.347* If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.348*349* For example, for testing for whether we have gcc, and whether it's 4.6 or higher,350* use "#if U_GCC_MAJOR_MINOR >= 406".351* @internal352*/353#ifdef __GNUC__354# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)355#else356# define U_GCC_MAJOR_MINOR 0357#endif358359/**360* \def U_IS_BIG_ENDIAN361* Determines the endianness of the platform.362* @internal363*/364#ifdef U_IS_BIG_ENDIAN365/* Use the predefined value. */366#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)367# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)368#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)369/* gcc */370# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)371#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)372# define U_IS_BIG_ENDIAN 1373#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)374# define U_IS_BIG_ENDIAN 0375#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__)376/* These platforms do not appear to predefine any endianness macros. */377# define U_IS_BIG_ENDIAN 1378#elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0)379/* HPPA do not appear to predefine any endianness macros. */380# define U_IS_BIG_ENDIAN 1381#elif defined(sparc) || defined(__sparc) || defined(__sparc__)382/* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */383# define U_IS_BIG_ENDIAN 1384#else385# define U_IS_BIG_ENDIAN 0386#endif387388/**389* \def U_HAVE_PLACEMENT_NEW390* Determines whether to override placement new and delete for STL.391* @stable ICU 2.6392*/393#ifdef U_HAVE_PLACEMENT_NEW394/* Use the predefined value. */395#elif defined(__BORLANDC__)396# define U_HAVE_PLACEMENT_NEW 0397#else398# define U_HAVE_PLACEMENT_NEW 1399#endif400401/**402* \def U_HAVE_DEBUG_LOCATION_NEW403* Define this to define the MFC debug version of the operator new.404*405* @stable ICU 3.4406*/407#ifdef U_HAVE_DEBUG_LOCATION_NEW408/* Use the predefined value. */409#elif defined(_MSC_VER)410# define U_HAVE_DEBUG_LOCATION_NEW 1411#else412# define U_HAVE_DEBUG_LOCATION_NEW 0413#endif414415/* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */416#ifndef __has_attribute417# define __has_attribute(x) 0418#endif419#ifndef __has_cpp_attribute420# define __has_cpp_attribute(x) 0421#endif422#ifndef __has_declspec_attribute423# define __has_declspec_attribute(x) 0424#endif425#ifndef __has_builtin426# define __has_builtin(x) 0427#endif428#ifndef __has_feature429# define __has_feature(x) 0430#endif431#ifndef __has_extension432# define __has_extension(x) 0433#endif434#ifndef __has_warning435# define __has_warning(x) 0436#endif437438/**439* \def U_MALLOC_ATTR440* Attribute to mark functions as malloc-like441* @internal442*/443#if defined(__GNUC__) && __GNUC__>=3444# define U_MALLOC_ATTR __attribute__ ((__malloc__))445#else446# define U_MALLOC_ATTR447#endif448449/**450* \def U_ALLOC_SIZE_ATTR451* Attribute to specify the size of the allocated buffer for malloc-like functions452* @internal453*/454#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size)455# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))456# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))457#else458# define U_ALLOC_SIZE_ATTR(X)459# define U_ALLOC_SIZE_ATTR2(X,Y)460#endif461462/**463* \def U_CPLUSPLUS_VERSION464* 0 if no C++; 1, 11, 14, ... if C++.465* Support for specific features cannot always be determined by the C++ version alone.466* @internal467*/468#ifdef U_CPLUSPLUS_VERSION469# if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus)470# undef U_CPLUSPLUS_VERSION471# define U_CPLUSPLUS_VERSION 0472# endif473/* Otherwise use the predefined value. */474#elif !defined(__cplusplus)475# define U_CPLUSPLUS_VERSION 0476#elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)477# define U_CPLUSPLUS_VERSION 14478#elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)479# define U_CPLUSPLUS_VERSION 11480#else481// C++98 or C++03482# define U_CPLUSPLUS_VERSION 1483#endif484485#if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)486// add in std::nullptr_t487namespace std {488typedef decltype(nullptr) nullptr_t;489};490#endif491492/**493* \def U_NOEXCEPT494* "noexcept" if supported, otherwise empty.495* Some code, especially STL containers, uses move semantics of objects only496* if the move constructor and the move operator are declared as not throwing exceptions.497* @internal498*/499#ifdef U_NOEXCEPT500/* Use the predefined value. */501#else502# define U_NOEXCEPT noexcept503#endif504505/**506* \def U_FALLTHROUGH507* Annotate intentional fall-through between switch labels.508* http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough509* @internal510*/511#ifndef __cplusplus512// Not for C.513#elif defined(U_FALLTHROUGH)514// Use the predefined value.515#elif defined(__clang__)516// Test for compiler vs. feature separately.517// Other compilers might choke on the feature test.518# if __has_cpp_attribute(clang::fallthrough) || \519(__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough"))520# define U_FALLTHROUGH [[clang::fallthrough]]521# endif522#elif defined(__GNUC__) && (__GNUC__ >= 7)523# define U_FALLTHROUGH __attribute__((fallthrough))524#endif525526#ifndef U_FALLTHROUGH527# define U_FALLTHROUGH528#endif529530/** @} */531532/*===========================================================================*/533/** @{ Character data types */534/*===========================================================================*/535536/**537* U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.538* @stable ICU 2.0539*/540#define U_ASCII_FAMILY 0541542/**543* U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.544* @stable ICU 2.0545*/546#define U_EBCDIC_FAMILY 1547548/**549* \def U_CHARSET_FAMILY550*551* <p>These definitions allow to specify the encoding of text552* in the char data type as defined by the platform and the compiler.553* It is enough to determine the code point values of "invariant characters",554* which are the ones shared by all encodings that are in use555* on a given platform.</p>556*557* <p>Those "invariant characters" should be all the uppercase and lowercase558* latin letters, the digits, the space, and "basic punctuation".559* Also, '\\n', '\\r', '\\t' should be available.</p>560*561* <p>The list of "invariant characters" is:<br>562* \code563* A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _564* \endcode565* <br>566* (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>567*568* <p>This matches the IBM Syntactic Character Set (CS 640).</p>569*570* <p>In other words, all the graphic characters in 7-bit ASCII should571* be safely accessible except the following:</p>572*573* \code574* '\' <backslash>575* '[' <left bracket>576* ']' <right bracket>577* '{' <left brace>578* '}' <right brace>579* '^' <circumflex>580* '~' <tilde>581* '!' <exclamation mark>582* '#' <number sign>583* '|' <vertical line>584* '$' <dollar sign>585* '@' <commercial at>586* '`' <grave accent>587* \endcode588* @stable ICU 2.0589*/590#ifdef U_CHARSET_FAMILY591/* Use the predefined value. */592#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)593# define U_CHARSET_FAMILY U_EBCDIC_FAMILY594#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)595# define U_CHARSET_FAMILY U_EBCDIC_FAMILY596#else597# define U_CHARSET_FAMILY U_ASCII_FAMILY598#endif599600/**601* \def U_CHARSET_IS_UTF8602*603* Hardcode the default charset to UTF-8.604*605* If this is set to 1, then606* - ICU will assume that all non-invariant char*, StringPiece, std::string etc.607* contain UTF-8 text, regardless of what the system API uses608* - some ICU code will use fast functions like u_strFromUTF8()609* rather than the more general and more heavy-weight conversion API (ucnv.h)610* - ucnv_getDefaultName() always returns "UTF-8"611* - ucnv_setDefaultName() is disabled and will not change the default charset612* - static builds of ICU are smaller613* - more functionality is available with the UCONFIG_NO_CONVERSION build-time614* configuration option (see unicode/uconfig.h)615* - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable616*617* @stable ICU 4.2618* @see UCONFIG_NO_CONVERSION619*/620#ifdef U_CHARSET_IS_UTF8621/* Use the predefined value. */622#elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED623# define U_CHARSET_IS_UTF8 1624#else625# define U_CHARSET_IS_UTF8 0626#endif627628/** @} */629630/*===========================================================================*/631/** @{ Information about wchar support */632/*===========================================================================*/633634/**635* \def U_HAVE_WCHAR_H636* Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.637*638* @stable ICU 2.0639*/640#ifdef U_HAVE_WCHAR_H641/* Use the predefined value. */642#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9643/*644* Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.645* The type and header existed, but the library functions did not work as expected.646* The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.647*/648# define U_HAVE_WCHAR_H 0649#else650# define U_HAVE_WCHAR_H 1651#endif652653/**654* \def U_SIZEOF_WCHAR_T655* U_SIZEOF_WCHAR_T==sizeof(wchar_t)656*657* @stable ICU 2.0658*/659#ifdef U_SIZEOF_WCHAR_T660/* Use the predefined value. */661#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9)662/*663* Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.664* Newer Mac OS X has size 4.665*/666# define U_SIZEOF_WCHAR_T 1667#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN668# define U_SIZEOF_WCHAR_T 2669#elif U_PLATFORM == U_PF_AIX670/*671* AIX 6.1 information, section "Wide character data representation":672* "... the wchar_t datatype is 32-bit in the 64-bit environment and673* 16-bit in the 32-bit environment."674* and675* "All locales use Unicode for their wide character code values (process code),676* except the IBM-eucTW codeset."677*/678# ifdef __64BIT__679# define U_SIZEOF_WCHAR_T 4680# else681# define U_SIZEOF_WCHAR_T 2682# endif683#elif U_PLATFORM == U_PF_OS390684/*685* z/OS V1R11 information center, section "LP64 | ILP32":686* "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.687* Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."688*/689# ifdef _LP64690# define U_SIZEOF_WCHAR_T 4691# else692# define U_SIZEOF_WCHAR_T 2693# endif694#elif U_PLATFORM == U_PF_OS400695# if defined(__UTF32__)696/*697* LOCALETYPE(*LOCALEUTF) is specified.698* Wide-character strings are in UTF-32,699* narrow-character strings are in UTF-8.700*/701# define U_SIZEOF_WCHAR_T 4702# elif defined(__UCS2__)703/*704* LOCALETYPE(*LOCALEUCS2) is specified.705* Wide-character strings are in UCS-2,706* narrow-character strings are in EBCDIC.707*/708# define U_SIZEOF_WCHAR_T 2709#else710/*711* LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.712* Wide-character strings are in 16-bit EBCDIC,713* narrow-character strings are in EBCDIC.714*/715# define U_SIZEOF_WCHAR_T 2716# endif717#else718# define U_SIZEOF_WCHAR_T 4719#endif720721#ifndef U_HAVE_WCSCPY722#define U_HAVE_WCSCPY U_HAVE_WCHAR_H723#endif724725/** @} */726727/**728* \def U_HAVE_CHAR16_T729* Defines whether the char16_t type is available for UTF-16730* and u"abc" UTF-16 string literals are supported.731* This is a new standard type and standard string literal syntax in C++0x732* but has been available in some compilers before.733* @internal734*/735#ifdef U_HAVE_CHAR16_T736/* Use the predefined value. */737#else738/*739* Notes:740* Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef741* and does not support u"abc" string literals.742* Visual Studio 2015 (_MSC_VER>=1900) and above adds support for743* both char16_t and u"abc" string literals.744* gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but745* does not support u"abc" string literals.746* C++11 and C11 require support for UTF-16 literals747* TODO: Fix for plain C. Doesn't work on Mac.748*/749# if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)750# define U_HAVE_CHAR16_T 1751# else752# define U_HAVE_CHAR16_T 0753# endif754#endif755756/**757* @{758* \def U_DECLARE_UTF16759* Do not use this macro because it is not defined on all platforms.760* Use the UNICODE_STRING or U_STRING_DECL macros instead.761* @internal762*/763#ifdef U_DECLARE_UTF16764/* Use the predefined value. */765#elif U_HAVE_CHAR16_T \766|| (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \767|| (defined(__HP_aCC) && __HP_aCC >= 035000) \768|| (defined(__HP_cc) && __HP_cc >= 111106) \769|| (defined(U_IN_DOXYGEN))770# define U_DECLARE_UTF16(string) u ## string771#elif U_SIZEOF_WCHAR_T == 2 \772&& (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))773# define U_DECLARE_UTF16(string) L ## string774#else775/* Leave U_DECLARE_UTF16 undefined. See unistr.h. */776#endif777778/** @} */779780/*===========================================================================*/781/** @{ Symbol import-export control */782/*===========================================================================*/783784#ifdef U_EXPORT785/* Use the predefined value. */786#elif defined(U_STATIC_IMPLEMENTATION)787# define U_EXPORT788#elif defined(_MSC_VER) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))789# define U_EXPORT __declspec(dllexport)790#elif defined(__GNUC__)791# define U_EXPORT __attribute__((visibility("default")))792#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \793|| (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)794# define U_EXPORT __global795/*#elif defined(__HP_aCC) || defined(__HP_cc)796# define U_EXPORT __declspec(dllexport)*/797#else798# define U_EXPORT799#endif800801/* U_CALLCONV is releated to U_EXPORT2 */802#ifdef U_EXPORT2803/* Use the predefined value. */804#elif defined(_MSC_VER)805# define U_EXPORT2 __cdecl806#else807# define U_EXPORT2808#endif809810#ifdef U_IMPORT811/* Use the predefined value. */812#elif defined(_MSC_VER) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))813/* Windows needs to export/import data. */814# define U_IMPORT __declspec(dllimport)815#else816# define U_IMPORT817#endif818819/**820* \def U_CALLCONV821* Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary822* in callback function typedefs to make sure that the calling convention823* is compatible.824*825* This is only used for non-ICU-API functions.826* When a function is a public ICU API,827* you must use the U_CAPI and U_EXPORT2 qualifiers.828*829* Please note, you need to use U_CALLCONV after the *.830*831* NO : "static const char U_CALLCONV *func( . . . )"832* YES: "static const char* U_CALLCONV func( . . . )"833*834* @stable ICU 2.0835*/836#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)837# define U_CALLCONV __cdecl838#else839# define U_CALLCONV U_EXPORT2840#endif841842/**843* \def U_CALLCONV_FPTR844* Similar to U_CALLCONV, but only used on function pointers.845* @internal846*/847#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)848# define U_CALLCONV_FPTR U_CALLCONV849#else850# define U_CALLCONV_FPTR851#endif852/* @} */853854#endif855856857