ICU-627 fix portability of UConverterStaticData

X-SVN-Rev: 2557
This commit is contained in:
Steven R. Loomis 2000-10-03 20:18:22 +00:00
parent 77f5f0afe8
commit c12237ff37
8 changed files with 42 additions and 43 deletions

View File

@ -464,8 +464,8 @@ const UConverterStaticData _ISO2022StaticData={
sizeof(UConverterStaticData),
"ISO_2022",
2022, UCNV_IBM, UCNV_ISO_2022, 1, 4,
1, { 0x1a, 0, 0, 0 }, FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} /* reserved */
{ 0x1a, 0, 0, 0 },1, FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} /* reserved */
};
@ -3507,11 +3507,3 @@ UConverter_getNextUChar_ISO_2022_CN(UConverterToUnicodeArgs *pArgs,
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return 0xffff;
}

View File

@ -121,7 +121,7 @@ isCnvAcceptable(void *context,
pInfo->dataFormat[1]==0x6e &&
pInfo->dataFormat[2]==0x76 &&
pInfo->dataFormat[3]==0x74 &&
pInfo->formatVersion[0]==5);
pInfo->formatVersion[0]==6);
}
#define DATA_TYPE "cnv"

View File

@ -64,26 +64,27 @@ typedef union UConverterTable UConverterTable;
struct UConverterImpl;
typedef struct UConverterImpl UConverterImpl;
typedef struct UConverterStaticData {
uint32_t structSize; /* Size of this structure */
typedef struct UConverterStaticData { /* +offset: size */
uint32_t structSize; /* +0: 4 Size of this structure */
char name [UCNV_MAX_CONVERTER_NAME_LENGTH]; /* internal name of the converter- invariant chars */
char name
[UCNV_MAX_CONVERTER_NAME_LENGTH]; /* +4: 60 internal name of the converter- invariant chars */
int32_t codepage; /* codepage # (now IBM-$codepage) */
int32_t codepage; /* +64: 4 codepage # (now IBM-$codepage) */
int8_t platform; /* platform of the converter (only IBM now) */
int8_t conversionType; /* conversion type */
int8_t platform; /* +68: 1 platform of the converter (only IBM now) */
int8_t conversionType; /* +69: 1 conversion type */
int8_t minBytesPerChar; /* Minimum # bytes per char in this codepage */
int8_t maxBytesPerChar; /* Maximum # bytes per char in this codepage */
int8_t minBytesPerChar; /* +70: 1 Minimum # bytes per char in this codepage */
int8_t maxBytesPerChar; /* +71: 1 Maximum # bytes per char in this codepage */
int8_t subCharLen;
uint8_t subChar[UCNV_MAX_SUBCHAR_LEN];
uint8_t hasToUnicodeFallback; /* UBool needs to be changed to UBool to be consistent across platform */
uint8_t hasFromUnicodeFallback;
uint8_t reserved[19]; /* to round out the structure */
uint8_t subChar[UCNV_MAX_SUBCHAR_LEN]; /* +72: 4 [note: 4 and 8 byte boundary] */
int8_t subCharLen; /* +76: 1 */
uint8_t hasToUnicodeFallback; /* +77: 1 UBool needs to be changed to UBool to be consistent across platform */
uint8_t hasFromUnicodeFallback; /* +78: 1 */
uint8_t reserved[21]; /* +79: 21 to round out the structure */
/* total size: 100 */
} UConverterStaticData;
/*

View File

@ -518,7 +518,7 @@ const UConverterStaticData _LMBCSStaticData##n={\
sizeof(UConverterStaticData),\
"LMBCS-" #n,\
0, UCNV_IBM, UCNV_LMBCS_##n, 1, 1,\
1, { 0x3f, 0, 0, 0 } \
{ 0x3f, 0, 0, 0 },1,FALSE,FALSE,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0} \
};\
const UConverterSharedData _LMBCSData##n={\
sizeof(UConverterSharedData), ~((uint32_t) 0),\

View File

@ -780,7 +780,7 @@ const UConverterStaticData _UTF8StaticData={
sizeof(UConverterStaticData),
"UTF8",
1208, UCNV_IBM, UCNV_UTF8, 1, 4,
3, { 0xef, 0xbf, 0xbd, 0 }
{ 0xef, 0xbf, 0xbd, 0 },3,FALSE,FALSE,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
@ -959,7 +959,7 @@ const UConverterStaticData _UTF16BEStaticData={
sizeof(UConverterStaticData),
"UTF16_BigEndian",
1200, UCNV_IBM, UCNV_UTF16_BigEndian, 2, 2,
2, { 0xff, 0xfd, 0, 0 }
{ 0xff, 0xfd, 0, 0 },2,FALSE,FALSE,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};
@ -1148,7 +1148,7 @@ const UConverterStaticData _UTF16LEStaticData={
sizeof(UConverterStaticData),
"UTF16_LittleEndian",
1200, UCNV_IBM, UCNV_UTF16_LittleEndian, 2, 2,
2, { 0xfd, 0xff, 0, 0 }
{ 0xfd, 0xff, 0, 0 },2,0,0,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};

View File

@ -197,7 +197,7 @@ const UConverterStaticData _Latin1StaticData={
sizeof(UConverterStaticData),
"LATIN_1",
819, UCNV_IBM, UCNV_LATIN_1, 1, 1,
1, { 0x1a, 0, 0, 0 }
{ 0x1a, 0, 0, 0 },1,FALSE, FALSE,{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
};

View File

@ -199,8 +199,8 @@ static UDataInfo dataInfo={
0,
0x63, 0x6e, 0x76, 0x74, /* dataFormat="cnvt" */
5, 0, 0, 0, /* formatVersion */
1, 6, 0, 0 /* dataVersion */
6, 0, 0, 0, /* formatVersion */
0, 0, 0, 0 /* dataVersion (calculated at runtime) */
};
@ -261,11 +261,16 @@ int main(int argc, char* argv[])
size_t destdirlen;
char* dot = NULL, *outBasename;
char cnvName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
UVersionInfo icuVersion;
#ifdef XP_MAC_CONSOLE
argc = ccommand((char***)&argv);
#endif
/* Set up the ICU version number */
u_getVersion(icuVersion);
uprv_memcpy(&dataInfo.dataVersion, &icuVersion, sizeof(UVersionInfo));
/* preset then read command line options */
options[4].value=u_getDataDirectory();
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
@ -1198,7 +1203,6 @@ static void WriteConverterSharedData(UNewDataMemory *pData, const UConverterShar
/* all read only, clean, platform independent data. Mmmm. :) */
udata_writeBlock(pData, data->staticData, sizeof(UConverterStaticData));
size += sizeof(UConverterStaticData); /* Is 4-aligned - by size */
/* Now, write the table .. Please note, the size of this table is
* */
switch (data->staticData->conversionType)

View File

@ -15,36 +15,38 @@
#include "unicode/ucnv.h"
#include "ucnv_bld.h"
static const UConverterStaticData _SBCSStaticData={
sizeof(UConverterStaticData),
"SBCS",
0, UCNV_IBM, UCNV_SBCS, 1, 1,
1, { 0, 0, 0, 0 },FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
{ 0, 0, 0, 0 }, 1, FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
};
static const UConverterStaticData _DBCSStaticData={
sizeof(UConverterStaticData),
"DBCS",
0, UCNV_IBM, UCNV_DBCS, 2, 2,
1, { 0, 0, 0, 0 }, FALSE, FALSE, /* subchar */
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
{ 0, 0, 0, 0 },1, FALSE, FALSE, /* subchar */
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
};
static const UConverterStaticData _MBCSStaticData={
sizeof(UConverterStaticData),
"MBCS",
0, UCNV_IBM, UCNV_MBCS, 1, 1,
1, { 0, 0, 0, 0 }, FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
{ 0, 0, 0, 0 }, 1, FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
};
static const UConverterStaticData _EBCDICStatefulStaticData={
sizeof(UConverterStaticData),
"EBCDICStateful",
0, UCNV_IBM, UCNV_EBCDIC_STATEFUL, 1, 1,
1, { 0, 0, 0, 0 }, FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
{ 0, 0, 0, 0 },1, FALSE, FALSE,
{ 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } /* reserved bytes */
};
/* NULLs for algorithmic types, their tables live in ucnv_bld.c */