Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/unicode/platform.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // © 2016 and later: Unicode, Inc. and others.
0002 // License & terms of use: http://www.unicode.org/copyright.html
0003 /*
0004 ******************************************************************************
0005 *
0006 *   Copyright (C) 1997-2016, International Business Machines
0007 *   Corporation and others.  All Rights Reserved.
0008 *
0009 ******************************************************************************
0010 *
0011 *  FILE NAME : platform.h
0012 *
0013 *   Date        Name        Description
0014 *   05/13/98    nos         Creation (content moved here from ptypes.h).
0015 *   03/02/99    stephen     Added AS400 support.
0016 *   03/30/99    stephen     Added Linux support.
0017 *   04/13/99    stephen     Reworked for autoconf.
0018 ******************************************************************************
0019 */
0020 
0021 #ifndef _PLATFORM_H
0022 #define _PLATFORM_H
0023 
0024 #include "unicode/uconfig.h"
0025 #include "unicode/uvernum.h"
0026 
0027 /**
0028  * \file
0029  * \brief Basic types for the platform.
0030  *
0031  * This file used to be generated by autoconf/configure.
0032  * Starting with ICU 49, platform.h is a normal source file,
0033  * to simplify cross-compiling and working with non-autoconf/make build systems.
0034  *
0035  * When a value in this file does not work on a platform, then please
0036  * try to derive it from the U_PLATFORM value
0037  * (for which we might need a new value constant in rare cases)
0038  * and/or from other macros that are predefined by the compiler
0039  * or defined in standard (POSIX or platform or compiler) headers.
0040  *
0041  * As a temporary workaround, you can add an explicit \#define for some macros
0042  * before it is first tested, or add an equivalent -D macro definition
0043  * to the compiler's command line.
0044  *
0045  * Note: Some compilers provide ways to show the predefined macros.
0046  * For example, with gcc you can compile an empty .c file and have the compiler
0047  * print the predefined macros with
0048  * \code
0049  * gcc -E -dM -x c /dev/null | sort
0050  * \endcode
0051  * (You can provide an actual empty .c file rather than /dev/null.
0052  * <code>-x c++</code> is for C++.)
0053  */
0054 
0055 /**
0056  * Define some things so that they can be documented.
0057  * @internal
0058  */
0059 #ifdef U_IN_DOXYGEN
0060 /*
0061  * Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented.
0062  * 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.
0063  */
0064 
0065 /* None for now. */
0066 #endif
0067 
0068 /**
0069  * \def U_PLATFORM
0070  * The U_PLATFORM macro defines the platform we're on.
0071  *
0072  * We used to define one different, value-less macro per platform.
0073  * That made it hard to know the set of relevant platforms and macros,
0074  * and hard to deal with variants of platforms.
0075  *
0076  * Starting with ICU 49, we define platforms as numeric macros,
0077  * with ranges of values for related platforms and their variants.
0078  * The U_PLATFORM macro is set to one of these values.
0079  *
0080  * Historical note from the Solaris Wikipedia article:
0081  * AT&T and Sun collaborated on a project to merge the most popular Unix variants
0082  * on the market at that time: BSD, System V, and Xenix.
0083  * This became Unix System V Release 4 (SVR4).
0084  *
0085  * @internal
0086  */
0087 
0088 /** Unknown platform. @internal */
0089 #define U_PF_UNKNOWN 0
0090 /** Windows @internal */
0091 #define U_PF_WINDOWS 1000
0092 /** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */
0093 #define U_PF_MINGW 1800
0094 /**
0095  * Cygwin. Windows, calls to cygwin1.dll for Posix functions,
0096  * using MSVC or GNU gcc and binutils.
0097  * @internal
0098  */
0099 #define U_PF_CYGWIN 1900
0100 /* Reserve 2000 for U_PF_UNIX? */
0101 /** HP-UX is based on UNIX System V. @internal */
0102 #define U_PF_HPUX 2100
0103 /** Solaris is a Unix operating system based on SVR4. @internal */
0104 #define U_PF_SOLARIS 2600
0105 /** BSD is a UNIX operating system derivative. @internal */
0106 #define U_PF_BSD 3000
0107 /** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */
0108 #define U_PF_AIX 3100
0109 /** IRIX is based on UNIX System V with BSD extensions. @internal */
0110 #define U_PF_IRIX 3200
0111 /**
0112  * Darwin is a POSIX-compliant operating system, composed of code developed by Apple,
0113  * as well as code derived from NeXTSTEP, BSD, and other projects,
0114  * built around the Mach kernel.
0115  * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.
0116  * (Original description modified from WikiPedia.)
0117  * @internal
0118  */
0119 #define U_PF_DARWIN 3500
0120 /** iPhone OS (iOS) is a derivative of Mac OS X. @internal */
0121 #define U_PF_IPHONE 3550
0122 /** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */
0123 #define U_PF_QNX 3700
0124 /** Linux is a Unix-like operating system. @internal */
0125 #define U_PF_LINUX 4000
0126 /**
0127  * Native Client is pretty close to Linux.
0128  * See https://developer.chrome.com/native-client and
0129  *  http://www.chromium.org/nativeclient
0130  *  @internal
0131  */
0132 #define U_PF_BROWSER_NATIVE_CLIENT 4020
0133 /** Android is based on Linux. @internal */
0134 #define U_PF_ANDROID 4050
0135 /** Haiku is a POSIX-ish platform. @internal */
0136 #define U_PF_HAIKU 4080
0137 /** Fuchsia is a POSIX-ish platform. @internal */
0138 #define U_PF_FUCHSIA 4100
0139 /* Maximum value for Linux-based platform is 4499 */
0140 /**
0141  * Emscripten is a C++ transpiler for the Web that can target asm.js or
0142  * WebAssembly. It provides some POSIX-compatible wrappers and stubs and
0143  * some Linux-like functionality, but is not fully compatible with
0144  * either.
0145  * @internal
0146  */
0147 #define U_PF_EMSCRIPTEN 5010
0148 /** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
0149 #define U_PF_OS390 9000
0150 /** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
0151 #define U_PF_OS400 9400
0152 
0153 #ifdef U_PLATFORM
0154     /* Use the predefined value. */
0155 #elif defined(__MINGW32__)
0156 #   define U_PLATFORM U_PF_MINGW
0157 #elif defined(__CYGWIN__)
0158 #   define U_PLATFORM U_PF_CYGWIN
0159     /* Cygwin uchar.h doesn't exist until Cygwin 3.5. */
0160 #   include <cygwin/version.h>
0161 #elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
0162 #   define U_PLATFORM U_PF_WINDOWS
0163 #elif defined(__ANDROID__)
0164 #   define U_PLATFORM U_PF_ANDROID
0165     /* Android wchar_t support depends on the API level. */
0166 #   include <android/api-level.h>
0167 #elif defined(__pnacl__) || defined(__native_client__)
0168 #   define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT
0169 #elif defined(__Fuchsia__)
0170 #   define U_PLATFORM U_PF_FUCHSIA
0171 #elif defined(linux) || defined(__linux__) || defined(__linux)
0172 #   define U_PLATFORM U_PF_LINUX
0173 #elif defined(__APPLE__) && defined(__MACH__)
0174 #   include <TargetConditionals.h>
0175 #   if (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) && (defined(TARGET_OS_MACCATALYST) && !TARGET_OS_MACCATALYST)   /* variant of TARGET_OS_MAC */
0176 #       define U_PLATFORM U_PF_IPHONE
0177 #   else
0178 #       define U_PLATFORM U_PF_DARWIN
0179 #   endif
0180 #elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)
0181 #   if defined(__FreeBSD__)
0182 #       include <sys/endian.h>
0183 #   endif
0184 #   define U_PLATFORM U_PF_BSD
0185 #elif defined(sun) || defined(__sun)
0186     /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */
0187 #   define U_PLATFORM U_PF_SOLARIS
0188 #   if defined(__GNUC__)
0189         /* Solaris/GCC needs this header file to get the proper endianness. Normally, this
0190          * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h
0191          *  is included which does not include this header file.
0192          */
0193 #       include <sys/isa_defs.h>
0194 #   endif
0195 #elif defined(_AIX) || defined(__TOS_AIX__)
0196 #   define U_PLATFORM U_PF_AIX
0197 #elif defined(_hpux) || defined(hpux) || defined(__hpux)
0198 #   define U_PLATFORM U_PF_HPUX
0199 #elif defined(sgi) || defined(__sgi)
0200 #   define U_PLATFORM U_PF_IRIX
0201 #elif defined(__QNX__) || defined(__QNXNTO__)
0202 #   define U_PLATFORM U_PF_QNX
0203 #elif defined(__TOS_MVS__)
0204 #   define U_PLATFORM U_PF_OS390
0205 #elif defined(__OS400__) || defined(__TOS_OS400__)
0206 #   define U_PLATFORM U_PF_OS400
0207 #elif defined(__HAIKU__)
0208 #   define U_PLATFORM U_PF_HAIKU
0209 #elif defined(__EMSCRIPTEN__)
0210 #   define U_PLATFORM U_PF_EMSCRIPTEN
0211 #else
0212 #   define U_PLATFORM U_PF_UNKNOWN
0213 #endif
0214 
0215 /**
0216  * \def U_REAL_MSVC
0217  * Defined if the compiler is the real MSVC compiler (and not something like
0218  * Clang setting _MSC_VER in order to compile Windows code that requires it).
0219  * Otherwise undefined.
0220  * @internal
0221  */
0222 #if (defined(_MSC_VER) && !(defined(__clang__) && __clang__)) || defined(U_IN_DOXYGEN)
0223 #   define U_REAL_MSVC
0224 #endif
0225 
0226 /**
0227  * \def CYGWINMSVC
0228  * Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
0229  * Otherwise undefined.
0230  * @internal
0231  */
0232 /* Commented out because this is already set in mh-cygwin-msvc
0233 #if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
0234 #   define CYGWINMSVC
0235 #endif
0236 */
0237 #ifdef U_IN_DOXYGEN
0238 #   define CYGWINMSVC
0239 #endif
0240 
0241 /**
0242  * \def U_PLATFORM_USES_ONLY_WIN32_API
0243  * Defines whether the platform uses only the Win32 API.
0244  * Set to 1 for Windows/MSVC, ClangCL and MinGW but not Cygwin.
0245  * @internal
0246  */
0247 #ifdef U_PLATFORM_USES_ONLY_WIN32_API
0248     /* Use the predefined value. */
0249 #elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)
0250 #   define U_PLATFORM_USES_ONLY_WIN32_API 1
0251 #else
0252     /* Cygwin implements POSIX. */
0253 #   define U_PLATFORM_USES_ONLY_WIN32_API 0
0254 #endif
0255 
0256 /**
0257  * \def U_PLATFORM_HAS_WIN32_API
0258  * Defines whether the Win32 API is available on the platform.
0259  * Set to 1 for Windows/MSVC, ClangCL, MinGW and Cygwin.
0260  * @internal
0261  */
0262 #ifdef U_PLATFORM_HAS_WIN32_API
0263     /* Use the predefined value. */
0264 #elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
0265 #   define U_PLATFORM_HAS_WIN32_API 1
0266 #else
0267 #   define U_PLATFORM_HAS_WIN32_API 0
0268 #endif
0269 
0270 /**
0271  * \def U_PLATFORM_HAS_WINUWP_API
0272  * Defines whether target is intended for Universal Windows Platform API
0273  * Set to 1 for Windows10 Release Solution Configuration
0274  * @internal
0275  */
0276 #ifdef U_PLATFORM_HAS_WINUWP_API
0277     /* Use the predefined value. */
0278 #else
0279 #   define U_PLATFORM_HAS_WINUWP_API 0
0280 #endif
0281 
0282 /**
0283  * \def U_PLATFORM_IMPLEMENTS_POSIX
0284  * Defines whether the platform implements (most of) the POSIX API.
0285  * Set to 1 for Cygwin and most other platforms.
0286  * @internal
0287  */
0288 #ifdef U_PLATFORM_IMPLEMENTS_POSIX
0289     /* Use the predefined value. */
0290 #elif U_PLATFORM_USES_ONLY_WIN32_API
0291 #   define U_PLATFORM_IMPLEMENTS_POSIX 0
0292 #else
0293 #   define U_PLATFORM_IMPLEMENTS_POSIX 1
0294 #endif
0295 
0296 /**
0297  * \def U_PLATFORM_IS_LINUX_BASED
0298  * Defines whether the platform is Linux or one of its derivatives.
0299  * @internal
0300  */
0301 #ifdef U_PLATFORM_IS_LINUX_BASED
0302     /* Use the predefined value. */
0303 #elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499
0304 #   define U_PLATFORM_IS_LINUX_BASED 1
0305 #else
0306 #   define U_PLATFORM_IS_LINUX_BASED 0
0307 #endif
0308 
0309 /**
0310  * \def U_PLATFORM_IS_DARWIN_BASED
0311  * Defines whether the platform is Darwin or one of its derivatives.
0312  * @internal
0313  */
0314 #ifdef U_PLATFORM_IS_DARWIN_BASED
0315     /* Use the predefined value. */
0316 #elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE
0317 #   define U_PLATFORM_IS_DARWIN_BASED 1
0318 #else
0319 #   define U_PLATFORM_IS_DARWIN_BASED 0
0320 #endif
0321 
0322 /*===========================================================================*/
0323 /** @{ Compiler and environment features                                     */
0324 /*===========================================================================*/
0325 
0326 /**
0327  * \def U_GCC_MAJOR_MINOR
0328  * Indicates whether the compiler is gcc (test for != 0),
0329  * and if so, contains its major (times 100) and minor version numbers.
0330  * If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.
0331  *
0332  * For example, for testing for whether we have gcc, and whether it's 4.6 or higher,
0333  * use "#if U_GCC_MAJOR_MINOR >= 406".
0334  * @internal
0335  */
0336 #ifdef __GNUC__
0337 #   define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)
0338 #else
0339 #   define U_GCC_MAJOR_MINOR 0
0340 #endif
0341 
0342 /**
0343  * \def U_IS_BIG_ENDIAN
0344  * Determines the endianness of the platform.
0345  * @internal
0346  */
0347 #ifdef U_IS_BIG_ENDIAN
0348     /* Use the predefined value. */
0349 #elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)
0350 #   define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
0351 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
0352     /* gcc */
0353 #   define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
0354 #elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
0355 #   define U_IS_BIG_ENDIAN 1
0356 #elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
0357 #   define U_IS_BIG_ENDIAN 0
0358 #elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__)
0359     /* These platforms do not appear to predefine any endianness macros. */
0360 #   define U_IS_BIG_ENDIAN 1
0361 #elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0)
0362     /* HPPA do not appear to predefine any endianness macros. */
0363 #   define U_IS_BIG_ENDIAN 1
0364 #elif defined(sparc) || defined(__sparc) || defined(__sparc__)
0365     /* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */
0366 #   define U_IS_BIG_ENDIAN 1
0367 #else
0368 #   define U_IS_BIG_ENDIAN 0
0369 #endif
0370 
0371 /**
0372  * \def U_HAVE_PLACEMENT_NEW
0373  * Determines whether to override placement new and delete for STL.
0374  * @stable ICU 2.6
0375  */
0376 #ifdef U_HAVE_PLACEMENT_NEW
0377     /* Use the predefined value. */
0378 #elif defined(__BORLANDC__)
0379 #   define U_HAVE_PLACEMENT_NEW 0
0380 #else
0381 #   define U_HAVE_PLACEMENT_NEW 1
0382 #endif
0383 
0384 /**
0385  * \def U_HAVE_DEBUG_LOCATION_NEW 
0386  * Define this to define the MFC debug version of the operator new.
0387  *
0388  * @stable ICU 3.4
0389  */
0390 #ifdef U_HAVE_DEBUG_LOCATION_NEW
0391     /* Use the predefined value. */
0392 #elif defined(_MSC_VER)
0393 #   define U_HAVE_DEBUG_LOCATION_NEW 1
0394 #else
0395 #   define U_HAVE_DEBUG_LOCATION_NEW 0
0396 #endif
0397 
0398 /* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
0399 #ifdef __has_attribute
0400 #   define UPRV_HAS_ATTRIBUTE(x) __has_attribute(x)
0401 #else
0402 #   define UPRV_HAS_ATTRIBUTE(x) 0
0403 #endif
0404 #ifdef __has_cpp_attribute
0405 #   define UPRV_HAS_CPP_ATTRIBUTE(x) __has_cpp_attribute(x)
0406 #else
0407 #   define UPRV_HAS_CPP_ATTRIBUTE(x) 0
0408 #endif
0409 #ifdef __has_declspec_attribute
0410 #   define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) __has_declspec_attribute(x)
0411 #else
0412 #   define UPRV_HAS_DECLSPEC_ATTRIBUTE(x) 0
0413 #endif
0414 #ifdef __has_builtin
0415 #   define UPRV_HAS_BUILTIN(x) __has_builtin(x)
0416 #else
0417 #   define UPRV_HAS_BUILTIN(x) 0
0418 #endif
0419 #ifdef __has_feature
0420 #   define UPRV_HAS_FEATURE(x) __has_feature(x)
0421 #else
0422 #   define UPRV_HAS_FEATURE(x) 0
0423 #endif
0424 #ifdef __has_extension
0425 #   define UPRV_HAS_EXTENSION(x) __has_extension(x)
0426 #else
0427 #   define UPRV_HAS_EXTENSION(x) 0
0428 #endif
0429 #ifdef __has_warning
0430 #   define UPRV_HAS_WARNING(x) __has_warning(x)
0431 #else
0432 #   define UPRV_HAS_WARNING(x) 0
0433 #endif
0434 
0435 
0436 #if defined(__clang__)
0437 #define UPRV_NO_SANITIZE_UNDEFINED __attribute__((no_sanitize("undefined")))
0438 #else
0439 #define UPRV_NO_SANITIZE_UNDEFINED
0440 #endif
0441 
0442 /**
0443  * \def U_MALLOC_ATTR
0444  * Attribute to mark functions as malloc-like
0445  * @internal
0446  */
0447 #if defined(__GNUC__) && __GNUC__>=3
0448 #    define U_MALLOC_ATTR __attribute__ ((__malloc__))
0449 #else
0450 #    define U_MALLOC_ATTR
0451 #endif
0452 
0453 /**
0454  * \def U_ALLOC_SIZE_ATTR
0455  * Attribute to specify the size of the allocated buffer for malloc-like functions
0456  * @internal
0457  */
0458 #if (defined(__GNUC__) &&                                            \
0459         (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || \
0460         UPRV_HAS_ATTRIBUTE(alloc_size)
0461 #   define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))
0462 #   define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))
0463 #else
0464 #   define U_ALLOC_SIZE_ATTR(X)
0465 #   define U_ALLOC_SIZE_ATTR2(X,Y)
0466 #endif
0467 
0468 /**
0469  * \def U_CPLUSPLUS_VERSION
0470  * 0 if no C++; 1, 11, 14, ... if C++.
0471  * Support for specific features cannot always be determined by the C++ version alone.
0472  * @internal
0473  */
0474 #ifdef U_CPLUSPLUS_VERSION
0475 #   if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus)
0476 #       undef U_CPLUSPLUS_VERSION
0477 #       define U_CPLUSPLUS_VERSION 0
0478 #   endif
0479     /* Otherwise use the predefined value. */
0480 #elif !defined(__cplusplus)
0481 #   define U_CPLUSPLUS_VERSION 0
0482 #elif __cplusplus >= 201703L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L)
0483 #   define U_CPLUSPLUS_VERSION 17
0484 #elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
0485 #   define U_CPLUSPLUS_VERSION 14
0486 #elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
0487 #   define U_CPLUSPLUS_VERSION 11
0488 #else
0489     // C++98 or C++03
0490 #   define U_CPLUSPLUS_VERSION 1
0491 #endif
0492 
0493 /**
0494  * \def U_FALLTHROUGH
0495  * Annotate intentional fall-through between switch labels.
0496  * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
0497  * @internal
0498  */
0499 #ifndef __cplusplus
0500     // Not for C.
0501 #elif defined(U_FALLTHROUGH)
0502     // Use the predefined value.
0503 #elif defined(__clang__)
0504     // Test for compiler vs. feature separately.
0505     // Other compilers might choke on the feature test.
0506 #    if UPRV_HAS_CPP_ATTRIBUTE(clang::fallthrough) || \
0507              (UPRV_HAS_FEATURE(cxx_attributes) &&     \
0508              UPRV_HAS_WARNING("-Wimplicit-fallthrough"))
0509 #       define U_FALLTHROUGH [[clang::fallthrough]]
0510 #   endif
0511 #elif defined(__GNUC__) && (__GNUC__ >= 7)
0512 #   define U_FALLTHROUGH __attribute__((fallthrough))
0513 #endif
0514 
0515 #ifndef U_FALLTHROUGH
0516 #   define U_FALLTHROUGH
0517 #endif
0518 
0519 /** @} */
0520 
0521 /*===========================================================================*/
0522 /** @{ Character data types                                                  */
0523 /*===========================================================================*/
0524 
0525 /**
0526  * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
0527  * @stable ICU 2.0
0528  */
0529 #define U_ASCII_FAMILY 0
0530 
0531 /**
0532  * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
0533  * @stable ICU 2.0
0534  */
0535 #define U_EBCDIC_FAMILY 1
0536 
0537 /**
0538  * \def U_CHARSET_FAMILY
0539  *
0540  * <p>These definitions allow to specify the encoding of text
0541  * in the char data type as defined by the platform and the compiler.
0542  * It is enough to determine the code point values of "invariant characters",
0543  * which are the ones shared by all encodings that are in use
0544  * on a given platform.</p>
0545  *
0546  * <p>Those "invariant characters" should be all the uppercase and lowercase
0547  * latin letters, the digits, the space, and "basic punctuation".
0548  * Also, '\\n', '\\r', '\\t' should be available.</p>
0549  *
0550  * <p>The list of "invariant characters" is:<br>
0551  * \code
0552  *    A-Z  a-z  0-9  SPACE  "  %  &amp;  '  (  )  *  +  ,  -  .  /  :  ;  <  =  >  ?  _
0553  * \endcode
0554  * <br>
0555  * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
0556  *
0557  * <p>This matches the IBM Syntactic Character Set (CS 640).</p>
0558  *
0559  * <p>In other words, all the graphic characters in 7-bit ASCII should
0560  * be safely accessible except the following:</p>
0561  *
0562  * \code
0563  *    '\' <backslash>
0564  *    '[' <left bracket>
0565  *    ']' <right bracket>
0566  *    '{' <left brace>
0567  *    '}' <right brace>
0568  *    '^' <circumflex>
0569  *    '~' <tilde>
0570  *    '!' <exclamation mark>
0571  *    '#' <number sign>
0572  *    '|' <vertical line>
0573  *    '$' <dollar sign>
0574  *    '@' <commercial at>
0575  *    '`' <grave accent>
0576  * \endcode
0577  * @stable ICU 2.0
0578  */
0579 #ifdef U_CHARSET_FAMILY
0580     /* Use the predefined value. */
0581 #elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)
0582 #   define U_CHARSET_FAMILY U_EBCDIC_FAMILY
0583 #elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)
0584 #   define U_CHARSET_FAMILY U_EBCDIC_FAMILY
0585 #else
0586 #   define U_CHARSET_FAMILY U_ASCII_FAMILY
0587 #endif
0588 
0589 /**
0590  * \def U_CHARSET_IS_UTF8
0591  *
0592  * Hardcode the default charset to UTF-8.
0593  *
0594  * If this is set to 1, then
0595  * - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
0596  *   contain UTF-8 text, regardless of what the system API uses
0597  * - some ICU code will use fast functions like u_strFromUTF8()
0598  *   rather than the more general and more heavy-weight conversion API (ucnv.h)
0599  * - ucnv_getDefaultName() always returns "UTF-8"
0600  * - ucnv_setDefaultName() is disabled and will not change the default charset
0601  * - static builds of ICU are smaller
0602  * - more functionality is available with the UCONFIG_NO_CONVERSION build-time
0603  *   configuration option (see unicode/uconfig.h)
0604  * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
0605  *
0606  * @stable ICU 4.2
0607  * @see UCONFIG_NO_CONVERSION
0608  */
0609 #ifdef U_CHARSET_IS_UTF8
0610     /* Use the predefined value. */
0611 #elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED || \
0612         U_PLATFORM == U_PF_EMSCRIPTEN
0613 #   define U_CHARSET_IS_UTF8 1
0614 #else
0615 #   define U_CHARSET_IS_UTF8 0
0616 #endif
0617 
0618 /** @} */
0619 
0620 /*===========================================================================*/
0621 /** @{ Information about wchar support                                       */
0622 /*===========================================================================*/
0623 
0624 /**
0625  * \def U_HAVE_WCHAR_H
0626  * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
0627  *
0628  * @stable ICU 2.0
0629  */
0630 #ifdef U_HAVE_WCHAR_H
0631     /* Use the predefined value. */
0632 #elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9
0633     /*
0634      * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.
0635      * The type and header existed, but the library functions did not work as expected.
0636      * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.
0637      */
0638 #   define U_HAVE_WCHAR_H 0
0639 #else
0640 #   define U_HAVE_WCHAR_H 1
0641 #endif
0642 
0643 /**
0644  * \def U_SIZEOF_WCHAR_T
0645  * U_SIZEOF_WCHAR_T==sizeof(wchar_t)
0646  *
0647  * @stable ICU 2.0
0648  */
0649 #ifdef U_SIZEOF_WCHAR_T
0650     /* Use the predefined value. */
0651 #elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9)
0652     /*
0653      * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.
0654      * Newer Mac OS X has size 4.
0655      */
0656 #   define U_SIZEOF_WCHAR_T 1
0657 #elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN
0658 #   define U_SIZEOF_WCHAR_T 2
0659 #elif U_PLATFORM == U_PF_AIX
0660     /*
0661      * AIX 6.1 information, section "Wide character data representation":
0662      * "... the wchar_t datatype is 32-bit in the 64-bit environment and
0663      * 16-bit in the 32-bit environment."
0664      * and
0665      * "All locales use Unicode for their wide character code values (process code),
0666      * except the IBM-eucTW codeset."
0667      */
0668 #   ifdef __64BIT__
0669 #       define U_SIZEOF_WCHAR_T 4
0670 #   else
0671 #       define U_SIZEOF_WCHAR_T 2
0672 #   endif
0673 #elif U_PLATFORM == U_PF_OS390
0674     /*
0675      * z/OS V1R11 information center, section "LP64 | ILP32":
0676      * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.
0677      * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."
0678      */
0679 #   ifdef _LP64
0680 #       define U_SIZEOF_WCHAR_T 4
0681 #   else
0682 #       define U_SIZEOF_WCHAR_T 2
0683 #   endif
0684 #elif U_PLATFORM == U_PF_OS400
0685 #   if defined(__UTF32__)
0686         /*
0687          * LOCALETYPE(*LOCALEUTF) is specified.
0688          * Wide-character strings are in UTF-32,
0689          * narrow-character strings are in UTF-8.
0690          */
0691 #       define U_SIZEOF_WCHAR_T 4
0692 #   elif defined(__UCS2__)
0693         /*
0694          * LOCALETYPE(*LOCALEUCS2) is specified.
0695          * Wide-character strings are in UCS-2,
0696          * narrow-character strings are in EBCDIC.
0697          */
0698 #       define U_SIZEOF_WCHAR_T 2
0699 #   else
0700         /*
0701          * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
0702          * Wide-character strings are in 16-bit EBCDIC,
0703          * narrow-character strings are in EBCDIC.
0704          */
0705 #       define U_SIZEOF_WCHAR_T 2
0706 #   endif
0707 #else
0708 #   define U_SIZEOF_WCHAR_T 4
0709 #endif
0710 
0711 #ifndef U_HAVE_WCSCPY
0712 #define U_HAVE_WCSCPY U_HAVE_WCHAR_H
0713 #endif
0714 
0715 /** @} */
0716 
0717 /**
0718  * \def U_HAVE_CHAR16_T
0719  * Defines whether the char16_t type is available for UTF-16
0720  * and u"abc" UTF-16 string literals are supported.
0721  * This is a new standard type and standard string literal syntax in C++11
0722  * but has been available in some compilers before.
0723  * @internal
0724  */
0725 #ifdef U_HAVE_CHAR16_T
0726     /* Use the predefined value. */
0727 #else
0728     /*
0729      * Notes:
0730      * C++11 and C11 require support for UTF-16 literals
0731      * Doesn't work on Mac C11 (see workaround in ptypes.h)
0732      * or Cygwin less than 3.5.
0733      */
0734 #   if defined(__cplusplus)
0735 #       define U_HAVE_CHAR16_T 1
0736 #   elif U_PLATFORM_IS_DARWIN_BASED || (U_PLATFORM == U_PF_CYGWIN && CYGWIN_VERSION_DLL_MAJOR < 3005)
0737 #       define U_HAVE_CHAR16_T 0
0738 #   else
0739         // conformant C11
0740 #       define U_HAVE_CHAR16_T 1
0741 #   endif
0742 #endif
0743 
0744 /**
0745  * @{
0746  * \def U_DECLARE_UTF16
0747  * Do not use this macro because it is not defined on all platforms.
0748  * In C++, use std::u16string_view literals, see the UNICODE_STRING docs.
0749  * In C, use u"UTF-16 literals".
0750  * See also the public U_STRING_DECL macro.
0751  * @internal
0752  */
0753 #ifdef U_DECLARE_UTF16
0754     /* Use the predefined value. */
0755 #elif U_HAVE_CHAR16_T \
0756     || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
0757     || (defined(__HP_aCC) && __HP_aCC >= 035000) \
0758     || (defined(__HP_cc) && __HP_cc >= 111106) \
0759     || (defined(U_IN_DOXYGEN))
0760 #   define U_DECLARE_UTF16(string) u ## string
0761 #elif U_SIZEOF_WCHAR_T == 2 \
0762     && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))
0763 #   define U_DECLARE_UTF16(string) L ## string
0764 #else
0765     /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */
0766 #endif
0767 
0768 /** @} */
0769 
0770 /*===========================================================================*/
0771 /** @{ Symbol import-export control                                          */
0772 /*===========================================================================*/
0773 
0774 #ifdef U_EXPORT
0775     /* Use the predefined value. */
0776 #elif defined(U_STATIC_IMPLEMENTATION)
0777 #   define U_EXPORT
0778 #elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \
0779                             UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
0780 #   define U_EXPORT __declspec(dllexport)
0781 #elif defined(__GNUC__) || defined(__open_xl__)
0782 #   define U_EXPORT __attribute__((visibility("default")))
0783 #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
0784    || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) 
0785 #   define U_EXPORT __global
0786 /*#elif defined(__HP_aCC) || defined(__HP_cc)
0787 #   define U_EXPORT __declspec(dllexport)*/
0788 #else
0789 #   define U_EXPORT
0790 #endif
0791 
0792 /* U_CALLCONV is related to U_EXPORT2 */
0793 #ifdef U_EXPORT2
0794     /* Use the predefined value. */
0795 #elif defined(_MSC_VER)
0796 #   define U_EXPORT2 __cdecl
0797 #else
0798 #   define U_EXPORT2
0799 #endif
0800 
0801 #ifdef U_IMPORT
0802     /* Use the predefined value. */
0803 #elif defined(_MSC_VER) || (UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllexport__) && \
0804                             UPRV_HAS_DECLSPEC_ATTRIBUTE(__dllimport__))
0805     /* Windows needs to export/import data. */
0806 #   define U_IMPORT __declspec(dllimport)
0807 #else
0808 #   define U_IMPORT 
0809 #endif
0810 
0811 /**
0812  * \def U_HIDDEN
0813  * This is used to mark internal structs declared within external classes,
0814  * to prevent the internal structs from having the same visibility as the
0815  * class within which they are declared. 
0816  * @internal
0817  */
0818 #ifdef U_HIDDEN
0819     /* Use the predefined value. */
0820 #elif defined(__GNUC__) || defined(__open_xl__)
0821 #   define U_HIDDEN __attribute__((visibility("hidden")))
0822 #else
0823 #   define U_HIDDEN 
0824 #endif
0825 
0826 /**
0827  * \def U_CALLCONV
0828  * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
0829  * in callback function typedefs to make sure that the calling convention
0830  * is compatible.
0831  *
0832  * This is only used for non-ICU-API functions.
0833  * When a function is a public ICU API,
0834  * you must use the U_CAPI and U_EXPORT2 qualifiers.
0835  *
0836  * Please note, you need to use U_CALLCONV after the *.
0837  *
0838  * NO : "static const char U_CALLCONV *func( . . . )"
0839  * YES: "static const char* U_CALLCONV func( . . . )"
0840  *
0841  * @stable ICU 2.0
0842  */
0843 #if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
0844 #    define U_CALLCONV __cdecl
0845 #else
0846 #    define U_CALLCONV U_EXPORT2
0847 #endif
0848 
0849 /**
0850  * \def U_CALLCONV_FPTR
0851  * Similar to U_CALLCONV, but only used on function pointers.
0852  * @internal
0853  */
0854 #if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
0855 #    define U_CALLCONV_FPTR U_CALLCONV
0856 #else
0857 #    define U_CALLCONV_FPTR
0858 #endif
0859 /** @} */
0860 
0861 #endif  // _PLATFORM_H