ICU-2235 initial icu data swapping code

X-SVN-Rev: 12797
This commit is contained in:
Markus Scherer 2003-08-08 23:39:34 +00:00
parent 69dcfdd494
commit c96db994ab
20 changed files with 2069 additions and 11 deletions

11
.gitignore vendored
View File

@ -365,6 +365,17 @@ icu4c/source/tools/genuca/genuca
icu4c/source/tools/genuca/genuca.8 icu4c/source/tools/genuca/genuca.8
icu4c/source/tools/genuca/tmp icu4c/source/tools/genuca/tmp
icu4c/source/tools/icupkg.inc icu4c/source/tools/icupkg.inc
icu4c/source/tools/icuswap/*.d
icu4c/source/tools/icuswap/*.ncb
icu4c/source/tools/icuswap/*.opt
icu4c/source/tools/icuswap/*.pdb
icu4c/source/tools/icuswap/*.plg
icu4c/source/tools/icuswap/Debug
icu4c/source/tools/icuswap/Makefile
icu4c/source/tools/icuswap/Release
icu4c/source/tools/icuswap/icuswap
icu4c/source/tools/icuswap/icuswap.[0-9]
icu4c/source/tools/icuswap/tmp
icu4c/source/tools/makeconv/*.d icu4c/source/tools/makeconv/*.d
icu4c/source/tools/makeconv/*.pdb icu4c/source/tools/makeconv/*.pdb
icu4c/source/tools/makeconv/*.plg icu4c/source/tools/makeconv/*.plg

View File

@ -447,6 +447,27 @@ Package=<4>
############################################################################### ###############################################################################
Project: "icuswap"=..\tools\icuswap\icuswap.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
Begin Project Dependency
Project_Dep_Name common
End Project Dependency
Begin Project Dependency
Project_Dep_Name i18n
End Project Dependency
Begin Project Dependency
Project_Dep_Name toolutil
End Project Dependency
}}}
###############################################################################
Project: "ieeetest"=..\test\ieeetest\ieeetest.dsp - Package Owner=<4> Project: "ieeetest"=..\test\ieeetest\ieeetest.dsp - Package Owner=<4>
Package=<5> Package=<5>

View File

@ -54,7 +54,7 @@ DEFS += -DU_COMMON_IMPLEMENTATION
LIBS = $(LIBICUDT) $(DEFAULT_LIBS) LIBS = $(LIBICUDT) $(DEFAULT_LIBS)
OBJECTS = putil.o uobject.o locmap.o mutex.o umutex.o \ OBJECTS = putil.o uobject.o locmap.o mutex.o umutex.o \
udata.o ucmndata.o udatamem.o umapfile.o filestrm.o \ udata.o ucmndata.o udatamem.o udataswp.o umapfile.o filestrm.o \
uresbund.o uresdata.o resbund.o cwchar.o uloc.o locid.o uhash.o uhash_us.o \ uresbund.o uresdata.o resbund.o cwchar.o uloc.o locid.o uhash.o uhash_us.o \
ucnv.o ucnv_bld.o ucnv_cb.o ucnv_cnv.o ucnv_err.o ucnv_io.o ucnvlat1.o \ ucnv.o ucnv_bld.o ucnv_cb.o ucnv_cnv.o ucnv_err.o ucnv_io.o ucnvlat1.o \
ucnv_u7.o ucnv_u8.o ucnv_u16.o ucnv_u32.o \ ucnv_u7.o ucnv_u8.o ucnv_u16.o ucnv_u32.o \

View File

@ -3318,6 +3318,14 @@ SOURCE=.\punycode.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\udataswp.c
# End Source File
# Begin Source File
SOURCE=.\udataswp.h
# End Source File
# Begin Source File
SOURCE=.\uidna.cpp SOURCE=.\uidna.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@ -838,6 +838,12 @@
<File <File
RelativePath=".\udatamem.h"> RelativePath=".\udatamem.h">
</File> </File>
<File
RelativePath=".\udataswp.c">
</File>
<File
RelativePath=".\udataswp.h">
</File>
<File <File
RelativePath=".\umapfile.c"> RelativePath=".\umapfile.c">
<FileConfiguration <FileConfiguration

View File

@ -58,6 +58,17 @@ uprv_toupper(char c) {
return c; return c;
} }
#if 0
/*
* Commented out because cstring.h defines uprv_tolower() to be
* the same as either uprv_asciitolower() or uprv_ebcdictolower()
* to reduce the amount of code to cover with tests.
*
* Note that this uprv_tolower() definition is likely to work for most
* charset families, not just ASCII and EBCDIC, because its #else branch
* is written generically.
*/
U_CAPI char U_EXPORT2 U_CAPI char U_EXPORT2
uprv_tolower(char c) { uprv_tolower(char c) {
#if U_CHARSET_FAMILY==U_EBCDIC_FAMILY #if U_CHARSET_FAMILY==U_EBCDIC_FAMILY
@ -71,6 +82,23 @@ uprv_tolower(char c) {
#endif #endif
return c; return c;
} }
#endif
U_CAPI char U_EXPORT2
uprv_asciitolower(char c) {
if(0x41<=c && c<=0x5a) {
c=(char)(c+0x20);
}
return c;
}
U_CAPI char U_EXPORT2
uprv_ebcdictolower(char c) {
if((0xc1<=c && c<=0xc9) || (0xd1<=c && c<=0xd9) || (0xe2<=c && c<=0xe9)) {
c=(char)(c-0x40);
}
return c;
}
U_CAPI char* U_EXPORT2 U_CAPI char* U_EXPORT2

View File

@ -45,8 +45,21 @@
U_CAPI char U_EXPORT2 U_CAPI char U_EXPORT2
uprv_toupper(char c); uprv_toupper(char c);
U_CAPI char U_EXPORT2 U_CAPI char U_EXPORT2
uprv_tolower(char c); uprv_asciitolower(char c);
U_CAPI char U_EXPORT2
uprv_ebcdictolower(char c);
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
# define uprv_tolower uprv_asciitolower
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
# define uprv_tolower uprv_ebcdictolower
#else
# error U_CHARSET_FAMILY is not valid
#endif
#define uprv_strtoul(str, end, base) U_STANDARD_CPP_NAMESPACE strtoul(str, end, base) #define uprv_strtoul(str, end, base) U_STANDARD_CPP_NAMESPACE strtoul(str, end, base)
#define uprv_strtol(str, end, base) U_STANDARD_CPP_NAMESPACE strtol(str, end, base) #define uprv_strtol(str, end, base) U_STANDARD_CPP_NAMESPACE strtol(str, end, base)

View File

@ -65,12 +65,14 @@
/* include ICU headers */ /* include ICU headers */
#include "unicode/utypes.h" #include "unicode/utypes.h"
#include "unicode/putil.h" #include "unicode/putil.h"
#include "unicode/ustring.h"
#include "uassert.h" #include "uassert.h"
#include "umutex.h" #include "umutex.h"
#include "cmemory.h" #include "cmemory.h"
#include "cstring.h" #include "cstring.h"
#include "locmap.h" #include "locmap.h"
#include "ucln_cmn.h" #include "ucln_cmn.h"
#include "udataswp.h"
/* Include standard headers. */ /* Include standard headers. */
#include <stdio.h> #include <stdio.h>
@ -1899,6 +1901,8 @@ uprv_getDefaultCodepage()
#endif #endif
} }
/* invariant-character handling --------------------------------------------- */
/* /*
* These maps for ASCII to/from EBCDIC map invariant characters (see utypes.h) * These maps for ASCII to/from EBCDIC map invariant characters (see utypes.h)
* appropriately for most EBCDIC codepages. * appropriately for most EBCDIC codepages.
@ -2140,7 +2144,174 @@ uprv_isInvariantUString(const UChar *s, int32_t length) {
return TRUE; return TRUE;
} }
/* end of platform-specific implementation */ /* UDataSwapFn implementations used in udataswp.c ------- */
U_CFUNC int32_t
uprv_ebcdicFromAscii(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
const uint8_t *s;
uint8_t *t;
uint8_t c;
int32_t count;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData!=NULL) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* setup and swapping */
s=(const uint8_t *)inData;
t=(uint8_t *)outData;
count=length;
while(count>0) {
c=*s++;
if(!CHAR_IS_INVARIANT(c)) {
*pErrorCode=U_INVALID_CHAR_FOUND;
return 0;
}
*t++=ebcdicFromAscii[c];
--count;
}
return length;
}
U_CFUNC int32_t
uprv_asciiFromEbcdic(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
const uint8_t *s;
uint8_t *t;
uint8_t c;
int32_t count;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData!=NULL) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* setup and swapping */
s=(const uint8_t *)inData;
t=(uint8_t *)outData;
count=length;
while(count>0) {
c=*s++;
if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !CHAR_IS_INVARIANT(c))) {
*pErrorCode=U_INVALID_CHAR_FOUND;
return 0;
}
*t++=c;
--count;
}
return length;
}
/* compare invariant strings; variant characters compare less than others and unlike each other */
U_CFUNC int32_t
uprv_compareInvAscii(const UDataSwapper *ds,
const char *inString, int32_t inLength,
const UChar *localString, int32_t localLength) {
int32_t minLength;
UChar32 c1, c2;
char c;
if(inString==NULL || inLength<-1 || localString==NULL || localLength<-1) {
return 0;
}
if(inLength<0) {
inLength=uprv_strlen(inString);
}
if(localLength<0) {
localLength=u_strlen(localString);
}
minLength= inLength<localLength ? inLength : localLength;
while(minLength>0) {
c=*inString++;
if(CHAR_IS_INVARIANT(c)) {
c1=c;
} else {
c1=-1;
}
c2=*localString++;
if(!CHAR_IS_INVARIANT(c2)) {
c1=-2;
}
if((c1-=c2)!=0) {
return c1;
}
--minLength;
}
/* strings start with same prefix, compare lengths */
return inLength-localLength;
}
U_CFUNC int32_t
uprv_compareInvEbcdic(const UDataSwapper *ds,
const char *inString, int32_t inLength,
const UChar *localString, int32_t localLength) {
int32_t minLength;
UChar32 c1, c2;
char c;
if(inString==NULL || inLength<-1 || localString==NULL || localLength<-1) {
return 0;
}
if(inLength<0) {
inLength=uprv_strlen(inString);
}
if(localLength<0) {
localLength=u_strlen(localString);
}
minLength= inLength<localLength ? inLength : localLength;
while(minLength>0) {
c=*inString++;
if(c==0) {
c1=0;
} else if((c1=asciiFromEbcdic[(uint8_t)c])!=0 && CHAR_IS_INVARIANT(c1)) {
/* c1 is set */
} else {
c1=-1;
}
c2=*localString++;
if(!CHAR_IS_INVARIANT(c2)) {
c1=-2;
}
if((c1-=c2)!=0) {
return c1;
}
--minLength;
}
/* strings start with same prefix, compare lengths */
return inLength-localLength;
}
/* end of platform-specific implementation -------------- */
/* version handling --------------------------------------------------------- */
U_CAPI void U_EXPORT2 U_CAPI void U_EXPORT2
u_versionFromString(UVersionInfo versionArray, const char *versionString) { u_versionFromString(UVersionInfo versionArray, const char *versionString) {

View File

@ -341,18 +341,36 @@ static uint32_t getTagNumber(const char *tagname) {
/* @see ucnv_compareNames */ /* @see ucnv_compareNames */
U_CFUNC char * U_EXPORT2 U_CFUNC char * U_EXPORT2
ucnv_io_stripForCompare(char *dst, const char *name) { ucnv_io_stripASCIIForCompare(char *dst, const char *name) {
char c1 = *name; char c1 = *name;
char *dstItr = dst; char *dstItr = dst;
while (c1) { while (c1) {
/* Ignore delimiters '-', '_', and ' ' */ /* Ignore delimiters '-', '_', and ' ' */
while ((c1 = *name) == '-' || c1 == '_' || c1 == ' ') { while ((c1 = *name) == 0x2d || c1 == 0x5f || c1 == 0x20) {
++name; ++name;
} }
/* lowercase for case-insensitive comparison */ /* lowercase for case-insensitive comparison */
*(dstItr++) = uprv_tolower(c1); *(dstItr++) = uprv_asciitolower(c1);
++name;
}
return dst;
}
U_CFUNC char * U_EXPORT2
ucnv_io_stripEBCDICForCompare(char *dst, const char *name) {
char c1 = *name;
char *dstItr = dst;
while (c1) {
/* Ignore delimiters '-', '_', and ' ' */
while ((c1 = *name) == 0x60 || c1 == 0x6d || c1 == 0x40) {
++name;
}
/* lowercase for case-insensitive comparison */
*(dstItr++) = uprv_ebcdictolower(c1);
++name; ++name;
} }
return dst; return dst;

View File

@ -21,14 +21,26 @@
#define UCNV_NUM_HIDDEN_TAGS 1 #define UCNV_NUM_HIDDEN_TAGS 1
/** /**
* \var ucnv_io_stripForCompare
* Remove the underscores, dashes and spaces from the name, and convert * Remove the underscores, dashes and spaces from the name, and convert
* the name to lower case. * the name to lower case.
* @param dst The destination buffer, which is <= the buffer of name. * @param dst The destination buffer, which is <= the buffer of name.
* @param dst The destination buffer, which is <= the buffer of name. * @param dst The destination buffer, which is <= the buffer of name.
* @return the destination buffer. * @return the destination buffer.
*/ */
#if U_CHARSET_FAMILY==U_ASCII_FAMILY
# define ucnv_io_stripForCompare ucnv_io_stripASCIIForCompare
#elif U_CHARSET_FAMILY==U_EBCDIC_FAMILY
# define ucnv_io_stripForCompare ucnv_io_stripEBCDICForCompare
#else
# error U_CHARSET_FAMILY is not valid
#endif
U_CFUNC char * U_EXPORT2 U_CFUNC char * U_EXPORT2
ucnv_io_stripForCompare(char *dst, const char *name); ucnv_io_stripASCIIForCompare(char *dst, const char *name);
U_CFUNC char * U_EXPORT2
ucnv_io_stripEBCDICForCompare(char *dst, const char *name);
/** /**
* Map a converter alias name to a canonical converter name. * Map a converter alias name to a canonical converter name.

View File

@ -0,0 +1,326 @@
/*
*******************************************************************************
*
* Copyright (C) 2003, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: udataswp.c
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2003jun05
* created by: Markus W. Scherer
*
* Definitions for ICU data transformations for different platforms,
* changing between big- and little-endian data and/or between
* charset families (ASCII<->EBCDIC).
*/
#include <stdarg.h>
#include "unicode/utypes.h"
#include "unicode/udata.h" /* UDataInfo */
#include "ucmndata.h" /* DataHeader */
#include "cmemory.h"
#include "udataswp.h"
/* swapping primitives ------------------------------------------------------ */
/* generic noop swapper for when nothing needs to be done */
static int32_t U_CALLCONV
uprv_swapNone(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
if(ds==NULL || inData==NULL || length<0 || outData==NULL) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
if(length>0 && inData!=outData) {
uprv_memcpy(outData, inData, length);
}
return length;
}
static int32_t U_CALLCONV
uprv_swapArray16(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
const uint16_t *p;
uint16_t *q;
int32_t count;
uint16_t x;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
if(ds==NULL || inData==NULL || length<0 || (length&1)!=0 || outData==NULL) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* setup and swapping */
p=(const uint16_t *)inData;
q=(uint16_t *)outData;
count=length/2;
while(count>0) {
x=*p++;
*q++=(uint16_t)((x<<8)|(x>>8));
--count;
}
return length;
}
static int32_t U_CALLCONV
uprv_swapArray32(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
const uint32_t *p;
uint32_t *q;
int32_t count;
uint32_t x;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
if(ds==NULL || inData==NULL || length<0 || (length&3)!=0 || outData==NULL) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* setup and swapping */
p=(const uint32_t *)inData;
q=(uint32_t *)outData;
count=length/4;
while(count>0) {
x=*p++;
*q++=(uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
--count;
}
return length;
}
static uint16_t U_CALLCONV
uprv_readSwapUInt16(uint16_t x) {
return (uint16_t)((x<<8)|(x>>8));
}
static uint16_t U_CALLCONV
uprv_readDirectUInt16(uint16_t x) {
return x;
}
static uint32_t U_CALLCONV
uprv_readSwapUInt32(uint32_t x) {
return (uint32_t)((x<<24)|((x<<8)&0xff0000)|((x>>8)&0xff00)|(x>>24));
}
static uint32_t U_CALLCONV
uprv_readDirectUInt32(uint32_t x) {
return x;
}
U_CAPI int16_t U_EXPORT2
udata_readInt16(const UDataSwapper *ds, int16_t x) {
return (int16_t)ds->readUInt16((uint16_t)x);
}
U_CAPI int32_t U_EXPORT2
udata_readInt32(const UDataSwapper *ds, int32_t x) {
return (int32_t)ds->readUInt32((uint32_t)x);
}
U_CAPI void U_EXPORT2
udata_printError(const UDataSwapper *ds,
const char *fmt,
...) {
va_list args;
if(ds->printError!=NULL) {
va_start(args, fmt);
ds->printError(ds->printErrorContext, fmt, args);
va_end(args);
}
}
/* swap a data header ------------------------------------------------------- */
U_CAPI int32_t U_EXPORT2
udata_swapDataHeader(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
const DataHeader *pHeader;
uint16_t headerSize, infoSize;
/* argument checking */
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
if(ds==NULL || inData==NULL || length<-1 || (length>0 && outData==NULL)) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return 0;
}
/* check minimum length and magic bytes */
pHeader=(const DataHeader *)inData;
if( (length>=0 && length<sizeof(DataHeader)) ||
pHeader->dataHeader.magic1!=0xda ||
pHeader->dataHeader.magic2!=0x27 ||
pHeader->info.sizeofUChar!=2
) {
*pErrorCode=U_UNSUPPORTED_ERROR;
return 0;
}
headerSize=ds->readUInt16(pHeader->dataHeader.headerSize);
infoSize=ds->readUInt16(pHeader->info.size);
if( headerSize<sizeof(DataHeader) ||
infoSize<sizeof(UDataInfo) ||
headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
(length>=0 && length<headerSize)
) {
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
if(length>0) {
DataHeader *outHeader;
const char *s;
int32_t maxLength;
/* Most of the fields are just bytes and need no swapping. */
if(inData!=outData) {
uprv_memcpy(outData, inData, headerSize);
}
outHeader=(DataHeader *)outData;
/* swap headerSize */
ds->swapArray16(ds, &pHeader->dataHeader.headerSize, 2, &outHeader->dataHeader.headerSize, pErrorCode);
/* swap UDataInfo size and reservedWord */
ds->swapArray16(ds, &pHeader->info.size, 4, &outHeader->info.size, pErrorCode);
/* swap copyright statement after the UDataInfo */
infoSize+=sizeof(pHeader->dataHeader);
s=(const char *)inData+infoSize;
maxLength=headerSize-infoSize;
/* get the length of the string */
for(length=0; length<maxLength && s[length]!=0; ++length) {}
/* swap the string contents */
ds->swapInvChars(ds, s, length, (char *)outData+infoSize, pErrorCode);
}
return headerSize;
}
/* API functions ------------------------------------------------------------ */
U_CAPI UDataSwapper * U_EXPORT2
udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset,
UBool outIsBigEndian, uint8_t outCharset,
UErrorCode *pErrorCode) {
UDataSwapper *swapper;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return NULL;
}
if(inCharset>U_EBCDIC_FAMILY || outCharset>U_EBCDIC_FAMILY) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
/* allocate the swapper */
swapper=uprv_malloc(sizeof(UDataSwapper));
if(swapper==NULL) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return NULL;
}
uprv_memset(swapper, 0, sizeof(UDataSwapper));
/* set values and functions pointers according to in/out parameters */
swapper->inIsBigEndian=inIsBigEndian;
swapper->inCharset=inCharset;
swapper->outIsBigEndian=outIsBigEndian;
swapper->outCharset=outCharset;
swapper->readUInt16= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt16 : uprv_readSwapUInt16;
swapper->readUInt32= inIsBigEndian==U_IS_BIG_ENDIAN ? uprv_readDirectUInt32 : uprv_readSwapUInt32;
swapper->compareInvChars= inCharset==U_ASCII_FAMILY ? uprv_compareInvAscii : uprv_compareInvEbcdic;
swapper->swapArray16= inIsBigEndian==outIsBigEndian ? uprv_swapNone : uprv_swapArray16;
swapper->swapArray32= inIsBigEndian==outIsBigEndian ? uprv_swapNone : uprv_swapArray32;
swapper->swapInvChars=
inCharset==outCharset ? uprv_swapNone :
inCharset==U_ASCII_FAMILY ? uprv_ebcdicFromAscii :
uprv_asciiFromEbcdic;
return swapper;
}
U_CAPI UDataSwapper * U_EXPORT2
udata_openSwapperForInputData(const void *data, int32_t length,
UBool outIsBigEndian, uint8_t outCharset,
UErrorCode *pErrorCode) {
const DataHeader *pHeader;
uint16_t headerSize, infoSize;
UBool inIsBigEndian;
int8_t inCharset;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return NULL;
}
if( data==NULL ||
(length>=0 && length<sizeof(DataHeader)) ||
outCharset>U_EBCDIC_FAMILY
) {
*pErrorCode=U_ILLEGAL_ARGUMENT_ERROR;
return NULL;
}
pHeader=(const DataHeader *)data;
if( (length>=0 && length<sizeof(DataHeader)) ||
pHeader->dataHeader.magic1!=0xda ||
pHeader->dataHeader.magic2!=0x27 ||
pHeader->info.sizeofUChar!=2
) {
*pErrorCode=U_UNSUPPORTED_ERROR;
return 0;
}
inIsBigEndian=(UBool)pHeader->info.isBigEndian;
inCharset=pHeader->info.charsetFamily;
if(inIsBigEndian==U_IS_BIG_ENDIAN) {
headerSize=pHeader->dataHeader.headerSize;
infoSize=pHeader->info.size;
} else {
headerSize=uprv_readSwapUInt16(pHeader->dataHeader.headerSize);
infoSize=uprv_readSwapUInt16(pHeader->info.size);
}
if( headerSize<sizeof(DataHeader) ||
infoSize<sizeof(UDataInfo) ||
headerSize<(sizeof(pHeader->dataHeader)+infoSize) ||
(length>=0 && length<headerSize)
) {
*pErrorCode=U_UNSUPPORTED_ERROR;
return 0;
}
return udata_openSwapper(inIsBigEndian, inCharset, outIsBigEndian, outCharset, pErrorCode);
}
U_CAPI void U_EXPORT2
udata_closeSwapper(UDataSwapper *ds) {
uprv_free(ds);
}

View File

@ -0,0 +1,268 @@
/*
*******************************************************************************
*
* Copyright (C) 2003, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: udataswp.h
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2003jun05
* created by: Markus W. Scherer
*
* Definitions for ICU data transformations for different platforms,
* changing between big- and little-endian data and/or between
* charset families (ASCII<->EBCDIC).
*/
#ifndef __UDATASWP_H__
#define __UDATASWP_H__
#include <stdarg.h>
#include "unicode/utypes.h"
/* forward declaration */
struct UDataSwapper;
typedef struct UDataSwapper UDataSwapper;
/*
* ### TODO Issues
*
* - should each swap function check all input parameters?
* - see if inData==outData can be allowed without major problems
* - cnvalias.dat needs to sort outData char * strings with
* the output charset family version of ucnv_io.c/ucnv_compareNames()
* - resource bundle swapping (in common) needs to call collation swapping
* (in i18n) for collation binaries
*/
/**
* Function type for data transformation.
* Transforms data, or just returns the length of the data if
* the input length is -1.
* Swap functions assume that their data pointers are aligned properly.
*
* @param ds Pointer to UDataSwapper containing global data about the
* transformation and function pointers for handling primitive
* types.
* @param inData Pointer to the input data to be transformed or examined.
* @param length Length of the data, counting bytes. May be -1 for preflighting.
* If length>=0, then transform the data.
* If length==-1, then only determine the length of the data.
* The length cannot be determined from the data itself for all
* types of data (e.g., not for simple arrays of integers).
* @param outData Pointer to the output data buffer.
* If length>=0 (transformation), then the output buffer must
* have a capacity of at least length.
* If length==-1, then outData will not be used and can be NULL.
* @param pErrorCode ICU UErrorCode parameter, must not be NULL and must
* fulfill U_SUCCESS on input.
* @return The actual length of the data.
*
* @see UDataSwapper
* @draft ICU 2.8
*/
typedef int32_t U_CALLCONV
UDataSwapFn(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode);
/**
* Convert one uint16_t from input to platform endianness.
* @draft ICU 2.8
*/
typedef uint16_t U_CALLCONV
UDataReadUInt16(uint16_t x);
/**
* Convert one uint32_t from input to platform endianness.
* @draft ICU 2.8
*/
typedef uint32_t U_CALLCONV
UDataReadUInt32(uint32_t x);
/**
* Compare invariant-character strings, one in the input data and the
* other one caller-provided in Unicode.
* You can use -1 for the length parameters of NUL-terminated strings as usual.
* Returns Unicode code point order for invariant characters.
* @draft ICU 2.8
*/
typedef int32_t U_CALLCONV
UDataCompareInvChars(const UDataSwapper *ds,
const char *inString, int32_t inLength,
const UChar *localString, int32_t localLength);
/**
* Function for message output when an error occurs during data swapping.
* A format string and variable number of arguments are passed
* like for vprintf().
*
* @param context A function-specific context pointer.
* @param fmt The format string.
* @param args The arguments for format string inserts.
*
* @draft ICU 2.8
*/
typedef void U_CALLCONV
UDataPrintError(void *context, const char *fmt, va_list args);
struct UDataSwapper {
/** Input endianness. @draft ICU 2.8 */
UBool inIsBigEndian;
/** Input charset family. @see U_CHARSET_FAMILY @draft ICU 2.8 */
uint8_t inCharset;
/** Output endianness. @draft ICU 2.8 */
UBool outIsBigEndian;
/** Output charset family. @see U_CHARSET_FAMILY @draft ICU 2.8 */
uint8_t outCharset;
/* basic functions for reading data values */
/** Convert one uint16_t from input to platform endianness. @draft ICU 2.8 */
UDataReadUInt16 *readUInt16;
/** Convert one uint32_t from input to platform endianness. @draft ICU 2.8 */
UDataReadUInt32 *readUInt32;
/** Compare invariant-character strings. @draft ICU 2.8 */
UDataCompareInvChars *compareInvChars;
/* basic functions for data transformations */
/** Transform an array of 16-bit integers. @draft ICU 2.8 */
UDataSwapFn *swapArray16;
/** Transform an array of 32-bit integers. @draft ICU 2.8 */
UDataSwapFn *swapArray32;
/** Transform an invariant-character string. @draft ICU 2.8 */
UDataSwapFn *swapInvChars;
/**
* Function for message output when an error occurs during data swapping.
* Can be NULL.
* @draft ICU 2.8
*/
UDataPrintError *printError;
/** Context pointer for printError. @draft ICU 2.8 */
void *printErrorContext;
};
U_CAPI UDataSwapper * U_EXPORT2
udata_openSwapper(UBool inIsBigEndian, uint8_t inCharset,
UBool outIsBigEndian, uint8_t outCharset,
UErrorCode *pErrorCode);
/**
* Open a UDataSwapper for the given input data and the specified output
* characteristics.
* Values of -1 for any of the characteristics mean the local platform's
* characteristics.
*
* @see udata_swap
* @draft ICU 2.8
*/
U_CAPI UDataSwapper * U_EXPORT2
udata_openSwapperForInputData(const void *data, int32_t length,
UBool outIsBigEndian, uint8_t outCharset,
UErrorCode *pErrorCode);
U_CAPI void U_EXPORT2
udata_closeSwapper(UDataSwapper *ds);
/**
* Read the beginning of an ICU data piece, recognize magic bytes,
* swap the structure.
* Set a U_UNSUPPORTED_ERROR if it does not look like an ICU data piece.
*
* @return The size of the data header, in bytes.
*
* @draft ICU 2.8
*/
U_CAPI int32_t U_EXPORT2
udata_swapDataHeader(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode);
U_CAPI int16_t U_EXPORT2
udata_readInt16(const UDataSwapper *ds, int16_t x);
U_CAPI int32_t U_EXPORT2
udata_readInt32(const UDataSwapper *ds, int32_t x);
U_CAPI void U_EXPORT2
udata_printError(const UDataSwapper *ds,
const char *fmt,
...);
/* internal exports from putil.c -------------------------------------------- */
/* declared here to keep them out of the public putil.h */
/**
* Swap invariant char * strings ASCII->EBCDIC.
* @internal
*/
U_CFUNC int32_t
uprv_ebcdicFromAscii(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode);
/**
* Swap invariant char * strings EBCDIC->ASCII.
* @internal
*/
U_CFUNC int32_t
uprv_asciiFromEbcdic(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode);
/**
* Compare ASCII invariant char * with Unicode invariant UChar *
* @internal
*/
U_CFUNC int32_t
uprv_compareInvAscii(const UDataSwapper *ds,
const char *inString, int32_t inLength,
const UChar *localString, int32_t localLength);
/**
* Compare EBCDIC invariant char * with Unicode invariant UChar *
* @internal
*/
U_CFUNC int32_t
uprv_compareInvEbcdic(const UDataSwapper *ds,
const char *inString, int32_t inLength,
const UChar *localString, int32_t localLength);
/* material... -------------------------------------------------------------- */
#if 0
/* udata.h */
/**
* Public API function in udata.c
*
* Same as udata_openChoice() but automatically swaps the data.
* isAcceptable, if not NULL, may accept data with endianness and charset family
* different from the current platform's properties.
* If the data is acceptable and the platform properties do not match, then
* the swap function is called to swap an allocated version of the data.
* Preflighting may or may not be performed depending on whether the size of
* the loaded data item is known.
*
* @param isAcceptable Same as for udata_openChoice(). May be NULL.
*
* @draft ICU 2.8
*/
U_CAPI UDataMemory * U_EXPORT2
udata_openSwap(const char *path, const char *type, const char *name,
UDataMemoryIsAcceptable *isAcceptable, void *isAcceptableContext,
UDataSwapFn *swap,
UDataPrintError *printError, void *printErrorContext,
UErrorCode *pErrorCode);
#endif
#endif

View File

@ -596,7 +596,6 @@
#define ucnv_io_getConverterName ucnv_io_getConverterName_2_6 #define ucnv_io_getConverterName ucnv_io_getConverterName_2_6
#define ucnv_io_getDefaultConverterName ucnv_io_getDefaultConverterName_2_6 #define ucnv_io_getDefaultConverterName ucnv_io_getDefaultConverterName_2_6
#define ucnv_io_setDefaultConverterName ucnv_io_setDefaultConverterName_2_6 #define ucnv_io_setDefaultConverterName ucnv_io_setDefaultConverterName_2_6
#define ucnv_io_stripForCompare ucnv_io_stripForCompare_2_6
#define ucnv_isAmbiguous ucnv_isAmbiguous_2_6 #define ucnv_isAmbiguous ucnv_isAmbiguous_2_6
#define ucnv_open ucnv_open_2_6 #define ucnv_open ucnv_open_2_6
#define ucnv_openAllNames ucnv_openAllNames_2_6 #define ucnv_openAllNames ucnv_openAllNames_2_6
@ -967,7 +966,6 @@
#define uprv_strdup uprv_strdup_2_6 #define uprv_strdup uprv_strdup_2_6
#define uprv_strtod uprv_strtod_2_6 #define uprv_strtod uprv_strtod_2_6
#define uprv_timezone uprv_timezone_2_6 #define uprv_timezone uprv_timezone_2_6
#define uprv_tolower uprv_tolower_2_6
#define uprv_toupper uprv_toupper_2_6 #define uprv_toupper uprv_toupper_2_6
#define uprv_trunc uprv_trunc_2_6 #define uprv_trunc uprv_trunc_2_6
#define uprv_tzname uprv_tzname_2_6 #define uprv_tzname uprv_tzname_2_6

View File

@ -20,8 +20,11 @@
*/ */
#include "unicode/utypes.h" #include "unicode/utypes.h"
#include "cstring.h"
#include "unicode/udata.h" #include "unicode/udata.h"
#include "cmemory.h"
#include "cstring.h"
#include "uarrsort.h"
#include "udataswp.h"
#include "uresdata.h" #include "uresdata.h"
#include "uresimp.h" #include "uresimp.h"
@ -414,3 +417,430 @@ res_getTableSize(const ResourceData *pResData, Resource table) {
uint16_t *p=(uint16_t *)RES_GET_POINTER(pResData->pRoot, table); uint16_t *p=(uint16_t *)RES_GET_POINTER(pResData->pRoot, table);
return *p; return *p;
} }
/* resource bundle swapping ------------------------------------------------- */
/*
* Need to always enumerate the entire item tree,
* track the lowest address of any item to use as the limit for char keys[],
* track the highest address of any item to return the size of the data.
*
* We should have thought of storing those in the data...
* It is possible to extend the data structure by putting additional values
* in places that are inaccessible by ordinary enumeration of the item tree.
* For example, additional integers could be stored at the beginning or
* end of the key strings; this could be indicated by a minor version number,
* and the data swapping would have to know about these values.
*
* The data structure does not forbid keys to be shared, so we must swap
* all keys once instead of each key when it is referenced.
*
* These swapping functions assume that a resource bundle always has a length
* that is a multiple of 4 bytes.
* Currently, this is trivially true because genrb writes bundle tree leaves
* physically first, before their branches, so that the root table with its
* array of resource items (uint32_t values) is always last.
*/
/* definitions for table sorting ------------------------ */
/*
* row of a temporary array
*
* gets platform-endian key string indexes and sorting indexes;
* after sorting this array by keys, the actual key/value arrays are permutated
* according to the sorting indexes
*
* TODO if and when we add another table type with 32-bit key string indexes,
* widen both values here to int32_t's
*/
typedef struct Row {
uint16_t keyIndex, sortIndex;
} Row;
static int32_t
ures_compareRows(const void *context, const void *left, const void *right) {
const char *keyChars=(const char *)context;
return (int32_t)uprv_strcmp(keyChars+((const Row *)left)->keyIndex,
keyChars+((const Row *)right)->keyIndex);
}
typedef struct TempTable {
const char *keyChars;
Row *rows;
int32_t *resort;
} TempTable;
enum {
STACK_ROW_CAPACITY=200
};
/*
* preflight one resource item and set bottom and top values;
* length, bottom, and top count Resource item offsets (4 bytes each), not bytes
*/
static void
ures_preflightResource(const UDataSwapper *ds,
const Resource *inBundle, int32_t length,
Resource res,
int32_t *pBottom, int32_t *pTop, int32_t *pMaxTableLength,
UErrorCode *pErrorCode) {
const Resource *p;
int32_t offset;
if(res==0 || RES_GET_TYPE(res)==URES_INT) {
/* empty string or integer, nothing to do */
return;
}
/* all other types use an offset to point to their data */
offset=(int32_t)RES_GET_OFFSET(res);
if(0<=length && length<=offset) {
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return;
} else if(offset<*pBottom) {
*pBottom=offset;
}
p=inBundle+offset;
switch(RES_GET_TYPE(res)) {
case URES_ALIAS:
/* physically same value layout as string, fall through */
case URES_STRING:
/* top=offset+1+(string length +1)/2 rounded up */
offset+=1+((udata_readInt32(ds, (int32_t)*p)+1)+1)/2;
break;
case URES_BINARY:
/* top=offset+1+(binary length)/4 rounded up */
offset+=1+(udata_readInt32(ds, (int32_t)*p)+3)/4;
break;
case URES_TABLE:
{
const uint16_t *pKey;
Resource item;
int32_t count;
/* get table item count */
pKey=(const uint16_t *)p;
count=ds->readUInt16(*pKey++);
if(count>*pMaxTableLength) {
*pMaxTableLength=count;
}
/* top=((1+ table item count)/2 rounded up)+(table item count) */
offset+=((1+count)+1)/2;
p=inBundle+offset; /* pointer to table resources */
offset+=count;
/* recurse */
if(offset<=length && count>0) {
do {
item=ds->readUInt32(*p++);
ures_preflightResource(ds, inBundle, length, item,
pBottom, pTop, pMaxTableLength,
pErrorCode);
} while(U_SUCCESS(*pErrorCode) && --count>0);
}
}
break;
case URES_ARRAY:
{
Resource item;
int32_t count;
/* top=offset+1+(array length) */
count=udata_readInt32(ds, (int32_t)*p++);
offset+=1+count;
/* recurse */
if(offset<=length && count>0) {
do {
item=ds->readUInt32(*p++);
ures_preflightResource(ds, inBundle, length, item,
pBottom, pTop, pMaxTableLength,
pErrorCode);
} while(U_SUCCESS(*pErrorCode) && --count>0);
}
}
break;
case URES_INT_VECTOR:
/* top=offset+1+(vector length) */
offset+=1+udata_readInt32(ds, (int32_t)*p);
break;
default:
/* also catches RES_BOGUS */
*pErrorCode=U_UNSUPPORTED_ERROR;
break;
}
if(U_FAILURE(*pErrorCode)) {
/* nothing to do */
} else if(0<=length && length<offset) {
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
} else if(offset>*pTop) {
*pTop=offset;
}
}
/*
* swap one resource item
* since preflighting succeeded, we need not check offsets against length any more
*/
static void
ures_swapResource(const UDataSwapper *ds,
const Resource *inBundle, Resource *outBundle,
Resource res, /* caller swaps res itself */
TempTable *pTempTable,
UErrorCode *pErrorCode) {
const Resource *p;
Resource *q;
int32_t offset, count;
if(res==0 || RES_GET_TYPE(res)==URES_INT) {
/* empty string or integer, nothing to do */
return;
}
/* all other types use an offset to point to their data */
offset=(int32_t)RES_GET_OFFSET(res);
p=inBundle+offset;
q=outBundle+offset;
switch(RES_GET_TYPE(res)) {
case URES_ALIAS:
/* physically same value layout as string, fall through */
case URES_STRING:
count=udata_readInt32(ds, (int32_t)*p);
/* swap length */
ds->swapArray32(ds, p, 4, q, pErrorCode);
/* swap each UChar (the terminating NUL would not change) */
ds->swapArray16(ds, p+1, 2*count, q+1, pErrorCode);
break;
case URES_BINARY:
/* swap length */
ds->swapArray32(ds, p, 4, q, pErrorCode);
/* no need to swap or copy bytes - ures_swap() copied them all */
break;
case URES_TABLE:
{
const uint16_t *pKey;
uint16_t *qKey;
Resource item;
int32_t i, oldIndex;
/* get table item count */
pKey=(const uint16_t *)p;
qKey=(uint16_t *)q;
count=ds->readUInt16(*pKey);
/* swap count */
ds->swapArray16(ds, pKey++, 2, qKey++, pErrorCode);
if(count==0) {
break;
}
offset+=((1+count)+1)/2;
p=inBundle+offset; /* pointer to table resources */
q=outBundle+offset;
/* recurse */
for(i=0; U_SUCCESS(*pErrorCode) && i<count; ++i) {
item=ds->readUInt32(p[i]);
/*
* ### TODO detect a collation binary that is to be swapped via
* ds->compareInvChars(ds, keyChars+readUInt16(pKey[i]), "CollationElements")
* etc.
*
* use some UDataSwapFn pointer from somewhere for collation swapping
* because the common library cannot directly call into the i18n library
*/
ures_swapResource(ds, inBundle, outBundle, item, pTempTable, pErrorCode);
}
if(U_FAILURE(*pErrorCode)) {
return;
}
/*
* ### TODO optimize
* After some testing, add a test
* if(inCharset==outCharset) { only swap keys and items, do not sort; }
* else { sort/copy/swap/permutate as below; }
*/
/*
* We need to sort tables by outCharset key strings because they
* sort differently for different charset families.
* ures_swap() already set pTempTable->keyChars appropriately.
* First we set up a temporary table with the key indexes and
* sorting indexes and sort that.
* Then we permutate and copy/swap the actual values.
*/
for(i=0; i<count; ++i) {
pTempTable->rows[i].keyIndex=ds->readUInt16(pKey[i]);
pTempTable->rows[i].sortIndex=(uint16_t)i;
}
uprv_sortArray(pTempTable->rows, count, sizeof(Row),
ures_compareRows, pTempTable->keyChars,
FALSE, pErrorCode);
if(U_FAILURE(*pErrorCode)) {
return;
}
/* copy/swap/permutate items */
if(pKey!=qKey) {
for(i=0; i<count; ++i) {
oldIndex=pTempTable->rows[i].sortIndex;
ds->swapArray16(ds, pKey+oldIndex, 2, qKey+i, pErrorCode);
ds->swapArray32(ds, p+oldIndex, 4, q+i, pErrorCode);
}
} else {
/*
* If we swap in-place, then the permutation must use another
* temporary array (pTempTable->resort)
* before the results are copied to the outBundle.
*/
int32_t *r=pTempTable->resort;
uint16_t *rKey=(uint16_t *)r;
for(i=0; i<count; ++i) {
oldIndex=pTempTable->rows[i].sortIndex;
ds->swapArray16(ds, pKey+oldIndex, 2, rKey+i, pErrorCode);
}
uprv_memcpy(qKey, rKey, 2*count);
for(i=0; i<count; ++i) {
oldIndex=pTempTable->rows[i].sortIndex;
ds->swapArray32(ds, p+oldIndex, 4, r+i, pErrorCode);
}
uprv_memcpy(q, r, 4*count);
}
}
break;
case URES_ARRAY:
{
Resource item;
int32_t i;
count=udata_readInt32(ds, (int32_t)*p);
/* swap length */
ds->swapArray32(ds, p++, 4, q++, pErrorCode);
/* recurse */
for(i=0; U_SUCCESS(*pErrorCode) && i<count; ++i) {
item=ds->readUInt32(p[i]);
ures_swapResource(ds, inBundle, outBundle, item, pTempTable, pErrorCode);
}
/* swap items */
ds->swapArray32(ds, p, 4*count, q, pErrorCode);
}
break;
case URES_INT_VECTOR:
count=udata_readInt32(ds, (int32_t)*p);
/* swap length and each integer */
ds->swapArray32(ds, p, 4*(1+count), q, pErrorCode);
break;
default:
/* also catches RES_BOGUS */
*pErrorCode=U_UNSUPPORTED_ERROR;
break;
}
}
U_CAPI int32_t U_EXPORT2
ures_swap(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
const UDataInfo *pInfo;
const Resource *inBundle;
Resource rootRes;
int32_t headerSize, maxTableLength;
Row rows[STACK_ROW_CAPACITY];
int32_t resort[STACK_ROW_CAPACITY];
TempTable tempTable;
/* the following integers count Resource item offsets (4 bytes each), not bytes */
int32_t bundleLength, bottom, top;
/* udata_swapDataHeader checks the arguments */
headerSize=udata_swapDataHeader(ds, inData, length, outData, pErrorCode);
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
/* check data format and format version */
pInfo=(const UDataInfo *)((const char *)inData+4);
if(!(
pInfo->dataFormat[0]==0x52 && /* dataFormat="ResB" */
pInfo->dataFormat[1]==0x65 &&
pInfo->dataFormat[2]==0x73 &&
pInfo->dataFormat[3]==0x42 &&
pInfo->formatVersion[0]==1
)) {
*pErrorCode=U_UNSUPPORTED_ERROR;
return 0;
}
/* ### TODO add ds->printError() output where errors occur */
/* a resource bundle must contain at least one resource item */
if(length<0) {
bundleLength=-1;
} else {
bundleLength=(length-headerSize)/4;
if(bundleLength<1) {
*pErrorCode=U_INDEX_OUTOFBOUNDS_ERROR;
return 0;
}
}
/* preflight to get the bottom, top and maxTableLength values */
inBundle=(const Resource *)((const char *)inData+headerSize);
bottom=0x7fffffff;
top=maxTableLength=0;
rootRes=*inBundle;
ures_preflightResource(ds, inBundle, bundleLength, rootRes,
&bottom, &top, &maxTableLength,
pErrorCode);
if(U_FAILURE(*pErrorCode)) {
return 0;
}
if(length>=0) {
Resource *outBundle=(Resource *)((char *)outData+headerSize);
/* copy the bundle for binary and inaccessible data */
if(inData!=outData) {
uprv_memcpy(outBundle, inBundle, 4*top);
}
/* swap the key strings */
ds->swapInvChars(ds, inBundle+1, 4*(bottom-1), outBundle+1, pErrorCode);
/* allocate the temporary table for sorting resource tables */
tempTable.keyChars=(const char *)outBundle; /* sort by outCharset */
if(maxTableLength<=STACK_ROW_CAPACITY) {
tempTable.rows=rows;
tempTable.resort=resort;
} else {
tempTable.rows=(Row *)uprv_malloc(maxTableLength*sizeof(Row)+maxTableLength*4);
if(tempTable.rows==NULL) {
*pErrorCode=U_MEMORY_ALLOCATION_ERROR;
return 0;
}
tempTable.resort=(int32_t *)(tempTable.rows+maxTableLength);
}
/* swap the resources */
ures_swapResource(ds, inBundle, outBundle, rootRes, &tempTable, pErrorCode);
if(tempTable.rows!=rows) {
uprv_free(tempTable.rows);
}
/* swap the root resource */
ds->swapArray32(ds, inBundle, 4, outBundle, pErrorCode);
}
return headerSize+4*top;
}

View File

@ -1,7 +1,7 @@
/* /*
****************************************************************************** ******************************************************************************
* * * *
* Copyright (C) 1999-2002, International Business Machines * * Copyright (C) 1999-2003, International Business Machines *
* Corporation and others. All Rights Reserved. * * Corporation and others. All Rights Reserved. *
* * * *
****************************************************************************** ******************************************************************************
@ -178,4 +178,17 @@ U_CFUNC Resource res_getTableItemByIndex(const ResourceData *pResData, Resource
U_CFUNC Resource res_getTableItemByKey(const ResourceData *pResData, Resource table, int32_t *indexS, const char* * key); U_CFUNC Resource res_getTableItemByKey(const ResourceData *pResData, Resource table, int32_t *indexS, const char* * key);
U_CFUNC Resource res_findResource(const ResourceData *pResData, Resource r, const char** path, const char** key); U_CFUNC Resource res_findResource(const ResourceData *pResData, Resource r, const char** path, const char** key);
/* forward declaration */
struct UDataSwapper;
typedef struct UDataSwapper UDataSwapper;
/**
* Swap an ICU resource bundle. See udataswp.h.
* @internal
*/
U_CAPI int32_t U_EXPORT2
ures_swap(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode);
#endif #endif

View File

@ -0,0 +1,11 @@
tmp
Debug
Release
Makefile
*.d
*.pdb
icuswap
icuswap.[0-9]
*.plg
*.ncb
*.opt

View File

@ -0,0 +1,94 @@
## Makefile.in for ICU - tools/icuswap
## Copyright (c) 1999-2003, International Business Machines Corporation and
## others. All Rights Reserved.
## Steven R. Loomis
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = ../..
include $(top_builddir)/icudefs.mk
## Build directory information
subdir = tools/icuswap
##
SECTION = 8
MANX_FILES = $(TARGET:$(EXEEXT)=).$(SECTION)
ALL_MAN_FILES = $(MANX_FILES)
## Extra files to remove for 'make clean'
CLEANFILES = *~ mkmap.tmp $(DEPS) $(RES_FILES) $(TEST_FILES) $(ALL_MAN_FILES)
## Target information
TARGET = icuswap$(EXEEXT)
CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(srcdir)/../toolutil $(BIR_CPPFLAGS)
LIBS = $(LIBICUTOOLUTIL) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
OBJECTS = icuswap.o
DEPS = $(OBJECTS:.o=.d)
## List of phony targets
.PHONY : all all-local install install-local clean clean-local \
distclean distclean-local dist dist-local check \
check-local install-man install-manx
## Clear suffix list
.SUFFIXES :
## List of standard targets
all: all-local
install: install-local
clean: clean-local
distclean : distclean-local
dist: dist-local
check: all check-local
all-local: $(TARGET) $(RES_FILES) $(TRANSLIT_RES) $(TEST_FILES) $(ALL_MAN_FILES)
install-local: all-local install-man
$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
$(INSTALL) $(TARGET) $(DESTDIR)$(sbindir)/$(TARGET)
dist-local:
clean-local:
test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
$(RMV) $(TARGET) $(OBJECTS)
distclean-local: clean-local
$(RMV) Makefile
check-local: all-local
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(TARGET) : $(OBJECTS)
$(LINK.cc) $(OUTOPT)$@ $^ $(LIBS)
# man page
install-man: install-manx
install-manx: $(MANX_FILES)
$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
$(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION)
%.$(SECTION): $(srcdir)/%.$(SECTION).in
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
ifeq (,$(MAKECMDGOALS))
-include $(DEPS)
else
ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
-include $(DEPS)
endif
endif

View File

@ -0,0 +1,293 @@
/*
*******************************************************************************
*
* Copyright (C) 2003, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: icuswap.cpp
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2003aug08
* created by: Markus W. Scherer
*
* This tool takes an ICU data file and "swaps" it, that is, changes its
* platform properties between big-/little-endianness and ASCII/EBCDIC charset
* families.
* The modified data file is written to a new file.
* Useful as an install-time tool for shipping only one flavor of ICU data
* and preparing data files for the target platform.
* Will not work with data DLLs (shared libraries).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unicode/utypes.h"
#include "unicode/udata.h"
#include "udataswp.h"
#include "uresdata.h"
#include "uoptions.h"
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
static UOption options[]={
UOPTION_HELP_H,
UOPTION_HELP_QUESTION_MARK,
UOPTION_DEF("type", 't', UOPT_REQUIRES_ARG)
};
enum {
OPT_HELP_H,
OPT_HELP_QUESTION_MARK,
OPT_OUT_TYPE
};
static int32_t
fileSize(FILE *f) {
int32_t size;
fseek(f, 0, SEEK_END);
size=(int32_t)ftell(f);
fseek(f, 0, SEEK_SET);
return size;
}
/**
* Identifies and then transforms the ICU data piece in-place, or determines
* its length. See UDataSwapFn.
* This function handles .dat data packages as well as single data pieces
* and internally dispatches to per-type swap functions.
* Sets a U_UNSUPPORTED_ERROR if the data format is not recognized.
*
* @see UDataSwapFn
* @see udata_openSwapper
* @see udata_openSwapperForInputData
* @draft ICU 2.8
*/
static int32_t
udata_swap(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode);
static int
printUsage(const char *pname, UBool ishelp) {
fprintf(stderr,
"%csage: %s [ -h, -?, --help ] -tl|-tb|-te|--type=b|... infilename outfilename\n",
ishelp ? 'U' : 'u', pname);
if(ishelp) {
fprintf(stderr,
"\nOptions: -h, -?, --help print this message and exit\n"
" Read the input file, swap its platform properties according\n"
" to the -t or --type option, and write the result to the output file.\n"
" -tl change to little-endian/ASCII charset family\n"
" -tb change to little-endian/ASCII charset family\n"
" -te change to little-endian/EBCDIC charset family\n");
}
return !ishelp;
}
extern int
main(int argc, char *argv[]) {
FILE *in, *out;
const char *pname;
char *data;
int32_t length;
UBool ishelp;
int rc;
UDataSwapper *ds;
UErrorCode errorCode;
uint8_t outCharset;
UBool outIsBigEndian;
U_MAIN_INIT_ARGS(argc, argv);
/* get the program basename */
pname=strchr(argv[0], U_FILE_SEP_CHAR);
if(pname==NULL) {
pname=strchr(argv[0], '/');
}
if(pname!=NULL) {
++pname;
} else {
pname=argv[0];
}
argc=u_parseArgs(argc, argv, LENGTHOF(options), options);
ishelp=options[OPT_HELP_H].doesOccur || options[OPT_HELP_QUESTION_MARK].doesOccur;
if(ishelp || argc!=3) {
return printUsage(pname, ishelp);
}
/* parse the output type option */
data=(char *)options[OPT_OUT_TYPE].value;
if(data[0]==0 || data[1]!=0) {
/* the type must be exactly one letter */
return printUsage(pname, FALSE);
}
switch(data[0]) {
case 'l':
outIsBigEndian=FALSE;
outCharset=U_ASCII_FAMILY;
break;
case 'b':
outIsBigEndian=TRUE;
outCharset=U_ASCII_FAMILY;
break;
case 'e':
outIsBigEndian=TRUE;
outCharset=U_EBCDIC_FAMILY;
break;
default:
return printUsage(pname, FALSE);
}
in=out=NULL;
data=NULL;
/* open the input file, get its length, allocate memory for it, read the file */
in=fopen(argv[1], "rb");
if(in==NULL) {
fprintf(stderr, "%s: unable to open input file \"%s\"\n", pname, argv[1]);
rc=2;
goto done;
}
length=fileSize(in);
if(length<=0) {
fprintf(stderr, "%s: empty input file \"%s\"\n", pname, argv[1]);
rc=2;
goto done;
}
data=(char *)malloc(length);
if(data==NULL) {
fprintf(stderr, "%s: error allocating memory for \"%s\"\n", pname, argv[1]);
rc=2;
goto done;
}
if(length!=(int32_t)fread(data, 1, length, in)) {
fprintf(stderr, "%s: error reading \"%s\"\n", pname, argv[1]);
rc=3;
goto done;
}
fclose(in);
in=NULL;
/* swap the data in-place */
errorCode=U_ZERO_ERROR;
ds=udata_openSwapperForInputData(data, length, outIsBigEndian, outCharset, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "%s: udata_openSwapperForInputData(\"%s\") failed - %s\n",
pname, argv[1], u_errorName(errorCode));
rc=4;
goto done;
}
/* ### TODO set ds->printError with a simple fprintf() implementation */
length=udata_swap(ds, data, length, data, &errorCode);
udata_closeSwapper(ds);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "%s: udata_swap(\"%s\") failed - %s\n",
pname, argv[1], u_errorName(errorCode));
rc=4;
goto done;
}
out=fopen(argv[2], "wb");
if(out==NULL) {
fprintf(stderr, "%s: unable to open output file \"%s\"\n", pname, argv[2]);
rc=5;
goto done;
}
if(length!=(int32_t)fwrite(data, 1, length, out)) {
fprintf(stderr, "%s: error writing \"%s\"\n", pname, argv[2]);
rc=6;
goto done;
}
fclose(out);
out=NULL;
/* all done */
rc=0;
done:
if(in!=NULL) {
fclose(in);
}
if(out!=NULL) {
fclose(out);
}
if(data!=NULL) {
free(data);
}
return rc;
}
/* swap the data ------------------------------------------------------------ */
static const struct {
uint8_t dataFormat[4];
UDataSwapFn *swapFn;
} swapFns[]={
{ { 0x52, 0x65, 0x73, 0x42 }, ures_swap } /* dataFormat="ResB" */
};
static int32_t
udata_swap(const UDataSwapper *ds,
const void *inData, int32_t length, void *outData,
UErrorCode *pErrorCode) {
const UDataInfo *pInfo;
int32_t headerSize, i;
if(pErrorCode==NULL || U_FAILURE(*pErrorCode)) {
return 0;
}
/*
* Preflight the header first; checks for illegal arguments, too.
* Do not swap the header right away because the format-specific swapper
* will swap it, get the headerSize again, and also use the header
* information. Otherwise we would have to pass some of the information
* and not be able to use the UDataSwapFn signature.
*/
headerSize=udata_swapDataHeader(ds, inData, -1, NULL, pErrorCode);
/*
* If we wanted udata_swap() to also handle non-loadable data like a UTrie,
* then we could check here for further known magic values and structures.
*/
if(U_FAILURE(*pErrorCode)) {
return 0; /* the data format was not recognized */
}
/* dispatch to the swap function for the dataFormat */
pInfo=(const UDataInfo *)((const char *)inData+4);
for(i=0; i<LENGTHOF(swapFns); ++i) {
if(0==memcmp(swapFns[i].dataFormat, pInfo->dataFormat, 4)) {
return swapFns[i].swapFn(ds, inData, length, outData, pErrorCode);
}
}
/* the dataFormat was not recognized */
*pErrorCode=U_UNSUPPORTED_ERROR;
return 0;
}
/*
* Hey, Emacs, please set the following:
*
* Local Variables:
* indent-tabs-mode: nil
* End:
*
*/

View File

@ -0,0 +1,185 @@
# Microsoft Developer Studio Project File - Name="icuswap" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=icuswap - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "icuswap.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "icuswap.mak" CFG="icuswap - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "icuswap - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "icuswap - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE "icuswap - Win64 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "icuswap - Win64 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "icuswap - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# ADD CPP /nologo /G6 /MD /Za /W4 /GX /O2 /I "..\..\common" /I "..\toolutil" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 icuin.lib icuuc.lib icutu.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\..\lib"
# Begin Custom Build
TargetPath=.\Release\icuswap.exe
InputPath=.\Release\icuswap.exe
InputName=icuswap
SOURCE="$(InputPath)"
"..\..\..\bin\$(InputName).exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetPath) ..\..\..\bin
# End Custom Build
!ELSEIF "$(CFG)" == "icuswap - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# ADD CPP /nologo /G6 /MDd /Za /W4 /Gm /GX /ZI /Od /I "..\..\common" /I "..\toolutil" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /FD /GZ /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 icuind.lib icuucd.lib icutud.lib kernel32.lib user32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\lib"
# Begin Custom Build
TargetPath=.\Debug\icuswap.exe
InputPath=.\Debug\icuswap.exe
InputName=icuswap
SOURCE="$(InputPath)"
"..\..\..\bin\$(InputName).exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetPath) ..\..\..\bin
# End Custom Build
!ELSEIF "$(CFG)" == "icuswap - Win64 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c
# ADD CPP /nologo /MD /Za /W4 /GX /Zi /O2 /I "..\..\common" /I "..\toolutil" /D "WIN64" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "_IA64_" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /QIA64_fmaopt /Wp64 /Zm600 /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:IX86 /machine:IA64
# ADD LINK32 icuin.lib icuuc.lib icutu.lib /nologo /subsystem:console /machine:IX86 /libpath:"..\..\..\lib" /machine:IA64
# Begin Custom Build
TargetPath=.\Release\icuswap.exe
InputPath=.\Release\icuswap.exe
InputName=icuswap
SOURCE="$(InputPath)"
"..\..\..\bin\$(InputName).exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetPath) ..\..\..\bin
# End Custom Build
!ELSEIF "$(CFG)" == "icuswap - Win64 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
MTL=midl.exe
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN64" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c
# ADD CPP /nologo /MDd /Za /W4 /Gm /GX /Zi /Od /I "..\..\common" /I "..\toolutil" /D "WIN64" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "_IA64_" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FR /FD /GZ /QIA64_fmaopt /Wp64 /Zm600 /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:IX86 /pdbtype:sept /machine:IA64
# ADD LINK32 icuind.lib icuucd.lib icutud.lib kernel32.lib user32.lib /nologo /subsystem:console /incremental:no /debug /machine:IX86 /pdbtype:sept /libpath:"..\..\..\lib" /machine:IA64
# Begin Custom Build
TargetPath=.\Debug\icuswap.exe
InputPath=.\Debug\icuswap.exe
InputName=icuswap
SOURCE="$(InputPath)"
"..\..\..\bin\$(InputName).exe" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
copy $(TargetPath) ..\..\..\bin
# End Custom Build
!ENDIF
# Begin Target
# Name "icuswap - Win32 Release"
# Name "icuswap - Win32 Debug"
# Name "icuswap - Win64 Release"
# Name "icuswap - Win64 Debug"
# Begin Source File
SOURCE=.\icuswap.cpp
# End Source File
# End Target
# End Project

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="icuswap"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="2"
ImproveFloatingPointConsistency="TRUE"
AdditionalIncludeDirectories="..\..\common,..\toolutil"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
DisableLanguageExtensions="TRUE"
PrecompiledHeaderFile=".\Release/icuswap.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="4"
SuppressStartupBanner="TRUE"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"
CommandLine="copy $(TargetPath) ..\..\..\bin
"
Outputs="..\..\..\bin\$(InputName).exe"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="icuin.lib icuuc.lib icutu.lib"
OutputFile=".\Release/icuswap.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\..\lib"
ProgramDatabaseFile=".\Release/icuswap.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/icuswap.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
ImproveFloatingPointConsistency="TRUE"
OptimizeForProcessor="2"
AdditionalIncludeDirectories="..\..\common,..\toolutil"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
DisableLanguageExtensions="TRUE"
PrecompiledHeaderFile=".\Debug/icuswap.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="4"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"
CommandLine="copy $(TargetPath) ..\..\..\bin
"
Outputs="..\..\..\bin\$(InputName).exe"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="icuind.lib icuucd.lib icutud.lib"
OutputFile=".\Debug/icuswap.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\..\..\lib"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/icuswap.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/icuswap.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\icuswap.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
</Filter>
<Filter
Name="Resource Files"
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>