• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
3 /*
4 ******************************************************************************
5 *
6 *   Copyright (C) 1997-2016, International Business Machines
7 *   Corporation and others.  All Rights Reserved.
8 *
9 ******************************************************************************
10 *
11 *  FILE NAME : platform.h
12 *
13 *   Date        Name        Description
14 *   05/13/98    nos         Creation (content moved here from ptypes.h).
15 *   03/02/99    stephen     Added AS400 support.
16 *   03/30/99    stephen     Added Linux support.
17 *   04/13/99    stephen     Reworked for autoconf.
18 ******************************************************************************
19 */
20 
21 #ifndef _PLATFORM_H
22 #define _PLATFORM_H
23 
24 #include "unicode/uconfig.h"
25 #include "unicode/uvernum.h"
26 
27 /**
28  * \file
29  * \brief Basic types for the platform.
30  *
31  * This file used to be generated by autoconf/configure.
32  * Starting with ICU 49, platform.h is a normal source file,
33  * to simplify cross-compiling and working with non-autoconf/make build systems.
34  *
35  * When a value in this file does not work on a platform, then please
36  * try to derive it from the U_PLATFORM value
37  * (for which we might need a new value constant in rare cases)
38  * and/or from other macros that are predefined by the compiler
39  * or defined in standard (POSIX or platform or compiler) headers.
40  *
41  * As a temporary workaround, you can add an explicit \#define for some macros
42  * before it is first tested, or add an equivalent -D macro definition
43  * to the compiler's command line.
44  *
45  * Note: Some compilers provide ways to show the predefined macros.
46  * For example, with gcc you can compile an empty .c file and have the compiler
47  * print the predefined macros with
48  * \code
49  * gcc -E -dM -x c /dev/null | sort
50  * \endcode
51  * (You can provide an actual empty .c file rather than /dev/null.
52  * <code>-x c++</code> is for C++.)
53  */
54 
55 /**
56  * Define some things so that they can be documented.
57  * @internal
58  */
59 #ifdef U_IN_DOXYGEN
60 /*
61  * Problem: "platform.h:335: warning: documentation for unknown define U_HAVE_STD_STRING found." means that U_HAVE_STD_STRING is not documented.
62  * 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.
63  */
64 
65 /* None for now. */
66 #endif
67 
68 /**
69  * \def U_PLATFORM
70  * The U_PLATFORM macro defines the platform we're on.
71  *
72  * We used to define one different, value-less macro per platform.
73  * That made it hard to know the set of relevant platforms and macros,
74  * and hard to deal with variants of platforms.
75  *
76  * Starting with ICU 49, we define platforms as numeric macros,
77  * with ranges of values for related platforms and their variants.
78  * The U_PLATFORM macro is set to one of these values.
79  *
80  * Historical note from the Solaris Wikipedia article:
81  * AT&T and Sun collaborated on a project to merge the most popular Unix variants
82  * on the market at that time: BSD, System V, and Xenix.
83  * This became Unix System V Release 4 (SVR4).
84  *
85  * @internal
86  */
87 
88 /** Unknown platform. @internal */
89 #define U_PF_UNKNOWN 0
90 /** Windows @internal */
91 #define U_PF_WINDOWS 1000
92 /** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */
93 #define U_PF_MINGW 1800
94 /**
95  * Cygwin. Windows, calls to cygwin1.dll for Posix functions,
96  * using MSVC or GNU gcc and binutils.
97  * @internal
98  */
99 #define U_PF_CYGWIN 1900
100 /* Reserve 2000 for U_PF_UNIX? */
101 /** HP-UX is based on UNIX System V. @internal */
102 #define U_PF_HPUX 2100
103 /** Solaris is a Unix operating system based on SVR4. @internal */
104 #define U_PF_SOLARIS 2600
105 /** BSD is a UNIX operating system derivative. @internal */
106 #define U_PF_BSD 3000
107 /** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */
108 #define U_PF_AIX 3100
109 /** IRIX is based on UNIX System V with BSD extensions. @internal */
110 #define U_PF_IRIX 3200
111 /**
112  * Darwin is a POSIX-compliant operating system, composed of code developed by Apple,
113  * as well as code derived from NeXTSTEP, BSD, and other projects,
114  * built around the Mach kernel.
115  * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based.
116  * (Original description modified from WikiPedia.)
117  * @internal
118  */
119 #define U_PF_DARWIN 3500
120 /** iPhone OS (iOS) is a derivative of Mac OS X. @internal */
121 #define U_PF_IPHONE 3550
122 /** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */
123 #define U_PF_QNX 3700
124 /** Linux is a Unix-like operating system. @internal */
125 #define U_PF_LINUX 4000
126 /**
127  * Native Client is pretty close to Linux.
128  * See https://developer.chrome.com/native-client and
129  *  http://www.chromium.org/nativeclient
130  *  @internal
131  */
132 #define U_PF_BROWSER_NATIVE_CLIENT 4020
133 /** Android is based on Linux. @internal */
134 #define U_PF_ANDROID 4050
135 /** Fuchsia is a POSIX-ish platform. @internal */
136 #define U_PF_FUCHSIA 4100
137 /* Maximum value for Linux-based platform is 4499 */
138 /** z/OS is the successor to OS/390 which was the successor to MVS. @internal */
139 #define U_PF_OS390 9000
140 /** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */
141 #define U_PF_OS400 9400
142 
143 #ifdef U_PLATFORM
144     /* Use the predefined value. */
145 #elif defined(__MINGW32__)
146 #   define U_PLATFORM U_PF_MINGW
147 #elif defined(__CYGWIN__)
148 #   define U_PLATFORM U_PF_CYGWIN
149 #elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)
150 #   define U_PLATFORM U_PF_WINDOWS
151 #elif defined(__ANDROID__)
152 #   define U_PLATFORM U_PF_ANDROID
153     /* Android wchar_t support depends on the API level. */
154 #   include <android/api-level.h>
155 #elif defined(__pnacl__) || defined(__native_client__)
156 #   define U_PLATFORM U_PF_BROWSER_NATIVE_CLIENT
157 #elif defined(__Fuchsia__)
158 #   define U_PLATFORM U_PF_FUCHSIA
159 #elif defined(linux) || defined(__linux__) || defined(__linux)
160 #   define U_PLATFORM U_PF_LINUX
161 #elif defined(__APPLE__) && defined(__MACH__)
162 #   include <TargetConditionals.h>
163 #   if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE  /* variant of TARGET_OS_MAC */
164 #       define U_PLATFORM U_PF_IPHONE
165 #   else
166 #       define U_PLATFORM U_PF_DARWIN
167 #   endif
168 #elif defined(BSD) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__MirBSD__)
169 #   if defined(__FreeBSD__)
170 #       include <sys/endian.h>
171 #   endif
172 #   define U_PLATFORM U_PF_BSD
173 #elif defined(sun) || defined(__sun)
174     /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */
175 #   define U_PLATFORM U_PF_SOLARIS
176 #   if defined(__GNUC__)
177         /* Solaris/GCC needs this header file to get the proper endianness. Normally, this
178          * header file is included with stddef.h but on Solairs/GCC, the GCC version of stddef.h
179          *  is included which does not include this header file.
180          */
181 #       include <sys/isa_defs.h>
182 #   endif
183 #elif defined(_AIX) || defined(__TOS_AIX__)
184 #   define U_PLATFORM U_PF_AIX
185 #elif defined(_hpux) || defined(hpux) || defined(__hpux)
186 #   define U_PLATFORM U_PF_HPUX
187 #elif defined(sgi) || defined(__sgi)
188 #   define U_PLATFORM U_PF_IRIX
189 #elif defined(__QNX__) || defined(__QNXNTO__)
190 #   define U_PLATFORM U_PF_QNX
191 #elif defined(__TOS_MVS__)
192 #   define U_PLATFORM U_PF_OS390
193 #elif defined(__OS400__) || defined(__TOS_OS400__)
194 #   define U_PLATFORM U_PF_OS400
195 #else
196 #   define U_PLATFORM U_PF_UNKNOWN
197 #endif
198 
199 /**
200  * \def CYGWINMSVC
201  * Defined if this is Windows with Cygwin, but using MSVC rather than gcc.
202  * Otherwise undefined.
203  * @internal
204  */
205 /* Commented out because this is already set in mh-cygwin-msvc
206 #if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER)
207 #   define CYGWINMSVC
208 #endif
209 */
210 #ifdef U_IN_DOXYGEN
211 #   define CYGWINMSVC
212 #endif
213 
214 /**
215  * \def U_PLATFORM_USES_ONLY_WIN32_API
216  * Defines whether the platform uses only the Win32 API.
217  * Set to 1 for Windows/MSVC and MinGW but not Cygwin.
218  * @internal
219  */
220 #ifdef U_PLATFORM_USES_ONLY_WIN32_API
221     /* Use the predefined value. */
222 #elif (U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW) || defined(CYGWINMSVC)
223 #   define U_PLATFORM_USES_ONLY_WIN32_API 1
224 #else
225     /* Cygwin implements POSIX. */
226 #   define U_PLATFORM_USES_ONLY_WIN32_API 0
227 #endif
228 
229 /**
230  * \def U_PLATFORM_HAS_WIN32_API
231  * Defines whether the Win32 API is available on the platform.
232  * Set to 1 for Windows/MSVC, MinGW and Cygwin.
233  * @internal
234  */
235 #ifdef U_PLATFORM_HAS_WIN32_API
236     /* Use the predefined value. */
237 #elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN
238 #   define U_PLATFORM_HAS_WIN32_API 1
239 #else
240 #   define U_PLATFORM_HAS_WIN32_API 0
241 #endif
242 
243 /**
244  * \def U_PLATFORM_HAS_WINUWP_API
245  * Defines whether target is intended for Universal Windows Platform API
246  * Set to 1 for Windows10 Release Solution Configuration
247  * @internal
248  */
249 #ifdef U_PLATFORM_HAS_WINUWP_API
250     /* Use the predefined value. */
251 #else
252 #   define U_PLATFORM_HAS_WINUWP_API 0
253 #endif
254 
255 /**
256  * \def U_PLATFORM_IMPLEMENTS_POSIX
257  * Defines whether the platform implements (most of) the POSIX API.
258  * Set to 1 for Cygwin and most other platforms.
259  * @internal
260  */
261 #ifdef U_PLATFORM_IMPLEMENTS_POSIX
262     /* Use the predefined value. */
263 #elif U_PLATFORM_USES_ONLY_WIN32_API
264 #   define U_PLATFORM_IMPLEMENTS_POSIX 0
265 #else
266 #   define U_PLATFORM_IMPLEMENTS_POSIX 1
267 #endif
268 
269 /**
270  * \def U_PLATFORM_IS_LINUX_BASED
271  * Defines whether the platform is Linux or one of its derivatives.
272  * @internal
273  */
274 #ifdef U_PLATFORM_IS_LINUX_BASED
275     /* Use the predefined value. */
276 #elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= 4499
277 #   define U_PLATFORM_IS_LINUX_BASED 1
278 #else
279 #   define U_PLATFORM_IS_LINUX_BASED 0
280 #endif
281 
282 /**
283  * \def U_PLATFORM_IS_DARWIN_BASED
284  * Defines whether the platform is Darwin or one of its derivatives.
285  * @internal
286  */
287 #ifdef U_PLATFORM_IS_DARWIN_BASED
288     /* Use the predefined value. */
289 #elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE
290 #   define U_PLATFORM_IS_DARWIN_BASED 1
291 #else
292 #   define U_PLATFORM_IS_DARWIN_BASED 0
293 #endif
294 
295 /**
296  * \def U_HAVE_STDINT_H
297  * Defines whether stdint.h is available. It is a C99 standard header.
298  * We used to include inttypes.h which includes stdint.h but we usually do not need
299  * the additional definitions from inttypes.h.
300  * @internal
301  */
302 #ifdef U_HAVE_STDINT_H
303     /* Use the predefined value. */
304 #elif U_PLATFORM_USES_ONLY_WIN32_API
305 #   if defined(__BORLANDC__) || U_PLATFORM == U_PF_MINGW || (defined(_MSC_VER) && _MSC_VER>=1600)
306         /* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */
307 #       define U_HAVE_STDINT_H 1
308 #   else
309 #       define U_HAVE_STDINT_H 0
310 #   endif
311 #elif U_PLATFORM == U_PF_SOLARIS
312     /* Solaris has inttypes.h but not stdint.h. */
313 #   define U_HAVE_STDINT_H 0
314 #elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)
315     /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */
316 #   define U_HAVE_STDINT_H 0
317 #else
318 #   define U_HAVE_STDINT_H 1
319 #endif
320 
321 /**
322  * \def U_HAVE_INTTYPES_H
323  * Defines whether inttypes.h is available. It is a C99 standard header.
324  * We include inttypes.h where it is available but stdint.h is not.
325  * @internal
326  */
327 #ifdef U_HAVE_INTTYPES_H
328     /* Use the predefined value. */
329 #elif U_PLATFORM == U_PF_SOLARIS
330     /* Solaris has inttypes.h but not stdint.h. */
331 #   define U_HAVE_INTTYPES_H 1
332 #elif U_PLATFORM == U_PF_AIX && !defined(_AIX51) && defined(_POWER)
333     /* PPC AIX <= 4.3 has inttypes.h but not stdint.h. */
334 #   define U_HAVE_INTTYPES_H 1
335 #else
336     /* Most platforms have both inttypes.h and stdint.h, or neither. */
337 #   define U_HAVE_INTTYPES_H U_HAVE_STDINT_H
338 #endif
339 
340 /*===========================================================================*/
341 /** @{ Compiler and environment features                                     */
342 /*===========================================================================*/
343 
344 /**
345  * \def U_GCC_MAJOR_MINOR
346  * Indicates whether the compiler is gcc (test for != 0),
347  * and if so, contains its major (times 100) and minor version numbers.
348  * If the compiler is not gcc, then U_GCC_MAJOR_MINOR == 0.
349  *
350  * For example, for testing for whether we have gcc, and whether it's 4.6 or higher,
351  * use "#if U_GCC_MAJOR_MINOR >= 406".
352  * @internal
353  */
354 #ifdef __GNUC__
355 #   define U_GCC_MAJOR_MINOR (__GNUC__ * 100 + __GNUC_MINOR__)
356 #else
357 #   define U_GCC_MAJOR_MINOR 0
358 #endif
359 
360 /**
361  * \def U_IS_BIG_ENDIAN
362  * Determines the endianness of the platform.
363  * @internal
364  */
365 #ifdef U_IS_BIG_ENDIAN
366     /* Use the predefined value. */
367 #elif defined(BYTE_ORDER) && defined(BIG_ENDIAN)
368 #   define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
369 #elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__)
370     /* gcc */
371 #   define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)
372 #elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN)
373 #   define U_IS_BIG_ENDIAN 1
374 #elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN)
375 #   define U_IS_BIG_ENDIAN 0
376 #elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 || defined(__s390__) || defined(__s390x__)
377     /* These platforms do not appear to predefine any endianness macros. */
378 #   define U_IS_BIG_ENDIAN 1
379 #elif defined(_PA_RISC1_0) || defined(_PA_RISC1_1) || defined(_PA_RISC2_0)
380     /* HPPA do not appear to predefine any endianness macros. */
381 #   define U_IS_BIG_ENDIAN 1
382 #elif defined(sparc) || defined(__sparc) || defined(__sparc__)
383     /* Some sparc based systems (e.g. Linux) do not predefine any endianness macros. */
384 #   define U_IS_BIG_ENDIAN 1
385 #else
386 #   define U_IS_BIG_ENDIAN 0
387 #endif
388 
389 /**
390  * \def U_HAVE_PLACEMENT_NEW
391  * Determines whether to override placement new and delete for STL.
392  * @stable ICU 2.6
393  */
394 #ifdef U_HAVE_PLACEMENT_NEW
395     /* Use the predefined value. */
396 #elif defined(__BORLANDC__)
397 #   define U_HAVE_PLACEMENT_NEW 0
398 #else
399 #   define U_HAVE_PLACEMENT_NEW 1
400 #endif
401 
402 /**
403  * \def U_HAVE_DEBUG_LOCATION_NEW
404  * Define this to define the MFC debug version of the operator new.
405  *
406  * @stable ICU 3.4
407  */
408 #ifdef U_HAVE_DEBUG_LOCATION_NEW
409     /* Use the predefined value. */
410 #elif defined(_MSC_VER)
411 #   define U_HAVE_DEBUG_LOCATION_NEW 1
412 #else
413 #   define U_HAVE_DEBUG_LOCATION_NEW 0
414 #endif
415 
416 /* Compatibility with compilers other than clang: http://clang.llvm.org/docs/LanguageExtensions.html */
417 #ifndef __has_attribute
418 #    define __has_attribute(x) 0
419 #endif
420 #ifndef __has_cpp_attribute
421 #    define __has_cpp_attribute(x) 0
422 #endif
423 #ifndef __has_declspec_attribute
424 #    define __has_declspec_attribute(x) 0
425 #endif
426 #ifndef __has_builtin
427 #    define __has_builtin(x) 0
428 #endif
429 #ifndef __has_feature
430 #    define __has_feature(x) 0
431 #endif
432 #ifndef __has_extension
433 #    define __has_extension(x) 0
434 #endif
435 #ifndef __has_warning
436 #    define __has_warning(x) 0
437 #endif
438 
439 /**
440  * \def U_MALLOC_ATTR
441  * Attribute to mark functions as malloc-like
442  * @internal
443  */
444 #if defined(__GNUC__) && __GNUC__>=3
445 #    define U_MALLOC_ATTR __attribute__ ((__malloc__))
446 #else
447 #    define U_MALLOC_ATTR
448 #endif
449 
450 /**
451  * \def U_ALLOC_SIZE_ATTR
452  * Attribute to specify the size of the allocated buffer for malloc-like functions
453  * @internal
454  */
455 #if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3))) || __has_attribute(alloc_size)
456 #   define U_ALLOC_SIZE_ATTR(X) __attribute__ ((alloc_size(X)))
457 #   define U_ALLOC_SIZE_ATTR2(X,Y) __attribute__ ((alloc_size(X,Y)))
458 #else
459 #   define U_ALLOC_SIZE_ATTR(X)
460 #   define U_ALLOC_SIZE_ATTR2(X,Y)
461 #endif
462 
463 /**
464  * \def U_CPLUSPLUS_VERSION
465  * 0 if no C++; 1, 11, 14, ... if C++.
466  * Support for specific features cannot always be determined by the C++ version alone.
467  * @internal
468  */
469 #ifdef U_CPLUSPLUS_VERSION
470 #   if U_CPLUSPLUS_VERSION != 0 && !defined(__cplusplus)
471 #       undef U_CPLUSPLUS_VERSION
472 #       define U_CPLUSPLUS_VERSION 0
473 #   endif
474     /* Otherwise use the predefined value. */
475 #elif !defined(__cplusplus)
476 #   define U_CPLUSPLUS_VERSION 0
477 #elif __cplusplus >= 201402L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L)
478 #   define U_CPLUSPLUS_VERSION 14
479 #elif __cplusplus >= 201103L || (defined(_MSVC_LANG) && _MSVC_LANG >= 201103L)
480 #   define U_CPLUSPLUS_VERSION 11
481 #else
482     // C++98 or C++03
483 #   define U_CPLUSPLUS_VERSION 1
484 #endif
485 
486 #if (U_PLATFORM == U_PF_AIX || U_PLATFORM == U_PF_OS390) && defined(__cplusplus) &&(U_CPLUSPLUS_VERSION < 11)
487 // add in std::nullptr_t
488 namespace std {
489   typedef decltype(nullptr) nullptr_t;
490 };
491 #endif
492 
493 /**
494  * \def U_NOEXCEPT
495  * "noexcept" if supported, otherwise empty.
496  * Some code, especially STL containers, uses move semantics of objects only
497  * if the move constructor and the move operator are declared as not throwing exceptions.
498  * @internal
499  */
500 #ifdef U_NOEXCEPT
501     /* Use the predefined value. */
502 #else
503 #   define U_NOEXCEPT noexcept
504 #endif
505 
506 /**
507  * \def U_FALLTHROUGH
508  * Annotate intentional fall-through between switch labels.
509  * http://clang.llvm.org/docs/AttributeReference.html#fallthrough-clang-fallthrough
510  * @internal
511  */
512 #ifndef __cplusplus
513     // Not for C.
514 #elif defined(U_FALLTHROUGH)
515     // Use the predefined value.
516 #elif defined(__clang__)
517     // Test for compiler vs. feature separately.
518     // Other compilers might choke on the feature test.
519 #   if __has_cpp_attribute(clang::fallthrough) || \
520             (__has_feature(cxx_attributes) && __has_warning("-Wimplicit-fallthrough"))
521 #       define U_FALLTHROUGH [[clang::fallthrough]]
522 #   endif
523 #elif defined(__GNUC__) && (__GNUC__ >= 7)
524 #   define U_FALLTHROUGH __attribute__((fallthrough))
525 #endif
526 
527 #ifndef U_FALLTHROUGH
528 #   define U_FALLTHROUGH
529 #endif
530 
531 /** @} */
532 
533 /*===========================================================================*/
534 /** @{ Character data types                                                  */
535 /*===========================================================================*/
536 
537 /**
538  * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform.
539  * @stable ICU 2.0
540  */
541 #define U_ASCII_FAMILY 0
542 
543 /**
544  * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform.
545  * @stable ICU 2.0
546  */
547 #define U_EBCDIC_FAMILY 1
548 
549 /**
550  * \def U_CHARSET_FAMILY
551  *
552  * <p>These definitions allow to specify the encoding of text
553  * in the char data type as defined by the platform and the compiler.
554  * It is enough to determine the code point values of "invariant characters",
555  * which are the ones shared by all encodings that are in use
556  * on a given platform.</p>
557  *
558  * <p>Those "invariant characters" should be all the uppercase and lowercase
559  * latin letters, the digits, the space, and "basic punctuation".
560  * Also, '\\n', '\\r', '\\t' should be available.</p>
561  *
562  * <p>The list of "invariant characters" is:<br>
563  * \code
564  *    A-Z  a-z  0-9  SPACE  "  %  &amp;  '  (  )  *  +  ,  -  .  /  :  ;  <  =  >  ?  _
565  * \endcode
566  * <br>
567  * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)</p>
568  *
569  * <p>This matches the IBM Syntactic Character Set (CS 640).</p>
570  *
571  * <p>In other words, all the graphic characters in 7-bit ASCII should
572  * be safely accessible except the following:</p>
573  *
574  * \code
575  *    '\' <backslash>
576  *    '[' <left bracket>
577  *    ']' <right bracket>
578  *    '{' <left brace>
579  *    '}' <right brace>
580  *    '^' <circumflex>
581  *    '~' <tilde>
582  *    '!' <exclamation mark>
583  *    '#' <number sign>
584  *    '|' <vertical line>
585  *    '$' <dollar sign>
586  *    '@' <commercial at>
587  *    '`' <grave accent>
588  * \endcode
589  * @stable ICU 2.0
590  */
591 #ifdef U_CHARSET_FAMILY
592     /* Use the predefined value. */
593 #elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB)
594 #   define U_CHARSET_FAMILY U_EBCDIC_FAMILY
595 #elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__)
596 #   define U_CHARSET_FAMILY U_EBCDIC_FAMILY
597 #else
598 #   define U_CHARSET_FAMILY U_ASCII_FAMILY
599 #endif
600 
601 /**
602  * \def U_CHARSET_IS_UTF8
603  *
604  * Hardcode the default charset to UTF-8.
605  *
606  * If this is set to 1, then
607  * - ICU will assume that all non-invariant char*, StringPiece, std::string etc.
608  *   contain UTF-8 text, regardless of what the system API uses
609  * - some ICU code will use fast functions like u_strFromUTF8()
610  *   rather than the more general and more heavy-weight conversion API (ucnv.h)
611  * - ucnv_getDefaultName() always returns "UTF-8"
612  * - ucnv_setDefaultName() is disabled and will not change the default charset
613  * - static builds of ICU are smaller
614  * - more functionality is available with the UCONFIG_NO_CONVERSION build-time
615  *   configuration option (see unicode/uconfig.h)
616  * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable
617  *
618  * @stable ICU 4.2
619  * @see UCONFIG_NO_CONVERSION
620  */
621 #ifdef U_CHARSET_IS_UTF8
622     /* Use the predefined value. */
623 #elif U_PLATFORM_IS_LINUX_BASED || U_PLATFORM_IS_DARWIN_BASED
624 #   define U_CHARSET_IS_UTF8 1
625 #else
626 #   define U_CHARSET_IS_UTF8 0
627 #endif
628 
629 /** @} */
630 
631 /*===========================================================================*/
632 /** @{ Information about wchar support                                       */
633 /*===========================================================================*/
634 
635 /**
636  * \def U_HAVE_WCHAR_H
637  * Indicates whether <wchar.h> is available (1) or not (0). Set to 1 by default.
638  *
639  * @stable ICU 2.0
640  */
641 #ifdef U_HAVE_WCHAR_H
642     /* Use the predefined value. */
643 #elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9
644     /*
645      * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t.
646      * The type and header existed, but the library functions did not work as expected.
647      * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway.
648      */
649 #   define U_HAVE_WCHAR_H 0
650 #else
651 #   define U_HAVE_WCHAR_H 1
652 #endif
653 
654 /**
655  * \def U_SIZEOF_WCHAR_T
656  * U_SIZEOF_WCHAR_T==sizeof(wchar_t)
657  *
658  * @stable ICU 2.0
659  */
660 #ifdef U_SIZEOF_WCHAR_T
661     /* Use the predefined value. */
662 #elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9)
663     /*
664      * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring.
665      * Newer Mac OS X has size 4.
666      */
667 #   define U_SIZEOF_WCHAR_T 1
668 #elif U_PLATFORM_HAS_WIN32_API || U_PLATFORM == U_PF_CYGWIN
669 #   define U_SIZEOF_WCHAR_T 2
670 #elif U_PLATFORM == U_PF_AIX
671     /*
672      * AIX 6.1 information, section "Wide character data representation":
673      * "... the wchar_t datatype is 32-bit in the 64-bit environment and
674      * 16-bit in the 32-bit environment."
675      * and
676      * "All locales use Unicode for their wide character code values (process code),
677      * except the IBM-eucTW codeset."
678      */
679 #   ifdef __64BIT__
680 #       define U_SIZEOF_WCHAR_T 4
681 #   else
682 #       define U_SIZEOF_WCHAR_T 2
683 #   endif
684 #elif U_PLATFORM == U_PF_OS390
685     /*
686      * z/OS V1R11 information center, section "LP64 | ILP32":
687      * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes.
688      * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes."
689      */
690 #   ifdef _LP64
691 #       define U_SIZEOF_WCHAR_T 4
692 #   else
693 #       define U_SIZEOF_WCHAR_T 2
694 #   endif
695 #elif U_PLATFORM == U_PF_OS400
696 #   if defined(__UTF32__)
697         /*
698          * LOCALETYPE(*LOCALEUTF) is specified.
699          * Wide-character strings are in UTF-32,
700          * narrow-character strings are in UTF-8.
701          */
702 #       define U_SIZEOF_WCHAR_T 4
703 #   elif defined(__UCS2__)
704         /*
705          * LOCALETYPE(*LOCALEUCS2) is specified.
706          * Wide-character strings are in UCS-2,
707          * narrow-character strings are in EBCDIC.
708          */
709 #       define U_SIZEOF_WCHAR_T 2
710 #else
711         /*
712          * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified.
713          * Wide-character strings are in 16-bit EBCDIC,
714          * narrow-character strings are in EBCDIC.
715          */
716 #       define U_SIZEOF_WCHAR_T 2
717 #   endif
718 #else
719 #   define U_SIZEOF_WCHAR_T 4
720 #endif
721 
722 #ifndef U_HAVE_WCSCPY
723 #define U_HAVE_WCSCPY U_HAVE_WCHAR_H
724 #endif
725 
726 /** @} */
727 
728 /**
729  * \def U_HAVE_CHAR16_T
730  * Defines whether the char16_t type is available for UTF-16
731  * and u"abc" UTF-16 string literals are supported.
732  * This is a new standard type and standard string literal syntax in C++0x
733  * but has been available in some compilers before.
734  * @internal
735  */
736 #ifdef U_HAVE_CHAR16_T
737     /* Use the predefined value. */
738 #else
739     /*
740      * Notes:
741      * Visual Studio 2010 (_MSC_VER==1600) defines char16_t as a typedef
742      * and does not support u"abc" string literals.
743      * Visual Studio 2015 (_MSC_VER>=1900) and above adds support for
744      * both char16_t and u"abc" string literals.
745      * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but
746      * does not support u"abc" string literals.
747      * C++11 and C11 require support for UTF-16 literals
748      * TODO: Fix for plain C. Doesn't work on Mac.
749      */
750 #   if U_CPLUSPLUS_VERSION >= 11 || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
751 #       define U_HAVE_CHAR16_T 1
752 #   else
753 #       define U_HAVE_CHAR16_T 0
754 #   endif
755 #endif
756 
757 /**
758  * @{
759  * \def U_DECLARE_UTF16
760  * Do not use this macro because it is not defined on all platforms.
761  * Use the UNICODE_STRING or U_STRING_DECL macros instead.
762  * @internal
763  */
764 #ifdef U_DECLARE_UTF16
765     /* Use the predefined value. */
766 #elif U_HAVE_CHAR16_T \
767     || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
768     || (defined(__HP_aCC) && __HP_aCC >= 035000) \
769     || (defined(__HP_cc) && __HP_cc >= 111106) \
770     || (defined(U_IN_DOXYGEN))
771 #   define U_DECLARE_UTF16(string) u ## string
772 #elif U_SIZEOF_WCHAR_T == 2 \
773     && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__)))
774 #   define U_DECLARE_UTF16(string) L ## string
775 #else
776     /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */
777 #endif
778 
779 /** @} */
780 
781 /*===========================================================================*/
782 /** @{ Symbol import-export control                                          */
783 /*===========================================================================*/
784 
785 #ifdef U_EXPORT
786     /* Use the predefined value. */
787 #elif defined(U_STATIC_IMPLEMENTATION)
788 #   define U_EXPORT
789 #elif defined(_MSC_VER) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))
790 #   define U_EXPORT __declspec(dllexport)
791 #elif defined(__GNUC__)
792 #   define U_EXPORT __attribute__((visibility("default")))
793 #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
794    || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
795 #   define U_EXPORT __global
796 /*#elif defined(__HP_aCC) || defined(__HP_cc)
797 #   define U_EXPORT __declspec(dllexport)*/
798 #else
799 #   define U_EXPORT
800 #endif
801 
802 /* U_CALLCONV is releated to U_EXPORT2 */
803 #ifdef U_EXPORT2
804     /* Use the predefined value. */
805 #elif defined(_MSC_VER)
806 #   define U_EXPORT2 __cdecl
807 #else
808 #   define U_EXPORT2
809 #endif
810 
811 #ifdef U_IMPORT
812     /* Use the predefined value. */
813 #elif defined(_MSC_VER) || (__has_declspec_attribute(dllexport) && __has_declspec_attribute(dllimport))
814     /* Windows needs to export/import data. */
815 #   define U_IMPORT __declspec(dllimport)
816 #else
817 #   define U_IMPORT
818 #endif
819 
820 /**
821  * \def U_CALLCONV
822  * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary
823  * in callback function typedefs to make sure that the calling convention
824  * is compatible.
825  *
826  * This is only used for non-ICU-API functions.
827  * When a function is a public ICU API,
828  * you must use the U_CAPI and U_EXPORT2 qualifiers.
829  *
830  * Please note, you need to use U_CALLCONV after the *.
831  *
832  * NO : "static const char U_CALLCONV *func( . . . )"
833  * YES: "static const char* U_CALLCONV func( . . . )"
834  *
835  * @stable ICU 2.0
836  */
837 #if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
838 #    define U_CALLCONV __cdecl
839 #else
840 #    define U_CALLCONV U_EXPORT2
841 #endif
842 
843 /**
844  * \def U_CALLCONV_FPTR
845  * Similar to U_CALLCONV, but only used on function pointers.
846  * @internal
847  */
848 #if U_PLATFORM == U_PF_OS390 && defined(__cplusplus)
849 #    define U_CALLCONV_FPTR U_CALLCONV
850 #else
851 #    define U_CALLCONV_FPTR
852 #endif
853 /* @} */
854 
855 #endif
856