mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-12 16:33:23 +00:00
parent
037aa7865a
commit
20934ac953
5 changed files with 67 additions and 84 deletions
|
@ -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; i<s.length(); ++i) {
|
||||
UChar c = s[i];
|
||||
if ((c <= (UChar)0x7F) && (c>0)) {
|
||||
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 {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 <unistd.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue