ICU-96 support for collation data

X-SVN-Rev: 2886
This commit is contained in:
Vladimir Weinstein 2000-11-08 22:56:34 +00:00
parent abc83a863c
commit 93097aa9f4
6 changed files with 61 additions and 13 deletions

View file

@ -196,7 +196,9 @@ CompactShortArray* ucmp16_openAdopt(uint16_t *indexArray,
{
CompactShortArray* this_obj = (CompactShortArray*) uprv_malloc(sizeof(CompactShortArray));
return ucmp16_initAdopt(this_obj, indexArray, newValues, count, defaultValue);
ucmp16_initAdopt(this_obj, indexArray, newValues, count, defaultValue);
this_obj->fIAmOwned = FALSE;
return this_obj;
}
CompactShortArray* ucmp16_openAdoptWithBlockShift(uint16_t *indexArray,
@ -224,7 +226,9 @@ CompactShortArray* ucmp16_openAlias(uint16_t *indexArray,
{
CompactShortArray* this_obj = (CompactShortArray*) uprv_malloc(sizeof(CompactShortArray));
return ucmp16_initAlias(this_obj, indexArray, newValues, count, defaultValue);
ucmp16_initAlias(this_obj, indexArray, newValues, count, defaultValue);
this_obj->fIAmOwned = FALSE;
return this_obj;
}
/*=======================================================*/
@ -247,7 +251,7 @@ CompactShortArray* ucmp16_initAdopt(CompactShortArray *this_obj,
this_obj->kBlockShift = UCMP16_kBlockShift;
this_obj->kBlockMask = UCMP16_kBlockMask;
this_obj->fAlias = FALSE;
this_obj->fIAmOwned = FALSE;
this_obj->fIAmOwned = TRUE;
}
return this_obj;
@ -289,7 +293,7 @@ CompactShortArray* ucmp16_initAlias(CompactShortArray *this_obj,
this_obj->kBlockShift = UCMP16_kBlockShift;
this_obj->kBlockMask = UCMP16_kBlockMask;
this_obj->fAlias = TRUE;
this_obj->fIAmOwned = FALSE;
this_obj->fIAmOwned = TRUE;
}
return this_obj;

View file

@ -271,7 +271,20 @@ CompactIntArray* ucmp32_openAdopt(uint16_t *indexArray,
{
CompactIntArray* this_obj = (CompactIntArray*) uprv_malloc(sizeof(CompactIntArray));
return ucmp32_initAdopt(this_obj, indexArray, newValues, count);
ucmp32_initAdopt(this_obj, indexArray, newValues, count);
this_obj->fIAmOwned = FALSE;
return this_obj;
}
CompactIntArray* ucmp32_openAlias(uint16_t *indexArray,
int32_t *newValues,
int32_t count)
{
CompactIntArray* this_obj = (CompactIntArray*) uprv_malloc(sizeof(CompactIntArray));
ucmp32_initAlias(this_obj, indexArray, newValues, count);
this_obj->fIAmOwned = FALSE;
return this_obj;
}
/*=======================================================*/
@ -290,12 +303,31 @@ CompactIntArray* ucmp32_initAdopt(CompactIntArray* this_obj,
this_obj->fIndex = indexArray;
this_obj->fCompact = (UBool)((count < UCMP32_kUnicodeCount) ? TRUE : FALSE);
this_obj->fAlias = FALSE;
this_obj->fIAmOwned = FALSE;
this_obj->fIAmOwned = TRUE;
}
return this_obj;
}
CompactIntArray* ucmp32_initAlias(CompactIntArray* this_obj,
uint16_t *indexArray,
int32_t *newValues,
int32_t count)
{
if (this_obj) {
this_obj->fCount = count;
this_obj->fBogus = FALSE;
this_obj->fStructSize = sizeof(CompactIntArray);
this_obj->fArray = newValues;
this_obj->fIndex = indexArray;
this_obj->fCompact = (UBool)((count < UCMP32_kUnicodeCount) ? TRUE : FALSE);
this_obj->fAlias = TRUE;
this_obj->fIAmOwned = TRUE;
}
return this_obj;
}
/*=======================================================*/
void ucmp32_close(CompactIntArray* this_obj)

View file

@ -77,7 +77,7 @@
* @see CompactIntArray
* @see CompactCharArray
* @see CompactStringArray
* @version $Revision: 1.13 $ 8/25/98
* @version $Revision: 1.14 $ 8/25/98
* @author Helena Shih
*/
/*====================================*/
@ -124,6 +124,9 @@ U_CAPI CompactIntArray* U_EXPORT2 ucmp32_openAdopt(uint16_t *indexArray,
int32_t *newValues,
int32_t count);
U_CAPI CompactIntArray* U_EXPORT2 ucmp32_openAlias(uint16_t *indexArray,
int32_t *newValues,
int32_t count);
/**
* Initialize a CompactIntArray from a pre-computed index and values array. The values
* will be adopted by the CompactIntArray. No memory is allocated. Note: for speed,
@ -140,6 +143,11 @@ U_CAPI CompactIntArray* U_EXPORT2 ucmp32_initAdopt(CompactIntArray *this_obj,
int32_t *newValues,
int32_t count);
U_CAPI CompactIntArray* U_EXPORT2 ucmp32_initAlias(CompactIntArray *this_obj,
uint16_t *indexArray,
int32_t *newValues,
int32_t count);
U_CAPI void U_EXPORT2 ucmp32_close(CompactIntArray* array);
/**

View file

@ -178,7 +178,9 @@ CompactByteArray* ucmp8_openAdopt(uint16_t *indexArray,
{
CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
return ucmp8_initAdopt(this_obj, indexArray, newValues, count);
ucmp8_initAdopt(this_obj, indexArray, newValues, count);
this_obj->fIAmOwned = FALSE;
return this_obj;
}
CompactByteArray* ucmp8_openAlias(uint16_t *indexArray,
@ -187,7 +189,9 @@ CompactByteArray* ucmp8_openAlias(uint16_t *indexArray,
{
CompactByteArray* this_obj = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
return ucmp8_initAlias(this_obj, indexArray, newValues, count);
ucmp8_initAlias(this_obj, indexArray, newValues, count);
this_obj->fIAmOwned = FALSE;
return this_obj;
}
/*=======================================================*/
@ -206,7 +210,7 @@ CompactByteArray* ucmp8_initAdopt(CompactByteArray *this_obj,
this_obj->fIndex = indexArray;
this_obj->fCompact = (UBool)((count < UCMP8_kUnicodeCount) ? TRUE : FALSE);
this_obj->fAlias = FALSE;
this_obj->fIAmOwned = FALSE;
this_obj->fIAmOwned = TRUE;
}
return this_obj;
@ -228,7 +232,7 @@ CompactByteArray* ucmp8_initAlias(CompactByteArray *this_obj,
this_obj->fIndex = indexArray;
this_obj->fCompact = (UBool)((count < UCMP8_kUnicodeCount) ? TRUE : FALSE);
this_obj->fAlias = TRUE;
this_obj->fIAmOwned = FALSE;
this_obj->fIAmOwned = TRUE;
}
return this_obj;

View file

@ -876,9 +876,9 @@ RuleBasedCollator::RuleBasedCollator( const Locale& desiredLocale,
// data exists, step 5 is repeated with hardcoded default rules.
const char *locName = constructFromBundle(desiredLocale, status); /*!*/
data->desiredLocale = desiredLocale;
if (U_SUCCESS(status)) {
data->desiredLocale = desiredLocale;
data->realLocaleName = locName;
if(status != U_USING_DEFAULT_ERROR) {
setDecomposition(Normalizer::NO_OP);

View file

@ -196,7 +196,7 @@ void TableCollationData::streamIn(UMemoryStream* is)
// Slight ugliness: We are a friend of TableCollation solely so
// we can access the constant UNMAPPED here. In fact, this code
// path shouldn't really happen, because mapping should always != 0.
if (mapping == 0) mapping = ucmp32_open(RuleBasedCollator::UNMAPPED);
if (mapping == 0) mapping = ucmp32_openAlias(NULL, NULL, 0);
if (mapping->fBogus ){
fBogus = TRUE;
return;