diff --git a/icu4c/source/test/intltest/regextst.cpp b/icu4c/source/test/intltest/regextst.cpp index 5de144cd093..f752d883ef2 100644 --- a/icu4c/source/test/intltest/regextst.cpp +++ b/icu4c/source/test/intltest/regextst.cpp @@ -177,35 +177,15 @@ static void utextToPrintable(char *buf, int32_t bufLen, UText *text) { utext_setNativeIndex(text, oldIndex); } -static inline UChar toHex(int32_t i) { - return (UChar)(i + (i < 10 ? 0x30 : (0x41 - 10))); -} - -static UnicodeString& escape(const UnicodeString& s, UnicodeString& result) { - for (int32_t i=0; i0)) { - result += c; - } else { - result += (UChar)0x5c; - result += (UChar)0x75; - result += toHex((c >> 12) & 0xF); - result += toHex((c >> 8) & 0xF); - result += toHex((c >> 4) & 0xF); - result += toHex( c & 0xF); - } - } - return result; -} static char ASSERT_BUF[1024]; -static const char* extractToAssertBuf(const UnicodeString& message) { +const char* RegexTest::extractToAssertBuf(const UnicodeString& message) { if(message.length()==0) { strcpy(ASSERT_BUF, "[[empty UnicodeString]]"); } else { UnicodeString buf; - escape(message, buf); + IntlTest::prettify(message,buf); if(buf.length()==0) { strcpy(ASSERT_BUF, "[[escape() returned 0 chars]]"); } else { diff --git a/icu4c/source/test/intltest/regextst.h b/icu4c/source/test/intltest/regextst.h index 870d8f7c03a..77742fb6b15 100644 --- a/icu4c/source/test/intltest/regextst.h +++ b/icu4c/source/test/intltest/regextst.h @@ -59,6 +59,8 @@ public: virtual UChar *ReadAndConvertFile(const char *fileName, int32_t &len, const char *charset, UErrorCode &status); virtual const char *getPath(char buffer[2048], const char *filename); + static const char* extractToAssertBuf(const UnicodeString& message); + }; #endif // !UCONFIG_NO_REGULAR_EXPRESSIONS diff --git a/icu4c/source/tools/pkgdata/pkgdata.cpp b/icu4c/source/tools/pkgdata/pkgdata.cpp index 71e3462f8f6..3e0512f43c2 100644 --- a/icu4c/source/tools/pkgdata/pkgdata.cpp +++ b/icu4c/source/tools/pkgdata/pkgdata.cpp @@ -37,10 +37,17 @@ #include "flagparser.h" #include "filetools.h" +#if U_HAVE_POPEN +#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 +#endif #if U_HAVE_POPEN # include #endif + #include #include diff --git a/icu4c/source/tools/toolutil/pkg_genc.h b/icu4c/source/tools/toolutil/pkg_genc.h index 763cf86cc14..ee589a45362 100644 --- a/icu4c/source/tools/toolutil/pkg_genc.h +++ b/icu4c/source/tools/toolutil/pkg_genc.h @@ -10,6 +10,62 @@ #include "unicode/utypes.h" #include "toolutil.h" +#include "unicode/putil.h" +#include "putilimp.h" + +/*** Platform #defines move here ***/ +#if U_PLATFORM_HAS_WIN32_API +#ifdef __GNUC__ +#define WINDOWS_WITH_GNUC +#else +#define WINDOWS_WITH_MSVC +#endif +#endif + + +#if !defined(WINDOWS_WITH_MSVC) && !U_PLATFORM_IS_LINUX_BASED +#define BUILD_DATA_WITHOUT_ASSEMBLY +#endif + +#ifndef U_DISABLE_OBJ_CODE /* testing */ +#if defined(WINDOWS_WITH_MSVC) || U_PLATFORM_IS_LINUX_BASED +#define CAN_WRITE_OBJ_CODE +#endif +#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) +#define CAN_GENERATE_OBJECTS +#endif +#endif + +#if U_PLATFORM == U_PF_CYGWIN || defined(CYGWINMSVC) +#define USING_CYGWIN +#endif + +/* + * When building the data library without assembly, + * some platforms use a single c code file for all of + * the data to generate the final data library. This can + * increase the performance of the pkdata tool. + */ +#if U_PLATFORM == U_PF_OS400 +#define USE_SINGLE_CCODE_FILE +#endif + +/* Need to fix the file seperator character when using MinGW. */ +#if defined(WINDOWS_WITH_GNUC) || defined(USING_CYGWIN) +#define PKGDATA_FILE_SEP_STRING "/" +#else +#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING +#endif + +#define LARGE_BUFFER_MAX_SIZE 2048 +#define SMALL_BUFFER_MAX_SIZE 512 +#define SMALL_BUFFER_FLAG_NAMES 32 +#define BUFFER_PADDING_SIZE 20 + +/** End platform defines **/ + + + U_INTERNAL void U_EXPORT2 printAssemblyHeadersToStdErr(void); diff --git a/icu4c/source/tools/toolutil/toolutil.h b/icu4c/source/tools/toolutil/toolutil.h index c6a941cb567..360b13833f9 100644 --- a/icu4c/source/tools/toolutil/toolutil.h +++ b/icu4c/source/tools/toolutil/toolutil.h @@ -21,68 +21,6 @@ #include "unicode/utypes.h" -#include "unicode/putil.h" -#include "putilimp.h" - -/*** Platform #defines move here ***/ -#if U_PLATFORM_HAS_WIN32_API -#ifdef __GNUC__ -#define WINDOWS_WITH_GNUC -#else -#define WINDOWS_WITH_MSVC -#endif -#endif - - -#if !defined(WINDOWS_WITH_MSVC) && !U_PLATFORM_IS_LINUX_BASED -#define BUILD_DATA_WITHOUT_ASSEMBLY -#endif - -#ifndef U_DISABLE_OBJ_CODE /* testing */ -#if defined(WINDOWS_WITH_MSVC) || U_PLATFORM_IS_LINUX_BASED -#define CAN_WRITE_OBJ_CODE -#endif -#if U_PLATFORM_HAS_WIN32_API || defined(U_ELF) -#define CAN_GENERATE_OBJECTS -#endif -#endif - -#if U_PLATFORM == U_PF_CYGWIN || defined(CYGWINMSVC) -#define USING_CYGWIN -#endif - -/* - * When building the data library without assembly, - * some platforms use a single c code file for all of - * the data to generate the final data library. This can - * increase the performance of the pkdata tool. - */ -#if U_PLATFORM == U_PF_OS400 -#define USE_SINGLE_CCODE_FILE -#endif - -/* Need to fix the file seperator character when using MinGW. */ -#if defined(WINDOWS_WITH_GNUC) || defined(USING_CYGWIN) -#define PKGDATA_FILE_SEP_STRING "/" -#else -#define PKGDATA_FILE_SEP_STRING U_FILE_SEP_STRING -#endif - -#define LARGE_BUFFER_MAX_SIZE 2048 -#define SMALL_BUFFER_MAX_SIZE 512 -#define SMALL_BUFFER_FLAG_NAMES 32 -#define BUFFER_PADDING_SIZE 20 - - -#if U_HAVE_POPEN -#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 -#endif - -/** End platform defines **/ - #ifdef __cplusplus