ICU-11574 fix Cherokee case folding data: add scf->self mappings for characters that do not have sfc (map to self) but have slc (ICU code: sfc falls back to slc)

X-SVN-Rev: 37374
This commit is contained in:
Markus Scherer 2015-04-21 23:55:18 +00:00
parent 928da728d6
commit f917158366

View file

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2004-2012, International Business Machines
* Copyright (C) 2004-2015, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -435,6 +435,20 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
value|=UCASE_EXCEPTION;
}
// Simple case folding falls back to simple lowercasing.
// If there is no case folding but there is a lowercase mapping,
// then add a case folding mapping to the code point.
// For example: Cherokee uppercase syllables since Unicode 8.
// (Full case folding falls back to simple case folding,
// not to full lowercasing, so we need not also handle it specially
// for such cases.)
UChar32 scf=props.scf;
if(scf<0 && props.slc>=0) {
scf=start;
hasMapping=TRUE;
value|=UCASE_EXCEPTION;
}
if(delta<UCASE_MIN_DELTA || UCASE_MAX_DELTA<delta) {
value|=UCASE_EXCEPTION;
}
@ -485,6 +499,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
errorCode=U_MEMORY_ALLOCATION_ERROR;
return;
}
newExcProps->props.scf=scf;
newExcProps->hasConditionalCaseMappings=newValues.contains(PPUCD_CONDITIONAL_CASE_MAPPINGS);
newExcProps->hasTurkicCaseFolding=newValues.contains(PPUCD_TURKIC_CASE_FOLDING);
value|=(uint32_t)excPropsCount<<UGENCASE_EXC_SHIFT;
@ -504,7 +519,7 @@ CasePropsBuilder::setProps(const UniProps &props, const UnicodeSet &newValues,
if(hasMapping) {
/* update the case-sensitive set */
caseSensitive.add(start);
if(props.scf>=0) { caseSensitive.add(props.scf); }
if(scf>=0) { caseSensitive.add(scf); }
if(props.slc>=0) { caseSensitive.add(props.slc); }
if(props.suc>=0) { caseSensitive.add(props.suc); }
if(props.stc>=0) { caseSensitive.add(props.stc); }
@ -907,10 +922,9 @@ CasePropsBuilder::makeException(UChar32 c, uint32_t value, ExcProps &ep, UErrorC
excWord|=U_MASK(UCASE_EXC_LOWER);
}
if( p.scf>=0 &&
(p.slc>=0 ?
p.slc!=p.slc :
p.slc!=c)
) {
(p.slc>=0 ?
p.scf!=p.slc :
p.scf!=c)) {
slots[count]=(uint32_t)p.scf;
slotBits|=slots[count];
++count;