ICU-4790 Spoof detection build failures with UCONFIG_NO_REGULAR_EXPRESSIONS

X-SVN-Rev: 25981
This commit is contained in:
Andy Heninger 2009-05-04 05:45:27 +00:00
parent 7088240fd8
commit 625bc9086e
11 changed files with 39 additions and 20 deletions

View File

@ -37,13 +37,9 @@
#include "uspoof_buildconf.h"
#include "uspoof_buildwsconf.h"
#include <stdio.h> // DEBUG
U_NAMESPACE_USE
// The main data building function
U_CAPI USpoofChecker * U_EXPORT2
@ -54,6 +50,10 @@ uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
if (U_FAILURE(*status)) {
return NULL;
}
#if UCONFIG_NO_REGULAR_EXPRESSIONS
*status = U_UNSUPPORTED_ERROR;
return NULL;
#else
if (errorType!=NULL) {
*errorType = 0;
}
@ -77,5 +77,6 @@ uspoof_openFromSource(const char *confusables, int32_t confusablesLen,
This = NULL;
}
return (USpoofChecker *)This;
#endif // UCONFIG_NO_REGULAR_EXPRESSIONS
}

View File

@ -18,6 +18,7 @@
#include "unicode/utypes.h"
#include "unicode/uspoof.h"
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "unicode/unorm.h"
#include "unicode/uregex.h"
#include "unicode/ustring.h"
@ -29,8 +30,6 @@
#include "uarrsort.h"
#include "uspoof_buildconf.h"
#include "stdio.h" // DEBUG. Remove.
U_NAMESPACE_USE
@ -591,3 +590,6 @@ UnicodeString ConfusabledataBuilder::getMapping(int32_t index) {
}
return UnicodeString();
}
#endif // !UCONFIG_NO_REGULAR_EXPRESSIONS

View File

@ -19,6 +19,8 @@
#ifndef __USPOOF_BUILDCONF_H__
#define __USPOOF_BUILDCONF_H__
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "uspoof_impl.h"
// SPUString
@ -120,4 +122,5 @@ class ConfusabledataBuilder : public UMemory {
int32_t confusablesLen, int32_t *errorType, UParseError *pe, UErrorCode &status);
};
#endif
#endif // !UCONFIG_NO_REGULAR_EXPRESSIONS
#endif // __USPOOF_BUILDCONF_H__

View File

@ -20,6 +20,9 @@
#include "unicode/utypes.h"
#include "unicode/uspoof.h"
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "unicode/unorm.h"
#include "unicode/uregex.h"
#include "unicode/ustring.h"
@ -30,8 +33,6 @@
#include "uassert.h"
#include "uspoof_buildwsconf.h"
//#include <stdio.h> // TODO: debug. remove.
U_NAMESPACE_USE
@ -427,5 +428,5 @@ BuilderScriptSet::~BuilderScriptSet() {
}
}
#endif // !UCONFIG_NO_REGULAR_EXPRESSIONS

View File

@ -20,6 +20,10 @@
#ifndef __USPOOF_BUILDWSCONF_H__
#define __USPOOF_BUILDWSCONF_H__
#include "unicode/utypes.h"
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "uspoof_impl.h"
#include "utrie2.h"
@ -53,4 +57,5 @@ void buildWSConfusableData(SpoofImpl *spImpl, const char * confusablesWS,
int32_t confusablesWSLen, UParseError *pe, UErrorCode &status);
#endif // !UCONFIG_NO_REGULAR_EXPRESSIONS
#endif

View File

@ -76,7 +76,9 @@ void addAllTests(TestNode** root)
#if !UCONFIG_NO_TRANSLITERATION
addUTransTest(root);
#endif
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
addUSpoofTest(root);
#endif
}

View File

@ -18,6 +18,7 @@
**/
#include "unicode/utypes.h"
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include <stdlib.h>
#include <stdio.h>
@ -518,3 +519,4 @@ static void TestUSpoofCAPI(void) {
TEST_TEARDOWN;
}
#endif /* UCONFIG_NO_REGULAR_EXPRESSIONS */

View File

@ -181,12 +181,13 @@ void MajorTestLevel::runIndexedTest( int32_t index, UBool exec, const char* &nam
break;
case 14: name = "spoof";
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
if (exec) {
logln("TestSuite SpoofDetection---"); logln();
IntlTestSpoof test;
callTest(test, par);
}
#endif
break;
default: name = ""; break;

View File

@ -10,7 +10,7 @@
#include "unicode/utypes.h"
#if !UCONFIG_NO_SPOOF_DETECT
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "itspoof.h"
#include "unicode/uspoof.h"
@ -245,5 +245,5 @@ void IntlTestSpoof::testInvisible() {
TEST_ASSERT_EQ(7, position);
TEST_TEARDOWN;
}
#endif // UCONFIG_NO_REGULAR_EXPRESSIONS
#endif /* #if !UCONFIG_NO_SPOOF_DETECT*/

View File

@ -13,6 +13,7 @@
#define INTLTESTSPOOF_H
#include "unicode/utypes.h"
#if !UCONFIG_NO_REGULAR_EXPRESSIONS
#include "unicode/uspoof.h"
#include "intltest.h"
@ -36,5 +37,5 @@ public:
const char *input, const char *expected, int32_t lineNum);
};
#endif // !UCONFIG_NO_REGULAR_EXPRESSIONS
#endif

View File

@ -74,7 +74,7 @@ void usageAndDie(int retCode) {
}
#if UCONFIG_NO_BREAK_ITERATION
#if UCONFIG_NO_REGULAR_EXPRESSIONS
/* dummy UDataInfo cf. udata.h */
static UDataInfo dummyDataInfo = {
@ -181,14 +181,16 @@ int main(int argc, char **argv) {
copyright = U_COPYRIGHT_STRING;
}
#if UCONFIG_NO_SPOOF_DETECTION
// TOOD: implement UCONFIG_NO_SPOOF_DETECTION in uconfig.h, or decide we don't want it and take this out.
#if UCONFIG_NO_REGULAR_EXPRESSIONS
// spoof detection data file parsing is dependent on regular expressions.
// TODO: have the tool return an error status. Requires fixing the ICU data build
// so that it doesn't abort entirely on that error.
UNewDataMemory *pData;
char msg[1024];
/* write message with just the name */
sprintf(msg, "gencfu writes dummy %s because of UCONFIG_NO_SPOOF_DETECTION, see uconfig.h", outFileName);
sprintf(msg, "gencfu writes dummy %s because of UCONFIG_NO_REGULAR_EXPRESSIONS, see uconfig.h", outFileName);
fprintf(stderr, "%s\n", msg);
/* write the dummy data file */
@ -289,8 +291,7 @@ int main(int argc, char **argv) {
u_cleanup();
printf("gencfu: tool completed successfully.\n");
return 0;
#endif /* #if !UCONFIG_NO_BREAK_ITERATION */
#endif // UCONFIG_NO_REGULAR_EXPRESSIONS
}