ICU-12410 remove unused UCaseProps pointer from ucase_... functions
X-SVN-Rev: 39656
This commit is contained in:
parent
5da94f206a
commit
0e4c0199ee
@ -46,13 +46,6 @@ struct UCaseProps {
|
||||
#define INCLUDED_FROM_UCASE_CPP
|
||||
#include "ucase_props_data.h"
|
||||
|
||||
/* UCaseProps singleton ----------------------------------------------------- */
|
||||
|
||||
U_CAPI const UCaseProps * U_EXPORT2
|
||||
ucase_getSingleton() {
|
||||
return &ucase_props_singleton;
|
||||
}
|
||||
|
||||
/* set of property starts for UnicodeSet ------------------------------------ */
|
||||
|
||||
static UBool U_CALLCONV
|
||||
@ -64,7 +57,7 @@ _enumPropertyStartsRange(const void *context, UChar32 start, UChar32 /*end*/, ui
|
||||
}
|
||||
|
||||
U_CFUNC void U_EXPORT2
|
||||
ucase_addPropertyStarts(const UCaseProps * /* unused csp */, const USetAdder *sa, UErrorCode *pErrorCode) {
|
||||
ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode) {
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return;
|
||||
}
|
||||
@ -133,7 +126,7 @@ static const uint8_t flagsOffset[256]={
|
||||
/* simple case mappings ----------------------------------------------------- */
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_tolower(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
ucase_tolower(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
if(!PROPS_HAS_EXCEPTION(props)) {
|
||||
if(UCASE_GET_TYPE(props)>=UCASE_UPPER) {
|
||||
@ -150,7 +143,7 @@ ucase_tolower(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
}
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_toupper(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
ucase_toupper(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
if(!PROPS_HAS_EXCEPTION(props)) {
|
||||
if(UCASE_GET_TYPE(props)==UCASE_LOWER) {
|
||||
@ -167,7 +160,7 @@ ucase_toupper(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
}
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_totitle(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
ucase_totitle(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
if(!PROPS_HAS_EXCEPTION(props)) {
|
||||
if(UCASE_GET_TYPE(props)==UCASE_LOWER) {
|
||||
@ -198,7 +191,7 @@ static const UChar iDotTilde[3] = { 0x69, 0x307, 0x303 };
|
||||
|
||||
|
||||
U_CFUNC void U_EXPORT2
|
||||
ucase_addCaseClosure(const UCaseProps * /* unused csp */, UChar32 c, const USetAdder *sa) {
|
||||
ucase_addCaseClosure(UChar32 c, const USetAdder *sa) {
|
||||
uint16_t props;
|
||||
|
||||
/*
|
||||
@ -338,7 +331,7 @@ strcmpMax(const UChar *s, int32_t length, const UChar *t, int32_t max) {
|
||||
}
|
||||
|
||||
U_CFUNC UBool U_EXPORT2
|
||||
ucase_addStringCaseClosure(const UCaseProps * /* unused csp */, const UChar *s, int32_t length, const USetAdder *sa) {
|
||||
ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa) {
|
||||
int32_t i, start, limit, result, unfoldRows, unfoldRowWidth, unfoldStringWidth;
|
||||
|
||||
if(ucase_props_singleton.unfold==NULL || s==NULL) {
|
||||
@ -381,7 +374,7 @@ ucase_addStringCaseClosure(const UCaseProps * /* unused csp */, const UChar *s,
|
||||
for(i=unfoldStringWidth; i<unfoldRowWidth && p[i]!=0;) {
|
||||
U16_NEXT_UNSAFE(p, i, c);
|
||||
sa->add(sa->set, c);
|
||||
ucase_addCaseClosure(&ucase_props_singleton, c, sa);
|
||||
ucase_addCaseClosure(c, sa);
|
||||
}
|
||||
return TRUE;
|
||||
} else if(result<0) {
|
||||
@ -430,21 +423,21 @@ U_NAMESPACE_END
|
||||
|
||||
/** @return UCASE_NONE, UCASE_LOWER, UCASE_UPPER, UCASE_TITLE */
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_getType(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
ucase_getType(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
return UCASE_GET_TYPE(props);
|
||||
}
|
||||
|
||||
/** @return same as ucase_getType() and set bit 2 if c is case-ignorable */
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_getTypeOrIgnorable(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
ucase_getTypeOrIgnorable(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
return UCASE_GET_TYPE_AND_IGNORABLE(props);
|
||||
}
|
||||
|
||||
/** @return UCASE_NO_DOT, UCASE_SOFT_DOTTED, UCASE_ABOVE, UCASE_OTHER_ACCENT */
|
||||
static inline int32_t
|
||||
getDotType(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
getDotType(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
if(!PROPS_HAS_EXCEPTION(props)) {
|
||||
return props&UCASE_DOT_MASK;
|
||||
@ -455,12 +448,12 @@ getDotType(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
ucase_isSoftDotted(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
return (UBool)(getDotType(&ucase_props_singleton, c)==UCASE_SOFT_DOTTED);
|
||||
ucase_isSoftDotted(UChar32 c) {
|
||||
return (UBool)(getDotType(c)==UCASE_SOFT_DOTTED);
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
ucase_isCaseSensitive(const UCaseProps * /* unused csp */, UChar32 c) {
|
||||
ucase_isCaseSensitive(UChar32 c) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
return (UBool)((props&UCASE_SENSITIVE)!=0);
|
||||
}
|
||||
@ -727,7 +720,7 @@ ucase_getCaseLocale(const char *locale) {
|
||||
* it is also cased or not.
|
||||
*/
|
||||
static UBool
|
||||
isFollowedByCasedLetter(const UCaseProps * /* unused csp */, UCaseContextIterator *iter, void *context, int8_t dir) {
|
||||
isFollowedByCasedLetter(UCaseContextIterator *iter, void *context, int8_t dir) {
|
||||
UChar32 c;
|
||||
|
||||
if(iter==NULL) {
|
||||
@ -735,7 +728,7 @@ isFollowedByCasedLetter(const UCaseProps * /* unused csp */, UCaseContextIterato
|
||||
}
|
||||
|
||||
for(/* dir!=0 sets direction */; (c=iter(context, dir))>=0; dir=0) {
|
||||
int32_t type=ucase_getTypeOrIgnorable(&ucase_props_singleton, c);
|
||||
int32_t type=ucase_getTypeOrIgnorable(c);
|
||||
if(type&4) {
|
||||
/* case-ignorable, continue with the loop */
|
||||
} else if(type!=UCASE_NONE) {
|
||||
@ -750,7 +743,7 @@ isFollowedByCasedLetter(const UCaseProps * /* unused csp */, UCaseContextIterato
|
||||
|
||||
/* Is preceded by Soft_Dotted character with no intervening cc=230 ? */
|
||||
static UBool
|
||||
isPrecededBySoftDotted(const UCaseProps * /* unused csp */, UCaseContextIterator *iter, void *context) {
|
||||
isPrecededBySoftDotted(UCaseContextIterator *iter, void *context) {
|
||||
UChar32 c;
|
||||
int32_t dotType;
|
||||
int8_t dir;
|
||||
@ -760,7 +753,7 @@ isPrecededBySoftDotted(const UCaseProps * /* unused csp */, UCaseContextIterator
|
||||
}
|
||||
|
||||
for(dir=-1; (c=iter(context, dir))>=0; dir=0) {
|
||||
dotType=getDotType(&ucase_props_singleton, c);
|
||||
dotType=getDotType(c);
|
||||
if(dotType==UCASE_SOFT_DOTTED) {
|
||||
return TRUE; /* preceded by TYPE_i */
|
||||
} else if(dotType!=UCASE_OTHER_ACCENT) {
|
||||
@ -807,7 +800,7 @@ isPrecededBySoftDotted(const UCaseProps * /* unused csp */, UCaseContextIterator
|
||||
|
||||
/* Is preceded by base character 'I' with no intervening cc=230 ? */
|
||||
static UBool
|
||||
isPrecededBy_I(const UCaseProps * /* unused csp */, UCaseContextIterator *iter, void *context) {
|
||||
isPrecededBy_I(UCaseContextIterator *iter, void *context) {
|
||||
UChar32 c;
|
||||
int32_t dotType;
|
||||
int8_t dir;
|
||||
@ -820,7 +813,7 @@ isPrecededBy_I(const UCaseProps * /* unused csp */, UCaseContextIterator *iter,
|
||||
if(c==0x49) {
|
||||
return TRUE; /* preceded by I */
|
||||
}
|
||||
dotType=getDotType(&ucase_props_singleton, c);
|
||||
dotType=getDotType(c);
|
||||
if(dotType!=UCASE_OTHER_ACCENT) {
|
||||
return FALSE; /* preceded by different base character (not I), or intervening cc==230 */
|
||||
}
|
||||
@ -831,7 +824,7 @@ isPrecededBy_I(const UCaseProps * /* unused csp */, UCaseContextIterator *iter,
|
||||
|
||||
/* Is followed by one or more cc==230 ? */
|
||||
static UBool
|
||||
isFollowedByMoreAbove(const UCaseProps * /* unused csp */, UCaseContextIterator *iter, void *context) {
|
||||
isFollowedByMoreAbove(UCaseContextIterator *iter, void *context) {
|
||||
UChar32 c;
|
||||
int32_t dotType;
|
||||
int8_t dir;
|
||||
@ -841,7 +834,7 @@ isFollowedByMoreAbove(const UCaseProps * /* unused csp */, UCaseContextIterator
|
||||
}
|
||||
|
||||
for(dir=1; (c=iter(context, dir))>=0; dir=0) {
|
||||
dotType=getDotType(&ucase_props_singleton, c);
|
||||
dotType=getDotType(c);
|
||||
if(dotType==UCASE_ABOVE) {
|
||||
return TRUE; /* at least one cc==230 following */
|
||||
} else if(dotType!=UCASE_OTHER_ACCENT) {
|
||||
@ -854,7 +847,7 @@ isFollowedByMoreAbove(const UCaseProps * /* unused csp */, UCaseContextIterator
|
||||
|
||||
/* Is followed by a dot above (without cc==230 in between) ? */
|
||||
static UBool
|
||||
isFollowedByDotAbove(const UCaseProps * /* unused csp */, UCaseContextIterator *iter, void *context) {
|
||||
isFollowedByDotAbove(UCaseContextIterator *iter, void *context) {
|
||||
UChar32 c;
|
||||
int32_t dotType;
|
||||
int8_t dir;
|
||||
@ -867,7 +860,7 @@ isFollowedByDotAbove(const UCaseProps * /* unused csp */, UCaseContextIterator *
|
||||
if(c==0x307) {
|
||||
return TRUE;
|
||||
}
|
||||
dotType=getDotType(&ucase_props_singleton, c);
|
||||
dotType=getDotType(c);
|
||||
if(dotType!=UCASE_OTHER_ACCENT) {
|
||||
return FALSE; /* next base character or cc==230 in between */
|
||||
}
|
||||
@ -877,7 +870,7 @@ isFollowedByDotAbove(const UCaseProps * /* unused csp */, UCaseContextIterator *
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullLower(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
ucase_toFullLower(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t loc) {
|
||||
@ -908,7 +901,7 @@ ucase_toFullLower(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
if( loc==UCASE_LOC_LITHUANIAN &&
|
||||
/* base characters, find accents above */
|
||||
(((c==0x49 || c==0x4a || c==0x12e) &&
|
||||
isFollowedByMoreAbove(&ucase_props_singleton, iter, context)) ||
|
||||
isFollowedByMoreAbove(iter, context)) ||
|
||||
/* precomposed with accent above, no need to find one */
|
||||
(c==0xcc || c==0xcd || c==0x128))
|
||||
) {
|
||||
@ -960,7 +953,7 @@ ucase_toFullLower(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
0130; 0069; 0130; 0130; az # LATIN CAPITAL LETTER I WITH DOT ABOVE
|
||||
*/
|
||||
return 0x69;
|
||||
} else if(loc==UCASE_LOC_TURKISH && c==0x307 && isPrecededBy_I(&ucase_props_singleton, iter, context)) {
|
||||
} else if(loc==UCASE_LOC_TURKISH && c==0x307 && isPrecededBy_I(iter, context)) {
|
||||
/*
|
||||
# When lowercasing, remove dot_above in the sequence I + dot_above, which will turn into i.
|
||||
# This matches the behavior of the canonically equivalent I-dot_above
|
||||
@ -969,7 +962,7 @@ ucase_toFullLower(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE
|
||||
*/
|
||||
return 0; /* remove the dot (continue without output) */
|
||||
} else if(loc==UCASE_LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(&ucase_props_singleton, iter, context)) {
|
||||
} else if(loc==UCASE_LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(iter, context)) {
|
||||
/*
|
||||
# When lowercasing, unless an I is before a dot_above, it turns into a dotless i.
|
||||
|
||||
@ -986,8 +979,8 @@ ucase_toFullLower(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
*pString=iDot;
|
||||
return 2;
|
||||
} else if( c==0x3a3 &&
|
||||
!isFollowedByCasedLetter(&ucase_props_singleton, iter, context, 1) &&
|
||||
isFollowedByCasedLetter(&ucase_props_singleton, iter, context, -1) /* -1=preceded */
|
||||
!isFollowedByCasedLetter(iter, context, 1) &&
|
||||
isFollowedByCasedLetter(iter, context, -1) /* -1=preceded */
|
||||
) {
|
||||
/* greek capital sigma maps depending on surrounding cased letters (see SpecialCasing.txt) */
|
||||
/*
|
||||
@ -1021,7 +1014,7 @@ ucase_toFullLower(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
|
||||
/* internal */
|
||||
static int32_t
|
||||
toUpperOrTitle(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
toUpperOrTitle(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t loc,
|
||||
@ -1056,7 +1049,7 @@ toUpperOrTitle(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
0069; 0069; 0130; 0130; az; # LATIN SMALL LETTER I
|
||||
*/
|
||||
return 0x130;
|
||||
} else if(loc==UCASE_LOC_LITHUANIAN && c==0x307 && isPrecededBySoftDotted(&ucase_props_singleton, iter, context)) {
|
||||
} else if(loc==UCASE_LOC_LITHUANIAN && c==0x307 && isPrecededBySoftDotted(iter, context)) {
|
||||
/*
|
||||
# Lithuanian
|
||||
|
||||
@ -1114,19 +1107,19 @@ toUpperOrTitle(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullUpper(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
ucase_toFullUpper(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t caseLocale) {
|
||||
return toUpperOrTitle(&ucase_props_singleton, c, iter, context, pString, caseLocale, TRUE);
|
||||
return toUpperOrTitle(c, iter, context, pString, caseLocale, TRUE);
|
||||
}
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullTitle(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
ucase_toFullTitle(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t caseLocale) {
|
||||
return toUpperOrTitle(&ucase_props_singleton, c, iter, context, pString, caseLocale, FALSE);
|
||||
return toUpperOrTitle(c, iter, context, pString, caseLocale, FALSE);
|
||||
}
|
||||
|
||||
/* case folding ------------------------------------------------------------- */
|
||||
@ -1172,7 +1165,7 @@ ucase_toFullTitle(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
|
||||
/* return the simple case folding mapping for c */
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_fold(const UCaseProps * /* unused csp */, UChar32 c, uint32_t options) {
|
||||
ucase_fold(UChar32 c, uint32_t options) {
|
||||
uint16_t props=UTRIE2_GET16(&ucase_props_singleton.trie, c);
|
||||
if(!PROPS_HAS_EXCEPTION(props)) {
|
||||
if(UCASE_GET_TYPE(props)>=UCASE_UPPER) {
|
||||
@ -1232,7 +1225,7 @@ ucase_fold(const UCaseProps * /* unused csp */, UChar32 c, uint32_t options) {
|
||||
*/
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullFolding(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
ucase_toFullFolding(UChar32 c,
|
||||
const UChar **pString,
|
||||
uint32_t options) {
|
||||
// The sign of the result has meaning, input must be non-negative so that it can be returned as is.
|
||||
@ -1306,42 +1299,40 @@ ucase_toFullFolding(const UCaseProps * /* unused csp */, UChar32 c,
|
||||
|
||||
/* case mapping properties API ---------------------------------------------- */
|
||||
|
||||
#define GET_CASE_PROPS() &ucase_props_singleton
|
||||
|
||||
/* public API (see uchar.h) */
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isULowercase(UChar32 c) {
|
||||
return (UBool)(UCASE_LOWER==ucase_getType(GET_CASE_PROPS(), c));
|
||||
return (UBool)(UCASE_LOWER==ucase_getType(c));
|
||||
}
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
u_isUUppercase(UChar32 c) {
|
||||
return (UBool)(UCASE_UPPER==ucase_getType(GET_CASE_PROPS(), c));
|
||||
return (UBool)(UCASE_UPPER==ucase_getType(c));
|
||||
}
|
||||
|
||||
/* Transforms the Unicode character to its lower case equivalent.*/
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
u_tolower(UChar32 c) {
|
||||
return ucase_tolower(GET_CASE_PROPS(), c);
|
||||
return ucase_tolower(c);
|
||||
}
|
||||
|
||||
/* Transforms the Unicode character to its upper case equivalent.*/
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
u_toupper(UChar32 c) {
|
||||
return ucase_toupper(GET_CASE_PROPS(), c);
|
||||
return ucase_toupper(c);
|
||||
}
|
||||
|
||||
/* Transforms the Unicode character to its title case equivalent.*/
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
u_totitle(UChar32 c) {
|
||||
return ucase_totitle(GET_CASE_PROPS(), c);
|
||||
return ucase_totitle(c);
|
||||
}
|
||||
|
||||
/* return the simple case folding mapping for c */
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
u_foldCase(UChar32 c, uint32_t options) {
|
||||
return ucase_fold(GET_CASE_PROPS(), c, options);
|
||||
return ucase_fold(c, options);
|
||||
}
|
||||
|
||||
U_CFUNC int32_t U_EXPORT2
|
||||
@ -1350,17 +1341,17 @@ ucase_hasBinaryProperty(UChar32 c, UProperty which) {
|
||||
const UChar *resultString;
|
||||
switch(which) {
|
||||
case UCHAR_LOWERCASE:
|
||||
return (UBool)(UCASE_LOWER==ucase_getType(&ucase_props_singleton, c));
|
||||
return (UBool)(UCASE_LOWER==ucase_getType(c));
|
||||
case UCHAR_UPPERCASE:
|
||||
return (UBool)(UCASE_UPPER==ucase_getType(&ucase_props_singleton, c));
|
||||
return (UBool)(UCASE_UPPER==ucase_getType(c));
|
||||
case UCHAR_SOFT_DOTTED:
|
||||
return ucase_isSoftDotted(&ucase_props_singleton, c);
|
||||
return ucase_isSoftDotted(c);
|
||||
case UCHAR_CASE_SENSITIVE:
|
||||
return ucase_isCaseSensitive(&ucase_props_singleton, c);
|
||||
return ucase_isCaseSensitive(c);
|
||||
case UCHAR_CASED:
|
||||
return (UBool)(UCASE_NONE!=ucase_getType(&ucase_props_singleton, c));
|
||||
return (UBool)(UCASE_NONE!=ucase_getType(c));
|
||||
case UCHAR_CASE_IGNORABLE:
|
||||
return (UBool)(ucase_getTypeOrIgnorable(&ucase_props_singleton, c)>>2);
|
||||
return (UBool)(ucase_getTypeOrIgnorable(c)>>2);
|
||||
/*
|
||||
* Note: The following Changes_When_Xyz are defined as testing whether
|
||||
* the NFD form of the input changes when Xyz-case-mapped.
|
||||
@ -1374,17 +1365,17 @@ ucase_hasBinaryProperty(UChar32 c, UProperty which) {
|
||||
* start sets for normalization and case mappings.
|
||||
*/
|
||||
case UCHAR_CHANGES_WHEN_LOWERCASED:
|
||||
return (UBool)(ucase_toFullLower(&ucase_props_singleton, c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
return (UBool)(ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
case UCHAR_CHANGES_WHEN_UPPERCASED:
|
||||
return (UBool)(ucase_toFullUpper(&ucase_props_singleton, c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
return (UBool)(ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
case UCHAR_CHANGES_WHEN_TITLECASED:
|
||||
return (UBool)(ucase_toFullTitle(&ucase_props_singleton, c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
return (UBool)(ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
/* case UCHAR_CHANGES_WHEN_CASEFOLDED: -- in uprops.c */
|
||||
case UCHAR_CHANGES_WHEN_CASEMAPPED:
|
||||
return (UBool)(
|
||||
ucase_toFullLower(&ucase_props_singleton, c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullUpper(&ucase_props_singleton, c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullTitle(&ucase_props_singleton, c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
ucase_toFullLower(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullUpper(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0 ||
|
||||
ucase_toFullTitle(c, NULL, NULL, &resultString, UCASE_LOC_ROOT)>=0);
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -37,18 +37,8 @@ U_NAMESPACE_END
|
||||
|
||||
/* library API -------------------------------------------------------------- */
|
||||
|
||||
U_CDECL_BEGIN
|
||||
|
||||
struct UCaseProps;
|
||||
typedef struct UCaseProps UCaseProps;
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
U_CAPI const UCaseProps * U_EXPORT2
|
||||
ucase_getSingleton(void);
|
||||
|
||||
U_CFUNC void U_EXPORT2
|
||||
ucase_addPropertyStarts(const UCaseProps *csp, const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
ucase_addPropertyStarts(const USetAdder *sa, UErrorCode *pErrorCode);
|
||||
|
||||
/**
|
||||
* Requires non-NULL locale ID but otherwise does the equivalent of
|
||||
@ -87,16 +77,16 @@ enum {
|
||||
/* single-code point functions */
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_tolower(const UCaseProps *csp, UChar32 c);
|
||||
ucase_tolower(UChar32 c);
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_toupper(const UCaseProps *csp, UChar32 c);
|
||||
ucase_toupper(UChar32 c);
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_totitle(const UCaseProps *csp, UChar32 c);
|
||||
ucase_totitle(UChar32 c);
|
||||
|
||||
U_CAPI UChar32 U_EXPORT2
|
||||
ucase_fold(const UCaseProps *csp, UChar32 c, uint32_t options);
|
||||
ucase_fold(UChar32 c, uint32_t options);
|
||||
|
||||
/**
|
||||
* Adds all simple case mappings and the full case folding for c to sa,
|
||||
@ -108,7 +98,7 @@ ucase_fold(const UCaseProps *csp, UChar32 c, uint32_t options);
|
||||
* - for k include the Kelvin sign
|
||||
*/
|
||||
U_CFUNC void U_EXPORT2
|
||||
ucase_addCaseClosure(const UCaseProps *csp, UChar32 c, const USetAdder *sa);
|
||||
ucase_addCaseClosure(UChar32 c, const USetAdder *sa);
|
||||
|
||||
/**
|
||||
* Maps the string to single code points and adds the associated case closure
|
||||
@ -123,7 +113,7 @@ ucase_addCaseClosure(const UCaseProps *csp, UChar32 c, const USetAdder *sa);
|
||||
* @return TRUE if the string was found
|
||||
*/
|
||||
U_CFUNC UBool U_EXPORT2
|
||||
ucase_addStringCaseClosure(const UCaseProps *csp, const UChar *s, int32_t length, const USetAdder *sa);
|
||||
ucase_addStringCaseClosure(const UChar *s, int32_t length, const USetAdder *sa);
|
||||
|
||||
#ifdef __cplusplus
|
||||
U_NAMESPACE_BEGIN
|
||||
@ -157,17 +147,17 @@ U_NAMESPACE_END
|
||||
|
||||
/** @return UCASE_NONE, UCASE_LOWER, UCASE_UPPER, UCASE_TITLE */
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_getType(const UCaseProps *csp, UChar32 c);
|
||||
ucase_getType(UChar32 c);
|
||||
|
||||
/** @return like ucase_getType() but also sets UCASE_IGNORABLE if c is case-ignorable */
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_getTypeOrIgnorable(const UCaseProps *csp, UChar32 c);
|
||||
ucase_getTypeOrIgnorable(UChar32 c);
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
ucase_isSoftDotted(const UCaseProps *csp, UChar32 c);
|
||||
ucase_isSoftDotted(UChar32 c);
|
||||
|
||||
U_CAPI UBool U_EXPORT2
|
||||
ucase_isCaseSensitive(const UCaseProps *csp, UChar32 c);
|
||||
ucase_isCaseSensitive(UChar32 c);
|
||||
|
||||
/* string case mapping functions */
|
||||
|
||||
@ -248,25 +238,25 @@ enum {
|
||||
* @internal
|
||||
*/
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullLower(const UCaseProps *csp, UChar32 c,
|
||||
ucase_toFullLower(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t caseLocale);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullUpper(const UCaseProps *csp, UChar32 c,
|
||||
ucase_toFullUpper(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t caseLocale);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullTitle(const UCaseProps *csp, UChar32 c,
|
||||
ucase_toFullTitle(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t caseLocale);
|
||||
|
||||
U_CAPI int32_t U_EXPORT2
|
||||
ucase_toFullFolding(const UCaseProps *csp, UChar32 c,
|
||||
ucase_toFullFolding(UChar32 c,
|
||||
const UChar **pString,
|
||||
uint32_t options);
|
||||
|
||||
@ -280,7 +270,7 @@ U_CDECL_BEGIN
|
||||
* @internal
|
||||
*/
|
||||
typedef int32_t U_CALLCONV
|
||||
UCaseMapFull(const UCaseProps *csp, UChar32 c,
|
||||
UCaseMapFull(UChar32 c,
|
||||
UCaseContextIterator *iter, void *context,
|
||||
const UChar **pString,
|
||||
int32_t caseLocale);
|
||||
|
@ -290,7 +290,7 @@ _caseMap(int32_t caseLocale, uint32_t /* TODO: options */, UCaseMapFull *map,
|
||||
}
|
||||
continue;
|
||||
}
|
||||
c=map(NULL, c, utf8_caseContextIterator, csc, &s, caseLocale);
|
||||
c=map(c, utf8_caseContextIterator, csc, &s, caseLocale);
|
||||
if((destIndex<destCapacity) && (c<0 ? (c2=~c)<=0x7f : UCASE_MAX_STRING_LENGTH<c && (c2=c)<=0x7f)) {
|
||||
/* fast path version of appendResult() for ASCII results */
|
||||
dest[destIndex++]=(uint8_t)c2;
|
||||
@ -364,7 +364,7 @@ ucasemap_internalUTF8ToTitle(
|
||||
/* find and copy uncased characters [prev..titleStart[ */
|
||||
titleStart=titleLimit=prev;
|
||||
U8_NEXT(src, titleLimit, idx, c);
|
||||
if((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0 && UCASE_NONE==ucase_getType(NULL, c)) {
|
||||
if((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0 && UCASE_NONE==ucase_getType(c)) {
|
||||
/* Adjust the titlecasing index (titleStart) to the next cased character. */
|
||||
for(;;) {
|
||||
titleStart=titleLimit;
|
||||
@ -376,7 +376,7 @@ ucasemap_internalUTF8ToTitle(
|
||||
break;
|
||||
}
|
||||
U8_NEXT(src, titleLimit, idx, c);
|
||||
if(UCASE_NONE!=ucase_getType(NULL, c)) {
|
||||
if(UCASE_NONE!=ucase_getType(c)) {
|
||||
break; /* cased letter at [titleStart..titleLimit[ */
|
||||
}
|
||||
}
|
||||
@ -392,7 +392,7 @@ ucasemap_internalUTF8ToTitle(
|
||||
if(c>=0) {
|
||||
csc.cpStart=titleStart;
|
||||
csc.cpLimit=titleLimit;
|
||||
c=ucase_toFullTitle(NULL, c, utf8_caseContextIterator, &csc, &s, caseLocale);
|
||||
c=ucase_toFullTitle(c, utf8_caseContextIterator, &csc, &s, caseLocale);
|
||||
destIndex=appendResult(dest, destIndex, destCapacity, c, s);
|
||||
} else {
|
||||
// Malformed UTF-8.
|
||||
@ -454,11 +454,11 @@ ucasemap_internalUTF8ToTitle(
|
||||
U_NAMESPACE_BEGIN
|
||||
namespace GreekUpper {
|
||||
|
||||
UBool isFollowedByCasedLetter(const UCaseProps *csp, const uint8_t *s, int32_t i, int32_t length) {
|
||||
UBool isFollowedByCasedLetter(const uint8_t *s, int32_t i, int32_t length) {
|
||||
while (i < length) {
|
||||
UChar32 c;
|
||||
U8_NEXT(s, i, length, c);
|
||||
int32_t type = ucase_getTypeOrIgnorable(csp, c);
|
||||
int32_t type = ucase_getTypeOrIgnorable(c);
|
||||
if ((type & UCASE_IGNORABLE) != 0) {
|
||||
// Case-ignorable, continue with the loop.
|
||||
} else if (type != UCASE_NONE) {
|
||||
@ -482,7 +482,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t /* TODO: options */,
|
||||
UChar32 c;
|
||||
U8_NEXT(src, nextIndex, srcLength, c);
|
||||
uint32_t nextState = 0;
|
||||
int32_t type = ucase_getTypeOrIgnorable(NULL, c);
|
||||
int32_t type = ucase_getTypeOrIgnorable(c);
|
||||
if ((type & UCASE_IGNORABLE) != 0) {
|
||||
// c is case-ignorable
|
||||
nextState |= (state & AFTER_CASED);
|
||||
@ -532,7 +532,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t /* TODO: options */,
|
||||
(data & HAS_ACCENT) != 0 &&
|
||||
numYpogegrammeni == 0 &&
|
||||
(state & AFTER_CASED) == 0 &&
|
||||
!isFollowedByCasedLetter(NULL, src, nextIndex, srcLength)) {
|
||||
!isFollowedByCasedLetter(src, nextIndex, srcLength)) {
|
||||
// Keep disjunctive "or" with (only) a tonos.
|
||||
// We use the same "word boundary" conditions as for the Final_Sigma test.
|
||||
if (i == nextIndex) {
|
||||
@ -568,7 +568,7 @@ int32_t toUpper(int32_t caseLocale, uint32_t /* TODO: options */,
|
||||
} else if(c>=0) {
|
||||
const UChar *s;
|
||||
UChar32 c2 = 0;
|
||||
c=ucase_toFullUpper(NULL, c, NULL, NULL, &s, caseLocale);
|
||||
c=ucase_toFullUpper(c, NULL, NULL, &s, caseLocale);
|
||||
if((destIndex<destCapacity) && (c<0 ? (c2=~c)<=0x7f : UCASE_MAX_STRING_LENGTH<c && (c2=c)<=0x7f)) {
|
||||
/* fast path version of appendResult() for ASCII results */
|
||||
dest[destIndex++]=(uint8_t)c2;
|
||||
@ -658,7 +658,7 @@ ucasemap_internalUTF8Fold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_B
|
||||
}
|
||||
continue;
|
||||
}
|
||||
c=ucase_toFullFolding(NULL, c, &s, options);
|
||||
c=ucase_toFullFolding(c, &s, options);
|
||||
if((destIndex<destCapacity) && (c<0 ? (c2=~c)<=0x7f : UCASE_MAX_STRING_LENGTH<c && (c2=c)<=0x7f)) {
|
||||
/* fast path version of appendResult() for ASCII results */
|
||||
dest[destIndex++]=(uint8_t)c2;
|
||||
|
@ -184,7 +184,6 @@ UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
|
||||
return *this;
|
||||
}
|
||||
if (attribute & (USET_CASE_INSENSITIVE | USET_ADD_CASE_MAPPINGS)) {
|
||||
const UCaseProps *csp = ucase_getSingleton();
|
||||
{
|
||||
UnicodeSet foldSet(*this);
|
||||
UnicodeString str;
|
||||
@ -215,22 +214,22 @@ UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
|
||||
if (attribute & USET_CASE_INSENSITIVE) {
|
||||
// full case closure
|
||||
for (UChar32 cp=start; cp<=end; ++cp) {
|
||||
ucase_addCaseClosure(csp, cp, &sa);
|
||||
ucase_addCaseClosure(cp, &sa);
|
||||
}
|
||||
} else {
|
||||
// add case mappings
|
||||
// (does not add long s for regular s, or Kelvin for k, for example)
|
||||
for (UChar32 cp=start; cp<=end; ++cp) {
|
||||
result = ucase_toFullLower(csp, cp, NULL, NULL, &full, UCASE_LOC_ROOT);
|
||||
result = ucase_toFullLower(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
|
||||
addCaseMapping(foldSet, result, full, str);
|
||||
|
||||
result = ucase_toFullTitle(csp, cp, NULL, NULL, &full, UCASE_LOC_ROOT);
|
||||
result = ucase_toFullTitle(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
|
||||
addCaseMapping(foldSet, result, full, str);
|
||||
|
||||
result = ucase_toFullUpper(csp, cp, NULL, NULL, &full, UCASE_LOC_ROOT);
|
||||
result = ucase_toFullUpper(cp, NULL, NULL, &full, UCASE_LOC_ROOT);
|
||||
addCaseMapping(foldSet, result, full, str);
|
||||
|
||||
result = ucase_toFullFolding(csp, cp, &full, 0);
|
||||
result = ucase_toFullFolding(cp, &full, 0);
|
||||
addCaseMapping(foldSet, result, full, str);
|
||||
}
|
||||
}
|
||||
@ -240,7 +239,7 @@ UnicodeSet& UnicodeSet::closeOver(int32_t attribute) {
|
||||
for (int32_t j=0; j<strings->size(); ++j) {
|
||||
str = *(const UnicodeString *) strings->elementAt(j);
|
||||
str.foldCase();
|
||||
if(!ucase_addStringCaseClosure(csp, str.getBuffer(), str.length(), &sa)) {
|
||||
if(!ucase_addStringCaseClosure(str.getBuffer(), str.length(), &sa)) {
|
||||
foldSet.add(str); // does not map to code points: add the folded string itself
|
||||
}
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ void U_CALLCONV UnicodeSet_initInclusion(int32_t src, UErrorCode &status) {
|
||||
if(U_SUCCESS(status)) {
|
||||
impl->addPropertyStarts(&sa, status);
|
||||
}
|
||||
ucase_addPropertyStarts(ucase_getSingleton(), &sa, &status);
|
||||
ucase_addPropertyStarts(&sa, &status);
|
||||
break;
|
||||
}
|
||||
case UPROPS_SRC_NFC: {
|
||||
@ -228,7 +228,7 @@ void U_CALLCONV UnicodeSet_initInclusion(int32_t src, UErrorCode &status) {
|
||||
}
|
||||
#endif
|
||||
case UPROPS_SRC_CASE:
|
||||
ucase_addPropertyStarts(ucase_getSingleton(), &sa, &status);
|
||||
ucase_addPropertyStarts(&sa, &status);
|
||||
break;
|
||||
case UPROPS_SRC_BIDI:
|
||||
ubidi_addPropertyStarts(ubidi_getSingleton(), &sa, &status);
|
||||
|
@ -145,7 +145,6 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
|
||||
uint32_t options,
|
||||
UErrorCode *pErrorCode) {
|
||||
const Normalizer2Impl *nfcImpl;
|
||||
const UCaseProps *csp;
|
||||
|
||||
/* current-level start/limit - s1/s2 as current */
|
||||
const UChar *start1, *start2, *limit1, *limit2;
|
||||
@ -183,11 +182,6 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
|
||||
} else {
|
||||
nfcImpl=NULL;
|
||||
}
|
||||
if((options&U_COMPARE_IGNORE_CASE)!=0) {
|
||||
csp=ucase_getSingleton();
|
||||
} else {
|
||||
csp=NULL;
|
||||
}
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
@ -319,7 +313,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
|
||||
*/
|
||||
|
||||
if( level1==0 && (options&U_COMPARE_IGNORE_CASE) &&
|
||||
(length=ucase_toFullFolding(csp, (UChar32)cp1, &p, options))>=0
|
||||
(length=ucase_toFullFolding((UChar32)cp1, &p, options))>=0
|
||||
) {
|
||||
/* cp1 case-folds to the code point "length" or to p[length] */
|
||||
if(U_IS_SURROGATE(c1)) {
|
||||
@ -364,7 +358,7 @@ unorm_cmpEquivFold(const UChar *s1, int32_t length1,
|
||||
}
|
||||
|
||||
if( level2==0 && (options&U_COMPARE_IGNORE_CASE) &&
|
||||
(length=ucase_toFullFolding(csp, (UChar32)cp2, &p, options))>=0
|
||||
(length=ucase_toFullFolding((UChar32)cp2, &p, options))>=0
|
||||
) {
|
||||
/* cp2 case-folds to the code point "length" or to p[length] */
|
||||
if(U_IS_SURROGATE(c2)) {
|
||||
|
@ -128,9 +128,8 @@ static UBool changesWhenCasefolded(const BinaryProperty &/*prop*/, UChar32 c, UP
|
||||
}
|
||||
if(c>=0) {
|
||||
/* single code point */
|
||||
const UCaseProps *csp=ucase_getSingleton();
|
||||
const UChar *resultString;
|
||||
return (UBool)(ucase_toFullFolding(csp, c, &resultString, U_FOLD_CASE_DEFAULT)>=0);
|
||||
return (UBool)(ucase_toFullFolding(c, &resultString, U_FOLD_CASE_DEFAULT)>=0);
|
||||
} else {
|
||||
/* guess some large but stack-friendly capacity */
|
||||
UChar dest[2*UCASE_MAX_STRING_LENGTH];
|
||||
@ -576,14 +575,13 @@ u_getFC_NFKC_Closure(UChar32 c, UChar *dest, int32_t destCapacity, UErrorCode *p
|
||||
// case folding and NFKC.)
|
||||
// For the derivation, see Unicode's DerivedNormalizationProps.txt.
|
||||
const Normalizer2 *nfkc=Normalizer2::getNFKCInstance(*pErrorCode);
|
||||
const UCaseProps *csp=ucase_getSingleton();
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
// first: b = NFKC(Fold(a))
|
||||
UnicodeString folded1String;
|
||||
const UChar *folded1;
|
||||
int32_t folded1Length=ucase_toFullFolding(csp, c, &folded1, U_FOLD_CASE_DEFAULT);
|
||||
int32_t folded1Length=ucase_toFullFolding(c, &folded1, U_FOLD_CASE_DEFAULT);
|
||||
if(folded1Length<0) {
|
||||
const Normalizer2Impl *nfkcImpl=Normalizer2Factory::getImpl(nfkc);
|
||||
if(nfkcImpl->getCompQuickCheck(nfkcImpl->getNorm16(c))!=UNORM_NO) {
|
||||
|
@ -217,7 +217,7 @@ _caseMap(int32_t caseLocale, uint32_t options, UCaseMapFull *map,
|
||||
U16_NEXT(src, srcIndex, srcLimit, c);
|
||||
csc->cpLimit=srcIndex;
|
||||
const UChar *s;
|
||||
c=map(NULL, c, utf16_caseContextIterator, csc, &s, caseLocale);
|
||||
c=map(c, utf16_caseContextIterator, csc, &s, caseLocale);
|
||||
destIndex = appendResult(dest, destIndex, destCapacity, c, s,
|
||||
srcIndex - cpStart, options, edits);
|
||||
if (destIndex < 0) {
|
||||
@ -282,7 +282,7 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
|
||||
int32_t titleLimit=prev;
|
||||
UChar32 c;
|
||||
U16_NEXT(src, titleLimit, index, c);
|
||||
if((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0 && UCASE_NONE==ucase_getType(NULL, c)) {
|
||||
if((options&U_TITLECASE_NO_BREAK_ADJUSTMENT)==0 && UCASE_NONE==ucase_getType(c)) {
|
||||
/* Adjust the titlecasing index (titleStart) to the next cased character. */
|
||||
for(;;) {
|
||||
titleStart=titleLimit;
|
||||
@ -294,7 +294,7 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
|
||||
break;
|
||||
}
|
||||
U16_NEXT(src, titleLimit, index, c);
|
||||
if(UCASE_NONE!=ucase_getType(NULL, c)) {
|
||||
if(UCASE_NONE!=ucase_getType(c)) {
|
||||
break; /* cased letter at [titleStart..titleLimit[ */
|
||||
}
|
||||
}
|
||||
@ -311,7 +311,7 @@ ustrcase_internalToTitle(int32_t caseLocale, uint32_t options, BreakIterator *it
|
||||
csc.cpStart=titleStart;
|
||||
csc.cpLimit=titleLimit;
|
||||
const UChar *s;
|
||||
c=ucase_toFullTitle(NULL, c, utf16_caseContextIterator, &csc, &s, caseLocale);
|
||||
c=ucase_toFullTitle(c, utf16_caseContextIterator, &csc, &s, caseLocale);
|
||||
destIndex=appendResult(dest, destIndex, destCapacity, c, s,
|
||||
titleLimit-titleStart, options, edits);
|
||||
if(destIndex<0) {
|
||||
@ -830,11 +830,11 @@ uint32_t getDiacriticData(UChar32 c) {
|
||||
}
|
||||
}
|
||||
|
||||
UBool isFollowedByCasedLetter(const UCaseProps *csp, const UChar *s, int32_t i, int32_t length) {
|
||||
UBool isFollowedByCasedLetter(const UChar *s, int32_t i, int32_t length) {
|
||||
while (i < length) {
|
||||
UChar32 c;
|
||||
U16_NEXT(s, i, length, c);
|
||||
int32_t type = ucase_getTypeOrIgnorable(csp, c);
|
||||
int32_t type = ucase_getTypeOrIgnorable(c);
|
||||
if ((type & UCASE_IGNORABLE) != 0) {
|
||||
// Case-ignorable, continue with the loop.
|
||||
} else if (type != UCASE_NONE) {
|
||||
@ -864,7 +864,7 @@ int32_t toUpper(uint32_t options,
|
||||
UChar32 c;
|
||||
U16_NEXT(src, nextIndex, srcLength, c);
|
||||
uint32_t nextState = 0;
|
||||
int32_t type = ucase_getTypeOrIgnorable(NULL, c);
|
||||
int32_t type = ucase_getTypeOrIgnorable(c);
|
||||
if ((type & UCASE_IGNORABLE) != 0) {
|
||||
// c is case-ignorable
|
||||
nextState |= (state & AFTER_CASED);
|
||||
@ -911,7 +911,7 @@ int32_t toUpper(uint32_t options,
|
||||
(data & HAS_ACCENT) != 0 &&
|
||||
numYpogegrammeni == 0 &&
|
||||
(state & AFTER_CASED) == 0 &&
|
||||
!isFollowedByCasedLetter(NULL, src, nextIndex, srcLength)) {
|
||||
!isFollowedByCasedLetter(src, nextIndex, srcLength)) {
|
||||
// Keep disjunctive "or" with (only) a tonos.
|
||||
// We use the same "word boundary" conditions as for the Final_Sigma test.
|
||||
if (i == nextIndex) {
|
||||
@ -980,7 +980,7 @@ int32_t toUpper(uint32_t options,
|
||||
}
|
||||
} else {
|
||||
const UChar *s;
|
||||
c=ucase_toFullUpper(NULL, c, NULL, NULL, &s, UCASE_LOC_GREEK);
|
||||
c=ucase_toFullUpper(c, NULL, NULL, &s, UCASE_LOC_GREEK);
|
||||
destIndex = appendResult(dest, destIndex, destCapacity, c, s,
|
||||
nextIndex - i, options, edits);
|
||||
if (destIndex < 0) {
|
||||
@ -1051,7 +1051,7 @@ ustrcase_internalFold(int32_t /* caseLocale */, uint32_t options, UCASEMAP_BREAK
|
||||
UChar32 c;
|
||||
U16_NEXT(src, srcIndex, srcLength, c);
|
||||
const UChar *s;
|
||||
c = ucase_toFullFolding(NULL, c, &s, options);
|
||||
c = ucase_toFullFolding(c, &s, options);
|
||||
destIndex = appendResult(dest, destIndex, destCapacity, c, s,
|
||||
srcIndex - cpStart, options, edits);
|
||||
if (destIndex < 0) {
|
||||
@ -1241,8 +1241,6 @@ static int32_t _cmpFold(
|
||||
UErrorCode *pErrorCode) {
|
||||
int32_t cmpRes = 0;
|
||||
|
||||
const UCaseProps *csp;
|
||||
|
||||
/* current-level start/limit - s1/s2 as current */
|
||||
const UChar *start1, *start2, *limit1, *limit2;
|
||||
|
||||
@ -1274,7 +1272,6 @@ static int32_t _cmpFold(
|
||||
* assume that at least the option U_COMPARE_IGNORE_CASE is set
|
||||
* otherwise this function would have to behave exactly as uprv_strCompare()
|
||||
*/
|
||||
csp=ucase_getSingleton();
|
||||
if(U_FAILURE(*pErrorCode)) {
|
||||
return 0;
|
||||
}
|
||||
@ -1456,7 +1453,7 @@ static int32_t _cmpFold(
|
||||
*/
|
||||
|
||||
if( level1==0 &&
|
||||
(length=ucase_toFullFolding(csp, (UChar32)cp1, &p, options))>=0
|
||||
(length=ucase_toFullFolding((UChar32)cp1, &p, options))>=0
|
||||
) {
|
||||
/* cp1 case-folds to the code point "length" or to p[length] */
|
||||
if(U_IS_SURROGATE(c1)) {
|
||||
@ -1502,7 +1499,7 @@ static int32_t _cmpFold(
|
||||
}
|
||||
|
||||
if( level2==0 &&
|
||||
(length=ucase_toFullFolding(csp, (UChar32)cp2, &p, options))>=0
|
||||
(length=ucase_toFullFolding((UChar32)cp2, &p, options))>=0
|
||||
) {
|
||||
/* cp2 case-folds to the code point "length" or to p[length] */
|
||||
if(U_IS_SURROGATE(c2)) {
|
||||
|
@ -92,7 +92,6 @@ UOBJECT_DEFINE_ABSTRACT_RTTI_IMPLEMENTATION(CaseMapTransliterator)
|
||||
*/
|
||||
CaseMapTransliterator::CaseMapTransliterator(const UnicodeString &id, UCaseMapFull *map) :
|
||||
Transliterator(id, 0),
|
||||
fCsp(ucase_getSingleton()),
|
||||
fMap(map)
|
||||
{
|
||||
// TODO test incremental mode with context-sensitive text (e.g. greek sigma)
|
||||
@ -110,7 +109,7 @@ CaseMapTransliterator::~CaseMapTransliterator() {
|
||||
*/
|
||||
CaseMapTransliterator::CaseMapTransliterator(const CaseMapTransliterator& o) :
|
||||
Transliterator(o),
|
||||
fCsp(o.fCsp), fMap(o.fMap)
|
||||
fMap(o.fMap)
|
||||
{
|
||||
}
|
||||
|
||||
@ -119,7 +118,6 @@ CaseMapTransliterator::CaseMapTransliterator(const CaseMapTransliterator& o) :
|
||||
*/
|
||||
/*CaseMapTransliterator& CaseMapTransliterator::operator=(const CaseMapTransliterator& o) {
|
||||
Transliterator::operator=(o);
|
||||
fCsp = o.fCsp;
|
||||
fMap = o.fMap;
|
||||
return *this;
|
||||
}*/
|
||||
@ -158,7 +156,7 @@ void CaseMapTransliterator::handleTransliterate(Replaceable& text,
|
||||
c=text.char32At(textPos);
|
||||
csc.cpLimit=textPos+=U16_LENGTH(c);
|
||||
|
||||
result=fMap(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
|
||||
result=fMap(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
|
||||
|
||||
if(csc.b1 && isIncremental) {
|
||||
// fMap() tried to look beyond the context limit
|
||||
|
@ -84,7 +84,6 @@ protected:
|
||||
UTransPosition& offsets,
|
||||
UBool isIncremental) const;
|
||||
|
||||
const UCaseProps *fCsp;
|
||||
UCaseMapFull *fMap;
|
||||
|
||||
private:
|
||||
|
@ -19,8 +19,7 @@
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
CaseFoldingUTextIterator::CaseFoldingUTextIterator(UText &text) :
|
||||
fUText(text), fcsp(NULL), fFoldChars(NULL), fFoldLength(0) {
|
||||
fcsp = ucase_getSingleton();
|
||||
fUText(text), fFoldChars(NULL), fFoldLength(0) {
|
||||
}
|
||||
|
||||
CaseFoldingUTextIterator::~CaseFoldingUTextIterator() {}
|
||||
@ -35,7 +34,7 @@ UChar32 CaseFoldingUTextIterator::next() {
|
||||
if (originalC == U_SENTINEL) {
|
||||
return originalC;
|
||||
}
|
||||
fFoldLength = ucase_toFullFolding(fcsp, originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
|
||||
fFoldLength = ucase_toFullFolding(originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
|
||||
if (fFoldLength >= UCASE_MAX_STRING_LENGTH || fFoldLength < 0) {
|
||||
// input code point folds to a single code point, possibly itself.
|
||||
// See comment in ucase.h for explanation of return values from ucase_toFullFoldings.
|
||||
@ -65,8 +64,7 @@ UBool CaseFoldingUTextIterator::inExpansion() {
|
||||
|
||||
|
||||
CaseFoldingUCharIterator::CaseFoldingUCharIterator(const UChar *chars, int64_t start, int64_t limit) :
|
||||
fChars(chars), fIndex(start), fLimit(limit), fcsp(NULL), fFoldChars(NULL), fFoldLength(0) {
|
||||
fcsp = ucase_getSingleton();
|
||||
fChars(chars), fIndex(start), fLimit(limit), fFoldChars(NULL), fFoldLength(0) {
|
||||
}
|
||||
|
||||
|
||||
@ -84,7 +82,7 @@ UChar32 CaseFoldingUCharIterator::next() {
|
||||
}
|
||||
U16_NEXT(fChars, fIndex, fLimit, originalC);
|
||||
|
||||
fFoldLength = ucase_toFullFolding(fcsp, originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
|
||||
fFoldLength = ucase_toFullFolding(originalC, &fFoldChars, U_FOLD_CASE_DEFAULT);
|
||||
if (fFoldLength >= UCASE_MAX_STRING_LENGTH || fFoldLength < 0) {
|
||||
// input code point folds to a single code point, possibly itself.
|
||||
// See comment in ucase.h for explanation of return values from ucase_toFullFoldings.
|
||||
|
@ -374,7 +374,6 @@ class CaseFoldingUTextIterator: public UMemory {
|
||||
// folding of the same code point from the orignal UText.
|
||||
private:
|
||||
UText &fUText;
|
||||
const UCaseProps *fcsp;
|
||||
const UChar *fFoldChars;
|
||||
int32_t fFoldLength;
|
||||
int32_t fFoldIndex;
|
||||
@ -404,7 +403,6 @@ class CaseFoldingUCharIterator: public UMemory {
|
||||
const UChar *fChars;
|
||||
int64_t fIndex;
|
||||
int64_t fLimit;
|
||||
const UCaseProps *fcsp;
|
||||
const UChar *fFoldChars;
|
||||
int32_t fFoldLength;
|
||||
int32_t fFoldIndex;
|
||||
|
@ -97,7 +97,7 @@ void TitlecaseTransliterator::handleTransliterate(
|
||||
int32_t start;
|
||||
for (start = offsets.start - 1; start >= offsets.contextStart; start -= U16_LENGTH(c)) {
|
||||
c = text.char32At(start);
|
||||
type=ucase_getTypeOrIgnorable(fCsp, c);
|
||||
type=ucase_getTypeOrIgnorable(c);
|
||||
if(type>0) { // cased
|
||||
doTitle=FALSE;
|
||||
break;
|
||||
@ -125,12 +125,12 @@ void TitlecaseTransliterator::handleTransliterate(
|
||||
c=text.char32At(textPos);
|
||||
csc.cpLimit=textPos+=U16_LENGTH(c);
|
||||
|
||||
type=ucase_getTypeOrIgnorable(fCsp, c);
|
||||
type=ucase_getTypeOrIgnorable(c);
|
||||
if(type>=0) { // not case-ignorable
|
||||
if(doTitle) {
|
||||
result=ucase_toFullTitle(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
|
||||
result=ucase_toFullTitle(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
|
||||
} else {
|
||||
result=ucase_toFullLower(fCsp, c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
|
||||
result=ucase_toFullLower(c, utrans_rep_caseContextIterator, &csc, &s, UCASE_LOC_ROOT);
|
||||
}
|
||||
doTitle = (UBool)(type==0); // doTitle=isUncased
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include "uprops.h"
|
||||
#include "uset_imp.h"
|
||||
#include "usc_impl.h"
|
||||
#include "udatamem.h" /* for testing ucase_openBinary() */
|
||||
#include "udatamem.h"
|
||||
#include "cucdapi.h"
|
||||
#include "cmemory.h"
|
||||
|
||||
@ -59,7 +59,6 @@ static void TestNumericProperties(void);
|
||||
static void TestPropertyNames(void);
|
||||
static void TestPropertyValues(void);
|
||||
static void TestConsistency(void);
|
||||
static void TestUCase(void);
|
||||
static void TestUBiDiProps(void);
|
||||
static void TestCaseFolding(void);
|
||||
|
||||
@ -196,7 +195,6 @@ void addUnicodeTest(TestNode** root)
|
||||
addTest(root, &TestPropertyNames, "tsutil/cucdtst/TestPropertyNames");
|
||||
addTest(root, &TestPropertyValues, "tsutil/cucdtst/TestPropertyValues");
|
||||
addTest(root, &TestConsistency, "tsutil/cucdtst/TestConsistency");
|
||||
addTest(root, &TestUCase, "tsutil/cucdtst/TestUCase");
|
||||
addTest(root, &TestUBiDiProps, "tsutil/cucdtst/TestUBiDiProps");
|
||||
addTest(root, &TestCaseFolding, "tsutil/cucdtst/TestCaseFolding");
|
||||
}
|
||||
@ -3256,47 +3254,6 @@ TestConsistency() {
|
||||
*/
|
||||
#define HARDCODED_DATA_4497 1
|
||||
|
||||
/* API coverage for ucase.c */
|
||||
static void TestUCase() {
|
||||
#if !HARDCODED_DATA_4497
|
||||
UDataMemory *pData;
|
||||
UCaseProps *csp;
|
||||
const UCaseProps *ccsp;
|
||||
UErrorCode errorCode;
|
||||
|
||||
/* coverage for ucase_openBinary() */
|
||||
errorCode=U_ZERO_ERROR;
|
||||
pData=udata_open(NULL, UCASE_DATA_TYPE, UCASE_DATA_NAME, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
log_data_err("unable to open " UCASE_DATA_NAME "." UCASE_DATA_TYPE ": %s\n",
|
||||
u_errorName(errorCode));
|
||||
return;
|
||||
}
|
||||
|
||||
csp=ucase_openBinary((const uint8_t *)pData->pHeader, -1, &errorCode);
|
||||
if(U_FAILURE(errorCode)) {
|
||||
log_err("ucase_openBinary() fails for the contents of " UCASE_DATA_NAME "." UCASE_DATA_TYPE ": %s\n",
|
||||
u_errorName(errorCode));
|
||||
udata_close(pData);
|
||||
return;
|
||||
}
|
||||
|
||||
if(UCASE_LOWER!=ucase_getType(csp, 0xdf)) { /* verify islower(sharp s) */
|
||||
log_err("ucase_openBinary() does not seem to return working UCaseProps\n");
|
||||
}
|
||||
|
||||
ucase_close(csp);
|
||||
udata_close(pData);
|
||||
|
||||
/* coverage for ucase_getDummy() */
|
||||
errorCode=U_ZERO_ERROR;
|
||||
ccsp=ucase_getDummy(&errorCode);
|
||||
if(ucase_tolower(ccsp, 0x41)!=0x41) {
|
||||
log_err("ucase_tolower(dummy, A)!=A\n");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/* API coverage for ubidi_props.c */
|
||||
static void TestUBiDiProps() {
|
||||
#if !HARDCODED_DATA_4497
|
||||
|
Loading…
Reference in New Issue
Block a user