1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/intl/icu/source/common/unicode/platform.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,755 @@ 1.4 +/* 1.5 +****************************************************************************** 1.6 +* 1.7 +* Copyright (C) 1997-2013, International Business Machines 1.8 +* Corporation and others. All Rights Reserved. 1.9 +* 1.10 +****************************************************************************** 1.11 +* 1.12 +* FILE NAME : platform.h 1.13 +* 1.14 +* Date Name Description 1.15 +* 05/13/98 nos Creation (content moved here from ptypes.h). 1.16 +* 03/02/99 stephen Added AS400 support. 1.17 +* 03/30/99 stephen Added Linux support. 1.18 +* 04/13/99 stephen Reworked for autoconf. 1.19 +****************************************************************************** 1.20 +*/ 1.21 + 1.22 +#ifndef _PLATFORM_H 1.23 +#define _PLATFORM_H 1.24 + 1.25 +#include "unicode/uconfig.h" 1.26 +#include "unicode/uvernum.h" 1.27 + 1.28 +/** 1.29 + * \file 1.30 + * \brief Basic types for the platform. 1.31 + * 1.32 + * This file used to be generated by autoconf/configure. 1.33 + * Starting with ICU 49, platform.h is a normal source file, 1.34 + * to simplify cross-compiling and working with non-autoconf/make build systems. 1.35 + * 1.36 + * When a value in this file does not work on a platform, then please 1.37 + * try to derive it from the U_PLATFORM value 1.38 + * (for which we might need a new value constant in rare cases) 1.39 + * and/or from other macros that are predefined by the compiler 1.40 + * or defined in standard (POSIX or platform or compiler) headers. 1.41 + * 1.42 + * As a temporary workaround, you can add an explicit <code>#define</code> for some macros 1.43 + * before it is first tested, or add an equivalent -D macro definition 1.44 + * to the compiler's command line. 1.45 + * 1.46 + * Note: Some compilers provide ways to show the predefined macros. 1.47 + * For example, with gcc you can compile an empty .c file and have the compiler 1.48 + * print the predefined macros with 1.49 + * \code 1.50 + * gcc -E -dM -x c /dev/null | sort 1.51 + * \endcode 1.52 + * (You can provide an actual empty .c file rather than /dev/null. 1.53 + * <code>-x c++</code> is for C++.) 1.54 + */ 1.55 + 1.56 +/** 1.57 + * Define some things so that they can be documented. 1.58 + * @internal 1.59 + */ 1.60 +#ifdef U_IN_DOXYGEN 1.61 +/* 1.62 + * Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented. 1.63 + * 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. 1.64 + */ 1.65 + 1.66 +/* None for now. */ 1.67 +#endif 1.68 + 1.69 +/** 1.70 + * \def U_PLATFORM 1.71 + * The U_PLATFORM macro defines the platform we're on. 1.72 + * 1.73 + * We used to define one different, value-less macro per platform. 1.74 + * That made it hard to know the set of relevant platforms and macros, 1.75 + * and hard to deal with variants of platforms. 1.76 + * 1.77 + * Starting with ICU 49, we define platforms as numeric macros, 1.78 + * with ranges of values for related platforms and their variants. 1.79 + * The U_PLATFORM macro is set to one of these values. 1.80 + * 1.81 + * Historical note from the Solaris Wikipedia article: 1.82 + * AT&T and Sun collaborated on a project to merge the most popular Unix variants 1.83 + * on the market at that time: BSD, System V, and Xenix. 1.84 + * This became Unix System V Release 4 (SVR4). 1.85 + * 1.86 + * @internal 1.87 + */ 1.88 + 1.89 +/** Unknown platform. @internal */ 1.90 +#define U_PF_UNKNOWN 0 1.91 +/** Windows @internal */ 1.92 +#define U_PF_WINDOWS 1000 1.93 +/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */ 1.94 +#define U_PF_MINGW 1800 1.95 +/** 1.96 + * Cygwin. Windows, calls to cygwin1.dll for Posix functions, 1.97 + * using MSVC or GNU gcc and binutils. 1.98 + * @internal 1.99 + */ 1.100 +#define U_PF_CYGWIN 1900 1.101 +/* Reserve 2000 for U_PF_UNIX? */ 1.102 +/** HP-UX is based on UNIX System V. @internal */ 1.103 +#define U_PF_HPUX 2100 1.104 +/** Solaris is a Unix operating system based on SVR4. @internal */ 1.105 +#define U_PF_SOLARIS 2600 1.106 +/** BSD is a UNIX operating system derivative. @internal */ 1.107 +#define U_PF_BSD 3000 1.108 +/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */ 1.109 +#define U_PF_AIX 3100 1.110 +/** IRIX is based on UNIX System V with BSD extensions. @internal */ 1.111 +#define U_PF_IRIX 3200 1.112 +/** 1.113 + * Darwin is a POSIX-compliant operating system, composed of code developed by Apple, 1.114 + * as well as code derived from NeXTSTEP, BSD, and other projects, 1.115 + * built around the Mach kernel. 1.116 + * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based. 1.117 + * (Original description modified from WikiPedia.) 1.118 + * @internal 1.119 + */ 1.120 +#define U_PF_DARWIN 3500 1.121 +/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */ 1.122 +#define U_PF_IPHONE 3550 1.123 +/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */ 1.124 +#define U_PF_QNX 3700 1.125 +/** Linux is a Unix-like operating system. @internal */ 1.126 +#define U_PF_LINUX 4000 1.127 +/** Android is based on Linux. @internal */ 1.128 +#define U_PF_ANDROID 4050 1.129 +/** "Classic" Mac OS (1984-2001) @internal */ 1.130 +#define U_PF_CLASSIC_MACOS 8000 1.131 +/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */ 1.132 +#define U_PF_OS390 9000 1.133 +/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */ 1.134 +#define U_PF_OS400 9400 1.135 + 1.136 +#ifdef U_PLATFORM 1.137 + /* Use the predefined value. */ 1.138 +#elif defined(__MINGW32__) 1.139 +# define U_PLATFORM U_PF_MINGW 1.140 +#elif defined(__CYGWIN__) 1.141 +# define U_PLATFORM U_PF_CYGWIN 1.142 +#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) 1.143 +# define U_PLATFORM U_PF_WINDOWS 1.144 +#elif defined(__ANDROID__) 1.145 +# define U_PLATFORM U_PF_ANDROID 1.146 + /* Android wchar_t support depends on the API level. */ 1.147 +# include <android/api-level.h> 1.148 +#elif defined(linux) || defined(__linux__) || defined(__linux) 1.149 +# define U_PLATFORM U_PF_LINUX 1.150 +#elif defined(__APPLE__) && defined(__MACH__) 1.151 +# include <TargetConditionals.h> 1.152 +# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */ 1.153 +# define U_PLATFORM U_PF_IPHONE 1.154 +# else 1.155 +# define U_PLATFORM U_PF_DARWIN 1.156 +# endif 1.157 +#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__) 1.158 +# define U_PLATFORM U_PF_BSD 1.159 +#elif defined(sun) || defined(__sun) 1.160 + /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */ 1.161 +# define U_PLATFORM U_PF_SOLARIS 1.162 +# if defined(__GNUC__) 1.163 + /* Solaris/GCC needs this header file to get the proper endianness. Normally, this 1.164 + * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h 1.165 + * is included which does not include this header file. 1.166 + */ 1.167 +# include <sys/isa_defs.h> 1.168 +# endif 1.169 +#elif defined(_AIX) || defined(__TOS_AIX__) 1.170 +# define U_PLATFORM U_PF_AIX 1.171 +#elif defined(_hpux) || defined(hpux) || defined(__hpux) 1.172 +# define U_PLATFORM U_PF_HPUX 1.173 +#elif defined(sgi) || defined(__sgi) 1.174 +# define U_PLATFORM U_PF_IRIX 1.175 +#elif defined(macintosh) 1.176 +# define U_PLATFORM U_PF_CLASSIC_MACOS 1.177 +#elif defined(__QNX__) || defined(__QNXNTO__) 1.178 +# define U_PLATFORM U_PF_QNX 1.179 +#elif defined(__TOS_MVS__) 1.180 +# define U_PLATFORM U_PF_OS390 1.181 +#elif defined(__OS400__) || defined(__TOS_OS400__) 1.182 +# define U_PLATFORM U_PF_OS400 1.183 +#else 1.184 +# define U_PLATFORM U_PF_UNKNOWN 1.185 +#endif 1.186 + 1.187 +/** 1.188 + * \def CYGWINMSVC 1.189 + * Defined if this is Windows with Cygwin, but using MSVC rather than gcc. 1.190 + * Otherwise undefined. 1.191 + * @internal 1.192 + */ 1.193 +/* Commented out because this is already set in mh-cygwin-msvc 1.194 +#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER) 1.195 +# define CYGWINMSVC 1.196 +#endif 1.197 +*/ 1.198 + 1.199 +/** 1.200 + * \def U_PLATFORM_USES_ONLY_WIN32_API 1.201 + * Defines whether the platform uses only the Win32 API. 1.202 + * Set to 1 for Windows/MSVC and MinGW but not Cygwin. 1.203 + * @internal 1.204 + */ 1.205 +#ifdef U_PLATFORM_USES_ONLY_WIN32_API 1.206 + /* Use the predefined value. */ 1.207 +#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC) 1.208 +# define U_PLATFORM_USES_ONLY_WIN32_API 1 1.209 +#else 1.210 + /* Cygwin implements POSIX. */ 1.211 +# define U_PLATFORM_USES_ONLY_WIN32_API 0 1.212 +#endif 1.213 + 1.214 +/** 1.215 + * \def U_PLATFORM_HAS_WIN32_API 1.216 + * Defines whether the Win32 API is available on the platform. 1.217 + * Set to 1 for Windows/MSVC, MinGW and Cygwin. 1.218 + * @internal 1.219 + */ 1.220 +#ifdef U_PLATFORM_HAS_WIN32_API 1.221 + /* Use the predefined value. */ 1.222 +#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN 1.223 +# define U_PLATFORM_HAS_WIN32_API 1 1.224 +#else 1.225 +# define U_PLATFORM_HAS_WIN32_API 0 1.226 +#endif 1.227 + 1.228 +/** 1.229 + * \def U_PLATFORM_IMPLEMENTS_POSIX 1.230 + * Defines whether the platform implements (most of) the POSIX API. 1.231 + * Set to 1 for Cygwin and most other platforms. 1.232 + * @internal 1.233 + */ 1.234 +#ifdef U_PLATFORM_IMPLEMENTS_POSIX 1.235 + /* Use the predefined value. */ 1.236 +#elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_CLASSIC_MACOS 1.237 +# define U_PLATFORM_IMPLEMENTS_POSIX 0 1.238 +#else 1.239 +# define U_PLATFORM_IMPLEMENTS_POSIX 1 1.240 +#endif 1.241 + 1.242 +/** 1.243 + * \def U_PLATFORM_IS_LINUX_BASED 1.244 + * Defines whether the platform is Linux or one of its derivatives. 1.245 + * @internal 1.246 + */ 1.247 +#ifdef U_PLATFORM_IS_LINUX_BASED 1.248 + /* Use the predefined value. */ 1.249 +#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= U_PF_ANDROID 1.250 +# define U_PLATFORM_IS_LINUX_BASED 1 1.251 +#else 1.252 +# define U_PLATFORM_IS_LINUX_BASED 0 1.253 +#endif 1.254 + 1.255 +/** 1.256 + * \def U_PLATFORM_IS_DARWIN_BASED 1.257 + * Defines whether the platform is Darwin or one of its derivatives. 1.258 + * @internal 1.259 + */ 1.260 +#ifdef U_PLATFORM_IS_DARWIN_BASED 1.261 + /* Use the predefined value. */ 1.262 +#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE 1.263 +# define U_PLATFORM_IS_DARWIN_BASED 1 1.264 +#else 1.265 +# define U_PLATFORM_IS_DARWIN_BASED 0 1.266 +#endif 1.267 + 1.268 +/** 1.269 + * \def U_HAVE_STDINT_H 1.270 + * Defines whether stdint.h is available. It is a C99 standard header. 1.271 + * We used to include inttypes.h which includes stdint.h but we usually do not need 1.272 + * the additional definitions from inttypes.h. 1.273 + * @internal 1.274 + */ 1.275 +#ifdef U_HAVE_STDINT_H 1.276 + /* Use the predefined value. */ 1.277 +#elif U_PLATFORM_USES_ONLY_WIN32_API 1.278 +# if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600) 1.279 + /* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */ 1.280 +# define U_HAVE_STDINT_H 1 1.281 +# else 1.282 +# define U_HAVE_STDINT_H 0 1.283 +# endif 1.284 +#elif U_PLATFORM == U_PF_SOLARIS 1.285 + /* Solaris has inttypes.h but not stdint.h. */ 1.286 +# define U_HAVE_STDINT_H 0 1.287 +#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER) 1.288 + /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */ 1.289 +# define U_HAVE_STDINT_H 0 1.290 +#else 1.291 +# define U_HAVE_STDINT_H 1 1.292 +#endif 1.293 + 1.294 +/** 1.295 + * \def U_HAVE_INTTYPES_H 1.296 + * Defines whether inttypes.h is available. It is a C99 standard header. 1.297 + * We include inttypes.h where it is available but stdint.h is not. 1.298 + * @internal 1.299 + */ 1.300 +#ifdef U_HAVE_INTTYPES_H 1.301 + /* Use the predefined value. */ 1.302 +#elif U_PLATFORM == U_PF_SOLARIS 1.303 + /* Solaris has inttypes.h but not stdint.h. */ 1.304 +# define U_HAVE_INTTYPES_H 1 1.305 +#elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER) 1.306 + /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */ 1.307 +# define U_HAVE_INTTYPES_H 1 1.308 +#else 1.309 + /* Most platforms have both inttypes.h and stdint.h, or neither. */ 1.310 +# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H 1.311 +#endif 1.312 + 1.313 +/** 1.314 + * \def U_IOSTREAM_SOURCE 1.315 + * Defines what support for C++ streams is available. 1.316 + * 1.317 + * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available 1.318 + * (the ISO/IEC C++ FDIS was published in November 1997), and then 1.319 + * one should qualify streams using the std namespace in ICU header 1.320 + * files. 1.321 + * Starting with ICU 49, this is the only supported version. 1.322 + * 1.323 + * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is 1.324 + * available instead (in June 1985 Stroustrup published 1.325 + * "An Extensible I/O Facility for C++" at the summer USENIX conference). 1.326 + * Starting with ICU 49, this version is not supported any more. 1.327 + * 1.328 + * If U_IOSTREAM_SOURCE is 0 (or any value less than 199711), 1.329 + * then C++ streams are not available and 1.330 + * support for them will be silently suppressed in ICU. 1.331 + * 1.332 + * @internal 1.333 + */ 1.334 +#ifndef U_IOSTREAM_SOURCE 1.335 +#define U_IOSTREAM_SOURCE 199711 1.336 +#endif 1.337 + 1.338 +/** 1.339 + * \def U_HAVE_STD_STRING 1.340 + * Defines whether the standard C++ (STL) <string> header is available. 1.341 + * @internal 1.342 + */ 1.343 +#ifdef U_HAVE_STD_STRING 1.344 + /* Use the predefined value. */ 1.345 +#else 1.346 +# define U_HAVE_STD_STRING 1 1.347 +#endif 1.348 + 1.349 +/*===========================================================================*/ 1.350 +/** @{ Compiler and environment features */ 1.351 +/*===========================================================================*/ 1.352 + 1.353 +/** 1.354 + * \def U_GCC_MAJOR_MINOR 1.355 + * Indicates whether the compiler is gcc (test for != 0), 1.356 + * and if so, contains its major (times 100) and minor version numbers. 1.357 + * If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0. 1.358 + * 1.359 + * For example, for testing for whether we have gcc, and whether it's 4.6 or higher, 1.360 + * use "#if U_GCC_MAJOR_MINOR >= 406". 1.361 + * @internal 1.362 + */ 1.363 +#ifdef __GNUC__ 1.364 +# define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__) 1.365 +#else 1.366 +# define U_GCC_MAJOR_MINOR 0 1.367 +#endif 1.368 + 1.369 +/** 1.370 + * \def U_IS_BIG_ENDIAN 1.371 + * Determines the endianness of the platform. 1.372 + * @internal 1.373 + */ 1.374 +#ifdef U_IS_BIG_ENDIAN 1.375 + /* Use the predefined value. */ 1.376 +#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) 1.377 +# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) 1.378 +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) 1.379 + /* gcc */ 1.380 +# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) 1.381 +#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN) 1.382 +# define U_IS_BIG_ENDIAN 1 1.383 +#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN) 1.384 +# define U_IS_BIG_ENDIAN 0 1.385 +#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__) 1.386 + /* These platforms do not appear to predefine any endianness macros. */ 1.387 +# define U_IS_BIG_ENDIAN 1 1.388 +#elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0) 1.389 + /* HPPA do not appear to predefine any endianness macros. */ 1.390 +# define U_IS_BIG_ENDIAN 1 1.391 +#elif defined(sparc) || defined(__sparc) || defined(__sparc__) 1.392 + /* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */ 1.393 +# define U_IS_BIG_ENDIAN 1 1.394 +#else 1.395 +# define U_IS_BIG_ENDIAN 0 1.396 +#endif 1.397 + 1.398 +/** 1.399 + * \def U_HAVE_PLACEMENT_NEW 1.400 + * Determines whether to override placement new and delete for STL. 1.401 + * @stable ICU 2.6 1.402 + */ 1.403 +#ifdef U_HAVE_PLACEMENT_NEW 1.404 + /* Use the predefined value. */ 1.405 +#elif defined(__BORLANDC__) 1.406 +# define U_HAVE_PLACEMENT_NEW 0 1.407 +#else 1.408 +# define U_HAVE_PLACEMENT_NEW 1 1.409 +#endif 1.410 + 1.411 +/** 1.412 + * \def U_HAVE_DEBUG_LOCATION_NEW 1.413 + * Define this to define the MFC debug version of the operator new. 1.414 + * 1.415 + * @stable ICU 3.4 1.416 + */ 1.417 +#ifdef U_HAVE_DEBUG_LOCATION_NEW 1.418 + /* Use the predefined value. */ 1.419 +#elif defined(_MSC_VER) 1.420 +# define U_HAVE_DEBUG_LOCATION_NEW 1 1.421 +#else 1.422 +# define U_HAVE_DEBUG_LOCATION_NEW 0 1.423 +#endif 1.424 + 1.425 +/* Compatibility with non clang compilers */ 1.426 +#ifndef __has_attribute 1.427 +# define __has_attribute(x) 0 1.428 +#endif 1.429 + 1.430 +/** 1.431 + * \def U_MALLOC_ATTR 1.432 + * Attribute to mark functions as malloc-like 1.433 + * @internal 1.434 + */ 1.435 +#if defined(__GNUC__) && __GNUC__>=3 1.436 +# define U_MALLOC_ATTR __attribute__ ((__malloc__)) 1.437 +#else 1.438 +# define U_MALLOC_ATTR 1.439 +#endif 1.440 + 1.441 +/** 1.442 + * \def U_ALLOC_SIZE_ATTR 1.443 + * Attribute to specify the size of the allocated buffer for malloc-like functions 1.444 + * @internal 1.445 + */ 1.446 +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size) 1.447 +# define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X))) 1.448 +# define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y))) 1.449 +#else 1.450 +# define U_ALLOC_SIZE_ATTR(X) 1.451 +# define U_ALLOC_SIZE_ATTR2(X,Y) 1.452 +#endif 1.453 + 1.454 +/** @} */ 1.455 + 1.456 +/*===========================================================================*/ 1.457 +/** @{ Character data types */ 1.458 +/*===========================================================================*/ 1.459 + 1.460 +/** 1.461 + * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform. 1.462 + * @stable ICU 2.0 1.463 + */ 1.464 +#define U_ASCII_FAMILY 0 1.465 + 1.466 +/** 1.467 + * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform. 1.468 + * @stable ICU 2.0 1.469 + */ 1.470 +#define U_EBCDIC_FAMILY 1 1.471 + 1.472 +/** 1.473 + * \def U_CHARSET_FAMILY 1.474 + * 1.475 + * <p>These definitions allow to specify the encoding of text 1.476 + * in the char data type as defined by the platform and the compiler. 1.477 + * It is enough to determine the code point values of "invariant characters", 1.478 + * which are the ones shared by all encodings that are in use 1.479 + * on a given platform.</p> 1.480 + * 1.481 + * <p>Those "invariant characters" should be all the uppercase and lowercase 1.482 + * latin letters, the digits, the space, and "basic punctuation". 1.483 + * Also, '\\n', '\\r', '\\t' should be available.</p> 1.484 + * 1.485 + * <p>The list of "invariant characters" is:<br> 1.486 + * \code 1.487 + * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _ 1.488 + * \endcode 1.489 + * <br> 1.490 + * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p> 1.491 + * 1.492 + * <p>This matches the IBM Syntactic Character Set (CS 640).</p> 1.493 + * 1.494 + * <p>In other words, all the graphic characters in 7-bit ASCII should 1.495 + * be safely accessible except the following:</p> 1.496 + * 1.497 + * \code 1.498 + * '\' <backslash> 1.499 + * '[' <left bracket> 1.500 + * ']' <right bracket> 1.501 + * '{' <left brace> 1.502 + * '}' <right brace> 1.503 + * '^' <circumflex> 1.504 + * '~' <tilde> 1.505 + * '!' <exclamation mark> 1.506 + * '#' <number sign> 1.507 + * '|' <vertical line> 1.508 + * '$' <dollar sign> 1.509 + * '@' <commercial at> 1.510 + * '`' <grave accent> 1.511 + * \endcode 1.512 + * @stable ICU 2.0 1.513 + */ 1.514 +#ifdef U_CHARSET_FAMILY 1.515 + /* Use the predefined value. */ 1.516 +#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB) 1.517 +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY 1.518 +#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__) 1.519 +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY 1.520 +#else 1.521 +# define U_CHARSET_FAMILY U_ASCII_FAMILY 1.522 +#endif 1.523 + 1.524 +/** 1.525 + * \def U_CHARSET_IS_UTF8 1.526 + * 1.527 + * Hardcode the default charset to UTF-8. 1.528 + * 1.529 + * If this is set to 1, then 1.530 + * - ICU will assume that all non-invariant char*, StringPiece, std::string etc. 1.531 + * contain UTF-8 text, regardless of what the system API uses 1.532 + * - some ICU code will use fast functions like u_strFromUTF8() 1.533 + * rather than the more general and more heavy-weight conversion API (ucnv.h) 1.534 + * - ucnv_getDefaultName() always returns "UTF-8" 1.535 + * - ucnv_setDefaultName() is disabled and will not change the default charset 1.536 + * - static builds of ICU are smaller 1.537 + * - more functionality is available with the UCONFIG_NO_CONVERSION build-time 1.538 + * configuration option (see unicode/uconfig.h) 1.539 + * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable 1.540 + * 1.541 + * @stable ICU 4.2 1.542 + * @see UCONFIG_NO_CONVERSION 1.543 + */ 1.544 +#ifdef U_CHARSET_IS_UTF8 1.545 + /* Use the predefined value. */ 1.546 +#elif U_PLATFORM == U_PF_ANDROID || U_PLATFORM_IS_DARWIN_BASED 1.547 +# define U_CHARSET_IS_UTF8 1 1.548 +#else 1.549 +# define U_CHARSET_IS_UTF8 0 1.550 +#endif 1.551 + 1.552 +/** @} */ 1.553 + 1.554 +/*===========================================================================*/ 1.555 +/** @{ Information about wchar support */ 1.556 +/*===========================================================================*/ 1.557 + 1.558 +/** 1.559 + * \def U_HAVE_WCHAR_H 1.560 + * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default. 1.561 + * 1.562 + * @stable ICU 2.0 1.563 + */ 1.564 +#ifdef U_HAVE_WCHAR_H 1.565 + /* Use the predefined value. */ 1.566 +#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9 1.567 + /* 1.568 + * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t. 1.569 + * The type and header existed, but the library functions did not work as expected. 1.570 + * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway. 1.571 + */ 1.572 +# define U_HAVE_WCHAR_H 0 1.573 +#else 1.574 +# define U_HAVE_WCHAR_H 1 1.575 +#endif 1.576 + 1.577 +/** 1.578 + * \def U_SIZEOF_WCHAR_T 1.579 + * U_SIZEOF_WCHAR_T==sizeof(wchar_t) 1.580 + * 1.581 + * @stable ICU 2.0 1.582 + */ 1.583 +#ifdef U_SIZEOF_WCHAR_T 1.584 + /* Use the predefined value. */ 1.585 +#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9) || U_PLATFORM == U_PF_CLASSIC_MACOS 1.586 + /* 1.587 + * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring. 1.588 + * Newer Mac OS X has size 4. 1.589 + */ 1.590 +# define U_SIZEOF_WCHAR_T 1 1.591 +#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN 1.592 +# define U_SIZEOF_WCHAR_T 2 1.593 +#elif U_PLATFORM == U_PF_AIX 1.594 + /* 1.595 + * AIX 6.1 information, section "Wide character data representation": 1.596 + * "... the wchar_t datatype is 32-bit in the 64-bit environment and 1.597 + * 16-bit in the 32-bit environment." 1.598 + * and 1.599 + * "All locales use Unicode for their wide character code values (process code), 1.600 + * except the IBM-eucTW codeset." 1.601 + */ 1.602 +# ifdef __64BIT__ 1.603 +# define U_SIZEOF_WCHAR_T 4 1.604 +# else 1.605 +# define U_SIZEOF_WCHAR_T 2 1.606 +# endif 1.607 +#elif U_PLATFORM == U_PF_OS390 1.608 + /* 1.609 + * z/OS V1R11 information center, section "LP64 | ILP32": 1.610 + * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes. 1.611 + * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes." 1.612 + */ 1.613 +# ifdef _LP64 1.614 +# define U_SIZEOF_WCHAR_T 4 1.615 +# else 1.616 +# define U_SIZEOF_WCHAR_T 2 1.617 +# endif 1.618 +#elif U_PLATFORM == U_PF_OS400 1.619 +# if defined(__UTF32__) 1.620 + /* 1.621 + * LOCALETYPE(*LOCALEUTF) is specified. 1.622 + * Wide-character strings are in UTF-32, 1.623 + * narrow-character strings are in UTF-8. 1.624 + */ 1.625 +# define U_SIZEOF_WCHAR_T 4 1.626 +# elif defined(__UCS2__) 1.627 + /* 1.628 + * LOCALETYPE(*LOCALEUCS2) is specified. 1.629 + * Wide-character strings are in UCS-2, 1.630 + * narrow-character strings are in EBCDIC. 1.631 + */ 1.632 +# define U_SIZEOF_WCHAR_T 2 1.633 +#else 1.634 + /* 1.635 + * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified. 1.636 + * Wide-character strings are in 16-bit EBCDIC, 1.637 + * narrow-character strings are in EBCDIC. 1.638 + */ 1.639 +# define U_SIZEOF_WCHAR_T 2 1.640 +# endif 1.641 +#else 1.642 +# define U_SIZEOF_WCHAR_T 4 1.643 +#endif 1.644 + 1.645 +#ifndef U_HAVE_WCSCPY 1.646 +#define U_HAVE_WCSCPY U_HAVE_WCHAR_H 1.647 +#endif 1.648 + 1.649 +/** @} */ 1.650 + 1.651 +/** 1.652 + * \def U_HAVE_CHAR16_T 1.653 + * Defines whether the char16_t type is available for UTF-16 1.654 + * and u"abc" UTF-16 string literals are supported. 1.655 + * This is a new standard type and standard string literal syntax in C++0x 1.656 + * but has been available in some compilers before. 1.657 + * @internal 1.658 + */ 1.659 +#ifdef U_HAVE_CHAR16_T 1.660 + /* Use the predefined value. */ 1.661 +#else 1.662 + /* 1.663 + * Notes: 1.664 + * Visual Studio 10 (_MSC_VER>=1600) defines char16_t but 1.665 + * does not support u"abc" string literals. 1.666 + * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but 1.667 + * does not support u"abc" string literals. 1.668 + * C++11 and C11 require support for UTF-16 literals 1.669 + */ 1.670 +# if (defined(__cplusplus) && __cplusplus >= 201103L) || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) 1.671 +# define U_HAVE_CHAR16_T 1 1.672 +# else 1.673 +# define U_HAVE_CHAR16_T 0 1.674 +# endif 1.675 +#endif 1.676 + 1.677 +/** 1.678 + * @{ 1.679 + * \def U_DECLARE_UTF16 1.680 + * Do not use this macro because it is not defined on all platforms. 1.681 + * Use the UNICODE_STRING or U_STRING_DECL macros instead. 1.682 + * @internal 1.683 + */ 1.684 +#ifdef U_DECLARE_UTF16 1.685 + /* Use the predefined value. */ 1.686 +#elif U_HAVE_CHAR16_T \ 1.687 + || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ 1.688 + || (defined(__HP_aCC) && __HP_aCC >= 035000) \ 1.689 + || (defined(__HP_cc) && __HP_cc >= 111106) 1.690 +# define U_DECLARE_UTF16(string) u ## string 1.691 +#elif U_SIZEOF_WCHAR_T == 2 \ 1.692 + && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__))) 1.693 +# define U_DECLARE_UTF16(string) L ## string 1.694 +#else 1.695 + /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */ 1.696 +#endif 1.697 + 1.698 +/** @} */ 1.699 + 1.700 +/*===========================================================================*/ 1.701 +/** @{ Symbol import-export control */ 1.702 +/*===========================================================================*/ 1.703 + 1.704 +#ifdef U_EXPORT 1.705 + /* Use the predefined value. */ 1.706 +#elif defined(U_STATIC_IMPLEMENTATION) 1.707 +# define U_EXPORT 1.708 +#elif defined(__GNUC__) 1.709 +# define U_EXPORT __attribute__((visibility("default"))) 1.710 +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ 1.711 + || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) 1.712 +# define U_EXPORT __global 1.713 +/*#elif defined(__HP_aCC) || defined(__HP_cc) 1.714 +# define U_EXPORT __declspec(dllexport)*/ 1.715 +#elif defined(_MSC_VER) 1.716 +# define U_EXPORT __declspec(dllexport) 1.717 +#else 1.718 +# define U_EXPORT 1.719 +#endif 1.720 + 1.721 +/* U_CALLCONV is releated to U_EXPORT2 */ 1.722 +#ifdef U_EXPORT2 1.723 + /* Use the predefined value. */ 1.724 +#elif defined(_MSC_VER) 1.725 +# define U_EXPORT2 __cdecl 1.726 +#else 1.727 +# define U_EXPORT2 1.728 +#endif 1.729 + 1.730 +#ifdef U_IMPORT 1.731 + /* Use the predefined value. */ 1.732 +#elif defined(_MSC_VER) 1.733 + /* Windows needs to export/import data. */ 1.734 +# define U_IMPORT __declspec(dllimport) 1.735 +#else 1.736 +# define U_IMPORT 1.737 +#endif 1.738 + 1.739 +/** 1.740 + * \def U_CALLCONV 1.741 + * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary 1.742 + * in callback function typedefs to make sure that the calling convention 1.743 + * is compatible. 1.744 + * 1.745 + * This is only used for non-ICU-API functions. 1.746 + * When a function is a public ICU API, 1.747 + * you must use the U_CAPI and U_EXPORT2 qualifiers. 1.748 + * @stable ICU 2.0 1.749 + */ 1.750 +#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) 1.751 +# define U_CALLCONV __cdecl 1.752 +#else 1.753 +# define U_CALLCONV U_EXPORT2 1.754 +#endif 1.755 + 1.756 +/* @} */ 1.757 + 1.758 +#endif