]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/unicode/platform.h
2 ******************************************************************************
4 * Copyright (C) 1997-2016, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 ******************************************************************************
9 * FILE NAME : platform.h
11 * Date Name Description
12 * 05/13/98 nos Creation (content moved here from ptypes.h).
13 * 03/02/99 stephen Added AS400 support.
14 * 03/30/99 stephen Added Linux support.
15 * 04/13/99 stephen Reworked for autoconf.
16 ******************************************************************************
22 #include "unicode/uconfig.h"
23 #include "unicode/uvernum.h"
27 * \brief Basic types for the platform.
29 * This file used to be generated by autoconf/configure.
30 * Starting with ICU 49, platform.h is a normal source file,
31 * to simplify cross-compiling and working with non-autoconf/make build systems.
33 * When a value in this file does not work on a platform, then please
34 * try to derive it from the U_PLATFORM value
35 * (for which we might need a new value constant in rare cases)
36 * and/or from other macros that are predefined by the compiler
37 * or defined in standard (POSIX or platform or compiler) headers.
39 * As a temporary workaround, you can add an explicit <code>#define</code> for some macros
40 * before it is first tested, or add an equivalent -D macro definition
41 * to the compiler's command line.
43 * Note: Some compilers provide ways to show the predefined macros.
44 * For example, with gcc you can compile an empty .c file and have the compiler
45 * print the predefined macros with
47 * gcc -E -dM -x c /dev/null | sort
49 * (You can provide an actual empty .c file rather than /dev/null.
50 * <code>-x c++</code> is for C++.)
54 * Define some things so that they can be documented.
59 * Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented.
60 * 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.
68 * The U_PLATFORM macro defines the platform we're on.
70 * We used to define one different, value-less macro per platform.
71 * That made it hard to know the set of relevant platforms and macros,
72 * and hard to deal with variants of platforms.
74 * Starting with ICU 49, we define platforms as numeric macros,
75 * with ranges of values for related platforms and their variants.
76 * The U_PLATFORM macro is set to one of these values.
78 * Historical note from the Solaris Wikipedia article:
79 * AT&T and Sun collaborated on a project to merge the most popular Unix variants
80 * on the market at that time: BSD, System V, and Xenix.
81 * This became Unix System V Release 4 (SVR4).
86 /** Unknown platform. @internal */
87 #define U_PF_UNKNOWN 0
88 /** Windows @internal */
89 #define U_PF_WINDOWS 1000
90 /** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */
91 #define U_PF_MINGW 1800
93 * Cygwin. Windows, calls to cygwin1.dll for Posix functions,
94 * using MSVC or GNU gcc and binutils.
97 #define U_PF_CYGWIN 1900
98 /* Reserve 2000 for U_PF_UNIX? */
99 /** HP-UX is based on UNIX System V. @internal */
100 #define U_PF_HPUX 2100
101 /** Solaris is a Unix operating system based on SVR4. @internal */
102 #define U_PF_SOLARIS 2600
103 /** BSD is a UNIX operating system derivative. @internal */
104 #define U_PF_BSD 3000
105 /** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */
106 #define U_PF_AIX 3100
107 /** IRIX is based on UNIX System V with BSD extensions. @internal */
108 #define U_PF_IRIX 3200
110 * Darwin is a POSIX-compliant operating system, composed of code developed by Apple,
111 * as well as code derived from NeXTSTEP, BSD, and other projects,
112 * built around the Mach kernel.
113 * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.
114 * (Original description modified from WikiPedia.)
117 #define U_PF_DARWIN 3500
118 /** iPhone OS (iOS) is a derivative of Mac OS X. @internal */
119 #define U_PF_IPHONE 3550
120 /** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */
121 #define U_PF_QNX 3700
122 /** Linux is a Unix-like operating system. @internal */
123 #define U_PF_LINUX 4000
125 * Native Client is pretty close to Linux.
126 * See https://developer.chrome.com/native-client and
127 * http://www.chromium.org/nativeclient
130 #define U_PF_BROWSER_NATIVE_CLIENT 4020
131 /** Android is based on Linux. @internal */
132 #define U_PF_ANDROID 4050
133 /* Maximum value for Linux-based platform is 4499 */
134 /** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
135 #define U_PF_OS390 9000
136 /** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
137 #define U_PF_OS400 9400
140 /* Use the predefined value. */
141 #elif defined(__MINGW32__)
142 # define U_PLATFORM U_PF_MINGW
143 #elif defined(__CYGWIN__)
144 # define U_PLATFORM U_PF_CYGWIN
145 #elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
146 # define U_PLATFORM U_PF_WINDOWS
147 #elif defined(__ANDROID__)
148 # define U_PLATFORM U_PF_ANDROID
149 /* Android wchar_t support depends on the API level. */
150 # include <android/api-level.h>
151 #elif defined(__native_client__)
152 # define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT
153 #elif defined(linux) || defined(__linux__) || defined(__linux)
154 # define U_PLATFORM U_PF_LINUX
155 #elif defined(__APPLE__) && defined(__MACH__)
156 # include <TargetConditionals.h>
157 # if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */
158 # define U_PLATFORM U_PF_IPHONE
160 # define U_PLATFORM U_PF_DARWIN
162 #elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)
163 # if defined(__FreeBSD__)
164 # include <sys/endian.h>
166 # define U_PLATFORM U_PF_BSD
167 #elif defined(sun) || defined(__sun)
168 /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */
169 # define U_PLATFORM U_PF_SOLARIS
170 # if defined(__GNUC__)
171 /* Solaris/GCC needs this header file to get the proper endianness. Normally, this
172 * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h
173 * is included which does not include this header file.
175 # include <sys/isa_defs.h>
177 #elif defined(_AIX) || defined(__TOS_AIX__)
178 # define U_PLATFORM U_PF_AIX
179 #elif defined(_hpux) || defined(hpux) || defined(__hpux)
180 # define U_PLATFORM U_PF_HPUX
181 #elif defined(sgi) || defined(__sgi)
182 # define U_PLATFORM U_PF_IRIX
183 #elif defined(__QNX__) || defined(__QNXNTO__)
184 # define U_PLATFORM U_PF_QNX
185 #elif defined(__TOS_MVS__)
186 # define U_PLATFORM U_PF_OS390
187 #elif defined(__OS400__) || defined(__TOS_OS400__)
188 # define U_PLATFORM U_PF_OS400
190 # define U_PLATFORM U_PF_UNKNOWN
195 * Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
196 * Otherwise undefined.
199 /* Commented out because this is already set in mh-cygwin-msvc
200 #if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
206 * \def U_PLATFORM_USES_ONLY_WIN32_API
207 * Defines whether the platform uses only the Win32 API.
208 * Set to 1 for Windows/MSVC and MinGW but not Cygwin.
211 #ifdef U_PLATFORM_USES_ONLY_WIN32_API
212 /* Use the predefined value. */
213 #elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)
214 # define U_PLATFORM_USES_ONLY_WIN32_API 1
216 /* Cygwin implements POSIX. */
217 # define U_PLATFORM_USES_ONLY_WIN32_API 0
221 * \def U_PLATFORM_HAS_WIN32_API
222 * Defines whether the Win32 API is available on the platform.
223 * Set to 1 for Windows/MSVC, MinGW and Cygwin.
226 #ifdef U_PLATFORM_HAS_WIN32_API
227 /* Use the predefined value. */
228 #elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
229 # define U_PLATFORM_HAS_WIN32_API 1
231 # define U_PLATFORM_HAS_WIN32_API 0
235 * \def U_PLATFORM_IMPLEMENTS_POSIX
236 * Defines whether the platform implements (most of) the POSIX API.
237 * Set to 1 for Cygwin and most other platforms.
240 #ifdef U_PLATFORM_IMPLEMENTS_POSIX
241 /* Use the predefined value. */
242 #elif U_PLATFORM_USES_ONLY_WIN32_API
243 # define U_PLATFORM_IMPLEMENTS_POSIX 0
245 # define U_PLATFORM_IMPLEMENTS_POSIX 1
249 * \def U_PLATFORM_IS_LINUX_BASED
250 * Defines whether the platform is Linux or one of its derivatives.
253 #ifdef U_PLATFORM_IS_LINUX_BASED
254 /* Use the predefined value. */
255 #elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499
256 # define U_PLATFORM_IS_LINUX_BASED 1
258 # define U_PLATFORM_IS_LINUX_BASED 0
262 * \def U_PLATFORM_IS_DARWIN_BASED
263 * Defines whether the platform is Darwin or one of its derivatives.
266 #ifdef U_PLATFORM_IS_DARWIN_BASED
267 /* Use the predefined value. */
268 #elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE
269 # define U_PLATFORM_IS_DARWIN_BASED 1
271 # define U_PLATFORM_IS_DARWIN_BASED 0
275 * \def U_HAVE_STDINT_H
276 * Defines whether stdint.h is available. It is a C99 standard header.
277 * We used to include inttypes.h which includes stdint.h but we usually do not need
278 * the additional definitions from inttypes.h.
281 #ifdef U_HAVE_STDINT_H
282 /* Use the predefined value. */
283 #elif U_PLATFORM_USES_ONLY_WIN32_API
284 # if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600)
285 /* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */
286 # define U_HAVE_STDINT_H 1
288 # define U_HAVE_STDINT_H 0
290 #elif U_PLATFORM == U_PF_SOLARIS
291 /* Solaris has inttypes.h but not stdint.h. */
292 # define U_HAVE_STDINT_H 0
293 #elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)
294 /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */
295 # define U_HAVE_STDINT_H 0
297 # define U_HAVE_STDINT_H 1
301 * \def U_HAVE_INTTYPES_H
302 * Defines whether inttypes.h is available. It is a C99 standard header.
303 * We include inttypes.h where it is available but stdint.h is not.
306 #ifdef U_HAVE_INTTYPES_H
307 /* Use the predefined value. */
308 #elif U_PLATFORM == U_PF_SOLARIS
309 /* Solaris has inttypes.h but not stdint.h. */
310 # define U_HAVE_INTTYPES_H 1
311 #elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)
312 /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */
313 # define U_HAVE_INTTYPES_H 1
315 /* Most platforms have both inttypes.h and stdint.h, or neither. */
316 # define U_HAVE_INTTYPES_H U_HAVE_STDINT_H
320 * \def U_IOSTREAM_SOURCE
321 * Defines what support for C++ streams is available.
323 * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
324 * (the ISO/IEC C++ FDIS was published in November 1997), and then
325 * one should qualify streams using the std namespace in ICU header
327 * Starting with ICU 49, this is the only supported version.
329 * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
330 * available instead (in June 1985 Stroustrup published
331 * "An Extensible I/O Facility for C++" at the summer USENIX conference).
332 * Starting with ICU 49, this version is not supported any more.
334 * If U_IOSTREAM_SOURCE is 0 (or any value less than 199711),
335 * then C++ streams are not available and
336 * support for them will be silently suppressed in ICU.
340 #ifndef U_IOSTREAM_SOURCE
341 #define U_IOSTREAM_SOURCE 199711
345 * \def U_HAVE_STD_STRING
346 * Defines whether the standard C++ (STL) <string> header is available.
349 #ifdef U_HAVE_STD_STRING
350 /* Use the predefined value. */
352 # define U_HAVE_STD_STRING 1
355 /*===========================================================================*/
356 /** @{ Compiler and environment features */
357 /*===========================================================================*/
360 * \def U_GCC_MAJOR_MINOR
361 * Indicates whether the compiler is gcc (test for != 0),
362 * and if so, contains its major (times 100) and minor version numbers.
363 * If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.
365 * For example, for testing for whether we have gcc, and whether it's 4.6 or higher,
366 * use "#if U_GCC_MAJOR_MINOR >= 406".
370 # define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)
372 # define U_GCC_MAJOR_MINOR 0
376 * \def U_IS_BIG_ENDIAN
377 * Determines the endianness of the platform.
380 #ifdef U_IS_BIG_ENDIAN
381 /* Use the predefined value. */
382 #elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)
383 # define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
384 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
386 # define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
387 #elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
388 # define U_IS_BIG_ENDIAN 1
389 #elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
390 # define U_IS_BIG_ENDIAN 0
391 #elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__)
392 /* These platforms do not appear to predefine any endianness macros. */
393 # define U_IS_BIG_ENDIAN 1
394 #elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0)
395 /* HPPA do not appear to predefine any endianness macros. */
396 # define U_IS_BIG_ENDIAN 1
397 #elif defined(sparc) || defined(__sparc) || defined(__sparc__)
398 /* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */
399 # define U_IS_BIG_ENDIAN 1
401 # define U_IS_BIG_ENDIAN 0
405 * \def U_HAVE_PLACEMENT_NEW
406 * Determines whether to override placement new and delete for STL.
409 #ifdef U_HAVE_PLACEMENT_NEW
410 /* Use the predefined value. */
411 #elif defined(__BORLANDC__)
412 # define U_HAVE_PLACEMENT_NEW 0
414 # define U_HAVE_PLACEMENT_NEW 1
418 * \def U_HAVE_DEBUG_LOCATION_NEW
419 * Define this to define the MFC debug version of the operator new.
423 #ifdef U_HAVE_DEBUG_LOCATION_NEW
424 /* Use the predefined value. */
425 #elif defined(_MSC_VER)
426 # define U_HAVE_DEBUG_LOCATION_NEW 1
428 # define U_HAVE_DEBUG_LOCATION_NEW 0
431 /* Compatibility with non clang compilers: http://clang.llvm.org/docs/LanguageExtensions.html */
432 #ifndef __has_attribute
433 # define __has_attribute(x) 0
435 #ifndef __has_cpp_attribute
436 # define __has_cpp_attribute(x) 0
438 #ifndef __has_builtin
439 # define __has_builtin(x) 0
441 #ifndef __has_feature
442 # define __has_feature(x) 0
444 #ifndef __has_extension
445 # define __has_extension(x) 0
447 #ifndef __has_warning
448 # define __has_warning(x) 0
453 * Attribute to mark functions as malloc-like
456 #if defined(__GNUC__) && __GNUC__>=3
457 # define U_MALLOC_ATTR __attribute__ ((__malloc__))
459 # define U_MALLOC_ATTR
463 * \def U_ALLOC_SIZE_ATTR
464 * Attribute to specify the size of the allocated buffer for malloc-like functions
467 #if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size)
468 # define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))
469 # define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))
471 # define U_ALLOC_SIZE_ATTR(X)
472 # define U_ALLOC_SIZE_ATTR2(X,Y)
476 * \def U_CPLUSPLUS_VERSION
477 * 0 if no C++; 1, 11, 14, ... if C++.
478 * Support for specific features cannot always be determined by the C++ version alone.
481 #ifdef U_CPLUSPLUS_VERSION
482 # if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus)
483 # undef U_CPLUSPLUS_VERSION
484 # define U_CPLUSPLUS_VERSION 0
486 /* Otherwise use the predefined value. */
487 #elif !defined(__cplusplus)
488 # define U_CPLUSPLUS_VERSION 0
489 #elif __cplusplus >= 201402L
490 # define U_CPLUSPLUS_VERSION 14
491 #elif __cplusplus >= 201103L
492 # define U_CPLUSPLUS_VERSION 11
495 # define U_CPLUSPLUS_VERSION 1
499 * \def U_HAVE_RVALUE_REFERENCES
500 * Set to 1 if the compiler supports rvalue references.
501 * C++11 feature, necessary for move constructor & move assignment.
504 #ifdef U_HAVE_RVALUE_REFERENCES
505 /* Use the predefined value. */
506 #elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_rvalue_references) \
507 || defined(__GXX_EXPERIMENTAL_CXX0X__) \
508 || (defined(_MSC_VER) && _MSC_VER >= 1600) /* Visual Studio 2010 */
509 # define U_HAVE_RVALUE_REFERENCES 1
511 # define U_HAVE_RVALUE_REFERENCES 0
516 * "noexcept" if supported, otherwise empty.
517 * Some code, especially STL containers, uses move semantics of objects only
518 * if the move constructor and the move operator are declared as not throwing exceptions.
522 /* Use the predefined value. */
523 #elif defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS /* Visual Studio */
525 #elif U_CPLUSPLUS_VERSION >= 11 || __has_feature(cxx_noexcept) || __has_extension(cxx_noexcept) \
526 || (defined(_MSC_VER) && _MSC_VER >= 1900) /* Visual Studio 2015 */
527 # define U_NOEXCEPT noexcept
534 * Annotate intentional fall-through between switch labels.
535 * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
539 # if __has_cpp_attribute(clang::fallthrough) || \
540 (__has_feature(cxx_attributes) && __has_warning( "-Wimplicit-fallthrough" ))
541 # define U_FALLTHROUGH [[clang::fallthrough]]
543 # define U_FALLTHROUGH
546 # define U_FALLTHROUGH
552 /*===========================================================================*/
553 /** @{ Character data types */
554 /*===========================================================================*/
557 * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
560 #define U_ASCII_FAMILY 0
563 * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
566 #define U_EBCDIC_FAMILY 1
569 * \def U_CHARSET_FAMILY
571 * <p>These definitions allow to specify the encoding of text
572 * in the char data type as defined by the platform and the compiler.
573 * It is enough to determine the code point values of "invariant characters",
574 * which are the ones shared by all encodings that are in use
575 * on a given platform.</p>
577 * <p>Those "invariant characters" should be all the uppercase and lowercase
578 * latin letters, the digits, the space, and "basic punctuation".
579 * Also, '\\n', '\\r', '\\t' should be available.</p>
581 * <p>The list of "invariant characters" is:<br>
583 * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _
586 * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
588 * <p>This matches the IBM Syntactic Character Set (CS 640).</p>
590 * <p>In other words, all the graphic characters in 7-bit ASCII should
591 * be safely accessible except the following:</p>
596 * ']' <right bracket>
601 * '!' <exclamation mark>
603 * '|' <vertical line>
605 * '@' <commercial at>
610 #ifdef U_CHARSET_FAMILY
611 /* Use the predefined value. */
612 #elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)
613 # define U_CHARSET_FAMILY U_EBCDIC_FAMILY
614 #elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)
615 # define U_CHARSET_FAMILY U_EBCDIC_FAMILY
617 # define U_CHARSET_FAMILY U_ASCII_FAMILY
621 * \def U_CHARSET_IS_UTF8
623 * Hardcode the default charset to UTF-8.
625 * If this is set to 1, then
626 * - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
627 * contain UTF-8 text, regardless of what the system API uses
628 * - some ICU code will use fast functions like u_strFromUTF8()
629 * rather than the more general and more heavy-weight conversion API (ucnv.h)
630 * - ucnv_getDefaultName() always returns "UTF-8"
631 * - ucnv_setDefaultName() is disabled and will not change the default charset
632 * - static builds of ICU are smaller
633 * - more functionality is available with the UCONFIG_NO_CONVERSION build-time
634 * configuration option (see unicode/uconfig.h)
635 * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
638 * @see UCONFIG_NO_CONVERSION
640 #ifdef U_CHARSET_IS_UTF8
641 /* Use the predefined value. */
642 #elif U_PLATFORM == U_PF_ANDROID || U_PLATFORM_IS_DARWIN_BASED
643 # define U_CHARSET_IS_UTF8 1
645 # define U_CHARSET_IS_UTF8 0
650 /*===========================================================================*/
651 /** @{ Information about wchar support */
652 /*===========================================================================*/
655 * \def U_HAVE_WCHAR_H
656 * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
660 #ifdef U_HAVE_WCHAR_H
661 /* Use the predefined value. */
662 #elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9
664 * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.
665 * The type and header existed, but the library functions did not work as expected.
666 * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.
668 # define U_HAVE_WCHAR_H 0
670 # define U_HAVE_WCHAR_H 1
674 * \def U_SIZEOF_WCHAR_T
675 * U_SIZEOF_WCHAR_T==sizeof(wchar_t)
679 #ifdef U_SIZEOF_WCHAR_T
680 /* Use the predefined value. */
681 #elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9)
683 * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.
684 * Newer Mac OS X has size 4.
686 # define U_SIZEOF_WCHAR_T 1
687 #elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN
688 # define U_SIZEOF_WCHAR_T 2
689 #elif U_PLATFORM == U_PF_AIX
691 * AIX 6.1 information, section "Wide character data representation":
692 * "... the wchar_t datatype is 32-bit in the 64-bit environment and
693 * 16-bit in the 32-bit environment."
695 * "All locales use Unicode for their wide character code values (process code),
696 * except the IBM-eucTW codeset."
699 # define U_SIZEOF_WCHAR_T 4
701 # define U_SIZEOF_WCHAR_T 2
703 #elif U_PLATFORM == U_PF_OS390
705 * z/OS V1R11 information center, section "LP64 | ILP32":
706 * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.
707 * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."
710 # define U_SIZEOF_WCHAR_T 4
712 # define U_SIZEOF_WCHAR_T 2
714 #elif U_PLATFORM == U_PF_OS400
715 # if defined(__UTF32__)
717 * LOCALETYPE(*LOCALEUTF) is specified.
718 * Wide-character strings are in UTF-32,
719 * narrow-character strings are in UTF-8.
721 # define U_SIZEOF_WCHAR_T 4
722 # elif defined(__UCS2__)
724 * LOCALETYPE(*LOCALEUCS2) is specified.
725 * Wide-character strings are in UCS-2,
726 * narrow-character strings are in EBCDIC.
728 # define U_SIZEOF_WCHAR_T 2
731 * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
732 * Wide-character strings are in 16-bit EBCDIC,
733 * narrow-character strings are in EBCDIC.
735 # define U_SIZEOF_WCHAR_T 2
738 # define U_SIZEOF_WCHAR_T 4
741 #ifndef U_HAVE_WCSCPY
742 #define U_HAVE_WCSCPY U_HAVE_WCHAR_H
748 * \def U_HAVE_CHAR16_T
749 * Defines whether the char16_t type is available for UTF-16
750 * and u"abc" UTF-16 string literals are supported.
751 * This is a new standard type and standard string literal syntax in C++0x
752 * but has been available in some compilers before.
755 #ifdef U_HAVE_CHAR16_T
756 /* Use the predefined value. */
760 * Visual Studio 10 (_MSC_VER>=1600) defines char16_t but
761 * does not support u"abc" string literals.
762 * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
763 * does not support u"abc" string literals.
764 * C++11 and C11 require support for UTF-16 literals
766 # if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
767 # define U_HAVE_CHAR16_T 1
769 # define U_HAVE_CHAR16_T 0
775 * \def U_DECLARE_UTF16
776 * Do not use this macro because it is not defined on all platforms.
777 * Use the UNICODE_STRING or U_STRING_DECL macros instead.
780 #ifdef U_DECLARE_UTF16
781 /* Use the predefined value. */
782 #elif U_HAVE_CHAR16_T \
783 || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
784 || (defined(__HP_aCC) && __HP_aCC >= 035000) \
785 || (defined(__HP_cc) && __HP_cc >= 111106)
786 # define U_DECLARE_UTF16(string) u ## string
787 #elif U_SIZEOF_WCHAR_T == 2 \
788 && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))
789 # define U_DECLARE_UTF16(string) L ## string
791 /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */
796 /*===========================================================================*/
797 /** @{ Symbol import-export control */
798 /*===========================================================================*/
801 /* Use the predefined value. */
802 #elif defined(U_STATIC_IMPLEMENTATION)
804 #elif defined(__GNUC__)
805 # define U_EXPORT __attribute__((visibility( "default" )))
806 #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
807 || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
808 # define U_EXPORT __global
809 /*#elif defined(__HP_aCC) || defined(__HP_cc)
810 # define U_EXPORT __declspec(dllexport)*/
811 #elif defined(_MSC_VER)
812 # define U_EXPORT __declspec(dllexport)
817 /* U_CALLCONV is releated to U_EXPORT2 */
819 /* Use the predefined value. */
820 #elif defined(_MSC_VER)
821 # define U_EXPORT2 __cdecl
827 /* Use the predefined value. */
828 #elif defined(_MSC_VER)
829 /* Windows needs to export/import data. */
830 # define U_IMPORT __declspec(dllimport)
837 * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
838 * in callback function typedefs to make sure that the calling convention
841 * This is only used for non-ICU-API functions.
842 * When a function is a public ICU API,
843 * you must use the U_CAPI and U_EXPORT2 qualifiers.
846 #if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
847 # define U_CALLCONV __cdecl
849 # define U_CALLCONV U_EXPORT2