From: Markus Scherer Date: Sat, 23 Jul 2011 00:10:30 +0000 (+0000) Subject: ICU-8452 un-autoconf platform.h, move user-configurable settings to uconfig.h, and... X-Git-Tag: milestone-59-0-1~4629 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9bcc40cf9e62647666242506135dadf55d2c83b9;p=icu ICU-8452 un-autoconf platform.h, move user-configurable settings to uconfig.h, and other changes; from svn merge --reintegrate branches/markus/platformh at r30411 X-SVN-Rev: 30412 --- diff --git a/icu4c/readme.html b/icu4c/readme.html index b75aa9a30f5..5fa13f0a5a3 100644 --- a/icu4c/readme.html +++ b/icu4c/readme.html @@ -43,6 +43,8 @@ +

User-Configurable Settings

+

ICU4C can be customized via a number of user-configurable settings. + Many of them are controlled by preprocessor macros which are + defined in the source/common/unicode/uconfig.h header file. + Some turn off parts of ICU, for example conversion or collation, + trading off a smaller library for reduced functionality. + Other settings are recommended (see previous section) + but their default values are set for better source code compatibility.

+ +

In order to change such user-configurable settings, you can + either modify the uconfig.h header file by adding + a specific #define ... for one or more of the macros + before they are first tested, + or set the compiler's preprocessor flags (CPPFLAGS) to include + an equivalent -D macro definition.

+

How To Build And Install On Windows

diff --git a/icu4c/source/common/Makefile.in b/icu4c/source/common/Makefile.in index 9e8d81facbd..36774e2e6f0 100644 --- a/icu4c/source/common/Makefile.in +++ b/icu4c/source/common/Makefile.in @@ -57,12 +57,9 @@ DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(srcdir) $(LIBCPPFLAGS) $(CPPFLAGSICUUC) -# we want DEFS here, because we want icucfg.h -DEFS += -DU_COMMON_IMPLEMENTATION -DU_HAVE_ICUCFG +# we want DEFS here +DEFS += -DU_COMMON_IMPLEMENTATION LDFLAGS += $(LDFLAGSICUUC) # for plugin configuration @@ -132,7 +129,7 @@ distclean : distclean-local dist: dist-local check: all check-local -all-local: $(ALL_TARGETS) unicode/platform.h +all-local: $(ALL_TARGETS) install-local: install-headers install-library @@ -182,7 +179,7 @@ clean-local: $(RMV) $(OBJECTS) $(STATIC_OBJECTS) $(ALL_TARGETS) $(SO_VERSION_DATA) distclean-local: clean-local - $(RMV) Makefile icucfg.h unicode/platform.h $(SVC_HOOK_INC) + $(RMV) Makefile icucfg.h $(SVC_HOOK_INC) check-local: @@ -190,10 +187,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(SVC_HOOK_INC) cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -unicode/platform.h: $(srcdir)/unicode/platform.h.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status - ifneq ($(ENABLE_STATIC),) $(TARGET): $(STATIC_OBJECTS) $(AR) $(ARFLAGS) $(AR_OUTOPT)$@ $^ diff --git a/icu4c/source/common/charstr.h b/icu4c/source/common/charstr.h index 2eb87a0791f..da391e245d0 100644 --- a/icu4c/source/common/charstr.h +++ b/icu4c/source/common/charstr.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2001-2010, International Business Machines +* Copyright (c) 2001-2011, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -21,7 +21,7 @@ U_NAMESPACE_BEGIN // Windows needs us to DLL-export the MaybeStackArray template specialization, // but MacOS X cannot handle it. Same as in digitlst.h. -#if !defined(U_DARWIN) +#if !U_PLATFORM_IS_DARWIN_BASED template class U_COMMON_API MaybeStackArray; #endif diff --git a/icu4c/source/common/cmemory.h b/icu4c/source/common/cmemory.h index 68daccaf35b..b6bc172e9cc 100644 --- a/icu4c/source/common/cmemory.h +++ b/icu4c/source/common/cmemory.h @@ -107,7 +107,7 @@ typedef void U_CALLCONV UObjectDeleter(void* obj); U_CAPI void U_EXPORT2 uprv_deleteUObject(void *obj); -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus U_NAMESPACE_BEGIN @@ -549,5 +549,5 @@ inline H *MaybeStackHeaderAndArray::orphanOrClone(int32_t l U_NAMESPACE_END -#endif /* XP_CPLUSPLUS */ +#endif /* __cplusplus */ #endif /* CMEMORY_H */ diff --git a/icu4c/source/common/common.vcxproj b/icu4c/source/common/common.vcxproj index 5c8edc9b6e8..ec679931911 100644 --- a/icu4c/source/common/common.vcxproj +++ b/icu4c/source/common/common.vcxproj @@ -625,7 +625,7 @@ - + copy "%(FullPath)" ..\..\include\unicode ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) @@ -639,8 +639,21 @@ ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) - - + + copy "%(FullPath)" ..\..\include\unicode + + ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) + copy "%(FullPath)" ..\..\include\unicode + + ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) + copy "%(FullPath)" ..\..\include\unicode + + ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) + copy "%(FullPath)" ..\..\include\unicode + + ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) + + copy "%(FullPath)" ..\..\include\unicode ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) @@ -654,6 +667,7 @@ ..\..\include\unicode\%(Filename)%(Extension);%(Outputs) + copy "%(FullPath)" ..\..\include\unicode @@ -1737,23 +1751,6 @@ false - - - Document - copy "%(FullPath)" unicode\%(FileName).h -copy "%(FullPath)" ..\..\include\unicode\%(FileName).h - unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs) - copy "%(FullPath)" unicode\%(FileName).h -copy "%(FullPath)" ..\..\include\unicode\%(FileName).h - unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs) - copy "%(FullPath)" unicode\%(FileName).h -copy "%(FullPath)" ..\..\include\unicode\%(FileName).h - unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs) - copy "%(FullPath)" unicode\%(FileName).h -copy "%(FullPath)" ..\..\include\unicode\%(FileName).h - unicode\%(Filename).h;..\..\include\unicode\%(Filename).h;%(Outputs) - - diff --git a/icu4c/source/common/common.vcxproj.filters b/icu4c/source/common/common.vcxproj.filters index 26f1c694516..1e4ae39601f 100644 --- a/icu4c/source/common/common.vcxproj.filters +++ b/icu4c/source/common/common.vcxproj.filters @@ -817,13 +817,13 @@ configuration - + configuration - + configuration - + configuration diff --git a/icu4c/source/common/cstring.h b/icu4c/source/common/cstring.h index 6d2fd0e8159..26528e59875 100644 --- a/icu4c/source/common/cstring.h +++ b/icu4c/source/common/cstring.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1997-2005, International Business Machines +* Copyright (C) 1997-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -62,7 +62,7 @@ uprv_ebcdictolower(char c); #define uprv_strtod(source, end) U_STANDARD_CPP_NAMESPACE strtod(source, end) #define uprv_strtoul(str, end, base) U_STANDARD_CPP_NAMESPACE strtoul(str, end, base) #define uprv_strtol(str, end, base) U_STANDARD_CPP_NAMESPACE strtol(str, end, base) -#ifdef U_WINDOWS +#if U_PLATFORM_USES_ONLY_WIN32_API # if defined(__BORLANDC__) # define uprv_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE stricmp(str1, str2) # define uprv_strnicmp(str1, str2, n) U_STANDARD_CPP_NAMESPACE strnicmp(str1, str2, n) diff --git a/icu4c/source/common/locmap.c b/icu4c/source/common/locmap.c index dc06318ca3d..ebf38aefae9 100644 --- a/icu4c/source/common/locmap.c +++ b/icu4c/source/common/locmap.c @@ -30,7 +30,15 @@ #include "cstring.h" #include "cmemory.h" -#if defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1500) +#if U_PLATFORM == U_PF_WINDOWS && defined(_MSC_VER) && (_MSC_VER >= 1500) +/* + * TODO: It seems like we should widen this to + * either U_PLATFORM_USES_ONLY_WIN32_API (includes MinGW) + * or U_PLATFORM_HAS_WIN32_API (includes MinGW and Cygwin) + * but those use gcc and won't have defined(_MSC_VER). + * We might need to #include some Windows header and test for some version macro from there. + * Or call some Windows function and see what it returns. + */ #define USE_WINDOWS_LOCALE_API #endif diff --git a/icu4c/source/common/putil.cpp b/icu4c/source/common/putil.cpp index a321fd45f7c..10eeb0b89d7 100644 --- a/icu4c/source/common/putil.cpp +++ b/icu4c/source/common/putil.cpp @@ -77,7 +77,12 @@ Cleanly installed Solaris can use this #define. #include /* include system headers */ -#if defined(U_WINDOWS) || defined(U_MINGW) +#if U_PLATFORM_USES_ONLY_WIN32_API + /* + * TODO: U_PLATFORM_USES_ONLY_WIN32_API includes MinGW. + * Should Cygwin be included as well (U_PLATFORM_HAS_WIN32_API) + * to use native APIs as much as possible? + */ # define WIN32_LEAN_AND_MEAN # define VC_EXTRALEAN # define NOUSER @@ -86,13 +91,13 @@ Cleanly installed Solaris can use this #define. # define NOMCX # include # include "wintz.h" -#elif defined(OS400) +#elif U_PLATFORM == U_PF_OS400 # include # include /* error code structure */ # include # include /* EPT_CALL macro - this include must be after all other "QSYSINCs" */ # include /* For uprv_maximumPtr */ -#elif defined(XP_MAC) +#elif U_PLATFORM == U_PF_CLASSIC_MACOS # include # include # include @@ -100,20 +105,20 @@ Cleanly installed Solaris can use this #define. # include # include # define ICU_NO_USER_DATA_OVERRIDE 1 -#elif defined(OS390) +#elif U_PLATFORM == U_PF_OS390 # include "unicode/ucnv.h" /* Needed for UCNV_SWAP_LFNL_OPTION_STRING */ -#elif defined(U_DARWIN) || defined(U_LINUX) || defined(U_BSD) +#elif U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED || U_PLATFORM == U_PF_BSD # include # include -#elif defined(U_QNX) +#elif U_PLATFORM == U_PF_QNX # include -#elif defined(U_SOLARIS) +#elif U_PLATFORM == U_PF_SOLARIS # ifndef _XPG4_2 # define _XPG4_2 # endif #endif -#if (defined(U_CYGWIN) || defined(U_MINGW)) && defined(__STRICT_ANSI__) +#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__) /* tzset isn't defined in strict ANSI on Cygwin and MinGW. */ #undef __STRICT_ANSI__ #endif @@ -123,11 +128,7 @@ Cleanly installed Solaris can use this #define. */ #include -#if defined(U_DARWIN) -#include -#endif - -#ifndef U_WINDOWS +#if !U_PLATFORM_USES_ONLY_WIN32_API #include #endif @@ -146,7 +147,15 @@ Cleanly installed Solaris can use this #define. * icucfg.h via autoheader. */ #if defined(U_HAVE_ICUCFG) -#include "icucfg.h" +# include "icucfg.h" +#elif U_PLATFORM_IMPLEMENTS_POSIX +# define HAVE_DLFCN_H 1 +# define HAVE_DLOPEN 1 +# define HAVE_GETTIMEOFDAY 1 +#else +# undef HAVE_DLFCN_H +# undef HAVE_DLOPEN +# undef HAVE_GETTIMEOFDAY #endif #define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0])) @@ -178,7 +187,7 @@ static const BitPatternConversion gInf = { (int64_t) INT64_C(0x7FF0000000000000) functions). ---------------------------------------------------------------------------*/ -#if defined(U_WINDOWS) || defined(XP_MAC) || defined(OS400) || defined(U_MINGW) +#if U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_CLASSIC_MACOS || U_PLATFORM == U_PF_OS400 # undef U_POSIX_LOCALE #else # define U_POSIX_LOCALE 1 @@ -264,7 +273,7 @@ static UDate getUTCtime_fake() { } #endif -#if defined(U_WINDOWS) +#if U_PLATFORM_USES_ONLY_WIN32_API typedef union { int64_t int64; FILETIME fileTime; @@ -297,7 +306,7 @@ uprv_getUTCtime() U_CAPI UDate U_EXPORT2 uprv_getRawUTCtime() { -#if defined(XP_MAC) +#if U_PLATFORM == U_PF_CLASSIC_MACOS time_t t, t1, t2; struct tm tmrec; @@ -311,7 +320,7 @@ uprv_getRawUTCtime() uprv_memcpy( &tmrec, gmtime(&t), sizeof(tmrec) ); t2 = mktime(&tmrec); /* seconds of current GMT*/ return (UDate)(t2 - t1) * U_MILLIS_PER_SECOND; /* GMT (or UTC) in seconds since 1970*/ -#elif defined(U_WINDOWS) +#elif U_PLATFORM_USES_ONLY_WIN32_API FileTimeConversion winTime; GetSystemTimeAsFileTime(&winTime.fileTime); @@ -350,7 +359,7 @@ uprv_isNaN(double number) /* Infinity is 0x7FF0000000000000U. Anything greater than that is a NaN */ return (UBool)((convertedNumber.i64 & U_INT64_MAX) > gInf.i64); -#elif defined(OS390) +#elif U_PLATFORM == U_PF_OS390 uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number, sizeof(uint32_t)); uint32_t lowBits = *(uint32_t*)u_bottomNBytesOfDouble(&number, @@ -375,7 +384,7 @@ uprv_isInfinite(double number) convertedNumber.d64 = number; /* Infinity is exactly 0x7FF0000000000000U. */ return (UBool)((convertedNumber.i64 & U_INT64_MAX) == gInf.i64); -#elif defined(OS390) +#elif U_PLATFORM == U_PF_OS390 uint32_t highBits = *(uint32_t*)u_topNBytesOfDouble(&number, sizeof(uint32_t)); uint32_t lowBits = *(uint32_t*)u_bottomNBytesOfDouble(&number, @@ -394,7 +403,7 @@ uprv_isInfinite(double number) U_CAPI UBool U_EXPORT2 uprv_isPositiveInfinity(double number) { -#if IEEE_754 || defined(OS390) +#if IEEE_754 || U_PLATFORM == U_PF_OS390 return (UBool)(number > 0 && uprv_isInfinite(number)); #else return uprv_isInfinite(number); @@ -404,7 +413,7 @@ uprv_isPositiveInfinity(double number) U_CAPI UBool U_EXPORT2 uprv_isNegativeInfinity(double number) { -#if IEEE_754 || defined(OS390) +#if IEEE_754 || U_PLATFORM == U_PF_OS390 return (UBool)(number < 0 && uprv_isInfinite(number)); #else @@ -418,7 +427,7 @@ uprv_isNegativeInfinity(double number) U_CAPI double U_EXPORT2 uprv_getNaN() { -#if IEEE_754 || defined(OS390) +#if IEEE_754 || U_PLATFORM == U_PF_OS390 return gNan.d64; #else /* If your platform doesn't support IEEE 754 but *does* have an NaN value,*/ @@ -431,7 +440,7 @@ uprv_getNaN() U_CAPI double U_EXPORT2 uprv_getInfinity() { -#if IEEE_754 || defined(OS390) +#if IEEE_754 || U_PLATFORM == U_PF_OS390 return gInf.d64; #else /* If your platform doesn't support IEEE 754 but *does* have an infinity*/ @@ -573,7 +582,7 @@ uprv_log(double d) U_CAPI void * U_EXPORT2 uprv_maximumPtr(void * base) { -#if defined(OS400) +#if U_PLATFORM == U_PF_OS400 /* * With the provided function we should never be out of range of a given segment * (a traditional/typical segment that is). Our segments have 5 bytes for the @@ -651,15 +660,15 @@ uprv_timezone() /* Note that U_TZNAME does *not* have to be tzname, but if it is, some platforms need to have it declared here. */ -#if defined(U_TZNAME) && (defined(U_IRIX) || defined(U_DARWIN) || defined(U_CYGWIN)) +#if defined(U_TZNAME) && (U_PLATFORM == U_PF_IRIX || U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM == U_PF_CYGWIN) /* RS6000 and others reject char **tzname. */ extern U_IMPORT char *U_TZNAME[]; #endif -#if !UCONFIG_NO_FILE_IO && (defined(U_DARWIN) || defined(U_LINUX) || defined(U_BSD)) +#if !UCONFIG_NO_FILE_IO && (U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED || U_PLATFORM == U_PF_BSD) /* These platforms are likely to use Olson timezone IDs. */ #define CHECK_LOCALTIME_LINK 1 -#if defined(U_DARWIN) +#if U_PLATFORM_IS_DARWIN_BASED #include #define TZZONEINFO (TZDIR "/") #else @@ -679,7 +688,7 @@ static char gTimeZoneBuffer[PATH_MAX]; static char *gTimeZoneBufferPtr = NULL; #endif -#ifndef U_WINDOWS +#if !U_PLATFORM_USES_ONLY_WIN32_API #define isNonDigit(ch) (ch < '0' || '9' < ch) static UBool isValidOlsonID(const char *id) { int32_t idx = 0; @@ -722,7 +731,7 @@ static void skipZoneIDPrefix(const char** id) { } #endif -#if defined(U_TZNAME) && !defined(U_WINDOWS) +#if defined(U_TZNAME) && !U_PLATFORM_USES_ONLY_WIN32_API #define CONVERT_HOURS_TO_SECONDS(offset) (int32_t)(offset*3600) typedef struct OffsetZoneMapping { @@ -969,7 +978,7 @@ U_CAPI const char* U_EXPORT2 uprv_tzname(int n) { const char *tzid = NULL; -#ifdef U_WINDOWS +#if U_PLATFORM_USES_ONLY_WIN32_API tzid = uprv_detectWindowsTimeZone(); if (tzid != NULL) { @@ -977,7 +986,7 @@ uprv_tzname(int n) } #else -/*#if defined(U_DARWIN) +/*#if U_PLATFORM_IS_DARWIN_BASED int ret; tzid = getenv("TZFILE"); @@ -1050,7 +1059,7 @@ uprv_tzname(int n) #endif #ifdef U_TZNAME -#if defined(U_WINDOWS) || defined(U_MINGW) +#if U_PLATFORM_USES_ONLY_WIN32_API /* The return value is free'd in timezone.cpp on Windows because * the other code path returns a pointer to a heap location. */ return uprv_strdup(U_TZNAME[n]); @@ -1169,7 +1178,7 @@ uprv_pathIsAbsolute(const char *path) } #endif -#if defined(U_WINDOWS) +#if U_PLATFORM_USES_ONLY_WIN32_API if( (((path[0] >= 'A') && (path[0] <= 'Z')) || ((path[0] >= 'a') && (path[0] <= 'z'))) && path[1] == ':' ) { @@ -1182,7 +1191,7 @@ uprv_pathIsAbsolute(const char *path) /* Temporary backup setting of ICU_DATA_DIR_PREFIX_ENV_VAR until some client wrapper makefiles are updated */ -#if defined(U_DARWIN) && TARGET_IPHONE_SIMULATOR +#if U_PLATFORM_IS_DARWIN_BASED && TARGET_IPHONE_SIMULATOR # if !defined(ICU_DATA_DIR_PREFIX_ENV_VAR) # define ICU_DATA_DIR_PREFIX_ENV_VAR "IPHONE_SIMULATOR_ROOT" # endif @@ -1260,7 +1269,7 @@ u_getDataDirectory(void) { /* Macintosh-specific locale information ------------------------------------ */ -#ifdef XP_MAC +#if U_PLATFORM == U_PF_CLASSIC_MACOS typedef struct { int32_t script; @@ -1570,7 +1579,7 @@ The leftmost codepage (.xxx) wins. return posixID; -#elif defined(U_WINDOWS) || defined(U_MINGW) +#elif U_PLATFORM_USES_ONLY_WIN32_API UErrorCode status = U_ZERO_ERROR; LCID id = GetThreadLocale(); const char* locID = uprv_convertToPosix(id, &status); @@ -1580,7 +1589,7 @@ The leftmost codepage (.xxx) wins. } return locID; -#elif defined(XP_MAC) +#elif U_PLATFORM == U_PF_CLASSIC_MACOS int32_t script = MAC_LC_INIT_NUMBER; /* = IntlScript(); or GetScriptManagerVariable(smSysScript);*/ int32_t region = MAC_LC_INIT_NUMBER; @@ -1615,7 +1624,7 @@ The leftmost codepage (.xxx) wins. return posixID; -#elif defined(OS400) +#elif U_PLATFORM == U_PF_OS400 /* locales are process scoped and are by definition thread safe */ static char correctedLocale[64]; const char *localeID = getenv("LC_ALL"); @@ -1728,7 +1737,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { if (name == NULL) { return NULL; } -#if defined(U_AIX) +#if U_PLATFORM == U_PF_AIX if (uprv_strcmp(name, "IBM-943") == 0) { /* Use the ASCII compatible ibm-943 */ name = "Shift-JIS"; @@ -1737,7 +1746,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { /* Use the windows-1252 that contains the Euro */ name = "IBM-5348"; } -#elif defined(U_SOLARIS) +#elif U_PLATFORM == U_PF_SOLARIS if (locale != NULL && uprv_strcmp(name, "EUC") == 0) { /* Solaris underspecifies the "EUC" name. */ if (uprv_strcmp(locale, "zh_CN") == 0) { @@ -1764,7 +1773,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { */ name = "ISO-8859-1"; } -#elif defined(U_DARWIN) +#elif U_PLATFORM_IS_DARWIN_BASED if (locale == NULL && *name == 0) { /* No locale was specified, and an empty name was passed in. @@ -1783,12 +1792,12 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { */ name = "UTF-8"; } -#elif defined(U_BSD) +#elif U_PLATFORM == U_PF_BSD if (uprv_strcmp(name, "CP949") == 0) { /* Remap CP949 to a similar codepage to avoid issues with backslash and won symbol. */ name = "EUC-KR"; } -#elif defined(U_HPUX) +#elif U_PLATFORM == U_PF_HPUX if (locale != NULL && uprv_strcmp(locale, "zh_HK") == 0 && uprv_strcmp(name, "big5") == 0) { /* HP decided to extend big5 as hkbig5 even though it's not compatible :-( */ /* zh_TW.big5 is not the same charset as zh_HK.big5! */ @@ -1802,7 +1811,7 @@ remapPlatformDependentCodepage(const char *locale, const char *name) { */ name = "eucjis"; } -#elif defined(U_LINUX) +#elif U_PLATFORM == U_PF_LINUX if (locale != NULL && uprv_strcmp(name, "euc") == 0) { /* Linux underspecifies the "EUC" name. */ if (uprv_strcmp(locale, "korean") == 0) { @@ -1866,7 +1875,7 @@ getCodepageFromPOSIXID(const char *localeName, char * buffer, int32_t buffCapaci static const char* int_getDefaultCodepage() { -#if defined(OS400) +#if U_PLATFORM == U_PF_OS400 uint32_t ccsid = 37; /* Default to ibm-37 */ static char codepage[64]; Qwc_JOBI0400_t jobinfo; @@ -1887,7 +1896,7 @@ int_getDefaultCodepage() sprintf(codepage,"ibm-%d", ccsid); return codepage; -#elif defined(OS390) +#elif U_PLATFORM == U_PF_OS390 static char codepage[64]; strncpy(codepage, nl_langinfo(CODESET),63-strlen(UCNV_SWAP_LFNL_OPTION_STRING)); @@ -1896,10 +1905,10 @@ int_getDefaultCodepage() return codepage; -#elif defined(XP_MAC) +#elif U_PLATFORM == U_PF_CLASSIC_MACOS return "macintosh"; /* TODO: Macintosh Roman. There must be a better way. fixme! */ -#elif defined(U_WINDOWS) +#elif U_PLATFORM_USES_ONLY_WIN32_API static char codepage[64]; sprintf(codepage, "windows-%d", GetACP()); return codepage; @@ -1917,7 +1926,7 @@ int_getDefaultCodepage() nl_langinfo may use the same buffer as setlocale. */ { const char *codeset = nl_langinfo(U_NL_LANGINFO_CODESET); -#if defined(U_DARWIN) || defined(U_LINUX) +#if U_PLATFORM_IS_DARWIN_BASED || U_PLATFORM_IS_LINUX_BASED /* * On Linux and MacOSX, ensure that default codepage for non C/POSIX locale is UTF-8 * instead of ASCII. @@ -2086,9 +2095,10 @@ u_getVersion(UVersionInfo versionArray) { #if defined(U_CHECK_DYLOAD) -#if defined(HAVE_DLOPEN) +#if defined(HAVE_DLOPEN) && !U_PLATFORM_HAS_WIN32_API #ifdef HAVE_DLFCN_H + #ifdef __MVS__ #ifndef __SUSV3 #define __SUSV3 1 @@ -2163,7 +2173,7 @@ uprv_dlsym_func(void *lib, const char* sym, UErrorCode *status) { #endif -#elif defined U_WINDOWS +#elif U_PLATFORM_HAS_WIN32_API U_INTERNAL void * U_EXPORT2 uprv_dl_open(const char *libName, UErrorCode *status) { diff --git a/icu4c/source/common/putilimp.h b/icu4c/source/common/putilimp.h index 863e0291aa4..cee8026b230 100644 --- a/icu4c/source/common/putilimp.h +++ b/icu4c/source/common/putilimp.h @@ -259,10 +259,10 @@ U_INTERNAL void * U_EXPORT2 uprv_maximumPtr(void *base); * @internal */ #ifndef U_MAX_PTR -# if defined(OS390) && !defined(_LP64) +# if U_PLATFORM == U_PF_OS390 && !defined(_LP64) /* We have 31-bit pointers. */ # define U_MAX_PTR(base) ((void *)0x7fffffff) -# elif defined(OS400) +# elif U_PLATFORM == U_PF_OS400 # define U_MAX_PTR(base) uprv_maximumPtr((void *)base) # elif 0 /* diff --git a/icu4c/source/common/rbbidata.h b/icu4c/source/common/rbbidata.h index ee6aa486160..e8ef322e4d7 100644 --- a/icu4c/source/common/rbbidata.h +++ b/icu4c/source/common/rbbidata.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2005,2008 International Business Machines +* Copyright (C) 1999-2011 International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -45,7 +45,7 @@ ubrk_swap(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode); -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus #include "unicode/uobject.h" #include "unicode/unistr.h" diff --git a/icu4c/source/common/ucln_imp.h b/icu4c/source/common/ucln_imp.h index 2608fb2c755..d5d202ecde6 100644 --- a/icu4c/source/common/ucln_imp.h +++ b/icu4c/source/common/ucln_imp.h @@ -32,8 +32,7 @@ * 3) Implementing own automatic cleanup functions * * For option 1, ensure that UCLN_NO_AUTO_CLEANUP is set to 0 by using --enable-auto-cleanup - * configure option or by setting UCLN_NO_AUTO_CLEANUP to 0 in pwin32.h (For Visual Studio - * solution file builds) + * configure option or by otherwise setting UCLN_NO_AUTO_CLEANUP to 0 * For option 2, follow option 1 and also define UCLN_AUTO_ATEXIT * For option 3, follow option 1 and also define UCLN_AUTO_LOCAL (see below for more information) */ @@ -109,17 +108,9 @@ U_CAPI void U_EXPORT2 UCLN_FINI () /* This function must be defined, if UCLN_FINI is defined, else link error. */ UCLN_CLEAN_ME_UP; } -#elif defined(__GNUC__) -/* GCC - use __attribute((destructor)) */ -static void ucln_destructor() __attribute__((destructor)) ; - -static void ucln_destructor() -{ - UCLN_CLEAN_ME_UP; -} /* Windows: DllMain */ -#elif defined (U_WINDOWS) +#elif U_PLATFORM_HAS_WIN32_API /* * ICU's own DllMain. */ @@ -168,6 +159,16 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) } return status; } + +#elif defined(__GNUC__) +/* GCC - use __attribute((destructor)) */ +static void ucln_destructor() __attribute__((destructor)) ; + +static void ucln_destructor() +{ + UCLN_CLEAN_ME_UP; +} + #endif #endif /* UCLN_NO_AUTO_CLEANUP */ diff --git a/icu4c/source/common/ucnv_bld.cpp b/icu4c/source/common/ucnv_bld.cpp index efef4f24d64..b3f8951c1da 100644 --- a/icu4c/source/common/ucnv_bld.cpp +++ b/icu4c/source/common/ucnv_bld.cpp @@ -1274,7 +1274,7 @@ ucnv_getDefaultName() { #if (U_CHARSET_FAMILY == U_ASCII_FAMILY) name = "US-ASCII"; /* there is no 'algorithmic' converter for EBCDIC */ -#elif defined(OS390) +#elif U_PLATFORM == U_PF_OS390 name = "ibm-1047_P100-1995" UCNV_SWAP_LFNL_OPTION_STRING; #else name = "ibm-37_P100-1995"; diff --git a/icu4c/source/common/udata.cpp b/icu4c/source/common/udata.cpp index 43f50af84ad..bdf910a4cde 100644 --- a/icu4c/source/common/udata.cpp +++ b/icu4c/source/common/udata.cpp @@ -14,9 +14,9 @@ * created by: Markus W. Scherer */ -#include "unicode/utypes.h" /* U_LINUX */ +#include "unicode/utypes.h" /* U_PLATFORM etc. */ -#ifdef U_LINUX +#ifdef __GNUC__ /* if gcc #define ATTRIBUTE_WEAK __attribute__ ((weak)) might have to #include some other header diff --git a/icu4c/source/common/udatamem.c b/icu4c/source/common/udatamem.c index 2c9741e527b..ec6175d9857 100644 --- a/icu4c/source/common/udatamem.c +++ b/icu4c/source/common/udatamem.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************/ @@ -60,7 +60,7 @@ UDataMemory_normalizeDataPointer(const void *p) { if(pdh==NULL || (pdh->dataHeader.magic1==0xda && pdh->dataHeader.magic2==0x27)) { return pdh; } else { -#ifdef OS400 +#if U_PLATFORM == U_PF_OS400 /* TODO: Fix this once the compiler implements this feature. Keep in sync with genccode.c diff --git a/icu4c/source/common/umapfile.c b/icu4c/source/common/umapfile.c index f9f857e9dbe..05caecfff2c 100644 --- a/icu4c/source/common/umapfile.c +++ b/icu4c/source/common/umapfile.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************/ @@ -59,10 +59,6 @@ # define LIB_SUFFIX ".dll" /* This is inconvienient until we figure out what to do with U_ICUDATA_NAME in utypes.h */ # define U_ICUDATA_ENTRY_NAME "icudt" U_ICU_VERSION_SHORT U_LIB_SUFFIX_C_NAME_STRING "_dat" -# else -# if defined(U_DARWIN) -# include -# endif # endif #elif MAP_IMPLEMENTATION==MAP_STDIO # include @@ -181,7 +177,7 @@ } /* get a view of the mapping */ -#ifndef U_HPUX +#if U_PLATFORM != U_PF_HPUX data=mmap(0, length, PROT_READ, MAP_SHARED, fd, 0); #else data=mmap(0, length, PROT_READ, MAP_PRIVATE, fd, 0); @@ -194,7 +190,7 @@ pData->map = (char *)data + length; pData->pHeader=(const DataHeader *)data; pData->mapAddr = data; -#if defined(U_DARWIN) && TARGET_OS_IPHONE +#if U_PLATFORM == U_PF_IPHONE posix_madvise(data, length, POSIX_MADV_RANDOM); #endif return TRUE; diff --git a/icu4c/source/common/umapfile.h b/icu4c/source/common/umapfile.h index f8bf77b92cc..1f4b43c5d9e 100644 --- a/icu4c/source/common/umapfile.h +++ b/icu4c/source/common/umapfile.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************/ @@ -38,10 +38,10 @@ U_CFUNC void uprv_unmapFile(UDataMemory *pData); #if UCONFIG_NO_FILE_IO # define MAP_IMPLEMENTATION MAP_NONE -#elif defined(U_WINDOWS) +#elif U_PLATFORM_HAS_WIN32_API # define MAP_IMPLEMENTATION MAP_WIN32 -#elif U_HAVE_MMAP || defined(OS390) -# if defined(OS390) && defined (OS390_STUBDATA) +#elif U_HAVE_MMAP || U_PLATFORM == U_PF_OS390 +# if U_PLATFORM == U_PF_OS390 && defined (OS390_STUBDATA) /* No memory mapping for 390 batch mode. Fake it using dll loading. */ # define MAP_IMPLEMENTATION MAP_390DLL # else diff --git a/icu4c/source/common/umutex.c b/icu4c/source/common/umutex.c index e3bbda6df4c..5be6eb95ef5 100644 --- a/icu4c/source/common/umutex.c +++ b/icu4c/source/common/umutex.c @@ -27,17 +27,13 @@ * platform independent set of mutex operations. For internal ICU use only. */ -/* Assume POSIX, and modify as necessary below */ -#define POSIX - -#if defined(U_WINDOWS) -#undef POSIX -#endif -#if defined(macintosh) -#undef POSIX -#endif -#if defined(OS2) -#undef POSIX +#if U_PLATFORM_HAS_WIN32_API + /* Prefer native Windows APIs even if POSIX is implemented (i.e., on Cygwin). */ +# undef POSIX +#elif U_PLATFORM_IMPLEMENTS_POSIX +# define POSIX +#else +# undef POSIX #endif #if defined(POSIX) && (ICU_USE_THREADS==1) @@ -45,7 +41,7 @@ #endif /* POSIX && (ICU_USE_THREADS==1) */ -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API # define WIN32_LEAN_AND_MEAN # define VC_EXTRALEAN # define NOUSER @@ -100,7 +96,7 @@ mutexed_compare_and_swap(dest, newval, oldval) -#elif defined(U_WINDOWS) +#elif U_PLATFORM_HAS_WIN32_API #define MUTEX_TYPE CRITICAL_SECTION #define PLATFORM_MUTEX_INIT(m) InitializeCriticalSection(m) #define PLATFORM_MUTEX_LOCK(m) EnterCriticalSection(m) @@ -493,18 +489,21 @@ umtx_atomic_inc(int32_t *p) { if (pIncFn) { retVal = (*pIncFn)(gIncDecContext, p); } else { - #if defined (U_WINDOWS) && ICU_USE_THREADS == 1 + #if !ICU_USE_THREADS + /* ICU thread support compiled out. */ + retVal = ++(*p); + #elif U_PLATFORM_HAS_WIN32_API retVal = InterlockedIncrement((LONG*)p); #elif defined(USE_MAC_OS_ATOMIC_INCREMENT) retVal = OSAtomicIncrement32Barrier(p); #elif (U_HAVE_GCC_ATOMICS == 1) retVal = __sync_add_and_fetch(p, 1); - #elif defined (POSIX) && ICU_USE_THREADS == 1 + #elif defined (POSIX) umtx_lock(&gIncDecMutex); retVal = ++(*p); umtx_unlock(&gIncDecMutex); #else - /* Unknown Platform, or ICU thread support compiled out. */ + /* Unknown Platform. */ retVal = ++(*p); #endif } @@ -517,18 +516,21 @@ umtx_atomic_dec(int32_t *p) { if (pDecFn) { retVal = (*pDecFn)(gIncDecContext, p); } else { - #if defined (U_WINDOWS) && ICU_USE_THREADS == 1 + #if !ICU_USE_THREADS + /* ICU thread support compiled out. */ + retVal = --(*p); + #elif U_PLATFORM_HAS_WIN32_API retVal = InterlockedDecrement((LONG*)p); #elif defined(USE_MAC_OS_ATOMIC_INCREMENT) retVal = OSAtomicDecrement32Barrier(p); #elif (U_HAVE_GCC_ATOMICS == 1) retVal = __sync_sub_and_fetch(p, 1); - #elif defined (POSIX) && ICU_USE_THREADS == 1 + #elif defined (POSIX) umtx_lock(&gIncDecMutex); retVal = --(*p); umtx_unlock(&gIncDecMutex); #else - /* Unknown Platform, or ICU thread support compiled out. */ + /* Unknown Platform. */ retVal = --(*p); #endif } diff --git a/icu4c/source/common/umutex.h b/icu4c/source/common/umutex.h index 3083bda6454..089afb775e5 100644 --- a/icu4c/source/common/umutex.h +++ b/icu4c/source/common/umutex.h @@ -21,11 +21,11 @@ #include "unicode/utypes.h" #include "unicode/uclean.h" -#if defined(U_WINDOWS) +#if defined(_MSC_VER) && _MSC_VER >= 1500 # include #endif -#if defined(U_DARWIN) +#if U_PLATFORM_IS_DARWIN_BASED #if defined(__STRICT_ANSI__) #define UPRV_REMAP_INLINE #define inline @@ -49,30 +49,15 @@ # define ANNOTATE_UNPROTECTED_READ(x) (x) #endif -/* APP_NO_THREADS is an old symbol. We'll honour it if present. */ -#ifdef APP_NO_THREADS -# define ICU_USE_THREADS 0 -#endif - -/* ICU_USE_THREADS - * - * Allows thread support (use of mutexes) to be compiled out of ICU. - * Default: use threads. - * Even with thread support compiled out, applications may override the - * (empty) mutex implementation with the u_setMutexFunctions() functions. - */ -#ifndef ICU_USE_THREADS -# define ICU_USE_THREADS 1 -#endif - #ifndef UMTX_FULL_BARRIER # if !ICU_USE_THREADS # define UMTX_FULL_BARRIER # elif U_HAVE_GCC_ATOMICS # define UMTX_FULL_BARRIER __sync_synchronize(); -# elif defined(U_WINDOWS) && !(defined(_MSC_VER) && !(_MSC_VER >= 1500)) +# elif defined(_MSC_VER) && _MSC_VER >= 1500 + /* From MSVC intrin.h. Use _ReadWriteBarrier() only on MSVC 9 and higher. */ # define UMTX_FULL_BARRIER _ReadWriteBarrier(); -# elif defined(U_DARWIN) +# elif U_PLATFORM_IS_DARWIN_BASED # define UMTX_FULL_BARRIER OSMemoryBarrier(); # else # define UMTX_FULL_BARRIER \ diff --git a/icu4c/source/common/unicode/platform.h b/icu4c/source/common/unicode/platform.h new file mode 100644 index 00000000000..c8f4221fdf3 --- /dev/null +++ b/icu4c/source/common/unicode/platform.h @@ -0,0 +1,828 @@ +/* +****************************************************************************** +* +* Copyright (C) 1997-2011, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +* +* FILE NAME : platform.h +* +* Date Name Description +* 05/13/98 nos Creation (content moved here from ptypes.h). +* 03/02/99 stephen Added AS400 support. +* 03/30/99 stephen Added Linux support. +* 04/13/99 stephen Reworked for autoconf. +****************************************************************************** +*/ + +#ifndef _PLATFORM_H +#define _PLATFORM_H + +#include "unicode/uconfig.h" +#include "unicode/uvernum.h" + +/** + * \file + * \brief Basic types for the platform. + * + * This file used to be generated by autoconf/configure. + * Starting with ICU 49, platform.h is a normal source file, + * to simplify cross-compiling and working with non-autoconf/make build systems. + * + * When a value in this file does not work on a platform, then please + * try to derive it from the U_PLATFORM value + * (for which we might need a new value constant in rare cases) + * and/or from other macros that are predefined by the compiler + * or defined in standard (POSIX or platform or compiler) headers. + * + * As a temporary workaround, you can add an explicit #define for some macros + * before it is first tested, or add an equivalent -D macro definition + * to the compiler's command line. + * + * Note: Some compilers provide ways to show the predefined macros. + * For example, with gcc you can compile an empty .c file and have the compiler + * print the predefined macros with + * \code + * gcc -E -dM -x c /dev/null | sort + * \endcode + * (You can provide an actual empty .c file rather than /dev/null. + * -x c++ is for C++.) + */ + +/** + * \def U_PLATFORM + * The U_PLATFORM macro defines the platform we're on. + * + * We used to define one different, value-less macro per platform. + * That made it hard to know the set of relevant platforms and macros, + * and hard to deal with variants of platforms. + * + * Starting with ICU 49, we define platforms as numeric macros, + * with ranges of values for related platforms and their variants. + * The U_PLATFORM macro is set to one of these values. + * + * Historical note from the Solaris Wikipedia article: + * AT&T and Sun collaborated on a project to merge the most popular Unix variants + * on the market at that time: BSD, System V, and Xenix. + * This became Unix System V Release 4 (SVR4). + * + * @internal + */ + +/** Unknown platform. @internal */ +#define U_PF_UNKNOWN 0 +/** Windows @internal */ +#define U_PF_WINDOWS 1000 +/** MinGW. Windows, calls to Win32 API, but using GNU gcc and binutils. @internal */ +#define U_PF_MINGW 1800 +/** + * Cygwin. Windows, calls to cygwin1.dll for Posix functions, + * using MSVC or GNU gcc and binutils. + * @internal + */ +#define U_PF_CYGWIN 1900 +/* Reserve 2000 for U_PF_UNIX? */ +/** HP-UX is based on UNIX System V. @internal */ +#define U_PF_HPUX 2100 +/** Solaris is a Unix operating system based on SVR4. @internal */ +#define U_PF_SOLARIS 2600 +/** BSD is a UNIX operating system derivative. @internal */ +#define U_PF_BSD 3000 +/** AIX is based on UNIX System V Releases and 4.3 BSD. @internal */ +#define U_PF_AIX 3100 +/** IRIX is based on UNIX System V with BSD extensions. @internal */ +#define U_PF_IRIX 3200 +/** + * Darwin is a POSIX-compliant operating system, composed of code developed by Apple, + * as well as code derived from NeXTSTEP, BSD, and other projects, + * built around the Mach kernel. + * Darwin forms the core set of components upon which Mac OS X, Apple TV, and iOS are based. + * (Original description modified from WikiPedia.) + * @internal + */ +#define U_PF_DARWIN 3500 +/** iPhone OS (iOS) is a derivative of Mac OS X. @internal */ +#define U_PF_IPHONE 3550 +/** QNX is a commercial Unix-like real-time operating system related to BSD. @internal */ +#define U_PF_QNX 3700 +/** Linux is a Unix-like operating system. @internal */ +#define U_PF_LINUX 4000 +/** Android is based on Linux. @internal */ +#define U_PF_ANDROID 4050 +/** "Classic" Mac OS (1984–2001) @internal */ +#define U_PF_CLASSIC_MACOS 8000 +/** z/OS is the successor to OS/390 which was the successor to MVS. @internal */ +#define U_PF_OS390 9000 +/** "IBM i" is the current name of what used to be i5/OS and earlier OS/400. @internal */ +#define U_PF_OS400 9400 + +#ifdef U_PLATFORM + /* Use the predefined value. */ +#elif defined(__MINGW32__) +# define U_PLATFORM U_PF_MINGW +#elif defined(__CYGWIN__) +# define U_PLATFORM U_PF_CYGWIN +#elif defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64) +# define U_PLATFORM U_PF_WINDOWS +#elif defined(__ANDROID__) +# define U_PLATFORM U_PF_ANDROID + /* Android wchar_t support depends on the API level. */ +# include +#elif defined(linux) || defined(__linux__) || defined(__linux) +# define U_PLATFORM U_PF_LINUX +#elif defined(BSD) +# define U_PLATFORM U_PF_BSD +#elif defined(sun) || defined(__sun) + /* Check defined(__SVR4) || defined(__svr4__) to distinguish Solaris from SunOS? */ +# define U_PLATFORM U_PF_SOLARIS +#elif defined(_AIX) || defined(__TOS_AIX__) +# define U_PLATFORM U_PF_AIX +#elif defined(_hpux) || defined(hpux) || defined(__hpux) +# define U_PLATFORM U_PF_HPUX +#elif defined(sgi) || defined(__sgi) +# define U_PLATFORM U_PF_IRIX +#elif defined(__APPLE__) && defined(__MACH__) +# include +# ifdef TARGET_OS_IPHONE /* variant of TARGET_OS_MAC */ +# define U_PLATFORM U_PF_IPHONE +# else +# define U_PLATFORM U_PF_DARWIN +# endif +#elif defined(macintosh) +# define U_PLATFORM U_PF_CLASSIC_MACOS +#elif defined(__QNX__) || defined(__QNXNTO__) +# define U_PLATFORM U_PF_QNX +#elif defined(__TOS_MVS__) +# define U_PLATFORM U_PF_OS390 +#elif defined(__OS400__) || defined(__TOS_OS400__) +# define U_PLATFORM U_PF_OS400 +#else +# define U_PLATFORM U_PF_UNKNOWN +#endif + +/** + * \def U_PLATFORM_USES_ONLY_WIN32_API + * Defines whether the platform uses only the Win32 API. + * Set to 1 for Windows/MSVC and MinGW but not Cygwin. + * @internal + */ +#ifdef U_PLATFORM_USES_ONLY_WIN32_API + /* Use the predefined value. */ +#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_MINGW +# define U_PLATFORM_USES_ONLY_WIN32_API 1 +#else + /* Cygwin implements POSIX. */ +# define U_PLATFORM_USES_ONLY_WIN32_API 0 +#endif + +/** + * \def U_PLATFORM_HAS_WIN32_API + * Defines whether the Win32 API is available on the platform. + * Set to 1 for Windows/MSVC, MinGW and Cygwin. + * @internal + */ +#ifdef U_PLATFORM_HAS_WIN32_API + /* Use the predefined value. */ +#elif U_PF_WINDOWS <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN +# define U_PLATFORM_HAS_WIN32_API 1 +#else +# define U_PLATFORM_HAS_WIN32_API 0 +#endif + +/** + * \def U_PLATFORM_IMPLEMENTS_POSIX + * Defines whether the platform implements (most of) the POSIX API. + * Set to 1 for Cygwin and most other platforms. + * @internal + */ +#ifdef U_PLATFORM_IMPLEMENTS_POSIX + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API || U_PLATFORM == U_PF_CLASSIC_MACOS +# define U_PLATFORM_IMPLEMENTS_POSIX 0 +#else +# define U_PLATFORM_IMPLEMENTS_POSIX 1 +#endif + +/** + * \def CYGWINMSVC + * Defined if this is Windows with Cygwin, but using MSVC rather than gcc. + * Otherwise undefined. + * @internal + */ +#if U_PLATFORM == U_PF_CYGWIN && defined(_MSC_VER) +# define CYGWINMSVC +#endif + +/** + * \def U_PLATFORM_IS_LINUX_BASED + * Defines whether the platform is Linux or one of its derivatives. + * @internal + */ +#ifdef U_PLATFORM_IS_LINUX_BASED + /* Use the predefined value. */ +#elif U_PF_LINUX <= U_PLATFORM && U_PLATFORM <= U_PF_ANDROID +# define U_PLATFORM_IS_LINUX_BASED 1 +#else +# define U_PLATFORM_IS_LINUX_BASED 0 +#endif + +/** + * \def U_PLATFORM_IS_DARWIN_BASED + * Defines whether the platform is Darwin or one of its derivatives. + * @internal + */ +#ifdef U_PLATFORM_IS_DARWIN_BASED + /* Use the predefined value. */ +#elif U_PF_DARWIN <= U_PLATFORM && U_PLATFORM <= U_PF_IPHONE +# define U_PLATFORM_IS_DARWIN_BASED 1 +#else +# define U_PLATFORM_IS_DARWIN_BASED 0 +#endif + +/** + * \def U_HAVE_DIRENT_H + * Defines whether dirent.h is available. + * @internal + */ +#ifdef U_HAVE_DIRENT_H + /* Use the predefined value. */ +#elif U_PLATFORM_HAS_WIN32_API +# define U_HAVE_DIRENT_H 0 +#else +# define U_HAVE_DIRENT_H 1 +#endif + +/** + * \def U_HAVE_STDINT_H + * Defines whether stdint.h is available. It is a C99 standard header. + * We used to include inttypes.h which includes stdint.h but we usually do not need + * the additional definitions from inttypes.h. + * @internal + */ +#ifdef U_HAVE_STDINT_H + /* Use the predefined value. */ +#elif U_PLATFORM_USES_ONLY_WIN32_API +# if defined(__BORLANDC__) || (defined(_MSC_VER) && _MSC_VER>=1600) + /* Windows Visual Studio 9 and below do not have stdint.h & inttypes.h, but VS 2010 adds them. */ +# define U_HAVE_STDINT_H 1 +# else +# define U_HAVE_STDINT_H 0 +# endif +#elif U_PLATFORM == U_PF_SOLARIS + /* Solaris has inttypes.h but not stdint.h. */ +# define U_HAVE_STDINT_H 0 +#else +# define U_HAVE_STDINT_H 1 +#endif + +/** + * \def U_HAVE_INTTYPES_H + * Defines whether inttypes.h is available. It is a C99 standard header. + * We include inttypes.h where it is available but stdint.h is not. + * @internal + */ +#ifdef U_HAVE_INTTYPES_H + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_SOLARIS + /* Solaris has inttypes.h but not stdint.h. */ +# define U_HAVE_INTTYPES_H 1 +#else + /* Most platforms have both inttypes.h and stdint.h, or neither. */ +# define U_HAVE_INTTYPES_H U_HAVE_STDINT_H +#endif + +/** + * \def U_IOSTREAM_SOURCE + * Defines what support for C++ streams is available. + * + * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available + * (the ISO/IEC C++ FDIS was published in November 1997), and then + * one should qualify streams using the std namespace in ICU header + * files. + * Starting with ICU 49, this is the only supported version. + * + * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is + * available instead (in June 1985 Stroustrup published + * "An Extensible I/O Facility for C++" at the summer USENIX conference). + * Starting with ICU 49, this version is not supported any more. + * + * If U_IOSTREAM_SOURCE is 0 (or any value less than 199711), + * then C++ streams are not available and + * support for them will be silently suppressed in ICU. + * + * @internal + */ +#ifndef U_IOSTREAM_SOURCE +#define U_IOSTREAM_SOURCE 199711 +#endif + +/** + * \def U_HAVE_STD_STRING + * Defines whether the standard C++ (STL) <string> header is available. + * @internal + */ +#ifdef U_HAVE_STD_STRING + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_ANDROID +# define U_HAVE_STD_STRING 0 +#else +# define U_HAVE_STD_STRING 1 +#endif + +/*===========================================================================*/ +/** @{ Compiler and environment features */ +/*===========================================================================*/ + +/** + * \def U_IS_BIG_ENDIAN + * Determines the endianness of the platform. + * @internal + */ +#ifdef U_IS_BIG_ENDIAN + /* Use the predefined value. */ +#elif defined(BYTE_ORDER) && defined(BIG_ENDIAN) +# define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) +#elif defined(__BYTE_ORDER__) && defined(__ORDER_BIG_ENDIAN__) + /* gcc */ +# define U_IS_BIG_ENDIAN (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) +#elif defined(__BIG_ENDIAN__) || defined(_BIG_ENDIAN) +# define U_IS_BIG_ENDIAN 1 +#elif defined(__LITTLE_ENDIAN__) || defined(_LITTLE_ENDIAN) +# define U_IS_BIG_ENDIAN 0 +#elif U_PLATFORM == U_PF_OS390 || U_PLATFORM == U_PF_OS400 + /* These platforms do not appear to predefine any endianness macros. */ +# define U_IS_BIG_ENDIAN 1 +#else +# define U_IS_BIG_ENDIAN 0 +#endif + +/** + * \def U_HAVE_PLACEMENT_NEW + * Determines whether to override placement new and delete for STL. + * @stable ICU 2.6 + */ +#ifdef U_HAVE_PLACEMENT_NEW + /* Use the predefined value. */ +#elif defined(__BORLANDC__) +# define U_HAVE_PLACEMENT_NEW 0 +#else +# define U_HAVE_PLACEMENT_NEW 1 +#endif + +/** + * \def U_HAVE_DEBUG_LOCATION_NEW + * Define this to define the MFC debug version of the operator new. + * + * @stable ICU 3.4 + */ +#ifdef U_HAVE_DEBUG_LOCATION_NEW + /* Use the predefined value. */ +#elif defined(_MSC_VER) +# define U_HAVE_DEBUG_LOCATION_NEW 1 +#else +# define U_HAVE_DEBUG_LOCATION_NEW 0 +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Character data types */ +/*===========================================================================*/ + +/** + * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform. + * @stable ICU 2.0 + */ +#define U_ASCII_FAMILY 0 + +/** + * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform. + * @stable ICU 2.0 + */ +#define U_EBCDIC_FAMILY 1 + +/** + * \def U_CHARSET_FAMILY + * + *

These definitions allow to specify the encoding of text + * in the char data type as defined by the platform and the compiler. + * It is enough to determine the code point values of "invariant characters", + * which are the ones shared by all encodings that are in use + * on a given platform.

+ * + *

Those "invariant characters" should be all the uppercase and lowercase + * latin letters, the digits, the space, and "basic punctuation". + * Also, '\\n', '\\r', '\\t' should be available.

+ * + *

The list of "invariant characters" is:
+ * \code + * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _ + * \endcode + *
+ * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)

+ * + *

This matches the IBM Syntactic Character Set (CS 640).

+ * + *

In other words, all the graphic characters in 7-bit ASCII should + * be safely accessible except the following:

+ * + * \code + * '\' + * '[' + * ']' + * '{' + * '}' + * '^' + * '~' + * '!' + * '#' + * '|' + * '$' + * '@' + * '`' + * \endcode + * @stable ICU 2.0 + */ +#ifdef U_CHARSET_FAMILY + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_OS390 && (!defined(__CHARSET_LIB) || !__CHARSET_LIB) +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY +#elif U_PLATFORM == U_PF_OS400 && !defined(__UTF32__) +# define U_CHARSET_FAMILY U_EBCDIC_FAMILY +#else +# define U_CHARSET_FAMILY U_ASCII_FAMILY +#endif + +/** + * \def U_CHARSET_IS_UTF8 + * + * Hardcode the default charset to UTF-8. + * + * If this is set to 1, then + * - ICU will assume that all non-invariant char*, StringPiece, std::string etc. + * contain UTF-8 text, regardless of what the system API uses + * - some ICU code will use fast functions like u_strFromUTF8() + * rather than the more general and more heavy-weight conversion API (ucnv.h) + * - ucnv_getDefaultName() always returns "UTF-8" + * - ucnv_setDefaultName() is disabled and will not change the default charset + * - static builds of ICU are smaller + * - more functionality is available with the UCONFIG_NO_CONVERSION build-time + * configuration option (see unicode/uconfig.h) + * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable + * + * @stable ICU 4.2 + * @see UCONFIG_NO_CONVERSION + */ +#ifndef U_CHARSET_IS_UTF8 +# define U_CHARSET_IS_UTF8 0 +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Information about wchar support */ +/*===========================================================================*/ + +/** + * \def U_HAVE_WCHAR_H + * Indicates whether is available (1) or not (0). Set to 1 by default. + * + * @stable ICU 2.0 + */ +#ifdef U_HAVE_WCHAR_H + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9 + /* + * Android before Gingerbread (Android 2.3, API level 9) did not support wchar_t. + * The type and header existed, but the library functions did not work as expected. + * The size of wchar_t was 1 but L"xyz" string literals had 32-bit units anyway. + */ +# define U_HAVE_WCHAR_H 0 +#else +# define U_HAVE_WCHAR_H 1 +#endif + +/** + * \def U_SIZEOF_WCHAR_T + * U_SIZEOF_WCHAR_T==sizeof(wchar_t) + * + * @stable ICU 2.0 + */ +#ifdef U_SIZEOF_WCHAR_T + /* Use the predefined value. */ +#elif (U_PLATFORM == U_PF_ANDROID && __ANDROID_API__ < 9) || U_PLATFORM == U_PF_CLASSIC_MACOS + /* + * Classic Mac OS and Mac OS X before 10.3 (Panther) did not support wchar_t or wstring. + * Newer Mac OS X has size 4. + */ +# define U_SIZEOF_WCHAR_T 1 +#elif U_PLATFORM_HAS_WIN32_API +# define U_SIZEOF_WCHAR_T 2 +#elif U_PLATFORM == U_PF_AIX + /* + * AIX 6.1 information, section "Wide character data representation": + * "... the wchar_t datatype is 32–bit in the 64–bit environment and + * 16–bit in the 32–bit environment." + * and + * "All locales use Unicode for their wide character code values (process code), + * except the IBM-eucTW codeset." + */ +# ifdef __64BIT__ +# define U_SIZEOF_WCHAR_T 4 +# else +# define U_SIZEOF_WCHAR_T 2 +# endif +#elif U_PLATFORM == U_PF_OS390 + /* + * z/OS V1R11 information center, section "LP64 | ILP32": + * "In 31-bit mode, the size of long and pointers is 4 bytes and the size of wchar_t is 2 bytes. + * Under LP64, the size of long and pointer is 8 bytes and the size of wchar_t is 4 bytes." + */ +# ifdef _LP64 +# define U_SIZEOF_WCHAR_T 4 +# else +# define U_SIZEOF_WCHAR_T 2 +# endif +#elif U_PLATFORM == U_PF_OS400 +# if defined(__UTF32__) + /* + * LOCALETYPE(*LOCALEUTF) is specified. + * Wide-character strings are in UTF-32, + * narrow-character strings are in UTF-8. + */ +# define U_SIZEOF_WCHAR_T 4 +# elif defined(__UCS2__) + /* + * LOCALETYPE(*LOCALEUCS2) is specified. + * Wide-character strings are in UCS-2, + * narrow-character strings are in EBCDIC. + */ +# define U_SIZEOF_WCHAR_T 2 +#else + /* + * LOCALETYPE(*CLD) or LOCALETYPE(*LOCALE) is specified. + * Wide-character strings are in 16-bit EBCDIC, + * narrow-character strings are in EBCDIC. + */ +# define U_SIZEOF_WCHAR_T 2 +# endif +#else +# define U_SIZEOF_WCHAR_T 4 +#endif + +#ifndef U_HAVE_WCSCPY +#define U_HAVE_WCSCPY U_HAVE_WCHAR_H +#endif + +/** @} */ + +/** + * \def U_HAVE_CHAR16_T + * Defines whether the char16_t type is available for UTF-16 + * and u"abc" UTF-16 string literals are supported. + * This is a new standard type and standard string literal syntax in C++0x + * but has been available in some compilers before. + * @internal + */ +#ifdef U_HAVE_CHAR16_T + /* Use the predefined value. */ +#else + /* + * Notes: + * Visual Studio 10 (_MSC_VER>=1600) defines char16_t but + * does not support u"abc" string literals. + * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but + * does not support u"abc" string literals. + */ +# define U_HAVE_CHAR16_T 0 +#endif + +/** + * @{ + * \def U_DECLARE_UTF16 + * Do not use this macro because it is not defined on all platforms. + * Use the UNICODE_STRING or U_STRING_DECL macros instead. + * @internal + */ +#ifdef U_DECLARE_UTF16 + /* Use the predefined value. */ +#elif (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ + || (defined(__HP_aCC) && __HP_aCC >= 035000) \ + || (defined(__HP_cc) && __HP_cc >= 111106) \ + || U_HAVE_CHAR16_T +# define U_DECLARE_UTF16(string) u ## string +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) +/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */ +/* Sun's C compiler has issues with this notation, and it's unreliable. */ +# define U_DECLARE_UTF16(string) U ## string +#elif U_SIZEOF_WCHAR_T == 2 \ + && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__))) +# define U_DECLARE_UTF16(string) L ## string +#else + /* Leave U_DECLARE_UTF16 undefined. See unistr.h. */ +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Information about POSIX support */ +/*===========================================================================*/ + +#ifdef U_HAVE_NL_LANGINFO_CODESET + /* Use the predefined value. */ +#elif U_PLATFORM_HAS_WIN32_API +# define U_HAVE_NL_LANGINFO_CODESET 0 +#else +# define U_HAVE_NL_LANGINFO_CODESET 1 +#endif + +#ifdef U_NL_LANGINFO_CODESET + /* Use the predefined value. */ +#elif !U_HAVE_NL_LANGINFO_CODESET +# define U_NL_LANGINFO_CODESET -1 +#else +# define U_NL_LANGINFO_CODESET CODESET +#endif + +#ifdef U_TZSET + /* Use the predefined value. */ +#elif U_PLATFORM_HAS_WIN32_API +# define U_TZSET _tzset +#else +# define U_TZSET tzset +#endif + +#ifdef U_TIMEZONE + /* Use the predefined value. */ +#elif U_PLATFORM_IS_LINUX_BASED +# define U_TIMEZONE __timezone +#elif U_PLATFORM_HAS_WIN32_API +# define U_TIMEZONE _timezone +#else +# define U_TIMEZONE timezone +#endif + +#ifdef U_TZNAME + /* Use the predefined value. */ +#elif U_PLATFORM_HAS_WIN32_API +# define U_TZNAME _tzname +#else +# define U_TZNAME tzname +#endif + +#ifdef U_HAVE_MMAP + /* Use the predefined value. */ +#elif U_PLATFORM_HAS_WIN32_API +# define U_HAVE_MMAP 0 +#else +# define U_HAVE_MMAP 1 +#endif + +#ifdef U_HAVE_POPEN + /* Use the predefined value. */ +#elif U_PLATFORM_HAS_WIN32_API +# define U_HAVE_POPEN 0 +#else +# define U_HAVE_POPEN 1 +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Symbol import-export control */ +/*===========================================================================*/ + +#ifdef U_EXPORT + /* Use the predefined value. */ +#elif defined(U_STATIC_IMPLEMENTATION) +# define U_EXPORT +#elif defined(__GNUC__) +# define U_EXPORT __attribute__((visibility("default"))) +#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ + || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) +# define U_EXPORT __global +/*#elif defined(__HP_aCC) || defined(__HP_cc) +# define U_EXPORT __declspec(dllexport)*/ +#elif defined(_MSC_VER) +# define U_EXPORT __declspec(dllexport) +#else +# define U_EXPORT +#endif + +/* U_CALLCONV is releated to U_EXPORT2 */ +#ifdef U_EXPORT2 + /* Use the predefined value. */ +#elif defined(_MSC_VER) +# define U_EXPORT2 __cdecl +#else +# define U_EXPORT2 +#endif + +#ifdef U_IMPORT + /* Use the predefined value. */ +#elif defined(_MSC_VER) + /* Windows needs to export/import data. */ +# define U_IMPORT __declspec(dllimport) +#else +# define U_IMPORT +#endif + +/** + * \def U_CALLCONV + * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary + * in callback function typedefs to make sure that the calling convention + * is compatible. + * + * This is only used for non-ICU-API functions. + * When a function is a public ICU API, + * you must use the U_CAPI and U_EXPORT2 qualifiers. + * @stable ICU 2.0 + */ +#if U_PLATFORM == U_PF_OS390 && defined(__cplusplus) +# define U_CALLCONV __cdecl +#else +# define U_CALLCONV U_EXPORT2 +#endif + +/* @} */ + +/*===========================================================================*/ +/** @{ Code alignment */ +/*===========================================================================*/ + +/** + * \def U_ALIGN_CODE + * This is used to align code fragments to a specific byte boundary. + * This is useful for getting consistent performance test results. + * @internal + */ +#ifdef U_ALIGN_CODE + /* Use the predefined value. */ +#elif defined(_MSC_VER) && defined(_M_IX86) && !defined(_MANAGED) +# define U_ALIGN_CODE(boundarySize) __asm align boundarySize +#else +# define U_ALIGN_CODE(boundarySize) +#endif + +/** @} */ + +/** + * \def U_HAVE_MSVC_2003_OR_EARLIER + * Flag for workaround of MSVC 2003 optimization bugs + * @internal + */ +#if !defined(U_HAVE_MSVC_2003_OR_EARLIER) && defined(_MSC_VER) && (_MSC_VER < 1400) +#define U_HAVE_MSVC_2003_OR_EARLIER +#endif + +/*===========================================================================*/ +/** @{ GCC built in functions for atomic memory operations */ +/*===========================================================================*/ + +/** + * \def U_HAVE_GCC_ATOMICS + * @internal + */ +#ifdef U_HAVE_GCC_ATOMICS + /* Use the predefined value. */ +#elif defined(__GNUC__) +# define U_HAVE_GCC_ATOMICS 1 +#else +# define U_HAVE_GCC_ATOMICS 0 +#endif + +/** @} */ + +/*===========================================================================*/ +/** @{ Programs used by ICU code */ +/*===========================================================================*/ + +/** + * \def U_MAKE_IS_NMAKE + * Defines whether the "make" program is Windows nmake. + */ +#ifdef U_MAKE_IS_NMAKE + /* Use the predefined value. */ +#elif U_PLATFORM == U_PF_WINDOWS +# define U_MAKE_IS_NMAKE 1 +#else +# define U_MAKE_IS_NMAKE 0 +#endif + +/** @} */ + +/*===========================================================================*/ +/* Custom icu entry point renaming */ +/*===========================================================================*/ + +#if U_HAVE_LIB_SUFFIX +# ifndef U_ICU_ENTRY_POINT_RENAME +/* Renaming pattern: u_strcpy_41_suffix */ +# define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## U_ICU_VERSION_MAJOR_NUM ## U_LIB_SUFFIX_C_NAME +# define U_DEF_ICUDATA_ENTRY_POINT(major) icudt ## U_LIB_SUFFIX_C_NAME ## major ##_dat + +# endif +#endif + +#endif diff --git a/icu4c/source/common/unicode/platform.h.in b/icu4c/source/common/unicode/platform.h.in deleted file mode 100644 index 43313978b2e..00000000000 --- a/icu4c/source/common/unicode/platform.h.in +++ /dev/null @@ -1,393 +0,0 @@ -/* -****************************************************************************** -* -* Copyright (C) 1997-2011, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* Note: autoconf creates platform.h from platform.h.in at configure time. -* -****************************************************************************** -* -* FILE NAME : platform.h -* -* Date Name Description -* 05/13/98 nos Creation (content moved here from ptypes.h). -* 03/02/99 stephen Added AS400 support. -* 03/30/99 stephen Added Linux support. -* 04/13/99 stephen Reworked for autoconf. -****************************************************************************** -*/ - -#ifndef _PLATFORM_H -#define _PLATFORM_H - -/** - * \file - * \brief Basic types for the platform - */ - -/* This file should be included before uvernum.h. */ -#if defined(UVERNUM_H) -# error Do not include unicode/uvernum.h before #including unicode/platform.h. Instead of unicode/uvernum.h, #include unicode/uversion.h -#endif - -/** - * Determine wheter to enable auto cleanup of libraries. - * @internal - */ -#ifndef UCLN_NO_AUTO_CLEANUP -#define UCLN_NO_AUTO_CLEANUP @UCLN_NO_AUTO_CLEANUP@ -#endif - -#if @U_USING_CYGWIN_MSVC@ -#define CYGWINMSVC -#endif - -/* Need platform.h when using CYGWINMSVC to get definitions above. Ignore everything else. */ -#ifndef CYGWINMSVC - -/** Define the platform we're on. */ -#ifndef @platform@ -#define @platform@ -#endif - -/** - * \def U_HAVE_DIRENT_H - * Define whether dirent.h is available - * @internal - */ -#ifndef U_HAVE_DIRENT_H -#define U_HAVE_DIRENT_H @U_HAVE_DIRENT_H@ -#endif - -/** Define whether inttypes.h is available */ -#ifndef U_HAVE_INTTYPES_H -#define U_HAVE_INTTYPES_H @U_HAVE_INTTYPES_H@ -#endif - -/** - * Define what support for C++ streams is available. - * - * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available - * (the ISO/IEC C++ FDIS was published in November 1997), and then - * one should qualify streams using the std namespace in ICU header - * files. - * Starting with ICU 49, this is the only supported version. - * - * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is - * available instead (in June 1985 Stroustrup published - * "An Extensible I/O Facility for C++" at the summer USENIX conference). - * Starting with ICU 49, this version is not supported any more. - * - * If U_IOSTREAM_SOURCE is 0 (or any value less than 199711), - * then C++ streams are not available and - * support for them will be silently suppressed in ICU. - */ -#ifndef U_IOSTREAM_SOURCE -#define U_IOSTREAM_SOURCE 199711 -#endif - -/** - * \def U_HAVE_STD_STRING - * Define whether the standard C++ (STL) <string> header is available. - * For platforms that do not use platform.h and do not define this constant - * in their platform-specific headers, std_string.h defaults - * U_HAVE_STD_STRING to 1. - * @internal - */ -#ifndef U_HAVE_STD_STRING -#define U_HAVE_STD_STRING @U_HAVE_STD_STRING@ -#endif - -/** @{ Determines whether specific types are available */ -#ifndef U_HAVE_INT8_T -#define U_HAVE_INT8_T @HAVE_INT8_T@ -#endif - -#ifndef U_HAVE_UINT8_T -#define U_HAVE_UINT8_T @HAVE_UINT8_T@ -#endif - -#ifndef U_HAVE_INT16_T -#define U_HAVE_INT16_T @HAVE_INT16_T@ -#endif - -#ifndef U_HAVE_UINT16_T -#define U_HAVE_UINT16_T @HAVE_UINT16_T@ -#endif - -#ifndef U_HAVE_INT32_T -#define U_HAVE_INT32_T @HAVE_INT32_T@ -#endif - -#ifndef U_HAVE_UINT32_T -#define U_HAVE_UINT32_T @HAVE_UINT32_T@ -#endif - -#ifndef U_HAVE_INT64_T -#define U_HAVE_INT64_T @HAVE_INT64_T@ -#endif - -#ifndef U_HAVE_UINT64_T -#define U_HAVE_UINT64_T @HAVE_UINT64_T@ -#endif - -/** @} */ - -/*===========================================================================*/ -/** @{ Compiler and environment features */ -/*===========================================================================*/ - -/* Determines the endianness of the platform - It's done this way in case multiple architectures are being built at once. - For example, Darwin supports fat binaries, which can be both PPC and x86 based. */ -#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) -#define U_IS_BIG_ENDIAN (BYTE_ORDER == BIG_ENDIAN) -#else -#define U_IS_BIG_ENDIAN @U_IS_BIG_ENDIAN@ -#endif - -/* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ -#ifndef ICU_USE_THREADS -#define ICU_USE_THREADS @ICU_USE_THREADS@ -#endif - -#ifndef U_DEBUG -#define U_DEBUG @ENABLE_DEBUG@ -#endif - -#ifndef U_RELEASE -#define U_RELEASE @ENABLE_RELEASE@ -#endif - -/* Determine whether to disable renaming or not. This overrides the - setting in umachine.h which is for all platforms. */ -#ifndef U_DISABLE_RENAMING -#define U_DISABLE_RENAMING @U_DISABLE_RENAMING@ -#endif - -/* Determine whether to override new and delete. */ -#ifndef U_OVERRIDE_CXX_ALLOCATION -#define U_OVERRIDE_CXX_ALLOCATION @U_OVERRIDE_CXX_ALLOCATION@ -#endif -/* Determine whether to override placement new and delete for STL. */ -#ifndef U_HAVE_PLACEMENT_NEW -#define U_HAVE_PLACEMENT_NEW @U_HAVE_PLACEMENT_NEW@ -#endif - -/* Determine whether to enable tracing. */ -#ifndef U_ENABLE_TRACING -#define U_ENABLE_TRACING @U_ENABLE_TRACING@ -#endif - -/** - * Whether to enable Dynamic loading in ICU - * @internal - */ -#ifndef U_ENABLE_DYLOAD -#define U_ENABLE_DYLOAD @U_ENABLE_DYLOAD@ -#endif - -/** - * Whether to test Dynamic loading as an OS capabilty - * @internal - */ -#ifndef U_CHECK_DYLOAD -#define U_CHECK_DYLOAD @U_CHECK_DYLOAD@ -#endif - - -/** Do we allow ICU users to use the draft APIs by default? */ -#ifndef U_DEFAULT_SHOW_DRAFT -#define U_DEFAULT_SHOW_DRAFT @U_DEFAULT_SHOW_DRAFT@ -#endif - -/** @} */ - -/*===========================================================================*/ -/** @{ Character data types */ -/*===========================================================================*/ - -#if ((defined(OS390) && (!defined(__CHARSET_LIB) || !__CHARSET_LIB))) || defined(OS400) -# define U_CHARSET_FAMILY 1 -#endif - -/** @} */ - -/*===========================================================================*/ -/** @{ Information about wchar support */ -/*===========================================================================*/ - -#ifndef U_HAVE_WCHAR_H -#define U_HAVE_WCHAR_H @U_HAVE_WCHAR_H@ -#endif - -#ifndef U_SIZEOF_WCHAR_T -#define U_SIZEOF_WCHAR_T @U_SIZEOF_WCHAR_T@ -#endif - -#ifndef U_HAVE_WCSCPY -#define U_HAVE_WCSCPY @U_HAVE_WCSCPY@ -#endif - -/** @} */ - -/** - * @{ - * \def U_DECLARE_UTF16 - * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros - * instead. - * @internal - * - * \def U_GNUC_UTF16_STRING - * @internal - */ -#ifndef U_GNUC_UTF16_STRING -#define U_GNUC_UTF16_STRING @U_CHECK_GNUC_UTF16_STRING@ -#endif -#if @U_CHECK_UTF16_STRING@ || defined(U_CHECK_UTF16_STRING) -#if (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ - || (defined(__HP_aCC) && __HP_aCC >= 035000) \ - || (defined(__HP_cc) && __HP_cc >= 111106) \ - || U_GNUC_UTF16_STRING -#define U_DECLARE_UTF16(string) u ## string -#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) -/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */ -/* Sun's C compiler has issues with this notation, and it's unreliable. */ -#define U_DECLARE_UTF16(string) U ## string -#elif U_SIZEOF_WCHAR_T == 2 \ - && (U_CHARSET_FAMILY == 0 || ((defined(OS390) || defined(OS400)) && defined(__UCS2__))) -#define U_DECLARE_UTF16(string) L ## string -#endif -#endif - -/** @} */ - -/*===========================================================================*/ -/** @{ Information about POSIX support */ -/*===========================================================================*/ - -#ifndef U_HAVE_NL_LANGINFO_CODESET -#define U_HAVE_NL_LANGINFO_CODESET @U_HAVE_NL_LANGINFO_CODESET@ -#endif - -#ifndef U_NL_LANGINFO_CODESET -#define U_NL_LANGINFO_CODESET @U_NL_LANGINFO_CODESET@ -#endif - -#if @U_HAVE_TZSET@ -#define U_TZSET @U_TZSET@ -#endif -#if @U_HAVE_TIMEZONE@ -#define U_TIMEZONE @U_TIMEZONE@ -#endif -#if @U_HAVE_TZNAME@ -#define U_TZNAME @U_TZNAME@ -#endif - -#define U_HAVE_MMAP @HAVE_MMAP@ -#define U_HAVE_POPEN @U_HAVE_POPEN@ - -/** @} */ - -/*===========================================================================*/ -/** @{ Symbol import-export control */ -/*===========================================================================*/ - -#ifdef U_STATIC_IMPLEMENTATION -#define U_EXPORT -#elif @U_USE_GCC_VISIBILITY_ATTRIBUTE@ -#define U_EXPORT __attribute__((visibility("default"))) -#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) \ - || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x550) -#define U_EXPORT __global -/*#elif defined(__HP_aCC) || defined(__HP_cc) -#define U_EXPORT __declspec(dllexport)*/ -#else -#define U_EXPORT -#endif - -/* U_CALLCONV is releated to U_EXPORT2 */ -#define U_EXPORT2 - -/* cygwin needs to export/import data */ -#if defined(U_CYGWIN) && !defined(__GNUC__) -#define U_IMPORT __declspec(dllimport) -#else -#define U_IMPORT -#endif - -/* @} */ - -/*===========================================================================*/ -/** @{ Code alignment */ -/*===========================================================================*/ - -#ifndef U_ALIGN_CODE -#define U_ALIGN_CODE(n) -#endif - -/** @} */ - -/*===========================================================================*/ -/** @{ GCC built in functions for atomic memory operations */ -/*===========================================================================*/ - -/** - * \def U_HAVE_GCC_ATOMICS - * @internal - */ -#ifndef U_HAVE_GCC_ATOMICS -#define U_HAVE_GCC_ATOMICS @U_HAVE_GCC_ATOMICS@ -#endif - -/** @} */ - -/*===========================================================================*/ -/** @{ Programs used by ICU code */ -/*===========================================================================*/ - -/** - * \def U_MAKE - * What program to execute to run 'make' - */ -#ifndef U_MAKE -#define U_MAKE "@U_MAKE@" -#endif - -/** @} */ - -#endif /* CYGWINMSVC */ - -/*===========================================================================*/ -/* Custom icu entry point renaming */ -/*===========================================================================*/ - -/** - * Define the library suffix with C syntax. - * @internal - */ -# define U_LIB_SUFFIX_C_NAME @ICULIBSUFFIXCNAME@ -/** - * Define the library suffix as a string with C syntax - * @internal - */ -# define U_LIB_SUFFIX_C_NAME_STRING "@ICULIBSUFFIXCNAME@" -/** - * 1 if a custom library suffix is set - * @internal - */ -# define U_HAVE_LIB_SUFFIX @U_HAVE_LIB_SUFFIX@ - -#if U_HAVE_LIB_SUFFIX -# ifndef U_ICU_ENTRY_POINT_RENAME -/* Renaming pattern: u_strcpy_41_suffix */ -# define U_ICU_ENTRY_POINT_RENAME(x) x ## _ ## @LIB_VERSION_MAJOR@ ## @ICULIBSUFFIXCNAME@ -# define U_DEF_ICUDATA_ENTRY_POINT(major) icudt##@ICULIBSUFFIXCNAME@##major##_dat - -# endif -#endif - -#endif diff --git a/icu4c/source/common/unicode/platform.win b/icu4c/source/common/unicode/platform.win deleted file mode 100644 index 5113f1f81ad..00000000000 --- a/icu4c/source/common/unicode/platform.win +++ /dev/null @@ -1,25 +0,0 @@ -/* -****************************************************************************** -* -* Copyright (C) 2011, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* Note: Windows build with MSVC Solution/Project files creates platform.h from -* platform.win buring common library build. This file is an empty header -* file to ensure the #include "unicode/platform.h" statement works. -* If ICU4C is built with Cywin using MSVC, the normal autoconf generated -* platform.h file will be used instead of this empty header file. This -* will help the user of ICU to know whether ICU was built with Cygwin using -* MSVC or was built with just the MSVC Solution/Project files. -*/ - -#ifndef _PLATFORM_H -#define _PLATFORM_H -/* - * This header file should be kept empty unless a Windows specific definition or - * configuration is needed. - */ -#endif - diff --git a/icu4c/source/common/unicode/ppalmos.h b/icu4c/source/common/unicode/ppalmos.h deleted file mode 100644 index 46ef320469e..00000000000 --- a/icu4c/source/common/unicode/ppalmos.h +++ /dev/null @@ -1,260 +0,0 @@ -/* -****************************************************************************** -* -* Copyright (C) 1997-2011, International Business Machines -* Corporation and others. All Rights Reserved. -* -****************************************************************************** -* -* FILE NAME : ppalmos.h -* -* Date Name Description -* 05/10/04 Ken Krugler Creation (copied from pwin32.h & modified). -****************************************************************************** -*/ - -#ifndef U_PPALMOS_H -#define U_PPALMOS_H - - /** - * \file - * \brief Configuration constants for the Palm OS platform - */ - -/* Define the platform we're on. */ -#ifndef U_PALMOS -#define U_PALMOS -#endif - -/* _MSC_VER is used to detect the Microsoft compiler. */ -#if defined(_MSC_VER) -#define U_INT64_IS_LONG_LONG 0 -#else -#define U_INT64_IS_LONG_LONG 1 -#endif - -/* Define whether inttypes.h is available */ -#ifndef U_HAVE_INTTYPES_H -#define U_HAVE_INTTYPES_H 1 -#endif - -/* - * Define what support for C++ streams is available. - * If U_IOSTREAM_SOURCE is set to 199711, then is available - * (1997711 is the date the ISO/IEC C++ FDIS was published), and then - * one should qualify streams using the std namespace in ICU header - * files. - * If U_IOSTREAM_SOURCE is set to 198506, then is - * available instead (198506 is the date when Stroustrup published - * "An Extensible I/O Facility for C++" at the summer USENIX conference). - * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and - * support for them will be silently suppressed in ICU. - * - */ - -#ifndef U_IOSTREAM_SOURCE -#define U_IOSTREAM_SOURCE 199711 -#endif - -/* Determines whether specific types are available */ -#ifndef U_HAVE_INT8_T -#define U_HAVE_INT8_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT8_T -#define U_HAVE_UINT8_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_INT16_T -#define U_HAVE_INT16_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT16_T -#define U_HAVE_UINT16_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_INT32_T -#define U_HAVE_INT32_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT32_T -#define U_HAVE_UINT32_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_INT64_T -#define U_HAVE_INT64_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT64_T -#define U_HAVE_UINT64_T U_HAVE_INTTYPES_H -#endif - - -/*===========================================================================*/ -/* Generic data types */ -/*===========================================================================*/ - -/* If your platform does not have the header, you may - need to edit the typedefs below. */ -#if U_HAVE_INTTYPES_H -#include -#else /* U_HAVE_INTTYPES_H */ - -#if ! U_HAVE_INT8_T -typedef signed char int8_t; -#endif - -#if ! U_HAVE_UINT8_T -typedef unsigned char uint8_t; -#endif - -#if ! U_HAVE_INT16_T -typedef signed short int16_t; -#endif - -#if ! U_HAVE_UINT16_T -typedef unsigned short uint16_t; -#endif - -#if ! U_HAVE_INT32_T -typedef signed int int32_t; -#endif - -#if ! U_HAVE_UINT32_T -typedef unsigned int uint32_t; -#endif - -#if ! U_HAVE_INT64_T -#if U_INT64_IS_LONG_LONG - typedef signed long long int64_t; -#else - typedef signed __int64 int64_t; -#endif -#endif - -#if ! U_HAVE_UINT64_T -#if U_INT64_IS_LONG_LONG - typedef unsigned long long uint64_t; -#else - typedef unsigned __int64 uint64_t; -#endif -#endif -#endif - -/*===========================================================================*/ -/* Compiler and environment features */ -/*===========================================================================*/ - -/* Determines the endianness of the platform */ -#define U_IS_BIG_ENDIAN 0 - -/* 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ -#define ICU_USE_THREADS 1 - -#ifndef U_DEBUG -#ifdef _DEBUG -#define U_DEBUG 1 -#else -#define U_DEBUG 0 -#endif -#endif - -#ifndef U_RELEASE -#ifdef NDEBUG -#define U_RELEASE 1 -#else -#define U_RELEASE 0 -#endif -#endif - -/* Determine whether to disable renaming or not. This overrides the - setting in umachine.h which is for all platforms. */ -#ifndef U_DISABLE_RENAMING -#define U_DISABLE_RENAMING 0 -#endif - -/* Determine whether to override new and delete. */ -#ifndef U_OVERRIDE_CXX_ALLOCATION -#define U_OVERRIDE_CXX_ALLOCATION 1 -#endif -/* Determine whether to override placement new and delete for STL. */ -#ifndef U_HAVE_PLACEMENT_NEW -#define U_HAVE_PLACEMENT_NEW 0 -#endif -/* Determine whether to override new and delete for MFC. */ -#if !defined(U_HAVE_DEBUG_LOCATION_NEW) && defined(_MSC_VER) -#define U_HAVE_DEBUG_LOCATION_NEW 0 -#endif - -/* Determine whether to enable tracing. */ -#ifndef U_ENABLE_TRACING -#define U_ENABLE_TRACING 1 -#endif - -/* Do we allow ICU users to use the draft APIs by default? */ -#ifndef U_DEFAULT_SHOW_DRAFT -#define U_DEFAULT_SHOW_DRAFT 1 -#endif - -/* Define the library suffix in a C syntax. */ -#define U_HAVE_LIB_SUFFIX 0 -#define U_LIB_SUFFIX_C_NAME -#define U_LIB_SUFFIX_C_NAME_STRING "" - -/*===========================================================================*/ -/* Information about wchar support */ -/*===========================================================================*/ - -#define U_HAVE_WCHAR_H 1 -#define U_SIZEOF_WCHAR_T 2 - -#define U_HAVE_WCSCPY 0 - -/*===========================================================================*/ -/* Information about POSIX support */ -/*===========================================================================*/ - - -/* TODO: Fix Palm OS's determination of a timezone */ -#if 0 -#define U_TZSET _tzset -#endif -#if 0 -#define U_TIMEZONE _timezone -#endif -#if 0 -#define U_TZNAME _tzname -#endif - -#define U_HAVE_MMAP 0 -#define U_HAVE_POPEN 0 - -/*===========================================================================*/ -/* Symbol import-export control */ -/*===========================================================================*/ - -#define U_EXPORT -#define U_EXPORT2 -#define U_IMPORT - -/*===========================================================================*/ -/* Code alignment */ -/*===========================================================================*/ - -#if defined(_MSC_VER) && defined(_M_IX86) -#define U_ALIGN_CODE(val) __asm align val -#else -#define U_ALIGN_CODE(val) -#endif - - -/*===========================================================================*/ -/* Programs used by ICU code */ -/*===========================================================================*/ - -#ifndef U_MAKE -#define U_MAKE "nmake" -#define U_MAKE_IS_NMAKE 1 -#endif - -#endif diff --git a/icu4c/source/common/unicode/ptypes.h b/icu4c/source/common/unicode/ptypes.h index 1f34d2f84e4..008e3bdcd77 100644 --- a/icu4c/source/common/unicode/ptypes.h +++ b/icu4c/source/common/unicode/ptypes.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1997-2010, International Business Machines +* Copyright (C) 1997-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -28,29 +28,37 @@ /* Generic data types */ /*===========================================================================*/ -/* If your platform does not have the header, you may - need to edit the typedefs below. */ -#if U_HAVE_INTTYPES_H +/* If your platform does not have the header, you may + need to edit the typedefs in the #else section below. + Use #if...#else...#endif with predefined compiler macros if possible. */ +#if U_HAVE_STDINT_H -/* autoconf 2.13 sometimes can't properly find the data types in */ -/* os/390 needs , but it doesn't have int8_t, and it sometimes */ -/* doesn't have uint8_t depending on the OS version. */ -/* So we have this work around. */ -#ifdef OS390 +/* + * We mostly need (which defines the standard integer types) but not . + * includes and adds the printf/scanf helpers PRId32, SCNx16 etc. + * which we almost never use, plus stuff like imaxabs() which we never use. + */ +#include + +/* z/OS has , but some versions are missing int8_t and/or uint8_t (APAR PK62248). */ +#if U_PLATFORM == U_PF_OS390 /* The features header is needed to get (u)int64_t sometimes. */ #include -#if ! U_HAVE_INT8_T +#if !defined(__int8_t) +#define __int8_t 1 typedef signed char int8_t; #endif #if !defined(__uint8_t) #define __uint8_t 1 typedef unsigned char uint8_t; #endif -#endif /* OS390 */ +#endif /* U_PLATFORM == U_PF_OS390 */ + +#elif U_HAVE_INTTYPES_H -#include +# include -#else /* U_HAVE_INTTYPES_H */ +#else /* neither U_HAVE_STDINT_H nor U_HAVE_INTTYPES_H */ #if ! U_HAVE_INT8_T typedef signed char int8_t; @@ -77,16 +85,21 @@ typedef unsigned int uint32_t; #endif #if ! U_HAVE_INT64_T +#ifdef _MSC_VER + typedef signed __int64 int64_t; +#else typedef signed long long int64_t; -/* else we may not have a 64-bit type */ +#endif #endif #if ! U_HAVE_UINT64_T +#ifdef _MSC_VER + typedef unsigned __int64 uint64_t; +#else typedef unsigned long long uint64_t; -/* else we may not have a 64-bit type */ +#endif #endif -#endif /* U_HAVE_INTTYPES_H */ +#endif /* U_HAVE_STDINT_H / U_HAVE_INTTYPES_H */ #endif /* _PTYPES_H */ - diff --git a/icu4c/source/common/unicode/putil.h b/icu4c/source/common/unicode/putil.h index 090b226f1de..5bd5983f0ab 100644 --- a/icu4c/source/common/unicode/putil.h +++ b/icu4c/source/common/unicode/putil.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1997-2009, International Business Machines +* Copyright (C) 1997-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -122,14 +122,14 @@ U_INTERNAL const char* U_EXPORT2 uprv_getDefaultLocaleID(void); * Example: '/' and ':' on Unix, '\\' and ';' on Windows. * @stable ICU 2.0 */ -#ifdef XP_MAC +#if U_PLATFORM == U_PF_CLASSIC_MACOS # define U_FILE_SEP_CHAR ':' # define U_FILE_ALT_SEP_CHAR ':' # define U_PATH_SEP_CHAR ';' # define U_FILE_SEP_STRING ":" # define U_FILE_ALT_SEP_STRING ":" # define U_PATH_SEP_STRING ";" -#elif defined(U_WINDOWS) +#elif U_PLATFORM_USES_ONLY_WIN32_API # define U_FILE_SEP_CHAR '\\' # define U_FILE_ALT_SEP_CHAR '/' # define U_PATH_SEP_CHAR ';' diff --git a/icu4c/source/common/unicode/pwin32.h b/icu4c/source/common/unicode/pwin32.h deleted file mode 100644 index 7970cb23f93..00000000000 --- a/icu4c/source/common/unicode/pwin32.h +++ /dev/null @@ -1,350 +0,0 @@ -/* - ****************************************************************************** - * - * Copyright (C) 1997-2011, International Business Machines - * Corporation and others. All Rights Reserved. - * - ****************************************************************************** - * - * FILE NAME : platform.h - * - * Date Name Description - * 05/13/98 nos Creation (content moved here from ptypes.h). - * 03/02/99 stephen Added AS400 support. - * 03/30/99 stephen Added Linux support. - * 04/13/99 stephen Reworked for autoconf. - ****************************************************************************** - */ - - /** - * \file - * \brief Configuration constants for the Windows platform - */ - -/** Define the platform we're on. */ -#ifndef U_WINDOWS -#define U_WINDOWS -#endif - -#if defined(__BORLANDC__) -#define U_HAVE_PLACEMENT_NEW 0 -#define __STDC_CONSTANT_MACROS -#endif - -/** _MSC_VER is used to detect the Microsoft compiler. */ -#if defined(_MSC_VER) -#define U_INT64_IS_LONG_LONG 0 -#else -#define U_INT64_IS_LONG_LONG 1 -#endif - -/** Define whether inttypes.h is available */ -#ifndef U_HAVE_INTTYPES_H -# if defined(__BORLANDC__) -# define U_HAVE_INTTYPES_H 1 -# else -# define U_HAVE_INTTYPES_H 0 -# endif -#endif - -/** - * Define what support for C++ streams is available. - * If U_IOSTREAM_SOURCE is set to 199711, then <iostream> is available - * (1997711 is the date the ISO/IEC C++ FDIS was published), and then - * one should qualify streams using the std namespace in ICU header - * files. - * If U_IOSTREAM_SOURCE is set to 198506, then <iostream.h> is - * available instead (198506 is the date when Stroustrup published - * "An Extensible I/O Facility for C++" at the summer USENIX conference). - * If U_IOSTREAM_SOURCE is 0, then C++ streams are not available and - * support for them will be silently suppressed in ICU. - * - */ - -#ifndef U_IOSTREAM_SOURCE -#define U_IOSTREAM_SOURCE 199711 -#endif - -/** @{ - * Determines whether specific types are available */ -#ifndef U_HAVE_INT8_T -#define U_HAVE_INT8_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT8_T -#define U_HAVE_UINT8_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_INT16_T -#define U_HAVE_INT16_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT16_T -#define U_HAVE_UINT16_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_INT32_T -#define U_HAVE_INT32_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT32_T -#define U_HAVE_UINT32_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_INT64_T -#define U_HAVE_INT64_T U_HAVE_INTTYPES_H -#endif - -#ifndef U_HAVE_UINT64_T -#define U_HAVE_UINT64_T U_HAVE_INTTYPES_H -#endif - -/** @} */ - -/** Define 64 bit limits */ -#if !U_INT64_IS_LONG_LONG -# ifndef INT64_C -# define INT64_C(x) ((int64_t)x) -# endif -# ifndef UINT64_C -# define UINT64_C(x) ((uint64_t)x) -# endif -/** else use the umachine.h definition */ -#endif - -/*===========================================================================*/ -/** @{ - * Generic data types */ -/*===========================================================================*/ - -/** If your platform does not have the header, you may - need to edit the typedefs below. */ -#if U_HAVE_INTTYPES_H -#include -#else /* U_HAVE_INTTYPES_H */ - -#if ! U_HAVE_INT8_T -typedef signed char int8_t; -#endif - -#if ! U_HAVE_UINT8_T -typedef unsigned char uint8_t; -#endif - -#if ! U_HAVE_INT16_T -typedef signed short int16_t; -#endif - -#if ! U_HAVE_UINT16_T -typedef unsigned short uint16_t; -#endif - -#if ! U_HAVE_INT32_T -typedef signed int int32_t; -#endif - -#if ! U_HAVE_UINT32_T -typedef unsigned int uint32_t; -#endif - -#if ! U_HAVE_INT64_T -#if U_INT64_IS_LONG_LONG - typedef signed long long int64_t; -#else - typedef signed __int64 int64_t; -#endif -#endif - -#if ! U_HAVE_UINT64_T -#if U_INT64_IS_LONG_LONG - typedef unsigned long long uint64_t; -#else - typedef unsigned __int64 uint64_t; -#endif -#endif -#endif - -/** - * @} - */ - -/*===========================================================================*/ -/** Compiler and environment features */ -/*===========================================================================*/ - -/** Determines the endianness of the platform */ -#define U_IS_BIG_ENDIAN 0 - -/** 1 or 0 to enable or disable threads. If undefined, default is: enable threads. */ -#ifndef ICU_USE_THREADS -#define ICU_USE_THREADS 1 -#endif - -/** 0 or 1 to enable or disable auto cleanup of libraries. If undefined, default is: disabled. */ -#ifndef UCLN_NO_AUTO_CLEANUP -#define UCLN_NO_AUTO_CLEANUP 1 -#endif - -/** Enable or disable debugging options **/ -#ifndef U_DEBUG -#ifdef _DEBUG -#define U_DEBUG 1 -#else -#define U_DEBUG 0 -#endif -#endif - -/** Enable or disable release options **/ -#ifndef U_RELEASE -#ifdef NDEBUG -#define U_RELEASE 1 -#else -#define U_RELEASE 0 -#endif -#endif - -/** Determine whether to disable renaming or not. This overrides the - setting in umachine.h which is for all platforms. */ -#ifndef U_DISABLE_RENAMING -#define U_DISABLE_RENAMING 0 -#endif - -/** Determine whether to override new and delete. */ -#ifndef U_OVERRIDE_CXX_ALLOCATION -#define U_OVERRIDE_CXX_ALLOCATION 1 -#endif -/** Determine whether to override placement new and delete for STL. */ -#ifndef U_HAVE_PLACEMENT_NEW -#define U_HAVE_PLACEMENT_NEW 1 -#endif -/** Determine whether to override new and delete for MFC. */ -#if !defined(U_HAVE_DEBUG_LOCATION_NEW) && defined(_MSC_VER) -#define U_HAVE_DEBUG_LOCATION_NEW 1 -#endif - -/** Determine whether to enable tracing. */ -#ifndef U_ENABLE_TRACING -#define U_ENABLE_TRACING 0 -#endif - -/** Do we allow ICU users to use the draft APIs by default? */ -#ifndef U_DEFAULT_SHOW_DRAFT -#define U_DEFAULT_SHOW_DRAFT 1 -#endif - -/** @{ Define the library suffix in a C syntax. */ -#ifndef U_HAVE_LIB_SUFFIX -#define U_HAVE_LIB_SUFFIX 0 -#endif -#ifndef U_LIB_SUFFIX_C_NAME -#define U_LIB_SUFFIX_C_NAME -#endif -#ifndef U_LIB_SUFFIX_C_NAME_STRING -#define U_LIB_SUFFIX_C_NAME_STRING "" -#endif -/** @} */ - -/*===========================================================================*/ -/** @{ Information about wchar support */ -/*===========================================================================*/ - -#define U_HAVE_WCHAR_H 1 -#define U_SIZEOF_WCHAR_T 2 - -#define U_HAVE_WCSCPY 1 - -/** @} */ - -/** - * \def U_DECLARE_UTF16 - * Do not use this macro. Use the UNICODE_STRING or U_STRING_DECL macros - * instead. - * @internal - */ -#if 1 -#define U_DECLARE_UTF16(string) L ## string -#endif - -/*===========================================================================*/ -/** @{ Information about POSIX support */ -/*===========================================================================*/ - -/** - * @internal - */ -#if 1 -#define U_TZSET _tzset -#endif -/** - * @internal - */ -#if 1 -#define U_TIMEZONE _timezone -#endif -/** - * @internal - */ -#if 1 -#define U_TZNAME _tzname -#endif -/** - * @internal - */ -#if 1 -#define U_DAYLIGHT _daylight -#endif - -#define U_HAVE_MMAP 0 -#define U_HAVE_POPEN 0 - -#ifndef U_ENABLE_DYLOAD -#define U_ENABLE_DYLOAD 1 -#endif - - -/** @} */ - -/*===========================================================================*/ -/** @{ Symbol import-export control */ -/*===========================================================================*/ - -#ifdef U_STATIC_IMPLEMENTATION -#define U_EXPORT -#else -#define U_EXPORT __declspec(dllexport) -#endif -#define U_EXPORT2 __cdecl -#define U_IMPORT __declspec(dllimport) -/** @} */ - -/*===========================================================================*/ -/** @{ Code alignment */ -/*===========================================================================*/ - -#if defined(_MSC_VER) && defined(_M_IX86) && !defined(_MANAGED) -#define U_ALIGN_CODE(val) __asm align val -#else -#define U_ALIGN_CODE(val) -#endif - -/** - * Flag for workaround of MSVC 2003 optimization bugs - */ -#if defined(_MSC_VER) && (_MSC_VER < 1400) -#define U_HAVE_MSVC_2003_OR_EARLIER -#endif - - -/** @} */ - -/*===========================================================================*/ -/** @{ Programs used by ICU code */ -/*===========================================================================*/ - -#ifndef U_MAKE -#define U_MAKE "nmake" -#define U_MAKE_IS_NMAKE 1 -#endif - -/** @} */ - diff --git a/icu4c/source/common/unicode/std_string.h b/icu4c/source/common/unicode/std_string.h index 2cd403ba988..67b1d6c5aad 100644 --- a/icu4c/source/common/unicode/std_string.h +++ b/icu4c/source/common/unicode/std_string.h @@ -25,15 +25,6 @@ #include "unicode/utypes.h" -/** - * \def U_HAVE_STD_STRING - * Define whether the standard C++ (STL) <string> header is available. - * @internal - */ -#ifndef U_HAVE_STD_STRING -#define U_HAVE_STD_STRING 1 -#endif - #if U_HAVE_STD_STRING #include diff --git a/icu4c/source/common/unicode/uconfig.h b/icu4c/source/common/unicode/uconfig.h index f7546bfc877..4a9f55c0b7c 100644 --- a/icu4c/source/common/unicode/uconfig.h +++ b/icu4c/source/common/unicode/uconfig.h @@ -18,9 +18,17 @@ /*! * \file - * \brief Switches for excluding parts of ICU library code modules. + * \brief User-configurable settings * - * Allows to build partial, smaller libraries for special purposes. + * Miscellaneous switches: + * + * A number of macros affect a variety of minor aspects of ICU. + * Most of them used to be defined elsewhere (e.g., in utypes.h or platform.h) + * and moved here to make them easier to find. + * + * Switches for excluding parts of ICU library code modules: + * + * Changing these macros allows building partial, smaller libraries for special purposes. * By default, all modules are built. * The switches are fairly coarse, controlling large modules. * Basic services cannot be turned off. @@ -38,14 +46,177 @@ /** * If this switch is defined, ICU will attempt to load a header file named "uconfig_local.h" * prior to determining default settings for uconfig variables. - * + * * @internal ICU 4.0 - * */ #if defined(UCONFIG_USE_LOCAL) #include "uconfig_local.h" #endif +/** + * \def U_DEBUG + * Determines whether to include debugging code. + * Automatically set on Windows, but most compilers do not have + * related predefined macros. + * @internal + */ +#ifdef U_DEBUG + /* Use the predefined value. */ +#elif defined(_DEBUG) + /* + * _DEBUG is defined by Visual Studio debug compilation. + * Do *not* test for its NDEBUG macro: It is an orthogonal macro + * which disables assert(). + */ +# define U_DEBUG 1 +#elif defined(U_RELEASE) +# define U_DEBUG (!U_RELEASE) +# else +# define U_DEBUG 0 +#endif + +/** + * \def U_DEBUG + * Opposite of U_DEBUG. + * @internal + */ +#ifndef U_RELEASE +#define U_RELEASE (!U_DEBUG) +#endif + +/** + * Determines wheter to enable auto cleanup of libraries. + * @internal + */ +#ifndef UCLN_NO_AUTO_CLEANUP +#define UCLN_NO_AUTO_CLEANUP 1 +#endif + +/** + * \def ICU_USE_THREADS + * + * Allows thread support (use of mutexes) to be compiled out of ICU. + * Default: use threads. + * + * Even with thread support compiled out, applications may override the + * (empty) mutex implementation with the u_setMutexFunctions() functions. + * @internal + */ +#ifdef ICU_USE_THREADS + /* Use the predefined value. */ +#elif defined(APP_NO_THREADS) + /* APP_NO_THREADS is an old symbol. We'll honour it if present. */ +# define ICU_USE_THREADS 0 +#else +# define ICU_USE_THREADS 1 +#endif + +/** + * \def U_DISABLE_RENAMING + * Determines whether to disable renaming or not. + * @internal + */ +#ifndef U_DISABLE_RENAMING +#define U_DISABLE_RENAMING 0 +#endif + +/** + * \def U_OVERRIDE_CXX_ALLOCATION + * Determines whether to override new and delete. + * ICU is normally built such that all of its C++ classes, via their UMemory base, + * override operators new and delete to use its internal, customizable, + * non-exception-throwing memory allocation functions. (Default value 1 for this macro.) + * + * This is especially important when the application and its libraries use multiple heaps. + * For example, on Windows, this allows the ICU DLL to be used by + * applications that statically link the C Runtime library. + * + * @stable ICU 2.2 + */ +#ifndef U_OVERRIDE_CXX_ALLOCATION +#define U_OVERRIDE_CXX_ALLOCATION 1 +#endif + +/** + * \def U_ENABLE_TRACING + * Determines whether to enable tracing. + * @internal + */ +#ifndef U_ENABLE_TRACING +#define U_ENABLE_TRACING 0 +#endif + +/** + * \def U_ENABLE_DYLOAD + * Whether to enable Dynamic loading in ICU. + * @internal + */ +#ifndef U_ENABLE_DYLOAD +#define U_ENABLE_DYLOAD 1 +#endif + +/** + * \def U_CHECK_DYLOAD + * Whether to test Dynamic loading as an OS capability. + * @internal + */ +#ifndef U_CHECK_DYLOAD +#define U_CHECK_DYLOAD 1 +#endif + + +/** + * \def U_DEFAULT_SHOW_DRAFT + * Do we allow ICU users to use the draft APIs by default? + * @internal + */ +#ifndef U_DEFAULT_SHOW_DRAFT +#define U_DEFAULT_SHOW_DRAFT 1 +#endif + +/*===========================================================================*/ +/* Custom icu entry point renaming */ +/*===========================================================================*/ + +/** + * \def U_HAVE_LIB_SUFFIX + * 1 if a custom library suffix is set. + * @internal + */ +#ifdef U_HAVE_LIB_SUFFIX + /* Use the predefined value. */ +#elif defined(U_LIB_SUFFIX_C_NAME) || defined(U_LIB_SUFFIX_C_NAME_STRING) +# define U_HAVE_LIB_SUFFIX 1 +#else +# define U_HAVE_LIB_SUFFIX 0 +#endif + +/** + * \def U_LIB_SUFFIX_C_NAME_STRING + * Defines the library suffix as a string with C syntax. + * @internal + */ +#ifdef U_LIB_SUFFIX_C_NAME_STRING + /* Use the predefined value. */ +#elif defined(U_LIB_SUFFIX_C_NAME) +# define U_LIB_SUFFIX_C_NAME_STRING #U_LIB_SUFFIX_C_NAME +#else +# define U_LIB_SUFFIX_C_NAME_STRING "" +#endif + +/** + * \def U_LIB_SUFFIX_C_NAME + * Defines the library suffix with C syntax. + * @internal + */ +#ifdef U_LIB_SUFFIX_C_NAME + /* Use the predefined value. */ +#else +# define U_LIB_SUFFIX_C_NAME +#endif + +/* common/i18n library switches --------------------------------------------- */ + /** * \def UCONFIG_ONLY_COLLATION * This switch turns off modules that are not needed for collation. diff --git a/icu4c/source/common/unicode/umachine.h b/icu4c/source/common/unicode/umachine.h index afd32b0e58c..cd742ec43ba 100644 --- a/icu4c/source/common/unicode/umachine.h +++ b/icu4c/source/common/unicode/umachine.h @@ -41,22 +41,7 @@ /* which are contained in the platform-specific file platform.h */ /*==========================================================================*/ -#if defined(U_PALMOS) -# include "unicode/ppalmos.h" -#elif !defined(__MINGW32__) && (defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64)) -/* - * platform.h is now also generated by MSVC Solution/Project files - * from platform.win and should always be included unless you are - * building stubdata which is built before the platform.h file is - * generated. - */ -#ifndef STUBDATA_BUILD -# include "unicode/platform.h" -#endif -# include "unicode/pwin32.h" -#else -# include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ -#endif +#include "unicode/ptypes.h" /* platform.h is included in ptypes.h */ /* * ANSI C headers: @@ -64,19 +49,6 @@ */ #include -/*==========================================================================*/ -/* XP_CPLUSPLUS is a cross-platform symbol which should be defined when */ -/* using C++. It should not be defined when compiling under C. */ -/*==========================================================================*/ - -#ifdef __cplusplus -# ifndef XP_CPLUSPLUS -# define XP_CPLUSPLUS -# endif -#else -# undef XP_CPLUSPLUS -#endif - /*==========================================================================*/ /* For C wrappers, we use the symbol U_STABLE. */ /* This works properly if the includer is C or C++. */ @@ -101,7 +73,7 @@ * @stable ICU 2.4 */ -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus # define U_CFUNC extern "C" # define U_CDECL_BEGIN extern "C" { # define U_CDECL_END } @@ -124,7 +96,7 @@ * This is used for Visual C++ specific attributes * @internal */ -#elif defined(U_WINDOWS) && defined(_MSC_VER) && (_MSC_VER >= 1400) +#elif defined(_MSC_VER) && (_MSC_VER >= 1400) # define U_ATTRIBUTE_DEPRECATED __declspec(deprecated) #else # define U_ATTRIBUTE_DEPRECATED @@ -243,27 +215,6 @@ typedef int8_t UBool; /* wchar_t-related definitions -------------------------------------------- */ -/** - * \def U_HAVE_WCHAR_H - * Indicates whether is available (1) or not (0). Set to 1 by default. - * - * @stable ICU 2.0 - */ -#ifndef U_HAVE_WCHAR_H -# define U_HAVE_WCHAR_H 1 -#endif - -/** - * \def U_SIZEOF_WCHAR_T - * U_SIZEOF_WCHAR_T==sizeof(wchar_t) (0 means it is not defined or autoconf could not set it) - * - * @stable ICU 2.0 - */ -#if U_SIZEOF_WCHAR_T==0 -# undef U_SIZEOF_WCHAR_T -# define U_SIZEOF_WCHAR_T 4 -#endif - /* * \def U_WCHAR_IS_UTF16 * Defined if wchar_t uses UTF-16. @@ -284,14 +235,16 @@ typedef int8_t UBool; # define U_WCHAR_IS_UTF32 # endif # elif defined __UCS2__ -# if (__OS390__ || __OS400__) && (U_SIZEOF_WCHAR_T==2) +# if (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) && (U_SIZEOF_WCHAR_T==2) # define U_WCHAR_IS_UTF16 # endif -# elif defined __UCS4__ +# elif defined(__UCS4__) || (U_PLATFORM == U_PF_OS400 && defined(__UTF32__)) # if (U_SIZEOF_WCHAR_T==4) # define U_WCHAR_IS_UTF32 # endif -# elif defined(U_WINDOWS) +# elif U_PLATFORM_IS_DARWIN_BASED || (U_SIZEOF_WCHAR_T==4 && U_PLATFORM_IS_LINUX_BASED) +# define U_WCHAR_IS_UTF32 +# elif U_PLATFORM_HAS_WIN32_API # define U_WCHAR_IS_UTF16 # endif #endif @@ -303,9 +256,10 @@ typedef int8_t UBool; /** * \var UChar - * Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned. - * If wchar_t is not 16 bits wide, then define UChar to be uint16_t or char16_t because GCC >=4.4 - * can handle UTF16 string literals. + * Define UChar to be char16_t, if available, + * or wchar_t if that is 16 bits wide; always assumed to be unsigned. + * If neither is available, then define UChar to be uint16_t. + * * This makes the definition of UChar platform-dependent * but allows direct string type compatibility with platforms with * 16-bit wchar_t types. @@ -313,14 +267,13 @@ typedef int8_t UBool; * @draft ICU 4.4 */ -/* Define UChar to be compatible with wchar_t if possible. */ -#if U_SIZEOF_WCHAR_T==2 - typedef wchar_t UChar; -#elif U_GNUC_UTF16_STRING -#if defined _GCC_ - typedef __CHAR16_TYPE__ char16_t; -#endif +/* Define UChar to be compatible with char16_t or wchar_t if possible. */ +#if U_HAVE_CHAR16_T typedef char16_t UChar; +#elif U_SIZEOF_WCHAR_T==2 + typedef wchar_t UChar; +#elif defined(__CHAR16_TYPE__) + typedef __CHAR16_TYPE__ UChar; #else typedef uint16_t UChar; #endif @@ -344,27 +297,6 @@ typedef int8_t UBool; */ typedef int32_t UChar32; -/*==========================================================================*/ -/* U_ALIGN_CODE Set default values if these are not already */ -/* defined. Definitions normally are in */ -/* platform.h or the corresponding file for */ -/* the OS in use. */ -/*==========================================================================*/ - -#ifndef U_HIDE_INTERNAL_API - -/** - * \def U_ALIGN_CODE - * This is used to align code fragments to a specific byte boundary. - * This is useful for getting consistent performance test results. - * @internal - */ -#ifndef U_ALIGN_CODE -# define U_ALIGN_CODE(n) -#endif - -#endif /* U_HIDE_INTERNAL_API */ - #include "unicode/urename.h" #endif diff --git a/icu4c/source/common/unicode/uobject.h b/icu4c/source/common/unicode/uobject.h index 27d4c84da5b..95f4ef576f1 100644 --- a/icu4c/source/common/unicode/uobject.h +++ b/icu4c/source/common/unicode/uobject.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 2002-2010, International Business Machines +* Copyright (C) 2002-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -19,50 +19,11 @@ #include "unicode/utypes.h" -U_NAMESPACE_BEGIN - /** * \file * \brief C++ API: Common ICU base class UObject. */ -/** U_OVERRIDE_CXX_ALLOCATION - Define this to override operator new and - * delete in UMemory. Enabled by default for ICU. - * - * Enabling forces all allocation of ICU object types to use ICU's - * memory allocation. On Windows, this allows the ICU DLL to be used by - * applications that statically link the C Runtime library, meaning that - * the app and ICU will be using different heaps. - * - * @stable ICU 2.2 - */ -#ifndef U_OVERRIDE_CXX_ALLOCATION -#define U_OVERRIDE_CXX_ALLOCATION 1 -#endif - -/** - * \def U_HAVE_PLACEMENT_NEW - * Define this to define the placement new and - * delete in UMemory for STL. - * - * @stable ICU 2.6 - */ -#ifndef U_HAVE_PLACEMENT_NEW -#define U_HAVE_PLACEMENT_NEW 1 -#endif - - -/** - * \def U_HAVE_DEBUG_LOCATION_NEW - * Define this to define the MFC debug - * version of the operator new. - * - * @stable ICU 3.4 - */ -#ifndef U_HAVE_DEBUG_LOCATION_NEW -#define U_HAVE_DEBUG_LOCATION_NEW 0 -#endif - /** * @{ * \def U_NO_THROW @@ -76,13 +37,66 @@ U_NAMESPACE_BEGIN * data, (which it typically does), the result is a segmentation violation. * * @draft ICU 4.2 - */ + */ #ifndef U_NO_THROW #define U_NO_THROW throw() #endif /** @} */ +/*===========================================================================*/ +/* UClassID-based RTTI */ +/*===========================================================================*/ + +/** + * UClassID is used to identify classes without using the compiler's RTTI. + * This was used before C++ compilers consistently supported RTTI. + * ICU 4.6 requires compiler RTTI to be turned on. + * + * Each class hierarchy which needs + * to implement polymorphic clone() or operator==() defines two methods, + * described in detail below. UClassID values can be compared using + * operator==(). Nothing else should be done with them. + * + * \par + * getDynamicClassID() is declared in the base class of the hierarchy as + * a pure virtual. Each concrete subclass implements it in the same way: + * + * \code + * class Base { + * public: + * virtual UClassID getDynamicClassID() const = 0; + * } + * + * class Derived { + * public: + * virtual UClassID getDynamicClassID() const + * { return Derived::getStaticClassID(); } + * } + * \endcode + * + * Each concrete class implements getStaticClassID() as well, which allows + * clients to test for a specific type. + * + * \code + * class Derived { + * public: + * static UClassID U_EXPORT2 getStaticClassID(); + * private: + * static char fgClassID; + * } + * + * // In Derived.cpp: + * UClassID Derived::getStaticClassID() + * { return (UClassID)&Derived::fgClassID; } + * char Derived::fgClassID = 0; // Value is irrelevant + * \endcode + * @stable ICU 2.0 + */ +typedef void* UClassID; + +U_NAMESPACE_BEGIN + /** * UMemory is the common ICU base class. * All other ICU C++ classes are derived from UMemory (starting with ICU 2.4). diff --git a/icu4c/source/common/unicode/utypes.h b/icu4c/source/common/unicode/utypes.h index 1face48bce4..f9641c677a7 100644 --- a/icu4c/source/common/unicode/utypes.h +++ b/icu4c/source/common/unicode/utypes.h @@ -54,7 +54,7 @@ * \def U_SHOW_CPLUSPLUS_API * @internal */ -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus # ifndef U_SHOW_CPLUSPLUS_API # define U_SHOW_CPLUSPLUS_API 1 # endif @@ -104,94 +104,6 @@ /** @} */ - -/*===========================================================================*/ -/* char Character set family */ -/*===========================================================================*/ - -/** - * U_CHARSET_FAMILY is equal to this value when the platform is an ASCII based platform. - * @stable ICU 2.0 - */ -#define U_ASCII_FAMILY 0 - -/** - * U_CHARSET_FAMILY is equal to this value when the platform is an EBCDIC based platform. - * @stable ICU 2.0 - */ -#define U_EBCDIC_FAMILY 1 - -/** - * \def U_CHARSET_FAMILY - * - *

These definitions allow to specify the encoding of text - * in the char data type as defined by the platform and the compiler. - * It is enough to determine the code point values of "invariant characters", - * which are the ones shared by all encodings that are in use - * on a given platform.

- * - *

Those "invariant characters" should be all the uppercase and lowercase - * latin letters, the digits, the space, and "basic punctuation". - * Also, '\\n', '\\r', '\\t' should be available.

- * - *

The list of "invariant characters" is:
- * \code - * A-Z a-z 0-9 SPACE " % & ' ( ) * + , - . / : ; < = > ? _ - * \endcode - *
- * (52 letters + 10 numbers + 20 punc/sym/space = 82 total)

- * - *

This matches the IBM Syntactic Character Set (CS 640).

- * - *

In other words, all the graphic characters in 7-bit ASCII should - * be safely accessible except the following:

- * - * \code - * '\' - * '[' - * ']' - * '{' - * '}' - * '^' - * '~' - * '!' - * '#' - * '|' - * '$' - * '@' - * '`' - * \endcode - * @stable ICU 2.0 - */ - -#ifndef U_CHARSET_FAMILY -# define U_CHARSET_FAMILY 0 -#endif - -/** - * \def U_CHARSET_IS_UTF8 - * - * Hardcode the default charset to UTF-8. - * - * If this is set to 1, then - * - ICU will assume that all non-invariant char*, StringPiece, std::string etc. - * contain UTF-8 text, regardless of what the system API uses - * - some ICU code will use fast functions like u_strFromUTF8() - * rather than the more general and more heavy-weight conversion API (ucnv.h) - * - ucnv_getDefaultName() always returns "UTF-8" - * - ucnv_setDefaultName() is disabled and will not change the default charset - * - static builds of ICU are smaller - * - more functionality is available with the UCONFIG_NO_CONVERSION build-time - * configuration option (see unicode/uconfig.h) - * - the UCONFIG_NO_CONVERSION build option in uconfig.h is more usable - * - * @stable ICU 4.2 - * @see UCONFIG_NO_CONVERSION - */ -#ifndef U_CHARSET_IS_UTF8 -# define U_CHARSET_IS_UTF8 0 -#endif - /*===========================================================================*/ /* ICUDATA naming scheme */ /*===========================================================================*/ @@ -270,30 +182,13 @@ #define U_DEF_ICUDATA_ENTRY_POINT(major) icudt##major##_dat #endif -/** - * \def U_CALLCONV - * Similar to U_CDECL_BEGIN/U_CDECL_END, this qualifier is necessary - * in callback function typedefs to make sure that the calling convention - * is compatible. - * - * This is only used for non-ICU-API functions. - * When a function is a public ICU API, - * you must use the U_CAPI and U_EXPORT2 qualifiers. - * @stable ICU 2.0 - */ -#if defined(OS390) && defined(XP_CPLUSPLUS) -# define U_CALLCONV __cdecl -#else -# define U_CALLCONV U_EXPORT2 -#endif - /** * \def NULL * Define NULL if necessary, to 0 for C++ and to ((void *)0) for C. * @stable ICU 2.0 */ #ifndef NULL -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus #define NULL 0 #else #define NULL ((void *)0) @@ -334,56 +229,6 @@ typedef double UDate; */ #define U_DATE_MIN -U_DATE_MAX - - -/*===========================================================================*/ -/* UClassID-based RTTI */ -/*===========================================================================*/ - -/** - * UClassID is used to identify classes without using RTTI, since RTTI - * is not yet supported by all C++ compilers. Each class hierarchy which needs - * to implement polymorphic clone() or operator==() defines two methods, - * described in detail below. UClassID values can be compared using - * operator==(). Nothing else should be done with them. - * - * \par - * getDynamicClassID() is declared in the base class of the hierarchy as - * a pure virtual. Each concrete subclass implements it in the same way: - * - * \code - * class Base { - * public: - * virtual UClassID getDynamicClassID() const = 0; - * } - * - * class Derived { - * public: - * virtual UClassID getDynamicClassID() const - * { return Derived::getStaticClassID(); } - * } - * \endcode - * - * Each concrete class implements getStaticClassID() as well, which allows - * clients to test for a specific type. - * - * \code - * class Derived { - * public: - * static UClassID U_EXPORT2 getStaticClassID(); - * private: - * static char fgClassID; - * } - * - * // In Derived.cpp: - * UClassID Derived::getStaticClassID() - * { return (UClassID)&Derived::fgClassID; } - * char Derived::fgClassID = 0; // Value is irrelevant - * \endcode - * @stable ICU 2.0 - */ -typedef void* UClassID; - /*===========================================================================*/ /* Shared library/DLL import-export API control */ /*===========================================================================*/ @@ -560,9 +405,9 @@ typedef void* UClassID; * * Note: This is currently only done on Windows because * some Linux/Unix compilers have problems with defining global new/delete. - * On Windows, U_WINDOWS is defined, and it is _MSC_VER>=1200 for MSVC 6.0 and higher. + * On Windows, it is _MSC_VER>=1200 for MSVC 6.0 and higher. */ -#if defined(XP_CPLUSPLUS) && defined(U_WINDOWS) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION)) +#if defined(__cplusplus) && U_DEBUG && U_OVERRIDE_CXX_ALLOCATION && (_MSC_VER>=1200) && !defined(U_STATIC_IMPLEMENTATION) && (defined(U_COMMON_IMPLEMENTATION) || defined(U_I18N_IMPLEMENTATION) || defined(U_IO_IMPLEMENTATION) || defined(U_LAYOUT_IMPLEMENTATION) || defined(U_LAYOUTEX_IMPLEMENTATION)) #ifndef U_HIDE_INTERNAL_API /** @@ -847,7 +692,7 @@ typedef enum UErrorCode { /* Use the following to determine if an UErrorCode represents */ /* operational success or failure. */ -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus /** * Does the error code indicate success? * @stable ICU 2.0 diff --git a/icu4c/source/common/unicode/uversion.h b/icu4c/source/common/unicode/uversion.h index e53c39f428e..2f259f1c13a 100644 --- a/icu4c/source/common/unicode/uversion.h +++ b/icu4c/source/common/unicode/uversion.h @@ -104,7 +104,7 @@ typedef uint8_t UVersionInfo[U_MAX_VERSION_LENGTH]; */ /* Define namespace symbols if the compiler supports it. */ -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus # if U_DISABLE_RENAMING # define U_ICU_NAMESPACE icu namespace U_ICU_NAMESPACE { } diff --git a/icu4c/source/common/uprops.h b/icu4c/source/common/uprops.h index 2d7febf5f1c..c1667c96b9d 100644 --- a/icu4c/source/common/uprops.h +++ b/icu4c/source/common/uprops.h @@ -412,7 +412,7 @@ uchar_swapNames(const UDataSwapper *ds, const void *inData, int32_t length, void *outData, UErrorCode *pErrorCode); -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus U_NAMESPACE_BEGIN diff --git a/icu4c/source/common/utrie2.h b/icu4c/source/common/utrie2.h index 4e7ead05215..fa8c8f3aa28 100644 --- a/icu4c/source/common/utrie2.h +++ b/icu4c/source/common/utrie2.h @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 2001-2010, International Business Machines +* Copyright (C) 2001-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -618,7 +618,7 @@ U_CDECL_END /* C++ convenience wrappers ------------------------------------------------- */ -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus #include "mutex.h" diff --git a/icu4c/source/common/wintz.c b/icu4c/source/common/wintz.c index bdacef050bd..79a8636f0df 100644 --- a/icu4c/source/common/wintz.c +++ b/icu4c/source/common/wintz.c @@ -11,7 +11,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #include "wintz.h" @@ -287,4 +287,4 @@ uprv_detectWindowsTimeZone() { return icuid; } -#endif /* #ifdef U_WINDOWS */ +#endif /* U_PLATFORM_HAS_WIN32_API */ diff --git a/icu4c/source/common/wintz.h b/icu4c/source/common/wintz.h index 3a06ceb9cf4..081b38db934 100644 --- a/icu4c/source/common/wintz.h +++ b/icu4c/source/common/wintz.h @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2008, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -14,7 +14,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API /** * \file @@ -29,6 +29,6 @@ U_CDECL_END U_CFUNC const char* U_EXPORT2 uprv_detectWindowsTimeZone(); -#endif /* #ifdef U_WINDOWS */ +#endif /* U_PLATFORM_HAS_WIN32_API */ #endif /* __WINTZ */ diff --git a/icu4c/source/configure b/icu4c/source/configure index 9fedf989fd3..6ebe468d3bc 100755 --- a/icu4c/source/configure +++ b/icu4c/source/configure @@ -7839,7 +7839,7 @@ then fi # output the Makefiles -ac_config_files="$ac_config_files icudefs.mk Makefile data/pkgdataMakefile config/Makefile.inc config/icu.pc config/pkgdataMakefile data/Makefile stubdata/Makefile common/Makefile i18n/Makefile layout/Makefile layoutex/Makefile io/Makefile extra/Makefile extra/uconv/Makefile extra/uconv/pkgdataMakefile extra/scrptrun/Makefile tools/Makefile tools/ctestfw/Makefile tools/toolutil/Makefile tools/makeconv/Makefile tools/genrb/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/genctd/Makefile tools/gentest/Makefile tools/gennorm2/Makefile tools/genbrk/Makefile tools/gensprep/Makefile tools/icuinfo/Makefile tools/icupkg/Makefile tools/icuswap/Makefile tools/pkgdata/Makefile tools/tzcode/Makefile tools/gencfu/Makefile test/Makefile test/compat/Makefile test/testdata/Makefile test/testdata/pkgdataMakefile test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/letest/Makefile test/perf/Makefile test/perf/collationperf/Makefile test/perf/dicttrieperf/Makefile test/perf/ubrkperf/Makefile test/perf/charperf/Makefile test/perf/convperf/Makefile test/perf/normperf/Makefile test/perf/DateFmtPerf/Makefile test/perf/strsrchperf/Makefile test/perf/unisetperf/Makefile test/perf/usetperf/Makefile test/perf/ustrperf/Makefile test/perf/utfperf/Makefile test/perf/utrie2perf/Makefile samples/Makefile samples/date/Makefile samples/cal/Makefile samples/layout/Makefile common/unicode/platform.h" +ac_config_files="$ac_config_files icudefs.mk Makefile data/pkgdataMakefile config/Makefile.inc config/icu.pc config/pkgdataMakefile data/Makefile stubdata/Makefile common/Makefile i18n/Makefile layout/Makefile layoutex/Makefile io/Makefile extra/Makefile extra/uconv/Makefile extra/uconv/pkgdataMakefile extra/scrptrun/Makefile tools/Makefile tools/ctestfw/Makefile tools/toolutil/Makefile tools/makeconv/Makefile tools/genrb/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/genctd/Makefile tools/gentest/Makefile tools/gennorm2/Makefile tools/genbrk/Makefile tools/gensprep/Makefile tools/icuinfo/Makefile tools/icupkg/Makefile tools/icuswap/Makefile tools/pkgdata/Makefile tools/tzcode/Makefile tools/gencfu/Makefile test/Makefile test/compat/Makefile test/testdata/Makefile test/testdata/pkgdataMakefile test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/letest/Makefile test/perf/Makefile test/perf/collationperf/Makefile test/perf/dicttrieperf/Makefile test/perf/ubrkperf/Makefile test/perf/charperf/Makefile test/perf/convperf/Makefile test/perf/normperf/Makefile test/perf/DateFmtPerf/Makefile test/perf/strsrchperf/Makefile test/perf/unisetperf/Makefile test/perf/usetperf/Makefile test/perf/ustrperf/Makefile test/perf/utfperf/Makefile test/perf/utrie2perf/Makefile samples/Makefile samples/date/Makefile samples/cal/Makefile samples/layout/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -8596,7 +8596,6 @@ do "samples/date/Makefile") CONFIG_FILES="$CONFIG_FILES samples/date/Makefile" ;; "samples/cal/Makefile") CONFIG_FILES="$CONFIG_FILES samples/cal/Makefile" ;; "samples/layout/Makefile") CONFIG_FILES="$CONFIG_FILES samples/layout/Makefile" ;; - "common/unicode/platform.h") CONFIG_FILES="$CONFIG_FILES common/unicode/platform.h" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac diff --git a/icu4c/source/configure.in b/icu4c/source/configure.in index 62728a3bd4c..455884775fd 100644 --- a/icu4c/source/configure.in +++ b/icu4c/source/configure.in @@ -1418,8 +1418,7 @@ AC_CONFIG_FILES([icudefs.mk \ test/perf/utfperf/Makefile \ test/perf/utrie2perf/Makefile \ samples/Makefile samples/date/Makefile \ - samples/cal/Makefile samples/layout/Makefile \ - common/unicode/platform.h]) + samples/cal/Makefile samples/layout/Makefile]) AC_OUTPUT echo diff --git a/icu4c/source/extra/scrptrun/Makefile.in b/icu4c/source/extra/scrptrun/Makefile.in index c39b7254456..9b338d83871 100644 --- a/icu4c/source/extra/scrptrun/Makefile.in +++ b/icu4c/source/extra/scrptrun/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - extra/scrptrun -## Copyright (c) 2001, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -23,7 +23,7 @@ CLEANFILES = *~ $(DEPS) TARGET = srtest DEFS = @DEFS@ -CPPFLAGS = @CPPFLAGS@ -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir) +CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/common -I$(top_srcdir) CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ ENABLE_RPATH = @ENABLE_RPATH@ diff --git a/icu4c/source/extra/uconv/Makefile.in b/icu4c/source/extra/uconv/Makefile.in index ce5d29d7417..b2f8c357599 100644 --- a/icu4c/source/extra/uconv/Makefile.in +++ b/icu4c/source/extra/uconv/Makefile.in @@ -42,7 +42,7 @@ CLEANFILES = *~ $(DEPS) $(ALL_MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(srcdir)/../toolutil +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(srcdir)/../toolutil LIBS = $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) ifeq ($(PKGDATA_OPTS),) diff --git a/icu4c/source/extra/uconv/uconv.cpp b/icu4c/source/extra/uconv/uconv.cpp index 57cf80501d3..0bba48eafe1 100644 --- a/icu4c/source/extra/uconv/uconv.cpp +++ b/icu4c/source/extra/uconv/uconv.cpp @@ -40,10 +40,10 @@ U_NAMESPACE_USE -#if (defined(U_WINDOWS) || defined(U_CYGWIN) || defined(U_MINGW)) && !defined(__STRICT_ANSI__) +#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(__STRICT_ANSI__) #include #include -#if defined(U_WINDOWS) +#if U_PLATFORM_USES_ONLY_WIN32_API #define USE_FILENO_BINARY_MODE 1 /* Windows likes to rename Unix-like functions */ #ifndef fileno @@ -1134,7 +1134,7 @@ main(int argc, char **argv) // Get and prettify pname. pname = uprv_strrchr(*argv, U_FILE_SEP_CHAR); -#ifdef U_WINDOWS +#if U_PLATFORM_USES_ONLY_WIN32_API if (!pname) { pname = uprv_strrchr(*argv, '/'); } diff --git a/icu4c/source/i18n/Makefile.in b/icu4c/source/i18n/Makefile.in index 22c60061dc9..f326e3b9a15 100644 --- a/icu4c/source/i18n/Makefile.in +++ b/icu4c/source/i18n/Makefile.in @@ -53,9 +53,6 @@ DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(srcdir) -I$(top_srcdir)/common $(LIBCPPFLAGS) $(CPPFLAGSICUI18N) DEFS += -DU_I18N_IMPLEMENTATION LDFLAGS += $(LDFLAGSICUI18N) diff --git a/icu4c/source/i18n/datefmt.cpp b/icu4c/source/i18n/datefmt.cpp index ad3555714d1..6f5917c2d5f 100644 --- a/icu4c/source/i18n/datefmt.cpp +++ b/icu4c/source/i18n/datefmt.cpp @@ -344,7 +344,7 @@ DateFormat* U_EXPORT2 DateFormat::create(EStyle timeStyle, EStyle dateStyle, const Locale& locale) { UErrorCode status = U_ZERO_ERROR; -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API char buffer[8]; int32_t count = locale.getKeywordValue("compat", buffer, sizeof(buffer), status); diff --git a/icu4c/source/i18n/digitlst.h b/icu4c/source/i18n/digitlst.h index 508f1b42478..c4e1d88e07b 100644 --- a/icu4c/source/i18n/digitlst.h +++ b/icu4c/source/i18n/digitlst.h @@ -61,7 +61,7 @@ class CharString; // Macintosh produces duplicate definition linker errors with the explicit template // instantiation. // -#if !defined(U_DARWIN) +#if !U_PLATFORM_IS_DARWIN_BASED template class U_I18N_API MaybeStackHeaderAndArray; #endif diff --git a/icu4c/source/i18n/dtptngen.cpp b/icu4c/source/i18n/dtptngen.cpp index f848bc3ee23..ade425404bd 100644 --- a/icu4c/source/i18n/dtptngen.cpp +++ b/icu4c/source/i18n/dtptngen.cpp @@ -66,9 +66,8 @@ struct UResourceBundleAIterator { /* Must be C linkage to pass function pointer to the sort function */ -#if !defined (OS390) && !defined (OS400) -extern "C" -#endif +U_CDECL_BEGIN + static int32_t U_CALLCONV ures_a_codepointSort(const void *context, const void *left, const void *right) { //CompareContext *cmp=(CompareContext *)context; @@ -76,6 +75,7 @@ ures_a_codepointSort(const void *context, const void *left, const void *right) { ((const UResAEntry *)right)->key); } +U_CDECL_END static void ures_a_open(UResourceBundleAIterator *aiter, UResourceBundle *bund, UErrorCode *status) { if(U_FAILURE(*status)) { diff --git a/icu4c/source/i18n/numfmt.cpp b/icu4c/source/i18n/numfmt.cpp index 94fc21a6be7..09ab634f0a1 100644 --- a/icu4c/source/i18n/numfmt.cpp +++ b/icu4c/source/i18n/numfmt.cpp @@ -1110,7 +1110,7 @@ NumberFormat::makeInstance(const Locale& desiredLocale, return NULL; } -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API char buffer[8]; int32_t count = desiredLocale.getKeywordValue("compat", buffer, sizeof(buffer), status); diff --git a/icu4c/source/i18n/rbt_pars.h b/icu4c/source/i18n/rbt_pars.h index 96bdac06479..098a700d4eb 100644 --- a/icu4c/source/i18n/rbt_pars.h +++ b/icu4c/source/i18n/rbt_pars.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (C) 1999-2007, International Business Machines Corporation +* Copyright (C) 1999-2011, International Business Machines Corporation * and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -13,7 +13,7 @@ #include "unicode/utypes.h" #if !UCONFIG_NO_TRANSLITERATION -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus #include "unicode/uobject.h" #include "unicode/parseerr.h" @@ -335,7 +335,7 @@ private: U_NAMESPACE_END -#endif /* #ifdef XP_CPLUSPLUS */ +#endif /* #ifdef __cplusplus */ /** * Strip/convert the following from the transliterator rules: diff --git a/icu4c/source/i18n/timezone.cpp b/icu4c/source/i18n/timezone.cpp index c1b9f1e3697..5512780029c 100644 --- a/icu4c/source/i18n/timezone.cpp +++ b/icu4c/source/i18n/timezone.cpp @@ -493,7 +493,7 @@ TimeZone::initDefault() hostStrID.truncate(hostStrID.length()-1); default_zone = createSystemTimeZone(hostStrID); -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API // hostID points to a heap-allocated location on Windows. uprv_free(const_cast(hostID)); #endif diff --git a/icu4c/source/i18n/ucol_imp.h b/icu4c/source/i18n/ucol_imp.h index 748986ff865..099a30de5e9 100644 --- a/icu4c/source/i18n/ucol_imp.h +++ b/icu4c/source/i18n/ucol_imp.h @@ -41,7 +41,7 @@ #if !UCONFIG_NO_COLLATION -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus #include "unicode/normalizer2.h" #include "unicode/unistr.h" #endif @@ -281,7 +281,7 @@ minimum number for special Jamo #define NFC_ZERO_CC_BLOCK_LIMIT_ 0x300 -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus U_NAMESPACE_BEGIN @@ -364,7 +364,7 @@ uprv_delete_collIterate(U_NAMESPACE_QUALIFIER collIterate *s); U_CAPI UBool U_EXPORT2 uprv_collIterateAtEnd(U_NAMESPACE_QUALIFIER collIterate *s); -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus U_NAMESPACE_BEGIN @@ -548,7 +548,7 @@ U_CFUNC uint32_t U_EXPORT2 ucol_getPrevCE(const UCollator *coll, /* get some memory */ void *ucol_getABuffer(const UCollator *coll, uint32_t size); -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus U_NAMESPACE_BEGIN @@ -1085,7 +1085,7 @@ ucol_getLeadBytesForReorderCode(const UCollator *uca, int reorderCode, uint16_t* U_CFUNC int U_EXPORT2 ucol_getReorderCodesForLeadByte(const UCollator *uca, int leadByte, int16_t* returnReorderCodes, int returnCapacity); -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus /* * Test whether a character is potentially "unsafe" for use as a collation * starting point. Unsafe chars are those with combining class != 0 plus @@ -1114,7 +1114,7 @@ static inline UBool ucol_unsafeCP(UChar c, const UCollator *coll) { htbyte = coll->unsafeCP[hash>>3]; return ((htbyte >> (hash & 7)) & 1); } -#endif /* XP_CPLUSPLUS */ +#endif /* __cplusplus */ /* The offsetBuffer in collIterate might need to be freed to avoid memory leaks. */ void ucol_freeOffsetBuffer(U_NAMESPACE_QUALIFIER collIterate *s); diff --git a/icu4c/source/i18n/uspoof_impl.h b/icu4c/source/i18n/uspoof_impl.h index 20b2bc30a90..f89af082e1a 100644 --- a/icu4c/source/i18n/uspoof_impl.h +++ b/icu4c/source/i18n/uspoof_impl.h @@ -22,7 +22,7 @@ #if !UCONFIG_NO_NORMALIZATION -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus U_NAMESPACE_BEGIN @@ -390,7 +390,7 @@ struct SpoofDataHeader { U_NAMESPACE_END -#endif /* XP_CPLUSPLUS */ +#endif /* __cplusplus */ /** * Endianness swap function for binary spoof data. diff --git a/icu4c/source/i18n/windtfmt.cpp b/icu4c/source/i18n/windtfmt.cpp index 8fedabd6753..0fda3419bce 100644 --- a/icu4c/source/i18n/windtfmt.cpp +++ b/icu4c/source/i18n/windtfmt.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2009, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -11,7 +11,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -317,5 +317,5 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // #ifdef U_WINDOWS +#endif // U_PLATFORM_HAS_WIN32_API diff --git a/icu4c/source/i18n/windtfmt.h b/icu4c/source/i18n/windtfmt.h index aea8f0a4458..39ac8afb620 100644 --- a/icu4c/source/i18n/windtfmt.h +++ b/icu4c/source/i18n/windtfmt.h @@ -14,7 +14,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -135,6 +135,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // #ifdef U_WINDOWS +#endif // U_PLATFORM_HAS_WIN32_API #endif // __WINDTFMT diff --git a/icu4c/source/i18n/winnmfmt.cpp b/icu4c/source/i18n/winnmfmt.cpp index 4207c52e7e9..97e730f538b 100644 --- a/icu4c/source/i18n/winnmfmt.cpp +++ b/icu4c/source/i18n/winnmfmt.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2007, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -11,7 +11,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -351,4 +351,4 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // #ifdef U_WINDOWS +#endif // U_PLATFORM_HAS_WIN32_API diff --git a/icu4c/source/i18n/winnmfmt.h b/icu4c/source/i18n/winnmfmt.h index 7b2f9ac8548..f4474d8d73c 100644 --- a/icu4c/source/i18n/winnmfmt.h +++ b/icu4c/source/i18n/winnmfmt.h @@ -14,7 +14,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #include "unicode/format.h" #include "unicode/datefmt.h" @@ -156,6 +156,6 @@ U_NAMESPACE_END #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // #ifdef U_WINDOWS +#endif // U_PLATFORM_HAS_WIN32_API #endif // __WINNMFMT diff --git a/icu4c/source/i18n/wintzimpl.cpp b/icu4c/source/i18n/wintzimpl.cpp index fb7de50a812..eaa3dd0d72d 100644 --- a/icu4c/source/i18n/wintzimpl.cpp +++ b/icu4c/source/i18n/wintzimpl.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2009, International Business Machines +* Copyright (C) 2009-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -11,7 +11,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #include "wintzimpl.h" diff --git a/icu4c/source/i18n/wintzimpl.h b/icu4c/source/i18n/wintzimpl.h index e7083e9226e..3c01c0f447d 100644 --- a/icu4c/source/i18n/wintzimpl.h +++ b/icu4c/source/i18n/wintzimpl.h @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2008, International Business Machines +* Copyright (C) 2008-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -14,7 +14,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API /** * \file * \brief C API: Utilities for dealing w/ Windows time zones. @@ -32,6 +32,6 @@ U_CAPI UBool U_EXPORT2 uprv_getWindowsTimeZoneInfo(TIME_ZONE_INFORMATION *zoneInfo, const UChar *icuid, int32_t length); -#endif /* #ifdef U_WINDOWS */ +#endif /* U_PLATFORM_HAS_WIN32_API */ #endif /* __WINTZIMPL */ diff --git a/icu4c/source/io/Makefile.in b/icu4c/source/io/Makefile.in index a40f7fd29e4..130b8776445 100644 --- a/icu4c/source/io/Makefile.in +++ b/icu4c/source/io/Makefile.in @@ -1,6 +1,6 @@ #****************************************************************************** # -# Copyright (C) 1999-2009, International Business Machines +# Copyright (C) 1999-2011, International Business Machines # Corporation and others. All Rights Reserved. # #****************************************************************************** @@ -53,9 +53,6 @@ DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n $(LIBCPPFLAGS) $(CPPFLAGSICUIO) DEFS += -DU_IO_IMPLEMENTATION LDFLAGS += $(LDFLAGSICUIO) diff --git a/icu4c/source/io/ufile.c b/icu4c/source/io/ufile.c index 2f0739f14ac..125bbfe4c62 100644 --- a/icu4c/source/io/ufile.c +++ b/icu4c/source/io/ufile.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1998-2010, International Business Machines +* Copyright (C) 1998-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -37,7 +37,7 @@ #include "cstring.h" #include "cmemory.h" -#if defined(U_WINDOWS) && !defined(fileno) +#if U_PLATFORM_USES_ONLY_WIN32_API && !defined(fileno) /* Windows likes to rename Unix-like functions */ #define fileno _fileno #endif @@ -62,7 +62,7 @@ finit_owner(FILE *f, uprv_memset(result, 0, sizeof(UFILE)); result->fFileno = fileno(f); -#ifdef U_WINDOWS +#if U_PLATFORM_USES_ONLY_WIN32_API if (0 <= result->fFileno && result->fFileno <= 2) { /* stdin, stdout and stderr need to be special cased for Windows 98 */ #if _MSC_VER >= 1400 diff --git a/icu4c/source/io/ustdio.c b/icu4c/source/io/ustdio.c index 0ec153ad249..c7e8751da74 100644 --- a/icu4c/source/io/ustdio.c +++ b/icu4c/source/io/ustdio.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * - * Copyright (C) 1998-2010, International Business Machines + * Copyright (C) 1998-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -37,7 +37,7 @@ #define DELIM_PS 0x2029 /* TODO: is this correct for all codepages? Should we just use \n and let the converter handle it? */ -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API static const UChar DELIMITERS [] = { DELIM_CR, DELIM_LF, 0x0000 }; static const uint32_t DELIMITERS_LEN = 2; /* TODO: Default newline writing should be detected based upon the converter being used. */ diff --git a/icu4c/source/layout/LETypes.h b/icu4c/source/layout/LETypes.h index 400d016e4a4..cc720f7797c 100644 --- a/icu4c/source/layout/LETypes.h +++ b/icu4c/source/layout/LETypes.h @@ -1,6 +1,6 @@ /* * - * (C) Copyright IBM Corp. 1998-2009 - All Rights Reserved + * (C) Copyright IBM Corp. 1998-2011 - All Rights Reserved * */ @@ -13,7 +13,7 @@ #include "unicode/utypes.h" -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus #include "unicode/uobject.h" #endif @@ -258,7 +258,7 @@ struct LEPoint float fY; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus /** * Used to hold a pair of (x, y) values which represent a point. * @@ -542,7 +542,7 @@ enum LEErrorCode { LE_MISSING_FONT_TABLE_ERROR = U_MISSING_RESOURCE_ERROR /**< The requested font table does not exist. */ }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus /** * Error codes returned by the LayoutEngine. * diff --git a/icu4c/source/layout/Makefile.in b/icu4c/source/layout/Makefile.in index 5e9ec49819d..6d722e0b75e 100644 --- a/icu4c/source/layout/Makefile.in +++ b/icu4c/source/layout/Makefile.in @@ -1,6 +1,6 @@ #****************************************************************************** # -# Copyright (C) 1999-2007, International Business Machines +# Copyright (C) 1999-2011, International Business Machines # Corporation and others. All Rights Reserved. # #****************************************************************************** @@ -52,9 +52,6 @@ DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)/common -I$(srcdir)/unicode $(LIBCPPFLAGS) DEFS += -DU_LAYOUT_IMPLEMENTATION LDFLAGS += $(LDFLAGSICULE) diff --git a/icu4c/source/layoutex/Makefile.in b/icu4c/source/layoutex/Makefile.in index 71e37f64503..3f11c87a950 100644 --- a/icu4c/source/layoutex/Makefile.in +++ b/icu4c/source/layoutex/Makefile.in @@ -1,6 +1,6 @@ #****************************************************************************** # -# Copyright (C) 1999-2008, International Business Machines +# Copyright (C) 1999-2011, International Business Machines # Corporation and others. All Rights Reserved. # #****************************************************************************** @@ -52,9 +52,6 @@ DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(srcdir) -I$(srcdir)/unicode -I$(srcdir)/.. -I$(top_srcdir)/common $(LIBCPPFLAGS) DEFS += -DU_LAYOUTEX_IMPLEMENTATION LDFLAGS += $(LDFLAGSICULX) diff --git a/icu4c/source/samples/cal/Makefile.in b/icu4c/source/samples/cal/Makefile.in index 08a8f77a86e..795e2f07d0c 100644 --- a/icu4c/source/samples/cal/Makefile.in +++ b/icu4c/source/samples/cal/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - samples/cal -## Copyright (c) 1999-2008, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -20,7 +20,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = icucal$(EXEEXT) -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n LIBS = $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = uprint.o cal.o diff --git a/icu4c/source/samples/date/Makefile.in b/icu4c/source/samples/date/Makefile.in index acf2442227a..de16093589e 100644 --- a/icu4c/source/samples/date/Makefile.in +++ b/icu4c/source/samples/date/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - samples/date -## Copyright (c) 1999-2008, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -20,7 +20,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = icudate$(EXEEXT) -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n LIBS = $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = uprint.o date.o diff --git a/icu4c/source/samples/layout/Makefile.in b/icu4c/source/samples/layout/Makefile.in index 15fae07c16a..4beb90f3468 100644 --- a/icu4c/source/samples/layout/Makefile.in +++ b/icu4c/source/samples/layout/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - samples/layout -## Copyright (c) 2001-2007, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -23,7 +23,7 @@ CLEANFILES = *~ $(DEPS) TARGET = gnomelayout CTARGET = cgnomelayout -CPPFLAGS += -DLE_USE_CMEMORY `pkg-config --cflags libgnomeui-2.0 freetype2 cairo` -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/layoutex -I$(top_srcdir)/layout -I$(top_srcdir) -g +CPPFLAGS += -DLE_USE_CMEMORY `pkg-config --cflags libgnomeui-2.0 freetype2 cairo` -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/layoutex -I$(top_srcdir)/layout -I$(top_srcdir) -g LIBS = $(LIBICULX) $(LIBICULE) $(LIBICUUC) $(LIBICUI18N) @LIBS@ @LIB_M@ `pkg-config --libs libgnomeui-2.0 freetype2 cairo` diff --git a/icu4c/source/stubdata/Makefile.in b/icu4c/source/stubdata/Makefile.in index 168fe2ceb17..ab09daf0ba3 100644 --- a/icu4c/source/stubdata/Makefile.in +++ b/icu4c/source/stubdata/Makefile.in @@ -1,6 +1,6 @@ #****************************************************************************** # -# Copyright (C) 1999-2007, International Business Machines +# Copyright (C) 1999-2011, International Business Machines # Corporation and others. All Rights Reserved. # #****************************************************************************** @@ -43,9 +43,6 @@ DYNAMICCPPFLAGS = $(SHAREDLIBCPPFLAGS) DYNAMICCFLAGS = $(SHAREDLIBCFLAGS) DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common $(LIBCPPFLAGS) LDFLAGS += $(LDFLAGSICUDT) @@ -119,10 +116,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status cd $(top_builddir) \ && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status -../common/unicode/platform.h: $(srcdir)/../common/unicode/platform.h.in $(top_builddir)/config.status - cd $(top_builddir) \ - && CONFIG_FILES=common/unicode/platform.h CONFIG_HEADERS= $(SHELL) ./config.status - ifneq ($(ENABLE_STATIC),) $(TARGET): $(STATIC_OBJECTS) $(AR) $(ARFLAGS) $(AR_OUTOPT)$@ $^ diff --git a/icu4c/source/test/cintltst/Makefile.in b/icu4c/source/test/cintltst/Makefile.in index 33725cd352a..67dd11fdba5 100644 --- a/icu4c/source/test/cintltst/Makefile.in +++ b/icu4c/source/test/cintltst/Makefile.in @@ -32,9 +32,6 @@ BUILDDIR := $(BUILDDIR:test\\cintltst/../../=) # Simplify the path for Windows 98 BUILDDIR := $(BUILDDIR:TEST\\CINTLTST/../../=) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif # we define ICU_UNICODE_VERSION so we can test it CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/ctestfw -I$(top_srcdir)/tools/toolutil DEFS += -D'ICU_UNICODE_VERSION="$(UNICODE_VERSION)"' -D'ICU_VERSION="@VERSION@"' -D'ICUDATA_NAME="$(ICUDATA_PLATFORM_NAME)"' -D'U_TOPSRCDIR="$(top_srcdir)/"' -D'U_TOPBUILDDIR="$(BUILDDIR)"' diff --git a/icu4c/source/test/cintltst/cbiditst.h b/icu4c/source/test/cintltst/cbiditst.h index afaffb27d48..fb5f5c07fce 100644 --- a/icu4c/source/test/cintltst/cbiditst.h +++ b/icu4c/source/test/cintltst/cbiditst.h @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2007, International Business Machines Corporation and + * Copyright (c) 1997-2011, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /* file name: cbiditst.h @@ -19,7 +19,7 @@ #include "unicode/uchar.h" #include "unicode/ubidi.h" -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus extern "C" { #endif @@ -75,7 +75,7 @@ tests[]; extern const int bidiTestCount; -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus } #endif diff --git a/icu4c/source/test/cintltst/ccapitst.c b/icu4c/source/test/cintltst/ccapitst.c index 1b9d5cedf5c..52035fa44f4 100644 --- a/icu4c/source/test/cintltst/ccapitst.c +++ b/icu4c/source/test/cintltst/ccapitst.c @@ -28,7 +28,7 @@ #include "ccapitst.h" /* for not including "cstring.h" -begin*/ -#ifdef U_WINDOWS +#if U_PLATFORM_USES_ONLY_WIN32_API # define ctest_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE _stricmp(str1, str2) #elif defined(POSIX) # define ctest_stricmp(str1, str2) U_STANDARD_CPP_NAMESPACE strcasecmp(str1, str2) diff --git a/icu4c/source/test/cintltst/cintltst.c b/icu4c/source/test/cintltst/cintltst.c index a09b2392d93..eb79980de9f 100644 --- a/icu4c/source/test/cintltst/cintltst.c +++ b/icu4c/source/test/cintltst/cintltst.c @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation and + * Copyright (c) 1997-2011, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ /******************************************************************************** @@ -494,7 +494,7 @@ char *aescstrdup(const UChar* unichars,int32_t length){ const void *p; UErrorCode errorCode = U_ZERO_ERROR; #if U_CHARSET_FAMILY==U_EBCDIC_FAMILY -# ifdef OS390 +# if U_PLATFORM == U_PF_OS390 static const char convName[] = "ibm-1047"; # else static const char convName[] = "ibm-37"; diff --git a/icu4c/source/test/cintltst/cmsccoll.c b/icu4c/source/test/cintltst/cmsccoll.c index 3be7e3cc928..948e1ca3d53 100644 --- a/icu4c/source/test/cintltst/cmsccoll.c +++ b/icu4c/source/test/cintltst/cmsccoll.c @@ -662,7 +662,7 @@ static UCollationResult ucaTest(void *collator, const int object, const UChar *s /* static UCollationResult winTest(void *collator, const int object, const UChar *source, const int sLen, const UChar *target, const int tLen) { -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API LCID lcid = (LCID)collator; return (UCollationResult)CompareString(lcid, 0, source, sLen, target, tLen); #else diff --git a/icu4c/source/test/cintltst/cmsgtst.c b/icu4c/source/test/cintltst/cmsgtst.c index 9b337322b9c..b5ebf4e48dd 100644 --- a/icu4c/source/test/cintltst/cmsgtst.c +++ b/icu4c/source/test/cintltst/cmsgtst.c @@ -219,7 +219,7 @@ static void MessageFormatTest( void ) austrdup(result), austrdup(testResultStrings[i]) ); } -#if defined (U_DARWIN) /* add platforms here .. */ +#if U_PLATFORM == U_PF_DARWIN /* add platforms here .. */ log_verbose("Skipping potentially crashing test for mismatched varargs.\n"); #else log_verbose("Note: the next is a platform dependent test. If it crashes, add an exclusion for your platform near %s:%d\n", __FILE__, __LINE__); diff --git a/icu4c/source/test/cintltst/cnmdptst.c b/icu4c/source/test/cintltst/cnmdptst.c index 561fe4d3c7f..799ef842a4c 100644 --- a/icu4c/source/test/cintltst/cnmdptst.c +++ b/icu4c/source/test/cintltst/cnmdptst.c @@ -196,7 +196,7 @@ static void TestExponential(void) char tempMsgBug[256]; double a; UErrorCode status = U_ZERO_ERROR; -#ifdef OS390 +#if U_PLATFORM == U_PF_OS390 static const double val[] = { 0.01234, 123456789, 1.23e75, -3.141592653e-78 }; #else static const double val[] = { 0.01234, 123456789, 1.23e300, -3.141592653e-271 }; @@ -220,7 +220,7 @@ static void TestExponential(void) }; static const double valParse[] = { -#ifdef OS390 +#if U_PLATFORM == U_PF_OS390 0.01234, 123460000, 1.23E75, -3.1416E-78, 0.01234, 123460000, 1.23E75, -3.1416E-78, 0.01234, 123456800, 1.23E75, -3.141593E-78, diff --git a/icu4c/source/test/cintltst/udatatst.c b/icu4c/source/test/cintltst/udatatst.c index a936bc245fa..d2188113b5a 100644 --- a/icu4c/source/test/cintltst/udatatst.c +++ b/icu4c/source/test/cintltst/udatatst.c @@ -34,7 +34,7 @@ #include #include -#ifdef U_WINDOWS +#if U_PLATFORM_USES_ONLY_WIN32_API #include #else #include @@ -1151,7 +1151,7 @@ static void TestICUDataName() /* test data swapping ------------------------------------------------------- */ -#ifdef OS400 +#if U_PLATFORM == U_PF_OS400 /* See comments in genccode.c on when this special implementation can be removed. */ static const struct { double bogus; diff --git a/icu4c/source/test/compat/Makefile.in b/icu4c/source/test/compat/Makefile.in index af87cf8e8bd..7bdc4e961a5 100644 --- a/icu4c/source/test/compat/Makefile.in +++ b/icu4c/source/test/compat/Makefile.in @@ -1,5 +1,5 @@ -## Makefile.in for ICU - samples/tzdate -## Copyright (c) 1999-2007, International Business Machines Corporation and +## Makefile.in for ICU - test/compat +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -20,7 +20,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = tzdate$(EXEEXT) -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n LIBS = $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = tzdate.o diff --git a/icu4c/source/test/hdrtst/pfiles.txt b/icu4c/source/test/hdrtst/pfiles.txt index 95502b7f8b5..81c5f4a68da 100644 --- a/icu4c/source/test/hdrtst/pfiles.txt +++ b/icu4c/source/test/hdrtst/pfiles.txt @@ -1,3 +1,3 @@ -# Copyright (c) 2001-2004 International Business Machines +# Copyright (c) 2001-2011 International Business Machines # Corporation and others. All Rights Reserved. -pwin32.h +# ICU 49 and later: no more platform-specific headers diff --git a/icu4c/source/test/intltest/Makefile.in b/icu4c/source/test/intltest/Makefile.in index fb1e67a02bf..cf38e6b9d50 100644 --- a/icu4c/source/test/intltest/Makefile.in +++ b/icu4c/source/test/intltest/Makefile.in @@ -32,9 +32,6 @@ BUILDDIR := $(BUILDDIR:test\\intltest/../../=) # Simplify the path for Windows 98 BUILDDIR := $(BUILDDIR:TEST\\INTLTEST/../../=) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw DEFS += -D'U_TOPSRCDIR="$(top_srcdir)/"' -D'U_TOPBUILDDIR="$(BUILDDIR)"' LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) $(LIB_THREAD) diff --git a/icu4c/source/test/intltest/dtfmttst.cpp b/icu4c/source/test/intltest/dtfmttst.cpp index 85202f975f6..3cb949189bb 100644 --- a/icu4c/source/test/intltest/dtfmttst.cpp +++ b/icu4c/source/test/intltest/dtfmttst.cpp @@ -21,7 +21,7 @@ #include "caltest.h" // for fieldName #include // for sprintf -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #include "windttst.h" #endif @@ -2098,7 +2098,7 @@ void DateFormatTest::TestZTimeZoneParsing(void) { void DateFormatTest::TestHost(void) { -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API Win32DateTimeTest::testLocales(this); #endif } diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index 508368c70f5..c6a3228e7cd 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation and + * Copyright (c) 1997-2011, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -92,7 +92,7 @@ Int64ToUnicodeString(int64_t num) char buffer[64]; // nos changed from 10 to 64 char danger = 'p'; // guard against overrunning the buffer (rtg) -#ifdef U_WINDOWS +#if defined(_MSC_VER) sprintf(buffer, "%I64d", num); #else sprintf(buffer, "%lld", (long long)num); diff --git a/icu4c/source/test/intltest/intltest.h b/icu4c/source/test/intltest/intltest.h index 531c883a137..c0b177091d2 100644 --- a/icu4c/source/test/intltest/intltest.h +++ b/icu4c/source/test/intltest/intltest.h @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation and + * Copyright (c) 1997-2011, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -17,9 +17,9 @@ U_NAMESPACE_USE -#ifdef OS390 +#if U_PLATFORM == U_PF_OS390 // avoid collision with math.h/log() -// this must be after including utypes.h so that OS390 is actually defined +// this must be after including utypes.h so that U_PLATFORM is actually defined #pragma map(IntlTest::log( const UnicodeString &message ),"logos390") #endif diff --git a/icu4c/source/test/intltest/nmfmtrt.cpp b/icu4c/source/test/intltest/nmfmtrt.cpp index c2c962a7968..e4d8d3804e5 100644 --- a/icu4c/source/test/intltest/nmfmtrt.cpp +++ b/icu4c/source/test/intltest/nmfmtrt.cpp @@ -1,6 +1,6 @@ /*********************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2010, International Business Machines Corporation + * Copyright (c) 1997-2011, International Business Machines Corporation * and others. All Rights Reserved. ***********************************************************************/ @@ -146,7 +146,7 @@ NumberFormatRoundTripTest::start() void NumberFormatRoundTripTest::test(NumberFormat *fmt) { -#if IEEE_754 && !defined(OS400) +#if IEEE_754 && U_PLATFORM != U_PF_OS400 test(fmt, uprv_getNaN()); test(fmt, uprv_getInfinity()); test(fmt, -uprv_getInfinity()); @@ -167,10 +167,10 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt) test(fmt, uprv_floor((randomDouble(10000)))); test(fmt, randomDouble(1e50)); test(fmt, randomDouble(1e-50)); -#if !defined(OS390) && !defined(OS400) +#if !(U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) test(fmt, randomDouble(1e100)); #elif IEEE_754 - test(fmt, randomDouble(1e75)); /*OS390 and OS400*/ + test(fmt, randomDouble(1e75)); #endif /* OS390 and OS400 */ // {sfb} When formatting with a percent instance, numbers very close to // DBL_MAX will fail the round trip. This is because: @@ -185,13 +185,13 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt) DecimalFormat *df = dynamic_cast(fmt); if(df != NULL) { -#if !defined(OS390) && !defined(OS400) +#if !(U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400) /* DBL_MAX/2 is here because randomDouble does a *2 in the math */ test(fmt, randomDouble(DBL_MAX/2.0) / df->getMultiplier()); #elif IEEE_754 - test(fmt, randomDouble(1e75) / df->getMultiplier()); + test(fmt, randomDouble(1e75) / df->getMultiplier()); #else - test(fmt, randomDouble(1e65) / df->getMultiplier()); /*OS390*/ + test(fmt, randomDouble(1e65) / df->getMultiplier()); #endif } @@ -199,8 +199,8 @@ NumberFormatRoundTripTest::test(NumberFormat *fmt) // These machines and compilers don't fully support denormalized doubles, test(fmt, randomDouble(1e-292)); test(fmt, randomDouble(1e-100)); -#elif defined(OS390) || defined(OS400) - // i5/OS (OS400) throws exceptions on denormalized numbers +#elif U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 + // i5/OS (OS/400) throws exceptions on denormalized numbers # if IEEE_754 test(fmt, randomDouble(1e-78)); test(fmt, randomDouble(1e-78)); diff --git a/icu4c/source/test/intltest/numfmtst.cpp b/icu4c/source/test/intltest/numfmtst.cpp index 2192231fcb7..214b7b7c130 100644 --- a/icu4c/source/test/intltest/numfmtst.cpp +++ b/icu4c/source/test/intltest/numfmtst.cpp @@ -376,7 +376,7 @@ NumberFormatTest::TestExponential(void) a = af.getLong(); else if (af.getType() == Formattable::kDouble) { a = af.getDouble(); -#if defined(OS390) || defined(OS400) +#if U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 // S/390 will show a failure like this: //| -3.141592652999999e-271 -format-> -3.1416E-271 //| -parse-> -3.1416e-271 @@ -2620,7 +2620,7 @@ void NumberFormatTest::TestJB3832(){ void NumberFormatTest::TestHost() { -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API Win32NumberTest::testLocales(this); #endif Locale loc("en_US@compat=host"); diff --git a/icu4c/source/test/intltest/numrgts.cpp b/icu4c/source/test/intltest/numrgts.cpp index 110e2e7cbd7..befd64801c7 100644 --- a/icu4c/source/test/intltest/numrgts.cpp +++ b/icu4c/source/test/intltest/numrgts.cpp @@ -1451,7 +1451,7 @@ void NumberFormatRegressionTest::Test4106658(void) UnicodeString temp; FieldPosition pos(FieldPosition::DONT_CARE); -#if defined(U_HPUX) +#if U_PLATFORM == U_PF_HPUX d1 = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword #else d1 *= -1.0; // Some compilers have a problem with defining -0.0 @@ -1582,7 +1582,7 @@ void NumberFormatRegressionTest::Test4106667(void) FieldPosition pos(FieldPosition::DONT_CARE); logln("pattern: \"" + df->toPattern(temp) + "\""); -#if defined(U_HPUX) +#if U_PLATFORM == U_PF_HPUX d = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword #else d *= -1.0; // Some compilers have a problem with defining -0.0 @@ -1598,7 +1598,7 @@ void NumberFormatRegressionTest::Test4106667(void) /* @bug 4110936 * DecimalFormat.setMaximumIntegerDigits() works incorrectly. */ -#ifdef OS390 +#if U_PLATFORM == U_PF_OS390 # define MAX_INT_DIGITS 70 #else # define MAX_INT_DIGITS 128 @@ -2023,7 +2023,7 @@ void NumberFormatRegressionTest::Test4147706(void) volatile double d1 = 0.0; // volatile to prevent code optimization double d2 = -0.0001; -#if defined(U_HPUX) +#if U_PLATFORM == U_PF_HPUX d1 = 0.0 * -1.0; // old HPUX compiler ignores volatile keyword #else d1 *= -1.0; // Some compilers have a problem with defining -0.0 @@ -2129,7 +2129,7 @@ NumberFormatRegressionTest::Test4162852(void) logln(UnicodeString("") + d + " -> " + '"' + s + '"' + " -> " + e); -#if (defined(OS390) && !defined(IEEE_754)) || defined(OS400) +#if (U_PLATFORM == U_PF_OS390 && !defined(IEEE_754)) || U_PLATFORM == U_PF_OS400 if (e != 0.0) { #else if (e != 0.0 || 1.0/e > 0.0) { diff --git a/icu4c/source/test/intltest/simplethread.cpp b/icu4c/source/test/intltest/simplethread.cpp index 323de856927..2817ab2cf85 100644 --- a/icu4c/source/test/intltest/simplethread.cpp +++ b/icu4c/source/test/intltest/simplethread.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1999-2009, International Business Machines Corporation and + * Copyright (c) 1999-2011, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -28,12 +28,17 @@ #include #include // tolower, toupper -#if !defined(U_WINDOWS) && !defined(XP_MAC) && !defined(U_RHAPSODY) -#define POSIX 1 +#if U_PLATFORM_HAS_WIN32_API + /* Prefer native Windows APIs even if POSIX is implemented (i.e., on Cygwin). */ +# undef POSIX +#elif U_PLATFORM_IMPLEMENTS_POSIX +# define POSIX +#else +# undef POSIX #endif /* Needed by z/OS to get usleep */ -#if defined(OS390) +#if U_PLATFORM == U_PF_OS390 #define __DOT1 1 #define __UU #define _XOPEN_SOURCE_EXTENDED 1 @@ -44,7 +49,7 @@ /*#include "platform_xopen_source_extended.h"*/ #endif -#if defined(POSIX) || defined(U_SOLARIS) || defined(U_AIX) || defined(U_HPUX) +#if defined(POSIX) #define HAVE_IMP #if (ICU_USE_THREADS == 1) @@ -62,11 +67,11 @@ #define __EXTENSIONS__ #endif -#if defined(OS390) +#if U_PLATFORM == U_PF_OS390 #include #endif -#if !defined(OS390) +#if U_PLATFORM != U_PF_OS390 #include #endif @@ -130,7 +135,7 @@ #include "unicode/calendar.h" #include "ucaconf.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #define HAVE_IMP # define VC_EXTRALEAN @@ -255,7 +260,7 @@ void SimpleThread::sleep(int32_t millis) // class SimpleThread NULL Implementation // //----------------------------------------------------------------------------------- -#elif defined XP_MAC +#elif U_PLATFORM == U_PF_CLASSIC_MACOS // since the Mac has no preemptive threading (at least on MacOS 8), only // cooperative threading, threads are a no-op. We have no yield() calls @@ -310,7 +315,7 @@ SimpleThread::isRunning() { // system level cleanup has happened. // //----------------------------------------------------------------------------------- -#if defined(POSIX)||defined(U_SOLARIS)||defined(U_AIX)||defined(U_HPUX) +#if defined(POSIX) #define HAVE_IMP struct PosixThreadImplementation @@ -373,7 +378,7 @@ int32_t SimpleThread::start() #else if (attrIsInitialized == FALSE) { rc = pthread_attr_init(&attr); -#if defined(OS390) +#if U_PLATFORM == U_PF_OS390 { int detachstate = 0; // jdc30: detach state of zero causes //threads created with this attr to be in @@ -417,13 +422,13 @@ SimpleThread::isRunning() { void SimpleThread::sleep(int32_t millis) { -#ifdef U_SOLARIS +#if U_PLATFORM == U_PF_SOLARIS sigignore(SIGALRM); #endif #ifdef HPUX_CMA cma_sleep(millis/100); -#elif defined(U_HPUX) || defined(OS390) +#elif U_PLATFORM == U_PF_HPUX || U_PLATFORM == U_PF_OS390 millis *= 1000; while(millis >= 1000000) { usleep(999999); diff --git a/icu4c/source/test/intltest/strtest.cpp b/icu4c/source/test/intltest/strtest.cpp index 8bb5e226c8c..1f7c81d4ae5 100644 --- a/icu4c/source/test/intltest/strtest.cpp +++ b/icu4c/source/test/intltest/strtest.cpp @@ -458,13 +458,13 @@ StringTest::TestStringByteSink() { #endif } -#if defined(U_WINDOWS) && defined(_MSC_VER) +#if defined(_MSC_VER) #include #endif void StringTest::TestSTLCompatibility() { -#if defined(U_WINDOWS) && defined(_MSC_VER) +#if defined(_MSC_VER) /* Just make sure that it compiles with STL's placement new usage. */ std::vector myvect; myvect.push_back(UnicodeString("blah")); diff --git a/icu4c/source/test/intltest/tsmthred.cpp b/icu4c/source/test/intltest/tsmthred.cpp index 56954006023..4074bcaee81 100644 --- a/icu4c/source/test/intltest/tsmthred.cpp +++ b/icu4c/source/test/intltest/tsmthred.cpp @@ -24,12 +24,18 @@ #include "unicode/uloc.h" #include "unicode/locid.h" #include "putilimp.h" -#if !defined(U_WINDOWS) && !defined(XP_MAC) && !defined(U_RHAPSODY) -#define POSIX 1 + +#if U_PLATFORM_HAS_WIN32_API + /* Prefer native Windows APIs even if POSIX is implemented (i.e., on Cygwin). */ +# undef POSIX +#elif U_PLATFORM_IMPLEMENTS_POSIX +# define POSIX +#else +# undef POSIX #endif /* Needed by z/OS to get usleep */ -#if defined(OS390) +#if U_PLATFORM == U_PF_OS390 #define __DOT1 1 #define __UU #define _XOPEN_SOURCE_EXTENDED 1 @@ -39,7 +45,7 @@ #include /*#include "platform_xopen_source_extended.h"*/ #endif -#if defined(POSIX) || defined(U_SOLARIS) || defined(U_AIX) || defined(U_HPUX) +#if defined(POSIX) #define HAVE_IMP @@ -58,11 +64,11 @@ #define __EXTENSIONS__ #endif -#if defined(OS390) +#if U_PLATFORM == U_PF_OS390 #include #endif -#if !defined(OS390) +#if U_PLATFORM != U_PF_OS390 #include #endif diff --git a/icu4c/source/test/intltest/tsnmfmt.cpp b/icu4c/source/test/intltest/tsnmfmt.cpp index d05b96bbb9a..9e417a3c40c 100644 --- a/icu4c/source/test/intltest/tsnmfmt.cpp +++ b/icu4c/source/test/intltest/tsnmfmt.cpp @@ -179,7 +179,7 @@ IntlTestNumberFormat::testFormat(/* char* par */) DecimalFormat *s = (DecimalFormat*)fFormat; logln((UnicodeString)" Pattern " + s->toPattern(str)); -#if defined(OS390) || defined(OS400) +#if U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 tryIt(-2.02147304840132e-68); tryIt(3.88057859588817e-68); // Test rounding when only some digits are shown because exponent is close to -maxfrac tryIt(-2.64651110485945e+65); // Overflows to +INF when shown as a percent @@ -196,7 +196,7 @@ IntlTestNumberFormat::testFormat(/* char* par */) // These fail due to round-off // The least significant digit drops by one during each format-parse cycle. // Both numbers DON'T have a round-off problem when multiplied by 100! (shown as %) -#ifdef OS390 +#if U_PLATFORM == U_PF_OS390 tryIt(-9.18228054496402e+64); tryIt(-9.69413034454191e+64); #else @@ -204,7 +204,7 @@ IntlTestNumberFormat::testFormat(/* char* par */) tryIt(-9.69413034454191e+273); #endif -#ifndef OS390 +#if U_PLATFORM != U_PF_OS390 tryIt(1.234e-200); tryIt(-2.3e-168); diff --git a/icu4c/source/test/intltest/tsputil.cpp b/icu4c/source/test/intltest/tsputil.cpp index 222225a9c35..009e3802f91 100644 --- a/icu4c/source/test/intltest/tsputil.cpp +++ b/icu4c/source/test/intltest/tsputil.cpp @@ -42,7 +42,7 @@ PUtilTest::testIEEEremainder() // simple remainder checks remainderTest(7.0, 2.5, -0.5); remainderTest(7.0, -2.5, -0.5); -#ifndef OS390 +#if U_PLATFORM != U_PF_OS390 // ### TODO: // The following tests fails on S/390 with IEEE support in release builds; // debug builds work. @@ -343,7 +343,7 @@ PUtilTest::testZero(void) if((pzero <= nzero) != TRUE) { errln("FAIL: 0.0 <= -0.0 returned FALSE, should be TRUE."); } -#ifndef OS400 /* OS/400 will generate divide by zero exception MCH1214 */ +#if U_PLATFORM != U_PF_OS400 /* OS/400 will generate divide by zero exception MCH1214 */ if(uprv_isInfinite(1/pzero) != TRUE) { errln("FAIL: isInfinite(1/0.0) returned FALSE, should be TRUE."); } diff --git a/icu4c/source/test/intltest/uobjtest.cpp b/icu4c/source/test/intltest/uobjtest.cpp index 6efcd816340..3f5e9cf0e37 100644 --- a/icu4c/source/test/intltest/uobjtest.cpp +++ b/icu4c/source/test/intltest/uobjtest.cpp @@ -380,7 +380,7 @@ void UObjectTest::testIDs() TESTCLASSID_FACTORY(IndianCalendar, Calendar::createInstance(Locale("@calendar=indian"), status)); TESTCLASSID_FACTORY(ChineseCalendar, Calendar::createInstance(Locale("@calendar=chinese"), status)); TESTCLASSID_FACTORY(TaiwanCalendar, Calendar::createInstance(Locale("@calendar=roc"), status)); -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API TESTCLASSID_FACTORY(Win32DateFormat, DateFormat::createDateInstance(DateFormat::kFull, Locale("@compat=host"))); TESTCLASSID_FACTORY(Win32NumberFormat, NumberFormat::createInstance(Locale("@compat=host"), status)); #endif diff --git a/icu4c/source/test/intltest/windttst.cpp b/icu4c/source/test/intltest/windttst.cpp index ce90de06981..b8b0823ec13 100644 --- a/icu4c/source/test/intltest/windttst.cpp +++ b/icu4c/source/test/intltest/windttst.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2009, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -11,7 +11,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -193,4 +193,4 @@ void Win32DateTimeTest::testLocales(TestLog *log) #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* #ifdef U_WINDOWS */ +#endif /* U_PLATFORM_HAS_WIN32_API */ diff --git a/icu4c/source/test/intltest/windttst.h b/icu4c/source/test/intltest/windttst.h index b9b3e637488..54ef0d12aa3 100644 --- a/icu4c/source/test/intltest/windttst.h +++ b/icu4c/source/test/intltest/windttst.h @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2006, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -14,7 +14,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -36,6 +36,6 @@ private: #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // #ifdef U_WINDOWS +#endif // U_PLATFORM_HAS_WIN32_API #endif // __WINDTTST diff --git a/icu4c/source/test/intltest/winnmtst.cpp b/icu4c/source/test/intltest/winnmtst.cpp index a18d2a2a682..d09c1fec87c 100644 --- a/icu4c/source/test/intltest/winnmtst.cpp +++ b/icu4c/source/test/intltest/winnmtst.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2009, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -11,7 +11,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -320,4 +320,4 @@ void Win32NumberTest::testLocales(TestLog *log) #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* #ifdef U_WINDOWS */ +#endif /* U_PLATFORM_HAS_WIN32_API */ diff --git a/icu4c/source/test/intltest/winnmtst.h b/icu4c/source/test/intltest/winnmtst.h index 411969ad9ef..440c9871268 100644 --- a/icu4c/source/test/intltest/winnmtst.h +++ b/icu4c/source/test/intltest/winnmtst.h @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2006, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -14,7 +14,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -36,6 +36,6 @@ private: #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // #ifdef U_WINDOWS +#endif // U_PLATFORM_HAS_WIN32_API #endif // __WINNMTST diff --git a/icu4c/source/test/intltest/winutil.cpp b/icu4c/source/test/intltest/winutil.cpp index 760e9feea2b..0b7bd6d7a9b 100644 --- a/icu4c/source/test/intltest/winutil.cpp +++ b/icu4c/source/test/intltest/winutil.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2009, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -11,7 +11,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -88,4 +88,4 @@ void Win32Utilities::freeLocales(LCIDRecord *records) #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif /* #ifdef U_WINDOWS */ +#endif /* U_PLATFORM_HAS_WIN32_API */ diff --git a/icu4c/source/test/intltest/winutil.h b/icu4c/source/test/intltest/winutil.h index 3d68f0e1ee6..a0003059cdf 100644 --- a/icu4c/source/test/intltest/winutil.h +++ b/icu4c/source/test/intltest/winutil.h @@ -1,6 +1,6 @@ /* ******************************************************************************** -* Copyright (C) 2005-2009, International Business Machines +* Copyright (C) 2005-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************** * @@ -14,7 +14,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #if !UCONFIG_NO_FORMATTING @@ -41,6 +41,6 @@ private: #endif /* #if !UCONFIG_NO_FORMATTING */ -#endif // #ifdef U_WINDOWS +#endif // U_PLATFORM_HAS_WIN32_API #endif // __WINUTIL diff --git a/icu4c/source/test/iotest/Makefile.in b/icu4c/source/test/iotest/Makefile.in index 65e12b9053c..9095f11b49f 100644 --- a/icu4c/source/test/iotest/Makefile.in +++ b/icu4c/source/test/iotest/Makefile.in @@ -1,6 +1,6 @@ #****************************************************************************** # -# Copyright (C) 1999-2010, International Business Machines +# Copyright (C) 1999-2011, International Business Machines # Corporation and others. All Rights Reserved. # #****************************************************************************** @@ -32,9 +32,6 @@ BUILDDIR := $(BUILDDIR:test\\iotest/../../=) # Simplify the path for Windows 98 BUILDDIR := $(BUILDDIR:TEST\\IOTEST/../../=) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/ctestfw -I$(top_srcdir)/io DEFS += -D'U_TOPSRCDIR="$(top_srcdir)/"' -D'U_TOPBUILDDIR="$(BUILDDIR)"' LIBS = $(LIBCTESTFW) $(LIBICUTOOLUTIL) $(LIBICUIO) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/test/iotest/stream.cpp b/icu4c/source/test/iotest/stream.cpp index 794da82a409..a821636c77e 100644 --- a/icu4c/source/test/iotest/stream.cpp +++ b/icu4c/source/test/iotest/stream.cpp @@ -35,7 +35,7 @@ using namespace std; #include U_CDECL_BEGIN -#ifdef U_WINDOWS +#if U_PLATFORM_USES_ONLY_WIN32_API const UChar NEW_LINE[] = {0x0d,0x0a,0}; const char C_NEW_LINE[] = {0x0d,0x0a,0}; #define UTF8_NEW_LINE "\x0d\x0a" diff --git a/icu4c/source/test/letest/Makefile.in b/icu4c/source/test/letest/Makefile.in index 62138995d6d..c989adb7ca5 100644 --- a/icu4c/source/test/letest/Makefile.in +++ b/icu4c/source/test/letest/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/letest -## Copyright (c) 2001-2007, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -31,11 +31,7 @@ BUILDDIR := $(BUILDDIR:test\\cintltst/../../=) # Simplify the path for Windows 98 BUILDDIR := $(BUILDDIR:TEST\\CINTLTST/../../=) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif - -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/ctestfw -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/layout -I$(top_srcdir)/layoutex -I$(top_srcdir) +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/ctestfw -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/layout -I$(top_srcdir)/layoutex -I$(top_srcdir) DEFS += -D'U_TOPSRCDIR="$(top_srcdir)/"' -D'U_TOPBUILDDIR="$(BUILDDIR)"' LIBS = $(LIBICULX) $(LIBICULE) $(LIBICUUC) $(LIBICUI18N) $(LIBCTESTFW) $(LIBICUTOOLUTIL) @LIBS@ @LIB_M@ diff --git a/icu4c/source/test/letest/letest.h b/icu4c/source/test/letest/letest.h index 9f066ca8c99..40d1e8f43eb 100644 --- a/icu4c/source/test/letest/letest.h +++ b/icu4c/source/test/letest/letest.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 1999-2007, International Business Machines + * Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -40,7 +40,7 @@ struct TestResult float *positions; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct TestResult TestResult; #endif diff --git a/icu4c/source/test/letest/sfnt.h b/icu4c/source/test/letest/sfnt.h index f83f9212e35..bd5888fc7c5 100644 --- a/icu4c/source/test/letest/sfnt.h +++ b/icu4c/source/test/letest/sfnt.h @@ -1,6 +1,6 @@ /*************************************************************************** * -* Copyright (C) 1998-2008, International Business Machines +* Copyright (C) 1998-2011, International Business Machines * Corporation and others. All Rights Reserved. * ************************************************************************/ @@ -24,7 +24,7 @@ struct DirectoryEntry le_uint32 length; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct DirectoryEntry DirectoryEntry; #endif @@ -38,7 +38,7 @@ struct SFNTDirectory DirectoryEntry tableDirectory[ANY_NUMBER]; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct SFNTDirectory SFNTDirectory; #endif @@ -50,7 +50,7 @@ struct CMAPEncodingSubtableHeader le_uint32 encodingOffset; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct CMAPEncodingSubtableHeader CMAPEncodingSubtableHeader; #endif @@ -61,7 +61,7 @@ struct CMAPTable CMAPEncodingSubtableHeader encodingSubtableHeaders[ANY_NUMBER]; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct CMAPTable CMAPTable; #endif @@ -72,11 +72,11 @@ struct CMAPEncodingSubtable le_uint16 language; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct CMAPEncodingSubtable CMAPEncodingSubtable; #endif -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus struct CMAPFormat0Encoding : CMAPEncodingSubtable { le_uint8 glyphIndexArray[256]; @@ -100,11 +100,11 @@ struct CMAPFormat2Subheader le_uint16 idRangeOffset; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct CMAPFormat2Subheader CMAPFormat2Subheader; #endif -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus struct CMAPFormat2Encoding : CMAPEncodingSubtable { le_uint16 subHeadKeys[256]; @@ -122,7 +122,7 @@ struct CMAPFormat2Encoding typedef struct CMAPFormat2Encoding CMAPFormat2Encoding; #endif -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus struct CMAPFormat4Encoding : CMAPEncodingSubtable { le_uint16 segCountX2; @@ -160,7 +160,7 @@ struct CMAPFormat4Encoding typedef struct CMAPFormat4Encoding CMAPFormat4Encoding; #endif -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus struct CMAPFormat6Encoding : CMAPEncodingSubtable { le_uint16 firstCode; @@ -187,7 +187,7 @@ struct CMAPEncodingSubtable32 le_uint32 language; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct CMAPEncodingSubtable32 CMAPEncodingSubtable32; #endif @@ -198,11 +198,11 @@ struct CMAPGroup le_uint32 startGlyphCode; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct CMAPGroup CMAPGroup; #endif -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus struct CMAPFormat8Encoding : CMAPEncodingSubtable32 { le_uint32 is32[65536/32]; @@ -222,7 +222,7 @@ struct CMAPFormat8Encoding typedef struct CMAPFormat8Encoding CMAPFormat8Encoding; #endif -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus struct CMAPFormat10Encoding : CMAPEncodingSubtable32 { le_uint32 startCharCode; @@ -242,7 +242,7 @@ struct CMAPFormat10Encoding typedef struct CMAPFormat10Encoding CMAPFormat10Encoding; #endif -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus struct CMAPFormat12Encoding : CMAPEncodingSubtable32 { le_uint32 nGroups; @@ -268,7 +268,7 @@ struct BigDate le_uint32 ad; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct BigDate BigDate; #endif @@ -292,7 +292,7 @@ struct HEADTable le_int16 glyphDataFormat; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct HEADTable HEADTable; #endif @@ -315,7 +315,7 @@ struct MAXPTable le_uint16 maxComponentDepth; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct MAXPTable MAXPTable; #endif @@ -340,7 +340,7 @@ struct HHEATable le_uint16 numOfLongHorMetrics; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct HHEATable HHEATable; #endif @@ -350,7 +350,7 @@ struct LongHorMetric le_int16 leftSideBearing; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct LongHorMetric LongHorMetric; #endif @@ -360,7 +360,7 @@ struct HMTXTable /* le_int16 leftSideBearing[ANY_NUMBER]; ANY_NUMBER = numGlyphs - numOfLongHorMetrics */ }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct HMTXTable HMTXTable; #endif @@ -429,7 +429,7 @@ struct NameRecord le_uint16 offset; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct NameRecord NameRecord; #endif @@ -441,7 +441,7 @@ struct NAMETable NameRecord nameRecords[ANY_NUMBER]; }; -#ifndef XP_CPLUSPLUS +#ifndef __cplusplus typedef struct NAMETable NAMETable; #endif diff --git a/icu4c/source/test/perf/DateFmtPerf/DateFmtPerf.h b/icu4c/source/test/perf/DateFmtPerf/DateFmtPerf.h index 8c3bbad509e..2a87c43780b 100644 --- a/icu4c/source/test/perf/DateFmtPerf/DateFmtPerf.h +++ b/icu4c/source/test/perf/DateFmtPerf/DateFmtPerf.h @@ -37,7 +37,7 @@ using namespace std; // Stubs for Windows API functions when building on UNIXes. // -#if defined(U_WINDOWS) +#if U_PLATFORM_USES_ONLY_WIN32_API // do nothing #else #define _UNICODE diff --git a/icu4c/source/test/perf/DateFmtPerf/Makefile.in b/icu4c/source/test/perf/DateFmtPerf/Makefile.in index eba8e388dcb..3e651de497e 100644 --- a/icu4c/source/test/perf/DateFmtPerf/Makefile.in +++ b/icu4c/source/test/perf/DateFmtPerf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/ubrkperf -## Copyright (c) 2001-2010, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = DateFmtPerf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_builddir)/i18n -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_builddir)/i18n -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = DateFmtPerf.o diff --git a/icu4c/source/test/perf/charperf/Makefile.in b/icu4c/source/test/perf/charperf/Makefile.in index 610b90d84ca..9276a78f032 100644 --- a/icu4c/source/test/perf/charperf/Makefile.in +++ b/icu4c/source/test/perf/charperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/charperf -## Copyright (c) 2001-2006, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = charperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = charperf.o diff --git a/icu4c/source/test/perf/collationperf/Makefile.in b/icu4c/source/test/perf/collationperf/Makefile.in index a59327124ac..81e324872d6 100644 --- a/icu4c/source/test/perf/collationperf/Makefile.in +++ b/icu4c/source/test/perf/collationperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/collationperf -## Copyright (c) 2001-2009, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = collperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = collperf.o diff --git a/icu4c/source/test/perf/collperf/Makefile.in b/icu4c/source/test/perf/collperf/Makefile.in index fcc1615b3fb..b2dce6815b3 100644 --- a/icu4c/source/test/perf/collperf/Makefile.in +++ b/icu4c/source/test/perf/collperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/collperf -## Copyright (c) 2001-2006, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = collperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = collperf.o diff --git a/icu4c/source/test/perf/collperf/collperf.cpp b/icu4c/source/test/perf/collperf/collperf.cpp index fd30f50bdea..a3b74679f55 100644 --- a/icu4c/source/test/perf/collperf/collperf.cpp +++ b/icu4c/source/test/perf/collperf/collperf.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: -* Copyright (C) 2001-2006 IBM, Inc. All Rights Reserved. +* Copyright (C) 2001-2011 IBM, Inc. All Rights Reserved. * ********************************************************************/ @@ -575,7 +575,7 @@ public: locale = "en_US"; // set default locale } - //#ifdef U_WINDOWS + //#if U_PLATFORM_USES_ONLY_WIN32_API if (options[i].doesOccur) { char *endp; int tmp = strtol(options[i].value, &endp, 0); diff --git a/icu4c/source/test/perf/convperf/Makefile.in b/icu4c/source/test/perf/convperf/Makefile.in index b2ec30bc698..538c49b16c6 100644 --- a/icu4c/source/test/perf/convperf/Makefile.in +++ b/icu4c/source/test/perf/convperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/collperf -## Copyright (c) 2001-2007, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = collperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = convperf.o diff --git a/icu4c/source/test/perf/dicttrieperf/Makefile.in b/icu4c/source/test/perf/dicttrieperf/Makefile.in index beb4fda2749..931a1a817d7 100644 --- a/icu4c/source/test/perf/dicttrieperf/Makefile.in +++ b/icu4c/source/test/perf/dicttrieperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/dicttrieperf -## Copyright (c) 2001-2010, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = dicttrieperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = dicttrieperf.o diff --git a/icu4c/source/test/perf/normperf/Makefile.in b/icu4c/source/test/perf/normperf/Makefile.in index 8b35cab0465..e56be510d27 100644 --- a/icu4c/source/test/perf/normperf/Makefile.in +++ b/icu4c/source/test/perf/normperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/normperf -## Copyright (c) 2001-2006, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = normperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = normperf.o diff --git a/icu4c/source/test/perf/normperf/dtfmtrtperf.h b/icu4c/source/test/perf/normperf/dtfmtrtperf.h index b100e69aa4f..6be40f4351e 100644 --- a/icu4c/source/test/perf/normperf/dtfmtrtperf.h +++ b/icu4c/source/test/perf/normperf/dtfmtrtperf.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2010,International Business Machines +* Copyright (c) 2010-2011,International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** ********************************************************************** @@ -39,7 +39,7 @@ using namespace std; // Stubs for Windows API functions when building on UNIXes. // -#if defined(U_WINDOWS) +#if U_PLATFORM_USES_ONLY_WIN32_API // do nothing #else #define _UNICODE diff --git a/icu4c/source/test/perf/normperf/normperf.h b/icu4c/source/test/perf/normperf/normperf.h index 6a43a7727be..ce2e90ca06d 100644 --- a/icu4c/source/test/perf/normperf/normperf.h +++ b/icu4c/source/test/perf/normperf/normperf.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2002-2006, International Business Machines +* Copyright (c) 2002-2011, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** ********************************************************************** @@ -16,7 +16,7 @@ // Stubs for Windows API functions when building on UNIXes. // -#if defined(U_WINDOWS) +#if U_PLATFORM_USES_ONLY_WIN32_API // do nothing #else #define _UNICODE @@ -315,7 +315,7 @@ int32_t ICUIsNormalized(const UChar* src,int32_t srcLen, UNormalizationMode mode } #endif -#if defined(U_WINDOWS) +#if U_PLATFORM_HAS_WIN32_API int32_t WinNormNFD(const UChar* src, int32_t srcLen, UChar* dest, int32_t dstLen, int32_t options, UErrorCode* status) { return FoldStringW(MAP_COMPOSITE,src,srcLen,dest,dstLen); diff --git a/icu4c/source/test/perf/strsrchperf/Makefile.in b/icu4c/source/test/perf/strsrchperf/Makefile.in index bd03d38e579..b2d93167bf3 100644 --- a/icu4c/source/test/perf/strsrchperf/Makefile.in +++ b/icu4c/source/test/perf/strsrchperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/strsrchperf -## Copyright (c) 2008, International Business Machines Corporation and +## Copyright (c) 2008-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = strsrchperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = strsrchperf.o diff --git a/icu4c/source/test/perf/ubrkperf/Makefile.in b/icu4c/source/test/perf/ubrkperf/Makefile.in index e255c38940e..6aa5ea85921 100644 --- a/icu4c/source/test/perf/ubrkperf/Makefile.in +++ b/icu4c/source/test/perf/ubrkperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/ubrkperf -## Copyright (c) 2001-2006, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = ubrkperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = ubrkperf.o diff --git a/icu4c/source/test/perf/ubrkperf/ubrkperf.cpp b/icu4c/source/test/perf/ubrkperf/ubrkperf.cpp index 9a090ee5fac..cd84edf9227 100644 --- a/icu4c/source/test/perf/ubrkperf/ubrkperf.cpp +++ b/icu4c/source/test/perf/ubrkperf/ubrkperf.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (C) 2001-2008 International Business Machines Corporation + * Copyright (C) 2001-2011 International Business Machines Corporation * and others. All Rights Reserved. * ********************************************************************/ @@ -21,7 +21,7 @@ #if 0 -#ifdef U_DARWIN +#if U_PLATFORM_IS_DARWIN_BASED #include enum{ kUCTextBreakAllMask = (kUCTextBreakClusterMask | kUCTextBreakWordMask | kUCTextBreakLineMask) @@ -83,7 +83,7 @@ void doForwardTest() { elapsedTime = timeGetTime()-startTime; } else if(opt_mac) { -#ifdef U_DARWIN +#if U_PLATFORM_IS_DARWIN_BASED createMACBrkIt(); UniChar* filePtr = text; OSStatus status = noErr; diff --git a/icu4c/source/test/perf/ubrkperf/ubrkperf.h b/icu4c/source/test/perf/ubrkperf/ubrkperf.h index 4c55a73976c..0d9e98730bb 100644 --- a/icu4c/source/test/perf/ubrkperf/ubrkperf.h +++ b/icu4c/source/test/perf/ubrkperf/ubrkperf.h @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2002-2005, International Business Machines +* Copyright (c) 2002-2011, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** ********************************************************************** @@ -104,13 +104,8 @@ public: }; class DarwinBreakFunction : public UPerfFunction { -#ifdef U_DARWIN public: virtual void call(UErrorCode *status) {}; -#else -public: - virtual void call(UErrorCode *status) {}; -#endif }; class BreakIteratorPerformanceTest : public UPerfTest { diff --git a/icu4c/source/test/perf/ubrkperf/ubrkperfold.cpp b/icu4c/source/test/perf/ubrkperf/ubrkperfold.cpp index 4ab8190f5ba..5700c26a8b4 100644 --- a/icu4c/source/test/perf/ubrkperf/ubrkperfold.cpp +++ b/icu4c/source/test/perf/ubrkperf/ubrkperfold.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (C) 2001-2005 IBM, Inc. All Rights Reserved. + * Copyright (C) 2001-2011 IBM, Inc. All Rights Reserved. * ********************************************************************/ /******************************************************************************** @@ -69,7 +69,7 @@ const char gUsageString[] = #include -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #include #else // @@ -165,7 +165,7 @@ int32_t textSize = 0; -#ifdef U_DARWIN +#if U_PLATFORM_IS_DARWIN_BASED #include enum{ kUCTextBreakAllMask = (kUCTextBreakClusterMask | kUCTextBreakWordMask | kUCTextBreakLineMask) @@ -309,7 +309,7 @@ void doForwardTest() { elapsedTime = timeGetTime()-startTime; } else if(opt_mac) { -#ifdef U_DARWIN +#if U_PLATFORM_IS_DARWIN_BASED createMACBrkIt(); UniChar* filePtr = text; OSStatus status = noErr; diff --git a/icu4c/source/test/perf/unisetperf/Makefile.in b/icu4c/source/test/perf/unisetperf/Makefile.in index 07c62d657da..12231b84c8d 100644 --- a/icu4c/source/test/perf/unisetperf/Makefile.in +++ b/icu4c/source/test/perf/unisetperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/unisetperf -## Copyright (c) 2001-2007, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = unisetperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = unisetperf.o diff --git a/icu4c/source/test/perf/usetperf/Makefile.in b/icu4c/source/test/perf/usetperf/Makefile.in index 3e737304748..80ee79b4575 100644 --- a/icu4c/source/test/perf/usetperf/Makefile.in +++ b/icu4c/source/test/perf/usetperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/usetperf -## Copyright (c) 2001-2006, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = usetperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = usetperf.o bitset.o diff --git a/icu4c/source/test/perf/ustrperf/Makefile.in b/icu4c/source/test/perf/ustrperf/Makefile.in index 654d4a2f6ea..4898b1bf834 100644 --- a/icu4c/source/test/perf/ustrperf/Makefile.in +++ b/icu4c/source/test/perf/ustrperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/ustrperf -## Copyright (c) 2001-2008, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = stringperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = stringperf.o diff --git a/icu4c/source/test/perf/utfperf/Makefile.in b/icu4c/source/test/perf/utfperf/Makefile.in index dbaf1ab4316..c6694ccc152 100644 --- a/icu4c/source/test/perf/utfperf/Makefile.in +++ b/icu4c/source/test/perf/utfperf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/utfperf -## Copyright (c) 2001-2006, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = utfperf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = utfperf.o diff --git a/icu4c/source/test/perf/utrie2perf/Makefile.in b/icu4c/source/test/perf/utrie2perf/Makefile.in index e9098ebe563..313c7c7eb6e 100644 --- a/icu4c/source/test/perf/utrie2perf/Makefile.in +++ b/icu4c/source/test/perf/utrie2perf/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/perf/utrie2perf -## Copyright (c) 2001-2008, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -19,7 +19,7 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = utrie2perf -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M) OBJECTS = utrie2perf.o diff --git a/icu4c/source/test/testmap/Makefile.in b/icu4c/source/test/testmap/Makefile.in index 9499b2c942e..2bf2b68840a 100644 --- a/icu4c/source/test/testmap/Makefile.in +++ b/icu4c/source/test/testmap/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/testmap -## Copyright (c) 2003-2006, International Business Machines Corporation and +## Copyright (c) 2003-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -20,7 +20,7 @@ CLEANFILES = *~ $(DEPS) TARGET = testmap$(EXEEXT) #DEFS = @DEFS@ -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n #CFLAGS += @CFLAGS@ #CXXFLAGS = @CXXFLAGS@ diff --git a/icu4c/source/test/thaitest/Makefile.in b/icu4c/source/test/thaitest/Makefile.in index 63cc7b7f632..0fada25f601 100644 --- a/icu4c/source/test/thaitest/Makefile.in +++ b/icu4c/source/test/thaitest/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/thaitest -## Copyright (c) 2003, International Business Machines Corporation and +## Copyright (c) 2003-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -20,7 +20,7 @@ CLEANFILES = *~ $(DEPS) TARGET = thaitest$(EXEEXT) DEFS = @DEFS@ -CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n +CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n #CFLAGS += @CFLAGS@ #CXXFLAGS = @CXXFLAGS@ diff --git a/icu4c/source/test/threadtest/Makefile.in b/icu4c/source/test/threadtest/Makefile.in index 8d268925fbc..4014a7fec58 100644 --- a/icu4c/source/test/threadtest/Makefile.in +++ b/icu4c/source/test/threadtest/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - test/threadtest -## Copyright (c) 2001, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -23,7 +23,7 @@ CLEANFILES = *~ $(DEPS) TARGET = threadtest DEFS = @DEFS@ -CPPFLAGS = @CPPFLAGS@ -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/i18n +CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/common -I$(top_srcdir)/i18n CFLAGS = @CFLAGS@ CXXFLAGS = @CXXFLAGS@ ENABLE_RPATH = @ENABLE_RPATH@ diff --git a/icu4c/source/test/threadtest/threadtest.cpp b/icu4c/source/test/threadtest/threadtest.cpp index 7891a888f19..bece6f2382e 100644 --- a/icu4c/source/test/threadtest/threadtest.cpp +++ b/icu4c/source/test/threadtest/threadtest.cpp @@ -1,6 +1,6 @@ // //******************************************************************** -// Copyright (C) 2002-2005, International Business Machines +// Copyright (C) 2002-2011, International Business Machines // Corporation and others. All Rights Reserved. //******************************************************************** // @@ -32,7 +32,7 @@ extern AbstractThreadTest *createConvertTest(); // Windows specific code for starting threads // //------------------------------------------------------------------------------ -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #include "Windows.h" #include "process.h" diff --git a/icu4c/source/tools/ctestfw/Makefile.in b/icu4c/source/tools/ctestfw/Makefile.in index 4f96959f004..3df9af6ed24 100644 --- a/icu4c/source/tools/ctestfw/Makefile.in +++ b/icu4c/source/tools/ctestfw/Makefile.in @@ -1,6 +1,6 @@ #****************************************************************************** # -# Copyright (C) 1999-2010, International Business Machines +# Copyright (C) 1999-2011, International Business Machines # Corporation and others. All Rights Reserved. # #****************************************************************************** @@ -43,9 +43,6 @@ DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(srcdir)/../toolutil -I$(srcdir) $(LIBCPPFLAGS) $(CPPFLAGSCTESTFW) DEFS += -DT_CTEST_IMPLEMENTATION LDFLAGS += $(LDFLAGSCTESTFW) diff --git a/icu4c/source/tools/ctestfw/unicode/testtype.h b/icu4c/source/tools/ctestfw/unicode/testtype.h index 6deb1cdff09..9c4a72ea738 100644 --- a/icu4c/source/tools/ctestfw/unicode/testtype.h +++ b/icu4c/source/tools/ctestfw/unicode/testtype.h @@ -1,6 +1,6 @@ /* ***************************************************************************************** - * Copyright (C) 2004-2007, International Business Machines + * Copyright (C) 2004-2011, International Business Machines * Corporation and others. All Rights Reserved. ***************************************************************************************** */ @@ -16,7 +16,7 @@ #define T_CTEST_IMPORT #endif -#if defined(U_WINDOWS) +#if defined(_MSC_VER) #define T_CTEST_EXPORT2 __cdecl #else #define T_CTEST_EXPORT2 diff --git a/icu4c/source/tools/ctestfw/unicode/utimer.h b/icu4c/source/tools/ctestfw/unicode/utimer.h index b59867cb006..fb9f049d740 100644 --- a/icu4c/source/tools/ctestfw/unicode/utimer.h +++ b/icu4c/source/tools/ctestfw/unicode/utimer.h @@ -10,12 +10,12 @@ #include "unicode/utypes.h" -#if defined(U_WINDOWS) +#if U_PLATFORM_HAS_WIN32_API # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # include #else -# if defined(OS390) +# if U_PLATFORM == U_PF_OS390 # define __UU /* Universal Unix - for struct timeval */ # endif # include @@ -88,7 +88,7 @@ * } * * retVal= fn(fileLines[line].name,len,dest,destCapacity,&error); - * #if defined(U_WINDOWS) + * #if U_PLATFORM_HAS_WIN32_API * if(retVal==0 ){ * fprintf(stderr,"Normalization of string in Windows API failed for mode %s. ErrorNo: %i at line number %i\n",mode,GetLastError(),line); * return 0; @@ -160,7 +160,7 @@ typedef struct UTimer UTimer; typedef void FuntionToBeTimed(void* param); -#if defined(U_WINDOWS) +#if U_PLATFORM_HAS_WIN32_API struct UTimer{ LARGE_INTEGER start; diff --git a/icu4c/source/tools/genbrk/Makefile.in b/icu4c/source/tools/genbrk/Makefile.in index 5884cef323d..77182d17d3c 100644 --- a/icu4c/source/tools/genbrk/Makefile.in +++ b/icu4c/source/tools/genbrk/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/genbrk -## Copyright (c) 2002-2006 International Business Machines Corporation and +## Copyright (c) 2002-2011 International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -26,9 +26,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/genccode/Makefile.in b/icu4c/source/tools/genccode/Makefile.in index 41913b13b2e..fe6b60fad7d 100644 --- a/icu4c/source/tools/genccode/Makefile.in +++ b/icu4c/source/tools/genccode/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/genccode -## Copyright (c) 1999-2008, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis @@ -27,9 +27,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/genccode/genccode.c b/icu4c/source/tools/genccode/genccode.c index 12520c3dc97..98e9bb33d5e 100644 --- a/icu4c/source/tools/genccode/genccode.c +++ b/icu4c/source/tools/genccode/genccode.c @@ -1,6 +1,6 @@ /* ******************************************************************************* - * Copyright (C) 1999-2008, International Business Machines + * Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: gennames.c @@ -19,7 +19,7 @@ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # define NOUSER @@ -30,7 +30,7 @@ #include #endif -#ifdef U_LINUX +#if U_PLATFORM_IS_LINUX_BASED # define U_ELF #endif @@ -57,7 +57,7 @@ #include "uoptions.h" #include "pkg_genc.h" -#if defined(U_WINDOWS) || defined(U_ELF) +#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) #define CAN_GENERATE_OBJECTS #endif diff --git a/icu4c/source/tools/gencfu/Makefile.in b/icu4c/source/tools/gencfu/Makefile.in index b966e4ed7ec..01856064184 100644 --- a/icu4c/source/tools/gencfu/Makefile.in +++ b/icu4c/source/tools/gencfu/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/gencfu -## Copyright (c) 2009 International Business Machines Corporation and +## Copyright (c) 2009-2011 International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -26,9 +26,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/gencmn/Makefile.in b/icu4c/source/tools/gencmn/Makefile.in index 2c6aafeb838..8a758d13dc7 100644 --- a/icu4c/source/tools/gencmn/Makefile.in +++ b/icu4c/source/tools/gencmn/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/gencmn -## Copyright (c) 1999-2008, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis @@ -27,9 +27,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/gencnval/Makefile.in b/icu4c/source/tools/gencnval/Makefile.in index c4c2ab56be8..985f1e3a606 100644 --- a/icu4c/source/tools/gencnval/Makefile.in +++ b/icu4c/source/tools/gencnval/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/gencnval -## Copyright (c) 1999-2005, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis @@ -27,9 +27,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/genctd/Makefile.in b/icu4c/source/tools/genctd/Makefile.in index daefb61b37f..f202702dec5 100644 --- a/icu4c/source/tools/genctd/Makefile.in +++ b/icu4c/source/tools/genctd/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/genctd -## Copyright (c) 2002-2006 International Business Machines Corporation and +## Copyright (c) 2002-2011 International Business Machines Corporation and ## others. All Rights Reserved. ## Source directory information @@ -26,9 +26,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/gennorm2/Makefile.in b/icu4c/source/tools/gennorm2/Makefile.in index f46e4664549..b8f926a7532 100644 --- a/icu4c/source/tools/gennorm2/Makefile.in +++ b/icu4c/source/tools/gennorm2/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/gennorm2 -## Copyright (c) 2009-2010, International Business Machines Corporation and +## Copyright (c) 2009-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis/Markus W. Scherer @@ -22,9 +22,6 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/genrb/Makefile.in b/icu4c/source/tools/genrb/Makefile.in index 83a67db8a6a..ae05bed8a6c 100644 --- a/icu4c/source/tools/genrb/Makefile.in +++ b/icu4c/source/tools/genrb/Makefile.in @@ -1,6 +1,6 @@ ################################################################################# ## Makefile.in for ICU - tools/genrb # -## Copyright (c) 1999-2009, International Business Machines Corporation and # +## Copyright (c) 1999-2011, International Business Machines Corporation and # ## others. All Rights Reserved. # ################################################################################# @@ -30,9 +30,6 @@ CLEANFILES = *~ $(MAN_FILES) $(DEPS) $(DERB_DEPS) TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) DERB = $(BINDIR)/$(DERB_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/genrb/derb.c b/icu4c/source/tools/genrb/derb.c index 095304fe389..65db73eba50 100644 --- a/icu4c/source/tools/genrb/derb.c +++ b/icu4c/source/tools/genrb/derb.c @@ -30,7 +30,7 @@ #include #include -#if defined(U_WINDOWS) || defined(U_CYGWIN) || defined(U_MINGW) +#if U_PLATFORM_HAS_WIN32_API #include #include #define USE_FILENO_BINARY_MODE 1 @@ -237,7 +237,7 @@ main(int argc, char* argv[]) { if (!(fromICUData = !uprv_strcmp(inputDir, "-"))) { UBool absfilename = *arg == U_FILE_SEP_CHAR; -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API if (!absfilename) { absfilename = (uprv_strlen(arg) > 2 && isalpha(arg[0]) && arg[1] == ':' && arg[2] == U_FILE_SEP_CHAR); @@ -293,7 +293,7 @@ main(int argc, char* argv[]) { if (tostdout) { out = stdout; -#if defined(U_WINDOWS) || defined(U_CYGWIN) || defined(U_MINGW) +#if U_PLATFORM_HAS_WIN32_API if (setmode(fileno(out), O_BINARY) == -1) { fprintf(stderr, "%s: couldn't set standard output to binary mode\n", pname); return 4; diff --git a/icu4c/source/tools/gensprep/Makefile.in b/icu4c/source/tools/gensprep/Makefile.in index be170ac4194..4da97bd1d86 100644 --- a/icu4c/source/tools/gensprep/Makefile.in +++ b/icu4c/source/tools/gensprep/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/gensprep -## Copyright (c) 2001-2005, International Business Machines Corporation and +## Copyright (c) 2001-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis/Markus W. Scherer @@ -27,9 +27,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/gentest/Makefile.in b/icu4c/source/tools/gentest/Makefile.in index 6d8e7eb1d26..7b70a1c0c48 100644 --- a/icu4c/source/tools/gentest/Makefile.in +++ b/icu4c/source/tools/gentest/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/gentest -## Copyright (c) 1999-2008, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Madhu Katragadda @@ -20,9 +20,6 @@ CLEANFILES = *~ $(DEPS) ## Target information TARGET = gentest$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil -I$(top_srcdir)/tools/ctestfw CPPFLAGS+= -I$(top_srcdir)/i18n LIBS = $(LIBCTESTFW) $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/icuinfo/Makefile.in b/icu4c/source/tools/icuinfo/Makefile.in index 18b58f7b7ca..6a3f026e29d 100644 --- a/icu4c/source/tools/icuinfo/Makefile.in +++ b/icu4c/source/tools/icuinfo/Makefile.in @@ -20,9 +20,6 @@ CLEANFILES = *~ $(DEPS) $(PLUGIN_OBJECTS) $(PLUGINFILE) $(PLUGIN) ## Target information TARGET = icuinfo$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil -I$(top_srcdir)/tools/ctestfw CPPFLAGS+= -I$(top_srcdir)/i18n LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) @@ -36,7 +33,7 @@ DEPS = $(OBJECTS:.o=.d) ICUINFO_OPTS=-i ../../data/out/build/$(ICUDATA_PLATFORM_NAME) -CPPFLAGS+= "-DU_PLATFORM=\"@platform@\"" "-DU_BUILD=\"@build@\"" "-DU_HOST=\"@host@\"" "-DU_CC=\"@CC@\"" "-DU_CXX=\"@CXX@\"" +CPPFLAGS+= "-DU_BUILD=\"@build@\"" "-DU_HOST=\"@host@\"" "-DU_CC=\"@CC@\"" "-DU_CXX=\"@CXX@\"" ## List of phony targets .PHONY : all all-local install install-local clean clean-local \ diff --git a/icu4c/source/tools/icuinfo/icuinfo.cpp b/icu4c/source/tools/icuinfo/icuinfo.cpp index 4144570f1bc..6b93f4ff4af 100644 --- a/icu4c/source/tools/icuinfo/icuinfo.cpp +++ b/icu4c/source/tools/icuinfo/icuinfo.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -60,16 +60,12 @@ static void do_init() { */ static const char *getPlatform() { -#if defined(U_PLATFORM) - return U_PLATFORM; -#elif defined(U_WINDOWS) - return "Windows"; -#elif defined(U_PALMOS) - return "PalmOS"; -#elif defined(_PLATFORM_H) - return "Other (POSIX-like)"; +#if U_PLATFORM_HAS_WIN32_API + return "Windows"; +#elif U_PLATFORM == U_PF_UNKNOWN + return "unknown" #else - return "unknown" + return "Other (POSIX-like)"; #endif } @@ -78,7 +74,7 @@ void cmd_millis() printf("Milliseconds since Epoch: %.0f\n", uprv_getUTCtime()); } -void cmd_version(UBool noLoad) +void cmd_version(UBool noLoad, UErrorCode &errorCode) { UVersionInfo icu; char str[200]; @@ -92,8 +88,47 @@ void cmd_version(UBool noLoad) printf("Compiled-Unicode-Version: %s\n", U_UNICODE_VERSION); u_getUnicodeVersion(icu); u_versionToString(icu, str); - printf("Runtime-Unicode-Version: %s\n", U_UNICODE_VERSION); + printf("Runtime-Unicode-Version: %s\n", str); printf("Platform: %s\n", getPlatform()); + printf("U_PLATFORM: %d\n", U_PLATFORM); + + union { + uint8_t byte; + uint16_t word; + } u; + u.word=0x0100; + if(U_IS_BIG_ENDIAN==u.byte) { + printf("U_IS_BIG_ENDIAN: %d\n", U_IS_BIG_ENDIAN); + } else { + fprintf(stderr, " error: U_IS_BIG_ENDIAN=%d != %d=actual 'is big endian'\n", + U_IS_BIG_ENDIAN, u.byte); + errorCode=U_INTERNAL_PROGRAM_ERROR; + } + + if(U_SIZEOF_WCHAR_T==sizeof(wchar_t)) { + printf("U_SIZEOF_WCHAR_T: %d\n", U_SIZEOF_WCHAR_T); + } else { + fprintf(stderr, " error: U_SIZEOF_WCHAR_T=%d != %d=sizeof(wchar_t)\n", + U_SIZEOF_WCHAR_T, (int)sizeof(wchar_t)); + errorCode=U_INTERNAL_PROGRAM_ERROR; + } + + int charsetFamily; + if('A'==0x41) { + charsetFamily=U_ASCII_FAMILY; + } else if('A'==0xc1) { + charsetFamily=U_EBCDIC_FAMILY; + } else { + charsetFamily=-1; // unknown + } + if(U_CHARSET_FAMILY==charsetFamily) { + printf("U_CHARSET_FAMILY: %d\n", U_CHARSET_FAMILY); + } else { + fprintf(stderr, " error: U_CHARSET_FAMILY=%d != %d=actual charset family\n", + U_CHARSET_FAMILY, charsetFamily); + errorCode=U_INTERNAL_PROGRAM_ERROR; + } + #if defined(U_BUILD) printf("Build: %s\n", U_BUILD); #if defined(U_HOST) @@ -298,19 +333,19 @@ main(int argc, char* argv[]) { cmd_listplugins(); didSomething = TRUE; } - + if(options[3].doesOccur) { - cmd_version(FALSE); + cmd_version(FALSE, errorCode); didSomething = TRUE; } - + if(options[6].doesOccur) { /* 2nd part of version: cleanup */ cmd_cleanup(); didSomething = TRUE; } - + if(!didSomething) { - cmd_version(FALSE); /* at least print the version # */ + cmd_version(FALSE, errorCode); /* at least print the version # */ } return U_FAILURE(errorCode); diff --git a/icu4c/source/tools/icupkg/Makefile.in b/icu4c/source/tools/icupkg/Makefile.in index 9b67b489201..a8cd5a4b6c7 100644 --- a/icu4c/source/tools/icupkg/Makefile.in +++ b/icu4c/source/tools/icupkg/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/icupkg -## Copyright (c) 1999-2006, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis @@ -26,9 +26,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/icuswap/Makefile.in b/icu4c/source/tools/icuswap/Makefile.in index d2a3ac4e17e..e30d3d74f78 100644 --- a/icu4c/source/tools/icuswap/Makefile.in +++ b/icu4c/source/tools/icuswap/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/icuswap -## Copyright (c) 1999-2008, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis @@ -26,9 +26,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/makeconv/Makefile.in b/icu4c/source/tools/makeconv/Makefile.in index 365401e2496..f0659e07d73 100644 --- a/icu4c/source/tools/makeconv/Makefile.in +++ b/icu4c/source/tools/makeconv/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/makeconv -## Copyright (c) 1999-2005, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Stephen F. Booth @@ -26,9 +26,6 @@ CLEANFILES = *~ $(DEPS) $(MAN_FILES) ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/pkgdata/Makefile.in b/icu4c/source/tools/pkgdata/Makefile.in index 1fc6fa51a0e..04fe636e0d1 100644 --- a/icu4c/source/tools/pkgdata/Makefile.in +++ b/icu4c/source/tools/pkgdata/Makefile.in @@ -1,5 +1,5 @@ ## Makefile.in for ICU - tools/pkgdata -## Copyright (c) 1999-2009, International Business Machines Corporation and +## Copyright (c) 1999-2011, International Business Machines Corporation and ## others. All Rights Reserved. ## Steven R. Loomis @@ -30,9 +30,6 @@ endif ## Target information TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil DEFS += -DUDATA_SO_SUFFIX=\".$(SO)\" -DSTATIC_O=\"$(STATIC_O)\" LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index a7393572cdb..444248d925c 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -30,7 +30,7 @@ #include "unicode/utypes.h" #if U_HAVE_POPEN -#if (defined(U_CYGWIN) || defined(U_MINGW)) && defined(__STRICT_ANSI__) +#if (U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN) && defined(__STRICT_ANSI__) /* popen/pclose aren't defined in strict ANSI on Cygwin and MinGW */ #undef __STRICT_ANSI__ #endif @@ -63,20 +63,20 @@ U_CDECL_BEGIN #include "pkgtypes.h" U_CDECL_END -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API #ifdef __GNUC__ #define WINDOWS_WITH_GNUC #else #define WINDOWS_WITH_MSVC #endif #endif -#if !defined(WINDOWS_WITH_MSVC) && !defined(U_LINUX) +#if !defined(WINDOWS_WITH_MSVC) && !U_PLATFORM_IS_LINUX_BASED #define BUILD_DATA_WITHOUT_ASSEMBLY #endif -#if defined(WINDOWS_WITH_MSVC) || defined(U_LINUX) +#if defined(WINDOWS_WITH_MSVC) || U_PLATFORM_IS_LINUX_BASED #define CAN_WRITE_OBJ_CODE #endif -#if defined(U_CYGWIN) || defined(CYGWINMSVC) +#if U_PLATFORM == U_PF_CYGWIN || defined(CYGWINMSVC) #define USING_CYGWIN #endif @@ -86,7 +86,7 @@ U_CDECL_END * the data to generate the final data library. This can * increase the performance of the pkdata tool. */ -#if defined(OS400) +#if U_PLATFORM == U_PF_OS400 #define USE_SINGLE_CCODE_FILE #endif @@ -154,7 +154,7 @@ static struct { const char *desc; } modes[] = { { "files", 0, "Uses raw data files (no effect). Installation copies all files to the target location." }, -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API { "dll", "library", "Generates one common data file and one shared library, .dll"}, { "common", "archive", "Generates just the common file, .dat"}, { "static", "static", "Generates one statically linked library, " LIB_PREFIX "" UDATA_LIB_SUFFIX } @@ -235,7 +235,7 @@ enum { LIB_FILE_VERSION_MAJOR, LIB_FILE_VERSION, LIB_FILE_VERSION_TMP, -#ifdef U_CYGWIN +#if U_PLATFORM == U_PF_CYGWIN LIB_FILE_CYGWIN, LIB_FILE_CYGWIN_VERSION, #endif @@ -505,7 +505,7 @@ static int runCommand(const char* command, UBool specialHandling) { } if (!specialHandling) { -#if defined(USING_CYGWIN) || defined(OS400) +#if defined(USING_CYGWIN) || U_PLATFORM == U_PF_OS400 if ((len + BUFFER_PADDING_SIZE) >= SMALL_BUFFER_MAX_SIZE) { cmd = (char *)uprv_malloc(len + BUFFER_PADDING_SIZE); } else { @@ -514,7 +514,7 @@ static int runCommand(const char* command, UBool specialHandling) { #ifdef USING_CYGWIN sprintf(cmd, "bash -c \"%s\"", command); -#elif defined(OS400) +#elif U_PLATFORM == U_PF_OS400 sprintf(cmd, "QSH CMD('%s')", command); #endif #else @@ -647,7 +647,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { } } -#ifndef OS400 +#if U_PLATFORM != U_PF_OS400 /* Certain platforms have different library extension ordering. (e.g. libicudata.##.so vs libicudata.so.##) * reverseExt is FALSE if the suffix should be the version number. */ @@ -724,7 +724,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { } #ifdef CAN_WRITE_OBJ_CODE writeObjectCode(datFileNamePath, o->tmpDir, o->entryName, NULL, NULL, gencFilePath); -#ifdef U_LINUX +#if U_PLATFORM_IS_LINUX_BASED result = pkg_generateLibraryFile(targetDir, mode, gencFilePath); #elif defined(WINDOWS_WITH_MSVC) result = pkg_createWindowsDLL(mode, gencFilePath, o); @@ -737,7 +737,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { return result; } } -#ifndef U_WINDOWS +#if !U_PLATFORM_USES_ONLY_WIN32_API if(mode != MODE_STATIC) { /* Certain platforms uses archive library. (e.g. AIX) */ if(o->verbose) { @@ -748,7 +748,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { fprintf(stderr, "Error creating data archive library file.\n"); return result; } -#ifndef OS400 +#if U_PLATFORM != U_PF_OS400 /* Create symbolic links for the final library file. */ result = pkg_createSymLinks(targetDir); if (result != 0) { @@ -759,7 +759,7 @@ static int32_t pkg_executeOptions(UPKGOptions *o) { } /* !MODE_STATIC */ #endif -#if !defined(U_WINDOWS) || defined(USING_CYGWIN) +#if !U_PLATFORM_USES_ONLY_WIN32_API /* Install the libraries if option was set. */ if (o->install != NULL) { if(o->verbose) { @@ -856,7 +856,7 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version } if (version != NULL) { -#if defined(U_CYGWIN) +#if U_PLATFORM == U_PF_CYGWIN sprintf(libFileNames[LIB_FILE_CYGWIN], "cyg%s.%s", libName, pkgDataFlags[SO_EXT]); @@ -868,7 +868,7 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version uprv_strcat(pkgDataFlags[SO_EXT], "."); uprv_strcat(pkgDataFlags[SO_EXT], pkgDataFlags[A_EXT]); -#elif defined(OS400) || defined(_AIX) +#elif U_PLATFORM == U_PF_OS400 || defined(_AIX) sprintf(libFileNames[LIB_FILE_VERSION_TMP], "%s.%s", libFileNames[LIB_FILE], pkgDataFlags[SOBJ_EXT]); @@ -895,7 +895,7 @@ static void createFileNames(UPKGOptions *o, const char mode, const char *version fprintf(stdout, "# libFileName[LIB_FILE_VERSION] = %s\n", libFileNames[LIB_FILE_VERSION]); } -#if defined(U_CYGWIN) || defined(U_MINGW) +#if U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN /* Cygwin and MinGW only deals with the version major number. */ uprv_strcpy(libFileNames[LIB_FILE_VERSION_TMP], libFileNames[LIB_FILE_VERSION_MAJOR]); #endif @@ -916,7 +916,7 @@ static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling) char name1[SMALL_BUFFER_MAX_SIZE]; /* symlink file name */ char name2[SMALL_BUFFER_MAX_SIZE]; /* file name to symlink */ -#if defined (U_MINGW) +#if U_PLATFORM == U_PF_MINGW /* On MINGW, symbolic links don't need to be created. */ return result; #endif @@ -943,7 +943,7 @@ static int32_t pkg_createSymLinks(const char *targetDir, UBool specialHandling) #endif if (specialHandling) { -#ifdef U_CYGWIN +#if U_PLATFORM == U_PF_CYGWIN sprintf(name1, "%s", libFileNames[LIB_FILE_CYGWIN]); sprintf(name2, "%s", libFileNames[LIB_FILE_CYGWIN_VERSION]); #else @@ -999,7 +999,7 @@ static int32_t pkg_installLibrary(const char *installDir, const char *targetDir) fprintf(stderr, "Error installing library. Failed command: %s\n", cmd); return result; } -#elif defined(U_CYGWIN) +#elif U_PLATFORM == U_PF_CYGWIN sprintf(cmd, "cd %s && %s %s %s", targetDir, pkgDataFlags[INSTALL_CMD], @@ -1218,7 +1218,7 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c uprv_strlen(objectFile) + uprv_strlen(pkgDataFlags[LD_SONAME]) + uprv_strlen(pkgDataFlags[LD_SONAME][0] == 0 ? "" : libFileNames[LIB_FILE_VERSION_MAJOR]) + uprv_strlen(pkgDataFlags[RPATH_FLAGS]) + uprv_strlen(pkgDataFlags[BIR_FLAGS]) + BUFFER_PADDING_SIZE; -#ifdef U_CYGWIN +#if U_PLATFORM == U_PF_CYGWIN length += uprv_strlen(targetDir) + uprv_strlen(libFileNames[LIB_FILE_CYGWIN_VERSION]); #endif if ((cmd = (char *)uprv_malloc(sizeof(char) * length)) == NULL) { @@ -1227,14 +1227,14 @@ static int32_t pkg_generateLibraryFile(const char *targetDir, const char mode, c } freeCmd = TRUE; } -#if defined(U_CYGWIN) +#if U_PLATFORM == U_PF_CYGWIN sprintf(cmd, "%s%s%s %s -o %s%s %s %s%s %s %s", pkgDataFlags[GENLIB], targetDir, libFileNames[LIB_FILE_VERSION_TMP], pkgDataFlags[LDICUDTFLAGS], targetDir, libFileNames[LIB_FILE_CYGWIN_VERSION], -#elif defined(U_AIX) +#elif U_PLATFORM == U_PF_AIX sprintf(cmd, "%s %s%s;%s %s -o %s%s %s %s%s %s %s", RM_CMD, targetDir, @@ -1605,7 +1605,7 @@ static int32_t pkg_createWindowsDLL(const char mode, const char *gencFilePath, U #endif static UPKGOptions *pkg_checkFlag(UPKGOptions *o) { -#ifdef U_AIX +#if U_PLATFORM == U_PF_AIX /* AIX needs a map file. */ char *flag = NULL; int32_t length = 0; @@ -1703,7 +1703,7 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) { T_FileStream_close(f); } } -#elif defined(U_CYGWIN) +#elif U_PLATFORM == U_PF_CYGWIN /* Cygwin needs to change flag options. */ char *flag = NULL; int32_t length = 0; @@ -1721,8 +1721,8 @@ static UPKGOptions *pkg_checkFlag(UPKGOptions *o) { } uprv_memset(flag + position, 0, length - position); -#elif defined(OS400) - /* OS400 needs to fix the ld options (swap single quote with double quote) */ +#elif U_PLATFORM == U_PF_OS400 + /* OS/400 needs to fix the ld options (swap single quote with double quote) */ char *flag = NULL; int32_t length = 0; diff --git a/icu4c/source/tools/pkgdata/pkgtypes.h b/icu4c/source/tools/pkgdata/pkgtypes.h index 2f47239d17a..4fa86559465 100644 --- a/icu4c/source/tools/pkgdata/pkgtypes.h +++ b/icu4c/source/tools/pkgdata/pkgtypes.h @@ -1,6 +1,6 @@ /************************************************************************** * -* Copyright (C) 2000-2009, International Business Machines +* Copyright (C) 2000-2011, International Business Machines * Corporation and others. All Rights Reserved. * *************************************************************************** @@ -132,7 +132,7 @@ char * convertToNativePathSeparators(char *path); /* set up common defines for library naming */ -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API # ifndef UDATA_SO_SUFFIX # define UDATA_SO_SUFFIX ".dll" # endif @@ -141,7 +141,7 @@ char * convertToNativePathSeparators(char *path); # define OBJ_SUFFIX ".obj" # define UDATA_LIB_SUFFIX ".lib" -#elif defined(U_CYGWIN) +#elif U_PLATFORM == U_PF_CYGWIN # define LIB_PREFIX "cyg" # define LIB_STATIC_PREFIX "lib" # define OBJ_SUFFIX ".o" diff --git a/icu4c/source/tools/toolutil/Makefile.in b/icu4c/source/tools/toolutil/Makefile.in index 02ab0e8ea8d..abada61250a 100644 --- a/icu4c/source/tools/toolutil/Makefile.in +++ b/icu4c/source/tools/toolutil/Makefile.in @@ -43,9 +43,6 @@ DYNAMICCXXFLAGS = $(SHAREDLIBCXXFLAGS) CFLAGS += $(LIBCFLAGS) CXXFLAGS += $(LIBCXXFLAGS) -ifneq ($(top_builddir),$(top_srcdir)) -CPPFLAGS += -I$(top_builddir)/common -endif CPPFLAGS += -I$(top_srcdir)/common -I$(top_srcdir)/i18n $(LIBCPPFLAGS) DEFS += -DU_TOOLUTIL_IMPLEMENTATION LDFLAGS += $(LDFLAGSICUTOOLUTIL) diff --git a/icu4c/source/tools/toolutil/filestrm.c b/icu4c/source/tools/toolutil/filestrm.c index bf646916f61..7309747c705 100644 --- a/icu4c/source/tools/toolutil/filestrm.c +++ b/icu4c/source/tools/toolutil/filestrm.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1997-2005, International Business Machines +* Copyright (C) 1997-2011, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -43,7 +43,7 @@ U_CAPI FileStream* U_EXPORT2 T_FileStream_wopen(const wchar_t* filename, const wchar_t* mode) { // TBD: _wfopen is believed to be MS-specific? -#if defined(U_WINDOWS) +#if U_PLATFORM_USES_ONLY_WIN32_API FILE* result = _wfopen(filename, mode); return (FileStream*)result; #else diff --git a/icu4c/source/tools/toolutil/pkg_genc.c b/icu4c/source/tools/toolutil/pkg_genc.c index 931a4418ecf..c065d57f37f 100644 --- a/icu4c/source/tools/toolutil/pkg_genc.c +++ b/icu4c/source/tools/toolutil/pkg_genc.c @@ -1,11 +1,11 @@ /****************************************************************************** - * Copyright (C) 2009-2010, International Business Machines + * Copyright (C) 2009-2011, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* */ #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # define NOUSER @@ -19,7 +19,7 @@ # endif #endif -#ifdef U_LINUX +#if U_PLATFORM_IS_LINUX_BASED # define U_ELF #endif @@ -51,7 +51,7 @@ #define HEX_0X 0 /* 0x1234 */ #define HEX_0H 1 /* 01234h */ -#if defined(U_WINDOWS) || defined(U_ELF) +#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) #define CAN_GENERATE_OBJECTS #endif @@ -65,7 +65,7 @@ write8(FileStream *out, uint8_t byte, uint32_t column); static uint32_t write32(FileStream *out, uint32_t byte, uint32_t column); -#ifdef OS400 +#if U_PLATFORM == U_PF_OS400 static uint32_t write8str(FileStream *out, uint8_t byte, uint32_t column); #endif @@ -359,7 +359,7 @@ writeCCode(const char *filename, const char *destdir, const char *optName, const } } -#ifdef OS400 +#if U_PLATFORM == U_PF_OS400 /* TODO: Fix this once the compiler implements this feature. Keep in sync with udatamem.c @@ -531,7 +531,7 @@ write8(FileStream *out, uint8_t byte, uint32_t column) { return column; } -#ifdef OS400 +#if U_PLATFORM == U_PF_OS400 static uint32_t write8str(FileStream *out, uint8_t byte, uint32_t column) { char s[8]; @@ -628,7 +628,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char #ifdef U_ELF Elf32_Ehdr header32; /* Elf32_Ehdr and ELF64_Ehdr are identical for the necessary fields. */ -#elif defined(U_WINDOWS) +#elif U_PLATFORM_HAS_WIN32_API IMAGE_FILE_HEADER header; #endif } buffer; @@ -639,7 +639,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char #ifdef U_ELF -#elif defined(U_WINDOWS) +#elif U_PLATFORM_HAS_WIN32_API const IMAGE_FILE_HEADER *pHeader; #else # error "Unknown platform for CAN_GENERATE_OBJECTS." @@ -654,7 +654,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char *pCPU=EM_386; *pBits=32; *pIsBigEndian=(UBool)(U_IS_BIG_ENDIAN ? ELFDATA2MSB : ELFDATA2LSB); -#elif defined(U_WINDOWS) +#elif U_PLATFORM_HAS_WIN32_API /* _M_IA64 should be defined in windows.h */ # if defined(_M_IA64) *pCPU=IMAGE_FILE_MACHINE_IA64; @@ -715,7 +715,7 @@ getArchitecture(uint16_t *pCPU, uint16_t *pBits, UBool *pIsBigEndian, const char /* TODO: Support byte swapping */ *pCPU=buffer.header32.e_machine; -#elif defined(U_WINDOWS) +#elif U_PLATFORM_HAS_WIN32_API if(length #include "unicode/utypes.h" -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API # define VC_EXTRALEAN # define WIN32_LEAN_AND_MEAN # define NOUSER @@ -37,7 +37,7 @@ #endif /* In MinGW environment, io.h needs to be included for _mkdir() */ -#ifdef U_MINGW +#if U_PLATFORM == U_PF_MINGW #include #endif @@ -86,7 +86,7 @@ U_CAPI int32_t U_EXPORT2 getCurrentYear() { U_CAPI const char * U_EXPORT2 getLongPathname(const char *pathname) { -#ifdef U_WINDOWS +#if U_PLATFORM_HAS_WIN32_API /* anticipate problems with "short" pathnames */ static WIN32_FIND_DATAA info; HANDLE file=FindFirstFileA(pathname, &info); @@ -166,13 +166,13 @@ U_CAPI void U_EXPORT2 uprv_mkdir(const char *pathname, UErrorCode *status) { int retVal = 0; -#if defined(U_WINDOWS) || defined(U_MINGW) +#if U_PLATFORM_USES_ONLY_WIN32_API retVal = _mkdir(pathname); #else retVal = mkdir(pathname, S_IRWXU | (S_IROTH | S_IXOTH) | (S_IROTH | S_IXOTH)); #endif if (retVal && errno != EEXIST) { -#if defined(U_CYGWIN) || defined(U_MINGW) +#if U_PF_MINGW <= U_PLATFORM && U_PLATFORM <= U_PF_CYGWIN /*if using Cygwin and the mkdir says it failed...check if the directory already exists..*/ /* if it does...don't give the error, if it does not...give the error - Brian Rower - 6/25/08 */ struct stat st; diff --git a/icu4c/source/tools/toolutil/toolutil.h b/icu4c/source/tools/toolutil/toolutil.h index be32942cde4..980d2dbc548 100644 --- a/icu4c/source/tools/toolutil/toolutil.h +++ b/icu4c/source/tools/toolutil/toolutil.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2010, International Business Machines +* Copyright (C) 1999-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -21,7 +21,7 @@ #include "unicode/utypes.h" -#ifdef XP_CPLUSPLUS +#ifdef __cplusplus #include "unicode/errorcode.h" diff --git a/icu4c/source/tools/toolutil/uoptions.h b/icu4c/source/tools/toolutil/uoptions.h index 55e30f681b2..43db65f281f 100644 --- a/icu4c/source/tools/toolutil/uoptions.h +++ b/icu4c/source/tools/toolutil/uoptions.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2000, International Business Machines +* Copyright (C) 2000-2011, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -22,7 +22,7 @@ #include "unicode/utypes.h" /* This should usually be called before calling u_parseArgs */ -/*#if defined(OS390) && (U_CHARSET_FAMILY == U_ASCII_FAMILY)*/ +/*#if U_PLATFORM == U_PF_OS390 && (U_CHARSET_FAMILY == U_ASCII_FAMILY)*/ /* translate args from EBCDIC to ASCII */ /*# define U_MAIN_INIT_ARGS(argc, argv) __argvtoascii_a(argc, argv)*/ /*#elif defined(XP_MAC_CONSOLE)*/