]> git.saurik.com Git - apple/icu.git/blame - icuSources/common/unicode/platform.h
ICU-491.11.1.tar.gz
[apple/icu.git] / icuSources / common / unicode / platform.h
CommitLineData
4388f060
A
1/*
2******************************************************************************
3*
4* Copyright (C) 1997-2012, International Business Machines
5* Corporation and others. All Rights Reserved.
6*
7******************************************************************************
8*
9* FILE NAME : platform.h
10*
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******************************************************************************
17*/
18
19#ifndef _PLATFORM_H
20#define _PLATFORM_H
21
22#include "unicode/uconfig.h"
23#include "unicode/uvernum.h"
24
25/**
26 * \file
27 * \brief Basic types for the platform.
28 *
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.
32 *
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.
38 *
39 * As a temporary workaround, you can add an explicit #define for some macros
40 * before it is first tested, or add an equivalent -D macro definition
41 * to the compiler's command line.
42 *
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
46 * \code
47 * gcc -E -dM -x c /dev/null | sort
48 * \endcode
49 * (You can provide an actual empty .c file rather than /dev/null.
50 * <code>-x c++</code> is for C++.)
51 */
52
53/**
54 * \def U_PLATFORM
55 * The U_PLATFORM macro defines the platform we're on.
56 *
57 * We used to define one different, value-less macro per platform.
58 * That made it hard to know the set of relevant platforms and macros,
59 * and hard to deal with variants of platforms.
60 *
61 * Starting with ICU 49, we define platforms as numeric macros,
62 * with ranges of values for related platforms and their variants.
63 * The U_PLATFORM macro is set to one of these values.
64 *
65 * Historical note from the Solaris Wikipedia article:
66 * AT&T and Sun collaborated on a project to merge the most popular Unix variants
67 * on the market at that time: BSD, System V, and Xenix.
68 * This became Unix System V Release 4 (SVR4).
69 *
70 * @internal
71 */
72
73/** Unknown platform. @internal */
74#define U_PF_UNKNOWN 0
75/** Windows @internal */
76#define U_PF_WINDOWS 1000
77/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */
78#define U_PF_MINGW 1800
79/**
80 * Cygwin. Windows, calls to cygwin1.dll for Posix functions,
81 * using MSVC or GNU gcc and binutils.
82 * @internal
83 */
84#define U_PF_CYGWIN 1900
85/* Reserve 2000 for U_PF_UNIX? */
86/** HP-UX is based on UNIX System V. @internal */
87#define U_PF_HPUX 2100
88/** Solaris is a Unix operating system based on SVR4. @internal */
89#define U_PF_SOLARIS 2600
90/** BSD is a UNIX operating system derivative. @internal */
91#define U_PF_BSD 3000
92/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */
93#define U_PF_AIX 3100
94/** IRIX is based on UNIX System V with BSD extensions. @internal */
95#define U_PF_IRIX 3200
96/**
97 * Darwin is a POSIX-compliant operating system, composed of code developed by Apple,
98 * as well as code derived from NeXTSTEP, BSD, and other projects,
99 * built around the Mach kernel.
100 * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.
101 * (Original description modified from WikiPedia.)
102 * @internal
103 */
104#define U_PF_DARWIN 3500
105/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */
106#define U_PF_IPHONE 3550
107/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */
108#define U_PF_QNX 3700
109/** Linux is a Unix-like operating system. @internal */
110#define U_PF_LINUX 4000
111/** Android is based on Linux. @internal */
112#define U_PF_ANDROID 4050
113/** "Classic" Mac OS (1984-2001) @internal */
114#define U_PF_CLASSIC_MACOS 8000
115/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
116#define U_PF_OS390 9000
117/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
118#define U_PF_OS400 9400
119
120#ifdef U_PLATFORM
121 /* Use the predefined value. */
122#elif defined(__MINGW32__)
123# define U_PLATFORM U_PF_MINGW
124#elif defined(__CYGWIN__)
125# define U_PLATFORM U_PF_CYGWIN
126#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
127# define U_PLATFORM U_PF_WINDOWS
128#elif defined(__ANDROID__)
129# define U_PLATFORM U_PF_ANDROID
130 /* Android wchar_t support depends on the API level. */
131# include <android/api-level.h>
132#elif defined(linux) || defined(__linux__) || defined(__linux)
133# define U_PLATFORM U_PF_LINUX
134#elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
135# define U_PLATFORM U_PF_BSD
136#elif defined(sun) || defined(__sun)
137 /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */
138# define U_PLATFORM U_PF_SOLARIS
139# if defined(__GNUC__)
140 /* Solaris/GCC needs this header file to get the proper endianness. Normally, this
141 * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h
142 * is included which does not include this header file.
143 */
144# include <sys/isa_defs.h>
145# endif
146#elif defined(_AIX) || defined(__TOS_AIX__)
147# define U_PLATFORM U_PF_AIX
148#elif defined(_hpux) || defined(hpux) || defined(__hpux)
149# define U_PLATFORM U_PF_HPUX
150#elif defined(sgi) || defined(__sgi)
151# define U_PLATFORM U_PF_IRIX
152#elif defined(__APPLE__) && defined(__MACH__)
153# include <TargetConditionals.h>
154# if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */
155# define U_PLATFORM U_PF_IPHONE
156# else
157# define U_PLATFORM U_PF_DARWIN
158# endif
159#elif defined(macintosh)
160# define U_PLATFORM U_PF_CLASSIC_MACOS
161#elif defined(__QNX__) || defined(__QNXNTO__)
162# define U_PLATFORM U_PF_QNX
163#elif defined(__TOS_MVS__)
164# define U_PLATFORM U_PF_OS390
165#elif defined(__OS400__) || defined(__TOS_OS400__)
166# define U_PLATFORM U_PF_OS400
167#else
168# define U_PLATFORM U_PF_UNKNOWN
169#endif
170
171/**
172 * \def CYGWINMSVC
173 * Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
174 * Otherwise undefined.
175 * @internal
176 */
177/* Commented out because this is already set in mh-cygwin-msvc
178#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
179# define CYGWINMSVC
180#endif
181*/
182
183/**
184 * \def U_PLATFORM_USES_ONLY_WIN32_API
185 * Defines whether the platform uses only the Win32 API.
186 * Set to 1 for Windows/MSVC and MinGW but not Cygwin.
187 * @internal
188 */
189#ifdef U_PLATFORM_USES_ONLY_WIN32_API
190 /* Use the predefined value. */
191#elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)
192# define U_PLATFORM_USES_ONLY_WIN32_API 1
193#else
194 /* Cygwin implements POSIX. */
195# define U_PLATFORM_USES_ONLY_WIN32_API 0
196#endif
197
198/**
199 * \def U_PLATFORM_HAS_WIN32_API
200 * Defines whether the Win32 API is available on the platform.
201 * Set to 1 for Windows/MSVC, MinGW and Cygwin.
202 * @internal
203 */
204#ifdef U_PLATFORM_HAS_WIN32_API
205 /* Use the predefined value. */
206#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
207# define U_PLATFORM_HAS_WIN32_API 1
208#else
209# define U_PLATFORM_HAS_WIN32_API 0
210#endif
211
212/**
213 * \def U_PLATFORM_IMPLEMENTS_POSIX
214 * Defines whether the platform implements (most of) the POSIX API.
215 * Set to 1 for Cygwin and most other platforms.
216 * @internal
217 */
218#ifdef U_PLATFORM_IMPLEMENTS_POSIX
219 /* Use the predefined value. */
220#elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_CLASSIC_MACOS
221# define U_PLATFORM_IMPLEMENTS_POSIX 0
222#else
223# define U_PLATFORM_IMPLEMENTS_POSIX 1
224#endif
225
226/**
227 * \def U_PLATFORM_IS_LINUX_BASED
228 * Defines whether the platform is Linux or one of its derivatives.
229 * @internal
230 */
231#ifdef U_PLATFORM_IS_LINUX_BASED
232 /* Use the predefined value. */
233#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= U_PF_ANDROID
234# define U_PLATFORM_IS_LINUX_BASED 1
235#else
236# define U_PLATFORM_IS_LINUX_BASED 0
237#endif
238
239/**
240 * \def U_PLATFORM_IS_DARWIN_BASED
241 * Defines whether the platform is Darwin or one of its derivatives.
242 * @internal
243 */
244#ifdef U_PLATFORM_IS_DARWIN_BASED
245 /* Use the predefined value. */
246#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE
247# define U_PLATFORM_IS_DARWIN_BASED 1
248#else
249# define U_PLATFORM_IS_DARWIN_BASED 0
250#endif
251
252/**
253 * \def U_HAVE_STDINT_H
254 * Defines whether stdint.h is available. It is a C99 standard header.
255 * We used to include inttypes.h which includes stdint.h but we usually do not need
256 * the additional definitions from inttypes.h.
257 * @internal
258 */
259#ifdef U_HAVE_STDINT_H
260 /* Use the predefined value. */
261#elif U_PLATFORM_USES_ONLY_WIN32_API
262# if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER>=1600)
263 /* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */
264# define U_HAVE_STDINT_H 1
265# else
266# define U_HAVE_STDINT_H 0
267# endif
268#elif U_PLATFORM == U_PF_SOLARIS
269 /* Solaris has inttypes.h but not stdint.h. */
270# define U_HAVE_STDINT_H 0
271#else
272# define U_HAVE_STDINT_H 1
273#endif
274
275/**
276 * \def U_HAVE_INTTYPES_H
277 * Defines whether inttypes.h is available. It is a C99 standard header.
278 * We include inttypes.h where it is available but stdint.h is not.
279 * @internal
280 */
281#ifdef U_HAVE_INTTYPES_H
282 /* Use the predefined value. */
283#elif U_PLATFORM == U_PF_SOLARIS
284 /* Solaris has inttypes.h but not stdint.h. */
285# define U_HAVE_INTTYPES_H 1
286#else
287 /* Most platforms have both inttypes.h and stdint.h, or neither. */
288# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H
289#endif
290
291/**
292 * \def U_IOSTREAM_SOURCE
293 * Defines what support for C++ streams is available.
294 *
295 * If U_IOSTREAM_SOURCE is set to 199711, then &lt;iostream&gt; is available
296 * (the ISO/IEC C++ FDIS was published in November 1997), and then
297 * one should qualify streams using the std namespace in ICU header
298 * files.
299 * Starting with ICU 49, this is the only supported version.
300 *
301 * If U_IOSTREAM_SOURCE is set to 198506, then &lt;iostream.h&gt; is
302 * available instead (in June 1985 Stroustrup published
303 * "An Extensible I/O Facility for C++" at the summer USENIX conference).
304 * Starting with ICU 49, this version is not supported any more.
305 *
306 * If U_IOSTREAM_SOURCE is 0 (or any value less than 199711),
307 * then C++ streams are not available and
308 * support for them will be silently suppressed in ICU.
309 *
310 * @internal
311 */
312#ifndef U_IOSTREAM_SOURCE
313#define U_IOSTREAM_SOURCE 199711
314#endif
315
316/**
317 * \def U_HAVE_STD_STRING
318 * Defines whether the standard C++ (STL) &lt;string&gt; header is available.
319 * @internal
320 */
321#ifdef U_HAVE_STD_STRING
322 /* Use the predefined value. */
323#elif U_PLATFORM == U_PF_ANDROID
324# define U_HAVE_STD_STRING 0
325#else
326# define U_HAVE_STD_STRING 1
327#endif
328
329/*===========================================================================*/
330/** @{ Compiler and environment features */
331/*===========================================================================*/
332
333/**
334 * \def U_IS_BIG_ENDIAN
335 * Determines the endianness of the platform.
336 * @internal
337 */
338#ifdef U_IS_BIG_ENDIAN
339 /* Use the predefined value. */
340#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)
341# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
342#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
343 /* gcc */
344# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
345#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
346# define U_IS_BIG_ENDIAN 1
347#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
348# define U_IS_BIG_ENDIAN 0
349#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400
350 /* These platforms do not appear to predefine any endianness macros. */
351# define U_IS_BIG_ENDIAN 1
352#else
353# define U_IS_BIG_ENDIAN 0
354#endif
355
356/**
357 * \def U_HAVE_PLACEMENT_NEW
358 * Determines whether to override placement new and delete for STL.
359 * @stable ICU 2.6
360 */
361#ifdef U_HAVE_PLACEMENT_NEW
362 /* Use the predefined value. */
363#elif defined(__BORLANDC__)
364# define U_HAVE_PLACEMENT_NEW 0
365#else
366# define U_HAVE_PLACEMENT_NEW 1
367#endif
368
369/**
370 * \def U_HAVE_DEBUG_LOCATION_NEW
371 * Define this to define the MFC debug version of the operator new.
372 *
373 * @stable ICU 3.4
374 */
375#ifdef U_HAVE_DEBUG_LOCATION_NEW
376 /* Use the predefined value. */
377#elif defined(_MSC_VER)
378# define U_HAVE_DEBUG_LOCATION_NEW 1
379#else
380# define U_HAVE_DEBUG_LOCATION_NEW 0
381#endif
382
383/** @} */
384
385/*===========================================================================*/
386/** @{ Character data types */
387/*===========================================================================*/
388
389/**
390 * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
391 * @stable ICU 2.0
392 */
393#define U_ASCII_FAMILY 0
394
395/**
396 * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
397 * @stable ICU 2.0
398 */
399#define U_EBCDIC_FAMILY 1
400
401/**
402 * \def U_CHARSET_FAMILY
403 *
404 * <p>These definitions allow to specify the encoding of text
405 * in the char data type as defined by the platform and the compiler.
406 * It is enough to determine the code point values of "invariant characters",
407 * which are the ones shared by all encodings that are in use
408 * on a given platform.</p>
409 *
410 * <p>Those "invariant characters" should be all the uppercase and lowercase
411 * latin letters, the digits, the space, and "basic punctuation".
412 * Also, '\\n', '\\r', '\\t' should be available.</p>
413 *
414 * <p>The list of "invariant characters" is:<br>
415 * \code
416 * A-Z a-z 0-9 SPACE " % &amp; ' ( ) * + , - . / : ; < = > ? _
417 * \endcode
418 * <br>
419 * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
420 *
421 * <p>This matches the IBM Syntactic Character Set (CS 640).</p>
422 *
423 * <p>In other words, all the graphic characters in 7-bit ASCII should
424 * be safely accessible except the following:</p>
425 *
426 * \code
427 * '\' <backslash>
428 * '[' <left bracket>
429 * ']' <right bracket>
430 * '{' <left brace>
431 * '}' <right brace>
432 * '^' <circumflex>
433 * '~' <tilde>
434 * '!' <exclamation mark>
435 * '#' <number sign>
436 * '|' <vertical line>
437 * '$' <dollar sign>
438 * '@' <commercial at>
439 * '`' <grave accent>
440 * \endcode
441 * @stable ICU 2.0
442 */
443#ifdef U_CHARSET_FAMILY
444 /* Use the predefined value. */
445#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)
446# define U_CHARSET_FAMILY U_EBCDIC_FAMILY
447#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)
448# define U_CHARSET_FAMILY U_EBCDIC_FAMILY
449#else
450# define U_CHARSET_FAMILY U_ASCII_FAMILY
451#endif
452
453/**
454 * \def U_CHARSET_IS_UTF8
455 *
456 * Hardcode the default charset to UTF-8.
457 *
458 * If this is set to 1, then
459 * - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
460 * contain UTF-8 text, regardless of what the system API uses
461 * - some ICU code will use fast functions like u_strFromUTF8()
462 * rather than the more general and more heavy-weight conversion API (ucnv.h)
463 * - ucnv_getDefaultName() always returns "UTF-8"
464 * - ucnv_setDefaultName() is disabled and will not change the default charset
465 * - static builds of ICU are smaller
466 * - more functionality is available with the UCONFIG_NO_CONVERSION build-time
467 * configuration option (see unicode/uconfig.h)
468 * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
469 *
470 * @stable ICU 4.2
471 * @see UCONFIG_NO_CONVERSION
472 */
473#ifdef U_CHARSET_IS_UTF8
474 /* Use the predefined value. */
475#elif U_PLATFORM == U_PF_ANDROID || U_PLATFORM_IS_DARWIN_BASED
476# define U_CHARSET_IS_UTF8 1
477#else
478# define U_CHARSET_IS_UTF8 0
479#endif
480
481/** @} */
482
483/*===========================================================================*/
484/** @{ Information about wchar support */
485/*===========================================================================*/
486
487/**
488 * \def U_HAVE_WCHAR_H
489 * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
490 *
491 * @stable ICU 2.0
492 */
493#ifdef U_HAVE_WCHAR_H
494 /* Use the predefined value. */
495#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9
496 /*
497 * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.
498 * The type and header existed, but the library functions did not work as expected.
499 * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.
500 */
501# define U_HAVE_WCHAR_H 0
502#else
503# define U_HAVE_WCHAR_H 1
504#endif
505
506/**
507 * \def U_SIZEOF_WCHAR_T
508 * U_SIZEOF_WCHAR_T==sizeof(wchar_t)
509 *
510 * @stable ICU 2.0
511 */
512#ifdef U_SIZEOF_WCHAR_T
513 /* Use the predefined value. */
514#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9) || U_PLATFORM == U_PF_CLASSIC_MACOS
515 /*
516 * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.
517 * Newer Mac OS X has size 4.
518 */
519# define U_SIZEOF_WCHAR_T 1
520#elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN
521# define U_SIZEOF_WCHAR_T 2
522#elif U_PLATFORM == U_PF_AIX
523 /*
524 * AIX 6.1 information, section "Wide character data representation":
525 * "... the wchar_t datatype is 32-bit in the 64-bit environment and
526 * 16-bit in the 32-bit environment."
527 * and
528 * "All locales use Unicode for their wide character code values (process code),
529 * except the IBM-eucTW codeset."
530 */
531# ifdef __64BIT__
532# define U_SIZEOF_WCHAR_T 4
533# else
534# define U_SIZEOF_WCHAR_T 2
535# endif
536#elif U_PLATFORM == U_PF_OS390
537 /*
538 * z/OS V1R11 information center, section "LP64 | ILP32":
539 * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.
540 * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."
541 */
542# ifdef _LP64
543# define U_SIZEOF_WCHAR_T 4
544# else
545# define U_SIZEOF_WCHAR_T 2
546# endif
547#elif U_PLATFORM == U_PF_OS400
548# if defined(__UTF32__)
549 /*
550 * LOCALETYPE(*LOCALEUTF) is specified.
551 * Wide-character strings are in UTF-32,
552 * narrow-character strings are in UTF-8.
553 */
554# define U_SIZEOF_WCHAR_T 4
555# elif defined(__UCS2__)
556 /*
557 * LOCALETYPE(*LOCALEUCS2) is specified.
558 * Wide-character strings are in UCS-2,
559 * narrow-character strings are in EBCDIC.
560 */
561# define U_SIZEOF_WCHAR_T 2
562#else
563 /*
564 * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
565 * Wide-character strings are in 16-bit EBCDIC,
566 * narrow-character strings are in EBCDIC.
567 */
568# define U_SIZEOF_WCHAR_T 2
569# endif
570#else
571# define U_SIZEOF_WCHAR_T 4
572#endif
573
574#ifndef U_HAVE_WCSCPY
575#define U_HAVE_WCSCPY U_HAVE_WCHAR_H
576#endif
577
578/** @} */
579
580/**
581 * \def U_HAVE_CHAR16_T
582 * Defines whether the char16_t type is available for UTF-16
583 * and u"abc" UTF-16 string literals are supported.
584 * This is a new standard type and standard string literal syntax in C++0x
585 * but has been available in some compilers before.
586 * @internal
587 */
588#ifdef U_HAVE_CHAR16_T
589 /* Use the predefined value. */
590#else
591 /*
592 * Notes:
593 * Visual Studio 10 (_MSC_VER>=1600) defines char16_t but
594 * does not support u"abc" string literals.
595 * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
596 * does not support u"abc" string literals.
597 */
598# define U_HAVE_CHAR16_T 0
599#endif
600
601/**
602 * @{
603 * \def U_DECLARE_UTF16
604 * Do not use this macro because it is not defined on all platforms.
605 * Use the UNICODE_STRING or U_STRING_DECL macros instead.
606 * @internal
607 */
608#ifdef U_DECLARE_UTF16
609 /* Use the predefined value. */
610#elif (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
611 || (defined(__HP_aCC) && __HP_aCC >= 035000) \
612 || (defined(__HP_cc) && __HP_cc >= 111106) \
613 || U_HAVE_CHAR16_T
614# define U_DECLARE_UTF16(string) u ## string
615#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
616/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
617/* Sun's C compiler has issues with this notation, and it's unreliable. */
618# define U_DECLARE_UTF16(string) U ## string
619#elif U_SIZEOF_WCHAR_T == 2 \
620 && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))
621# define U_DECLARE_UTF16(string) L ## string
622#else
623 /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */
624#endif
625
626/** @} */
627
628/*===========================================================================*/
629/** @{ Symbol import-export control */
630/*===========================================================================*/
631
632#ifdef U_EXPORT
633 /* Use the predefined value. */
634#elif defined(U_STATIC_IMPLEMENTATION)
635# define U_EXPORT
636#elif defined(__GNUC__)
637# define U_EXPORT __attribute__((visibility("default")))
638#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
639 || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
640# define U_EXPORT __global
641/*#elif defined(__HP_aCC) || defined(__HP_cc)
642# define U_EXPORT __declspec(dllexport)*/
643#elif defined(_MSC_VER)
644# define U_EXPORT __declspec(dllexport)
645#else
646# define U_EXPORT
647#endif
648
649/* U_CALLCONV is releated to U_EXPORT2 */
650#ifdef U_EXPORT2
651 /* Use the predefined value. */
652#elif defined(_MSC_VER)
653# define U_EXPORT2 __cdecl
654#else
655# define U_EXPORT2
656#endif
657
658#ifdef U_IMPORT
659 /* Use the predefined value. */
660#elif defined(_MSC_VER)
661 /* Windows needs to export/import data. */
662# define U_IMPORT __declspec(dllimport)
663#else
664# define U_IMPORT
665#endif
666
667/**
668 * \def U_CALLCONV
669 * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
670 * in callback function typedefs to make sure that the calling convention
671 * is compatible.
672 *
673 * This is only used for non-ICU-API functions.
674 * When a function is a public ICU API,
675 * you must use the U_CAPI and U_EXPORT2 qualifiers.
676 * @stable ICU 2.0
677 */
678#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
679# define U_CALLCONV __cdecl
680#else
681# define U_CALLCONV U_EXPORT2
682#endif
683
684/* @} */
685
686#endif