mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 08:53:20 +00:00
ICU-157 converter data in udata + udata fixes
X-SVN-Rev: 296
This commit is contained in:
parent
57cca2d237
commit
a34482e43f
23 changed files with 712 additions and 319 deletions
icu4c/source
|
@ -40,6 +40,8 @@
|
|||
/* Determines the endianness of the platform */
|
||||
#define U_IS_BIG_ENDIAN @U_IS_BIG_ENDIAN@
|
||||
|
||||
#define HAVE_DLOPEN @HAVE_DLOPEN@
|
||||
|
||||
/*===========================================================================*/
|
||||
/* Platform/Language determination */
|
||||
/*===========================================================================*/
|
||||
|
|
|
@ -1369,7 +1369,7 @@ const char* icu_getDefaultCodepage()
|
|||
icu_strcpy(codepage+2, _itoa(GetACP(), tempString, 10));
|
||||
return codepage;
|
||||
#elif defined(POSIX)
|
||||
return "LATIN_1");
|
||||
return "LATIN_1";
|
||||
#else
|
||||
return "LATIN_1";
|
||||
#endif
|
||||
|
|
|
@ -61,7 +61,7 @@ static CompactShortArray *ulTables;
|
|||
static CompactByteArray *dirTables;
|
||||
|
||||
|
||||
static const uint16_t indicies[] = {
|
||||
static const uint16_t indices[] = {
|
||||
|
||||
(uint16_t)0, (uint16_t)127, (uint16_t)255, (uint16_t)382,
|
||||
(uint16_t)502, (uint16_t)584, (uint16_t)712,
|
||||
|
@ -5185,7 +5185,7 @@ createTables()
|
|||
{
|
||||
CompactByteArray* newTables;
|
||||
if (tables == 0) {
|
||||
newTables = ucmp8_openAdopt((uint16_t*)indicies, (int8_t*)values, offsetCount);
|
||||
newTables = ucmp8_openAlias((uint16_t*)indices, (int8_t*)values, offsetCount);
|
||||
if (newTables != 0) {
|
||||
umtx_lock(NULL);
|
||||
if (tables == 0) {
|
||||
|
@ -5210,7 +5210,7 @@ createUlTables()
|
|||
CompactShortArray* newTables;
|
||||
if (ulTables == 0)
|
||||
{
|
||||
newTables = ucmp16_openAdopt((uint16_t*)caseIndex,
|
||||
newTables = ucmp16_openAlias((uint16_t*)caseIndex,
|
||||
(int16_t*)caseValues,
|
||||
caseCount,
|
||||
0);
|
||||
|
@ -5239,7 +5239,7 @@ createDirTables()
|
|||
CompactByteArray* newTables;
|
||||
if (dirTables == 0)
|
||||
{
|
||||
newTables = ucmp8_openAdopt((uint16_t*)fCharDirIndices,
|
||||
newTables = ucmp8_openAlias((uint16_t*)fCharDirIndices,
|
||||
(int8_t*)fCharDirValues,
|
||||
fCharDirCount);
|
||||
if (newTables != 0) {
|
||||
|
|
|
@ -81,10 +81,12 @@ CompactShortArray* ucmp16_open(int16_t defaultValue)
|
|||
CompactShortArray* this_obj = (CompactShortArray*) icu_malloc(sizeof(CompactShortArray));
|
||||
if (this_obj == NULL) return NULL;
|
||||
|
||||
this_obj->fStructSize = sizeof(CompactShortArray);
|
||||
this_obj->fCount = UCMP16_kUnicodeCount;
|
||||
this_obj->fCompact = FALSE;
|
||||
this_obj->fBogus = FALSE;
|
||||
this_obj->fArray = NULL;
|
||||
this_obj->fAlias = FALSE;
|
||||
this_obj->fIndex = NULL;
|
||||
this_obj->fHashes = NULL;
|
||||
this_obj->fDefaultValue = defaultValue;
|
||||
|
@ -145,12 +147,14 @@ CompactShortArray* ucmp16_openAdopt(uint16_t *indexArray,
|
|||
this_obj->fArray = newValues;
|
||||
this_obj->fIndex = indexArray;
|
||||
this_obj->fCompact = count < UCMP16_kUnicodeCount;
|
||||
this_obj->fStructSize = sizeof(CompactShortArray);
|
||||
this_obj->kBlockShift = UCMP16_kBlockShift;
|
||||
this_obj->kBlockMask = UCMP16_kBlockMask;
|
||||
|
||||
this_obj->fAlias = FALSE;
|
||||
return this_obj;
|
||||
}
|
||||
|
||||
|
||||
CompactShortArray* ucmp16_openAdoptWithBlockShift(uint16_t *indexArray,
|
||||
int16_t *newValues,
|
||||
int32_t count,
|
||||
|
@ -169,12 +173,37 @@ CompactShortArray* ucmp16_openAdoptWithBlockShift(uint16_t *indexArray,
|
|||
return this_obj;
|
||||
}
|
||||
|
||||
|
||||
CompactShortArray* ucmp16_openAlias(uint16_t *indexArray,
|
||||
int16_t *newValues,
|
||||
int32_t count,
|
||||
int16_t defaultValue)
|
||||
{
|
||||
CompactShortArray* this_obj = (CompactShortArray*) icu_malloc(sizeof(CompactShortArray));
|
||||
if (this_obj == NULL) return NULL;
|
||||
this_obj->fHashes = NULL;
|
||||
this_obj->fCount = count;
|
||||
this_obj->fDefaultValue = defaultValue;
|
||||
this_obj->fBogus = FALSE;
|
||||
this_obj->fArray = newValues;
|
||||
this_obj->fIndex = indexArray;
|
||||
this_obj->fCompact = count < UCMP16_kUnicodeCount;
|
||||
this_obj->fStructSize = sizeof(CompactShortArray);
|
||||
this_obj->kBlockShift = UCMP16_kBlockShift;
|
||||
this_obj->kBlockMask = UCMP16_kBlockMask;
|
||||
this_obj->fAlias = TRUE;
|
||||
return this_obj;
|
||||
}
|
||||
|
||||
/*=======================================================*/
|
||||
|
||||
void ucmp16_close(CompactShortArray* this_obj)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
icu_free(this_obj->fIndex);
|
||||
if(this_obj->fAlias == FALSE)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
icu_free(this_obj->fIndex);
|
||||
}
|
||||
icu_free(this_obj->fHashes);
|
||||
icu_free(this_obj);
|
||||
|
||||
|
@ -344,13 +373,13 @@ void ucmp16_compact(CompactShortArray* this_obj)
|
|||
int16_t *result = (int16_t*) icu_malloc(sizeof(int16_t) * newSize);
|
||||
|
||||
icu_memcpy(result, this_obj->fArray, newSize * sizeof(int16_t));
|
||||
|
||||
|
||||
icu_free(this_obj->fArray);
|
||||
this_obj->fArray = result;
|
||||
this_obj->fCount = newSize;
|
||||
icu_free(this_obj->fHashes);
|
||||
this_obj->fHashes = NULL;
|
||||
|
||||
|
||||
this_obj->fCompact = TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -395,3 +424,41 @@ const uint16_t* ucmp16_getIndex(const CompactShortArray* this_obj)
|
|||
}
|
||||
|
||||
|
||||
/* We use sizeof(*array), etc so that this code can be as portable as
|
||||
possible between the ucmpX_ family. Check lines marked 'SIZE'.
|
||||
*/
|
||||
|
||||
U_CAPI CompactShortArray * U_EXPORT2 ucmp16_cloneFromData(const uint8_t **source, UErrorCode *status)
|
||||
{
|
||||
CompactShortArray *array;
|
||||
const CompactShortArray *oldArray;
|
||||
|
||||
if(U_FAILURE(*status))
|
||||
return NULL;
|
||||
|
||||
oldArray= (const CompactShortArray*)*source;
|
||||
|
||||
if(oldArray->fStructSize != sizeof(*oldArray))
|
||||
{
|
||||
*status = U_INVALID_TABLE_FORMAT; /* ? */
|
||||
return NULL;
|
||||
}
|
||||
array = (CompactShortArray*)malloc(sizeof(*array));
|
||||
|
||||
icu_memcpy(array,*source, sizeof(*array));
|
||||
|
||||
*source += array->fStructSize;
|
||||
|
||||
array->fArray = (int16_t*)*source; /* SIZE */
|
||||
*source += (sizeof(int16_t)*array->fCount); /* SIZE */
|
||||
|
||||
array->fIndex = (uint16_t*)*source;
|
||||
*source += (sizeof(uint16_t)*UCMP16_kIndexCount); /* SIZE*/
|
||||
|
||||
array->fAlias = TRUE;
|
||||
|
||||
return array;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -76,11 +76,12 @@
|
|||
* @see CompactIntArray
|
||||
* @see CompactCharArray
|
||||
* @see CompactStringArray
|
||||
* @version $Revision: 1.3 $ 8/25/98
|
||||
* @version $Revision: 1.4 $ 8/25/98
|
||||
* @author Helena Shih
|
||||
*/
|
||||
|
||||
typedef struct CompactShortArray {
|
||||
int32_t fStructSize;
|
||||
int16_t* fArray;
|
||||
uint16_t* fIndex;
|
||||
int32_t* fHashes;
|
||||
|
@ -88,6 +89,7 @@ typedef struct CompactShortArray {
|
|||
int16_t fDefaultValue;
|
||||
bool_t fCompact;
|
||||
bool_t fBogus;
|
||||
bool_t fAlias;
|
||||
int32_t kBlockShift;
|
||||
int32_t kBlockMask;
|
||||
} CompactShortArray;
|
||||
|
@ -126,6 +128,11 @@ U_CAPI CompactShortArray* U_EXPORT2 ucmp16_openAdoptWithBlockShift(uint16_t *in
|
|||
int32_t blockShift);
|
||||
|
||||
|
||||
U_CAPI CompactShortArray* U_EXPORT2 ucmp16_openAlias(uint16_t *indexArray,
|
||||
int16_t *newValues,
|
||||
int32_t count,
|
||||
int16_t defaultValue );
|
||||
|
||||
U_CAPI void U_EXPORT2 ucmp16_close(CompactShortArray* array);
|
||||
/**
|
||||
* Returns TRUE if the creation of the compact array fails.
|
||||
|
@ -205,6 +212,8 @@ U_CAPI const int16_t* U_EXPORT2 ucmp16_getArray(const CompactShortArray* array)
|
|||
U_CAPI const uint16_t* U_EXPORT2 ucmp16_getIndex(const CompactShortArray* array);
|
||||
|
||||
|
||||
/** INTERNAL USE ONLY **/
|
||||
U_CAPI CompactShortArray * U_EXPORT2 ucmp16_cloneFromData(const uint8_t **source, UErrorCode *status);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -59,11 +59,13 @@ CompactByteArray* ucmp8_open(int8_t defaultValue)
|
|||
|
||||
if (this_obj == NULL) return NULL;
|
||||
|
||||
this_obj->fStructSize = sizeof(CompactByteArray);
|
||||
this_obj->fArray = NULL;
|
||||
this_obj->fIndex = NULL;
|
||||
this_obj->fCount = UCMP8_kUnicodeCount;
|
||||
this_obj->fCompact = FALSE;
|
||||
this_obj->fBogus = FALSE;
|
||||
this_obj->fAlias = FALSE;
|
||||
|
||||
|
||||
this_obj->fArray = (int8_t*) icu_malloc(sizeof(int8_t) * UCMP8_kUnicodeCount);
|
||||
|
@ -103,11 +105,32 @@ CompactByteArray* ucmp8_openAdopt(uint16_t *indexArray,
|
|||
this_obj->fIndex = NULL;
|
||||
this_obj->fCount = count;
|
||||
this_obj->fBogus = FALSE;
|
||||
this_obj->fStructSize = sizeof(CompactByteArray);
|
||||
|
||||
this_obj->fArray = newValues;
|
||||
this_obj->fIndex = indexArray;
|
||||
this_obj->fCompact = (count < UCMP8_kUnicodeCount) ? TRUE : FALSE;
|
||||
this_obj->fAlias = FALSE;
|
||||
return this_obj;
|
||||
}
|
||||
|
||||
CompactByteArray* ucmp8_openAlias(uint16_t *indexArray,
|
||||
int8_t *newValues,
|
||||
int32_t count)
|
||||
{
|
||||
CompactByteArray* this_obj = (CompactByteArray*) icu_malloc(sizeof(CompactByteArray));
|
||||
if (!this_obj) return NULL;
|
||||
|
||||
this_obj->fArray = NULL;
|
||||
this_obj->fIndex = NULL;
|
||||
this_obj->fCount = count;
|
||||
this_obj->fBogus = FALSE;
|
||||
this_obj->fStructSize = sizeof(CompactByteArray);
|
||||
|
||||
this_obj->fArray = newValues;
|
||||
this_obj->fIndex = indexArray;
|
||||
this_obj->fCompact = (count < UCMP8_kUnicodeCount) ? TRUE : FALSE;
|
||||
this_obj->fAlias = TRUE;
|
||||
return this_obj;
|
||||
}
|
||||
|
||||
|
@ -115,12 +138,17 @@ CompactByteArray* ucmp8_openAdopt(uint16_t *indexArray,
|
|||
|
||||
void ucmp8_close(CompactByteArray* this_obj)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
if(this_obj->fAlias == FALSE)
|
||||
{
|
||||
icu_free(this_obj->fArray);
|
||||
icu_free(this_obj->fIndex);
|
||||
}
|
||||
|
||||
this_obj->fArray = NULL;
|
||||
icu_free(this_obj->fIndex);
|
||||
this_obj->fIndex = NULL;
|
||||
this_obj->fCount = 0;
|
||||
this_obj->fCompact = FALSE;
|
||||
this_obj->fAlias = TRUE;
|
||||
icu_free(this_obj);
|
||||
}
|
||||
|
||||
|
@ -142,27 +170,28 @@ void ucmp8_expand(CompactByteArray* this_obj)
|
|||
* INDEX 0 4 8 12 16 ...
|
||||
* ARRAY abcdeababcedzyabcdea...
|
||||
*/
|
||||
int32_t i;
|
||||
if (this_obj->fCompact)
|
||||
int32_t i;
|
||||
if (this_obj->fCompact)
|
||||
{
|
||||
int8_t* tempArray;
|
||||
tempArray = (int8_t*) icu_malloc(sizeof(int8_t) * UCMP8_kUnicodeCount);
|
||||
if (!tempArray)
|
||||
{
|
||||
this_obj->fBogus = TRUE;
|
||||
return;
|
||||
}
|
||||
{
|
||||
this_obj->fBogus = TRUE;
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < UCMP8_kUnicodeCount; ++i)
|
||||
{
|
||||
tempArray[i] = ucmp8_get(this_obj,(UChar)i); /* HSYS : How expand?*/
|
||||
}
|
||||
{
|
||||
tempArray[i] = ucmp8_get(this_obj,(UChar)i); /* HSYS : How expand?*/
|
||||
}
|
||||
for (i = 0; i < UCMP8_kIndexCount; ++i)
|
||||
{
|
||||
this_obj->fIndex[i] = (uint16_t)(i<< UCMP8_kBlockShift);
|
||||
}
|
||||
{
|
||||
this_obj->fIndex[i] = (uint16_t)(i<< UCMP8_kBlockShift);
|
||||
}
|
||||
icu_free(this_obj->fArray);
|
||||
this_obj->fArray = tempArray;
|
||||
this_obj->fCompact = FALSE;
|
||||
this_obj->fAlias = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -358,3 +387,47 @@ ucmp8_compact(CompactByteArray* this_obj,
|
|||
} /* endif (!this_obj->fCompact)*/
|
||||
}
|
||||
|
||||
/* We use sizeof(*array), etc so that this code can be as portable as
|
||||
possible between the ucmpX_ family.
|
||||
*/
|
||||
|
||||
U_CAPI CompactByteArray * U_EXPORT2 ucmp8_cloneFromData(const uint8_t **source, UErrorCode *status)
|
||||
{
|
||||
CompactByteArray *array;
|
||||
const CompactByteArray *oldArray;
|
||||
|
||||
if(U_FAILURE(*status))
|
||||
return NULL;
|
||||
|
||||
oldArray= (const CompactByteArray*)*source;
|
||||
|
||||
if(oldArray->fStructSize != sizeof(*oldArray))
|
||||
{
|
||||
*status = U_INVALID_TABLE_FORMAT; /* ? */
|
||||
return NULL;
|
||||
}
|
||||
array = (CompactByteArray*)malloc(sizeof(*array));
|
||||
|
||||
icu_memcpy(array,*source, sizeof(*array));
|
||||
|
||||
array->fAlias = TRUE;
|
||||
|
||||
*source += array->fStructSize;
|
||||
|
||||
array->fArray = (const int8_t*)*source;
|
||||
*source += (sizeof(int8_t)*array->fCount);
|
||||
|
||||
array->fIndex = (const uint16_t*)*source;
|
||||
*source += (sizeof(uint16_t)*UCMP8_kIndexCount);
|
||||
|
||||
return array;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -26,11 +26,13 @@ U_CAPI int32_t U_EXPORT2 ucmp8_getkUnicodeCount(void);
|
|||
U_CAPI int32_t U_EXPORT2 ucmp8_getkBlockCount(void);
|
||||
|
||||
typedef struct CompactByteArray {
|
||||
uint32_t fStructSize;
|
||||
int8_t* fArray;
|
||||
uint16_t* fIndex;
|
||||
int32_t fCount;
|
||||
bool_t fCompact;
|
||||
bool_t fCompact;
|
||||
bool_t fBogus;
|
||||
bool_t fAlias;
|
||||
} CompactByteArray;
|
||||
|
||||
#define UCMP8_kUnicodeCount 65536
|
||||
|
@ -79,7 +81,8 @@ U_CAPI void U_EXPORT2 ucmp8_compact(CompactByteArray* array,
|
|||
/* Expanded takes the array back to a 65536 element array*/
|
||||
U_CAPI void U_EXPORT2 ucmp8_expand(CompactByteArray* array);
|
||||
|
||||
|
||||
/** INTERNAL USE ONLY **/
|
||||
U_CAPI CompactByteArray * U_EXPORT2 ucmp8_cloneFromData(const uint8_t **source, UErrorCode *status);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
/*
|
||||
********************************************************************************
|
||||
* *
|
||||
* COPYRIGHT: *
|
||||
* (C) Copyright International Business Machines Corporation, 1998 *
|
||||
* Licensed Material - Program-Property of IBM - All Rights Reserved. *
|
||||
* US Government Users Restricted Rights - Use, duplication, or disclosure *
|
||||
* restricted by GSA ADP Schedule Contract with IBM Corp. *
|
||||
* *
|
||||
********************************************************************************
|
||||
*
|
||||
********************************************************************
|
||||
* COPYRIGHT:
|
||||
* Copyright (c) 1996-1999, International Business Machines Corporation and
|
||||
* others. All Rights Reserved.
|
||||
********************************************************************
|
||||
*
|
||||
* uconv_bld.c:
|
||||
*
|
||||
|
@ -26,12 +21,15 @@
|
|||
#include "ucnv_bld.h"
|
||||
#include "ucnv_err.h"
|
||||
#include "ucnv_imp.h"
|
||||
#include "udata.h"
|
||||
#include "ucnv.h"
|
||||
#include "umutex.h"
|
||||
#include "cstring.h"
|
||||
#include "cmemory.h"
|
||||
#include "filestrm.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
/*Array used to generate ALGORITHMIC_CONVERTERS_HASHTABLE
|
||||
*should ALWAYS BE EMPTY STRING TERMINATED.
|
||||
*/
|
||||
|
@ -86,6 +84,11 @@ static void initializeAlgorithmicConverter (UConverter * myConverter);
|
|||
|
||||
static int32_t uhash_hashSharedData (void *sharedData);
|
||||
|
||||
/**
|
||||
* Un flatten shared data from a UDATA..
|
||||
*/
|
||||
U_CAPI UConverterSharedData* U_EXPORT2 ucnv_data_unFlattenClone(const UConverterSharedData *data, UErrorCode *status);
|
||||
|
||||
|
||||
/*initializes some global variables */
|
||||
UHashtable *SHARED_DATA_HASHTABLE = NULL;
|
||||
|
@ -263,6 +266,25 @@ CompactByteArray* createCompactByteArrayFromFile (FileStream * infile,
|
|||
return ucmp8_openAdopt (myIndexArray, myByteArray, myValuesCount);
|
||||
}
|
||||
|
||||
|
||||
static bool_t
|
||||
isCnvAcceptable(void *context,
|
||||
const char *type, const char *name,
|
||||
UDataInfo *pInfo) {
|
||||
return
|
||||
pInfo->size>=20 &&
|
||||
pInfo->isBigEndian==U_IS_BIG_ENDIAN &&
|
||||
pInfo->charsetFamily==U_CHARSET_FAMILY &&
|
||||
pInfo->sizeofUChar==U_SIZEOF_UCHAR &&
|
||||
pInfo->dataFormat[0]==0x63 && /* dataFormat="cnvt" */
|
||||
pInfo->dataFormat[1]==0x6e &&
|
||||
pInfo->dataFormat[2]==0x76 &&
|
||||
pInfo->dataFormat[3]==0x74 &&
|
||||
pInfo->formatVersion[0]==1;
|
||||
}
|
||||
|
||||
#define DATA_TYPE "cnv"
|
||||
|
||||
UConverter* createConverterFromFile (const char *fileName, UErrorCode * err)
|
||||
{
|
||||
int32_t i = 0;
|
||||
|
@ -272,134 +294,60 @@ UConverter* createConverterFromFile (const char *fileName, UErrorCode * err)
|
|||
int32_t myIndexCount = 0;
|
||||
UConverter *myConverter = NULL;
|
||||
int32_t myCheck;
|
||||
FileStream *infile = NULL;
|
||||
int8_t errorLevel = 0;
|
||||
char throwAway[UCNV_COPYRIGHT_STRING_LENGTH];
|
||||
char actualFullFilenameName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
|
||||
|
||||
UDataMemory *data;
|
||||
|
||||
if (err == NULL || U_FAILURE (*err)) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
icu_strcpy (actualFullFilenameName, u_getDataDirectory ());
|
||||
icu_strcat (actualFullFilenameName, fileName);
|
||||
icu_strcat (actualFullFilenameName, CONVERTER_FILE_EXTENSION);
|
||||
|
||||
infile = T_FileStream_open (actualFullFilenameName, "rb");
|
||||
if (infile == NULL)
|
||||
{
|
||||
*err = U_FILE_ACCESS_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*Reads the UCNV_FILE_CHECK_MARKER to assess the integrity of the file */
|
||||
T_FileStream_read (infile, &myCheck, sizeof (int32_t));
|
||||
if (myCheck != UCNV_FILE_CHECK_MARKER)
|
||||
{
|
||||
T_FileStream_close (infile);
|
||||
*err = U_INVALID_TABLE_FILE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*Skips the copyright*/
|
||||
T_FileStream_read(infile , throwAway, UCNV_COPYRIGHT_STRING_LENGTH);
|
||||
|
||||
|
||||
data = udata_openChoice(NULL, DATA_TYPE, fileName, isCnvAcceptable, NULL, err);
|
||||
if(U_FAILURE(*err))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
myConverter = (UConverter *) icu_malloc (sizeof (UConverter));
|
||||
if (myConverter == NULL)
|
||||
{
|
||||
T_FileStream_close (infile);
|
||||
udata_close(data);
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
myConverter->sharedData =
|
||||
(UConverterSharedData *) icu_malloc (sizeof (UConverterSharedData));
|
||||
(UConverterSharedData *) udata_getMemory(data);
|
||||
|
||||
if (myConverter->sharedData == NULL)
|
||||
{
|
||||
T_FileStream_close (infile);
|
||||
udata_close(data);
|
||||
icu_free (myConverter);
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*Reads in the UConverterSharedData object straight from file */
|
||||
T_FileStream_read (infile, myConverter->sharedData, sizeof (UConverterSharedData));
|
||||
/* clone it. OK to drop the original sharedData */
|
||||
myConverter->sharedData = ucnv_data_unFlattenClone(myConverter->sharedData, err);
|
||||
|
||||
/*switches over the types of conversions
|
||||
*allocates appropriate amounts of memory for the table
|
||||
*and calls functions to read in the CompactArrays
|
||||
*/
|
||||
switch (myConverter->sharedData->conversionType)
|
||||
myConverter->sharedData->dataMemory = (void*)data; /* for future use */
|
||||
|
||||
|
||||
if(U_FAILURE(*err))
|
||||
{
|
||||
case UCNV_SBCS:
|
||||
{
|
||||
myConverter->sharedData->table = (UConverterTable *) icu_malloc (sizeof (UConverterSBCSTable));
|
||||
if (myConverter->sharedData->table == NULL)
|
||||
{
|
||||
icu_free (myConverter->sharedData);
|
||||
icu_free (myConverter);
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
break;
|
||||
}
|
||||
T_FileStream_read (infile, myConverter->sharedData->table->sbcs.toUnicode, 256 * sizeof (UChar));
|
||||
myConverter->sharedData->table->sbcs.fromUnicode = createCompactByteArrayFromFile (infile, err);
|
||||
}
|
||||
break;
|
||||
udata_close(data);
|
||||
icu_free (myConverter);
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
case UCNV_DBCS:
|
||||
case UCNV_EBCDIC_STATEFUL:
|
||||
{
|
||||
myConverter->sharedData->table = (UConverterTable *) icu_malloc (sizeof (UConverterDBCSTable));
|
||||
if (myConverter->sharedData->table == NULL)
|
||||
{
|
||||
icu_free (myConverter->sharedData);
|
||||
icu_free (myConverter);
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
break;
|
||||
}
|
||||
myConverter->sharedData->table->dbcs.toUnicode = createCompactShortArrayFromFile (infile, err);
|
||||
myConverter->sharedData->table->dbcs.fromUnicode = createCompactShortArrayFromFile (infile, err);
|
||||
}
|
||||
break;
|
||||
|
||||
case UCNV_MBCS:
|
||||
{
|
||||
myConverter->sharedData->table = (UConverterTable *) icu_malloc (sizeof (UConverterMBCSTable));
|
||||
if (myConverter->sharedData->table == NULL)
|
||||
{
|
||||
icu_free (myConverter->sharedData);
|
||||
icu_free (myConverter);
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
break;
|
||||
}
|
||||
T_FileStream_read (infile, myConverter->sharedData->table->mbcs.starters, 256 * sizeof (bool_t));
|
||||
myConverter->sharedData->table->mbcs.toUnicode = createCompactShortArrayFromFile (infile, err);
|
||||
myConverter->sharedData->table->mbcs.fromUnicode = createCompactShortArrayFromFile (infile, err);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/*If it isn't any of the above, the file is invalid */
|
||||
*err = U_INVALID_TABLE_FILE;
|
||||
icu_free (myConverter->sharedData);
|
||||
icu_free (myConverter);
|
||||
}
|
||||
};
|
||||
|
||||
/*there could be a U_FAILURE on the createCompact{Short,Byte}ArrayFromFile
|
||||
*calls, if so we don't want to initialize
|
||||
*/
|
||||
|
||||
T_FileStream_close (infile);
|
||||
if (U_SUCCESS (*err))
|
||||
{
|
||||
initializeDataConverter (myConverter);
|
||||
}
|
||||
|
||||
return myConverter;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -538,44 +486,56 @@ UConverterSharedData *getSharedConverterData (const char *name)
|
|||
*/
|
||||
bool_t deleteSharedConverterData (UConverterSharedData * deadSharedData)
|
||||
{
|
||||
if (deadSharedData->referenceCounter > 0)
|
||||
return FALSE;
|
||||
|
||||
switch (deadSharedData->conversionType)
|
||||
if (deadSharedData->referenceCounter > 0)
|
||||
return FALSE;
|
||||
|
||||
/* Note: if we have a dataMemory, then that means that all ucmp's came
|
||||
from udata, and their tables will go away at the end
|
||||
of this function. So, we need to simply dealloc the UCMP8's themselves.
|
||||
We're guaranteed that they do not allocate any further memory.
|
||||
|
||||
When we have an API to simply 'init' a ucmp8, then no action at all will
|
||||
need to happen. --srl
|
||||
*/
|
||||
|
||||
switch (deadSharedData->conversionType)
|
||||
{
|
||||
|
||||
case UCNV_SBCS:
|
||||
{
|
||||
{
|
||||
ucmp8_close (deadSharedData->table->sbcs.fromUnicode);
|
||||
icu_free (deadSharedData->table);
|
||||
icu_free (deadSharedData);
|
||||
};
|
||||
break;
|
||||
|
||||
};
|
||||
break;
|
||||
|
||||
case UCNV_MBCS:
|
||||
{
|
||||
{
|
||||
ucmp16_close (deadSharedData->table->mbcs.fromUnicode);
|
||||
ucmp16_close (deadSharedData->table->mbcs.toUnicode);
|
||||
icu_free (deadSharedData->table);
|
||||
icu_free (deadSharedData);
|
||||
};
|
||||
break;
|
||||
icu_free (deadSharedData->table);
|
||||
};
|
||||
break;
|
||||
|
||||
case UCNV_DBCS:
|
||||
case UCNV_EBCDIC_STATEFUL:
|
||||
{
|
||||
{
|
||||
ucmp16_close (deadSharedData->table->dbcs.fromUnicode);
|
||||
ucmp16_close (deadSharedData->table->dbcs.toUnicode);
|
||||
icu_free (deadSharedData->table);
|
||||
icu_free (deadSharedData);
|
||||
};
|
||||
break;
|
||||
icu_free (deadSharedData->table);
|
||||
};
|
||||
break;
|
||||
|
||||
default:
|
||||
icu_free (deadSharedData);
|
||||
};
|
||||
|
||||
return TRUE;
|
||||
if(deadSharedData->dataMemory != NULL)
|
||||
{
|
||||
UDataMemory *data = (UDataMemory*)deadSharedData->dataMemory;
|
||||
udata_close(data);
|
||||
}
|
||||
|
||||
icu_free (deadSharedData);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool_t isDataBasedConverter (const char *name)
|
||||
|
@ -983,7 +943,9 @@ UConverter *
|
|||
icu_free (myConverter);
|
||||
return NULL;
|
||||
}
|
||||
mySharedData->structSize = sizeof(UConverterSharedData);
|
||||
mySharedData->table = NULL;
|
||||
mySharedData->dataMemory = NULL;
|
||||
icu_strcpy (mySharedData->name, actualName);
|
||||
/*Initializes the referenceCounter to 1 */
|
||||
mySharedData->referenceCounter = 1;
|
||||
|
@ -995,3 +957,72 @@ UConverter *
|
|||
initializeAlgorithmicConverter (myConverter);
|
||||
return myConverter;
|
||||
}
|
||||
|
||||
|
||||
UConverterSharedData* ucnv_data_unFlattenClone(const UConverterSharedData *source, UErrorCode *status)
|
||||
{
|
||||
const uint8_t *raw;
|
||||
UConverterSharedData *data = NULL;
|
||||
|
||||
if(U_FAILURE(*status))
|
||||
return NULL;
|
||||
|
||||
if(source->structSize != sizeof(UConverterSharedData))
|
||||
{
|
||||
*status = U_INVALID_TABLE_FORMAT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = (UConverterSharedData*) malloc(sizeof(UConverterSharedData));
|
||||
raw = (uint8_t*)source;
|
||||
icu_memcpy(data,source,sizeof(UConverterSharedData));
|
||||
|
||||
raw += data->structSize;
|
||||
|
||||
/* data->table = (UConverterTable*)raw; */
|
||||
|
||||
switch (data->conversionType)
|
||||
{
|
||||
case UCNV_SBCS:
|
||||
data->table = malloc(sizeof(UConverterSBCSTable));
|
||||
data->table->sbcs.toUnicode = (UChar*)raw;
|
||||
raw += sizeof(UChar)*256;
|
||||
|
||||
data->table->sbcs.fromUnicode = ucmp8_cloneFromData(&raw, status);
|
||||
|
||||
break;
|
||||
|
||||
case UCNV_EBCDIC_STATEFUL:
|
||||
case UCNV_DBCS:
|
||||
data->table = icu_malloc(sizeof(UConverterDBCSTable));
|
||||
data->table->dbcs.
|
||||
toUnicode=ucmp16_cloneFromData(&raw, status);
|
||||
data->table->dbcs.fromUnicode =ucmp16_cloneFromData(&raw, status);
|
||||
|
||||
break;
|
||||
|
||||
case UCNV_MBCS:
|
||||
data->table = icu_malloc(sizeof(UConverterMBCSTable));
|
||||
|
||||
data->table->mbcs.starters = (bool_t*)raw;
|
||||
raw += sizeof(bool_t)*256;
|
||||
|
||||
data->table->mbcs.toUnicode = ucmp16_cloneFromData(&raw, status);
|
||||
data->table->mbcs.fromUnicode = ucmp16_cloneFromData(&raw, status);
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
*status = U_INVALID_TABLE_FORMAT;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ typedef enum {
|
|||
/*Table Node Definitions */
|
||||
typedef struct
|
||||
{
|
||||
UChar toUnicode[256];
|
||||
UChar *toUnicode; /* [256]; */
|
||||
CompactByteArray *fromUnicode;
|
||||
}
|
||||
UConverterSBCSTable;
|
||||
|
@ -100,7 +100,7 @@ UConverterDBCSTable;
|
|||
|
||||
typedef struct
|
||||
{
|
||||
bool_t starters[256];
|
||||
bool_t *starters; /* [256]; */
|
||||
CompactShortArray *toUnicode;
|
||||
CompactShortArray *fromUnicode;
|
||||
}
|
||||
|
@ -120,6 +120,8 @@ UConverterTable;
|
|||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint32_t structSize; /* Size of this structure */
|
||||
void *dataMemory;
|
||||
uint32_t referenceCounter; /*used to count number of clients */
|
||||
char name[UCNV_MAX_CONVERTER_NAME_LENGTH]; /*internal name of the converter */
|
||||
UConverterPlatform platform; /*platform of the converter (only IBM now) */
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#include "filestrm.h"
|
||||
#include "udata.h"
|
||||
|
||||
#if !defined(HAVE_DLOPEN)
|
||||
# define HAVE_DLOPEN 0
|
||||
#endif
|
||||
|
||||
#if !defined(UDATA_DLL) && !defined(UDATA_MAP)
|
||||
# define UDATA_DLL
|
||||
#endif
|
||||
|
@ -225,7 +229,7 @@ typedef struct {
|
|||
#endif
|
||||
|
||||
/* add more to this list as more platform's dll support is written */
|
||||
# if defined(UDATA_DLL) && (defined(LINUX)||defined(SOLARIS)) /* POSIX dll implementation ----------------------- */
|
||||
# if defined(UDATA_DLL) && (HAVE_DLOPEN)
|
||||
|
||||
struct UDataMemory {
|
||||
void *lib;
|
||||
|
@ -255,10 +259,17 @@ getChoice(Library lib, const char *entry,
|
|||
|
||||
#define NO_LIBRARY NULL
|
||||
#define IS_LIBRARY(lib) ((lib)!=NULL)
|
||||
#define LOAD_LIBRARY(path, basename, isCommon) dlopen(path, RTLD_LAZY|RTLD_GLOBAL)
|
||||
#define LOAD_LIBRARY(path, basename, isCommon) dlopen(path, RTLD_LAZY|RTLD_GLOBAL);
|
||||
#define UNLOAD_LIBRARY(lib) dlclose(lib)
|
||||
|
||||
# else /* POSIX memory map implementation --------------------------------- */
|
||||
#ifdef UDATA_DLL
|
||||
#undef UDATA_DLL
|
||||
#endif
|
||||
|
||||
#ifndef UDATA_MAP
|
||||
#define UDATA_MAP
|
||||
#endif
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
|
|
103
icu4c/source/configure
vendored
103
icu4c/source/configure
vendored
|
@ -1342,9 +1342,13 @@ fi
|
|||
|
||||
fi
|
||||
|
||||
#only LINUX for now
|
||||
# check for dlopen()
|
||||
|
||||
HAVE_DLOPEN=0
|
||||
|
||||
#add more libs here..
|
||||
echo $ac_n "checking for dlopen in -ldl""... $ac_c" 1>&6
|
||||
echo "configure:1348: checking for dlopen in -ldl" >&5
|
||||
echo "configure:1352: checking for dlopen in -ldl" >&5
|
||||
ac_lib_var=`echo dl'_'dlopen | sed 'y%./+-%__p_%'`
|
||||
if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
|
@ -1352,7 +1356,7 @@ else
|
|||
ac_save_LIBS="$LIBS"
|
||||
LIBS="-ldl $LIBS"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1356 "configure"
|
||||
#line 1360 "configure"
|
||||
#include "confdefs.h"
|
||||
/* Override any gcc2 internal prototype to avoid an error. */
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
|
@ -1363,7 +1367,7 @@ int main() {
|
|||
dlopen()
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
if { (eval echo configure:1371: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
|
||||
rm -rf conftest*
|
||||
eval "ac_cv_lib_$ac_lib_var=yes"
|
||||
else
|
||||
|
@ -1391,8 +1395,14 @@ else
|
|||
fi
|
||||
|
||||
|
||||
if test $ac_cv_lib_dl_dlopen = yes; then
|
||||
HAVE_DLOPEN=1
|
||||
fi
|
||||
|
||||
|
||||
|
||||
echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
|
||||
echo "configure:1396: checking how to run the C preprocessor" >&5
|
||||
echo "configure:1406: checking how to run the C preprocessor" >&5
|
||||
# On Suns, sometimes $CPP names a directory.
|
||||
if test -n "$CPP" && test -d "$CPP"; then
|
||||
CPP=
|
||||
|
@ -1407,13 +1417,13 @@ else
|
|||
# On the NeXT, cc -E runs the code through the compiler's parser,
|
||||
# not just through cpp.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1411 "configure"
|
||||
#line 1421 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1417: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1427: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
|
@ -1424,13 +1434,13 @@ else
|
|||
rm -rf conftest*
|
||||
CPP="${CC-cc} -E -traditional-cpp"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1428 "configure"
|
||||
#line 1438 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1434: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1444: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
|
@ -1441,13 +1451,13 @@ else
|
|||
rm -rf conftest*
|
||||
CPP="${CC-cc} -nologo -E"
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1445 "configure"
|
||||
#line 1455 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <assert.h>
|
||||
Syntax Error
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1451: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1461: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
:
|
||||
|
@ -1475,17 +1485,17 @@ for ac_hdr in inttypes.h
|
|||
do
|
||||
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
|
||||
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
|
||||
echo "configure:1479: checking for $ac_hdr" >&5
|
||||
echo "configure:1489: checking for $ac_hdr" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1484 "configure"
|
||||
#line 1494 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <$ac_hdr>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1489: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1499: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
@ -1519,14 +1529,14 @@ fi
|
|||
|
||||
|
||||
echo $ac_n "checking whether byte ordering is bigendian""... $ac_c" 1>&6
|
||||
echo "configure:1523: checking whether byte ordering is bigendian" >&5
|
||||
echo "configure:1533: checking whether byte ordering is bigendian" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_c_bigendian'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
ac_cv_c_bigendian=unknown
|
||||
# See if sys/param.h defines the BYTE_ORDER macro.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1530 "configure"
|
||||
#line 1540 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -1537,11 +1547,11 @@ int main() {
|
|||
#endif
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1541: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1551: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
# It does; now see whether it defined to BIG_ENDIAN or not.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1545 "configure"
|
||||
#line 1555 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
|
@ -1552,7 +1562,7 @@ int main() {
|
|||
#endif
|
||||
; return 0; }
|
||||
EOF
|
||||
if { (eval echo configure:1556: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
if { (eval echo configure:1566: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
|
||||
rm -rf conftest*
|
||||
ac_cv_c_bigendian=yes
|
||||
else
|
||||
|
@ -1572,7 +1582,7 @@ if test "$cross_compiling" = yes; then
|
|||
{ echo "configure: error: can not run test program while cross compiling" 1>&2; exit 1; }
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1576 "configure"
|
||||
#line 1586 "configure"
|
||||
#include "confdefs.h"
|
||||
main () {
|
||||
/* Are we little or big endian? From Harbison&Steele. */
|
||||
|
@ -1585,7 +1595,7 @@ main () {
|
|||
exit (u.c[sizeof (long) - 1] == 1);
|
||||
}
|
||||
EOF
|
||||
if { (eval echo configure:1589: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:1599: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
ac_cv_c_bigendian=no
|
||||
else
|
||||
|
@ -1617,12 +1627,12 @@ fi
|
|||
|
||||
|
||||
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
|
||||
echo "configure:1621: checking for ANSI C header files" >&5
|
||||
echo "configure:1631: checking for ANSI C header files" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1626 "configure"
|
||||
#line 1636 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
|
@ -1630,7 +1640,7 @@ else
|
|||
#include <float.h>
|
||||
EOF
|
||||
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
|
||||
{ (eval echo configure:1634: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
{ (eval echo configure:1644: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
|
||||
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
|
||||
if test -z "$ac_err"; then
|
||||
rm -rf conftest*
|
||||
|
@ -1647,7 +1657,7 @@ rm -f conftest*
|
|||
if test $ac_cv_header_stdc = yes; then
|
||||
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1651 "configure"
|
||||
#line 1661 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <string.h>
|
||||
EOF
|
||||
|
@ -1665,7 +1675,7 @@ fi
|
|||
if test $ac_cv_header_stdc = yes; then
|
||||
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1669 "configure"
|
||||
#line 1679 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <stdlib.h>
|
||||
EOF
|
||||
|
@ -1686,7 +1696,7 @@ if test "$cross_compiling" = yes; then
|
|||
:
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1690 "configure"
|
||||
#line 1700 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <ctype.h>
|
||||
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
|
||||
|
@ -1697,7 +1707,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
|
|||
exit (0); }
|
||||
|
||||
EOF
|
||||
if { (eval echo configure:1701: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
if { (eval echo configure:1711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
|
||||
then
|
||||
:
|
||||
else
|
||||
|
@ -1721,12 +1731,12 @@ EOF
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for int8_t""... $ac_c" 1>&6
|
||||
echo "configure:1725: checking for int8_t" >&5
|
||||
echo "configure:1735: checking for int8_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_int8_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1730 "configure"
|
||||
#line 1740 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
|
@ -1754,12 +1764,12 @@ EOF
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for uint8_t""... $ac_c" 1>&6
|
||||
echo "configure:1758: checking for uint8_t" >&5
|
||||
echo "configure:1768: checking for uint8_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_uint8_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1763 "configure"
|
||||
#line 1773 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
|
@ -1787,12 +1797,12 @@ EOF
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for int16_t""... $ac_c" 1>&6
|
||||
echo "configure:1791: checking for int16_t" >&5
|
||||
echo "configure:1801: checking for int16_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_int16_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1796 "configure"
|
||||
#line 1806 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
|
@ -1820,12 +1830,12 @@ EOF
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for uint16_t""... $ac_c" 1>&6
|
||||
echo "configure:1824: checking for uint16_t" >&5
|
||||
echo "configure:1834: checking for uint16_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_uint16_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1829 "configure"
|
||||
#line 1839 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
|
@ -1853,12 +1863,12 @@ EOF
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for int32_t""... $ac_c" 1>&6
|
||||
echo "configure:1857: checking for int32_t" >&5
|
||||
echo "configure:1867: checking for int32_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_int32_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1862 "configure"
|
||||
#line 1872 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
|
@ -1886,12 +1896,12 @@ EOF
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for uint32_t""... $ac_c" 1>&6
|
||||
echo "configure:1890: checking for uint32_t" >&5
|
||||
echo "configure:1900: checking for uint32_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_uint32_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1895 "configure"
|
||||
#line 1905 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
|
@ -1919,12 +1929,12 @@ EOF
|
|||
fi
|
||||
|
||||
echo $ac_n "checking for bool_t""... $ac_c" 1>&6
|
||||
echo "configure:1923: checking for bool_t" >&5
|
||||
echo "configure:1933: checking for bool_t" >&5
|
||||
if eval "test \"`echo '$''{'ac_cv_type_bool_t'+set}'`\" = set"; then
|
||||
echo $ac_n "(cached) $ac_c" 1>&6
|
||||
else
|
||||
cat > conftest.$ac_ext <<EOF
|
||||
#line 1928 "configure"
|
||||
#line 1938 "configure"
|
||||
#include "confdefs.h"
|
||||
#include <sys/types.h>
|
||||
#if STDC_HEADERS
|
||||
|
@ -2037,7 +2047,8 @@ fi
|
|||
|
||||
|
||||
|
||||
if test "$mapped" = true; then
|
||||
|
||||
if test "$mapped" = true -o "$HAVE_DLOPEN" = 0; then
|
||||
USE_MAPPED_TRUE=
|
||||
USE_MAPPED_FALSE='#'
|
||||
else
|
||||
|
@ -2045,6 +2056,7 @@ else
|
|||
USE_MAPPED_FALSE=
|
||||
fi
|
||||
|
||||
|
||||
# Check whether --enable-tests or --disable-tests was given.
|
||||
if test "${enable_tests+set}" = set; then
|
||||
enableval="$enable_tests"
|
||||
|
@ -2230,7 +2242,7 @@ trap 'rm -fr `echo "Makefile \
|
|||
extra/Makefile extra/ustdio/Makefile \
|
||||
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
|
||||
tools/genrb/Makefile tools/gencol/Makefile \
|
||||
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile \
|
||||
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/gentz/Makefile \
|
||||
tools/gennames/Makefile tools/toolutil/Makefile \
|
||||
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
|
||||
test/ieeetest/Makefile \
|
||||
|
@ -2283,6 +2295,7 @@ s%@host_cpu@%$host_cpu%g
|
|||
s%@host_vendor@%$host_vendor%g
|
||||
s%@host_os@%$host_os%g
|
||||
s%@LIB_M@%$LIB_M%g
|
||||
s%@HAVE_DLOPEN@%$HAVE_DLOPEN%g
|
||||
s%@CPP@%$CPP%g
|
||||
s%@HAVE_INTTYPES_H@%$HAVE_INTTYPES_H%g
|
||||
s%@U_IS_BIG_ENDIAN@%$U_IS_BIG_ENDIAN%g
|
||||
|
@ -2351,7 +2364,7 @@ CONFIG_FILES=\${CONFIG_FILES-"Makefile \
|
|||
extra/Makefile extra/ustdio/Makefile \
|
||||
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
|
||||
tools/genrb/Makefile tools/gencol/Makefile \
|
||||
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile \
|
||||
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/gentz/Makefile \
|
||||
tools/gennames/Makefile tools/toolutil/Makefile \
|
||||
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
|
||||
test/ieeetest/Makefile \
|
||||
|
|
|
@ -43,9 +43,19 @@ if test $ac_cv_lib_pthread_pthread_create = no; then
|
|||
AC_CHECK_LIB(cma, pthread_create)
|
||||
fi
|
||||
|
||||
#only LINUX for now
|
||||
# check for dlopen()
|
||||
|
||||
HAVE_DLOPEN=0
|
||||
|
||||
#add more libs here..
|
||||
AC_CHECK_LIB(dl, dlopen)
|
||||
|
||||
if test $ac_cv_lib_dl_dlopen = yes; then
|
||||
HAVE_DLOPEN=1
|
||||
fi
|
||||
|
||||
AC_SUBST(HAVE_DLOPEN)
|
||||
|
||||
dnl Checks for header files
|
||||
AC_CHECK_HEADERS(inttypes.h)
|
||||
if test $ac_cv_header_inttypes_h = no; then
|
||||
|
@ -143,7 +153,9 @@ AC_ARG_ENABLE(mapped,
|
|||
*) AC_MSG_ERROR(bad value ${enableval} for --enable-mapped) ;;
|
||||
esac],
|
||||
mapped=false)
|
||||
ICU_CONDITIONAL(USE_MAPPED, test "$mapped" = true)
|
||||
|
||||
ICU_CONDITIONAL(USE_MAPPED, test "$mapped" = true -o "$HAVE_DLOPEN" = 0)
|
||||
|
||||
|
||||
dnl Enable/disable tests
|
||||
AC_ARG_ENABLE(tests,
|
||||
|
@ -213,7 +225,7 @@ AC_OUTPUT([Makefile \
|
|||
extra/Makefile extra/ustdio/Makefile \
|
||||
tools/Makefile tools/ctestfw/Makefile tools/makeconv/Makefile \
|
||||
tools/genrb/Makefile tools/gencol/Makefile \
|
||||
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile \
|
||||
tools/rbdump/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/gentz/Makefile \
|
||||
tools/gennames/Makefile tools/toolutil/Makefile \
|
||||
test/Makefile test/intltest/Makefile test/cintltst/Makefile \
|
||||
test/ieeetest/Makefile \
|
||||
|
|
|
@ -717,7 +717,9 @@ RuleBasedCollator::constructFromFile( const Locale& locale,
|
|||
}
|
||||
|
||||
// Now try to load it up from a resource bundle text source file
|
||||
ResourceBundle bundle(UnicodeString(Locale::getDataDirectory(),""), localeFileName, status);
|
||||
UnicodeString dataDir = UnicodeString(Locale::getDataDirectory(),"");
|
||||
|
||||
ResourceBundle bundle(dataDir, localeFileName, status);
|
||||
|
||||
// if there is no resource bundle file for the give locale, break out
|
||||
if(U_FAILURE(status))
|
||||
|
|
|
@ -327,7 +327,7 @@ void TestConvert()
|
|||
ucs_file_in = fopen(ucs_file_name,"rb");
|
||||
if (!ucs_file_in)
|
||||
{
|
||||
log_err("Couldn't open the Unicode file...\n");
|
||||
log_err("Couldn't open the Unicode file [%s]... Exiting...\n", ucs_file_name);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
@ -578,9 +578,14 @@ void TestConvert()
|
|||
log_err("ucnv_toUChars() FAILED %s\n", myErrorName(err));
|
||||
else
|
||||
log_verbose(" ucnv_toUChars() o.k.\n");
|
||||
|
||||
if(u_strcmp(uchar1,uchar2)!=0)
|
||||
log_err("equality test failed with convertion routine\n");
|
||||
}
|
||||
if(u_strcmp(uchar1,uchar2)!=0)
|
||||
log_err("equality test failed with convertion routine\n");
|
||||
else
|
||||
{
|
||||
log_err("ERR: calling toUChars: Didn't get U_BUFFER_OVERFLOW .. expected it.\n");
|
||||
}
|
||||
|
||||
/*testing for ucnv_fromUnicode() and ucnv_toUnicode() */
|
||||
/*Clean up re-usable vars*/
|
||||
|
@ -632,10 +637,17 @@ void TestConvert()
|
|||
log_err("Equality test failed\n");
|
||||
|
||||
/*sanity compare */
|
||||
if(u_strcmp(uchar2, uchar3)==0)
|
||||
log_verbose("Equality test o.k.\n");
|
||||
if(uchar2 == NULL)
|
||||
{
|
||||
log_err("uchar2 was NULL (ccapitst.c line %d), couldn't do sanity check\n", __LINE__);
|
||||
}
|
||||
else
|
||||
log_err("Equality test failed\n");
|
||||
{
|
||||
if(u_strcmp(uchar2, uchar3)==0)
|
||||
log_verbose("Equality test o.k.\n");
|
||||
else
|
||||
log_err("Equality test failed\n");
|
||||
}
|
||||
|
||||
fclose(ucs_file_in);
|
||||
ucnv_close(myConverter);
|
||||
|
|
|
@ -91,7 +91,7 @@ void TestEuroRegression()
|
|||
{
|
||||
UErrorCode err = U_ZERO_ERROR;
|
||||
UConverter* myConv = ucnv_open(convertersToCheck[i], &err);
|
||||
if (U_FAILURE(err)&&convertersToCheck[i][0]) log_err("%s \tMISSING\n", convertersToCheck[i]);
|
||||
if (U_FAILURE(err)&&convertersToCheck[i][0]) log_err("%s \tMISSING [%s]\n", convertersToCheck[i], errorName(err));
|
||||
else
|
||||
{
|
||||
if (isEuroAware(myConv)) log_verbose("%s \tsupports euro\n", convertersToCheck[i]);
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include "utypes.h"
|
||||
#include "ustring.h"
|
||||
|
||||
static void printSeq(const char* a, int len);
|
||||
static void printSeq(const unsigned char* a, int len);
|
||||
static void printUSeq(const UChar* a, int len);
|
||||
|
||||
void TestNewConvertWithBufferSizes(int32_t osize, int32_t isize) ;
|
||||
|
@ -43,7 +43,7 @@ static char gNuConvTestName[1024];
|
|||
|
||||
#define nct_min(x,y) ((x<y) ? x : y)
|
||||
|
||||
void printSeq(const char* a, int len)
|
||||
void printSeq(const unsigned char* a, int len)
|
||||
{
|
||||
int i=0;
|
||||
log_verbose("\n{");
|
||||
|
@ -58,7 +58,7 @@ void printUSeq(const UChar* a, int len)
|
|||
log_verbose("}\n");
|
||||
}
|
||||
|
||||
void printSeqErr(const char* a, int len)
|
||||
void printSeqErr(const unsigned char* a, int len)
|
||||
{
|
||||
int i=0;
|
||||
fprintf(stderr, "\n{");
|
||||
|
@ -473,7 +473,7 @@ void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
|
|||
|
||||
/* Sahha [health], slashed h's */
|
||||
const UChar malteseUChars[] = { 0x0053, 0x0061, 0x0127, 0x0127, 0x0061 };
|
||||
const char maltesechars[] = { '\0' };
|
||||
const char expectedMaltese913[] = { 0x53, 0x61, 0xB1, 0xB1, 0x61 };
|
||||
/*********************************** START OF CODE finally *************/
|
||||
|
||||
gInBufferSize = insize;
|
||||
|
@ -509,6 +509,8 @@ void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
|
|||
|
||||
/****/
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if(!testConvertToU(expectedUTF8, sizeof(expectedUTF8),
|
||||
sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf8", fmUTF8Offs ))
|
||||
log_err("utf8 -> u did not match\n");
|
||||
|
@ -518,6 +520,8 @@ void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
|
|||
|
||||
log_err("iso-2022 -> u did not match");
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
if(!testConvertToU(expectedIBM930, sizeof(expectedIBM930),
|
||||
sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "ibm-930", fmIBM930Offs ))
|
||||
|
@ -531,6 +535,15 @@ void TestNewConvertWithBufferSizes(int32_t outsize, int32_t insize )
|
|||
sampleText, sizeof(sampleText)/sizeof(sampleText[0]), "utf-16le", fmUTF16LEOffs ))
|
||||
log_err("utf-16le -> u did not match");
|
||||
#endif
|
||||
|
||||
if(!testConvertToU(expectedMaltese913, sizeof(expectedMaltese913),
|
||||
malteseUChars, sizeof(malteseUChars)/sizeof(malteseUChars[0]), "latin3", NULL))
|
||||
log_err("latin3[813] -> u did not match\n");
|
||||
|
||||
if(!testConvertFromU(malteseUChars, sizeof(malteseUChars)/sizeof(malteseUChars[0]),
|
||||
expectedMaltese913, sizeof(expectedMaltese913), "iso-8859-3", NULL ))
|
||||
log_err("u-> latin3[813] did not match.\n");
|
||||
|
||||
}
|
||||
|
||||
void TestConverterTypesAndStarters()
|
||||
|
@ -572,25 +585,41 @@ void TestConverterTypesAndStarters()
|
|||
log_verbose("Testing KSC, ibm-930, ibm-878 for starters and their conversion types.");
|
||||
|
||||
myConverter[0] = ucnv_open("ksc", &err);
|
||||
if (U_FAILURE(err)) log_err("Failed to create an ibm-949 converter\n");
|
||||
myConverter[1] = ucnv_open("ibm-930", &err);
|
||||
if (U_FAILURE(err)) log_err("Failed to create an ibm-930 converter\n");
|
||||
myConverter[2] = ucnv_open("ibm-878", &err);
|
||||
if (U_FAILURE(err)) log_err("Failed to create an ibm-815 converter\n");
|
||||
|
||||
if (ucnv_getType(myConverter[0])!=UCNV_MBCS) log_err("ucnv_getType Failed for ibm-949\n");
|
||||
else log_verbose("ucnv_getType ibm-949 ok\n");
|
||||
if (ucnv_getType(myConverter[1])!=UCNV_EBCDIC_STATEFUL) log_err("ucnv_getType Failed for ibm-930\n");
|
||||
else log_verbose("ucnv_getType ibm-930 ok\n");
|
||||
if (ucnv_getType(myConverter[2])!=UCNV_SBCS) log_err("ucnv_getType Failed for ibm-815\n");
|
||||
else log_verbose("ucnv_getType ibm-815 ok\n");
|
||||
|
||||
|
||||
ucnv_getStarters(myConverter[0], mystarters, &err);
|
||||
/*if (memcmp(expectedKSCstarters, mystarters, sizeof(expectedKSCstarters)))
|
||||
log_err("Failed ucnv_getStarters for ksc\n");
|
||||
if (U_FAILURE(err))
|
||||
log_err("Failed to create an ibm-949 converter\n");
|
||||
else
|
||||
log_verbose("ucnv_getStarters ok\n");*/
|
||||
{
|
||||
if (ucnv_getType(myConverter[0])!=UCNV_MBCS) log_err("ucnv_getType Failed for ibm-949\n");
|
||||
else log_verbose("ucnv_getType ibm-949 ok\n");
|
||||
|
||||
if(myConverter[0]!=NULL)
|
||||
ucnv_getStarters(myConverter[0], mystarters, &err);
|
||||
|
||||
/*if (memcmp(expectedKSCstarters, mystarters, sizeof(expectedKSCstarters)))
|
||||
log_err("Failed ucnv_getStarters for ksc\n");
|
||||
else
|
||||
log_verbose("ucnv_getStarters ok\n");*/
|
||||
|
||||
}
|
||||
|
||||
myConverter[1] = ucnv_open("ibm-930", &err);
|
||||
if (U_FAILURE(err))
|
||||
log_err("Failed to create an ibm-930 converter\n");
|
||||
else
|
||||
{
|
||||
if (ucnv_getType(myConverter[1])!=UCNV_EBCDIC_STATEFUL) log_err("ucnv_getType Failed for ibm-930\n");
|
||||
else log_verbose("ucnv_getType ibm-930 ok\n");
|
||||
}
|
||||
|
||||
myConverter[2] = ucnv_open("ibm-878", &err);
|
||||
if (U_FAILURE(err))
|
||||
log_err("Failed to create an ibm-815 converter\n");
|
||||
else
|
||||
{
|
||||
if (ucnv_getType(myConverter[2])!=UCNV_SBCS) log_err("ucnv_getType Failed for ibm-815\n");
|
||||
else log_verbose("ucnv_getType ibm-815 ok\n");
|
||||
}
|
||||
|
||||
|
||||
ucnv_close(myConverter[0]);
|
||||
ucnv_close(myConverter[1]);
|
||||
|
|
|
@ -32,7 +32,7 @@ pkglibdir = $(libdir)/@PACKAGE@
|
|||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
|
||||
ICUDATADIR=$(pkgdatadir)/$(VERSION)
|
||||
SRCDATADIR=$(top_builddir)/../data/
|
||||
SRCDATADIR=$(top_builddir)/../data
|
||||
|
||||
## Build directory information
|
||||
top_builddir = ..
|
||||
|
@ -57,7 +57,7 @@ VERSION = @VERSION@
|
|||
CLEANFILES = *~
|
||||
|
||||
SUBDIRS = ctestfw makeconv genrb gencol rbdump \
|
||||
toolutil genccode gennames gencmn gencnval
|
||||
toolutil genccode gennames gencmn gencnval gentz
|
||||
|
||||
## List of phony targets
|
||||
.PHONY : all all-local all-recursive install install-local install-everything install-files install-dlls build-data build-cmnfile build-dll \
|
||||
|
@ -96,9 +96,28 @@ all-recursive install-recursive clean-recursive distclean-recursive dist-recursi
|
|||
|
||||
all-local: build-local
|
||||
|
||||
DATAFILES=$(SRCDATADIR)/unames.dat $(SRCDATADIR)/cnvalias.dat
|
||||
SRCDATAFILES=$(DATAFILES:.dat=_dat.c)
|
||||
OBJDATAFILES=$(SRCDATAFILES:.c=.o)
|
||||
DAT_FILES=unames.dat cnvalias.dat tz.dat
|
||||
|
||||
DATAFILESD=$(DAT_FILES:%=$(SRCDATADIR)/%)
|
||||
|
||||
include makeconv/ucmfiles.mk
|
||||
-include makeconv/ucmlocal.mk
|
||||
ALL_UCM_SOURCE= $(UCM_SOURCE) $(UCM_SOURCE_LOCAL)
|
||||
|
||||
|
||||
UCM_FILES = $(ALL_UCM_SOURCE:%=$(top_srcdir)/../data/%)
|
||||
CNV_FILES = $(UCM_FILES:.ucm=.cnv)
|
||||
DATAFILESC=$(CNV_FILES)
|
||||
|
||||
|
||||
DATAFILES=$(DATAFILESD) $(DATAFILESC)
|
||||
|
||||
SRCDATAFILESD=$(DATAFILESD:.dat=_dat.c)
|
||||
SRCDATAFILESC=$(DATAFILESC:%.cnv=%_cnv.c)
|
||||
SRCDATAFILES=$(SRCDATAFILESD) $(SRCDATAFILESC)
|
||||
|
||||
|
||||
OBJDATAFILES=$(SRCDATAFILES:%.c=%.o)
|
||||
COMMONFILE=$(SRCDATADIR)/icudata.dat
|
||||
COMMONDLL=$(SRCDATADIR)/libicudata.$(SO)
|
||||
|
||||
|
@ -106,38 +125,55 @@ COMMONDLL=$(SRCDATADIR)/libicudata.$(SO)
|
|||
UDATA_FILES=icudata.dat
|
||||
UDATA_DLLS=libicudata.$(SO)
|
||||
|
||||
build-local: build-data build-cmnfile build-dll
|
||||
### use the "--enable-mapped=" option to configure, to get mapped file behavior.
|
||||
# the case where '--enable-mapped=yes'
|
||||
@USE_MAPPED_TRUE@build-local: build-data build-cmnfile
|
||||
|
||||
# the case where '--enable-mapped=no' (DEFAULT)
|
||||
@USE_MAPPED_FALSE@build-local: build-data build-dll
|
||||
###
|
||||
|
||||
# check for any other generated data here
|
||||
install-data: $(DATAFILES)
|
||||
|
||||
build-cmnfile: $(COMMONFILE)
|
||||
|
||||
# argh! the -Wpath [etc] has relative DLL paths in it
|
||||
# the -Wpath [etc] has relative DLL paths in it
|
||||
# so we have to cd into the other dir..
|
||||
|
||||
gencmn/mkmap.tmp: Makefile
|
||||
-rm -f gencmn/mkmap.tmp
|
||||
for file in $(DATAFILES); do \
|
||||
|
||||
|
||||
$(COMMONFILE): $(DATAFILES)
|
||||
@-rm -f gencmn/mkmap.tmp
|
||||
@for file in $(DATAFILES); do \
|
||||
echo `pwd`/$$file >> gencmn/mkmap.tmp; \
|
||||
done;
|
||||
|
||||
|
||||
$(COMMONFILE): $(DATAFILES) gencmn/mkmap.tmp
|
||||
@echo -n Generating common file $(COMMONFILE). Number of files:
|
||||
-@wc -l gencmn/mkmap.tmp
|
||||
-rm -f $(COMMONFILE)
|
||||
(cd gencmn ; ICU_DATA=../$(SRCDATADIR) ./gencmn 1000000 mkmap.tmp )
|
||||
@(cd gencmn ; ICU_DATA=../$(SRCDATADIR) ./gencmn 1000000 mkmap.tmp )
|
||||
-@ls -l $(COMMONFILE)
|
||||
|
||||
build-dll: $(COMMONDLL)
|
||||
|
||||
%_dat.c: %.dat
|
||||
(cd genccode ; ./genccode ../$< )
|
||||
|
||||
%_cnv.c: %.cnv
|
||||
(cd genccode ; ./genccode ../$< )
|
||||
|
||||
|
||||
# strip is optional
|
||||
# -$(STRIP) $@
|
||||
|
||||
$(COMMONDLL): $(OBJDATAFILES)
|
||||
$(SHLIB.c) -o $@ $^
|
||||
-$(STRIP) $@
|
||||
-ls -l $@
|
||||
|
||||
srcs: $(SRCDATAFILES)
|
||||
|
||||
|
||||
|
||||
### use the "--enable-mapped=" option to configure, to get mapped file behavior.
|
||||
# the case where '--enable-mapped=yes' - raw files [which can be mapped]
|
||||
|
|
|
@ -85,11 +85,11 @@ install-local: target-clean-local all-local build-data
|
|||
$(mkinstalldirs) $(sbindir)
|
||||
$(INSTALL) $(TARGET) $(sbindir)/$(TARGET)
|
||||
|
||||
build-data: $(ICUDATADIR)/unames.dat
|
||||
build-data: $(ICUDATADIR)/cnvalias.dat
|
||||
|
||||
# we set the ICU_DATA directory here so that unames.dat ends up in
|
||||
# icu/data rather than PREFIX/share/icu/VERSION/
|
||||
$(ICUDATADIR)/unames.dat: $(CONVRTRSFILE) $(TARGET)
|
||||
$(ICUDATADIR)/cnvalias.dat: $(CONVRTRSFILE) $(TARGET)
|
||||
ICU_DATA=$(ICUDATADIR) ./$(TARGET)
|
||||
|
||||
dist-local:
|
||||
|
|
|
@ -74,9 +74,16 @@ distclean : distclean-local
|
|||
dist: dist-local
|
||||
check: check-local
|
||||
|
||||
all-local: $(TARGET)
|
||||
all-local: $(TARGET) build-data
|
||||
|
||||
## only rebuild if ANY .RES FILES CHANGE
|
||||
|
||||
build-data: .sentinel
|
||||
|
||||
.sentinel: $(top_srcdir)/../data/*
|
||||
@echo "Creating binary collation files (may take a while)"
|
||||
@ICU_DATA=$(top_builddir)/../data/ ./$(TARGET) > /dev/null 2>&1
|
||||
@ICU_DATA=$(top_builddir)/../data/ ./$(TARGET) > /dev/null 2>&1
|
||||
@touch .sentinel
|
||||
|
||||
install-local: target-clean-local all-local
|
||||
# $(mkinstalldirs) $(sbindir)
|
||||
|
@ -87,7 +94,7 @@ install-local: target-clean-local all-local
|
|||
dist-local:
|
||||
|
||||
target-clean-local:
|
||||
rm -f $(TARGET)
|
||||
rm -f $(TARGET) .sentinel
|
||||
|
||||
clean-local: target-clean-local
|
||||
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
|
|
@ -103,7 +103,7 @@ class gentz {
|
|||
public:
|
||||
int main(int argc, char *argv[]);
|
||||
private:
|
||||
int32_t writeTzDatFile(FileStream* out);
|
||||
int32_t writeTzDatFile();
|
||||
void parseTzTextFile(FileStream* in);
|
||||
|
||||
// High level parsing
|
||||
|
@ -202,23 +202,14 @@ int gentz::main(int argc, char *argv[]) {
|
|||
fprintf(stdout, "Read %ld standard zones, %ld dst zones, %ld zone names\n",
|
||||
header.standardCount, header.dstCount, zoneCount);
|
||||
|
||||
FileStream* out = T_FileStream_open(outfile, "w");
|
||||
if (out == 0) {
|
||||
die("Cannot open output file");
|
||||
}
|
||||
int32_t wlen = writeTzDatFile(out);
|
||||
T_FileStream_close(out);
|
||||
int32_t wlen = writeTzDatFile();
|
||||
fprintf(stdout, "Wrote to %s: %ld bytes\n",
|
||||
outfile, wlen);
|
||||
// REMOVE THIS NOTICE when it no longer applies:
|
||||
fprintf(stdout, "NOTE: Currently, gentz writes the output file to"
|
||||
" the data directory and creates an EMPTY file of the"
|
||||
" same name in the target directory. Ignore the empty file.");
|
||||
|
||||
return 0; // success
|
||||
}
|
||||
|
||||
int32_t gentz::writeTzDatFile(FileStream* out) {
|
||||
int32_t gentz::writeTzDatFile() {
|
||||
UNewDataMemory *pdata;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
## Makefile.in for ICU - tools/makeconv
|
||||
## Stephen F. Booth
|
||||
|
||||
## List of converter tables to build
|
||||
include ucmfiles.mk
|
||||
-include ucmlocal.mk
|
||||
|
||||
## Shell to use
|
||||
SHELL = @SHELL@
|
||||
|
||||
|
@ -47,49 +51,19 @@ CLEANFILES = *~
|
|||
TARGET = makeconv
|
||||
|
||||
DEFS = @DEFS@
|
||||
CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/common
|
||||
CPPFLAGS = @CPPFLAGS@ -I$(top_srcdir)/common -I../toolutil
|
||||
CFLAGS = @CFLAGS@
|
||||
CXXFLAGS = @CXXFLAGS@
|
||||
LDFLAGS = @LDFLAGS@ \
|
||||
$(LD_RPATH)$(LD_RPATH_PRE)$(libdir)@ld_rpath_suf@$(LD_RPATH_PRE)$(top_builddir)/common
|
||||
LIBS = $(LIBICU-UC) @LIBS@ @LIB_M@
|
||||
$(LD_RPATH)$(LD_RPATH_PRE)$(libdir)@ld_rpath_suf@$(LD_RPATH_PRE)$(top_builddir)/common@ld_rpath_suf@$(LD_RPATH_PRE)$(top_builddir)/tools/toolutil
|
||||
LIBS = $(LIBICU-UC) @LIBS@ @LIB_M@ -L$(top_builddir)/tools/toolutil -licu-toolutil
|
||||
|
||||
OBJECTS = makeconv.o
|
||||
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
## List of converter tables to build
|
||||
UCM_SOURCE = ibm-1038.ucm ibm-1047.ucm ibm-1089.ucm ibm-1123.ucm \
|
||||
ibm-1140.ucm ibm-1141.ucm ibm-1142.ucm ibm-1143.ucm ibm-1144.ucm \
|
||||
ibm-1145.ucm ibm-1146.ucm ibm-1147.ucm ibm-1148.ucm ibm-1149.ucm \
|
||||
ibm-1153.ucm ibm-1154.ucm ibm-1155.ucm ibm-1156.ucm ibm-1157.ucm \
|
||||
ibm-1158.ucm ibm-1159.ucm ibm-1160.ucm ibm-1164.ucm ibm-1252.ucm \
|
||||
ibm-12712.ucm ibm-1275.ucm ibm-1276.ucm ibm-1277.ucm ibm-1280.ucm \
|
||||
ibm-1281.ucm ibm-1282.ucm ibm-1283.ucm ibm-1361.ucm ibm-1362.ucm \
|
||||
ibm-1363.ucm ibm-1364.ucm ibm-1370.ucm ibm-1371.ucm ibm-1383.ucm \
|
||||
ibm-1386.ucm ibm-1390.ucm ibm-1399.ucm ibm-16684.ucm ibm-16804.ucm \
|
||||
ibm-17248.ucm ibm-21427.ucm ibm-420.ucm ibm-424.ucm ibm-437.ucm \
|
||||
ibm-4899.ucm ibm-4909.ucm ibm-4930.ucm ibm-4971.ucm ibm-5104.ucm \
|
||||
ibm-5123.ucm ibm-5210.ucm ibm-5346.ucm ibm-5347.ucm ibm-5349.ucm \
|
||||
ibm-5350.ucm ibm-5351.ucm ibm-5352.ucm ibm-5353.ucm ibm-5354.ucm \
|
||||
ibm-803.ucm ibm-808.ucm ibm-813.ucm ibm-834.ucm ibm-848.ucm \
|
||||
ibm-8482.ucm ibm-849.ucm ibm-852.ucm ibm-855.ucm ibm-856.ucm \
|
||||
ibm-857.ucm ibm-858.ucm ibm-859.ucm ibm-860.ucm ibm-861.ucm \
|
||||
ibm-863.ucm ibm-864.ucm ibm-865.ucm ibm-866.ucm ibm-867.ucm \
|
||||
ibm-868.ucm ibm-869.ucm ibm-872.ucm ibm-874.ucm ibm-878.ucm \
|
||||
ibm-901.ucm ibm-902.ucm ibm-9027.ucm ibm-9044.ucm ibm-9049.ucm \
|
||||
ibm-9061.ucm ibm-912.ucm ibm-913.ucm ibm-914.ucm ibm-915.ucm \
|
||||
ibm-916.ucm ibm-920.ucm ibm-921.ucm ibm-922.ucm ibm-923.ucm \
|
||||
ibm-9238.ucm ibm-924.ucm ibm-933.ucm ibm-935.ucm ibm-942.ucm \
|
||||
ibm-943.ucm ibm-949.ucm ibm-970.ucm ibm-1258.ucm ibm-273.ucm \
|
||||
ibm-277.ucm ibm-278.ucm ibm-280.ucm ibm-284.ucm ibm-285.ucm \
|
||||
ibm-297.ucm ibm-37.ucm ibm-500.ucm ibm-871.ucm ibm-937.ucm \
|
||||
ibm-930.ucm ibm-1257.ucm ibm-1256.ucm ibm-1255.ucm ibm-1254.ucm ibm-1253.ucm ibm-1251.ucm \
|
||||
ibm-1250.ucm ibm-862.ucm ibm-850.ucm ibm-950.ucm
|
||||
|
||||
|
||||
|
||||
UCM_FILES = $(UCM_SOURCE:%=$(top_srcdir)/../data/%)
|
||||
ALL_UCM = $(UCM_SOURCE) $(UCM_SOURCE_LOCAL)
|
||||
UCM_FILES = $(ALL_UCM:%=$(top_srcdir)/../data/%)
|
||||
CNV_FILES = $(UCM_FILES:.ucm=.cnv)
|
||||
|
||||
## List of phony targets
|
||||
|
@ -110,17 +84,22 @@ check: check-local
|
|||
|
||||
all-local: $(TARGET) $(CNV_FILES)
|
||||
|
||||
install-local: target-clean-local all-local
|
||||
$(mkinstalldirs) $(sbindir)
|
||||
$(INSTALL) $(TARGET) $(sbindir)/$(TARGET)
|
||||
$(mkinstalldirs) $(pkgdatadir)/$(VERSION)
|
||||
@list='$(notdir $(CNV_FILES)) convrtrs.txt'; for file in $$list; do \
|
||||
echo $(INSTALL_DATA) $(top_srcdir)/../data/$$file $(pkgdatadir)/$(VERSION)/$$file; \
|
||||
$(INSTALL_DATA) $(top_srcdir)/../data/$$file $(pkgdatadir)/$(VERSION)/$$file; \
|
||||
done
|
||||
|
||||
#install-local: all-local
|
||||
# $(mkinstalldirs) $(sbindir)
|
||||
# $(INSTALL) $(TARGET) $(sbindir)/$(TARGET)
|
||||
# $(mkinstalldirs) $(pkgdatadir)/$(VERSION)
|
||||
# @list='$(notdir $(CNV_FILES)) convrtrs.txt'; for file in $$list; do \
|
||||
# echo $(INSTALL_DATA) $(top_srcdir)/../data/$$file $(pkgdatadir)/$(VERSION)/$$file; \
|
||||
# $(INSTALL_DATA) $(top_srcdir)/../data/$$file $(pkgdatadir)/$(VERSION)/$$file; \
|
||||
# done
|
||||
|
||||
dist-local:
|
||||
|
||||
rebuild: $(TARGET)
|
||||
-rm -f $(CNV_FILES)
|
||||
$(MAKE) all-local
|
||||
|
||||
target-clean-local:
|
||||
rm -f $(TARGET)
|
||||
|
||||
|
@ -140,10 +119,10 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
|||
$(TARGET) : $(OBJECTS)
|
||||
$(LINK.c) -o $@ $^ $(LIBS)
|
||||
|
||||
## Rule to build a compiled cnv file
|
||||
# Rule to build a compiled cnv file
|
||||
%.cnv : %.ucm
|
||||
@echo "Creating .cnv file for $<"
|
||||
@ICU_DATA=$(top_builddir)/../data/ ./makeconv $< > /dev/null 2>&1
|
||||
@echo -n "$< -> "
|
||||
@ICU_DATA=$(top_builddir)/../data/ ./makeconv $<
|
||||
|
||||
ifneq ($(MAKECMDGOALS),distclean)
|
||||
-include $(DEPS)
|
||||
|
|
|
@ -26,6 +26,9 @@
|
|||
#include "cmemory.h"
|
||||
#include "filestrm.h"
|
||||
|
||||
#include "udata.h"
|
||||
#include "unewdata.h"
|
||||
#include "ucmpwrit.h"
|
||||
|
||||
/*Reads the header of the table file and fills in basic knowledge about the converter
|
||||
*in "converter"
|
||||
|
@ -62,6 +65,9 @@ static void writeUConverterSharedDataToFile(const char* filename,
|
|||
UConverterSharedData* mySharedData,
|
||||
UErrorCode* err);
|
||||
|
||||
|
||||
static void WriteConverterSharedData(UNewDataMemory *pData, const UConverterSharedData* data);
|
||||
|
||||
static UConverterPlatform getPlatformFromName(char* name);
|
||||
static int32_t getCodepageNumberFromName(char* name);
|
||||
|
||||
|
@ -139,6 +145,50 @@ char *
|
|||
return line + i;
|
||||
}
|
||||
|
||||
static const UDataInfo dataInfo={
|
||||
sizeof(UDataInfo),
|
||||
0,
|
||||
|
||||
U_IS_BIG_ENDIAN,
|
||||
U_CHARSET_FAMILY,
|
||||
sizeof(UChar),
|
||||
0,
|
||||
|
||||
0x63, 0x6e, 0x76, 0x74, /* dataFormat="cnvt" */
|
||||
1, 0, 0, 0, /* formatVersion */
|
||||
1, 3, 1, 0 /* dataVersion */
|
||||
};
|
||||
|
||||
|
||||
void writeConverterData(UConverterSharedData *mySharedData, const char *cName, UErrorCode *status)
|
||||
{
|
||||
UNewDataMemory *mem;
|
||||
void *data;
|
||||
const char *cnvName;
|
||||
|
||||
uint32_t sz ;
|
||||
uint32_t sz2, sz3;
|
||||
|
||||
cnvName = icu_strrchr(cName, '/');
|
||||
if(cnvName)
|
||||
{
|
||||
cnvName++;
|
||||
}
|
||||
else
|
||||
cnvName = cName;
|
||||
|
||||
|
||||
mem = udata_create("cnv", cnvName, &dataInfo, UCNV_COPYRIGHT_STRING, status);
|
||||
|
||||
WriteConverterSharedData(mem, mySharedData);
|
||||
|
||||
udata_writeBlock(mem, data, sz);
|
||||
|
||||
sz2 = udata_finish(mem, status);
|
||||
|
||||
/* printf("Done. Wrote %d bytes.\n", sz2); */
|
||||
}
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
@ -146,7 +196,7 @@ int main(int argc, char** argv)
|
|||
UErrorCode err = U_ZERO_ERROR;
|
||||
char outFileName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
|
||||
char* dot = NULL;
|
||||
|
||||
char cnvName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
|
||||
|
||||
if (argc == 1)
|
||||
{
|
||||
|
@ -162,9 +212,12 @@ int main(int argc, char** argv)
|
|||
*dot = '\0';
|
||||
}
|
||||
/*Adds the target extension*/
|
||||
icu_strcpy(cnvName, outFileName);
|
||||
|
||||
icu_strcat(outFileName, CONVERTER_FILE_EXTENSION);
|
||||
|
||||
mySharedData = createConverterFromTableFile(argv[argc], &err);
|
||||
|
||||
if (U_FAILURE(err) || (mySharedData == NULL))
|
||||
{
|
||||
/* in an error is found, print out a error msg and keep going*/
|
||||
|
@ -173,7 +226,8 @@ int main(int argc, char** argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
writeUConverterSharedDataToFile(outFileName, mySharedData, &err);
|
||||
/* writeUConverterSharedDataToFile(outFileName, mySharedData, &err); */
|
||||
writeConverterData(mySharedData, cnvName, &err);
|
||||
deleteSharedConverterData(mySharedData);
|
||||
puts(outFileName);
|
||||
}
|
||||
|
@ -490,6 +544,7 @@ void loadSBCSTableFromFile(FileStream* convFile, UConverter* myConverter, UError
|
|||
return;
|
||||
}
|
||||
|
||||
myUConverterTable->sbcs.toUnicode = malloc(sizeof(UChar)*256);
|
||||
/*fills in the toUnicode array with the Unicode Replacement Char*/
|
||||
for (i=0;i<255;i++) myUConverterTable->sbcs.toUnicode[i] = unicodeValue;
|
||||
|
||||
|
@ -547,6 +602,14 @@ void loadMBCSTableFromFile(FileStream* convFile, UConverter* myConverter, UError
|
|||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
myUConverterTable->mbcs.starters = icu_malloc(sizeof(bool_t)*256);
|
||||
if (myUConverterTable->mbcs.starters == NULL)
|
||||
{
|
||||
*err = U_MEMORY_ALLOCATION_ERROR;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*Initializes the mbcs.starters to FALSE*/
|
||||
|
||||
|
@ -717,6 +780,8 @@ void loadDBCSTableFromFile(FileStream* convFile, UConverter* myConverter, UError
|
|||
ucmp16_compact(myToUnicode);
|
||||
myUConverterTable->dbcs.fromUnicode = myFromUnicode;
|
||||
myUConverterTable->dbcs.toUnicode = myToUnicode;
|
||||
|
||||
|
||||
myConverter->sharedData->referenceCounter = 1;
|
||||
myConverter->sharedData->table = myUConverterTable;
|
||||
|
||||
|
@ -781,6 +846,9 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
|||
T_FileStream_close(convFile);
|
||||
}
|
||||
|
||||
mySharedData->structSize = sizeof(UConverterSharedData);
|
||||
mySharedData->dataMemory = NULL; /* for init */
|
||||
|
||||
myConverter.sharedData = mySharedData;
|
||||
readHeaderFromFile(&myConverter, convFile, err);
|
||||
|
||||
|
@ -813,5 +881,51 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
|
|||
};
|
||||
|
||||
T_FileStream_close(convFile);
|
||||
|
||||
|
||||
return mySharedData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void WriteConverterSharedData(UNewDataMemory *pData, const UConverterSharedData* data)
|
||||
{
|
||||
udata_writeBlock(pData, data, sizeof(UConverterSharedData));
|
||||
|
||||
switch (data->conversionType)
|
||||
{
|
||||
case UCNV_SBCS:
|
||||
{
|
||||
udata_writeBlock(pData, (void*)data->table->sbcs.toUnicode, sizeof(UChar)*256);
|
||||
udata_write_ucmp8(pData, data->table->sbcs.fromUnicode);
|
||||
}
|
||||
break;
|
||||
|
||||
case UCNV_DBCS:
|
||||
case UCNV_EBCDIC_STATEFUL:
|
||||
{
|
||||
udata_write_ucmp16(pData,data->table->dbcs.toUnicode);
|
||||
udata_write_ucmp16(pData,data->table->dbcs.fromUnicode);
|
||||
}
|
||||
break;
|
||||
|
||||
case UCNV_MBCS:
|
||||
{
|
||||
udata_writeBlock(pData, data->table->mbcs.starters, 256*sizeof(bool_t));
|
||||
udata_write_ucmp16(pData,data->table->mbcs.toUnicode);
|
||||
udata_write_ucmp16(pData,data->table->mbcs.fromUnicode);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
/*If it isn't any of the above, the file is invalid */
|
||||
fprintf(stderr, "Error: bad converter type, can't write!!\n");
|
||||
exit(1);
|
||||
return; /* 0; */
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ CXXFLAGS = @CXXFLAGS@
|
|||
LDFLAGS = @LDFLAGS@ $(LD_RPATH)$(LD_RPATH_PRE)$(libdir)
|
||||
LIBS = $(LIBICU-UC) @LIBS@
|
||||
|
||||
OBJECTS = toolutil.o unewdata.o
|
||||
OBJECTS = toolutil.o unewdata.o ucmpwrit.o
|
||||
|
||||
DEPS = $(OBJECTS:.o=.d)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue