ICU-1992 data packaging changes

X-SVN-Rev: 9223
This commit is contained in:
Steven R. Loomis 2002-07-17 03:56:50 +00:00
parent 7d400dec01
commit 06d5ee2949
25 changed files with 599 additions and 361 deletions

View File

@ -29,6 +29,10 @@ UNICODE_VERSION=3.2
ICUBLD=$(ICUMAKE)\out\build
ICUOUT=$(ICUMAKE)\out
# ICUDT
# the prefix "icudt21_" for use in filenames
ICUPKG=$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX)
ICUDT=$(ICUPKG)_
# ICUP
# The root of the ICU source directory tree
@ -219,13 +223,13 @@ ALL_RES = $(RB_FILES) $(TRANSLIT_FILES)
# Building the common dll in $(ICUBLD) unconditionally copies it to $(DLL_OUTPUT) too.
#
#############################################################################
ALL : GODATA "$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" "$(TESTDATAOUT)\testdata.dat" "$(TESTDATAOUT)\test1.cnv" "$(TESTDATAOUT)\test3.cnv" "$(TESTDATAOUT)\test4.cnv"
ALL : GODATA "$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" "$(TESTDATAOUT)\testdata.dat"
@echo All targets are up to date
#
# testdata - nmake will invoke pkgdata, which will create testdata.dat
#
"$(TESTDATAOUT)\testdata.dat": ucadata.dat $(TRANSLIT_FILES) $(RB_FILES) {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe
"$(TESTDATAOUT)\testdata.dat": $(ICUDT)ucadata.dat $(TRANSLIT_FILES) $(RB_FILES) {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe
@cd "$(TESTDATA)"
@echo building testdata...
nmake /nologo /f "$(TESTDATA)\testdata.mk" TESTDATA=. ICUTOOLS="$(ICUTOOLS)" PKGOPT="$(PKGOPT)" CFG=$(CFG) TESTDATAOUT="$(TESTDATAOUT)" ICUDATA="$(ICUDATA)" TESTDATABLD="$(TESTDATABLD)"
@ -233,24 +237,24 @@ ALL : GODATA "$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" "$(TESTDATAOUT)\testdata.dat"
#
# Break iterator data files.
#
BRK_FILES = "$(ICUBLD)\sent.brk" "$(ICUBLD)\char.brk" "$(ICUBLD)\line.brk" "$(ICUBLD)\word.brk" "$(ICUBLD)\title.brk" "$(ICUBLD)\line_th.brk" "$(ICUBLD)\word_th.brk"
BRK_FILES = "$(ICUBLD)\$(ICUDT)sent.brk" "$(ICUBLD)\$(ICUDT)char.brk" "$(ICUBLD)\$(ICUDT)line.brk" "$(ICUBLD)\$(ICUDT)word.brk" "$(ICUBLD)\$(ICUDT)title.brk" "$(ICUBLD)\$(ICUDT)line_th.brk" "$(ICUBLD)\$(ICUDT)word_th.brk"
#invoke pkgdata for ICU common data
# pkgdata will drop all output files (.dat, .dll, .lib) into the target (ICUBLD) directory.
# move the .dll and .lib files to their final destination afterwards.
# The $(U_ICUDATA_NAME).lib and $(U_ICUDATA_NAME).exp should already be in the right place due to stubdata.
#
"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : "$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata.exe" $(CNV_FILES) $(BRK_FILES) "$(ICUBLD)\uprops.dat" "$(ICUBLD)\unames.dat" "$(ICUBLD)\unorm.dat" "$(ICUBLD)\cnvalias.icu" "$(ICUBLD)\tz.dat" "$(ICUBLD)\ucadata.dat" "$(ICUBLD)\invuca.dat" $(ALL_RES) "$(ICUBLD)\icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : "$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata.exe" $(CNV_FILES) $(BRK_FILES) "$(ICUBLD)\$(ICUDT)uprops.dat" "$(ICUBLD)\$(ICUDT)unames.dat" "$(ICUBLD)\$(ICUDT)unorm.dat" "$(ICUBLD)\$(ICUDT)cnvalias.icu" "$(ICUBLD)\$(ICUDT)tz.dat" "$(ICUBLD)\$(ICUDT)ucadata.dat" "$(ICUBLD)\$(ICUDT)invuca.dat" $(ALL_RES) "$(ICUBLD)\$(ICUDT)icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
@echo Building icu data
@cd "$(ICUBLD)"
"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -e $(U_ICUDATA_NAME) -v -m dll -c -p $(U_ICUDATA_NAME) -O "$(PKGOPT)" -d "$(ICUBLD)" -s . <<pkgdatain.txt
uprops.dat
unames.dat
unorm.dat
cnvalias.icu
tz.dat
ucadata.dat
invuca.dat
@"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -e $(U_ICUDATA_NAME) -v -m dll -c -p $(ICUPKG) -O "$(PKGOPT)" -d "$(ICUBLD)" -s . <<pkgdatain.txt
$(ICUDT)uprops.dat
$(ICUDT)unames.dat
$(ICUDT)unorm.dat
$(ICUDT)cnvalias.icu
$(ICUDT)tz.dat
$(ICUDT)ucadata.dat
$(ICUDT)invuca.dat
$(CNV_FILES:.cnv =.cnv
)
$(ALL_RES:.res =.res
@ -260,10 +264,10 @@ $(INDEX_RES_FILES:.res =.res
$(BRK_FILES:.brk" =.brk"
)
<<KEEP
copy "$(U_ICUDATA_NAME).dll" "$(DLL_OUTPUT)"
-@erase "$(U_ICUDATA_NAME).dll"
copy "$(U_ICUDATA_NAME).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
-@erase "$(U_ICUDATA_NAME).dat"
copy "$(ICUPKG).dll" "$(DLL_OUTPUT)"
-@erase "$(ICUPKG).dll"
copy "$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
-@erase "$(ICUPKG).dat"
@ -271,26 +275,26 @@ $(BRK_FILES:.brk" =.brk"
# TODO: set up an inference rule, so these don't need to be written out one by one...
#
"$(ICUBLD)\char.brk" : "$(ICUBRK)\char.txt" "$(ICUBLD)\uprops.dat"
genbrk -r "$(ICUBRK)\char.txt" -o "$(ICUBLD)\char.brk"
"$(ICUBLD)\$(ICUDT)char.brk" : "$(ICUBRK)\char.txt" "$(ICUBLD)\$(ICUDT)uprops.dat"
genbrk -r "$(ICUBRK)\char.txt" -o "$(ICUBLD)\$(ICUDT)char.brk"
"$(ICUBLD)\word.brk" : "$(ICUBRK)\word.txt" "$(ICUBLD)\uprops.dat"
genbrk -r "$(ICUBRK)\word.txt" -o "$(ICUBLD)\word.brk"
"$(ICUBLD)\$(ICUDT)word.brk" : "$(ICUBRK)\word.txt" "$(ICUBLD)\$(ICUDT)uprops.dat"
genbrk -r "$(ICUBRK)\word.txt" -o "$(ICUBLD)\$(ICUDT)word.brk"
"$(ICUBLD)\line.brk" : "$(ICUBRK)\line.txt" "$(ICUBLD)\uprops.dat"
genbrk -r "$(ICUBRK)\line.txt" -o "$(ICUBLD)\line.brk"
"$(ICUBLD)\$(ICUDT)line.brk" : "$(ICUBRK)\line.txt" "$(ICUBLD)\$(ICUDT)uprops.dat"
genbrk -r "$(ICUBRK)\line.txt" -o "$(ICUBLD)\$(ICUDT)line.brk"
"$(ICUBLD)\sent.brk" : "$(ICUBRK)\sent.txt" "$(ICUBLD)\uprops.dat"
genbrk -r "$(ICUBRK)\sent.txt" -o "$(ICUBLD)\sent.brk"
"$(ICUBLD)\$(ICUDT)sent.brk" : "$(ICUBRK)\sent.txt" "$(ICUBLD)\$(ICUDT)uprops.dat"
genbrk -r "$(ICUBRK)\sent.txt" -o "$(ICUBLD)\$(ICUDT)sent.brk"
"$(ICUBLD)\title.brk" : "$(ICUBRK)\title.txt" "$(ICUBLD)\uprops.dat"
genbrk -r "$(ICUBRK)\title.txt" -o "$(ICUBLD)\title.brk"
"$(ICUBLD)\$(ICUDT)title.brk" : "$(ICUBRK)\title.txt" "$(ICUBLD)\$(ICUDT)uprops.dat"
genbrk -r "$(ICUBRK)\title.txt" -o "$(ICUBLD)\$(ICUDT)title.brk"
"$(ICUBLD)\word_th.brk" : "$(ICUBRK)\word_th.txt" "$(ICUBLD)\uprops.dat"
genbrk -r "$(ICUBRK)\word_th.txt" -o "$(ICUBLD)\word_th.brk"
"$(ICUBLD)\$(ICUDT)word_th.brk" : "$(ICUBRK)\word_th.txt" "$(ICUBLD)\$(ICUDT)uprops.dat"
genbrk -r "$(ICUBRK)\word_th.txt" -o "$(ICUBLD)\$(ICUDT)word_th.brk"
"$(ICUBLD)\line_th.brk" : "$(ICUBRK)\line_th.txt" "$(ICUBLD)\uprops.dat"
genbrk -r "$(ICUBRK)\line_th.txt" -o "$(ICUBLD)\line_th.brk"
"$(ICUBLD)\$(ICUDT)line_th.brk" : "$(ICUBRK)\line_th.txt" "$(ICUBLD)\$(ICUDT)uprops.dat"
genbrk -r "$(ICUBRK)\line_th.txt" -o "$(ICUBLD)\$(ICUDT)line_th.brk"
# utility target to send us to the right dir
@ -326,33 +330,15 @@ CLEAN : GODATA
@cd "$(ICUBLD)"
# Targets for test converter data
"$(TESTDATAOUT)\test1.cnv": "$(TESTDATA)\test1.ucm"
@cd "$(ICUDATA)"
@set ICU_DATA=$(TESTDATAOUT)
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" $**
"$(TESTDATAOUT)\test3.cnv": "$(TESTDATA)\test3.ucm"
@cd "$(ICUDATA)"
@set ICU_DATA=$(TESTDATAOUT)
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" $**
"$(TESTDATAOUT)\test4.cnv": "$(TESTDATA)\test4.ucm"
@cd "$(ICUDATA)"
@set ICU_DATA=$(TESTDATAOUT)
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" $**
# Batch inference rule for creating converters
{$(ICUSRCDATA_RELATIVE_PATH)\$(ICUUCM)}.ucm.cnv::
@echo Generating converters
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" -d"$(ICUBLD)" $<
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
# Batch infrence rule for creating transliterator resource files
{$(ICUSRCDATA_RELATIVE_PATH)\$(ICUTRNS)}.txt.res::
@echo Making Transliterator Resource Bundle files
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -d"$(ICUBLD)" $<
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -t -p"$(ICUPKG)" -d"$(ICUBLD)" $<
# Inference rule for creating resource bundle files
{$(ICUSRCDATA_RELATIVE_PATH)\$(ICULOC)}.txt.res::
@ -365,46 +351,46 @@ res_index {
}
}
<<KEEP
@echo Making Locale Resource Bundle files
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -d"$(ICUBLD)" .\res_index.txt $<
echo Making Locale Resource Bundle files
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -t -p"$(ICUPKG)" -d"$(ICUBLD)" .\res_index.txt $<
# DLL version information
"$(ICUBLD)\icudata.res": "$(ICUMISC)\icudata.rc"
"$(ICUBLD)\$(ICUDT)icudata.res": "$(ICUMISC)\icudata.rc"
@echo Creating data DLL version information from $**
@rc.exe /i "..\..\..\..\include" /r /fo $@ $**
# Targets for unames.dat
"$(ICUBLD)\unames.dat": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennames\$(CFG)\gennames.exe"
"$(ICUBLD)\$(ICUDT)unames.dat": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennames\$(CFG)\gennames.exe"
@echo Creating data file for Unicode Names
@set ICU_DATA=$(ICUBLD)
@"$(ICUTOOLS)\gennames\$(CFG)\gennames" -1 -u $(UNICODE_VERSION) "$(ICUUNIDATA)\UnicodeData.txt"
# Targets for uprops.dat
"$(ICUBLD)\uprops.dat": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\genprops\$(CFG)\genprops.exe"
"$(ICUBLD)\$(ICUDT)uprops.dat": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\genprops\$(CFG)\genprops.exe"
@echo Creating data file for Unicode Character Properties
@set ICU_DATA=$(ICUBLD)
@"$(ICUTOOLS)\genprops\$(CFG)\genprops" -u $(UNICODE_VERSION) -s "$(ICUUNIDATA)"
# Targets for unorm.dat
"$(ICUBLD)\unorm.dat": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennorm\$(CFG)\gennorm.exe"
"$(ICUBLD)\$(ICUDT)unorm.dat": "$(ICUUNIDATA)\*.txt" "$(ICUTOOLS)\gennorm\$(CFG)\gennorm.exe"
@echo Creating data file for Unicode Normalization
@set ICU_DATA=$(ICUBLD)
@"$(ICUTOOLS)\gennorm\$(CFG)\gennorm" -u $(UNICODE_VERSION) -s "$(ICUUNIDATA)"
# Targets for converters
"$(ICUBLD)\cnvalias.icu" : {"$(ICUSRCDATA)\$(ICUUCM)"}\convrtrs.txt "$(ICUTOOLS)\gencnval\$(CFG)\gencnval.exe"
"$(ICUBLD)\$(ICUDT)cnvalias.icu" : {"$(ICUSRCDATA)\$(ICUUCM)"}\convrtrs.txt "$(ICUTOOLS)\gencnval\$(CFG)\gencnval.exe"
@echo Creating data file for Converter Aliases
@set ICU_DATA=$(ICUBLD)
@"$(ICUTOOLS)\gencnval\$(CFG)\gencnval" "$(ICUSRCDATA)\$(ICUUCM)\convrtrs.txt"
# Targets for tz
"$(ICUBLD)\tz.dat" : {"$(ICUMISC)"}timezone.txt {"$(ICUTOOLS)\gentz\$(CFG)"}gentz.exe
"$(ICUBLD)\$(ICUDT)tz.dat" : {"$(ICUMISC)"}timezone.txt {"$(ICUTOOLS)\gentz\$(CFG)"}gentz.exe
@echo Creating data file for Timezones
@set ICU_DATA=$(ICUBLD)
@"$(ICUTOOLS)\gentz\$(CFG)\gentz" "$(ICUMISC)\timezone.txt"
# Targets for ucadata.dat & invuca.dat
"$(ICUBLD)\invuca.dat" "$(ICUBLD)\ucadata.dat": "$(ICUUNIDATA)\FractionalUCA.txt" "$(ICUTOOLS)\genuca\$(CFG)\genuca.exe" uprops.dat unorm.dat
"$(ICUBLD)\$(ICUDT)invuca.dat" "$(ICUBLD)\$(ICUDT)ucadata.dat": "$(ICUUNIDATA)\FractionalUCA.txt" "$(ICUTOOLS)\genuca\$(CFG)\genuca.exe" $(ICUDT)uprops.dat $(ICUDT)unorm.dat
@echo Creating UCA data files
@set ICU_DATA=$(ICUBLD)
@"$(ICUTOOLS)\genuca\$(CFG)\genuca" -s "$(ICUUNIDATA)"
@ -413,5 +399,5 @@ res_index {
$(UCM_SOURCE) : {"$(ICUTOOLS)\makeconv\$(CFG)"}makeconv.exe
$(TRANSLIT_SOURCE) $(GENRB_SOURCE) : {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe ucadata.dat uprops.dat unorm.dat
$(TRANSLIT_SOURCE) $(GENRB_SOURCE) : {"$(ICUTOOLS)\genrb\$(CFG)"}genrb.exe $(ICUDT)ucadata.dat $(ICUDT)uprops.dat $(ICUDT)unorm.dat

View File

@ -44,8 +44,8 @@ RSC=rc.exe
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /c
# ADD CPP /nologo /G6 /MD /Za /W3 /GX /O2 /I "..\common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /c
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /c
# ADD CPP /nologo /G6 /MD /Za /W3 /GX /O2 /I "..\common" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@ -76,8 +76,8 @@ PreLink_Cmds=echo "File with stubdata build time, used as a dependency to trigge
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /GZ /c
# ADD CPP /nologo /G6 /MDd /Za /W3 /GX /ZI /Od /I "..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /GZ /c
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /GZ /c
# ADD CPP /nologo /G6 /MDd /Za /W3 /GX /ZI /Od /I "..\common" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@ -87,7 +87,7 @@ BSC32=bscmake.exe
# 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 /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib /nologo /dll /machine:I386 /out:"..\..\bin\icudt22.dll" /implib:"..\..\lib\icudata.lib" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib /nologo /dll /machine:I386 /out:"..\..\bin\icudt22l.dll" /implib:"..\..\lib\icudata.lib" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
# Begin Special Build Tool
ProjDir=.
@ -108,8 +108,8 @@ PreLink_Cmds=echo "File with stubdata build time, used as a dependency to trigge
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /c
# ADD CPP /nologo /MD /Za /W3 /I "..\common" /D"WIN64" /D"NDEBUG" /D"_WINDOWS" /D"_MBCS" /D"_USRDLL" /D"STUBDATA_EXPORTS" /FD /c /O2 /GX /Op /QIA64_fmaopt /D"_IA64_" /Zi /D"WIN64" /D"WIN32" /D"_AFX_NO_DAO_SUPPORT" /Wp64 /Zm600
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN64" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /c
# ADD CPP /nologo /MD /Za /W3 /GX /Zi /O2 /I "..\common" /D "WIN64" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /D "_IA64_" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /QIA64_fmaopt /Wp64 /Zm600 /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win64
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win64
# ADD BASE RSC /l 0x409 /d "NDEBUG"
@ -119,7 +119,7 @@ BSC32=bscmake.exe
# 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 /nologo /dll /machine:IA64
# ADD LINK32 kernel32.lib user32.lib /nologo /dll /machine:IA64 /out:"..\..\bin\icudt22.dll" /implib:"..\..\lib\icudata.lib" /incremental:no
# ADD LINK32 kernel32.lib user32.lib /nologo /dll /machine:IA64 /out:"..\..\bin\icudt22l.dll" /implib:"..\..\lib\icudata.lib" /incremental:no
# SUBTRACT LINK32
# Begin Special Build Tool
ProjDir=.
@ -140,8 +140,8 @@ PreLink_Cmds=echo "File with stubdata build time, used as a dependency to trigge
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN64" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /GZ /c
# ADD CPP /nologo /MDd /Za /W3 /I "..\common" /D"WIN64" /D"_DEBUG" /D"_WINDOWS" /D"_MBCS" /D"_USRDLL" /D"STUBDATA_EXPORTS" /FD /GZ /c /Od /GX /Op /QIA64_fmaopt /D"_IA64_" /Zi /D"WIN64" /D"WIN32" /D"_AFX_NO_DAO_SUPPORT" /Wp64 /Zm600
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN64" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /FD /GZ /c
# ADD CPP /nologo /MDd /Za /W3 /GX /Zi /Od /I "..\common" /D "WIN64" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "STUBDATA_EXPORTS" /D "_IA64_" /D "WIN32" /D "_AFX_NO_DAO_SUPPORT" /FD /GZ /QIA64_fmaopt /Wp64 /Zm600 /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win64
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win64
# ADD BASE RSC /l 0x409 /d "_DEBUG"
@ -151,7 +151,7 @@ BSC32=bscmake.exe
# 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 /nologo /dll /debug /machine:IA64 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib /nologo /dll /machine:IA64 /out:"..\..\bin\icudt22.dll" /implib:"..\..\lib\icudata.lib" /pdbtype:sept /incremental:no
# ADD LINK32 kernel32.lib user32.lib /nologo /dll /machine:IA64 /out:"..\..\bin\icudt22l.dll" /implib:"..\..\lib\icudata.lib" /pdbtype:sept /incremental:no
# SUBTRACT LINK32
# Begin Special Build Tool
ProjDir=.

View File

@ -175,12 +175,50 @@ int main(int argc, const char* const argv[])
return nerrors ? 1 : 0;
}
void ctest_appendToDataDirectory(const char *toAppend)
{
const char *oldPath ="";
char newBuf [1024];
char *newPath = newBuf;
int32_t oldLen;
int32_t newLen;
if((toAppend == NULL) || (*toAppend == 0)) {
return;
}
oldPath = u_getDataDirectory();
if( (oldPath==NULL) || (*oldPath == 0)) {
u_setDataDirectory(toAppend);
} else {
oldLen = strlen(oldPath);
newLen = strlen(toAppend)+1+oldLen;
if(newLen > 1022)
{
newPath = malloc(newLen);
}
strcpy(newPath, oldPath);
strcpy(newPath+oldLen, U_PATH_SEP_STRING);
strcpy(newPath+oldLen+1, toAppend);
u_setDataDirectory(newPath);
if(newPath != newBuf)
{
free(newPath);
}
}
}
void
ctest_pathnameInContext( char* fullname, int32_t maxsize, const char* relPath )
{
char mainDirBuffer[1024];
char* mainDir = NULL;
const char *dataDirectory = u_getDataDirectory();
const char *dataDirectory = ctest_dataOutDir();
const char inpSepChar = '|';
char* tmp;
int32_t lenMainDir;
@ -228,22 +266,13 @@ ctest_pathnameInContext( char* fullname, int32_t maxsize, const char* relPath )
}
}
/* returns the path to icu/source/data/out */
const char *ctest_dataOutDir()
{
static char *dataOutDir = NULL;
/* ctest_setICU_DATA - if the ICU_DATA environment variable is not already
* set, try to deduce the directory in which ICU was built,
* and set ICU_DATA to "icu/source/data" in that location.
* The intent is to allow the tests to have a good chance
* of running without requiring that the user manually set
* ICU_DATA. Common data isn't a problem, since it is
* picked up via a static (build time) reference, but the
* tests dynamically load some data.
*/
void ctest_setICU_DATA() {
const char *original_ICU_DATA = getenv("ICU_DATA");
if (original_ICU_DATA != NULL && *original_ICU_DATA != 0) {
/* If the user set ICU_DATA, don't second-guess the person. */
return;
if(dataOutDir) {
return dataOutDir;
}
/* U_TOPBUILDDIR is set by the makefiles on UNIXes when building cintltst and intltst
@ -256,9 +285,7 @@ void ctest_setICU_DATA() {
*/
#if defined (U_TOPBUILDDIR)
{
static char env_string[] = U_TOPBUILDDIR U_FILE_SEP_STRING "data"U_FILE_SEP_STRING"out"U_FILE_SEP_STRING;
u_setDataDirectory(env_string);
return;
dataOutDir = U_TOPBUILDDIR U_FILE_SEP_STRING "data"U_FILE_SEP_STRING"out"U_FILE_SEP_STRING;
}
#else
@ -267,7 +294,7 @@ void ctest_setICU_DATA() {
* Change to "wherever\icu\source\data"
*/
{
char p[sizeof(__FILE__) + 10];
static char p[sizeof(__FILE__) + 10];
char *pBackSlash;
int i;
@ -286,12 +313,27 @@ void ctest_setICU_DATA() {
* Now append "source\data" and set the environment
*/
strcpy(pBackSlash, U_FILE_SEP_STRING "data" U_FILE_SEP_STRING "out" U_FILE_SEP_STRING);
u_setDataDirectory(p); /* p is "ICU_DATA=wherever\icu\source\data" */
return;
dataOutDir = p;
}
}
#endif
return dataOutDir;
}
/* ctest_setICU_DATA - if the ICU_DATA environment variable is not already
* set, try to deduce the directory in which ICU was built,
* and set ICU_DATA to "icu/source/data" in that location.
* The intent is to allow the tests to have a good chance
* of running without requiring that the user manually set
* ICU_DATA. Common data isn't a problem, since it is
* picked up via a static (build time) reference, but the
* tests dynamically load some data.
*/
void ctest_setICU_DATA() {
/* No location for the data dir was identifiable.
* Add other fallbacks for the test data location here if the need arises
*/
@ -349,10 +391,10 @@ const char* loadTestData(UErrorCode* err){
const char* directory=NULL;
UResourceBundle* test =NULL;
char* tdpath=NULL;
const char* tdrelativepath = ".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING"out"U_FILE_SEP_STRING;
const char* tdrelativepath = ".."U_FILE_SEP_STRING".."U_FILE_SEP_STRING"test"U_FILE_SEP_STRING"testdata"U_FILE_SEP_STRING"out"U_FILE_SEP_STRING;
if( _testDataPath == NULL){
directory= u_getDataDirectory();
directory= ctest_dataOutDir();
tdpath = (char*) ctst_malloc(sizeof(char) *(( strlen(directory) * strlen(tdrelativepath)) + 10));
@ -369,41 +411,11 @@ const char* loadTestData(UErrorCode* err){
test=ures_open(tdpath, "testtypes", err);
/* we could not find the data in tdpath
* try tdpathFallback
*/
if(U_FAILURE(*err))
{
strcpy(tdpath,directory);
strcat(tdpath,".."U_FILE_SEP_STRING);
strcat(tdpath, tdrelativepath);
strcat(tdpath,"testdata");
*err =U_ZERO_ERROR;
test=ures_open(tdpath, "testtypes", err);
/* we could not find the data in tdpath
* try one more tdpathFallback
*/
if(U_FAILURE(*err)){
strcpy(tdpath,directory);
strcat(tdpath,".."U_FILE_SEP_STRING);
strcat(tdpath,".."U_FILE_SEP_STRING);
strcat(tdpath, tdrelativepath);
strcat(tdpath,"testdata");
*err =U_ZERO_ERROR;
test=ures_open(tdpath, "testtypes", err);
/* Fall back did not succeed either so return */
if(U_FAILURE(*err)){
*err = U_FILE_ACCESS_ERROR;
log_err("construction of NULL did not succeed : %s \n", u_errorName(*err));
return "";
}
ures_close(test);
_testDataPath = tdpath;
return _testDataPath;
}
ures_close(test);
_testDataPath = tdpath;
return _testDataPath;
/* Fall back did not succeed either so return */
if(U_FAILURE(*err)){
*err = U_FILE_ACCESS_ERROR;
log_err("Could not load testtypes.res in testdata bundle with path %s - %as\n", tdpath, u_errorName(*err));
return "";
}
ures_close(test);
_testDataPath = tdpath;

View File

@ -28,6 +28,11 @@ The main root for C API tests
U_CFUNC void addAllTests(TestNode** root);
/**
* Return the path to the icu/source/data/out directory
*/
U_CFUNC const char* ctest_dataOutDir();
/**
*complete a relative path to a full pathname, and convert to platform-specific syntax.
* The character seperating directories for the relative path is '|'.

View File

@ -262,10 +262,7 @@ static void TestDecodedBundle(){
/* pre-flight */
int32_t num =0;
char testdatapath[256];
const char *directory= u_getDataDirectory();
strcpy(testdatapath, directory);
strcat(testdatapath, "testdata");
const char *testdatapath = loadTestData(&error);
resB = ures_open(testdatapath, "ja_data", &error);
srcFromRes=ures_getStringByKey(resB,"str",&len,&error);
@ -299,6 +296,7 @@ static void TestNewTypes() {
UChar uExpect[200];
testdatapath=loadTestData(&status);
if(U_FAILURE(status))
{
log_err("Could not load testdata.dat %s \n",myErrorName(status));
@ -448,7 +446,6 @@ static void TestEmptyTypes() {
const int32_t *zeroIntVect;
strcpy(action, "Construction of testtypes bundle");
testdatapath=loadTestData(&status);
if(U_FAILURE(status))
{
@ -1147,13 +1144,11 @@ static void TestConstruction2()
const char* directory;
const char* locale="te_IN";
wchar_t widedirectory[256];
char testdatapath[256];
const char *testdatapath;
int32_t len=0;
char verboseOutput[256];
directory= u_getDataDirectory();
uprv_strcpy(testdatapath, directory);
uprv_strcat(testdatapath, "testdata");
testdatapath= loadTestData(&err);
mbstowcs(widedirectory, testdatapath, 256);
log_verbose("Testing ures_openW().......\n");

View File

@ -62,6 +62,19 @@ addUDataTest(TestNode** root)
}
#if 0
static void lots_of_mallocs()
{
int q;
for(q=1;q<100;q++)
{
free(malloc(q));
malloc(q*2);
}
}
#endif
static void TestUDataOpen(){
UDataMemory *result;
UErrorCode status=U_ZERO_ERROR;
@ -75,7 +88,7 @@ static void TestUDataOpen(){
const char* type = "dat";
const char dirSepString[] = {U_FILE_SEP_CHAR, 0};
char* path=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory())
char* path=(char*)malloc(sizeof(char) * (strlen(ctest_dataOutDir())
+ strlen(U_ICUDATA_NAME)
+ strlen("/build")+1 ) );
@ -84,7 +97,9 @@ static void TestUDataOpen(){
const char* testPath=loadTestData(&status);
strcat(strcpy(path, u_getDataDirectory()), U_ICUDATA_NAME);
/* lots_of_mallocs(); */
strcat(strcpy(path, ctest_dataOutDir()), U_ICUDATA_NAME);
log_verbose("Testing udata_open()\n");
result=udata_open(testPath, type, name, &status);
@ -103,11 +118,13 @@ static void TestUDataOpen(){
icuDataFilePath = (char *)malloc(strlen(path) + 10);
strcpy(icuDataFilePath, path);
strcat(icuDataFilePath, ".dat");
/* lots_of_mallocs(); */
if (stat(icuDataFilePath, &stat_buf) == 0)
{
int i;
log_verbose("Testing udata_open() on %s\n", icuDataFilePath);
for(i=0; i<sizeof(memMap)/sizeof(memMap[0]); i++){
/* lots_of_mallocs(); */
status=U_ZERO_ERROR;
result=udata_open(path, memMap[i][1], memMap[i][0], &status);
if(U_FAILURE(status)) {
@ -120,11 +137,13 @@ static void TestUDataOpen(){
}
else
{
/* lots_of_mallocs(); */
log_verbose("Skipping tests of udata_open() on %s. File not present in this configuration.\n",
icuDataFilePath);
}
free(icuDataFilePath);
icuDataFilePath = NULL;
/* lots_of_mallocs(); */
/* If the ICU individual files used to build the ICU system common data are
* present in this configuration,
@ -134,18 +153,24 @@ static void TestUDataOpen(){
* back into this directory structure, but this is not required. Soooo, if
* the files are missing, skip this test without error.
*/
icuDataFilePath = (char *)malloc(strlen(u_getDataDirectory()) + 50);
strcpy(icuDataFilePath, u_getDataDirectory());
/* lots_of_mallocs(); */
icuDataFilePath = (char *)malloc(strlen(ctest_dataOutDir()) + 50);
strcpy(icuDataFilePath, ctest_dataOutDir());
strcat(icuDataFilePath, "build");
strcat(icuDataFilePath, dirSepString);
strcat(icuDataFilePath, U_ICUDATA_NAME);
strcat(icuDataFilePath, "_");
strcat(icuDataFilePath, "tz.dat");
/* lots_of_mallocs(); */
if (stat(icuDataFilePath, &stat_buf) == 0)
{
int i;
strcpy(icuDataFilePath, u_getDataDirectory());
log_verbose("%s exists, so..\n", icuDataFilePath);
strcpy(icuDataFilePath, ctest_dataOutDir());
strcat(icuDataFilePath, "build");
strcat(icuDataFilePath, dirSepString);
strcat(icuDataFilePath, "dummyLibraryName");
strcat(icuDataFilePath, U_ICUDATA_NAME);
log_verbose("Testing udata_open() on %s\n", icuDataFilePath);
for(i=0; i<sizeof(memMap)/sizeof(memMap[0]); i++){
status=U_ZERO_ERROR;
@ -163,13 +188,14 @@ static void TestUDataOpen(){
log_verbose("Skipping tests of udata_open() on %s. File not present in this configuration.\n",
icuDataFilePath);
}
free(icuDataFilePath);
icuDataFilePath = NULL;
/*
* Test fallback file names for open of separate data files.
* With these params to udata_open:
* path = wherever/testudata
* path = wherever/testdata
* type = typ
* name = nam
* these files will be tried first:
@ -178,43 +204,42 @@ static void TestUDataOpen(){
* A test data file named testudata_nam.typ exists for the purpose of testing this.
*/
log_verbose("Testing udata_open, with base_name.type style fallback to individual file.\n");
icuDataFilePath = (char *)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + 50));
strcpy(icuDataFilePath, testPath);
strrchr(icuDataFilePath, U_FILE_SEP_CHAR)[1] = 0; /* Trncate after the '\' */
strcat(icuDataFilePath, "testudata");
status = U_ZERO_ERROR;
result = udata_open( icuDataFilePath, "typ", "nam", &status);
result = udata_open( testPath, "typ", "nam", &status);
if (status != U_ZERO_ERROR) {
log_err("FAIL: udata_open( \"%s\", \"typ\", \"nam\") returned status %s\n", icuDataFilePath, u_errorName(status));
log_err("FAIL: udata_open( \"%s\", \"typ\", \"nam\") returned status %s\n", testPath, u_errorName(status));
}
udata_close(result);
free(icuDataFilePath);
/* This type of path is deprecated */
/*
* Another fallback test. Paths ending with a trailing directory separator
* take a slightly different code path, with the "base name" from the path
* being empty in the internal udata_open logic.
*/
log_verbose("Testing udata_open, with path containing a trailing directory separator.\n");
icuDataFilePath = (char *)malloc(strlen(u_getDataDirectory()) + 50);
strcpy(icuDataFilePath, testPath);
status = U_ZERO_ERROR;
result = udata_open( icuDataFilePath, "cnv", "test1", &status);
if (status != U_ZERO_ERROR) {
log_err("FAIL: udata_open( \"%s\", \"cnv\", \"test1\") returned status %s\n", icuDataFilePath, u_errorName(status));
}
udata_close(result);
free(icuDataFilePath);
/* log_verbose("Testing udata_open, with path containing a trailing directory separator.\n"); */
/* icuDataFilePath = (char *)malloc(strlen(u_getDataDirectory()) + 50); */
/* strcpy(icuDataFilePath, testPath); */
/* status = U_ZERO_ERROR; */
/* result = udata_open( icuDataFilePath, "cnv", "test1", &status); */
/* if (status != U_ZERO_ERROR) { */
/* log_err("FAIL: udata_open( \"%s\", \"cnv\", \"test1\") returned status %s\n", icuDataFilePath, u_errorName(status)); */
/* } */
/* udata_close(result); */
/* free(icuDataFilePath); */
log_verbose("Testing udata_open() with a non existing binary file\n");
result=udata_open(path, "tst", "nonexist", &status);
result=udata_open("testdata", "tst", "nonexist", &status);
if(status==U_FILE_ACCESS_ERROR){
log_verbose("Opening udata_open with non-existing file handled correctly.\n");
status=U_ZERO_ERROR;
} else {
log_err("calling udata_open with non-existing file not handled correctly\n. Expected: U_FILE_ACCESS_ERROR, Got: %s\n", myErrorName(status));
log_err("calling udata_open with non-existing file [testdata | nonexist.tst] not handled correctly\n. Expected: U_FILE_ACCESS_ERROR, Got: %s\n", myErrorName(status));
if(U_SUCCESS(status)) {
udata_close(result);
}
@ -242,14 +267,16 @@ static void TestUDataSetAppData(){
size_t i;
/** srl REVISIT **/
/* Open the testdata.dat file, using normal */
const char* tdrelativepath = loadTestData(&status);
char* filePath=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen("testdata.dat") +1 +strlen(tdrelativepath)) );
char* filePath=(char*)malloc(sizeof(char) * (strlen(tdrelativepath) + strlen(".dat") +1 +strlen(tdrelativepath)) );
strcpy(filePath, tdrelativepath);
strcat(filePath, ".dat");
log_verbose("Testing udata_setAppData()\n");
log_verbose("Testing udata_setAppData() with %s\n", filePath);
#ifdef WIN32
fileHandle = open( filePath, O_RDONLY | O_BINARY );
@ -312,57 +339,11 @@ static void TestUDataSetAppData(){
" returned status of %s, expected U_USING_DEFAULT_WARNING.\n", u_errorName(status));
}
/*
* Verify that we can access data using the names we supplied to setAppData
* testData should hold these items: root.res te.res te_IN.res testtypes.res testempty.res test.dat
*/
status = U_ZERO_ERROR;
dataItem = udata_open("appData1", "res", "te_IN", &status);
if (status != U_ZERO_ERROR) {
log_err("FAIL: TestUDataSetAppData(): udata_open(\"appData1\", \"res\", \"te_IN\"... "
" returned status of %s, expected U_ZERO_ERROR.\n", u_errorName(status));
}
udata_close(dataItem);
status = U_ZERO_ERROR;
dataItem = udata_open("appData2", "dat", "test", &status);
if (status != U_ZERO_ERROR) {
log_err("FAIL: TestUDataSetAppData(): udata_open(\"appData2\", \"dat\", \"test\"... "
" returned status of %s, expected U_ZERO_ERROR.\n", u_errorName(status));
}
udata_close(dataItem);
/*
* Try data that should not exist, check for returned error.
*/
status = U_ZERO_ERROR;
dataItem = udata_open("appData3", "res", "bum_IN", &status);
if (status != U_FILE_ACCESS_ERROR) {
log_err("FAIL: TestUDataSetAppData(): udata_open(\"appData3\", \"res\", \"te_IN\"... "
" returned status of %s, expected U_FILE_ACCESS_ERROR.\n", u_errorName(status));
}
udata_close(dataItem);
status = U_ZERO_ERROR;
dataItem = udata_open("appData2", "dat", "no_such_name", &status);
if (status != U_FILE_ACCESS_ERROR) {
log_err("FAIL: TestUDataSetAppData(): udata_open(\"appData2\", \"dat\", \"no_such_name\"... "
" returned status of %s, expected U_FILE_ACCESS_ERROR.\n", u_errorName(status));
}
udata_close(dataItem);
/*
* Try udata_setAppData on memory conatining bogus data - data that does not
* have the header of an ICU common data format file.
*/
status = U_ZERO_ERROR;
udata_setAppData("appData4", "This string is memory that doesn't look like ICU Common Data", &status);
if (status != U_INVALID_FORMAT_ERROR) {
log_err("FAIL: TestUDataSetAppData(): udata_open(\"appData2\", \"dat\", \"no_such_name\"... "
" returned status of %s, expected U_INVALID_FORMAT_ERROR.\n", u_errorName(status));
}
/** It is no longer correct to use udata_setAppData to change the
package of a contained item.
dataItem = udata_open("appData1", "res", "te_IN", &status); **/
cleanupAndReturn:
/* Note: fileBuf is not deleted because ICU retains a pointer to it
@ -458,7 +439,6 @@ isAcceptable3(void *context,
}
static void TestUDataOpenChoiceDemo1() {
UDataMemory *result;
UErrorCode status=U_ZERO_ERROR;
@ -468,10 +448,7 @@ static void TestUDataOpenChoiceDemo1() {
"test"
};
const char* type="dat";
char* testPath=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen("testdata") +1 ) );
strcat(strcpy(testPath, u_getDataDirectory()), "testdata");
const char* testPath="testdata";
result=udata_openChoice(NULL, "icu", name[0], isAcceptable1, NULL, &status);
if(U_FAILURE(status)){
@ -506,9 +483,6 @@ static void TestUDataOpenChoiceDemo1() {
if(U_SUCCESS(status)){
udata_close(result);
}
free(testPath);
}
static UBool
@ -534,6 +508,9 @@ isAcceptable(void *context,
}
}
/* This test checks to see if the isAcceptable function is being called correctly. */
static void TestUDataOpenChoiceDemo2() {
UDataMemory *result;
UErrorCode status=U_ZERO_ERROR;
@ -543,14 +520,9 @@ static void TestUDataOpenChoiceDemo2() {
const char* name="test";
const char* type="dat";
const char* base[]={ /* these are the common base names to use for the test */
"testdata", /* corresponds to something like 'base.dat', 'base.dll', 'libbase.so', etc.. */
"testdata" /* libbase_test.so, libbase_test.a, etc... */
};
int n;
char* path=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen(base[0]) + 1) );
strcpy(path, u_getDataDirectory());
strcat(path, base[0]);
const char* path = loadTestData(&status);
result=udata_openChoice(path, type, name, isAcceptable, &p, &status);
if(U_FAILURE(status)){
@ -559,12 +531,9 @@ static void TestUDataOpenChoiceDemo2() {
if(U_SUCCESS(status) ) {
udata_close(result);
}
strcpy(path, "");
p=0;
for(i=0;i<sizeof(base)/sizeof(base[0]); i++){
path=(char*)realloc(path, sizeof(char) * (strlen(u_getDataDirectory()) + strlen(base[i]) +1 ) );
strcat(strcpy(path, u_getDataDirectory()), base[i]);
for(i=0;i<2; i++){
result=udata_openChoice(path, type, name, isAcceptable, &p, &status);
if(p<2) {
if(U_FAILURE(status) && status==U_INVALID_FORMAT_ERROR){
@ -573,24 +542,19 @@ static void TestUDataOpenChoiceDemo2() {
p++;
}
else {
log_err("ERROR: failed to either load the data or to reject the loaded data. ERROR=%s\n", myErrorName(status) );
log_err("FAIL: failed to either load the data or to reject the loaded data. ERROR=%s\n", myErrorName(status) );
}
}
else if(p == 2) {
if(U_FAILURE(status)) {
log_err("ERROR: failed to load the data and accept it. ERROR=%s\n", myErrorName(status) );
log_err("FAIL: failed to load the data and accept it. ERROR=%s\n", myErrorName(status) );
}
else {
log_verbose("Loads the data and accepts it for p==2 as expected\n");
udata_close(result);
}
}
strcpy(path, "");
}
free(path);
}
@ -616,17 +580,12 @@ static void TestUDataGetInfo() {
const char* name2="test";
const char* type="dat";
char* path=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen(U_ICUDATA_NAME) +1 ) );
char* testPath=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen("testdata") +1 ) );
strcat(strcpy(path, u_getDataDirectory()), U_ICUDATA_NAME);
strcat(strcpy(testPath, u_getDataDirectory()), "testdata");
const char* testPath=loadTestData(&status);
log_verbose("Testing udata_getInfo() for cnvalias.dat\n");
result=udata_open(NULL, "icu", name, &status);
if(U_FAILURE(status)){
log_err("FAIL: udata_open() failed for path = NULL, name=%s, type=%s, \n errorcode=%s\n", path, name, type, myErrorName(status));
log_err("FAIL: udata_open() failed for path = NULL, name=%s, type=%s, \n errorcode=%s\n", name, type, myErrorName(status));
return;
}
udata_getInfo(result, &dataInfo);
@ -670,8 +629,6 @@ static void TestUDataGetInfo() {
log_err("FAIL: udata_getInfo() filled in the wrong values\n");
}
udata_close(result);
free(path);
free(testPath);
}
static void TestUDataGetMemory() {
@ -685,9 +642,7 @@ static void TestUDataGetMemory() {
const char* name2="test";
char* testPath=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen("testdata") +1 ) );
strcat(strcpy(testPath, u_getDataDirectory()), "testdata");
const char* testPath = loadTestData(&status);
type="icu";
log_verbose("Testing udata_getMemory for \"cnvalias.dat()\"\n");
@ -718,7 +673,6 @@ static void TestUDataGetMemory() {
udata_close(result);
free(testPath);
}
static void TestErrorConditions(){
@ -743,11 +697,7 @@ static void TestErrorConditions(){
const char* name = "test";
const char* type="dat";
char* path=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen(U_ICUDATA_NAME) +1 ) );
char* testPath=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen("testdata") +1 ) );
strcat(strcpy(path, u_getDataDirectory()), U_ICUDATA_NAME);
strcat(strcpy(testPath, u_getDataDirectory()), "testdata");
const char *testPath = loadTestData(&status);
status = U_ILLEGAL_ARGUMENT_ERROR;
/*Try udata_open with status != U_ZERO_ERROR*/
@ -835,9 +785,6 @@ static void TestErrorConditions(){
} else {
log_verbose("calling udat_open with non-existing file returned null as expected\n");
}
free(path);
free(testPath);
}
/* Test whether apps and ICU can each have their own root.res */
@ -855,9 +802,7 @@ static void TestAppData()
UErrorCode status = U_ZERO_ERROR;
char testMsgBuf[256];
char* testPath=(char*)malloc(sizeof(char) * (strlen(u_getDataDirectory()) + strlen("testdata") +1 ) );
strcat(strcpy(testPath, u_getDataDirectory()), "testdata");
const char* testPath=loadTestData(&status);
icu = ures_open(NULL, "root", &status);
if(U_FAILURE(status))
@ -924,8 +869,6 @@ static void TestAppData()
ures_close(tmp2);
ures_close(icu);
ures_close(app);
free(testPath);
}
static void TestICUDataName()

View File

@ -7,24 +7,30 @@
.SUFFIXES : .res .txt
TESTPKG=testdata
TESTDT=$(TESTPKG)_
ALL : "$(TESTDATAOUT)\testdata.dat"
@echo Test data is built.
"$(TESTDATAOUT)\testdata.dat" : "$(TESTDATABLD)\ja_data.res" "$(TESTDATABLD)\casing.res" "$(TESTDATABLD)\root.res" "$(TESTDATABLD)\te.res" "$(TESTDATABLD)\te_IN.res" "$(TESTDATABLD)\testaliases.res" "$(TESTDATABLD)\testtypes.res" "$(TESTDATABLD)\testempty.res" "$(TESTDATABLD)\ja_data.res" "$(TESTDATAOUT)\DataDrivenCollationTest.res" $(TESTDATAOUT)test.dat
"$(TESTDATAOUT)\testdata.dat" : "$(TESTDATABLD)\casing.res" "$(TESTDATABLD)\root.res" "$(TESTDATABLD)\te.res" "$(TESTDATABLD)\te_IN.res" "$(TESTDATABLD)\testaliases.res" "$(TESTDATABLD)\testtypes.res" "$(TESTDATABLD)\testempty.res" "$(TESTDATABLD)\ja_data.res" "$(TESTDATABLD)\DataDrivenCollationTest.res" $(TESTDATABLD)\testdata_test.dat "$(TESTDATABLD)\testdata_test1.cnv" "$(TESTDATABLD)\testdata_test3.cnv" "$(TESTDATABLD)\testdata_test4.cnv"
@echo Building test data
copy "$(TESTDATABLD)\te.res" "$(TESTDATAOUT)\testudata_nam.typ"
@"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -v -m common -c -p testdata -O "$(PKGOPT)" -d "$(TESTDATAOUT)" -T "$(TESTDATABLD)" -s "$(TESTDATABLD)" <<
casing.res
root.res
te.res
te_IN.res
testtypes.res
testempty.res
testaliases.res
ja_data.res
DataDrivenCollationTest.res
test.dat
copy "$(TESTDATABLD)\testdata_te.res" "$(TESTDATAOUT)\testdata_nam.typ"
@"$(ICUTOOLS)\pkgdata\$(CFG)\pkgdata" -v -m common -c -p"$(TESTPKG)" -O "$(PKGOPT)" -d "$(TESTDATAOUT)" -T "$(TESTDATABLD)" -s "$(TESTDATABLD)" <<
testdata_casing.res
testdata_root.res
testdata_te.res
testdata_te_IN.res
testdata_testtypes.res
testdata_testempty.res
testdata_testaliases.res
testdata_ja_data.res
testdata_DataDrivenCollationTest.res
testdata_test.dat
testdata_test1.cnv
testdata_test3.cnv
testdata_test4.cnv
<<
@ -32,12 +38,24 @@ test.dat
# Some test data resource bundles are known to have warnings and bad data.
# The -q option is there on purpose, so we don't see it normally.
{$(TESTDATA)}.txt.res::
@echo Making Test Resource Bundle files
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -q -s"$(TESTDATA)" -d"$(TESTDATABLD)" $<
@echo Making Test Resource Bundle files $<
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -t -p"$(TESTPKG)" -q -s"$(TESTDATA)" -d"$(TESTDATABLD)" $<
"$(TESTDATABLD)\ja_data.res":
@echo Making Test Resource Bundle file with encoding ISO-2022-JP
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -q -s"$(TESTDATA)" -eISO_2022_JP -d"$(TESTDATABLD)" ja_data.bin
@"$(ICUTOOLS)\genrb\$(CFG)\genrb" -t -p"$(TESTPKG)" -q -s"$(TESTDATA)" -eISO_2022_JP -d"$(TESTDATABLD)" ja_data.bin
$(TESTDATAOUT)test.dat : {"$(ICUTOOLS)\gentest\$(CFG)"}gentest.exe
"$(ICUTOOLS)\gentest\$(CFG)\gentest" -d"$(TESTDATABLD)"
$(TESTDATABLD)\testdata_test.dat : {"$(ICUTOOLS)\gentest\$(CFG)"}gentest.exe
"$(ICUTOOLS)\gentest\$(CFG)\gentest" -d"$(TESTDATABLD)"
# Targets for test converter data
"$(TESTDATABLD)\testdata_test1.cnv": "$(TESTDATA)\test1.ucm"
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" -d"$(TESTDATABLD)" -t -p testdata $**
"$(TESTDATABLD)\testdata_test3.cnv": "$(TESTDATA)\test3.ucm"
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" -d"$(TESTDATABLD)" -t -p testdata $**
"$(TESTDATABLD)\testdata_test4.cnv": "$(TESTDATA)\test4.ucm"
@"$(ICUTOOLS)\makeconv\$(CFG)\makeconv" -d"$(TESTDATABLD)" -t -p testdata $**

View File

@ -178,6 +178,8 @@ int main(int argc, char **argv) {
// This will compile the rules.
//
UParseError parseError;
parseError.line = 0;
parseError.offset = 0;
RuleBasedBreakIterator *bi = new RuleBasedBreakIterator(ruleSourceS, parseError, status);
if (U_FAILURE(status)) {
fprintf(stderr, "createRuleBasedBreakIterator: ICU Error \"%s\" at line %d, column %d\n",

View File

@ -98,20 +98,7 @@ main(int argc, char* argv[]) {
/* read command line options */
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
if( options[3].doesOccur ) /* be consistent with gencmn! */
{
uprv_strcpy(symPrefix, options[3].value);
}
else
{
symPrefix[0] = 0;
}
/* add an underscore to the prefix if non empty */
if(symPrefix[0] != 0)
{
uprv_strcat(symPrefix, "_");
}
symPrefix[0] = 0;
/* error handling, printing usage message */
if(argc<0) {

View File

@ -88,7 +88,7 @@ static UOption options[]={
/*9*/ UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG)
};
static char *symPrefix;
static char *symPrefix = NULL;
extern int
main(int argc, char* argv[]) {
@ -323,6 +323,8 @@ main(int argc, char* argv[]) {
entrypointName = options[6].value;
}
#if 0
symPrefix = (char *) uprv_malloc(uprv_strlen(entrypointName) + 2);
/* test for NULL */
@ -333,6 +335,7 @@ main(int argc, char* argv[]) {
uprv_strcpy(symPrefix, entrypointName);
uprv_strcat(symPrefix, "_");
#endif
/* write the source file */
sprintf(buffer,
@ -347,10 +350,10 @@ main(int argc, char* argv[]) {
options[6].value, options[7].value);
T_FileStream_writeLine(out, buffer);
sprintf(buffer, "extern const char\n %s%s[]", symPrefix, files[0].pathname);
sprintf(buffer, "extern const char\n %s%s[]", symPrefix?symPrefix:"", files[0].pathname);
T_FileStream_writeLine(out, buffer);
for(i=1; i<fileCount; ++i) {
sprintf(buffer, ",\n %s%s[]", symPrefix, files[i].pathname);
sprintf(buffer, ",\n %s%s[]", symPrefix?symPrefix:"", files[i].pathname);
T_FileStream_writeLine(out, buffer);
}
T_FileStream_writeLine(out, ";\n\n");
@ -387,10 +390,10 @@ main(int argc, char* argv[]) {
);
T_FileStream_writeLine(out, buffer);
sprintf(buffer, " { \"%s\", %s%s }", files[0].basename, symPrefix, files[0].pathname);
sprintf(buffer, " { \"%s\", %s%s }", files[0].basename, symPrefix?symPrefix:"", files[0].pathname);
T_FileStream_writeLine(out, buffer);
for(i=1; i<fileCount; ++i) {
sprintf(buffer, ",\n { \"%s\", %s%s }", files[i].basename, symPrefix, files[i].pathname);
sprintf(buffer, ",\n { \"%s\", %s%s }", files[i].basename, symPrefix?symPrefix:"", files[i].pathname);
T_FileStream_writeLine(out, buffer);
}

View File

@ -226,7 +226,7 @@ main(int argc, char* argv[]) {
if(argc<0 || options[HELP1].doesOccur || options[HELP2].doesOccur) {
fprintf(stderr,
"usage: %s [-options] [convrtrs.txt]\n"
"\tread convrtrs.txt and create " DATA_NAME "." DATA_TYPE "\n"
"\tread convrtrs.txt and create " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE "\n"
"options:\n"
"\t-h or -? or --help this usage text\n"
"\t-v or --verbose prints out extra information about the alias table\n"
@ -275,7 +275,7 @@ main(int argc, char* argv[]) {
T_FileStream_close(in);
/* create the output file */
out=udata_create(options[3].value, DATA_TYPE, DATA_NAME, &dataInfo,
out=udata_create(options[3].value, DATA_TYPE, U_ICUDATA_NAME "_" DATA_NAME, &dataInfo,
options[2].doesOccur ? U_COPYRIGHT_STRING : NULL, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gencnval: unable to open output file - error %s\n", u_errorName(errorCode));

View File

@ -307,7 +307,7 @@ main(int argc, char* argv[]) {
"Usage: %s [-1[+|-]] [-v[+|-]] [-c[+|-]] filename\n"
"\n"
"Read the UnicodeData.txt file and \n"
"create a binary file " DATA_NAME "." DATA_TYPE " with the character names\n"
"create a binary file " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE " with the character names\n"
"\n"
"\tfilename absolute path/filename for the Unicode database text file\n"
"\t\t(default: standard input)\n"
@ -810,7 +810,7 @@ generateData(const char *dataDir) {
long dataLength;
int16_t token;
pData=udata_create(dataDir, DATA_TYPE, DATA_NAME, &dataInfo,
pData=udata_create(dataDir, DATA_TYPE,U_ICUDATA_NAME "_" DATA_NAME, &dataInfo,
haveCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gennames: unable to create data memory, error %d\n", errorCode);

View File

@ -92,7 +92,7 @@ main(int argc, char* argv[]) {
"Usage: %s [-options] [suffix]\n"
"\n"
"Read the UnicodeData.txt file and other Unicode properties files and\n"
"create a binary file " DATA_NAME "." DATA_TYPE " with the normalization data\n"
"create a binary file " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE " with the normalization data\n"
"\n",
argv[0]);
fprintf(stderr,

View File

@ -1534,7 +1534,7 @@ generateData(const char *dataDir) {
printf(" number of sets %5d\n", canonSetsCount);
printf(" size of BMP search table %5u uint16_t\n", canonStartSets[_NORM_SET_INDEX_CANON_BMP_TABLE_LENGTH]);
printf(" size of supplementary search table %5u uint16_t\n", canonStartSets[_NORM_SET_INDEX_CANON_SUPP_TABLE_LENGTH]);
printf("size of " DATA_NAME "." DATA_TYPE " contents: %ld bytes\n", (long)size);
printf("size of " U_ICUDATA_NAME "_" DATA_NAME "." DATA_TYPE " contents: %ld bytes\n", (long)size);
}
indexes[_NORM_INDEX_TRIE_SIZE]=normTrieSize;
@ -1552,7 +1552,7 @@ generateData(const char *dataDir) {
indexes[_NORM_INDEX_CANON_SET_COUNT]=canonStartSetsTop;
/* write the data */
pData=udata_create(dataDir, DATA_TYPE, DATA_NAME, &dataInfo,
pData=udata_create(dataDir, DATA_TYPE, U_ICUDATA_NAME "_" DATA_NAME, &dataInfo,
haveCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gennorm: unable to create the output file, error %d\n", errorCode);

View File

@ -780,7 +780,7 @@ generateData(const char *dataDir) {
}
/* write the data */
pData=udata_create(dataDir, DATA_TYPE, DATA_NAME, &dataInfo,
pData=udata_create(dataDir, DATA_TYPE, U_ICUDATA_NAME "_" DATA_NAME, &dataInfo,
haveCopyright ? U_COPYRIGHT_STRING : NULL, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "genprops: unable to create data memory, %s\n", u_errorName(errorCode));

View File

@ -19,8 +19,9 @@
#include "genrb.h"
/* Protos */
static void processFile(const char *filename, const char* cp, const char *inputDir, const char *outputDir, UErrorCode *status);
static char *make_res_filename(const char *filename, const char *outputDir, UErrorCode *status);
static void processFile(const char *filename, const char* cp, const char *inputDir, const char *outputDir, const char *packageName, UErrorCode *status);
static char *make_res_filename(const char *filename, const char *outputDir,
const char *packageName, UErrorCode *status);
/* File suffixes */
#define RES_SUFFIX ".res"
@ -44,9 +45,10 @@ enum
ENCODING,
ICUDATADIR,
WRITE_JAVA,
COPYRIGHT,
PACKAGE_NAME,
BUNDLE_NAME,
COPYRIGHT
TOUCHFILE
};
UOption options[]={
@ -60,13 +62,15 @@ UOption options[]={
UOPTION_ENCODING,
UOPTION_ICUDATADIR,
UOPTION_WRITE_JAVA,
UOPTION_COPYRIGHT,
UOPTION_PACKAGE_NAME,
UOPTION_BUNDLE_NAME,
UOPTION_COPYRIGHT
UOPTION_DEF( "touchfile", 't', UOPT_NO_ARG) /* 12 */
};
static UBool verbose = FALSE;
static UBool write_java = FALSE;
static UBool touchfile = FALSE;
static const char* outputEnc ="";
static const char* packageName=NULL;
static const char* bundleName=NULL;
@ -156,6 +160,26 @@ main(int argc,
if(options[DESTDIR].doesOccur) {
outputDir = options[DESTDIR].value;
}
if(options[PACKAGE_NAME].doesOccur) {
packageName = options[PACKAGE_NAME].value;
if(!strcmp(packageName, "ICUDATA"))
{
packageName = U_ICUDATA_NAME;
}
if(packageName[0] == 0)
{
packageName = NULL;
}
}
if(options[TOUCHFILE].doesOccur) {
if(packageName == NULL) {
fprintf(stderr, "%s: Don't use touchfile (-t) option with no package.\n",
argv[0]);
return -1;
}
touchfile = TRUE;
}
if(options[ENCODING].doesOccur) {
encoding = options[ENCODING].value;
@ -168,9 +192,7 @@ main(int argc,
write_java = TRUE;
outputEnc = options[WRITE_JAVA].value;
}
if(options[PACKAGE_NAME].doesOccur) {
packageName = options[PACKAGE_NAME].value;
}
if(options[BUNDLE_NAME].doesOccur) {
bundleName = options[BUNDLE_NAME].value;
}
@ -194,7 +216,7 @@ main(int argc,
if (verbose) {
printf("processing file \"%s\"\n", theCurrentFileName);
}
processFile(arg, encoding, inputDir, outputDir, &status);
processFile(arg, encoding, inputDir, outputDir, packageName, &status);
}
return status;
@ -202,7 +224,7 @@ main(int argc,
/* Process a file */
static void
processFile(const char *filename, const char *cp, const char *inputDir, const char *outputDir, UErrorCode *status) {
processFile(const char *filename, const char *cp, const char *inputDir, const char *outputDir, const char *packageName, UErrorCode *status) {
FileStream *in = NULL;
struct SRBRoot *data = NULL;
UCHARBUF *ucbuf = NULL;
@ -314,13 +336,44 @@ processFile(const char *filename, const char *cp, const char *inputDir, const ch
}
/* Determine the target rb filename */
rbname = make_res_filename(filename, outputDir, status);
rbname = make_res_filename(filename, outputDir, packageName, status);
if(touchfile == TRUE) {
FileStream *q;
char msg[1024];
char *tfname = NULL;
tfname = make_res_filename(filename, outputDir, NULL, status);
if(U_FAILURE(*status))
{
fprintf(stderr, "Error writing touchfile for \"%s\"\n", filename);
*status = U_FILE_ACCESS_ERROR;
} else {
uprv_strcat(tfname, ".res");
sprintf(msg, "This empty file tells nmake that %s in package %s has been updated.\n",
filename, packageName);
q = T_FileStream_open(tfname, "w");
if(q == NULL)
{
fprintf(stderr, "Error writing touchfile \"%s\"\n", tfname);
*status = U_FILE_ACCESS_ERROR;
}
else
{
T_FileStream_write(q, msg, uprv_strlen(msg));
T_FileStream_close(q);
}
uprv_free(tfname);
}
}
if(U_FAILURE(*status)) {
goto finish;
}
if(write_java== FALSE){
/* Write the data to the file */
bundle_write(data, outputDir, outputFileName, sizeof(outputFileName), status);
bundle_write(data, outputDir, packageName, outputFileName, sizeof(outputFileName), status);
}else{
bundle_write_java(data,outputDir,outputEnc, outputFileName, sizeof(outputFileName),packageName,bundleName,status);
}
@ -357,15 +410,23 @@ finish:
static char*
make_res_filename(const char *filename,
const char *outputDir,
const char *packageName,
UErrorCode *status) {
char *basename;
char *dirname;
char *resName;
int32_t pkgLen = 0; /* length of package prefix */
if (U_FAILURE(*status)) {
return 0;
}
if(packageName != NULL)
{
pkgLen = 1 + uprv_strlen(packageName);
}
/* setup */
basename = dirname = resName = 0;
@ -389,20 +450,29 @@ make_res_filename(const char *filename,
if (outputDir == NULL) {
/* output in same dir as .txt */
resName = (char*) uprv_malloc(sizeof(char) * (uprv_strlen(dirname)
+ pkgLen
+ uprv_strlen(basename)
+ uprv_strlen(RES_SUFFIX) + 1));
+ uprv_strlen(RES_SUFFIX) + 8));
if(resName == 0) {
*status = U_MEMORY_ALLOCATION_ERROR;
goto finish;
}
uprv_strcpy(resName, dirname);
if(packageName != NULL)
{
uprv_strcat(resName, packageName);
uprv_strcat(resName, "_");
}
uprv_strcat(resName, basename);
} else {
int32_t dirlen = (int32_t)uprv_strlen(outputDir);
int32_t basenamelen = (int32_t)uprv_strlen(basename);
resName = (char*) uprv_malloc(sizeof(char) * (dirlen + basenamelen + 2));
resName = (char*) uprv_malloc(sizeof(char) * (dirlen + pkgLen + basenamelen + 8));
if (resName == NULL) {
*status = U_MEMORY_ALLOCATION_ERROR;
@ -416,6 +486,12 @@ make_res_filename(const char *filename,
resName[dirlen + 1] = '\0';
}
if(packageName != NULL)
{
uprv_strcat(resName, packageName);
uprv_strcat(resName, "_");
}
uprv_strcat(resName, basename);
}

View File

@ -274,11 +274,12 @@ uint32_t res_write(UNewDataMemory *mem, struct SResource *res,
return 0;
}
void bundle_write(struct SRBRoot *bundle, const char *outputDir, char *writtenFilename, int writtenFilenameLen, UErrorCode *status) {
void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *outputPkg, char *writtenFilename, int writtenFilenameLen, UErrorCode *status) {
UNewDataMemory *mem = NULL;
uint8_t pad = 0;
uint32_t root = 0;
uint32_t usedOffset = 0;
char dataName[1024];
if (writtenFilename && writtenFilenameLen) {
*writtenFilename = 0;
@ -302,6 +303,14 @@ void bundle_write(struct SRBRoot *bundle, const char *outputDir, char *writtenFi
writtenFilename[off] = U_FILE_SEP_CHAR;
if (--writtenFilenameLen) {
++off;
if(outputPkg != NULL)
{
uprv_strcpy(writtenFilename+off, outputPkg);
off += uprv_strlen(outputPkg);
writtenFilename[off] = '_';
++off;
}
len = (int32_t)uprv_strlen(bundle->fLocale);
if (len > writtenFilenameLen) {
len = writtenFilenameLen;
@ -319,7 +328,18 @@ void bundle_write(struct SRBRoot *bundle, const char *outputDir, char *writtenFi
}
}
mem = udata_create(outputDir, "res", bundle->fLocale, &dataInfo, (gIncludeCopyright==TRUE)? U_COPYRIGHT_STRING:NULL, status);
if(outputPkg)
{
uprv_strcpy(dataName, outputPkg);
uprv_strcat(dataName, "_");
uprv_strcat(dataName, bundle->fLocale);
}
else
{
uprv_strcpy(dataName, bundle->fLocale);
}
mem = udata_create(outputDir, "res", dataName, &dataInfo, (gIncludeCopyright==TRUE)? U_COPYRIGHT_STRING:NULL, status);
pad = calcPadding(bundle->fKeyPoint);

View File

@ -41,7 +41,7 @@ struct SRBRoot {
};
struct SRBRoot *bundle_open(UErrorCode *status);
void bundle_write(struct SRBRoot *bundle, const char *outputDir, char *writtenFilename, int writtenFilenameLen, UErrorCode *status);
void bundle_write(struct SRBRoot *bundle, const char *outputDir, const char *outputPkg, char *writtenFilename, int writtenFilenameLen, UErrorCode *status);
/* write a java resource file */
void bundle_write_java(struct SRBRoot *bundle, const char *outputDir, const char* outputEnc, char *writtenFilename,

View File

@ -26,6 +26,7 @@
#include "cstring.h"
#include "uoptions.h"
#define DATA_PKG "testdata"
#define DATA_NAME "test"
#define DATA_TYPE "dat"
@ -67,7 +68,7 @@ main(int argc, char* argv[]) {
if(argc<0 || options[0].doesOccur || options[1].doesOccur) {
fprintf(stderr,
"usage: %s [-options]\n"
"\tcreate the test file " DATA_NAME "." DATA_TYPE "\n"
"\tcreate the test file " DATA_PKG "_" DATA_NAME "." DATA_TYPE "\n"
"\toptions:\n"
"\t\t-h or -? or --help this usage text\n"
"\t\t-d or --destdir destination directory, followed by the path\n",
@ -91,7 +92,7 @@ createData(const char* outputDirectory) {
long dataLength;
uint32_t size;
pData=udata_create(outputDirectory, DATA_TYPE, DATA_NAME, &dataInfo,
pData=udata_create(outputDirectory, DATA_TYPE, DATA_PKG "_" DATA_NAME, &dataInfo,
U_COPYRIGHT_STRING, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gentest: unable to create data memory, error %d\n", errorCode);

View File

@ -187,7 +187,7 @@ int gentz::MMain(int argc, char* argv[]) {
if(argc<0 || options[0].doesOccur || options[1].doesOccur) {
fprintf(stderr,
"usage: %s [-options] timezone-file\n"
"\tread the timezone file produced by tz.pl and create " TZ_DATA_NAME "." TZ_DATA_TYPE "\n"
"\tread the timezone file produced by tz.pl and create " U_ICUDATA_NAME "_" TZ_DATA_NAME "." TZ_DATA_TYPE "\n"
"options:\n"
"\t-h or -? or --help this usage text\n"
"\t-v or --verbose turn on verbose output\n"
@ -224,7 +224,7 @@ int gentz::MMain(int argc, char* argv[]) {
int32_t wlen = writeTzDatFile(options[3].value);
if (verbose) {
fprintf(stdout, "Output file: %s.%s, %ld bytes\n",
TZ_DATA_NAME, TZ_DATA_TYPE, (long)wlen);
U_ICUDATA_NAME "_" TZ_DATA_NAME, TZ_DATA_TYPE, (long)wlen);
}
return 0; // success
@ -266,7 +266,7 @@ int32_t gentz::writeTzDatFile(const char *destdir) {
*(uint16_t*)&(dataInfo.dataVersion[0]) = header.versionYear;
*(uint16_t*)&(dataInfo.dataVersion[2]) = header.versionSuffix;
pdata = udata_create(destdir, TZ_DATA_TYPE, TZ_DATA_NAME, &dataInfo,
pdata = udata_create(destdir, TZ_DATA_TYPE, U_ICUDATA_NAME "_" TZ_DATA_NAME, &dataInfo,
useCopyright ? U_COPYRIGHT_STRING : 0, &status);
if (U_FAILURE(status)) {
die("Unable to create data memory");

View File

@ -299,7 +299,7 @@ static void writeOutInverseData(InverseTableHeader *data,
long dataLength;
pData=udata_create(outputDir, INVC_DATA_TYPE, INVC_DATA_NAME, &invUcaDataInfo,
pData=udata_create(outputDir, INVC_DATA_TYPE, U_ICUDATA_NAME "_" INVC_DATA_NAME, &invUcaDataInfo,
copyright, status);
if(U_FAILURE(*status)) {
@ -310,7 +310,7 @@ static void writeOutInverseData(InverseTableHeader *data,
/* write the data to the file */
if (VERBOSE) {
fprintf(stdout, "Writing out inverse UCA table: %s%c%s.%s\n", outputDir, U_FILE_SEP_CHAR,
INVC_DATA_NAME,
U_ICUDATA_NAME "_" INVC_DATA_NAME,
INVC_DATA_TYPE);
}
udata_writeBlock(pData, data, data->byteSize);
@ -627,7 +627,7 @@ void writeOutData(UCATableHeader *data,
long dataLength;
pData=udata_create(outputDir, UCA_DATA_TYPE, UCA_DATA_NAME, &ucaDataInfo,
pData=udata_create(outputDir, UCA_DATA_TYPE, U_ICUDATA_NAME "_" UCA_DATA_NAME, &ucaDataInfo,
copyright, status);
if(U_FAILURE(*status)) {
@ -639,7 +639,7 @@ void writeOutData(UCATableHeader *data,
if (VERBOSE) {
fprintf(stdout, "Writing out UCA table: %s%c%s.%s\n", outputDir,
U_FILE_SEP_CHAR,
UCA_DATA_NAME,
U_ICUDATA_NAME "_" UCA_DATA_NAME,
UCA_DATA_TYPE);
}
udata_writeBlock(pData, data, size);
@ -743,6 +743,11 @@ write_uca_table(const char *filename,
myD->jamoSpecial = FALSE;
tempUCATable *t = uprv_uca_initTempTable(myD, opts, NULL, IMPLICIT_TAG, status);
if(U_FAILURE(*status))
{
fprintf(stderr, "Failed to init UCA temp table: %s\n", u_errorName(*status));
return -1;
}
#if 0
IMPLICIT_TAG = 9,
@ -971,6 +976,13 @@ int main(int argc, char* argv[]) {
uprv_strcpy(basename, getLongPathname(*argv));
}
#if 0
if(u_getCombiningClass(0x0053) == 0)
{
fprintf(stderr, "SEVERE ERROR: Normalization data is not functioning! Bailing out. Was not able to load unorm.dat.\n");
exit(1);
}
#endif
return write_uca_table(filename, destdir, copyright, &status);
}

View File

@ -44,6 +44,7 @@ extern const UConverterStaticData * ucnv_converterStaticData[UCNV_NUMBER_OF_SUPP
* Global - verbosity
*/
UBool VERBOSE = FALSE;
UBool TOUCHFILE = FALSE;
/*Reads the header of the table file and fills in basic knowledge about the converter
*in "converter"
@ -247,7 +248,9 @@ static UOption options[]={
UOPTION_COPYRIGHT, /* 2 */
UOPTION_VERSION, /* 3 */
UOPTION_DESTDIR, /* 4 */
UOPTION_VERBOSE /* 5 */
UOPTION_VERBOSE, /* 5 */
UOPTION_PACKAGE_NAME, /* 6 */
UOPTION_DEF( "touchfile", 't', UOPT_NO_ARG) /* 7 */
};
int main(int argc, char* argv[])
@ -255,10 +258,13 @@ int main(int argc, char* argv[])
UConverterSharedData* mySharedData = NULL;
UErrorCode err = U_ZERO_ERROR;
char outFileName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
char touchFileName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
const char* destdir, *arg;
const char *pkgName = NULL;
size_t destdirlen;
char* dot = NULL, *outBasename;
char cnvName[UCNV_MAX_FULL_FILE_NAME_LENGTH];
char cnvNameWithPkg[UCNV_MAX_FULL_FILE_NAME_LENGTH];
UVersionInfo icuVersion;
U_MAIN_INIT_ARGS(argc, argv);
@ -289,6 +295,9 @@ int main(int argc, char* argv[])
"\t-c or --copyright include a copyright notice\n"
"\t-d or --destdir destination directory, followed by the path\n"
"\t-v or --verbose Turn on verbose output\n",
"\t-p or --pkgname sets the 'package' name for output files. If ICUDATA, then the default\n"
"\t icu package name will be used.\n"
"\t-t or --touchfile Generate additional small file without packagename, for nmake\n",
argv[0]);
return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
}
@ -301,6 +310,34 @@ int main(int argc, char* argv[])
exit(0);
}
TOUCHFILE = options[7].doesOccur;
if(!options[6].doesOccur)
{
fprintf(stderr, "%s : option -p (package name) is required.\n",
argv[0]);
exit(1);
}
else
{
pkgName =options[6].value;
if(!strcmp(pkgName, "ICUDATA"))
{
pkgName = U_ICUDATA_NAME;
}
if(pkgName[0] == 0)
{
pkgName = NULL;
if(TOUCHFILE)
{
fprintf(stderr, "%s: Don't use touchfile option with an empty packagename.\n",
argv[0]);
exit(1);
}
}
}
/* get the options values */
haveCopyright = options[2].doesOccur;
destdir = options[4].value;
@ -366,6 +403,21 @@ int main(int argc, char* argv[])
/* the basename without extension is the converter name */
uprv_strcpy(cnvName, outBasename);
if(TOUCHFILE)
{
uprv_strcpy(touchFileName, outBasename);
uprv_strcat(touchFileName, ".cnv");
}
if(pkgName != NULL)
{
/* changes both baename and filename */
uprv_strcpy(outBasename, pkgName);
uprv_strcat(outBasename, "_");
uprv_strcat(outBasename, cnvName);
}
/*Adds the target extension*/
uprv_strcat(outBasename, CONVERTER_FILE_EXTENSION);
@ -378,7 +430,7 @@ int main(int argc, char* argv[])
if (U_FAILURE(err) || (mySharedData == NULL))
{
/* if an error is found, print out an error msg and keep going */
fprintf(stderr, "Error creating \"%s\" file for \"%s\" (error code %d - %s)\n", outFileName, arg, err,
fprintf(stderr, "Error creating converter for \"%s\" file for \"%s\" (error code %d - %s)\n", outFileName, arg, err,
u_errorName(err));
err = U_ZERO_ERROR;
}
@ -395,8 +447,42 @@ int main(int argc, char* argv[])
uprv_strcpy((char*)mySharedData->staticData->name, cnvName);
writeConverterData(mySharedData, cnvName, destdir, &err);
if(pkgName == NULL)
{
uprv_strcpy(cnvNameWithPkg, cnvName);
}
else
{
uprv_strcpy(cnvNameWithPkg, pkgName);
uprv_strcat(cnvNameWithPkg, "_");
uprv_strcat(cnvNameWithPkg, cnvName);
}
writeConverterData(mySharedData, cnvNameWithPkg, destdir, &err);
((NewConverter *)mySharedData->table)->close((NewConverter *)mySharedData->table);
if(TOUCHFILE)
{
FileStream *q;
char msg[1024];
sprintf(msg, "This empty file tells nmake that %s in package %s has been updated.\n",
cnvName, pkgName);
q = T_FileStream_open(touchFileName, "w");
if(q == NULL)
{
fprintf(stderr, "Error writing touchfile \"%s\"\n", touchFileName);
err = U_FILE_ACCESS_ERROR;
}
else
{
T_FileStream_write(q, msg, uprv_strlen(msg));
T_FileStream_close(q);
}
}
/* write the information data */
uprv_free((UConverterStaticData *)mySharedData->staticData);
uprv_free(mySharedData);
@ -828,7 +914,8 @@ UConverterSharedData* createConverterFromTableFile(const char* converterName, UE
uprv_memset(myStaticData, 0, sizeof(UConverterStaticData));
mySharedData->staticData = myStaticData;
myStaticData->structSize = sizeof(UConverterStaticData);
mySharedData->staticDataOwned = TRUE;
/* mySharedData->staticDataOwned = FALSE; */ /* not owned if in udata */
mySharedData->sharedDataCached = FALSE;
mySharedData->dataMemory = NULL; /* for init */

View File

@ -434,11 +434,19 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
{
CharList *l, *tail = NULL, *tail2 = NULL;
FileStream *in;
char line[2048];
char tmp[1024];
char line[16384];
char *linePtr, *lineNext;
const uint32_t lineMax = 16300;
char tmp[1024], tmp2[1024];
char pkgPrefix[1024];
int32_t pkgPrefixLen;
const char* baseName;
char *s;
int32_t ln;
strcpy(pkgPrefix, o->shortName);
strcat(pkgPrefix, "_");
pkgPrefixLen=uprv_strlen(pkgPrefix);
for(l = o->fileListFiles; l; l = l->next) {
if(o->verbose) {
fprintf(stdout, "# Reading %s..\n", l->str);
@ -451,8 +459,16 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
*status = U_FILE_ACCESS_ERROR;
return;
}
ln = 0;
while(T_FileStream_readLine(in, line, sizeof(line))!=NULL) {
ln++;
if(uprv_strlen(line)>lineMax)
{
fprintf(stderr, "%s:%d - line too long (over %d chars)\n", l->str, ln, lineMax);
exit(1);
}
/* remove trailing newline characters */
s=line;
while(*s!=0) {
@ -466,22 +482,91 @@ static void loadLists(UPKGOptions *o, UErrorCode *status)
continue; /* comment or empty line */
}
/* add the file */
s = (char*)getLongPathname(line);
/* Now, process the line */
linePtr = line;
lineNext = NULL;
while(linePtr && *linePtr)
{
while(*linePtr == ' ')
{
linePtr++;
}
baseName = findBasename(s);
/* Find the next */
if(linePtr[0] == '"')
{
lineNext = uprv_strchr(linePtr+1, '"');
if(lineNext == NULL)
{
fprintf(stderr, "%s:%d - missing trailing double quote (\")\n",
l->str, ln);
exit(1);
}
else
{
lineNext++;
if(*lineNext)
{
if(*lineNext != ' ')
{
fprintf(stderr, "%s:%d - malformed quoted line at position %d, expected ' ' got '%c'\n",
l->str, ln, lineNext-line, (*lineNext)?*lineNext:'0');
exit(1);
}
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(baseName));
*lineNext = 0;
lineNext++;
}
}
}
else
{
lineNext = uprv_strchr(linePtr, ' ');
if(lineNext)
{
*lineNext = 0; /* terminate at space */
lineNext++;
}
}
if(s != baseName) { /* s was something long, so we leave it as it is */
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(s));
} else { /* s was just a basename, we want to prepend source dir*/
uprv_strcpy(tmp, o->srcDir);
uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1]==U_FILE_SEP_CHAR?"":U_FILE_SEP_STRING);
uprv_strcat(tmp, s);
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
}
}
/* add the file */
s = (char*)getLongPathname(linePtr);
baseName = findBasename(s);
if(s != baseName) { /* s was something long, so we leave it as it is */
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(baseName));
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(s));
} else { /* s was just a basename, we want to prepend source dir*/
/* check for prefix of package */
uprv_strcpy(tmp, o->srcDir);
uprv_strcat(tmp, o->srcDir[uprv_strlen(o->srcDir)-1]==U_FILE_SEP_CHAR?"":U_FILE_SEP_STRING);
if(strncmp(pkgPrefix,s, pkgPrefixLen))
{
/* didn't have the prefix - add it */
uprv_strcat(tmp, pkgPrefix);
/* make up a new basename */
uprv_strcpy(tmp2, pkgPrefix);
uprv_strcat(tmp2, s);
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(tmp2));
}
else
{
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(baseName));
}
uprv_strcat(tmp, s);
o->filePaths = pkg_appendToList(o->filePaths, &tail2, uprv_strdup(tmp));
}
linePtr = lineNext;
}
}
T_FileStream_close(in);
}

View File

@ -27,12 +27,14 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
{
int32_t ln = 0;
char buffer[1024];
const CharList *ol = NULL;
while(l != NULL)
{
if(l->str)
{
uprv_strcpy(buffer, l->str);
uprv_strncpy(buffer, l->str, 1020);
buffer[1019]=0;
if(quote < 0) { /* remove quotes */
if(buffer[uprv_strlen(buffer)-1] == '"') {
buffer[uprv_strlen(buffer)-1] = '\0';
@ -43,7 +45,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
} else if(quote > 0) { /* add quotes */
if(l->str[0] != '"') {
uprv_strcpy(buffer, "\"");
uprv_strcat(buffer, l->str);
uprv_strncat(buffer, l->str,1020);
}
if(l->str[uprv_strlen(l->str)-1] != '"') {
uprv_strcat(buffer, "\"");
@ -54,6 +56,7 @@ const char *pkg_writeCharListWrap(FileStream *s, CharList *l, const char *delim,
ln += uprv_strlen(l->str);
ol = l;
if(l->next && delim)
{

View File

@ -280,8 +280,11 @@ void pkg_mode_static(UPKGOptions *o, FileStream *makefile, UErrorCode *status)
T_FileStream_writeLine(makefile, "install: $(TARG_PATH)$(LIB_TARGET)\n"
"\t$(INSTALL-L) $(TARG_PATH)$(LIB_TARGET) $(INSTALLTO)/$(LIB_TARGET)\n");
T_FileStream_writeLine(makefile, "\t$(RANLIB) $(INSTALLTO)/$(LIB_TARGET)\n");
if (o->version) {
T_FileStream_writeLine(makefile, "\tcd $(INSTALLTO) && $(RM) $(MIDDLE_STATIC_LIB_TARGET) && ln -s $(LIB_TARGET) $(MIDDLE_STATIC_LIB_TARGET)\n\tcd $(INSTALLTO) && $(RM) $(STATIC_LIB_TARGET) && ln -s $(LIB_TARGET) $(STATIC_LIB_TARGET)\n");
T_FileStream_writeLine(makefile, "\t$(RANLIB) $(INSTALLTO)/$(STATIC_LIB_TARGET)\n\n");
}
*status = U_ZERO_ERROR;