ICU-903 updated copyright notices.
X-SVN-Rev: 4245
This commit is contained in:
parent
6f1fa85d5b
commit
360f38dc1e
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
* @version 1.0 06/19/98
|
||||
@ -27,8 +27,8 @@ CompactByteArray* charDirArray = 0;
|
||||
static const UChar LAST_CHAR_CODE_IN_FILE = 0xFFFD;
|
||||
const char charDirStrings[] = "L R EN ES ET AN CS B S WS ON LRELROAL RLERLOPDFNSMBN ";
|
||||
|
||||
int tagValues[] = {
|
||||
0, // kLeftToRight = 0,
|
||||
int tagValues[] = {
|
||||
0, // kLeftToRight = 0,
|
||||
1, // kRightToLeft = 1,
|
||||
2, // kEuropeanNumber = 2,
|
||||
3, // kEuropeanNumberSeparator = 3,
|
||||
@ -37,7 +37,7 @@ int tagValues[] = {
|
||||
6, // kCommonNumberSeparator = 6,
|
||||
7, // kParagraphSeparator = 7,
|
||||
8, // kSegmentSeparator = 8,
|
||||
9, // kWhiteSpaceNeutral = 9,
|
||||
9, // kWhiteSpaceNeutral = 9,
|
||||
10, // kOtherNeutral = 10,
|
||||
11, // kLeftToRightEmbedding = 11,
|
||||
12, // kLeftToRightOverride = 12,
|
||||
@ -50,7 +50,7 @@ int tagValues[] = {
|
||||
|
||||
};
|
||||
|
||||
int MakeProp(char* str)
|
||||
int MakeProp(char* str)
|
||||
{
|
||||
int result = 0;
|
||||
char* matchPosition;
|
||||
@ -121,7 +121,7 @@ getArray(FILE *input)
|
||||
return charDirArray;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
writeArrays()
|
||||
{
|
||||
const int8_t* values = ucmp8_getArray(charDirArray);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
********************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-1999, International Business Machines
|
||||
* Copyright (C) 1997-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
********************************************************************
|
||||
@ -20,9 +20,9 @@
|
||||
#include "cmemory.h"
|
||||
|
||||
static int32_t findOverlappingPosition(CompactByteArray* this,
|
||||
uint32_t start,
|
||||
const UChar *tempIndex,
|
||||
int32_t tempIndexCount,
|
||||
uint32_t start,
|
||||
const UChar *tempIndex,
|
||||
int32_t tempIndexCount,
|
||||
uint32_t cycle);
|
||||
|
||||
/* internal constants*/
|
||||
@ -47,7 +47,7 @@ int32_t ucmp8_getkBlockCount() { return UCMP8_kBlockCount;}
|
||||
int32_t ucmp8_getkIndexCount(){ return UCMP8_kIndexCount;}
|
||||
/* debug flags*/
|
||||
/*=======================================================*/
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index)
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index)
|
||||
{
|
||||
return (array->fArray[(array->fIndex[index >> UCMP8_kBlockShift] & 0xFFFF) + (index & UCMP8_kBlockMask)]);
|
||||
}
|
||||
@ -80,35 +80,35 @@ CompactByteArray* ucmp8_open(int8_t defaultValue)
|
||||
*/
|
||||
CompactByteArray* this = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
|
||||
int32_t i;
|
||||
|
||||
|
||||
if (this == NULL) return NULL;
|
||||
|
||||
this->fArray = NULL;
|
||||
this->fArray = NULL;
|
||||
this->fIndex = NULL;
|
||||
this->fCount = UCMP8_kUnicodeCount;
|
||||
this->fCompact = FALSE;
|
||||
this->fCompact = FALSE;
|
||||
this->fBogus = FALSE;
|
||||
|
||||
|
||||
this->fArray = (int8_t*) uprv_malloc(sizeof(int8_t) * UCMP8_kUnicodeCount);
|
||||
if (!this->fArray)
|
||||
if (!this->fArray)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
this->fIndex = (uint16_t*) uprv_malloc(sizeof(uint16_t) * UCMP8_kIndexCount);
|
||||
if (!this->fIndex)
|
||||
if (!this->fIndex)
|
||||
{
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = NULL;
|
||||
this->fBogus = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
{
|
||||
this->fArray[i] = defaultValue;
|
||||
}
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
{
|
||||
this->fIndex[i] = (uint16_t)(i << UCMP8_kBlockShift);
|
||||
}
|
||||
@ -122,12 +122,12 @@ CompactByteArray* ucmp8_openAdopt(uint16_t *indexArray,
|
||||
{
|
||||
CompactByteArray* this = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
|
||||
if (!this) return NULL;
|
||||
|
||||
|
||||
this->fArray = NULL;
|
||||
this->fIndex = NULL;
|
||||
this->fIndex = NULL;
|
||||
this->fCount = count;
|
||||
this->fBogus = FALSE;
|
||||
|
||||
|
||||
this->fArray = newValues;
|
||||
this->fIndex = indexArray;
|
||||
this->fCompact = (count < UCMP8_kUnicodeCount) ? TRUE : FALSE;
|
||||
@ -136,8 +136,8 @@ CompactByteArray* ucmp8_openAdopt(uint16_t *indexArray,
|
||||
}
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
void ucmp8_close(CompactByteArray* this)
|
||||
|
||||
void ucmp8_close(CompactByteArray* this)
|
||||
{
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = NULL;
|
||||
@ -150,8 +150,8 @@ void ucmp8_close(CompactByteArray* this)
|
||||
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
void ucmp8_expand(CompactByteArray* this)
|
||||
|
||||
void ucmp8_expand(CompactByteArray* this)
|
||||
{
|
||||
/* can optimize later.
|
||||
* if we have to expand, then walk through the blocks instead of using Get
|
||||
@ -167,20 +167,20 @@ void ucmp8_expand(CompactByteArray* this)
|
||||
* ARRAY abcdeababcedzyabcdea...
|
||||
*/
|
||||
int32_t i;
|
||||
if (this->fCompact)
|
||||
if (this->fCompact)
|
||||
{
|
||||
int8_t* tempArray;
|
||||
tempArray = (int8_t*) uprv_malloc(sizeof(int8_t) * UCMP8_kUnicodeCount);
|
||||
if (!tempArray)
|
||||
if (!tempArray)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
{
|
||||
tempArray[i] = ucmp8_get(this,(UChar)i); /* HSYS : How expand?*/
|
||||
}
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
{
|
||||
this->fIndex[i] = (uint16_t)(i<< UCMP8_kBlockShift);
|
||||
}
|
||||
@ -189,7 +189,7 @@ void ucmp8_expand(CompactByteArray* this)
|
||||
this->fCompact = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*=======================================================*/
|
||||
/* this->fArray: an array to be overlapped
|
||||
@ -199,35 +199,35 @@ void ucmp8_expand(CompactByteArray* this)
|
||||
* inputHash[i] = XOR of values from i-count+1 to i
|
||||
*/
|
||||
int32_t
|
||||
findOverlappingPosition(CompactByteArray* this,
|
||||
findOverlappingPosition(CompactByteArray* this,
|
||||
uint32_t start,
|
||||
const UChar* tempIndex,
|
||||
int32_t tempIndexCount,
|
||||
uint32_t cycle)
|
||||
uint32_t cycle)
|
||||
{
|
||||
/* this is a utility routine for finding blocks that overlap.
|
||||
* IMPORTANT: the cycle number is very important. Small cycles take a lot
|
||||
* longer to work. In some cases, they may be able to get better compaction.
|
||||
*/
|
||||
|
||||
|
||||
int32_t i;
|
||||
int32_t j;
|
||||
int32_t currentCount;
|
||||
|
||||
for (i = 0; i < tempIndexCount; i += cycle)
|
||||
|
||||
for (i = 0; i < tempIndexCount; i += cycle)
|
||||
{
|
||||
currentCount = UCMP8_kBlockCount;
|
||||
if (i + UCMP8_kBlockCount > tempIndexCount)
|
||||
if (i + UCMP8_kBlockCount > tempIndexCount)
|
||||
{
|
||||
currentCount = tempIndexCount - i;
|
||||
}
|
||||
for (j = 0; j < currentCount; ++j)
|
||||
}
|
||||
for (j = 0; j < currentCount; ++j)
|
||||
{
|
||||
if (this->fArray[start + j] != this->fArray[tempIndex[i + j]]) break;
|
||||
}
|
||||
if (j == currentCount) break;
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -249,19 +249,19 @@ ucmp8_getIndex(const CompactByteArray* this)
|
||||
return this->fIndex;
|
||||
}
|
||||
|
||||
int32_t
|
||||
int32_t
|
||||
ucmp8_getCount(const CompactByteArray* this)
|
||||
{
|
||||
return this->fCount;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
ucmp8_set(CompactByteArray* this,
|
||||
UChar c,
|
||||
int8_t value)
|
||||
{
|
||||
if (this->fCompact == TRUE)
|
||||
if (this->fCompact == TRUE)
|
||||
{
|
||||
ucmp8_expand(this);
|
||||
if (this->fBogus) return;
|
||||
@ -270,19 +270,19 @@ ucmp8_set(CompactByteArray* this,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
ucmp8_setRange(CompactByteArray* this,
|
||||
UChar start,
|
||||
UChar end,
|
||||
int8_t value)
|
||||
{
|
||||
int32_t i;
|
||||
if (this->fCompact == TRUE)
|
||||
if (this->fCompact == TRUE)
|
||||
{
|
||||
ucmp8_expand(this);
|
||||
if (this->fBogus) return;
|
||||
}
|
||||
for (i = start; i <= end; ++i)
|
||||
for (i = start; i <= end; ++i)
|
||||
{
|
||||
this->fArray[i] = value;
|
||||
}
|
||||
@ -290,12 +290,12 @@ ucmp8_setRange(CompactByteArray* this,
|
||||
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
void
|
||||
|
||||
void
|
||||
ucmp8_compact(CompactByteArray* this,
|
||||
uint32_t cycle)
|
||||
uint32_t cycle)
|
||||
{
|
||||
if (!this->fCompact)
|
||||
if (!this->fCompact)
|
||||
{
|
||||
/* this actually does the compaction.
|
||||
* it walks throught the contents of the expanded array, finding the
|
||||
@ -311,46 +311,46 @@ ucmp8_compact(CompactByteArray* this,
|
||||
int32_t tempIndexCount;
|
||||
int8_t* tempArray;
|
||||
int32_t iBlock, iIndex;
|
||||
|
||||
|
||||
/* fix cycle, must be 0 < cycle <= blockcount*/
|
||||
if (cycle < 0) cycle = 1;
|
||||
else if (cycle > (uint32_t)UCMP8_kBlockCount) cycle = UCMP8_kBlockCount;
|
||||
|
||||
|
||||
/* make temp storage, larger than we need*/
|
||||
tempIndex = (UChar*) uprv_malloc(sizeof(UChar)* UCMP8_kUnicodeCount);
|
||||
if (!tempIndex)
|
||||
if (!tempIndex)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* set up first block.*/
|
||||
tempIndexCount = UCMP8_kBlockCount;
|
||||
for (iIndex = 0; iIndex < UCMP8_kBlockCount; ++iIndex)
|
||||
for (iIndex = 0; iIndex < UCMP8_kBlockCount; ++iIndex)
|
||||
{
|
||||
tempIndex[iIndex] = (uint16_t)iIndex;
|
||||
}; /* endfor (iIndex = 0; .....)*/
|
||||
this->fIndex[0] = 0;
|
||||
|
||||
|
||||
/* for each successive block, find out its first position in the compacted array*/
|
||||
for (iBlock = 1; iBlock < UCMP8_kIndexCount; ++iBlock)
|
||||
for (iBlock = 1; iBlock < UCMP8_kIndexCount; ++iBlock)
|
||||
{
|
||||
int32_t newCount, firstPosition, block;
|
||||
block = iBlock << UCMP8_kBlockShift;
|
||||
/* if (debugSmall) if (block > debugSmallLimit) break;*/
|
||||
firstPosition = findOverlappingPosition(this,
|
||||
firstPosition = findOverlappingPosition(this,
|
||||
block,
|
||||
tempIndex,
|
||||
tempIndexCount,
|
||||
cycle);
|
||||
|
||||
|
||||
/* if not contained in the current list, copy the remainder
|
||||
* invariant; cumulativeHash[iBlock] = XOR of values from iBlock-kBlockCount+1 to iBlock
|
||||
* we do this by XORing out cumulativeHash[iBlock-kBlockCount]
|
||||
*/
|
||||
newCount = firstPosition + UCMP8_kBlockCount;
|
||||
if (newCount > tempIndexCount)
|
||||
if (newCount > tempIndexCount)
|
||||
{
|
||||
for (iIndex = tempIndexCount; iIndex < newCount; ++iIndex)
|
||||
for (iIndex = tempIndexCount; iIndex < newCount; ++iIndex)
|
||||
{
|
||||
tempIndex[iIndex] = (uint16_t)(iIndex - firstPosition + block);
|
||||
} /* endfor (iIndex = tempIndexCount....)*/
|
||||
@ -358,24 +358,24 @@ ucmp8_compact(CompactByteArray* this,
|
||||
} /* endif (newCount > tempIndexCount)*/
|
||||
this->fIndex[iBlock] = (uint16_t)firstPosition;
|
||||
} /* endfor (iBlock = 1.....)*/
|
||||
|
||||
|
||||
/* now allocate and copy the items into the array*/
|
||||
tempArray = (int8_t*) uprv_malloc(tempIndexCount * sizeof(int8_t));
|
||||
if (!tempArray)
|
||||
if (!tempArray)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
uprv_free(tempIndex);
|
||||
return;
|
||||
}
|
||||
for (iIndex = 0; iIndex < tempIndexCount; ++iIndex)
|
||||
for (iIndex = 0; iIndex < tempIndexCount; ++iIndex)
|
||||
{
|
||||
tempArray[iIndex] = this->fArray[tempIndex[iIndex]];
|
||||
}
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = tempArray;
|
||||
this->fCount = tempIndexCount;
|
||||
|
||||
|
||||
|
||||
|
||||
/* free up temp storage*/
|
||||
uprv_free(tempIndex);
|
||||
this->fCompact = TRUE;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
********************************************************************
|
||||
*
|
||||
* Copyright (C) 1996-1999, International Business Machines
|
||||
* Copyright (C) 1996-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
********************************************************************
|
||||
@ -37,28 +37,28 @@ typedef struct{
|
||||
int8_t* fArray;
|
||||
uint16_t* fIndex;
|
||||
int32_t fCount;
|
||||
UBool fCompact;
|
||||
UBool fCompact;
|
||||
UBool fBogus;
|
||||
} CompactByteArray;
|
||||
|
||||
U_CAPI CompactByteArray* ucmp8_open(int8_t defaultValue);
|
||||
U_CAPI CompactByteArray* ucmp8_openAdopt(uint16_t* indexArray,
|
||||
U_CAPI CompactByteArray* ucmp8_openAdopt(uint16_t* indexArray,
|
||||
int8_t* newValues,
|
||||
int32_t count);
|
||||
U_CAPI void ucmp8_close(CompactByteArray* array);
|
||||
U_CAPI UBool isBogus(const CompactByteArray* array);
|
||||
|
||||
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index);
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index);
|
||||
U_CAPI uint8_t ucmp8_getu(CompactByteArray* array, uint16_t index);
|
||||
|
||||
U_CAPI void ucmp8_set(CompactByteArray* array,
|
||||
UChar index,
|
||||
int8_t value);
|
||||
|
||||
U_CAPI void ucmp8_setRange(CompactByteArray* array,
|
||||
U_CAPI void ucmp8_setRange(CompactByteArray* array,
|
||||
UChar start,
|
||||
UChar end,
|
||||
UChar end,
|
||||
int8_t value);
|
||||
|
||||
U_CAPI int32_t ucmp8_getCount(const CompactByteArray* array);
|
||||
@ -72,7 +72,7 @@ U_CAPI const uint16_t* ucmp8_getIndex(const CompactByteArray* array);
|
||||
then using that will be faster than cycle = 1, and get almost the
|
||||
same compression.
|
||||
*/
|
||||
U_CAPI void ucmp8_compact(CompactByteArray* array,
|
||||
U_CAPI void ucmp8_compact(CompactByteArray* array,
|
||||
uint32_t cycle);
|
||||
|
||||
/* Expanded takes the array back to a 65536 element array*/
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 1996-1999, International Business Machines
|
||||
* Copyright (C) 1996-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
* @version 1.0 12/12/96
|
||||
@ -62,12 +62,12 @@ const int16_t CharTypeBuilder::tagValues[] =
|
||||
const UChar CharTypeBuilder:: LAST_CHAR_CODE_IN_FILE = 0xFFFD;
|
||||
|
||||
CompactByteArray* CharTypeBuilder::charTypeArray = 0;
|
||||
int
|
||||
CharTypeBuilder::MakeProp(char* str)
|
||||
int
|
||||
CharTypeBuilder::MakeProp(char* str)
|
||||
{
|
||||
int result = 0;
|
||||
char* matchPosition;
|
||||
|
||||
|
||||
matchPosition = strstr(tagStrings, str);
|
||||
if (matchPosition == 0) fprintf(stderr, "unrecognized type letter %s\n", str);
|
||||
else result = ((matchPosition - tagStrings) / 2);
|
||||
@ -119,7 +119,7 @@ CharTypeBuilder::getByteArray(FILE* input)
|
||||
return charTypeArray;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
CharTypeBuilder::writeByteArrays()
|
||||
{
|
||||
const int8_t* values = ucmp8_getArray(charTypeArray);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*****************************************************************************************
|
||||
*
|
||||
* Copyright (C) 1994-1999, International Business Machines
|
||||
* Copyright (C) 1994-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*****************************************************************************************
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
********************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-1999, International Business Machines
|
||||
* Copyright (C) 1997-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
********************************************************************
|
||||
@ -21,9 +21,9 @@
|
||||
#include "cmemory.h"
|
||||
|
||||
static int32_t findOverlappingPosition(CompactByteArray* this,
|
||||
uint32_t start,
|
||||
const UChar *tempIndex,
|
||||
int32_t tempIndexCount,
|
||||
uint32_t start,
|
||||
const UChar *tempIndex,
|
||||
int32_t tempIndexCount,
|
||||
uint32_t cycle);
|
||||
|
||||
/* internal constants*/
|
||||
@ -48,7 +48,7 @@ int32_t ucmp8_getkBlockCount() { return UCMP8_kBlockCount;}
|
||||
int32_t ucmp8_getkIndexCount(){ return UCMP8_kIndexCount;}
|
||||
/* debug flags*/
|
||||
/*=======================================================*/
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index)
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index)
|
||||
{
|
||||
return (array->fArray[(array->fIndex[index >> UCMP8_kBlockShift] & 0xFFFF) + (index & UCMP8_kBlockMask)]);
|
||||
}
|
||||
@ -81,35 +81,35 @@ CompactByteArray* ucmp8_open(int8_t defaultValue)
|
||||
*/
|
||||
CompactByteArray* this = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
|
||||
int32_t i;
|
||||
|
||||
|
||||
if (this == NULL) return NULL;
|
||||
|
||||
this->fArray = NULL;
|
||||
this->fArray = NULL;
|
||||
this->fIndex = NULL;
|
||||
this->fCount = UCMP8_kUnicodeCount;
|
||||
this->fCompact = FALSE;
|
||||
this->fCompact = FALSE;
|
||||
this->fBogus = FALSE;
|
||||
|
||||
|
||||
this->fArray = (int8_t*) uprv_malloc(sizeof(int8_t) * UCMP8_kUnicodeCount);
|
||||
if (!this->fArray)
|
||||
if (!this->fArray)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
this->fIndex = (uint16_t*) uprv_malloc(sizeof(uint16_t) * UCMP8_kIndexCount);
|
||||
if (!this->fIndex)
|
||||
if (!this->fIndex)
|
||||
{
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = NULL;
|
||||
this->fBogus = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
{
|
||||
this->fArray[i] = defaultValue;
|
||||
}
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
{
|
||||
this->fIndex[i] = (uint16_t)(i << UCMP8_kBlockShift);
|
||||
}
|
||||
@ -123,12 +123,12 @@ CompactByteArray* ucmp8_openAdopt(uint16_t *indexArray,
|
||||
{
|
||||
CompactByteArray* this = (CompactByteArray*) uprv_malloc(sizeof(CompactByteArray));
|
||||
if (!this) return NULL;
|
||||
|
||||
|
||||
this->fArray = NULL;
|
||||
this->fIndex = NULL;
|
||||
this->fIndex = NULL;
|
||||
this->fCount = count;
|
||||
this->fBogus = FALSE;
|
||||
|
||||
|
||||
this->fArray = newValues;
|
||||
this->fIndex = indexArray;
|
||||
this->fCompact = (count < UCMP8_kUnicodeCount) ? TRUE : FALSE;
|
||||
@ -137,8 +137,8 @@ CompactByteArray* ucmp8_openAdopt(uint16_t *indexArray,
|
||||
}
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
void ucmp8_close(CompactByteArray* this)
|
||||
|
||||
void ucmp8_close(CompactByteArray* this)
|
||||
{
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = NULL;
|
||||
@ -151,8 +151,8 @@ void ucmp8_close(CompactByteArray* this)
|
||||
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
void ucmp8_expand(CompactByteArray* this)
|
||||
|
||||
void ucmp8_expand(CompactByteArray* this)
|
||||
{
|
||||
/* can optimize later.
|
||||
* if we have to expand, then walk through the blocks instead of using Get
|
||||
@ -168,20 +168,20 @@ void ucmp8_expand(CompactByteArray* this)
|
||||
* ARRAY abcdeababcedzyabcdea...
|
||||
*/
|
||||
int32_t i;
|
||||
if (this->fCompact)
|
||||
if (this->fCompact)
|
||||
{
|
||||
int8_t* tempArray;
|
||||
tempArray = (int8_t*) uprv_malloc(sizeof(int8_t) * UCMP8_kUnicodeCount);
|
||||
if (!tempArray)
|
||||
if (!tempArray)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
{
|
||||
tempArray[i] = ucmp8_get(this,(UChar)i); /* HSYS : How expand?*/
|
||||
}
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
{
|
||||
this->fIndex[i] = (uint16_t)(i<< UCMP8_kBlockShift);
|
||||
}
|
||||
@ -190,7 +190,7 @@ void ucmp8_expand(CompactByteArray* this)
|
||||
this->fCompact = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*=======================================================*/
|
||||
/* this->fArray: an array to be overlapped
|
||||
@ -200,35 +200,35 @@ void ucmp8_expand(CompactByteArray* this)
|
||||
* inputHash[i] = XOR of values from i-count+1 to i
|
||||
*/
|
||||
int32_t
|
||||
findOverlappingPosition(CompactByteArray* this,
|
||||
findOverlappingPosition(CompactByteArray* this,
|
||||
uint32_t start,
|
||||
const UChar* tempIndex,
|
||||
int32_t tempIndexCount,
|
||||
uint32_t cycle)
|
||||
uint32_t cycle)
|
||||
{
|
||||
/* this is a utility routine for finding blocks that overlap.
|
||||
* IMPORTANT: the cycle number is very important. Small cycles take a lot
|
||||
* longer to work. In some cases, they may be able to get better compaction.
|
||||
*/
|
||||
|
||||
|
||||
int32_t i;
|
||||
int32_t j;
|
||||
int32_t currentCount;
|
||||
|
||||
for (i = 0; i < tempIndexCount; i += cycle)
|
||||
|
||||
for (i = 0; i < tempIndexCount; i += cycle)
|
||||
{
|
||||
currentCount = UCMP8_kBlockCount;
|
||||
if (i + UCMP8_kBlockCount > tempIndexCount)
|
||||
if (i + UCMP8_kBlockCount > tempIndexCount)
|
||||
{
|
||||
currentCount = tempIndexCount - i;
|
||||
}
|
||||
for (j = 0; j < currentCount; ++j)
|
||||
}
|
||||
for (j = 0; j < currentCount; ++j)
|
||||
{
|
||||
if (this->fArray[start + j] != this->fArray[tempIndex[i + j]]) break;
|
||||
}
|
||||
if (j == currentCount) break;
|
||||
}
|
||||
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
@ -250,19 +250,19 @@ ucmp8_getIndex(const CompactByteArray* this)
|
||||
return this->fIndex;
|
||||
}
|
||||
|
||||
int32_t
|
||||
int32_t
|
||||
ucmp8_getCount(const CompactByteArray* this)
|
||||
{
|
||||
return this->fCount;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
ucmp8_set(CompactByteArray* this,
|
||||
UChar c,
|
||||
int8_t value)
|
||||
{
|
||||
if (this->fCompact == TRUE)
|
||||
if (this->fCompact == TRUE)
|
||||
{
|
||||
ucmp8_expand(this);
|
||||
if (this->fBogus) return;
|
||||
@ -271,19 +271,19 @@ ucmp8_set(CompactByteArray* this,
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
ucmp8_setRange(CompactByteArray* this,
|
||||
UChar start,
|
||||
UChar end,
|
||||
int8_t value)
|
||||
{
|
||||
int32_t i;
|
||||
if (this->fCompact == TRUE)
|
||||
if (this->fCompact == TRUE)
|
||||
{
|
||||
ucmp8_expand(this);
|
||||
if (this->fBogus) return;
|
||||
}
|
||||
for (i = start; i <= end; ++i)
|
||||
for (i = start; i <= end; ++i)
|
||||
{
|
||||
this->fArray[i] = value;
|
||||
}
|
||||
@ -291,12 +291,12 @@ ucmp8_setRange(CompactByteArray* this,
|
||||
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
void
|
||||
|
||||
void
|
||||
ucmp8_compact(CompactByteArray* this,
|
||||
uint32_t cycle)
|
||||
uint32_t cycle)
|
||||
{
|
||||
if (!this->fCompact)
|
||||
if (!this->fCompact)
|
||||
{
|
||||
/* this actually does the compaction.
|
||||
* it walks throught the contents of the expanded array, finding the
|
||||
@ -312,46 +312,46 @@ ucmp8_compact(CompactByteArray* this,
|
||||
int32_t tempIndexCount;
|
||||
int8_t* tempArray;
|
||||
int32_t iBlock, iIndex;
|
||||
|
||||
|
||||
/* fix cycle, must be 0 < cycle <= blockcount*/
|
||||
if (cycle < 0) cycle = 1;
|
||||
else if (cycle > (uint32_t)UCMP8_kBlockCount) cycle = UCMP8_kBlockCount;
|
||||
|
||||
|
||||
/* make temp storage, larger than we need*/
|
||||
tempIndex = (UChar*) uprv_malloc(sizeof(UChar)* UCMP8_kUnicodeCount);
|
||||
if (!tempIndex)
|
||||
if (!tempIndex)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
/* set up first block.*/
|
||||
tempIndexCount = UCMP8_kBlockCount;
|
||||
for (iIndex = 0; iIndex < UCMP8_kBlockCount; ++iIndex)
|
||||
for (iIndex = 0; iIndex < UCMP8_kBlockCount; ++iIndex)
|
||||
{
|
||||
tempIndex[iIndex] = (uint16_t)iIndex;
|
||||
}; /* endfor (iIndex = 0; .....)*/
|
||||
this->fIndex[0] = 0;
|
||||
|
||||
|
||||
/* for each successive block, find out its first position in the compacted array*/
|
||||
for (iBlock = 1; iBlock < UCMP8_kIndexCount; ++iBlock)
|
||||
for (iBlock = 1; iBlock < UCMP8_kIndexCount; ++iBlock)
|
||||
{
|
||||
int32_t newCount, firstPosition, block;
|
||||
block = iBlock << UCMP8_kBlockShift;
|
||||
/* if (debugSmall) if (block > debugSmallLimit) break;*/
|
||||
firstPosition = findOverlappingPosition(this,
|
||||
firstPosition = findOverlappingPosition(this,
|
||||
block,
|
||||
tempIndex,
|
||||
tempIndexCount,
|
||||
cycle);
|
||||
|
||||
|
||||
/* if not contained in the current list, copy the remainder
|
||||
* invariant; cumulativeHash[iBlock] = XOR of values from iBlock-kBlockCount+1 to iBlock
|
||||
* we do this by XORing out cumulativeHash[iBlock-kBlockCount]
|
||||
*/
|
||||
newCount = firstPosition + UCMP8_kBlockCount;
|
||||
if (newCount > tempIndexCount)
|
||||
if (newCount > tempIndexCount)
|
||||
{
|
||||
for (iIndex = tempIndexCount; iIndex < newCount; ++iIndex)
|
||||
for (iIndex = tempIndexCount; iIndex < newCount; ++iIndex)
|
||||
{
|
||||
tempIndex[iIndex] = (uint16_t)(iIndex - firstPosition + block);
|
||||
} /* endfor (iIndex = tempIndexCount....)*/
|
||||
@ -359,24 +359,24 @@ ucmp8_compact(CompactByteArray* this,
|
||||
} /* endif (newCount > tempIndexCount)*/
|
||||
this->fIndex[iBlock] = (uint16_t)firstPosition;
|
||||
} /* endfor (iBlock = 1.....)*/
|
||||
|
||||
|
||||
/* now allocate and copy the items into the array*/
|
||||
tempArray = (int8_t*) uprv_malloc(tempIndexCount * sizeof(int8_t));
|
||||
if (!tempArray)
|
||||
if (!tempArray)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
uprv_free(tempIndex);
|
||||
return;
|
||||
}
|
||||
for (iIndex = 0; iIndex < tempIndexCount; ++iIndex)
|
||||
for (iIndex = 0; iIndex < tempIndexCount; ++iIndex)
|
||||
{
|
||||
tempArray[iIndex] = this->fArray[tempIndex[iIndex]];
|
||||
}
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = tempArray;
|
||||
this->fCount = tempIndexCount;
|
||||
|
||||
|
||||
|
||||
|
||||
/* free up temp storage*/
|
||||
uprv_free(tempIndex);
|
||||
this->fCompact = TRUE;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
********************************************************************
|
||||
*
|
||||
* Copyright (C) 1996-1999, International Business Machines
|
||||
* Copyright (C) 1996-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
********************************************************************
|
||||
@ -38,28 +38,28 @@ typedef struct{
|
||||
int8_t* fArray;
|
||||
uint16_t* fIndex;
|
||||
int32_t fCount;
|
||||
UBool fCompact;
|
||||
UBool fCompact;
|
||||
UBool fBogus;
|
||||
} CompactByteArray;
|
||||
|
||||
U_CAPI CompactByteArray* ucmp8_open(int8_t defaultValue);
|
||||
U_CAPI CompactByteArray* ucmp8_openAdopt(uint16_t* indexArray,
|
||||
U_CAPI CompactByteArray* ucmp8_openAdopt(uint16_t* indexArray,
|
||||
int8_t* newValues,
|
||||
int32_t count);
|
||||
U_CAPI void ucmp8_close(CompactByteArray* array);
|
||||
U_CAPI UBool isBogus(const CompactByteArray* array);
|
||||
|
||||
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index);
|
||||
U_CAPI int8_t ucmp8_get(CompactByteArray* array, uint16_t index);
|
||||
U_CAPI uint8_t ucmp8_getu(CompactByteArray* array, uint16_t index);
|
||||
|
||||
U_CAPI void ucmp8_set(CompactByteArray* array,
|
||||
UChar index,
|
||||
int8_t value);
|
||||
|
||||
U_CAPI void ucmp8_setRange(CompactByteArray* array,
|
||||
U_CAPI void ucmp8_setRange(CompactByteArray* array,
|
||||
UChar start,
|
||||
UChar end,
|
||||
UChar end,
|
||||
int8_t value);
|
||||
|
||||
U_CAPI int32_t ucmp8_getCount(const CompactByteArray* array);
|
||||
@ -73,7 +73,7 @@ U_CAPI const uint16_t* ucmp8_getIndex(const CompactByteArray* array);
|
||||
then using that will be faster than cycle = 1, and get almost the
|
||||
same compression.
|
||||
*/
|
||||
U_CAPI void ucmp8_compact(CompactByteArray* array,
|
||||
U_CAPI void ucmp8_compact(CompactByteArray* array,
|
||||
uint32_t cycle);
|
||||
|
||||
/* Expanded takes the array back to a 65536 element array*/
|
||||
|
@ -1,5 +1,5 @@
|
||||
## Makefile.in for ICU - tools/ctestfw
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Stephen F. Booth
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
/*
|
||||
*****************************************************************************************
|
||||
*
|
||||
* Copyright (C) 1996-1999, International Business Machines
|
||||
* Copyright (C) 1996-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*****************************************************************************************
|
||||
@ -13,7 +13,7 @@
|
||||
#include <stdarg.h>
|
||||
|
||||
/* NOTES:
|
||||
3/20/1999 srl - strncpy called w/o setting nulls at the end
|
||||
3/20/1999 srl - strncpy called w/o setting nulls at the end
|
||||
*/
|
||||
|
||||
#define MAXTESTNAME 128
|
||||
@ -47,7 +47,7 @@ static void getNextLevel( const char* name,
|
||||
int* nameLen,
|
||||
const char** nextName );
|
||||
|
||||
static void iterateTestsWithLevel( const TestNode *root, int len,
|
||||
static void iterateTestsWithLevel( const TestNode *root, int len,
|
||||
const TestNode** list,
|
||||
TestMode mode);
|
||||
/* If we need to make the framework multi-thread safe
|
||||
@ -78,7 +78,7 @@ static void getNextLevel( const char* name,
|
||||
{
|
||||
/* Get the next component of the name */
|
||||
*nextName = strchr(name, TEST_SEPARATOR);
|
||||
|
||||
|
||||
if( *nextName != 0 )
|
||||
{
|
||||
char n[255];
|
||||
@ -88,20 +88,20 @@ static void getNextLevel( const char* name,
|
||||
n[*nameLen] = 0;
|
||||
/* printf("->%s-< [%d] -> [%s]\n", name, *nameLen, *nextName);*/
|
||||
}
|
||||
else *nameLen = strlen(name);
|
||||
else *nameLen = strlen(name);
|
||||
}
|
||||
|
||||
static TestNode *createTestNode( )
|
||||
{
|
||||
TestNode *newNode;
|
||||
|
||||
|
||||
newNode = (TestNode*)malloc ( sizeof ( TestNode ) );
|
||||
|
||||
|
||||
newNode->name[0] = '\0';
|
||||
newNode->test = NULL;
|
||||
newNode->sibling = NULL;
|
||||
newNode->child = NULL;
|
||||
|
||||
newNode->child = NULL;
|
||||
|
||||
return newNode;
|
||||
}
|
||||
|
||||
@ -211,7 +211,7 @@ static TestNode *addTestNode ( TestNode *root, const char *name )
|
||||
}
|
||||
|
||||
static void iterateTestsWithLevel ( const TestNode* root,
|
||||
int len,
|
||||
int len,
|
||||
const TestNode** list,
|
||||
TestMode mode)
|
||||
{
|
||||
@ -235,7 +235,7 @@ static void iterateTestsWithLevel ( const TestNode* root,
|
||||
strcat(pathToFunction, list[i]->name);
|
||||
|
||||
INDENT_LEVEL = len;
|
||||
if ( (mode == RUNTESTS) && (root->test != NULL))
|
||||
if ( (mode == RUNTESTS) && (root->test != NULL))
|
||||
{
|
||||
int myERROR_COUNT = ERROR_COUNT;
|
||||
root->test();
|
||||
@ -288,7 +288,7 @@ void runTests ( const TestNode *root )
|
||||
if (root == NULL)
|
||||
log_err("TEST CAN'T BE FOUND!\n");
|
||||
|
||||
ERRONEOUS_FUNCTION_COUNT = ERROR_COUNT = 0;
|
||||
ERRONEOUS_FUNCTION_COUNT = ERROR_COUNT = 0;
|
||||
iterateTestsWithLevel ( root, 0, aList, RUNTESTS );
|
||||
|
||||
/*print out result summary*/
|
||||
@ -299,7 +299,7 @@ void runTests ( const TestNode *root )
|
||||
for (i=0;i < ERRONEOUS_FUNCTION_COUNT; i++)
|
||||
log_info("[%s]\n",ERROR_LOG[i]);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
log_info("\n[All tests passed successfully...]\n");
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
/*
|
||||
*****************************************************************************************
|
||||
*
|
||||
* Copyright (C) 1996-1999, International Business Machines
|
||||
* Copyright (C) 1996-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*****************************************************************************************
|
||||
@ -25,7 +25,7 @@
|
||||
#define C_CTEST_API extern "C"
|
||||
#else
|
||||
#define C_CTEST_API
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef T_CTEST_IMPLEMENTATION
|
||||
#define T_CTEST_API C_CTEST_API T_CTEST_EXPORT
|
||||
@ -55,7 +55,7 @@ typedef void (*TestFunctionPtr)();
|
||||
typedef struct TestNode TestNode;
|
||||
|
||||
/**
|
||||
* Count of errors from all tests.
|
||||
* Count of errors from all tests.
|
||||
* May be reset.
|
||||
* @internal Internal APIs for testing purpose only
|
||||
*/
|
||||
@ -67,7 +67,7 @@ T_CTEST_EXPORT_API extern int ERROR_COUNT;
|
||||
* @internal Internal APIs for testing purpose only
|
||||
*
|
||||
*/
|
||||
T_CTEST_EXPORT_API extern int VERBOSITY;
|
||||
T_CTEST_EXPORT_API extern int VERBOSITY;
|
||||
|
||||
/**
|
||||
* Set this to zero to disable log_verbose() messages.
|
||||
@ -75,11 +75,11 @@ T_CTEST_EXPORT_API extern int VERBOSITY;
|
||||
* @internal Internal APIs for testing purpose only
|
||||
*
|
||||
*/
|
||||
T_CTEST_EXPORT_API extern int ERR_MSG;
|
||||
T_CTEST_EXPORT_API extern int ERR_MSG;
|
||||
|
||||
/**
|
||||
* Show the names of all nodes.
|
||||
*
|
||||
*
|
||||
* @param root Subtree of tests.
|
||||
* @internal Internal APIs for testing purpose only
|
||||
*/
|
||||
@ -87,7 +87,7 @@ T_CTEST_API void showTests ( const TestNode *root);
|
||||
|
||||
/**
|
||||
* Run a subtree of tests.
|
||||
*
|
||||
*
|
||||
* @param root Subtree of tests.
|
||||
* @internal Internal APIs for testing purpose only
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Makefile.in for ICU - tools/genccode
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Steven R. Loomi
|
||||
## Steven R. Loomis
|
||||
|
||||
## Source directory information
|
||||
srcdir = @srcdir@
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
## Makefile.in for ICU - tools/gencmn
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2001, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Steven R. Loomi
|
||||
## Steven R. Loomis
|
||||
|
||||
## Source directory information
|
||||
srcdir = @srcdir@
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -363,7 +363,7 @@ main(int argc, char* argv[]) {
|
||||
sprintf(buffer, ",\n { \"%s\", %s%s }", files[i].basename, symPrefix, files[i].pathname);
|
||||
T_FileStream_writeLine(out, buffer);
|
||||
}
|
||||
|
||||
|
||||
T_FileStream_writeLine(out, "\n }\n};\n");
|
||||
T_FileStream_close(out);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
## Makefile.in for ICU - tools/gencnval
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Steven R. Loomi
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -66,7 +66,7 @@ typedef struct {
|
||||
|
||||
static char stringStore[STRING_STORE_SIZE];
|
||||
static StringBlock stringBlock = { stringStore, 0, STRING_STORE_SIZE };
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *alias;
|
||||
uint16_t converter;
|
||||
@ -328,7 +328,7 @@ parseLine(const char *line) {
|
||||
++pos;
|
||||
}
|
||||
} while (line[pos] && line[pos] != '}' && line[pos] != '#');
|
||||
|
||||
|
||||
if (line[pos] == '}') {
|
||||
++pos;
|
||||
} else {
|
||||
|
@ -1,5 +1,5 @@
|
||||
## Makefile.in for ICU - tools/gennames
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Steven R. Loomi
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,5 +1,5 @@
|
||||
## Makefile.in for ICU - tools/genprops
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Steven R. Loomis
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -21,13 +21,13 @@
|
||||
/* This is incredibly non thread-safe, but it doesn't matter for this util */
|
||||
static char gErrorText[200] = { "" };
|
||||
|
||||
void
|
||||
void
|
||||
setErrorText(const char *s)
|
||||
{
|
||||
uprv_strcpy(gErrorText, s);
|
||||
}
|
||||
|
||||
const char*
|
||||
const char*
|
||||
getErrorText()
|
||||
{
|
||||
return gErrorText[0] != 0 ? gErrorText : NULL;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -87,7 +87,7 @@ main(int argc,
|
||||
const char *arg = NULL;
|
||||
const char *outputDir = NULL; /* NULL = no output directory, use current */
|
||||
const char *inputDir = NULL;
|
||||
const char *encoding = "";
|
||||
const char *encoding = "";
|
||||
UBool verbose;
|
||||
|
||||
#ifdef XP_MAC_CONSOLE
|
||||
@ -104,7 +104,7 @@ main(int argc,
|
||||
}
|
||||
|
||||
if(argc<0 || options[HELP1].doesOccur || options[HELP2].doesOccur) {
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"Usage: %s [OPTIONS] [FILES]\n"
|
||||
"\treads the list of resource bundle source files and creates\n"
|
||||
"\tbinary version of reosurce bundles (.res files)\n"
|
||||
@ -121,9 +121,9 @@ main(int argc,
|
||||
}
|
||||
|
||||
if(options[VERSION].doesOccur) {
|
||||
fprintf(stderr,
|
||||
fprintf(stderr,
|
||||
"%s version %s (ICU version %s).\n"
|
||||
"%s\n",
|
||||
"%s\n",
|
||||
argv[0], GENRB_VERSION, U_ICU_VERSION, U_COPYRIGHT_STRING);
|
||||
return U_ZERO_ERROR;
|
||||
}
|
||||
@ -280,7 +280,7 @@ make_res_filename(const char *filename,
|
||||
goto finish;
|
||||
}
|
||||
get_basename(basename, filename);
|
||||
|
||||
|
||||
dirname = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(filename) + 1));
|
||||
if(dirname == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -292,7 +292,7 @@ make_res_filename(const char *filename,
|
||||
{
|
||||
/* output in same dir as .txt */
|
||||
resName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(RES_SUFFIX) + 1));
|
||||
if(resName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -319,10 +319,10 @@ make_res_filename(const char *filename,
|
||||
if(outputDir[dirlen] != U_FILE_SEP_CHAR) {
|
||||
resName[dirlen] = U_FILE_SEP_CHAR;
|
||||
resName[dirlen+1] = '\0';
|
||||
}
|
||||
}
|
||||
/*uprv_strcat(resName, dirname);*/
|
||||
/*uprv_strcpy(resName, dirname);*/
|
||||
uprv_strcat(resName, basename);
|
||||
uprv_strcat(resName, basename);
|
||||
}
|
||||
|
||||
finish:
|
||||
@ -357,7 +357,7 @@ make_col_filename(const char *filename,
|
||||
goto finish;
|
||||
}
|
||||
get_basename(basename, filename);
|
||||
|
||||
|
||||
dirname = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(filename) + 1));
|
||||
if(dirname == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -366,11 +366,11 @@ make_col_filename(const char *filename,
|
||||
|
||||
if(outputDir == NULL)
|
||||
{
|
||||
|
||||
|
||||
get_dirname(dirname, filename);
|
||||
|
||||
|
||||
colName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(COL_SUFFIX) + 1));
|
||||
if(colName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -387,7 +387,7 @@ make_col_filename(const char *filename,
|
||||
get_dirname(dirname, filename);
|
||||
|
||||
colName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(outputDir)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(basename)
|
||||
+ uprv_strlen(COL_SUFFIX) + 1));
|
||||
if(colName == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -416,7 +416,7 @@ static void make_col(const char *filename, UErrorCode *status)
|
||||
return;
|
||||
}
|
||||
get_basename(basename, filename);
|
||||
|
||||
|
||||
coll = ucol_open(basename, status);
|
||||
if(U_FAILURE(*status)) {
|
||||
printf("gencol: %s for locale \"%s\"", u_errorName(*status), basename);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -32,9 +32,9 @@ struct SList*
|
||||
strlist_open(UErrorCode *status)
|
||||
{
|
||||
struct SList *list;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
|
||||
|
||||
list = (struct SList*) uprv_malloc(sizeof(struct SList));
|
||||
if(list == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -42,7 +42,7 @@ strlist_open(UErrorCode *status)
|
||||
}
|
||||
|
||||
list->fType = eStringList;
|
||||
|
||||
|
||||
list->u.fStringList.fData = 0;
|
||||
list->u.fStringList.fCount = 0;
|
||||
list->u.fStringList.fCapacity = 32;
|
||||
@ -64,13 +64,13 @@ strlist_close(struct SList *list,
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* deallocate each string */
|
||||
for(i = 0; i < list->u.fStringList.fCount; ++i) {
|
||||
uprv_free(list->u.fStringList.fData[i]);
|
||||
}
|
||||
uprv_free(list->u.fStringList.fData);
|
||||
|
||||
|
||||
list->fType = eEmpty;
|
||||
uprv_free(list);
|
||||
}
|
||||
@ -81,20 +81,20 @@ strlist_add(struct SList *list,
|
||||
UErrorCode *status)
|
||||
{
|
||||
int32_t index;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
|
||||
if(list->fType != eStringList) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
index = list->u.fStringList.fCount;
|
||||
|
||||
if(list->u.fStringList.fCount == list->u.fStringList.fCapacity)
|
||||
|
||||
if(list->u.fStringList.fCount == list->u.fStringList.fCapacity)
|
||||
strlist_grow(list, status);
|
||||
|
||||
list->u.fStringList.fData[index] = (UChar*)
|
||||
list->u.fStringList.fData[index] = (UChar*)
|
||||
uprv_malloc(sizeof(UChar) * (u_strlen(s) + 1));
|
||||
if(list->u.fStringList.fData[index] == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -105,23 +105,23 @@ strlist_add(struct SList *list,
|
||||
++(list->u.fStringList.fCount);
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
strlist_grow(struct SList *list,
|
||||
UErrorCode *status)
|
||||
{
|
||||
int32_t i, j;
|
||||
int32_t newCapacity;
|
||||
UChar **newData;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
|
||||
if(list->fType != eStringList) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
newCapacity = list->u.fStringList.fCapacity << 1;
|
||||
|
||||
|
||||
newCapacity = list->u.fStringList.fCapacity << 1;
|
||||
|
||||
/* allocate space for the array of strings */
|
||||
newData = (UChar**) uprv_malloc(sizeof(UChar*) * newCapacity);
|
||||
if(newData == 0) {
|
||||
@ -131,18 +131,18 @@ strlist_grow(struct SList *list,
|
||||
|
||||
/* allocate and copy each string */
|
||||
for(i = 0; i < list->u.fStringList.fCount; ++i) {
|
||||
newData[i] = (UChar*)
|
||||
newData[i] = (UChar*)
|
||||
uprv_malloc(sizeof(UChar) * (u_strlen(list->u.fStringList.fData[i]) + 1));
|
||||
if(newData[i] == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
for(j = 0; j < i; ++j)
|
||||
for(j = 0; j < i; ++j)
|
||||
uprv_free(newData[j]);
|
||||
uprv_free(newData);
|
||||
return;
|
||||
}
|
||||
u_strcpy(newData[i], list->u.fStringList.fData[i]);
|
||||
}
|
||||
|
||||
|
||||
uprv_free(list->u.fStringList.fData);
|
||||
list->u.fStringList.fData = newData;
|
||||
list->u.fStringList.fCapacity = newCapacity;
|
||||
@ -154,7 +154,7 @@ struct SList*
|
||||
strlist2d_open(UErrorCode *status)
|
||||
{
|
||||
struct SList *list;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
|
||||
list = (struct SList*) uprv_malloc(sizeof(struct SList));
|
||||
@ -164,7 +164,7 @@ strlist2d_open(UErrorCode *status)
|
||||
}
|
||||
|
||||
list->fType = eStringList2d;
|
||||
|
||||
|
||||
list->u.fStringList2d.fData = 0;
|
||||
list->u.fStringList2d.fCount = 0;
|
||||
list->u.fStringList2d.fCapacity = 32;
|
||||
@ -184,14 +184,14 @@ strlist2d_open(UErrorCode *status)
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
strlist2d_close(struct SList *list,
|
||||
UErrorCode *status)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
|
||||
if(list->fType != eStringList2d) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
@ -219,11 +219,11 @@ strlist2d_newRow(struct SList *list,
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if(list->u.fStringList2d.fRowCount == list->u.fStringList2d.fRowCapacity)
|
||||
strlist2d_growRows(list, status);
|
||||
if(U_FAILURE(*status)) return;
|
||||
list->u.fStringList2d.fRows[(list->u.fStringList2d.fRowCount)++] =
|
||||
list->u.fStringList2d.fRows[(list->u.fStringList2d.fRowCount)++] =
|
||||
list->u.fStringList2d.fCount;
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ void strlist2d_add(struct SList *list,
|
||||
UErrorCode *status)
|
||||
{
|
||||
int32_t index;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
if(list->fType != eStringList2d) {
|
||||
@ -241,11 +241,11 @@ void strlist2d_add(struct SList *list,
|
||||
}
|
||||
|
||||
index = list->u.fStringList2d.fCount;
|
||||
|
||||
if(list->u.fStringList2d.fCount == list->u.fStringList2d.fCapacity)
|
||||
|
||||
if(list->u.fStringList2d.fCount == list->u.fStringList2d.fCapacity)
|
||||
strlist2d_grow(list, status);
|
||||
|
||||
list->u.fStringList2d.fData[index] = (UChar*)
|
||||
list->u.fStringList2d.fData[index] = (UChar*)
|
||||
uprv_malloc(sizeof(UChar) * (u_strlen(s) + 1));
|
||||
if(list->u.fStringList2d.fData[index] == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -263,16 +263,16 @@ strlist2d_grow(struct SList *list,
|
||||
int32_t i, j;
|
||||
int32_t newCapacity;
|
||||
UChar **newData;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
if(list->fType != eStringList2d) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
newCapacity = list->u.fStringList2d.fCapacity << 1;
|
||||
|
||||
|
||||
newCapacity = list->u.fStringList2d.fCapacity << 1;
|
||||
|
||||
/* allocate space for the array of strings */
|
||||
newData = (UChar**) uprv_malloc(sizeof(UChar*) * newCapacity);
|
||||
if(newData == 0) {
|
||||
@ -282,24 +282,24 @@ strlist2d_grow(struct SList *list,
|
||||
|
||||
/* allocate and copy each string */
|
||||
for(i = 0; i < list->u.fStringList2d.fCount; ++i) {
|
||||
newData[i] = (UChar*)
|
||||
newData[i] = (UChar*)
|
||||
uprv_malloc(sizeof(UChar) * (u_strlen(list->u.fStringList2d.fData[i]) + 1));
|
||||
if(newData[i] == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
for(j = 0; j < i; ++j)
|
||||
for(j = 0; j < i; ++j)
|
||||
uprv_free(newData[j]);
|
||||
uprv_free(newData);
|
||||
return;
|
||||
}
|
||||
u_strcpy(newData[i], list->u.fStringList2d.fData[i]);
|
||||
}
|
||||
|
||||
|
||||
uprv_free(list->u.fStringList2d.fData);
|
||||
list->u.fStringList2d.fData = newData;
|
||||
list->u.fStringList2d.fCapacity = newCapacity;
|
||||
}
|
||||
|
||||
static void
|
||||
static void
|
||||
strlist2d_growRows(struct SList *list,
|
||||
UErrorCode *status)
|
||||
{
|
||||
@ -315,17 +315,17 @@ strlist2d_growRows(struct SList *list,
|
||||
}
|
||||
|
||||
newCapacity = list->u.fStringList2d.fRowCapacity << 1;
|
||||
|
||||
|
||||
/* allocate space for the array of ints */
|
||||
newRows = (int32_t*) uprv_malloc(sizeof(int32_t) * newCapacity);
|
||||
if(newRows == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* copy each int */
|
||||
for(i = 0; i < list->u.fStringList2d.fRowCount; ++i)
|
||||
for(i = 0; i < list->u.fStringList2d.fRowCount; ++i)
|
||||
newRows[i] = list->u.fStringList2d.fRows[i];
|
||||
|
||||
|
||||
/* clean up */
|
||||
uprv_free(list->u.fStringList2d.fRows);
|
||||
list->u.fStringList2d.fRows = newRows;
|
||||
@ -338,9 +338,9 @@ struct SList*
|
||||
taglist_open(UErrorCode *status)
|
||||
{
|
||||
struct SList *list;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
|
||||
|
||||
list = (struct SList*) uprv_malloc(sizeof(struct SList));
|
||||
if(list == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -348,18 +348,18 @@ taglist_open(UErrorCode *status)
|
||||
}
|
||||
|
||||
list->fType = eTaggedList;
|
||||
|
||||
|
||||
/*list->u.fTaggedList.fData = 0;*/
|
||||
list->u.fTaggedList.fFirst = NULL;
|
||||
list->u.fTaggedList.fCount = 0;
|
||||
/*list->u.fTaggedList.fCapacity = 32;*/
|
||||
|
||||
/*taglist_grow(list, status);*/
|
||||
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
taglist_close(struct SList *list,
|
||||
UErrorCode *status)
|
||||
{
|
||||
@ -379,10 +379,10 @@ taglist_close(struct SList *list,
|
||||
current = current->fNext;
|
||||
uprv_free(prev);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*uprv_free(list->u.fTaggedList.fData);*/
|
||||
|
||||
|
||||
list->fType = eEmpty;
|
||||
uprv_free(list);
|
||||
}
|
||||
@ -390,7 +390,7 @@ taglist_close(struct SList *list,
|
||||
|
||||
void
|
||||
taglist_add(struct SList *list,
|
||||
const UChar *tag,
|
||||
const UChar *tag,
|
||||
const UChar *data,
|
||||
UErrorCode *status)
|
||||
{
|
||||
@ -398,14 +398,14 @@ taglist_add(struct SList *list,
|
||||
struct SStringPair *pair = NULL;
|
||||
struct SStringPair *current = NULL;
|
||||
struct SStringPair *prev = NULL;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
if(list->fType != eTaggedList) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
pair = (struct SStringPair *) uprv_malloc(sizeof(struct SStringPair));
|
||||
if(pair->fKey == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -461,16 +461,16 @@ taglist_add(struct SList *list,
|
||||
/* end of list */
|
||||
prev->fNext = pair;
|
||||
pair->fNext = NULL;
|
||||
|
||||
|
||||
/*index = list->u.fTaggedList.fCount;*/
|
||||
|
||||
|
||||
/*if(list->u.fTaggedList.fCount == list->u.fTaggedList.fCapacity)*/
|
||||
/*taglist_grow(list, status);*/
|
||||
|
||||
|
||||
/*list->u.fTaggedList.fData[index] = pair;*/
|
||||
}
|
||||
|
||||
const UChar*
|
||||
const UChar*
|
||||
taglist_get(const struct SList *list,
|
||||
const char *tag,
|
||||
UErrorCode *status)
|
||||
@ -479,7 +479,7 @@ taglist_get(const struct SList *list,
|
||||
struct SStringPair *current;
|
||||
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
|
||||
|
||||
if(list->fType != eTaggedList) {
|
||||
*status = U_ILLEGAL_ARGUMENT_ERROR;
|
||||
return 0;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -36,7 +36,7 @@ struct SStringList2d {
|
||||
UChar **fData;
|
||||
int32_t fCount;
|
||||
int32_t fCapacity;
|
||||
|
||||
|
||||
int32_t *fRows;
|
||||
int32_t fRowCount;
|
||||
int32_t fRowCapacity;
|
||||
@ -64,9 +64,9 @@ struct STaggedList {
|
||||
|
||||
struct SList* taglist_open(UErrorCode *status);
|
||||
void taglist_close(struct SList *list, UErrorCode *status);
|
||||
void taglist_add(struct SList *list, const UChar *tag,
|
||||
void taglist_add(struct SList *list, const UChar *tag,
|
||||
const UChar *data, UErrorCode *status);
|
||||
const UChar* taglist_get(const struct SList *list, const char *tag,
|
||||
const UChar* taglist_get(const struct SList *list, const char *tag,
|
||||
UErrorCode *status);
|
||||
|
||||
/* Types of lists */
|
||||
@ -80,7 +80,7 @@ enum EListType {
|
||||
/* A generic list container */
|
||||
struct SList {
|
||||
enum EListType fType; /* type of element in union */
|
||||
|
||||
|
||||
union {
|
||||
struct SStringList fStringList;
|
||||
struct SStringList2d fStringList2d;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Copyright (C) 1998-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -198,7 +198,7 @@ char *getModificationData(struct UFILE *file, UErrorCode *status) {
|
||||
uprv_free(retValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
setErrorText("Invalid modificator directive");
|
||||
*status = U_INVALID_FORMAT_ERROR;
|
||||
|
||||
@ -232,7 +232,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
struct SResource *temp2 = NULL;
|
||||
UBool colEl = FALSE, colOverride = FALSE, ucaEl = FALSE;
|
||||
UChar trueValue[] = {0x0054, 0x0052, 0x0055, 0x0045, 0x0000}; /* Just to store "TRUE" and "FALSE" */
|
||||
UChar falseValue[] = {0x0046, 0x0041, 0x004C, 0x0053, 0x0045, 0x0000};
|
||||
UChar falseValue[] = {0x0046, 0x0041, 0x004C, 0x0053, 0x0045, 0x0000};
|
||||
|
||||
/* Hashtable for keeping track of seen tag names */
|
||||
struct UHashtable *data;
|
||||
@ -418,7 +418,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
/* importing a file and storing it in a binary object */
|
||||
else if(uprv_strcmp(modificator, "import") == 0) {
|
||||
FileStream *importFile;
|
||||
int32_t len;
|
||||
int32_t len;
|
||||
uint8_t *binData;
|
||||
char *fileName;
|
||||
fprintf(stdout, "import\n");
|
||||
@ -495,7 +495,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
case eStr:
|
||||
/* check if we have reached here after finding %%UCARULES */
|
||||
if(ucaEl==TRUE){
|
||||
UChar *c,*end,*ucaRulesStr;
|
||||
UChar *c,*end,*ucaRulesStr;
|
||||
FileStream *in =NULL;
|
||||
UFILE* ufile=NULL;
|
||||
int fileLength = 0;
|
||||
@ -549,7 +549,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
fprintf(stderr, "Error! Couldn't open input file %s for tag %s\n", fileName, cTag );
|
||||
goto finish;
|
||||
}
|
||||
|
||||
|
||||
}else{
|
||||
if(temp != NULL) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
@ -580,8 +580,8 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
/* Record a comma-delimited list string */
|
||||
|
||||
/* Record a comma-delimited list string */
|
||||
case eListStr:
|
||||
temp1 = string_open(bundle, NULL, token.fChars, token.fLength, status);
|
||||
array_add(temp, temp1, status);
|
||||
@ -590,7 +590,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
/* End a string list */
|
||||
case eEndList:
|
||||
/*uhash_put(data, tag.fChars, status);*/
|
||||
@ -601,7 +601,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eBeg2dList:
|
||||
if(temp != NULL) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
@ -613,7 +613,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eEnd2dList:
|
||||
/*uhash_put(data, tag.fChars, status);*/
|
||||
put(data, &tag, status);
|
||||
@ -625,7 +625,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case e2dStr:
|
||||
temp2 = string_open(bundle, NULL, token.fChars, token.fLength, status);
|
||||
array_add(temp1, temp2, status);
|
||||
@ -634,7 +634,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eNewRow:
|
||||
array_add(temp, temp1, status);
|
||||
temp1 = array_open(bundle, NULL, status);
|
||||
@ -642,7 +642,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eBegTagged:
|
||||
if(temp != NULL) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
@ -654,7 +654,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eEndTagged:
|
||||
/*uhash_put(data, tag.fChars, status);*/
|
||||
put(data, &tag, status);
|
||||
@ -664,7 +664,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eTaggedStr:
|
||||
temp1 = string_open(bundle, cSubTag, token.fChars, token.fLength, status);
|
||||
table_add(temp, temp1, status);
|
||||
@ -674,7 +674,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
/* We have seen the Override tag aleady, now checks if the value is "TRUE" or "FALSE". */
|
||||
if (uprv_strcmp(cSubTag, "Override") == 0)
|
||||
if (uprv_strcmp(cSubTag, "Override") == 0)
|
||||
{
|
||||
if (u_strncmp(token.fChars, trueValue, u_strlen(trueValue)) == 0)
|
||||
{
|
||||
@ -699,7 +699,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
/* do the collation elements */
|
||||
int32_t len = 0;
|
||||
uint8_t *binColData = NULL;
|
||||
UCollator *coll = NULL;
|
||||
UCollator *coll = NULL;
|
||||
UChar *rules = NULL;
|
||||
struct UString newTag;
|
||||
|
||||
@ -727,7 +727,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
ustr_initChars(&newTag, "CollationElements", -1, &intStatus);
|
||||
if(U_FAILURE(intStatus)) {
|
||||
goto finish;
|
||||
}
|
||||
}
|
||||
put(data, &newTag, &intStatus);
|
||||
ustr_deinit(&newTag);
|
||||
if(U_FAILURE(intStatus)) {
|
||||
@ -747,7 +747,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
goto finish;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case eOpen:
|
||||
if(data != 0) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
@ -761,7 +761,7 @@ parse(FileStream *f, const char *cp, const char *inputDir,
|
||||
data = uhash_open(hashUString, compareUString, status);
|
||||
uhash_setKeyDeleter(data, freeUString);
|
||||
break;
|
||||
|
||||
|
||||
case eClose:
|
||||
if(data == 0) {
|
||||
*status = U_INTERNAL_PROGRAM_ERROR;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -22,16 +22,16 @@
|
||||
#include "cstring.h"
|
||||
|
||||
|
||||
struct SRBItem*
|
||||
make_rbitem(const UChar *tag,
|
||||
const struct SList *data,
|
||||
struct SRBItem*
|
||||
make_rbitem(const UChar *tag,
|
||||
const struct SList *data,
|
||||
UErrorCode *status)
|
||||
{
|
||||
struct SRBItem *item;
|
||||
char *s;
|
||||
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
|
||||
|
||||
item = (struct SRBItem*) uprv_malloc(sizeof(struct SRBItem));
|
||||
if(item == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -58,9 +58,9 @@ struct SRBItemList*
|
||||
rblist_open(UErrorCode *status)
|
||||
{
|
||||
struct SRBItemList *list;
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) return 0;
|
||||
|
||||
|
||||
list = (struct SRBItemList*) uprv_malloc(sizeof(struct SRBItemList));
|
||||
if(list == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -70,7 +70,7 @@ rblist_open(UErrorCode *status)
|
||||
list->fLocale = 0;
|
||||
list->fFirst = NULL;
|
||||
|
||||
// list->fData = 0;
|
||||
// list->fData = 0;
|
||||
list->fCount = 0;
|
||||
list->fCapacity = 32;
|
||||
list->fKeys = (char *) uprv_malloc(sizeof(char) * 65532);
|
||||
@ -90,18 +90,18 @@ void rblist_close(struct SRBItemList *list,
|
||||
current = list->fFirst;
|
||||
/* deallocate each list */
|
||||
// for(i = 0; i < list->fCount; ++i) {
|
||||
while(current != NULL) {
|
||||
|
||||
while(current != NULL) {
|
||||
|
||||
// switch(list->fData[i]->fData->fType) {
|
||||
switch(current->fData->fType) {
|
||||
case eStringList:
|
||||
strlist_close(current->fData, status);
|
||||
break;
|
||||
|
||||
|
||||
case eStringList2d:
|
||||
strlist2d_close(current->fData, status);
|
||||
break;
|
||||
|
||||
|
||||
case eTaggedList:
|
||||
taglist_close(current->fData, status);
|
||||
break;
|
||||
@ -120,14 +120,14 @@ void rblist_close(struct SRBItemList *list,
|
||||
uprv_free(list);
|
||||
}
|
||||
|
||||
void rblist_setlocale(struct SRBItemList *list,
|
||||
const UChar *locale,
|
||||
void rblist_setlocale(struct SRBItemList *list,
|
||||
const UChar *locale,
|
||||
UErrorCode *status)
|
||||
{
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
||||
/* Allocate enough space */
|
||||
list->fLocale = (UChar*) uprv_realloc(list->fLocale,
|
||||
list->fLocale = (UChar*) uprv_realloc(list->fLocale,
|
||||
sizeof(UChar) * (u_strlen(locale) + 1));
|
||||
if(list->fLocale == 0) {
|
||||
*status = U_MEMORY_ALLOCATION_ERROR;
|
||||
@ -147,7 +147,7 @@ void rblist_add(struct SRBItemList *list,
|
||||
struct SRBItem *prev = NULL;
|
||||
|
||||
if(U_FAILURE(*status)) return;
|
||||
/* here we need to traverse the list */
|
||||
/* here we need to traverse the list */
|
||||
|
||||
++(list->fCount);
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -41,14 +41,14 @@ struct SRBItemList {
|
||||
|
||||
struct SRBItemList* rblist_open(UErrorCode *status);
|
||||
|
||||
struct SRBItem* make_rbitem(const UChar *tag, const struct SList *data,
|
||||
struct SRBItem* make_rbitem(const UChar *tag, const struct SList *data,
|
||||
UErrorCode *status);
|
||||
|
||||
void rblist_close(struct SRBItemList *list, UErrorCode *status);
|
||||
|
||||
void rblist_setlocale(struct SRBItemList *list, const UChar *locale,
|
||||
void rblist_setlocale(struct SRBItemList *list, const UChar *locale,
|
||||
UErrorCode *status);
|
||||
void rblist_add(struct SRBItemList *list, struct SRBItem *s,
|
||||
void rblist_add(struct SRBItemList *list, struct SRBItem *s,
|
||||
UErrorCode *status);
|
||||
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -44,7 +44,7 @@ static UBool didInit=FALSE;
|
||||
extern int32_t lineCount;
|
||||
|
||||
/* Protos */
|
||||
static enum ETokenType getStringToken(UFILE *f, UChar initialChar,
|
||||
static enum ETokenType getStringToken(UFILE *f, UChar initialChar,
|
||||
struct UString *token,
|
||||
UErrorCode *status);
|
||||
static UChar unescape(UFILE *f, UErrorCode *status);
|
||||
@ -53,7 +53,7 @@ static void seekUntilNewline(UFILE *f, UErrorCode *status);
|
||||
static void seekUntilEndOfComment(UFILE *f, UErrorCode *status);
|
||||
static UBool isWhitespace(UChar c);
|
||||
static UBool isNewline(UChar c);
|
||||
|
||||
|
||||
|
||||
/* Read and return the next token from the stream. If the token is of
|
||||
type eString, fill in the token parameter with the token. If the
|
||||
@ -89,7 +89,7 @@ enum ETokenType getNextToken(UFILE *f,
|
||||
case COLON: return tok_colon;
|
||||
c = getNextChar(f, TRUE, status);
|
||||
tokenType = getStringToken(f, c, token, status);
|
||||
break;
|
||||
break;
|
||||
*/
|
||||
default: return getStringToken(f, c, token, status);
|
||||
}
|
||||
@ -167,7 +167,7 @@ static enum ETokenType getStringToken(UFILE *f,
|
||||
return tok_error;
|
||||
}
|
||||
lastStringWasQuoted = TRUE;
|
||||
|
||||
|
||||
for(;;) {
|
||||
c = u_fgetc(f);
|
||||
/* c = u_fgetc(f, status);*/
|
||||
@ -179,9 +179,9 @@ static enum ETokenType getStringToken(UFILE *f,
|
||||
/* Unterminated quoted strings */
|
||||
if(U_FAILURE(*status))
|
||||
return tok_error;
|
||||
if(c == QUOTE)
|
||||
if(c == QUOTE)
|
||||
break;
|
||||
if(c == ESCAPE)
|
||||
if(c == ESCAPE)
|
||||
c = unescape(f, status);
|
||||
ustr_ucat(token, c, status);
|
||||
if(U_FAILURE(*status))
|
||||
@ -195,8 +195,8 @@ static enum ETokenType getStringToken(UFILE *f,
|
||||
return tok_error;
|
||||
}
|
||||
lastStringWasQuoted = FALSE;
|
||||
|
||||
if(c == ESCAPE)
|
||||
|
||||
if(c == ESCAPE)
|
||||
c = unescape(f, status);
|
||||
ustr_ucat(token, c, status);
|
||||
if(U_FAILURE(*status))
|
||||
@ -211,7 +211,7 @@ static enum ETokenType getStringToken(UFILE *f,
|
||||
return tok_string;
|
||||
}
|
||||
|
||||
if(U_FAILURE(*status))
|
||||
if(U_FAILURE(*status))
|
||||
return tok_string;
|
||||
|
||||
if(c == QUOTE
|
||||
@ -225,22 +225,22 @@ static enum ETokenType getStringToken(UFILE *f,
|
||||
break;
|
||||
}
|
||||
|
||||
if(isWhitespace(c))
|
||||
if(isWhitespace(c))
|
||||
break;
|
||||
|
||||
if(c == ESCAPE)
|
||||
if(c == ESCAPE)
|
||||
c = unescape(f, status);
|
||||
ustr_ucat(token, c, status);
|
||||
if(U_FAILURE(*status))
|
||||
return tok_error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* DO skip whitespace */
|
||||
c = getNextChar(f, TRUE, status);
|
||||
if(U_FAILURE(*status))
|
||||
if(U_FAILURE(*status))
|
||||
return tok_string;
|
||||
|
||||
|
||||
if(c == OPENBRACE || c == CLOSEBRACE || c == COMMA/* || c == COLON*/) {
|
||||
u_fungetc(c, f);
|
||||
/*u_fungetc(c, f, status);*/
|
||||
@ -252,7 +252,7 @@ static enum ETokenType getStringToken(UFILE *f,
|
||||
/* Retrieve the next character, ignoring comments. If skipwhite is
|
||||
true, whitespace is skipped as well. */
|
||||
static UChar getNextChar(UFILE *f,
|
||||
UBool skipwhite,
|
||||
UBool skipwhite,
|
||||
UErrorCode *status)
|
||||
{
|
||||
UChar c;
|
||||
@ -266,13 +266,13 @@ static UChar getNextChar(UFILE *f,
|
||||
if(c == (UChar)U_EOF)
|
||||
return U_EOF;
|
||||
|
||||
if(skipwhite && isWhitespace(c))
|
||||
if(skipwhite && isWhitespace(c))
|
||||
continue;
|
||||
|
||||
|
||||
/* This also handles the get() failing case */
|
||||
if(c != SLASH)
|
||||
return c;
|
||||
|
||||
|
||||
c = u_fgetc(f);
|
||||
/* c = u_fgetc(f, status);*/
|
||||
if(c == (UChar)U_EOF)
|
||||
@ -282,12 +282,12 @@ static UChar getNextChar(UFILE *f,
|
||||
case SLASH:
|
||||
seekUntilNewline(f, status);
|
||||
break;
|
||||
|
||||
|
||||
case ASTERISK:
|
||||
/* Note that we silently ignore an unterminated comment */
|
||||
seekUntilEndOfComment(f, status);
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
u_fungetc(c, f);
|
||||
/*u_fungetc(c, f, status);*/
|
||||
@ -309,7 +309,7 @@ static void seekUntilNewline(UFILE *f,
|
||||
c = u_fgetc(f);
|
||||
/* c = u_fgetc(f, status);*/
|
||||
} while(! isNewline(c) && c != (UChar)U_EOF && *status == U_ZERO_ERROR);
|
||||
|
||||
|
||||
/*if(U_FAILURE(*status))
|
||||
err = kItemNotFound;*/
|
||||
}
|
||||
@ -358,7 +358,7 @@ static UBool isWhitespace(UChar c)
|
||||
switch (c) {
|
||||
/* ' ', '\t', '\n', '\r', 0x2029, 0xFEFF */
|
||||
case 0x000A:
|
||||
case 0x2029:
|
||||
case 0x2029:
|
||||
lineCount++;
|
||||
case 0x000D:
|
||||
case 0x0020:
|
||||
@ -378,7 +378,7 @@ static UBool isNewline(UChar c)
|
||||
case 0x000A:
|
||||
case 0x2029:
|
||||
lineCount++;
|
||||
case 0x000D:
|
||||
case 0x000D:
|
||||
return TRUE;
|
||||
|
||||
default:
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -37,7 +37,7 @@ enum ETokenType
|
||||
tok_start_array, /* :Array */
|
||||
tok_start_intvector, /* :IntVector */
|
||||
tok_start_reserved, /* :Reserved - treat like a string */
|
||||
|
||||
|
||||
tok_EOF, /* End of the file has been reached successfully */
|
||||
tok_error, /* An error, such an unterminated quoted string */
|
||||
tok_token_type_count = 12 /* Number of "real" token types */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -34,7 +34,7 @@ ustr_init(struct UString *s)
|
||||
|
||||
void
|
||||
ustr_initChars(struct UString *s, const char* source, int32_t length, UErrorCode *status)
|
||||
{
|
||||
{
|
||||
int i = 0;
|
||||
if (U_FAILURE(*status)) return;
|
||||
s->fChars = 0;
|
||||
@ -68,14 +68,14 @@ ustr_deinit(struct UString *s)
|
||||
s->fChars = 0;
|
||||
s->fLength = s->fCapacity = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ustr_cpy(struct UString *dst,
|
||||
const struct UString *src,
|
||||
ustr_cpy(struct UString *dst,
|
||||
const struct UString *src,
|
||||
UErrorCode *status)
|
||||
{
|
||||
if(U_FAILURE(*status) || dst == src) return;
|
||||
|
||||
|
||||
if(dst->fCapacity < src->fLength) {
|
||||
ustr_resize(dst, ALLOCATION(src->fLength), status);
|
||||
if(U_FAILURE(*status)) return;
|
||||
@ -87,7 +87,7 @@ ustr_cpy(struct UString *dst,
|
||||
}
|
||||
|
||||
void
|
||||
ustr_setlen(struct UString *s,
|
||||
ustr_setlen(struct UString *s,
|
||||
int32_t len,
|
||||
UErrorCode *status)
|
||||
{
|
||||
@ -103,35 +103,35 @@ ustr_setlen(struct UString *s,
|
||||
}
|
||||
|
||||
void
|
||||
ustr_cat(struct UString *dst,
|
||||
const struct UString *src,
|
||||
ustr_cat(struct UString *dst,
|
||||
const struct UString *src,
|
||||
UErrorCode *status)
|
||||
{
|
||||
ustr_ncat(dst, src, src->fLength, status);
|
||||
}
|
||||
|
||||
void
|
||||
ustr_ncat(struct UString *dst,
|
||||
const struct UString *src,
|
||||
int32_t n,
|
||||
ustr_ncat(struct UString *dst,
|
||||
const struct UString *src,
|
||||
int32_t n,
|
||||
UErrorCode *status)
|
||||
{
|
||||
if(U_FAILURE(*status) || dst == src) return;
|
||||
|
||||
|
||||
if(dst->fCapacity < (dst->fLength + n)) {
|
||||
ustr_resize(dst, ALLOCATION(dst->fLength + n), status);
|
||||
if(U_FAILURE(*status)) return;
|
||||
}
|
||||
|
||||
uprv_memcpy(dst->fChars + dst->fLength, src->fChars,
|
||||
|
||||
uprv_memcpy(dst->fChars + dst->fLength, src->fChars,
|
||||
sizeof(UChar) * n);
|
||||
dst->fLength += src->fLength;
|
||||
dst->fChars[dst->fLength] = 0x0000;
|
||||
}
|
||||
|
||||
void
|
||||
ustr_ucat(struct UString *dst,
|
||||
UChar c,
|
||||
ustr_ucat(struct UString *dst,
|
||||
UChar c,
|
||||
UErrorCode *status)
|
||||
{
|
||||
if(U_FAILURE(*status)) return;
|
||||
@ -140,8 +140,8 @@ ustr_ucat(struct UString *dst,
|
||||
ustr_resize(dst, ALLOCATION(dst->fLength + 1), status);
|
||||
if(U_FAILURE(*status)) return;
|
||||
}
|
||||
|
||||
uprv_memcpy(dst->fChars + dst->fLength, &c,
|
||||
|
||||
uprv_memcpy(dst->fChars + dst->fLength, &c,
|
||||
sizeof(UChar) * 1);
|
||||
dst->fLength += 1;
|
||||
dst->fChars[dst->fLength] = 0x0000;
|
||||
@ -149,8 +149,8 @@ ustr_ucat(struct UString *dst,
|
||||
|
||||
/* Destroys data in the string */
|
||||
static void
|
||||
ustr_resize(struct UString *s,
|
||||
int32_t len,
|
||||
ustr_resize(struct UString *s,
|
||||
int32_t len,
|
||||
UErrorCode *status)
|
||||
{
|
||||
if(U_FAILURE(*status)) return;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -36,13 +36,13 @@ void ustr_deinit(struct UString *s);
|
||||
|
||||
void ustr_setlen(struct UString *s, int32_t len, UErrorCode *status);
|
||||
|
||||
void ustr_cpy(struct UString *dst, const struct UString *src,
|
||||
void ustr_cpy(struct UString *dst, const struct UString *src,
|
||||
UErrorCode *status);
|
||||
|
||||
void ustr_cat(struct UString *dst, const struct UString *src,
|
||||
UErrorCode *status);
|
||||
|
||||
void ustr_ncat(struct UString *dst, const struct UString *src,
|
||||
void ustr_ncat(struct UString *dst, const struct UString *src,
|
||||
int32_t n, UErrorCode *status);
|
||||
|
||||
void ustr_ucat(struct UString *dst, UChar c, UErrorCode *status);
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -28,7 +28,7 @@
|
||||
/* Protos */
|
||||
static void write_ustring(FileStream *rb, const UChar *data);
|
||||
static void write_string(FileStream *rb, const char *data);
|
||||
static void write_strlist(FileStream *rb, const char *name,
|
||||
static void write_strlist(FileStream *rb, const char *name,
|
||||
const struct SStringList *list);
|
||||
static void write_strlist2d(FileStream *rb, const char *name,
|
||||
const struct SStringList2d *list);
|
||||
@ -52,7 +52,7 @@ static const UChar gCollationElementsTag [] = {
|
||||
|
||||
/* Write a null-terminated UChar array */
|
||||
static void
|
||||
write_ustring(FileStream *rb,
|
||||
write_ustring(FileStream *rb,
|
||||
const UChar *data)
|
||||
{
|
||||
int32_t len;
|
||||
@ -79,7 +79,7 @@ write_string(FileStream *rb,
|
||||
|
||||
/* Write a string list */
|
||||
static void
|
||||
write_strlist(FileStream *rb,
|
||||
write_strlist(FileStream *rb,
|
||||
const char *name,
|
||||
const struct SStringList *list)
|
||||
{
|
||||
@ -101,7 +101,7 @@ write_strlist(FileStream *rb,
|
||||
}
|
||||
|
||||
/* Write a 2-d string list */
|
||||
static void
|
||||
static void
|
||||
write_strlist2d(FileStream *rb,
|
||||
const char *name,
|
||||
const struct SStringList2d *list)
|
||||
@ -134,8 +134,8 @@ write_strlist2d(FileStream *rb,
|
||||
}
|
||||
|
||||
/* Write a tagged list */
|
||||
static void
|
||||
write_taglist(FileStream *rb,
|
||||
static void
|
||||
write_taglist(FileStream *rb,
|
||||
const char *name,
|
||||
const struct STaggedList *list)
|
||||
{
|
||||
@ -168,8 +168,8 @@ write_taglist(FileStream *rb,
|
||||
|
||||
/* Write a parsed SRBItemList to a file */
|
||||
void
|
||||
rb_write(FileStream *f,
|
||||
struct SRBItemList *data,
|
||||
rb_write(FileStream *f,
|
||||
struct SRBItemList *data,
|
||||
UErrorCode *status)
|
||||
{
|
||||
// int32_t i;
|
||||
@ -225,6 +225,6 @@ rb_write(FileStream *f,
|
||||
|
||||
finish:
|
||||
;
|
||||
|
||||
|
||||
/* clean up */
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
## Makefile.in for ICU - tools/gentest
|
||||
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Madhu Katragadda
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -75,7 +75,7 @@ main(int argc, char* argv[]) {
|
||||
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
|
||||
}
|
||||
|
||||
printf("Generating the test memory mapped file\n");
|
||||
printf("Generating the test memory mapped file\n");
|
||||
createData(options[2].value);
|
||||
return 0;
|
||||
}
|
||||
@ -87,7 +87,7 @@ createData(const char* outputDirectory) {
|
||||
UErrorCode errorCode=U_ZERO_ERROR;
|
||||
char stringValue[]={'Y', 'E', 'A', 'R', '\0'};
|
||||
uint16_t intValue=2000;
|
||||
|
||||
|
||||
long dataLength;
|
||||
uint32_t size;
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
## Makefile.in for ICU - tools/gentz
|
||||
## Copyright (c) 1999, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2000, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Steven R. Loomi
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Date Name Description
|
||||
@ -21,7 +21,7 @@
|
||||
* As a matter of policy, the perl script tz.pl wants to do as much of
|
||||
* the parsing, data processing, and error checking as possible, and
|
||||
* this program wants to just do the binary translation step.
|
||||
*
|
||||
*
|
||||
* See tz.pl for the file format that is READ by this program.
|
||||
*/
|
||||
|
||||
@ -65,7 +65,7 @@ class gentz {
|
||||
STANDARD_TIME,
|
||||
UTC_TIME
|
||||
};
|
||||
|
||||
|
||||
// The largest number of zones we accept as sensible. Anything
|
||||
// larger is considered an error. Adjust as needed.
|
||||
enum { MAX_ZONES = 1000 };
|
||||
@ -84,7 +84,7 @@ class gentz {
|
||||
static const char DST_MARK;
|
||||
static const char SEP;
|
||||
static const char NUL;
|
||||
|
||||
|
||||
static const char* END_KEYWORD;
|
||||
|
||||
enum { BUFLEN = 1024 };
|
||||
@ -294,7 +294,7 @@ void gentz::parseTzTextFile(FileStream* in) {
|
||||
|
||||
// Parse the equivalency groups
|
||||
equivTable = parseEquivTable(in);
|
||||
|
||||
|
||||
// Parse the GMT offset index table
|
||||
offsetIndex = parseOffsetIndexTable(in);
|
||||
|
||||
@ -386,7 +386,7 @@ TZEquivalencyGroup* gentz::parseEquivTable(FileStream* in) {
|
||||
// This pointer will be adjusted to point to the start of the
|
||||
// list of zones in this group.
|
||||
uint16_t* pList = 0;
|
||||
|
||||
|
||||
switch (flavor) {
|
||||
case STANDARD_MARK:
|
||||
eg->isDST = 0;
|
||||
@ -414,7 +414,7 @@ TZEquivalencyGroup* gentz::parseEquivTable(FileStream* in) {
|
||||
*pList++ = (uint16_t) parseInteger(p, (j==(egCount-1)) ? NUL : SEP,
|
||||
0, header.count-1);
|
||||
}
|
||||
|
||||
|
||||
// At this point pList points to the byte after the last byte of this
|
||||
// equiv group struct. Time to 4-align it.
|
||||
uint16_t structSize = (uint16_t) (((int8_t*)pList) - ((int8_t*)eg));
|
||||
@ -497,7 +497,7 @@ OffsetIndex* gentz::parseOffsetIndexTable(FileStream* in) {
|
||||
zoneNumberArray[alignedCount++] = (uint16_t)0xFFFF;
|
||||
}
|
||||
int8_t* nextIndex = (int8_t*)&(zoneNumberArray[alignedCount]);
|
||||
|
||||
|
||||
index->nextEntryDelta = (uint16_t) ((i==(n-1)) ? 0 : (nextIndex - (int8_t*)index));
|
||||
index = (OffsetIndex*)nextIndex;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
######################################################################
|
||||
# Copyright (C) 1999, International Business Machines
|
||||
# Copyright (C) 1999-2001, International Business Machines
|
||||
# Corporation and others. All Rights Reserved.
|
||||
######################################################################
|
||||
# A simple alias list. We use this to retain backward compatibility.
|
||||
|
@ -1,5 +1,5 @@
|
||||
######################################################################
|
||||
# Copyright (C) 1999, International Business Machines
|
||||
# Copyright (C) 1999-2001, International Business Machines
|
||||
# Corporation and others. All Rights Reserved.
|
||||
######################################################################
|
||||
# Default zone list. If ICU cannot find an exact match for the host
|
||||
|
@ -1,5 +1,5 @@
|
||||
######################################################################
|
||||
# Copyright (C) 1999, International Business Machines
|
||||
# Copyright (C) 1999-2001, International Business Machines
|
||||
# Corporation and others. All Rights Reserved.
|
||||
######################################################################
|
||||
# See: ftp://elsie.nci.nih.gov/pub/tzdata<year>
|
||||
|
@ -1,5 +1,5 @@
|
||||
######################################################################
|
||||
# Copyright (C) 1999, International Business Machines
|
||||
# Copyright (C) 1999-2001, International Business Machines
|
||||
# Corporation and others. All Rights Reserved.
|
||||
######################################################################
|
||||
# See: ftp://elsie.nci.nih.gov/pub/tzdata<year>
|
||||
|
@ -1,5 +1,5 @@
|
||||
## Makefile.in for ICU - tools/genuca
|
||||
## Copyright (c) 1999, 2000, International Business Machines Corporation and
|
||||
## Copyright (c) 1999-2001, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
|
||||
## Source directory information
|
||||
|
@ -2,7 +2,7 @@
|
||||
.\"
|
||||
.\" genuca.8: manual page for the genuca utility
|
||||
.\"
|
||||
.\" Copyright (C) 2000 IBM, Inc. and others.
|
||||
.\" Copyright (C) 2000-2001 IBM, Inc. and others.
|
||||
.\"
|
||||
.TH GENUCA 8 "22 February 2001" "ICU MANPAGE" "ICU @VERSION@ Manual"
|
||||
.SH NAME
|
||||
|
@ -1,4 +1,6 @@
|
||||
## Makefile.in for ICU - tools/makeconv
|
||||
## Copyright (c) 2001, International Business Machines Corporation and
|
||||
## others. All Rights Reserved.
|
||||
## Stephen F. Booth
|
||||
|
||||
## Source directory information
|
||||
|
@ -1,3 +1,6 @@
|
||||
rem Copyright (C) 2000, International Business Machines
|
||||
rem Corporation and others. All Rights Reserved.
|
||||
|
||||
rem gbbmp.bat takes gbkuni30.txt and generates a mapping file for all BMP
|
||||
rem code points, as well as unidirectional files covering the BMP
|
||||
|
||||
|
@ -1,3 +1,6 @@
|
||||
# Copyright (C) 2000, International Business Machines
|
||||
# Corporation and others. All Rights Reserved.
|
||||
#
|
||||
# ICU state information for the GB 18030 MBCS codepage
|
||||
# Note that the entire block for the supplementary Unicode planes is
|
||||
# marked unassigned because they are handled algorithmically.
|
||||
|
@ -1,3 +1,7 @@
|
||||
rem Copyright (C) 2000, International Business Machines
|
||||
rem Corporation and others. All Rights Reserved.
|
||||
|
||||
|
||||
rem gbucm.bat takes gbkuni30.txt and ranges.txt and generates a .ucm file with
|
||||
rem all mappings except for the ones listed in ranges.txt
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -1242,7 +1242,7 @@ compactToUnicode2(MBCSData *mbcsData) {
|
||||
* recursive sub-function of compactToUnicodeHelper()
|
||||
* returns:
|
||||
* >0 number of bytes that are used in unicodeCodeUnits[] that could be saved,
|
||||
* if all sequences from this state are unassigned, returns the
|
||||
* if all sequences from this state are unassigned, returns the
|
||||
* <0 there are assignments in unicodeCodeUnits[]
|
||||
* 0 no use of unicodeCodeUnits[]
|
||||
*/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
********************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
********************************************************************************
|
||||
@ -14,7 +14,7 @@
|
||||
* 05/04/2000 helena Added fallback mapping into the picture...
|
||||
* 06/29/2000 helena Major rewrite of the callback APIs.
|
||||
*/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include "unicode/putil.h"
|
||||
#include "ucmp16.h"
|
||||
@ -124,7 +124,7 @@ static char *
|
||||
{
|
||||
uprv_memset(pound, ' ', fallback-pound);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
*pound = '\0';
|
||||
}
|
||||
@ -134,7 +134,7 @@ static char *
|
||||
|
||||
/* Returns true in c is a in set 'setOfChars', false otherwise
|
||||
*/
|
||||
static UBool
|
||||
static UBool
|
||||
isInSet (char c, const char *setOfChars)
|
||||
{
|
||||
uint8_t i = 0;
|
||||
@ -150,7 +150,7 @@ static UBool
|
||||
|
||||
/* Returns pointer to the next non-whitespace (or non-separator)
|
||||
*/
|
||||
static int32_t
|
||||
static int32_t
|
||||
nextTokenOffset (const char *line, const char *separators)
|
||||
{
|
||||
int32_t i = 0;
|
||||
@ -192,9 +192,9 @@ static UDataInfo dataInfo={
|
||||
{0, 0, 0, 0} /* dataVersion (calculated at runtime) */
|
||||
};
|
||||
|
||||
void writeConverterData(UConverterSharedData *mySharedData,
|
||||
const char *cnvName,
|
||||
const char *cnvDir,
|
||||
void writeConverterData(UConverterSharedData *mySharedData,
|
||||
const char *cnvName,
|
||||
const char *cnvDir,
|
||||
UErrorCode *status)
|
||||
{
|
||||
UNewDataMemory *mem = NULL;
|
||||
@ -221,7 +221,7 @@ void writeConverterData(UConverterSharedData *mySharedData,
|
||||
{
|
||||
fprintf(stderr, "- Opened udata %s.%s\n", cnvName, "cnv");
|
||||
}
|
||||
|
||||
|
||||
/* all read only, clean, platform independent data. Mmmm. :) */
|
||||
udata_writeBlock(mem, mySharedData->staticData, sizeof(UConverterStaticData));
|
||||
size += sizeof(UConverterStaticData); /* Is 4-aligned - by size */
|
||||
@ -236,12 +236,12 @@ void writeConverterData(UConverterSharedData *mySharedData,
|
||||
}
|
||||
if(VERBOSE)
|
||||
{
|
||||
fprintf(stderr, "- Wrote %d bytes to the udata.\n", sz2);
|
||||
fprintf(stderr, "- Wrote %d bytes to the udata.\n", sz2);
|
||||
}
|
||||
}
|
||||
|
||||
static UOption options[]={
|
||||
UOPTION_HELP_H, /* 0 Numbers for those who*/
|
||||
UOPTION_HELP_H, /* 0 Numbers for those who*/
|
||||
UOPTION_HELP_QUESTION_MARK, /* 1 can't count. */
|
||||
UOPTION_COPYRIGHT, /* 2 */
|
||||
UOPTION_VERSION, /* 3 */
|
||||
@ -251,7 +251,7 @@ static UOption options[]={
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
UConverterSharedData* mySharedData = NULL;
|
||||
UConverterSharedData* mySharedData = NULL;
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
char outFileName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
|
||||
const char* destdir, *arg;
|
||||
@ -319,7 +319,7 @@ int main(int argc, char* argv[])
|
||||
destdirlen = 0;
|
||||
outBasename = outFileName;
|
||||
}
|
||||
|
||||
|
||||
#if DEBUG
|
||||
{
|
||||
int i;
|
||||
@ -359,7 +359,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
/*removes the extension if any is found*/
|
||||
dot = uprv_strrchr(outBasename, '.');
|
||||
if (dot)
|
||||
if (dot)
|
||||
{
|
||||
*dot = '\0';
|
||||
}
|
||||
@ -388,7 +388,7 @@ int main(int argc, char* argv[])
|
||||
/* Make the static data name equal to the file name */
|
||||
if( /*VERBOSE && */ uprv_stricmp(cnvName,mySharedData->staticData->name))
|
||||
{
|
||||
fprintf(stderr, "Warning: %s%s claims to be '%s'\n",
|
||||
fprintf(stderr, "Warning: %s%s claims to be '%s'\n",
|
||||
cnvName,
|
||||
CONVERTER_FILE_EXTENSION,
|
||||
mySharedData->staticData->name);
|
||||
@ -647,7 +647,7 @@ void readHeaderFromFile(UConverterSharedData* mySharedData,
|
||||
*pErrorCode=U_INVALID_TABLE_FORMAT;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void loadTableFromFile(FileStream* convFile, UConverterSharedData* sharedData, UErrorCode* err)
|
||||
{
|
||||
char storageLine[200];
|
||||
@ -799,15 +799,15 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
||||
UConverterStaticData* myStaticData = NULL;
|
||||
|
||||
if (U_FAILURE(*err)) return NULL;
|
||||
|
||||
|
||||
convFile = T_FileStream_open(converterName, "r");
|
||||
if (convFile == NULL)
|
||||
if (convFile == NULL)
|
||||
{
|
||||
*err = U_FILE_ACCESS_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
mySharedData = (UConverterSharedData*) uprv_malloc(sizeof(UConverterSharedData));
|
||||
if (mySharedData == NULL)
|
||||
{
|
||||
@ -815,9 +815,9 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
||||
T_FileStream_close(convFile);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
uprv_memset(mySharedData, 0, sizeof(UConverterSharedData));
|
||||
|
||||
|
||||
mySharedData->structSize = sizeof(UConverterSharedData);
|
||||
|
||||
myStaticData = (UConverterStaticData*) uprv_malloc(sizeof(UConverterStaticData));
|
||||
@ -826,7 +826,7 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
T_FileStream_close(convFile);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
uprv_memset(myStaticData, 0, sizeof(UConverterStaticData));
|
||||
mySharedData->staticData = myStaticData;
|
||||
myStaticData->structSize = sizeof(UConverterStaticData);
|
||||
@ -839,10 +839,10 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
||||
readHeaderFromFile(mySharedData, convFile, converterName, err);
|
||||
|
||||
if (U_FAILURE(*err)) return NULL;
|
||||
|
||||
|
||||
switch (myStaticData->conversionType)
|
||||
{
|
||||
case UCNV_SBCS:
|
||||
case UCNV_SBCS:
|
||||
{
|
||||
/* SBCS: use MBCS data structure with a default state table */
|
||||
if(mySharedData->staticData->maxBytesPerChar!=1) {
|
||||
@ -865,12 +865,12 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UCNV_MBCS:
|
||||
case UCNV_MBCS:
|
||||
{
|
||||
/* MBCSOpen() was called by readHeaderFromFile() */
|
||||
break;
|
||||
}
|
||||
case UCNV_EBCDIC_STATEFUL:
|
||||
case UCNV_EBCDIC_STATEFUL:
|
||||
{
|
||||
/* EBCDIC_STATEFUL: use MBCS data structure with a default state table */
|
||||
if(mySharedData->staticData->maxBytesPerChar!=2) {
|
||||
@ -898,7 +898,7 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
||||
}
|
||||
break;
|
||||
}
|
||||
case UCNV_DBCS:
|
||||
case UCNV_DBCS:
|
||||
{
|
||||
/* DBCS: use MBCS data structure with a default state table */
|
||||
if(mySharedData->staticData->maxBytesPerChar!=2) {
|
||||
@ -939,7 +939,7 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
||||
}
|
||||
|
||||
T_FileStream_close(convFile);
|
||||
|
||||
|
||||
return mySharedData;
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -58,18 +58,18 @@ typedef struct CCSIDStateTable {
|
||||
|
||||
static const CCSIDStateTable
|
||||
knownStateTables[]={
|
||||
|
||||
|
||||
301, "<icu:state> 0-ff:2, 81-9f:1, e0-fc:1\n"
|
||||
"<icu:state> 40-7e, 80-fc\n"
|
||||
"<icu:state>\n",
|
||||
367, "<icu:state> 0-7f\n",
|
||||
|
||||
|
||||
927, japanesePCDBCSStates,
|
||||
|
||||
|
||||
926, japanesePCDBCSStates,
|
||||
|
||||
928, japanesePCDBCSStates,
|
||||
|
||||
|
||||
932, "<icu:state> 0-7f,80,81-9f:1,a0-df,fd-ff, e0-fc:1\n"
|
||||
"<icu:state> 40-7e, 80-fc\n",
|
||||
|
||||
@ -87,14 +87,14 @@ knownStateTables[]={
|
||||
|
||||
946, "<icu:state> 0-80, 81-fb:1,fc:2,fd-ff\n"
|
||||
"<icu:state> 40-7e, 80-fe\n"
|
||||
"<icu:state> 80-fe.u,fc",
|
||||
"<icu:state> 80-fe.u,fc",
|
||||
|
||||
947, "<icu:state> 0-7f, 80-fe:1\n"
|
||||
"<icu:state> 40-7e, 80-fe\n",
|
||||
|
||||
|
||||
948, "<icu:state> 0-80, 81-fb:1,fc:2,fd-fe\n"
|
||||
"<icu:state> 40-7e, 80-fe\n"
|
||||
"<icu:state> 80-fe.u,fc\n",
|
||||
"<icu:state> 80-fe.u,fc\n",
|
||||
|
||||
949, "<icu:state> 0-84, 8f-fe:1\n"
|
||||
"<icu:state> 40-7e, 80-fe\n",
|
||||
@ -111,7 +111,7 @@ knownStateTables[]={
|
||||
955, "<icu:state> 0-20:2, 21-7e:1, 7f-ff:2\n"
|
||||
"<icu:state> 21-7e\n"
|
||||
"<icu:state>\n",
|
||||
|
||||
|
||||
963, "<icu:state> 0-20:2, 21-7e:1, 7f-ff:2\n"
|
||||
"<icu:state> 21-7e\n"
|
||||
"<icu:state>\n",
|
||||
@ -140,7 +140,7 @@ knownStateTables[]={
|
||||
1351, "<icu:state> 0-ff:2, 81-9f:1, e0-fc:1\n"
|
||||
"<icu:state> 40-7e, 80-fc\n"
|
||||
"<icu:state>\n",
|
||||
|
||||
|
||||
1370, "<icu:state> 0-80, 81-fe:1\n"
|
||||
"<icu:state> 40-7e, 81-fe\n",
|
||||
|
||||
@ -159,7 +159,7 @@ knownStateTables[]={
|
||||
|
||||
5039, "<icu:state> 0-80, 81-9f:1, a0-df, e0-fc:1, fd-ff\n"
|
||||
"<icu:state> 40-7e, 80-fc\n",
|
||||
|
||||
|
||||
5050, "<icu:state> 0-8d, 8e:2, 8f:3, 90-9f, a1-fe:1\n"
|
||||
"<icu:state> a1-fe\n"
|
||||
"<icu:state> a1-e4\n"
|
||||
@ -168,10 +168,10 @@ knownStateTables[]={
|
||||
5067, "<icu:state> 0-ff:2, 21-7e:1\n"
|
||||
"<icu:state> 21-7e\n"
|
||||
"<icu:state>\n",
|
||||
|
||||
|
||||
5478, "<icu:state> 0-ff:2, 21-7e:1\n"
|
||||
"<icu:state> 21-7e\n"
|
||||
"<icu:state>\n",
|
||||
"<icu:state>\n",
|
||||
|
||||
21427, "<icu:state> 0-80:2, 81-fe:1, ff:2\n"
|
||||
"<icu:state> 40-7e, 80-fe\n"
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Copyright (C) 1998-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
******************************************************************************
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
**********************************************************************
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
**********************************************************************
|
||||
* Date Name Description
|
||||
@ -376,7 +376,7 @@ void processLine(int fileNo, int varNo, char* line, UBool isFirstLine, TokenHand
|
||||
if (isFirstLine) {
|
||||
/* Call once with NULL for initialization */
|
||||
(*proc)(NULL, 0, fileNo, varNo);
|
||||
}
|
||||
}
|
||||
for (;;) {
|
||||
int32_t len = 0;
|
||||
char* p;
|
||||
|
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -13,7 +13,7 @@
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* This program packages the ICU data into different forms
|
||||
* (DLL, common data, etc.)
|
||||
* (DLL, common data, etc.)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -89,7 +89,7 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
CharList *objects = NULL;
|
||||
CharList *iter;
|
||||
|
||||
if(U_FAILURE(*status)) {
|
||||
if(U_FAILURE(*status)) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -116,11 +116,11 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
#ifdef OS390
|
||||
if(uprv_isOS390BatchMode()) {
|
||||
if (uprv_strcmp(o->shortName, U_ICUDATA_NAME) == 0)
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMICUDA)'\"\n\n");
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMICUDA)'\"\n\n");
|
||||
else if (uprv_strcmp(o->shortName, "testdata") == 0)
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMICUTE)'\"\n\n");
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMICUTE)'\"\n\n");
|
||||
else if (uprv_strcmp(o->shortName, U_ICUDATA_NAME"_390") == 0)
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMICUD1)'\"\n\n");
|
||||
sprintf(tmp, "# File to make:\nBATCH_TARGET=\"//'${LOADMOD}(IXMICUD1)'\"\n\n");
|
||||
T_FileStream_writeLine(makefile, tmp);
|
||||
}
|
||||
#endif
|
||||
@ -178,8 +178,8 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
T_FileStream_writeLine(makefile,"$(TEMP_DIR)/%.o: $(TEMP_DIR)/%.c\n\t $(COMPILE.c) -o $@ $<\n\n");
|
||||
|
||||
T_FileStream_writeLine(makefile,"build-objs: $(SOURCES) $(OBJECTS)\n\n$(OBJECTS): $(SOURCES)\n\n");
|
||||
|
||||
#ifdef HPUX
|
||||
|
||||
#ifdef HPUX
|
||||
T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(TARGET): $(OBJECTS) $(HPUX_JUNK_OBJ) $(LISTFILES) $(BIR_DEPS)\n"
|
||||
"\t$(SHLIB.cc) -o $@ $(OBJECTS) $(HPUX_JUNK_OBJ) $(BIR_LDFLAGS)\n"
|
||||
"\t-ls -l $@\n\n");
|
||||
@ -206,7 +206,7 @@ void pkg_mode_dll(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
|
||||
T_FileStream_writeLine(makefile, "CLEANFILES= $(OBJECTS) $(HPUX_JUNK_OBJ) $(TARGETDIR)/$(TARGET)\n\nclean:\n\t-$(RMV) $(CLEANFILES) $(MAKEFILE)");
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
|
||||
T_FileStream_writeLine(makefile, "install: $(TARGETDIR)/$(TARGET)\n"
|
||||
"\t$(INSTALL-L) $(TARGETDIR)/$(TARGET) $(INSTALLTO)/$(TARGET)\n\n");
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -45,7 +45,7 @@ install: all
|
||||
$(INSTALL_DATA) $(TARGETS) $(instdir)
|
||||
|
||||
|
||||
==Note:==
|
||||
==Note:==
|
||||
The only items in the first '$(INSTALL_DATA)' are files NOT already in the out dir!
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
|
||||
fprintf(stderr, " ####### Warning! Files mode is still experimental. -srl\n");
|
||||
|
||||
|
||||
|
||||
/* Dont' copy files already in tmp */
|
||||
for(infiles = o->filePaths;infiles;infiles = infiles->next)
|
||||
{
|
||||
@ -79,7 +79,7 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
uprv_strcpy(tmp, o->tmpDir);
|
||||
uprv_strcat(tmp, U_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp, baseName);
|
||||
|
||||
|
||||
o->outFiles = pkg_appendToList(o->outFiles, &tail, uprv_strdup(tmp));
|
||||
|
||||
if(strcmp(tmp, infiles->str) == 0)
|
||||
@ -93,21 +93,21 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
uprv_strcat(tmp2, U_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp2, U_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp2, baseName);
|
||||
|
||||
|
||||
if(strcmp(tmp2, infiles->str) == 0)
|
||||
{
|
||||
/* fprintf(stderr, "### NOT copying: %s\n", tmp2); */
|
||||
/* no copy needed.. */
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* left hand side: target path, target name */
|
||||
copyFilesLeft = pkg_appendToList(copyFilesLeft, ©FilesLeftTail, uprv_strdup(tmp));
|
||||
|
||||
fprintf(stderr, "##### COPY %s\n", tmp2);
|
||||
/* rhs: source path */
|
||||
copyFilesRight = pkg_appendToList(copyFilesRight, ©FilesRightTail, uprv_strdup(infiles->str));
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(o->nooutput || o->verbose) {
|
||||
@ -118,7 +118,7 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
|
||||
if(o->nooutput) {
|
||||
*status = U_ZERO_ERROR;
|
||||
return;
|
||||
@ -129,7 +129,7 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
pkg_writeCharListWrap(makefile, copyFilesLeft, " ", " \\\n",1);
|
||||
T_FileStream_writeLine(makefile, "\n");
|
||||
|
||||
|
||||
|
||||
T_FileStream_writeLine(makefile, "all: $(TARGETDIR)/$(NAME)\n\n");
|
||||
T_FileStream_writeLine(makefile, "$(TARGETDIR)/$(NAME):\n");
|
||||
T_FileStream_writeLine(makefile, "\t@-$(RMV) $(TARGETDIR)/$(NAME)\n");
|
||||
@ -137,13 +137,13 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
/* commands for the make rule */
|
||||
tail = NULL;
|
||||
copyCommands = pkg_appendToList(copyCommands, &tail, uprv_strdup("$(INSTALL_DATA) $? $(TARGETDIR)"));
|
||||
|
||||
|
||||
if(copyFilesRight != NULL)
|
||||
{
|
||||
|
||||
pkg_mak_writeStanza(makefile, o, "$(COPIEDDEST)", copyFilesRight,
|
||||
copyCommands);
|
||||
|
||||
|
||||
T_FileStream_writeLine(makefile, "clean:\n\t-$(RMV) $(COPIEDDEST) $(MAKEFILE)");
|
||||
T_FileStream_writeLine(makefile, "\n\n");
|
||||
|
||||
@ -152,7 +152,7 @@ void pkg_mode_files(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
|
||||
{
|
||||
T_FileStream_writeLine(makefile, "clean:\n\n");
|
||||
}
|
||||
|
||||
|
||||
sprintf(tmp, "install: $(COPIEDDEST)\n"
|
||||
"\t$(INSTALL_DATA) $(DATAFILEPATHS) $(INSTALLTO)\n\n");
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -13,7 +13,7 @@
|
||||
* created by: Steven \u24C7 Loomis
|
||||
*
|
||||
* This program packages the ICU data into different forms
|
||||
* (DLL, common data, etc.)
|
||||
* (DLL, common data, etc.)
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
@ -53,7 +53,7 @@ static struct
|
||||
const char *name;
|
||||
UPKGMODE *fcn;
|
||||
const char *desc;
|
||||
} modes[] =
|
||||
} modes[] =
|
||||
{
|
||||
{ "files", pkg_mode_files, "Uses raw data files (no effect). Installation copies all files to the target location." },
|
||||
#ifdef WIN32
|
||||
@ -68,16 +68,16 @@ static struct
|
||||
};
|
||||
|
||||
static UOption options[]={
|
||||
/*00*/ UOPTION_DEF( "name", 'p', UOPT_REQUIRES_ARG),
|
||||
/*00*/ UOPTION_DEF( "name", 'p', UOPT_REQUIRES_ARG),
|
||||
/*01*/ UOPTION_DEF( "bldopt", 'O', UOPT_REQUIRES_ARG), /* on Win32 it is release or debug */
|
||||
/*02*/ UOPTION_DEF( "mode", 'm', UOPT_REQUIRES_ARG),
|
||||
/*03*/ UOPTION_HELP_H, /* -h */
|
||||
/*04*/ UOPTION_HELP_QUESTION_MARK, /* -? */
|
||||
/*05*/ UOPTION_VERBOSE, /* -v */
|
||||
/*06*/ UOPTION_COPYRIGHT, /* -c */
|
||||
/*07*/ UOPTION_DEF( "comment", 'C', UOPT_REQUIRES_ARG),
|
||||
/*07*/ UOPTION_DEF( "comment", 'C', UOPT_REQUIRES_ARG),
|
||||
/*08*/ UOPTION_DESTDIR, /* -d */
|
||||
/*09*/ UOPTION_DEF( "clean", 'k', UOPT_NO_ARG),
|
||||
/*09*/ UOPTION_DEF( "clean", 'k', UOPT_NO_ARG),
|
||||
/*10*/ UOPTION_DEF( "nooutput",'n', UOPT_NO_ARG),
|
||||
/*11*/ UOPTION_DEF( "rebuild", 'F', UOPT_NO_ARG),
|
||||
/*12*/ UOPTION_DEF( "tempdir", 'T', UOPT_REQUIRES_ARG),
|
||||
@ -124,9 +124,9 @@ main(int argc, char* argv[]) {
|
||||
|
||||
/* read command line options */
|
||||
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
|
||||
|
||||
|
||||
/* error handling, printing usage message */
|
||||
/* I've decided to simply print an error and quit. This tool has too
|
||||
/* I've decided to simply print an error and quit. This tool has too
|
||||
many options to just display them all of the time. */
|
||||
|
||||
if(options[3].doesOccur || options[4].doesOccur) {
|
||||
@ -147,7 +147,7 @@ main(int argc, char* argv[]) {
|
||||
fprintf(stderr, "Run '%s --help' for help.\n", progname);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
if(argc == 1) {
|
||||
fprintf(stderr,
|
||||
"No input files specified.\n"
|
||||
@ -162,7 +162,7 @@ main(int argc, char* argv[]) {
|
||||
"\tProduce packaged ICU data from the given list(s) of files.\n"
|
||||
"\t'-' by itself means to read from stdin.\n",
|
||||
progname);
|
||||
|
||||
|
||||
fprintf(stderr, "\n options:\n");
|
||||
for(i=0;i<(sizeof(options)/sizeof(options[0]));i++) {
|
||||
fprintf(stderr, "%-5s -%c or --%-10s %s\n",
|
||||
@ -240,7 +240,7 @@ main(int argc, char* argv[]) {
|
||||
o.clean = options[9].doesOccur;
|
||||
o.nooutput = options[10].doesOccur;
|
||||
o.rebuild = options[11].doesOccur;
|
||||
|
||||
|
||||
if( options[12].doesOccur ) {
|
||||
o.tmpDir = options[12].value;
|
||||
} else {
|
||||
@ -307,7 +307,7 @@ main(int argc, char* argv[]) {
|
||||
T_FileStream_close(out);
|
||||
|
||||
if(U_FAILURE(status)) {
|
||||
fprintf(stderr, "Error creating makefile [%s]: %s\n", o.mode,
|
||||
fprintf(stderr, "Error creating makefile [%s]: %s\n", o.mode,
|
||||
u_errorName(status));
|
||||
return 1;
|
||||
}
|
||||
@ -315,7 +315,7 @@ main(int argc, char* argv[]) {
|
||||
if(o.nooutput == TRUE) {
|
||||
return 0; /* nothing to do. */
|
||||
}
|
||||
|
||||
|
||||
return executeMakefile(&o);
|
||||
}
|
||||
|
||||
@ -326,7 +326,7 @@ static int executeMakefile(const UPKGOptions *o)
|
||||
/*char pwd[1024];*/
|
||||
const char *make;
|
||||
int rc;
|
||||
|
||||
|
||||
make = getenv("MAKE");
|
||||
|
||||
if(!make || !make[0]) {
|
||||
@ -367,7 +367,7 @@ static int executeMakefile(const UPKGOptions *o)
|
||||
}
|
||||
|
||||
rc = system(cmd);
|
||||
|
||||
|
||||
if(rc < 0) {
|
||||
fprintf(stderr, "# Failed, rc=%d\n", rc);
|
||||
}
|
||||
@ -378,26 +378,26 @@ static int executeMakefile(const UPKGOptions *o)
|
||||
static void loadLists(UPKGOptions *o, UErrorCode *status)
|
||||
{
|
||||
CharList *l, *tail = NULL, *tail2 = NULL;
|
||||
FileStream *in;
|
||||
FileStream *in;
|
||||
char line[2048];
|
||||
char tmp[1024];
|
||||
const char* baseName;
|
||||
char *s;
|
||||
|
||||
|
||||
for(l = o->fileListFiles; l; l = l->next) {
|
||||
if(o->verbose) {
|
||||
fprintf(stdout, "# Reading %s..\n", l->str);
|
||||
}
|
||||
|
||||
|
||||
/* TODO: stdin */
|
||||
in = T_FileStream_open(l->str, "r");
|
||||
|
||||
|
||||
if(!in) {
|
||||
fprintf(stderr, "Error opening <%s>.\n", l->str);
|
||||
*status = U_FILE_ACCESS_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
while(T_FileStream_readLine(in, line, sizeof(line))!=NULL) {
|
||||
/* remove trailing newline characters */
|
||||
s=line;
|
||||
@ -411,7 +411,7 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
|
||||
if((*line == 0) || (*line == '#')) {
|
||||
continue; /* comment or empty line */
|
||||
}
|
||||
|
||||
|
||||
/* add the file */
|
||||
s = (char*)getLongPathname(line);
|
||||
|
||||
@ -425,10 +425,10 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
|
||||
uprv_strcpy(tmp, o->srcDir);
|
||||
uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1]==U_FILE_SEP_CHAR?"":U_FILE_SEP_STRING);
|
||||
uprv_strcat(tmp, s);
|
||||
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
|
||||
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
T_FileStream_close(in);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -54,7 +54,7 @@ main(int argc,
|
||||
/* parse the options */
|
||||
for(optind = 1; optind < argc; ++optind) {
|
||||
arg = argv[optind];
|
||||
|
||||
|
||||
/* version info */
|
||||
if(uprv_strcmp(arg, "-v") == 0 || uprv_strcmp(arg, "--version") == 0) {
|
||||
printVersion = 1;
|
||||
@ -107,7 +107,7 @@ main(int argc,
|
||||
/* Usage information */
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
{
|
||||
puts("Usage: rbdump [OPTIONS] [FILES]");
|
||||
puts("Options:");
|
||||
puts(" -h, --help Print this message and exit.");
|
||||
@ -118,7 +118,7 @@ usage()
|
||||
static void
|
||||
version()
|
||||
{
|
||||
printf("rbdump version %s (ICU version %s).\n",
|
||||
printf("rbdump version %s (ICU version %s).\n",
|
||||
RBDUMP_VERSION, U_ICU_VERSION);
|
||||
puts(U_COPYRIGHT_STRING);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
@ -51,13 +51,13 @@ uprint(const UChar *s,
|
||||
|
||||
/* open a default converter */
|
||||
converter = ucnv_open(0, status);
|
||||
|
||||
|
||||
/* if we failed, clean up and exit */
|
||||
if(U_FAILURE(*status)) goto finish;
|
||||
|
||||
/* output unicode characters properly */
|
||||
ucnv_setFromUCallBack(converter, UCNV_FROM_U_CALLBACK_ESCAPE, NULL, oldFromUAction, &oldFromUContext, status);
|
||||
|
||||
|
||||
if(U_FAILURE(*status)) goto finish;
|
||||
|
||||
/* perform the conversion */
|
||||
@ -77,10 +77,10 @@ uprint(const UChar *s,
|
||||
myTarget = buf;
|
||||
arraySize = BUF_SIZE;
|
||||
}
|
||||
while(*status == U_BUFFER_OVERFLOW_ERROR);
|
||||
while(*status == U_BUFFER_OVERFLOW_ERROR);
|
||||
|
||||
finish:
|
||||
|
||||
|
||||
/* close the converter */
|
||||
ucnv_close(converter);
|
||||
}
|
||||
|
@ -1,3 +1,6 @@
|
||||
## Copyright (C) 2000, International Business Machines Corporation
|
||||
## and others. All Rights Reserved.
|
||||
|
||||
## Makefile.in for ICU - tools/toolutil
|
||||
## Steven R. Loomis
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,6 +1,6 @@
|
||||
/********************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-1999, International Business Machines
|
||||
* Copyright (C) 1997-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*********************************************************************/
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999,2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 1999, International Business Machines
|
||||
* Copyright (C) 1999-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*******************************************************************************
|
||||
*
|
||||
* Copyright (C) 2000, International Business Machines
|
||||
* Copyright (C) 2000-2001, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*******************************************************************************
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
*****************************************************************************************
|
||||
*
|
||||
* Copyright (C) 1997-1999, International Business Machines
|
||||
* Copyright (C) 1997-200, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
*****************************************************************************************
|
||||
@ -78,39 +78,39 @@ CompactShortArray* ucmp16_open(int16_t defaultValue)
|
||||
int32_t i;
|
||||
CompactShortArray* this = (CompactShortArray*) uprv_malloc(sizeof(CompactShortArray));
|
||||
if (this == NULL) return NULL;
|
||||
|
||||
|
||||
this->fCount = UCMP16_kUnicodeCount;
|
||||
this->fCompact = FALSE;
|
||||
this->fCompact = FALSE;
|
||||
this->fBogus = FALSE;
|
||||
this->fArray = NULL;
|
||||
this->fIndex = NULL;
|
||||
this->fHashes = NULL;
|
||||
this->fHashes = NULL;
|
||||
this->fDefaultValue = defaultValue;
|
||||
|
||||
|
||||
this->fArray = (int16_t*)uprv_malloc(UCMP16_kUnicodeCount * sizeof(int16_t));
|
||||
if (this->fArray == NULL)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
this->fIndex = (uint16_t*)uprv_malloc(UCMP16_kIndexCount * sizeof(uint16_t));
|
||||
if (this->fIndex == NULL)
|
||||
{
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = NULL;
|
||||
|
||||
|
||||
this->fBogus = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
this->kBlockShift = UCMP16_kBlockShift;
|
||||
this->kBlockMask = UCMP16_kBlockMask;
|
||||
for (i = 0; i < UCMP16_kUnicodeCount; i += 1)
|
||||
{
|
||||
this->fArray[i] = defaultValue;
|
||||
}
|
||||
|
||||
|
||||
this->fHashes =(int32_t*)uprv_malloc(UCMP16_kIndexCount * sizeof(int32_t));
|
||||
if (this->fHashes == NULL)
|
||||
{
|
||||
@ -119,25 +119,25 @@ CompactShortArray* ucmp16_open(int16_t defaultValue)
|
||||
this->fBogus = TRUE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < UCMP16_kIndexCount; i += 1)
|
||||
{
|
||||
this->fIndex[i] = (uint16_t)(i << UCMP16_kBlockShift);
|
||||
this->fHashes[i] = 0;
|
||||
}
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
CompactShortArray* ucmp16_openAdopt(uint16_t *indexArray,
|
||||
int16_t *newValues,
|
||||
int16_t *newValues,
|
||||
int32_t count,
|
||||
int16_t defaultValue)
|
||||
{
|
||||
CompactShortArray* this = (CompactShortArray*) uprv_malloc(sizeof(CompactShortArray));
|
||||
if (this == NULL) return NULL;
|
||||
this->fHashes = NULL;
|
||||
this->fCount = count;
|
||||
this->fCount = count;
|
||||
this->fDefaultValue = defaultValue;
|
||||
this->fBogus = FALSE;
|
||||
this->fArray = newValues;
|
||||
@ -160,15 +160,15 @@ CompactShortArray* ucmp16_openAdoptWithBlockShift(uint16_t *indexArray,
|
||||
count,
|
||||
defaultValue);
|
||||
if (this == NULL) return NULL;
|
||||
|
||||
|
||||
this->kBlockShift = blockShift;
|
||||
this->kBlockMask = (uint32_t) (((uint32_t)1 << (uint32_t)blockShift) - (uint32_t)1);
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
|
||||
void ucmp16_close(CompactShortArray* this)
|
||||
{
|
||||
uprv_free(this->fArray);
|
||||
@ -183,17 +183,17 @@ CompactShortArray* setToBogus(CompactShortArray* this)
|
||||
{
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = NULL;
|
||||
|
||||
|
||||
uprv_free(this->fIndex);
|
||||
this->fIndex = NULL;
|
||||
|
||||
|
||||
uprv_free(this->fHashes);
|
||||
this->fHashes = NULL;
|
||||
|
||||
|
||||
this->fCount = 0;
|
||||
this->fCompact = FALSE;
|
||||
this->fBogus = TRUE;
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -204,23 +204,23 @@ void ucmp16_expand(CompactShortArray* this)
|
||||
{
|
||||
int32_t i;
|
||||
int16_t *tempArray = (int16_t*)uprv_malloc(UCMP16_kUnicodeCount * sizeof(int16_t));
|
||||
|
||||
|
||||
if (tempArray == NULL)
|
||||
{
|
||||
this->fBogus = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < UCMP16_kUnicodeCount; i += 1)
|
||||
{
|
||||
tempArray[i] = ucmp16_get(this, (UChar)i); /* HSYS : How expand?*/
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < (1 << (16 - this->kBlockShift)); i += 1)
|
||||
{
|
||||
this->fIndex[i] = (uint16_t)(i<<this->kBlockShift);
|
||||
}
|
||||
|
||||
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = tempArray;
|
||||
this->fCompact = FALSE;
|
||||
@ -236,9 +236,9 @@ void ucmp16_set(CompactShortArray* this,
|
||||
ucmp16_expand(this);
|
||||
if (this->fBogus) return;
|
||||
}
|
||||
|
||||
|
||||
this->fArray[(int32_t)c] = value;
|
||||
|
||||
|
||||
if (value != this->fDefaultValue)
|
||||
{
|
||||
touchBlock(this, c >> this->kBlockShift, value);
|
||||
@ -246,7 +246,7 @@ void ucmp16_set(CompactShortArray* this,
|
||||
}
|
||||
|
||||
|
||||
void ucmp16_setRange(CompactShortArray* this,
|
||||
void ucmp16_setRange(CompactShortArray* this,
|
||||
UChar start,
|
||||
UChar end,
|
||||
int16_t value)
|
||||
@ -280,13 +280,13 @@ void ucmp16_compact(CompactShortArray* this)
|
||||
int32_t limitCompacted = 0;
|
||||
int32_t i, iBlockStart;
|
||||
int16_t iUntouched = -1;
|
||||
|
||||
|
||||
for (i = 0, iBlockStart = 0; i < (1 << (16 - this->kBlockShift)); i += 1, iBlockStart += (1 << this->kBlockShift))
|
||||
{
|
||||
UBool touched = blockTouched(this, i);
|
||||
|
||||
|
||||
this->fIndex[i] = 0xFFFF;
|
||||
|
||||
|
||||
if (!touched && iUntouched != -1)
|
||||
{
|
||||
/* If no values in this block were set, we can just set its
|
||||
@ -298,7 +298,7 @@ void ucmp16_compact(CompactShortArray* this)
|
||||
else
|
||||
{
|
||||
int32_t j, jBlockStart;
|
||||
|
||||
|
||||
for (j = 0, jBlockStart = 0;
|
||||
j < limitCompacted;
|
||||
j += 1, jBlockStart += (1 << this->kBlockShift))
|
||||
@ -306,26 +306,26 @@ void ucmp16_compact(CompactShortArray* this)
|
||||
if (this->fHashes[i] == this->fHashes[j] &&
|
||||
arrayRegionMatches(this->fArray,
|
||||
iBlockStart,
|
||||
this->fArray,
|
||||
this->fArray,
|
||||
jBlockStart,
|
||||
(1 << this->kBlockShift)))
|
||||
{
|
||||
this->fIndex[i] = (int16_t)jBlockStart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* TODO: verify this is correct*/
|
||||
if (this->fIndex[i] == 0xFFFF)
|
||||
{
|
||||
/* we didn't match, so copy & update*/
|
||||
uprv_memcpy(&(this->fArray[jBlockStart]),
|
||||
uprv_memcpy(&(this->fArray[jBlockStart]),
|
||||
&(this->fArray[iBlockStart]),
|
||||
(1 << this->kBlockShift)*sizeof(int16_t));
|
||||
|
||||
|
||||
this->fIndex[i] = (int16_t)jBlockStart;
|
||||
this->fHashes[j] = this->fHashes[i];
|
||||
limitCompacted += 1;
|
||||
|
||||
|
||||
if (!touched)
|
||||
{
|
||||
/* If this is the first untouched block we've seen,*/
|
||||
@ -340,15 +340,15 @@ void ucmp16_compact(CompactShortArray* this)
|
||||
{
|
||||
int32_t newSize = limitCompacted * (1 << this->kBlockShift);
|
||||
int16_t *result = (int16_t*) uprv_malloc(sizeof(int16_t) * newSize);
|
||||
|
||||
|
||||
uprv_memcpy(result, this->fArray, newSize * sizeof(int16_t));
|
||||
|
||||
|
||||
uprv_free(this->fArray);
|
||||
this->fArray = result;
|
||||
this->fCount = newSize;
|
||||
uprv_free(this->fHashes);
|
||||
this->fHashes = NULL;
|
||||
|
||||
|
||||
this->fCompact = TRUE;
|
||||
}
|
||||
}
|
||||
@ -390,7 +390,7 @@ ucmp16_getIndex(const CompactShortArray* this)
|
||||
return this->fIndex;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
uint32_t
|
||||
ucmp16_getCount(const CompactShortArray* this)
|
||||
{
|
||||
return this->fCount;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/*
|
||||
********************************************************************
|
||||
*
|
||||
* Copyright (C) 1996-1999, International Business Machines
|
||||
* Copyright (C) 1996-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
********************************************************************
|
||||
@ -13,7 +13,7 @@
|
||||
* @version 1.0 23/10/96
|
||||
* @author Helena Shih
|
||||
* Based on Taligent international support for java
|
||||
* Modification History :
|
||||
* Modification History :
|
||||
*
|
||||
* 05/07/97 helena Added isBogus()
|
||||
* 07/15/98 erm Synched with Java 1.2 CompactShortArray.java.
|
||||
@ -72,18 +72,18 @@
|
||||
* @see CompactIntArray
|
||||
* @see CompactCharArray
|
||||
* @see CompactStringArray
|
||||
* @version $Revision: 1.6 $ 8/25/98
|
||||
* @version $Revision: 1.7 $ 8/25/98
|
||||
* @author Helena Shih
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
typedef struct
|
||||
{
|
||||
int16_t* fArray;
|
||||
uint16_t* fIndex;
|
||||
int32_t* fHashes;
|
||||
int32_t fCount;
|
||||
int16_t fDefaultValue;
|
||||
UBool fCompact;
|
||||
UBool fCompact;
|
||||
UBool fBogus;
|
||||
int32_t kBlockShift;
|
||||
int32_t kBlockMask;
|
||||
@ -172,7 +172,7 @@ U_CAPI void ucmp16_set(CompactShortArray *array,
|
||||
*/
|
||||
U_CAPI void ucmp16_setRange(CompactShortArray* array,
|
||||
UChar start,
|
||||
UChar end,
|
||||
UChar end,
|
||||
int16_t value);
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (C) 1998-1999, International Business Machines
|
||||
* Copyright (C) 1998-2000, International Business Machines
|
||||
* Corporation and others. All Rights Reserved.
|
||||
*
|
||||
* @version 1.0 06/19/98
|
||||
@ -92,12 +92,12 @@ const int16_t tagValues[] =
|
||||
/* Pi */ (int16_t)INITIAL_PUNCTUATION,
|
||||
/* Pf */ (int16_t)FINAL_PUNCTUATION
|
||||
};
|
||||
int
|
||||
MakeProp(char* str)
|
||||
int
|
||||
MakeProp(char* str)
|
||||
{
|
||||
int result = 0;
|
||||
char* matchPosition;
|
||||
|
||||
|
||||
matchPosition = strstr(tagStrings, str);
|
||||
if (matchPosition == 0) fprintf(stderr, "unrecognized type letter %s", str);
|
||||
else result = ((matchPosition - tagStrings) / 2);
|
||||
@ -153,15 +153,15 @@ getArray(FILE *input)
|
||||
}
|
||||
sscanf(bufferPtr, "%X", &otherunicode);
|
||||
// the Unicode char has a equivalent uppercase
|
||||
if ((typeResult == LOWERCASE_LETTER) && (0 <= otherunicode && otherunicode < 65536)) {
|
||||
if ((typeResult == LOWERCASE_LETTER) && (0 <= otherunicode && otherunicode < 65536)) {
|
||||
set = TRUE;
|
||||
}
|
||||
}
|
||||
if ((typeResult == UPPERCASE_LETTER) && !set) {
|
||||
bufferPtr++;
|
||||
sscanf(bufferPtr, "%X", &otherunicode);
|
||||
if (0 <= otherunicode && otherunicode < 65536) {
|
||||
if (0 <= otherunicode && otherunicode < 65536) {
|
||||
set = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((set == TRUE) && (ucmp16_get(ulxfrmArray, (UChar)unicode) == (int16_t)0xffff))
|
||||
ucmp16_set(ulxfrmArray, (UChar)unicode, (int16_t)otherunicode);
|
||||
@ -178,7 +178,7 @@ getArray(FILE *input)
|
||||
return ulxfrmArray;
|
||||
}
|
||||
|
||||
void
|
||||
void
|
||||
writeArrays()
|
||||
{
|
||||
const int16_t* values = ucmp16_getArray(ulxfrmArray);
|
||||
|
Loading…
Reference in New Issue
Block a user