ICU-1075 Data updates. More updateds to ICU data handling.
X-SVN-Rev: 5467
This commit is contained in:
parent
d046d1a2a5
commit
c84ea102a7
File diff suppressed because it is too large
Load Diff
@ -268,9 +268,10 @@ udata_setCommonData(const void *data, UErrorCode *err);
|
||||
* data and allows you to force the it to come out of a user-specified
|
||||
* pointer.
|
||||
*
|
||||
* The format of this data is that of the icu common data file, 'icudata.dat'
|
||||
* Read in or memory map the whole file and then pass the address to the start of the
|
||||
* data to this function.
|
||||
* The format of this data is that of the icu common data file, like 'icudata.dat'
|
||||
* The application must read in or otherwise construct an image of the data and then
|
||||
* pass the address of it to this function.
|
||||
*
|
||||
*
|
||||
* Warning: setAppData will fail with a U_USING_DEFAULT_ERROR error if
|
||||
* data with the specifed path that has already been opened, or
|
||||
@ -288,6 +289,20 @@ udata_setCommonData(const void *data, UErrorCode *err);
|
||||
U_CAPI void U_EXPORT2
|
||||
udata_setAppData(const char *path, const void *data, UErrorCode *err);
|
||||
|
||||
/**
|
||||
* Clean-up function for allocated memory and any other resources owned
|
||||
* by udata. Deletes all such items. Everything is returned to its initial
|
||||
* state.
|
||||
*
|
||||
* This function is called by <fill in the name>. Applicataions normally
|
||||
* have no reason to call it directly.
|
||||
*
|
||||
* @draft
|
||||
*/
|
||||
U_CAPI void U_EXPORT2
|
||||
udata_cleanup();
|
||||
|
||||
|
||||
U_CDECL_END
|
||||
|
||||
#endif
|
||||
|
@ -40,7 +40,7 @@ TESTDATAOBJDIR=../test/testdata
|
||||
top_builddir_from_tmp = $(patsubst ..%,../..%,$(top_builddir))
|
||||
INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(top_builddir_from_tmp)/common:$(top_builddir_from_tmp)/tools/toolutil:$(top_builddir_from_tmp)/stubdata:$$$(LDLIBRARYPATH_ENVVAR)
|
||||
CURDIR=$(shell pwd)
|
||||
PKGDATA = $(top_builddir_from_tmp)/tools/pkgdata/pkgdata -O $(top_builddir_from_tmp)/tools/pkgdata/icupkg.inc -d $(CURDIR) -m $(PKGDATA_MODE)
|
||||
PKGDATA = $(top_builddir_from_tmp)/tools/pkgdata/pkgdata -O $(top_builddir_from_tmp)/tools/pkgdata/icupkg.inc -d $(CURDIR)
|
||||
|
||||
|
||||
## List of phony targets
|
||||
@ -105,26 +105,24 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
|
||||
packagedata: build/icudata.lst $(top_builddir)/tools/pkgdata/icupkg.inc
|
||||
( cd build ; \
|
||||
$(INVOKE) $(PKGDATA) -e $(ICUDATA_NAME) -s . -T . -p $(ICUDATA_NAME) icudata.lst ; \
|
||||
$(INVOKE) $(PKGDATA) -e $(ICUDATA_NAME) -s . -T . -p $(ICUDATA_NAME) -m dll icudata.lst ; \
|
||||
)
|
||||
$(RM) libicudata.$(SO) && ln -s $(LIB_ICUDATA_NAME).$(SO) libicudata.$(SO) ; \
|
||||
|
||||
packagetest: $(TESTDATAOBJDIR)/testdata.lst $(top_builddir)/tools/pkgdata/icupkg.inc
|
||||
( cd $(TESTDATAOBJDIR) ; $(INVOKE) $(PKGDATA) -T . -s . -p testdata testdata.lst )
|
||||
( cd $(TESTDATAOBJDIR) ; $(INVOKE) $(PKGDATA) -T . -s . -p testdata -m common testdata.lst )
|
||||
|
||||
cleanpackage:
|
||||
@echo Cleaning up packaged data..
|
||||
@-( cd build ; $(INVOKE) $(PKGDATA) -s . -T . -p $(ICUDATA_NAME) icudata.lst --clean 2> /dev/null)
|
||||
@-( cd $(TESTDATAOBJDIR) ; $(INVOKE) $(PKGDATA) -T . -s . -p testdata testdata.lst --clean 2> /dev/null )
|
||||
@-( cd build ; $(INVOKE) $(PKGDATA) -m dll -s . -T . -p $(ICUDATA_NAME) icudata.lst --clean 2> /dev/null)
|
||||
@-( cd $(TESTDATAOBJDIR) ; $(INVOKE) $(PKGDATA) -m common -T . -s . -p testdata testdata.lst --clean 2> /dev/null )
|
||||
$(RMV) $(ICUDATA_NAME).* build/icudata.lst build/*.mak
|
||||
|
||||
## Install ICU data. Make a convenience link 'icudata' library if it's a library mode.
|
||||
install-local: build/icudata.lst $(top_builddir)/tools/pkgdata/icupkg.inc install-convrtrstxt
|
||||
$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(ICUDATA_DIR)/$(VERSION)
|
||||
( cd build ; $(INVOKE) $(PKGDATA) -e icudata -T . -s . -p $(ICUDATA_NAME) icudata.lst -I $(DESTDIR)$(ICUDATA_DIR)/$(VERSION) )
|
||||
ifeq ($(strip $(PKGDATA_MODE)),dll)
|
||||
( cd build ; $(INVOKE) $(PKGDATA) -m dll -e icudata -T . -s . -p $(ICUDATA_NAME) icudata.lst -I $(DESTDIR)$(ICUDATA_DIR)/$(VERSION) )
|
||||
(cd $(DESTDIR)$(ICUDATA_DIR)/$(VERSION); $(RM) icudata.$(SO) && ln -s $(LIB_ICUDATA_NAME).$(SO) icudata.$(SO))
|
||||
endif
|
||||
|
||||
install-convrtrstxt: $(top_srcdir)/../data/convrtrs.txt
|
||||
$(MKINSTALLDIRS) $(DESTDIR)$(pkgsysconfdir)
|
||||
|
@ -51,7 +51,6 @@ addUDataTest(TestNode** root)
|
||||
}
|
||||
|
||||
static void TestUDataOpen(){
|
||||
int i;
|
||||
UDataMemory *result;
|
||||
UErrorCode status=U_ZERO_ERROR;
|
||||
const char* memMap[][2]={
|
||||
@ -79,16 +78,24 @@ static void TestUDataOpen(){
|
||||
udata_close(result);
|
||||
}
|
||||
|
||||
for(i=0; i<sizeof(memMap)/sizeof(memMap[0]); i++){
|
||||
status=U_ZERO_ERROR;
|
||||
result=udata_open(path, memMap[i][1], memMap[i][0], &status);
|
||||
if(U_FAILURE(status)) {
|
||||
log_err("FAIL: udata_open() failed for path = %s, name=%s, type=%s, \n errorcode=%s\n", path, memMap[i][0], memMap[i][1], myErrorName(status));
|
||||
} else {
|
||||
log_verbose("PASS: udata_open worked for path = %s, name=%s, type=%s\n", path, memMap[i][0], memMap[i][1]);
|
||||
udata_close(result);
|
||||
#if 0
|
||||
{
|
||||
int i;
|
||||
/* These tests assume that the ICU data dll can be opened by name. */
|
||||
/* This is no longer true. For common data, only .dat files can be */
|
||||
/* dynamicallyopened, not libraries */
|
||||
for(i=0; i<sizeof(memMap)/sizeof(memMap[0]); i++){
|
||||
status=U_ZERO_ERROR;
|
||||
result=udata_open(path, memMap[i][1], memMap[i][0], &status);
|
||||
if(U_FAILURE(status)) {
|
||||
log_err("FAIL: udata_open() failed for path = %s, name=%s, type=%s, \n errorcode=%s\n", path, memMap[i][0], memMap[i][1], myErrorName(status));
|
||||
} else {
|
||||
log_verbose("PASS: udata_open worked for path = %s, name=%s, type=%s\n", path, memMap[i][0], memMap[i][1]);
|
||||
udata_close(result);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
log_verbose("Testing udata_open() with a non existing binary file\n");
|
||||
result=udata_open(path, "tst", "nonexist", &status);
|
||||
@ -360,9 +367,9 @@ static void TestUDataGetInfo() {
|
||||
|
||||
|
||||
log_verbose("Testing udata_getInfo() for cnvalias.dat\n");
|
||||
result=udata_open(path, type, name, &status);
|
||||
result=udata_open(NULL, type, name, &status);
|
||||
if(U_FAILURE(status)){
|
||||
log_err("FAIL: udata_open() failed for path = %s, 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", path, name, type, myErrorName(status));
|
||||
return;
|
||||
}
|
||||
udata_getInfo(result, &dataInfo);
|
||||
|
@ -8,8 +8,6 @@ top_srcdir = @top_srcdir@
|
||||
|
||||
top_builddir = ..
|
||||
|
||||
PKGDATA_MODE = $(MODE)
|
||||
|
||||
include $(top_builddir)/icudefs.mk
|
||||
|
||||
include @platform_make_fragment@
|
||||
@ -40,7 +38,7 @@ DATABUILDDIR=$(OBJDATADIR)
|
||||
# relative lib links from pkgdata are the same as for tmp
|
||||
top_builddir_from_tmp = $(patsubst ..%,../..%,$(top_builddir))
|
||||
INVOKE = $(LDLIBRARYPATH_ENVVAR)=$(top_builddir_from_tmp)/common:$(top_builddir_from_tmp)/tools/toolutil:$$$(LDLIBRARYPATH_ENVVAR)
|
||||
PKGDATA = ../pkgdata/pkgdata -T . -s $(DATABUILDDIR) -O ./icupkg.inc -d $(DATABUILDDIR) -m $(PKGDATA_MODE)
|
||||
PKGDATA = ../pkgdata/pkgdata -T . -s $(DATABUILDDIR) -O ./icupkg.inc -d $(DATABUILDDIR)
|
||||
|
||||
## Install program information
|
||||
MKINSTALLDIRS = $(SHELL) $(top_srcdir)/mkinstalldirs
|
||||
@ -206,15 +204,13 @@ build-local:
|
||||
|
||||
install-pkgdata: $(TMPDATADIR)/$(ICUDATA_NAME).lst $(TMPDATADIR)/icupkg.inc
|
||||
$(MKINSTALLDIRS) $(TMPDATADIR) $(DESTDIR)$(ICUDATA_DIR)/$(VERSION)
|
||||
(cd $(TMPDATADIR); $(INVOKE) $(PKGDATA) -p $(ICUDATA_NAME) ./$(ICUDATA_NAME).lst -I $(DESTDIR)$(ICUDATA_DIR)/$(VERSION))
|
||||
ifeq ($(strip $(PKGDATA_MODE)),dll)
|
||||
(cd $(TMPDATADIR); $(INVOKE) $(PKGDATA) -m dll -p $(ICUDATA_NAME) ./$(ICUDATA_NAME).lst -I $(DESTDIR)$(ICUDATA_DIR)/$(VERSION))
|
||||
(cd $(DESTDIR)$(ICUDATA_DIR)/$(VERSION); $(RM) icudata.$(SO) && ln -s $(ICUDATA_NAME).$(SO) icudata.$(SO))
|
||||
endif
|
||||
|
||||
clean-pkgdata:
|
||||
-(cd $(TMPDATADIR); $(INVOKE) $(PKGDATA) -p $(ICUDATA_NAME) ./$(ICUDATA_NAME).lst --clean || echo '### Warning, cannot clean up icu/data if pkgdata is already gone.' )
|
||||
-(cd $(TMPDATADIR); $(INVOKE) $(PKGDATA) -p testdat1 ./testdata.lst --clean || echo '### Warning, cannot clean up icu/data if pkgdata is already gone.' )
|
||||
-(cd $(TMPDATADIR)2; $(INVOKE) $(PKGDATA) -p testdat2 ./testdata.lst --clean || echo '### Warning, cannot clean up icu/data if pkgdata is already gone.' )
|
||||
-(cd $(TMPDATADIR); $(INVOKE) $(PKGDATA) -m dll -p $(ICUDATA_NAME) ./$(ICUDATA_NAME).lst --clean || echo '### Warning, cannot clean up icu/data if pkgdata is already gone.' )
|
||||
-(cd $(TMPDATADIR); $(INVOKE) $(PKGDATA) -m common -p testdat1 ./testdata.lst --clean || echo '### Warning, cannot clean up icu/data if pkgdata is already gone.' )
|
||||
-(cd $(TMPDATADIR)2; $(INVOKE) $(PKGDATA) -m common -p testdat2 ./testdata.lst --clean || echo '### Warning, cannot clean up icu/data if pkgdata is already gone.' )
|
||||
-$(RMV) $(TMPDATADIR)/$(ICUDATA_NAME).lst $(TMPDATADIR)/testdata.lst $(TMPDATADIR)/icupkg.inc $(TMPDATADIR)2/testdata.lst
|
||||
|
||||
check-local:
|
||||
|
Loading…
Reference in New Issue
Block a user