]> git.saurik.com Git - apple/javascriptcore.git/blob - icu/unicode/platform.h
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / icu / unicode / platform.h
1 /*
2 ******************************************************************************
3 *
4 * Copyright (C) 1997-2010, International Business Machines
5 * Corporation and others. All Rights Reserved.
6 *
7 ******************************************************************************
8 *
9 * Note: autoconf creates platform.h from platform.h.in at configure time.
10 *
11 ******************************************************************************
12 *
13 * FILE NAME : platform.h
14 *
15 * Date Name Description
16 * 05/13/98 nos Creation (content moved here from ptypes.h).
17 * 03/02/99 stephen Added AS400 support.
18 * 03/30/99 stephen Added Linux support.
19 * 04/13/99 stephen Reworked for autoconf.
20 ******************************************************************************
21 */
22
23 #ifndef _PLATFORM_H
24 #define _PLATFORM_H
25
26 /**
27 * \file
28 * \brief Basic types for the platform
29 */
30
31 /* This file should be included before uvernum.h. */
32 #if defined(UVERNUM_H)
33 # error Do not include unicode/uvernum.h before #including unicode/platform.h. Instead of unicode/uvernum.h, #include unicode/uversion.h
34 #endif
35
36 /**
37 * Determine wheter to enable auto cleanup of libraries.
38 * @internal
39 */
40 #ifndef UCLN_NO_AUTO_CLEANUP
41 #define UCLN_NO_AUTO_CLEANUP 1
42 #endif
43
44 /* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */
45 #ifndef CYGWINMSVC
46
47 /** Define the platform we're on. */
48 #ifndef U_DARWIN
49 #define U_DARWIN
50 #endif
51
52 /**
53 * \def U_HAVE_DIRENT_H
54 * Define whether dirent.h is available
55 * @internal
56 */
57 #ifndef U_HAVE_DIRENT_H
58 #define U_HAVE_DIRENT_H 1
59 #endif
60
61 /** Define whether inttypes.h is available */
62 #ifndef U_HAVE_INTTYPES_H
63 #define U_HAVE_INTTYPES_H 1
64 #endif
65
66 /**
67 * Define what support for C++ streams is available.
68 * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available
69 * (1997711 is the date the ISO/IEC C++ FDIS was published), and then
70 * one should qualify streams using the std namespace in ICU header
71 * files.
72 * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is
73 * available instead (198506 is the date when Stroustrup published
74 * "An Extensible I/O Facility for C++" at the summer USENIX conference).
75 * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and
76 * support for them will be silently suppressed in ICU.
77 *
78 */
79
80 #ifndef U_IOSTREAM_SOURCE
81 #define U_IOSTREAM_SOURCE 199711
82 #endif
83
84 /**
85 * \def U_HAVE_STD_STRING
86 * Define whether the standard C++ (STL) <string> header is available.
87 * For platforms that do not use platform.h and do not define this constant
88 * in their platform-specific headers, std_string.h defaults
89 * U_HAVE_STD_STRING to 1.
90 * @internal
91 */
92 #ifndef U_HAVE_STD_STRING
93 #define U_HAVE_STD_STRING 1
94 #endif
95
96 /** @{ Determines whether specific types are available */
97 #ifndef U_HAVE_INT8_T
98 #define U_HAVE_INT8_T 1
99 #endif
100
101 #ifndef U_HAVE_UINT8_T
102 #define U_HAVE_UINT8_T 0
103 #endif
104
105 #ifndef U_HAVE_INT16_T
106 #define U_HAVE_INT16_T 1
107 #endif
108
109 #ifndef U_HAVE_UINT16_T
110 #define U_HAVE_UINT16_T 0
111 #endif
112
113 #ifndef U_HAVE_INT32_T
114 #define U_HAVE_INT32_T 1
115 #endif
116
117 #ifndef U_HAVE_UINT32_T
118 #define U_HAVE_UINT32_T 0
119 #endif
120
121 #ifndef U_HAVE_INT64_T
122 #define U_HAVE_INT64_T 1
123 #endif
124
125 #ifndef U_HAVE_UINT64_T
126 #define U_HAVE_UINT64_T 0
127 #endif
128
129 /** @} */
130
131 /*===========================================================================*/
132 /** @{ Compiler and environment features */
133 /*===========================================================================*/
134
135 /* Define whether namespace is supported */
136 #ifndef U_HAVE_NAMESPACE
137 #define U_HAVE_NAMESPACE 1
138 #endif
139
140 /* Determines the endianness of the platform
141 It's done this way in case multiple architectures are being built at once.
142 For example, Darwin supports fat binaries, which can be both PPC and x86 based. */
143 #if defined(BYTE_ORDER) && defined(BIG_ENDIAN)
144 #define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN)
145 #else
146 #define U_IS_BIG_ENDIAN 1
147 #endif
148
149 /* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */
150 #ifndef ICU_USE_THREADS
151 #define ICU_USE_THREADS 1
152 #endif
153
154 /* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check lock. */
155 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
156 #define UMTX_STRONG_MEMORY_MODEL 1
157 #endif
158
159 #ifndef U_DEBUG
160 #define U_DEBUG 0
161 #endif
162
163 #ifndef U_RELEASE
164 #define U_RELEASE 1
165 #endif
166
167 /* Determine whether to disable renaming or not. This overrides the
168 setting in umachine.h which is for all platforms. */
169 #ifndef U_DISABLE_RENAMING
170 #define U_DISABLE_RENAMING 1
171 #endif
172
173 /* Determine whether to override new and delete. */
174 #ifndef U_OVERRIDE_CXX_ALLOCATION
175 #define U_OVERRIDE_CXX_ALLOCATION 1
176 #endif
177 /* Determine whether to override placement new and delete for STL. */
178 #ifndef U_HAVE_PLACEMENT_NEW
179 #define U_HAVE_PLACEMENT_NEW 1
180 #endif
181
182 /* Determine whether to enable tracing. */
183 #ifndef U_ENABLE_TRACING
184 #define U_ENABLE_TRACING 1
185 #endif
186
187 /**
188 * Whether to enable Dynamic loading in ICU
189 * @internal
190 */
191 #ifndef U_ENABLE_DYLOAD
192 #define U_ENABLE_DYLOAD 1
193 #endif
194
195 /**
196 * Whether to test Dynamic loading as an OS capabilty
197 * @internal
198 */
199 #ifndef U_CHECK_DYLOAD
200 #define U_CHECK_DYLOAD 1
201 #endif
202
203
204 /** Do we allow ICU users to use the draft APIs by default? */
205 #ifndef U_DEFAULT_SHOW_DRAFT
206 #define U_DEFAULT_SHOW_DRAFT 1
207 #endif
208
209 /** @} */
210
211 /*===========================================================================*/
212 /** @{ Character data types */
213 /*===========================================================================*/
214
215 #if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400)
216 # define U_CHARSET_FAMILY 1
217 #endif
218
219 /** @} */
220
221 /*===========================================================================*/
222 /** @{ Information about wchar support */
223 /*===========================================================================*/
224
225 #ifndef U_HAVE_WCHAR_H
226 #define U_HAVE_WCHAR_H 1
227 #endif
228
229 #ifndef U_SIZEOF_WCHAR_T
230 #define U_SIZEOF_WCHAR_T 4
231 #endif
232
233 #ifndef U_HAVE_WCSCPY
234 #define U_HAVE_WCSCPY 1
235 #endif
236
237 /** @} */
238
239 /**
240 * @{
241 * \def U_DECLARE_UTF16
242 * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros
243 * instead.
244 * @internal
245 *
246 * \def U_GNUC_UTF16_STRING
247 * @internal
248 */
249 #ifndef U_GNUC_UTF16_STRING
250 #define U_GNUC_UTF16_STRING 0
251 #endif
252 #if 1 || defined(U_CHECK_UTF16_STRING)
253 #if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \
254 || (defined(__HP_aCC) && __HP_aCC >= 035000) \
255 || (defined(__HP_cc) && __HP_cc >= 111106) \
256 || U_GNUC_UTF16_STRING
257 #define U_DECLARE_UTF16(string) u ## string
258 #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550)
259 /* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */
260 /* Sun's C compiler has issues with this notation, and it's unreliable. */
261 #define U_DECLARE_UTF16(string) U ## string
262 #elif U_SIZEOF_WCHAR_T == 2 \
263 && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__)))
264 #define U_DECLARE_UTF16(string) L ## string
265 #endif
266 #endif
267
268 /** @} */
269
270 /*===========================================================================*/
271 /** @{ Information about POSIX support */
272 /*===========================================================================*/
273
274 #ifndef U_HAVE_NL_LANGINFO_CODESET
275 #define U_HAVE_NL_LANGINFO_CODESET 1
276 #endif
277
278 #ifndef U_NL_LANGINFO_CODESET
279 #define U_NL_LANGINFO_CODESET CODESET
280 #endif
281
282 #if 1
283 #define U_TZSET tzset
284 #endif
285 #if 0
286 #define U_TIMEZONE timezone
287 #endif
288 #if 1
289 #define U_TZNAME tzname
290 #endif
291
292 #define U_HAVE_MMAP 1
293 #define U_HAVE_POPEN 1
294
295 /** @} */
296
297 /*===========================================================================*/
298 /** @{ Symbol import-export control */
299 /*===========================================================================*/
300
301 #if 1
302 #define U_EXPORT __attribute__((visibility("default")))
303 #elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \
304 || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550)
305 #define U_EXPORT __global
306 /*#elif defined(__HP_aCC) || defined(__HP_cc)
307 #define U_EXPORT __declspec(dllexport)*/
308 #else
309 #define U_EXPORT
310 #endif
311
312 /* U_CALLCONV is releated to U_EXPORT2 */
313 #define U_EXPORT2
314
315 /* cygwin needs to export/import data */
316 #if defined(U_CYGWIN) && !defined(__GNUC__)
317 #define U_IMPORT __declspec(dllimport)
318 #else
319 #define U_IMPORT
320 #endif
321
322 /* @} */
323
324 /*===========================================================================*/
325 /** @{ Code alignment and C function inlining */
326 /*===========================================================================*/
327
328 #ifndef U_INLINE
329 # ifdef __cplusplus
330 # define U_INLINE inline
331 # else
332 # define U_INLINE __inline__
333 # endif
334 #endif
335
336 #ifndef U_ALIGN_CODE
337 #define U_ALIGN_CODE(n)
338 #endif
339
340 /** @} */
341
342 /*===========================================================================*/
343 /** @{ GCC built in functions for atomic memory operations */
344 /*===========================================================================*/
345
346 /**
347 * \def U_HAVE_GCC_ATOMICS
348 * @internal
349 */
350 #ifndef U_HAVE_GCC_ATOMICS
351 #define U_HAVE_GCC_ATOMICS 1
352 #endif
353
354 /** @} */
355
356 /*===========================================================================*/
357 /** @{ Programs used by ICU code */
358 /*===========================================================================*/
359
360 /**
361 * \def U_MAKE
362 * What program to execute to run 'make'
363 */
364 #ifndef U_MAKE
365 #define U_MAKE "/usr/bin/gnumake"
366 #endif
367
368 /** @} */
369
370 #endif /* CYGWINMSVC */
371
372 /*===========================================================================*/
373 /* Custom icu entry point renaming */
374 /*===========================================================================*/
375
376 /**
377 * Define the library suffix with C syntax.
378 * @internal
379 */
380 # define U_LIB_SUFFIX_C_NAME
381 /**
382 * Define the library suffix as a string with C syntax
383 * @internal
384 */
385 # define U_LIB_SUFFIX_C_NAME_STRING ""
386 /**
387 * 1 if a custom library suffix is set
388 * @internal
389 */
390 # define U_HAVE_LIB_SUFFIX 0
391
392 #if U_HAVE_LIB_SUFFIX
393 # ifndef U_ICU_ENTRY_POINT_RENAME
394 /* Renaming pattern: u_strcpy_41_suffix */
395 # define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## 46 ##
396 # define U_DEF_ICUDATA_ENTRY_POINT(major, minor) icudt####major##minor##_dat
397
398 # endif
399 #endif
400
401 #endif