1/* 2 ****************************************************************************** 3 * 4 * Copyright (C) 1997-2010, 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 /** 20 * \file 21 * \brief Configuration constants for the Windows platform 22 */ 23 24/** Define the platform we're on. */ 25#ifndef U_WINDOWS 26#define U_WINDOWS 27#endif 28 29#if _MSC_VER >= 1600 30#include <stdint.h> 31#endif 32 33#if defined(__BORLANDC__) 34#define U_HAVE_PLACEMENT_NEW 0 35#define __STDC_CONSTANT_MACROS 36#endif 37 38/** _MSC_VER is used to detect the Microsoft compiler. */ 39#if defined(_MSC_VER) 40#define U_INT64_IS_LONG_LONG 0 41#else 42#define U_INT64_IS_LONG_LONG 1 43#endif 44 45/** Define whether inttypes.h is available */ 46#ifndef U_HAVE_INTTYPES_H 47# if defined(__BORLANDC__) || defined(__MINGW32__) 48# define U_HAVE_INTTYPES_H 1 49# else 50# define U_HAVE_INTTYPES_H 0 51# endif 52#endif 53 54/** 55 * Define what support for C++ streams is available. 56 * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available 57 * (1997711 is the date the ISO/IEC C++ FDIS was published), and then 58 * one should qualify streams using the std namespace in ICU header 59 * files. 60 * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is 61 * available instead (198506 is the date when Stroustrup published 62 * "An Extensible I/O Facility for C++" at the summer USENIX conference). 63 * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and 64 * support for them will be silently suppressed in ICU. 65 * 66 */ 67 68#ifndef U_IOSTREAM_SOURCE 69#define U_IOSTREAM_SOURCE 199711 70#endif 71 72/** @{ 73 * Determines whether specific types are available */ 74#ifndef U_HAVE_INT8_T 75#define U_HAVE_INT8_T U_HAVE_INTTYPES_H 76#endif 77 78#ifndef U_HAVE_UINT8_T 79#define U_HAVE_UINT8_T U_HAVE_INTTYPES_H 80#endif 81 82#ifndef U_HAVE_INT16_T 83#define U_HAVE_INT16_T U_HAVE_INTTYPES_H 84#endif 85 86#ifndef U_HAVE_UINT16_T 87#define U_HAVE_UINT16_T U_HAVE_INTTYPES_H 88#endif 89 90#ifndef U_HAVE_INT32_T 91#define U_HAVE_INT32_T U_HAVE_INTTYPES_H 92#endif 93 94#ifndef U_HAVE_UINT32_T 95#define U_HAVE_UINT32_T U_HAVE_INTTYPES_H 96#endif 97 98#ifndef U_HAVE_INT64_T 99#define U_HAVE_INT64_T U_HAVE_INTTYPES_H 100#endif 101 102#ifndef U_HAVE_UINT64_T 103#define U_HAVE_UINT64_T U_HAVE_INTTYPES_H 104#endif 105 106/** @} */ 107 108/** Define 64 bit limits */ 109#if !U_INT64_IS_LONG_LONG 110# ifndef INT64_C 111# define INT64_C(x) ((int64_t)x) 112# endif 113# ifndef UINT64_C 114# define UINT64_C(x) ((uint64_t)x) 115# endif 116/** else use the umachine.h definition */ 117#endif 118 119/*===========================================================================*/ 120/** @{ 121 * Generic data types */ 122/*===========================================================================*/ 123 124/** If your platform does not have the <inttypes.h> header, you may 125 need to edit the typedefs below. */ 126#if U_HAVE_INTTYPES_H 127#include <inttypes.h> 128#else /* U_HAVE_INTTYPES_H */ 129 130#if ! U_HAVE_INT8_T 131typedef signed char int8_t; 132#endif 133 134#if ! U_HAVE_UINT8_T 135typedef unsigned char uint8_t; 136#endif 137 138#if ! U_HAVE_INT16_T 139typedef signed short int16_t; 140#endif 141 142#if ! U_HAVE_UINT16_T 143typedef unsigned short uint16_t; 144#endif 145 146#if ! U_HAVE_INT32_T 147typedef signed int int32_t; 148#endif 149 150#if ! U_HAVE_UINT32_T 151typedef unsigned int uint32_t; 152#endif 153 154#if ! U_HAVE_INT64_T 155#if U_INT64_IS_LONG_LONG 156 typedef signed long long int64_t; 157#else 158 typedef signed __int64 int64_t; 159#endif 160#endif 161 162#if ! U_HAVE_UINT64_T 163#if U_INT64_IS_LONG_LONG 164 typedef unsigned long long uint64_t; 165#else 166 typedef unsigned __int64 uint64_t; 167#endif 168#endif 169#endif 170 171/** 172 * @} 173 */ 174 175/*===========================================================================*/ 176/** Compiler and environment features */ 177/*===========================================================================*/ 178 179/** Define whether namespace is supported */ 180#ifndef U_HAVE_NAMESPACE 181#define U_HAVE_NAMESPACE 1 182#endif 183 184/** Determines the endianness of the platform */ 185#define U_IS_BIG_ENDIAN 0 186 187/** 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ 188#ifndef ICU_USE_THREADS 189#define ICU_USE_THREADS 1 190#endif 191 192/** 0 or 1 to enable or disable auto cleanup of libraries. If undefined, default is: disabled. */ 193#ifndef UCLN_NO_AUTO_CLEANUP 194#define UCLN_NO_AUTO_CLEANUP 1 195#endif 196 197/* On strong memory model CPUs (e.g. x86 CPUs), we use a safe & quick double check mutex lock. */ 198/** 199Microsoft can define _M_IX86, _M_AMD64 (before Visual Studio 8) or _M_X64 (starting in Visual Studio 8). 200Intel can define _M_IX86 or _M_X64 201*/ 202#if defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) || (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))) 203#define UMTX_STRONG_MEMORY_MODEL 1 204#endif 205 206/** Enable or disable debugging options **/ 207#ifndef U_DEBUG 208#ifdef _DEBUG 209#define U_DEBUG 1 210#else 211#define U_DEBUG 0 212#endif 213#endif 214 215/** Enable or disable release options **/ 216#ifndef U_RELEASE 217#ifdef NDEBUG 218#define U_RELEASE 1 219#else 220#define U_RELEASE 0 221#endif 222#endif 223 224/** Determine whether to disable renaming or not. This overrides the 225 setting in umachine.h which is for all platforms. */ 226#ifndef U_DISABLE_RENAMING 227#define U_DISABLE_RENAMING 0 228#endif 229 230/** Determine whether to override new and delete. */ 231#ifndef U_OVERRIDE_CXX_ALLOCATION 232#define U_OVERRIDE_CXX_ALLOCATION 1 233#endif 234/** Determine whether to override placement new and delete for STL. */ 235#ifndef U_HAVE_PLACEMENT_NEW 236#define U_HAVE_PLACEMENT_NEW 1 237#endif 238/** Determine whether to override new and delete for MFC. */ 239#if !defined(U_HAVE_DEBUG_LOCATION_NEW) && defined(_MSC_VER) 240#define U_HAVE_DEBUG_LOCATION_NEW 1 241#endif 242 243/** Determine whether to enable tracing. */ 244#ifndef U_ENABLE_TRACING 245#define U_ENABLE_TRACING 0 246#endif 247 248/** Do we allow ICU users to use the draft APIs by default? */ 249#ifndef U_DEFAULT_SHOW_DRAFT 250#define U_DEFAULT_SHOW_DRAFT 1 251#endif 252 253/** @{ Define the library suffix in a C syntax. */ 254#ifndef U_HAVE_LIB_SUFFIX 255#define U_HAVE_LIB_SUFFIX 0 256#endif 257#ifndef U_LIB_SUFFIX_C_NAME 258#define U_LIB_SUFFIX_C_NAME 259#endif 260#ifndef U_LIB_SUFFIX_C_NAME_STRING 261#define U_LIB_SUFFIX_C_NAME_STRING "" 262#endif 263/** @} */ 264 265/*===========================================================================*/ 266/** @{ Information about wchar support */ 267/*===========================================================================*/ 268 269#define U_HAVE_WCHAR_H 1 270#define U_SIZEOF_WCHAR_T 2 271 272#define U_HAVE_WCSCPY 1 273 274/** @} */ 275 276/** 277 * \def U_DECLARE_UTF16 278 * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros 279 * instead. 280 * @internal 281 */ 282#if 1 283#define U_DECLARE_UTF16(string) L ## string 284#endif 285 286/*===========================================================================*/ 287/** @{ Information about POSIX support */ 288/*===========================================================================*/ 289 290/** 291 * @internal 292 */ 293#if 1 294#define U_TZSET _tzset 295#endif 296/** 297 * @internal 298 */ 299#if 1 300#define U_TIMEZONE _timezone 301#endif 302/** 303 * @internal 304 */ 305#if 1 306#define U_TZNAME _tzname 307#endif 308/** 309 * @internal 310 */ 311#if 1 312#define U_DAYLIGHT _daylight 313#endif 314 315#define U_HAVE_MMAP 0 316#define U_HAVE_POPEN 0 317 318#ifndef U_ENABLE_DYLOAD 319#define U_ENABLE_DYLOAD 1 320#endif 321 322 323/** @} */ 324 325/*===========================================================================*/ 326/** @{ Symbol import-export control */ 327/*===========================================================================*/ 328 329#ifdef U_STATIC_IMPLEMENTATION 330#define U_EXPORT 331#else 332#define U_EXPORT __declspec(dllexport) 333#endif 334#define U_EXPORT2 __cdecl 335#define U_IMPORT __declspec(dllimport) 336/** @} */ 337 338/*===========================================================================*/ 339/** @{ Code alignment and C function inlining */ 340/*===========================================================================*/ 341 342#ifndef U_INLINE 343# ifdef __cplusplus 344# define U_INLINE inline 345# else 346# define U_INLINE __inline 347# endif 348#endif 349 350#if defined(_MSC_VER) && defined(_M_IX86) && !defined(_MANAGED) 351#define U_ALIGN_CODE(val) __asm align val 352#else 353#define U_ALIGN_CODE(val) 354#endif 355 356/** 357 * Flag for workaround of MSVC 2003 optimization bugs 358 */ 359#if defined(_MSC_VER) && (_MSC_VER < 1400) 360#define U_HAVE_MSVC_2003_OR_EARLIER 361#endif 362 363 364/** @} */ 365 366/*===========================================================================*/ 367/** @{ Programs used by ICU code */ 368/*===========================================================================*/ 369 370#ifndef U_MAKE 371#define U_MAKE "nmake" 372#define U_MAKE_IS_NMAKE 1 373#endif 374 375/** @} */ 376 377