ICU-96 support for tailoring tests as requested by Mark Davis

X-SVN-Rev: 4288
This commit is contained in:
Vladimir Weinstein 2001-03-22 23:11:22 +00:00
parent 0e0d31e7e7
commit d8b88547bf
3 changed files with 60 additions and 3 deletions

View File

@ -85,6 +85,59 @@ static uint32_t strengthMask[UCOL_CE_STRENGTH_LIMIT] = {
0xFFFFFFFF
};
U_CAPI uint32_t U_EXPORT2 ucol_inv_getNextCE(uint32_t CE, uint32_t strength) {
uint32_t SecondCE = 0;
uint32_t *CETable = (uint32_t *)((uint8_t *)invUCA+invUCA->table);
uint32_t nextCE, nextContCE;
int32_t iCE;
iCE = ucol_inv_findCE(CE, 0);
if(iCE<0) {
return UCOL_NOT_FOUND;
}
CE &= strengthMask[strength];
SecondCE &= strengthMask[strength];
nextCE = CE;
nextContCE = 0;
while((nextCE & strengthMask[strength]) == CE
&& (nextContCE & strengthMask[strength]) == SecondCE) {
nextCE = (*(CETable+3*(++iCE)));
nextContCE = (*(CETable+3*(iCE)+1));
}
return nextCE;
}
U_CAPI uint32_t U_EXPORT2 ucol_inv_getPrevCE(uint32_t CE, uint32_t strength) {
uint32_t SecondCE = 0;
uint32_t *CETable = (uint32_t *)((uint8_t *)invUCA+invUCA->table);
uint32_t previousCE, previousContCE;
int32_t iCE;
iCE = ucol_inv_findCE(CE, 0);
if(iCE<0) {
return UCOL_NOT_FOUND;
}
CE &= strengthMask[strength];
SecondCE &= strengthMask[strength];
previousCE = CE;
previousContCE = 0;
while((previousCE & strengthMask[strength]) == CE && (previousContCE & strengthMask[strength])== SecondCE) {
previousCE = (*(CETable+3*(--iCE)));
previousContCE = (*(CETable+3*(iCE)+1));
}
return previousCE;
}
int32_t ucol_inv_getPrevious(UColTokListHeader *lh, uint32_t strength) {
uint32_t CE = lh->baseCE;

View File

@ -37,7 +37,6 @@
#include "unicode/normlzr.h"
const InverseTableHeader *ucol_initInverseUCA(UErrorCode *status);
UCATableHeader *ucol_assembleTailoringTable(UColTokenParser *src, UErrorCode *status);
typedef struct {

View File

@ -545,9 +545,14 @@ void ucol_putOptionsToHeader(UCollator* result, UCATableHeader * image, UErrorCo
uint32_t ucol_getIncrementalUCA(UChar ch, incrementalContext *collationSource, UErrorCode *status);
int32_t ucol_getIncrementalSpecialCE(const UCollator *coll, uint32_t CE, incrementalContext *ctx, UErrorCode *status);
void ucol_updateInternalState(UCollator *coll);
uint32_t ucol_getFirstCE(const UCollator *coll, UChar u, UErrorCode *status);
U_CAPI uint32_t U_EXPORT2 ucol_getFirstCE(const UCollator *coll, UChar u, UErrorCode *status);
U_CAPI char U_EXPORT2 *ucol_sortKeyToString(const UCollator *coll, const uint8_t *sortkey, char *buffer, uint32_t *len);
U_CAPI UBool isTailored(const UCollator *coll, const UChar u, UErrorCode *status);
U_CAPI UBool U_EXPORT2 isTailored(const UCollator *coll, const UChar u, UErrorCode *status);
U_CAPI const U_EXPORT2 InverseTableHeader *ucol_initInverseUCA(UErrorCode *status);
U_CAPI uint32_t U_EXPORT2 ucol_inv_getNextCE(uint32_t CE, uint32_t strength);
U_CAPI uint32_t U_EXPORT2 ucol_inv_getPrevCE(uint32_t CE, uint32_t strength);
#endif