ICU-3933 Merge pkgdata update from branch to trunk.

X-SVN-Rev: 25002
This commit is contained in:
Michael Ow 2008-11-24 20:04:52 +00:00
parent 6565d71ae3
commit 09813cbf3d
30 changed files with 3709 additions and 2465 deletions

11
.gitattributes vendored
View File

@ -81,6 +81,7 @@ icu4c/source/data/locales/zh_Hans_HK.txt -text
icu4c/source/data/locales/zh_Hans_MO.txt -text
icu4c/source/data/misc/likelySubtags.txt -text
icu4c/source/data/misc/plurals.txt -text
icu4c/source/data/pkgdataMakefile.in -text
icu4c/source/data/xml/collation/bn_IN.xml -text
icu4c/source/data/xml/collation/ur.xml -text
icu4c/source/data/xml/main/ha.xml -text
@ -92,6 +93,7 @@ icu4c/source/data/xml/main/pa_Arab.xml -text
icu4c/source/data/xml/main/pa_PK.xml -text
icu4c/source/data/xml/main/si.xml -text
icu4c/source/data/xml/main/zu.xml -text
icu4c/source/extra/uconv/pkgdataMakefile.in -text
icu4c/source/i18n/dtitv_impl.h -text
icu4c/source/i18n/dtitvfmt.cpp -text
icu4c/source/i18n/dtitvinf.cpp -text
@ -119,12 +121,21 @@ icu4c/source/test/perf/strsrchperf/StrSrchPerf_r.pl -text
icu4c/source/test/perf/strsrchperf/strsrchperf.cpp -text
icu4c/source/test/perf/strsrchperf/strsrchperf.h -text
icu4c/source/test/perf/strsrchperf/strsrchperf.vcproj -text
icu4c/source/test/perf/utrie2perf/Makefile -text
icu4c/source/test/testdata/ConverterSelectorTestUTF16.txt -text
icu4c/source/test/testdata/TestFont1.otf -text
icu4c/source/test/testdata/icu26_testtypes.res -text
icu4c/source/test/testdata/icu26e_testtypes.res -text
icu4c/source/test/testdata/importtest.bin -text
icu4c/source/test/testdata/pkgdataMakefile.in -text
icu4c/source/test/testdata/uni-text.bin -text
icu4c/source/tools/pkgdata/pkgdata.cpp -text
icu4c/source/tools/toolutil/pkg_genc.c -text
icu4c/source/tools/toolutil/pkg_genc.h -text
icu4c/source/tools/toolutil/pkg_gencmn.c -text
icu4c/source/tools/toolutil/pkg_gencmn.h -text
icu4c/source/tools/toolutil/pkg_icu.cpp -text
icu4c/source/tools/toolutil/pkg_icu.h -text
icu4j/.classpath -text
icu4j/.project -text
icu4j/eclipseFragment.txt -text

3
.gitignore vendored
View File

@ -41,6 +41,7 @@ icu4c/source/data/icupkg.inc
icu4c/source/data/in
icu4c/source/data/makedata.vcproj.*.*.user
icu4c/source/data/out
icu4c/source/data/pkgdataMakefile
icu4c/source/doc
icu4c/source/extra/Makefile
icu4c/source/extra/scrptrun/Makefile
@ -51,6 +52,7 @@ icu4c/source/extra/uconv/Makefile
icu4c/source/extra/uconv/Release
icu4c/source/extra/uconv/debug
icu4c/source/extra/uconv/pkgdata.inc
icu4c/source/extra/uconv/pkgdataMakefile
icu4c/source/extra/uconv/pkgdatain.txt
icu4c/source/extra/uconv/release
icu4c/source/extra/uconv/resources/*.res
@ -362,6 +364,7 @@ icu4c/source/test/perf/utfperf/utfperf.vcproj.*.*.user
icu4c/source/test/testdata/Makefile
icu4c/source/test/testdata/out
icu4c/source/test/testdata/pkgdata.inc
icu4c/source/test/testdata/pkgdataMakefile
icu4c/source/test/testmap/*.d
icu4c/source/test/testmap/Debug
icu4c/source/test/testmap/Makefile

View File

@ -49,6 +49,7 @@ CFLAGS+=/GF /nologo
CXXFLAGS+=/GF /nologo /EHsc /Zc:wchar_t
CPPFLAGS+=-D_CRT_SECURE_NO_DEPRECATE
DEFS+=-DWIN32
DEFS+=-DCYGWINMSVC
LDFLAGS+=/nologo
# Commands to compile

View File

@ -10078,7 +10078,7 @@ then
fi
# output the Makefiles
ac_config_files="$ac_config_files icudefs.mk Makefile data/icupkg.inc config/Makefile.inc data/Makefile stubdata/Makefile common/Makefile i18n/Makefile layout/Makefile layoutex/Makefile io/Makefile extra/Makefile extra/uconv/Makefile extra/scrptrun/Makefile tools/Makefile tools/ctestfw/Makefile tools/toolutil/Makefile tools/makeconv/Makefile tools/genrb/Makefile tools/genuca/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/genctd/Makefile tools/gennames/Makefile tools/gentest/Makefile tools/gennorm/Makefile tools/genprops/Makefile tools/gencase/Makefile tools/genbidi/Makefile tools/genpname/Makefile tools/genbrk/Makefile tools/gensprep/Makefile tools/icupkg/Makefile tools/icuswap/Makefile tools/pkgdata/Makefile tools/tzcode/Makefile test/Makefile test/compat/Makefile test/testdata/Makefile test/testdata/pkgdata.inc test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/letest/Makefile test/perf/Makefile test/perf/collationperf/Makefile test/perf/ubrkperf/Makefile test/perf/charperf/Makefile test/perf/convperf/Makefile test/perf/normperf/Makefile test/perf/strsrchperf/Makefile test/perf/unisetperf/Makefile test/perf/usetperf/Makefile test/perf/ustrperf/Makefile test/perf/utfperf/Makefile test/perf/utrie2perf/Makefile samples/Makefile samples/date/Makefile samples/cal/Makefile samples/layout/Makefile common/unicode/platform.h"
ac_config_files="$ac_config_files icudefs.mk Makefile data/pkgdataMakefile config/Makefile.inc data/Makefile stubdata/Makefile common/Makefile i18n/Makefile layout/Makefile layoutex/Makefile io/Makefile extra/Makefile extra/uconv/Makefile extra/uconv/pkgdataMakefile extra/scrptrun/Makefile tools/Makefile tools/ctestfw/Makefile tools/toolutil/Makefile tools/makeconv/Makefile tools/genrb/Makefile tools/genuca/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/Makefile tools/genctd/Makefile tools/gennames/Makefile tools/gentest/Makefile tools/gennorm/Makefile tools/genprops/Makefile tools/gencase/Makefile tools/genbidi/Makefile tools/genpname/Makefile tools/genbrk/Makefile tools/gensprep/Makefile tools/icupkg/Makefile tools/icuswap/Makefile tools/pkgdata/Makefile tools/tzcode/Makefile test/Makefile test/compat/Makefile test/testdata/Makefile test/testdata/pkgdataMakefile test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/letest/Makefile test/perf/Makefile test/perf/collationperf/Makefile test/perf/ubrkperf/Makefile test/perf/charperf/Makefile test/perf/convperf/Makefile test/perf/normperf/Makefile test/perf/strsrchperf/Makefile test/perf/unisetperf/Makefile test/perf/usetperf/Makefile test/perf/ustrperf/Makefile test/perf/utfperf/Makefile test/perf/utrie2perf/Makefile samples/Makefile samples/date/Makefile samples/cal/Makefile samples/layout/Makefile common/unicode/platform.h"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@ -10678,7 +10678,7 @@ do
"common/icucfg.h") CONFIG_HEADERS="$CONFIG_HEADERS common/icucfg.h" ;;
"icudefs.mk") CONFIG_FILES="$CONFIG_FILES icudefs.mk" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"data/icupkg.inc") CONFIG_FILES="$CONFIG_FILES data/icupkg.inc" ;;
"data/pkgdataMakefile") CONFIG_FILES="$CONFIG_FILES data/pkgdataMakefile" ;;
"config/Makefile.inc") CONFIG_FILES="$CONFIG_FILES config/Makefile.inc" ;;
"data/Makefile") CONFIG_FILES="$CONFIG_FILES data/Makefile" ;;
"stubdata/Makefile") CONFIG_FILES="$CONFIG_FILES stubdata/Makefile" ;;
@ -10689,6 +10689,7 @@ do
"io/Makefile") CONFIG_FILES="$CONFIG_FILES io/Makefile" ;;
"extra/Makefile") CONFIG_FILES="$CONFIG_FILES extra/Makefile" ;;
"extra/uconv/Makefile") CONFIG_FILES="$CONFIG_FILES extra/uconv/Makefile" ;;
"extra/uconv/pkgdataMakefile") CONFIG_FILES="$CONFIG_FILES extra/uconv/pkgdataMakefile" ;;
"extra/scrptrun/Makefile") CONFIG_FILES="$CONFIG_FILES extra/scrptrun/Makefile" ;;
"tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;;
"tools/ctestfw/Makefile") CONFIG_FILES="$CONFIG_FILES tools/ctestfw/Makefile" ;;
@ -10716,7 +10717,7 @@ do
"test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;;
"test/compat/Makefile") CONFIG_FILES="$CONFIG_FILES test/compat/Makefile" ;;
"test/testdata/Makefile") CONFIG_FILES="$CONFIG_FILES test/testdata/Makefile" ;;
"test/testdata/pkgdata.inc") CONFIG_FILES="$CONFIG_FILES test/testdata/pkgdata.inc" ;;
"test/testdata/pkgdataMakefile") CONFIG_FILES="$CONFIG_FILES test/testdata/pkgdataMakefile" ;;
"test/hdrtst/Makefile") CONFIG_FILES="$CONFIG_FILES test/hdrtst/Makefile" ;;
"test/intltest/Makefile") CONFIG_FILES="$CONFIG_FILES test/intltest/Makefile" ;;
"test/cintltst/Makefile") CONFIG_FILES="$CONFIG_FILES test/cintltst/Makefile" ;;

View File

@ -1041,7 +1041,7 @@ fi
# output the Makefiles
AC_CONFIG_FILES([icudefs.mk \
Makefile \
data/icupkg.inc \
data/pkgdataMakefile \
config/Makefile.inc \
data/Makefile \
stubdata/Makefile \
@ -1052,6 +1052,7 @@ AC_CONFIG_FILES([icudefs.mk \
io/Makefile \
extra/Makefile \
extra/uconv/Makefile \
extra/uconv/pkgdataMakefile \
extra/scrptrun/Makefile \
tools/Makefile \
tools/ctestfw/Makefile \
@ -1079,7 +1080,7 @@ AC_CONFIG_FILES([icudefs.mk \
test/Makefile \
test/compat/Makefile \
test/testdata/Makefile \
test/testdata/pkgdata.inc \
test/testdata/pkgdataMakefile \
test/hdrtst/Makefile \
test/intltest/Makefile \
test/cintltst/Makefile \

View File

@ -36,7 +36,7 @@ ICUPKGDATA_OUTDIR = $(OUTDIR)
endif
CURDIR:=$(CURR_FULL_DIR)
PKGDATA = $(BINDIR)/pkgdata $(PKGDATA_OPTS) -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) -d $(ICUPKGDATA_OUTDIR) -M'PKGDATA_LDFLAGS="$(LDFLAGSICUDT)"'
PKGDATA = $(BINDIR)/pkgdata $(PKGDATA_OPTS) -q -c -s $(CURDIR)/out/build/$(ICUDATA_PLATFORM_NAME) -d $(ICUPKGDATA_OUTDIR)
ifeq ($(OS390_STUBDATA),1)
OS390PKG=package390
@ -574,9 +574,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
icupkg.inc: $(srcdir)/icupkg.inc.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
icupkg.inc:
$(MAKE) -f pkgdataMakefile
###########
########### 390 (z/OS) support

View File

@ -350,7 +350,7 @@ ALL_RES = $(ALL_RES) $(RB_FILES) $(MISC_FILES)
# Common defines for both ways of building ICU's data library.
COMMON_ICUDATA_DEPENDENCIES="$(ICUPBIN)\pkgdata.exe" "$(ICUTMP)\icudata.res" "$(ICUP)\source\stubdata\stubdatabuilt.txt"
COMMON_ICUDATA_ARGUMENTS=-f -e $(U_ICUDATA_NAME) -v $(ICU_PACKAGE_MODE) -M"PKGDATA_LDFLAGS=/base:0x4ad00000" -c -p $(ICUPKG) -T "$(ICUTMP)" -L $(U_ICUDATA_NAME) -d "$(ICUBLD_PKG)" -s .
COMMON_ICUDATA_ARGUMENTS=-f -e $(U_ICUDATA_NAME) -v $(ICU_PACKAGE_MODE) -c -p $(ICUPKG) -T "$(ICUTMP)" -L $(U_ICUDATA_NAME) -d "$(ICUBLD_PKG)" -s .
#############################################################################
#

View File

@ -0,0 +1,39 @@
## pkgdataMakefile.in for ICU data
## Copyright (c) 2008, International Business Machines Corporation and
## others. All Rights Reserved.
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
# So that you have $(top_builddir)/config.status
top_builddir = ..
## All the flags and other definitions are included here.
include $(top_builddir)/icudefs.mk
OUTPUTFILE=icupkg.inc
MIDDLE_SO_TARGET=
all : clean
@echo GENCCODE_ASSEMBLY_TYPE=$(GENCCODE_ASSEMBLY) >> $(OUTPUTFILE)
@echo SO=$(SO) >> $(OUTPUTFILE)
@echo SOBJ=$(SOBJ) >> $(OUTPUTFILE)
@echo A=$(A) >> $(OUTPUTFILE)
@echo LIBPREFIX=$(LIBPREFIX) >> $(OUTPUTFILE)
@echo LIB_EXT_ORDER=$(FINAL_SO_TARGET) >> $(OUTPUTFILE)
@echo COMPILE="$(COMPILE.c)" >> $(OUTPUTFILE)
@echo LIBFLAGS="-I$(top_srcdir)/common -I$(top_builddir)/common $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE)
@echo GENLIB="$(SHLIB.c)" >> $(OUTPUTFILE)
@echo LDICUDTFLAGS=$(LDFLAGSICUDT) >> $(OUTPUTFILE)
@echo LD_SONAME=$(LD_SONAME) >> $(OUTPUTFILE)
@echo RPATH_FLAGS=$(RPATH_FLAGS) >> $(OUTPUTFILE)
@echo BIR_LDFLAGS=$(BIR_LDFLAGS) >> $(OUTPUTFILE)
@echo AR=$(AR) >> $(OUTPUTFILE)
@echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
@echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
clean :
$(RMV) $(OUTPUTFILE)

View File

@ -1,6 +1,6 @@
## ******************************************************************************
## *
## * Copyright (C) 1999-2006, International Business Machines
## * Copyright (C) 1999-2008, International Business Machines
## * Corporation and others. All Rights Reserved.
## *
## *******************************************************************************
@ -118,9 +118,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
pkgdata.inc: $(srcdir)/pkgdata.inc.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
pkgdata.inc:
$(MAKE) -f pkgdataMakefile
$(TARGET_STUB_NAME).$(SECTION): $(srcdir)/$(TARGET_STUB_NAME).$(SECTION).in pkgdata.inc
cd $(top_builddir) \

View File

@ -0,0 +1,40 @@
## pkgdataMakefile.in for ICU data
## Copyright (c) 2008, International Business Machines Corporation and
## others. All Rights Reserved.
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
# So that you have $(top_builddir)/config.status
top_builddir = ../..
## All the flags and other definitions are included here.
include $(top_builddir)/icudefs.mk
MIDDLE_SO_TARGET=
OUTPUTFILE=pkgdata.inc
all : clean
@echo GENCCODE_ASSEMBLY_TYPE=$(GENCCODE_ASSEMBLY) >> $(OUTPUTFILE)
@echo SO=$(SO) >> $(OUTPUTFILE)
@echo SOBJ=$(SOBJ) >> $(OUTPUTFILE)
@echo A=$(A) >> $(OUTPUTFILE)
@echo LIBPREFIX=$(LIBPREFIX) >> $(OUTPUTFILE)
@echo LIB_EXT_ORDER=$(FINAL_SO_TARGET) >> $(OUTPUTFILE)
@echo COMPILE="$(COMPILE.c)" >> $(OUTPUTFILE)
@echo LIBFLAGS="-I$(top_srcdir)/common -I$(top_builddir)/common $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE)
@echo GENLIB="$(SHLIB.c)" >> $(OUTPUTFILE)
@echo LDICUDTFLAGS=$(LDFLAGSICUDT) >> $(OUTPUTFILE)
@echo LD_SONAME=$(LD_SONAME) >> $(OUTPUTFILE)
@echo RPATH_FLAGS=$(RPATH_FLAGS) >> $(OUTPUTFILE)
@echo BIR_LDFLAGS=$(BIR_LDFLAGS) >> $(OUTPUTFILE)
@echo AR=$(AR) >> $(OUTPUTFILE)
@echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
@echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
clean :
$(RMV) $(OUTPUTFILE)

View File

@ -0,0 +1,79 @@
## Makefile.in for ICU - test/perf/utrie2perf
## Copyright (c) 2001-2008, International Business Machines Corporation and
## others. All Rights Reserved.
## Source directory information
srcdir = .
top_srcdir = ../../..
top_builddir = ../../..
include $(top_builddir)/icudefs.mk
## Build directory information
subdir = test/perf/utrie2perf
## Extra files to remove for 'make clean'
CLEANFILES = *~ $(DEPS)
## Target information
TARGET = utrie2perf
CPPFLAGS += -I$(top_builddir)/common -I$(top_srcdir)/common -I$(top_srcdir)/tools/toolutil -I$(top_srcdir)/tools/ctestfw
LIBS = $(LIBCTESTFW) $(LIBICUI18N) $(LIBICUUC) $(LIBICUTOOLUTIL) $(DEFAULT_LIBS) $(LIB_M)
OBJECTS = utrie2perf.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
## 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)
install-local:
dist-local:
clean-local:
test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
$(RMV) $(OBJECTS) $(TARGET)
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) -o $@ $^ $(LIBS)
$(POST_BUILD_STEP)
invoke:
ICU_DATA=$${ICU_DATA:-$(top_builddir)/data/} TZ=PST8PDT $(INVOKE) $(INVOCATION)
ifeq (,$(MAKECMDGOALS))
-include $(DEPS)
else
ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
ifneq ($(patsubst %install,,$(MAKECMDGOALS)),)
-include $(DEPS)
endif
endif
endif

View File

@ -63,10 +63,8 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
pkgdata.inc: $(srcdir)/pkgdata.inc.in Makefile $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
pkgdata.inc:
$(MAKE) -f pkgdataMakefile
#########################################################################
############################## Test ## stuff ############################

View File

@ -0,0 +1,40 @@
## pkgdataMakefile.in for ICU data
## Copyright (c) 2008, International Business Machines Corporation and
## others. All Rights Reserved.
## Source directory information
srcdir = @srcdir@
top_srcdir = @top_srcdir@
# So that you have $(top_builddir)/config.status
top_builddir = ../..
## All the flags and other definitions are included here.
include $(top_builddir)/icudefs.mk
MIDDLE_SO_TARGET=
OUTPUTFILE=pkgdata.inc
all : clean
@echo GENCCODE_ASSEMBLY_TYPE=$(GENCCODE_ASSEMBLY) >> $(OUTPUTFILE)
@echo SO=$(SO) >> $(OUTPUTFILE)
@echo SOBJ=$(SOBJ) >> $(OUTPUTFILE)
@echo A=$(A) >> $(OUTPUTFILE)
@echo LIBPREFIX=$(LIBPREFIX) >> $(OUTPUTFILE)
@echo LIB_EXT_ORDER=$(FINAL_SO_TARGET) >> $(OUTPUTFILE)
@echo COMPILE="$(COMPILE.c)" >> $(OUTPUTFILE)
@echo LIBFLAGS="-I$(top_srcdir)/common -I$(top_builddir)/common $(SHAREDLIBCPPFLAGS) $(SHAREDLIBCFLAGS)" >> $(OUTPUTFILE)
@echo GENLIB="$(SHLIB.c)" >> $(OUTPUTFILE)
@echo LDICUDTFLAGS=$(LDFLAGSICUDT) >> $(OUTPUTFILE)
@echo LD_SONAME=$(LD_SONAME) >> $(OUTPUTFILE)
@echo RPATH_FLAGS=$(RPATH_FLAGS) >> $(OUTPUTFILE)
@echo BIR_LDFLAGS=$(BIR_LDFLAGS) >> $(OUTPUTFILE)
@echo AR=$(AR) >> $(OUTPUTFILE)
@echo ARFLAGS=$(ARFLAGS) >> $(OUTPUTFILE)
@echo RANLIB=$(RANLIB) >> $(OUTPUTFILE)
clean :
$(RMV) $(OUTPUTFILE)

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 1999-2006, International Business Machines
* Copyright (C) 1999-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -29,95 +29,7 @@
#include "unewdata.h"
#include "uoptions.h"
#include "putilimp.h"
#define STRING_STORE_SIZE 100000
#define MAX_FILE_COUNT 2000
#define COMMON_DATA_NAME U_ICUDATA_NAME
#define DATA_TYPE "dat"
/* ICU package data file format (.dat files) ------------------------------- ***
Description of the data format after the usual ICU data file header
(UDataInfo etc.).
Format version 1
A .dat package file contains a simple Table of Contents of item names,
followed by the items themselves:
1. ToC table
uint32_t count; - number of items
UDataOffsetTOCEntry entry[count]; - pair of uint32_t values per item:
uint32_t nameOffset; - offset of the item name
uint32_t dataOffset; - offset of the item data
both are byte offsets from the beginning of the data
2. item name strings
All item names are stored as char * strings in one block between the ToC table
and the data items.
3. data items
The data items are stored following the item names block.
Each data item is 16-aligned.
The data items are stored in the sorted order of their names.
Therefore, the top of the name strings block is the offset of the first item,
the length of the last item is the difference between its offset and
the .dat file length, and the length of all previous items is the difference
between its offset and the next one.
----------------------------------------------------------------------------- */
/* UDataInfo cf. udata.h */
static const UDataInfo dataInfo={
sizeof(UDataInfo),
0,
U_IS_BIG_ENDIAN,
U_CHARSET_FAMILY,
sizeof(UChar),
0,
{0x43, 0x6d, 0x6e, 0x44}, /* dataFormat="CmnD" */
{1, 0, 0, 0}, /* formatVersion */
{3, 0, 0, 0} /* dataVersion */
};
static uint32_t maxSize;
static char stringStore[STRING_STORE_SIZE];
static uint32_t stringTop=0, basenameTotal=0;
typedef struct {
char *pathname, *basename;
uint32_t basenameLength, basenameOffset, fileSize, fileOffset;
} File;
static File files[MAX_FILE_COUNT];
static uint32_t fileCount=0;
/* prototypes --------------------------------------------------------------- */
static void
addFile(const char *filename, UBool sourceTOC, UBool verbose);
static char *
allocString(uint32_t length);
static int
compareFiles(const void *file1, const void *file2);
static char *
pathToFullPath(const char *path);
/* map non-tree separator (such as '\') to tree separator ('/') inplace. */
static void
fixDirToTreePath(char *s);
/* -------------------------------------------------------------------------- */
#include "pkg_gencmn.h"
static UOption options[]={
/*0*/ UOPTION_HELP_H,
@ -133,26 +45,14 @@ static UOption options[]={
/*10*/UOPTION_SOURCEDIR,
};
static char *symPrefix = NULL;
extern int
main(int argc, char* argv[]) {
static char buffer[4096];
char line[512];
FileStream *in, *file;
char *s;
UErrorCode errorCode=U_ZERO_ERROR;
uint32_t i, fileOffset, basenameOffset, length, nread;
UBool sourceTOC, verbose;
const char *entrypointName = NULL;
uint32_t maxSize;
U_MAIN_INIT_ARGS(argc, argv);
/* preset then read command line options */
options[4].value=u_getDataDirectory();
options[6].value=COMMON_DATA_NAME;
options[7].value=DATA_TYPE;
options[10].value=".";
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
/* error handling, printing usage message */
@ -166,7 +66,7 @@ main(int argc, char* argv[]) {
if(argc<0 || options[0].doesOccur || options[1].doesOccur) {
FILE *where = argc < 0 ? stderr : stdout;
/*
* Broken into chucks because the C89 standard says the minimum
* required supported string length is 509 bytes.
@ -186,9 +86,9 @@ main(int argc, char* argv[]) {
"\t-d, --destdir dir destination directory\n");
fprintf(where,
"\t-n, --name filename output filename, without .type extension\n"
"\t (default: " COMMON_DATA_NAME ")\n"
"\t (default: " U_ICUDATA_NAME ")\n"
"\t-t, --type filetype type of the destination file\n"
"\t (default: \"" DATA_TYPE "\")\n"
"\t (default: \" dat \")\n"
"\t-S, --source tocfile write a .c source file with the table of\n"
"\t contents\n"
"\t-e, --entrypoint name override the c entrypoint name\n"
@ -203,423 +103,17 @@ main(int argc, char* argv[]) {
maxSize=(uint32_t)uprv_strtoul(argv[1], NULL, 0);
if(argc==2) {
in=T_FileStream_stdin();
} else {
in=T_FileStream_open(argv[2], "r");
if(in==NULL) {
fprintf(stderr, "gencmn: unable to open input file %s\n", argv[2]);
exit(U_FILE_ACCESS_ERROR);
}
}
if (verbose) {
if(sourceTOC) {
printf("generating %s_%s.c (table of contents source file)\n", options[6].value, options[7].value);
} else {
printf("generating %s.%s (common data file with table of contents)\n", options[6].value, options[7].value);
}
}
/* read the list of files and get their lengths */
while(T_FileStream_readLine(in, line, sizeof(line))!=NULL) {
/* remove trailing newline characters */
s=line;
while(*s!=0) {
if(*s=='\r' || *s=='\n') {
*s=0;
break;
}
++s;
}
/* check for comment */
if (*line == '#') {
continue;
}
/* add the file */
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
{
char *t;
while((t = uprv_strchr(line,U_FILE_ALT_SEP_CHAR))) {
*t = U_FILE_SEP_CHAR;
}
}
#endif
addFile(getLongPathname(line), sourceTOC, verbose);
}
if(in!=T_FileStream_stdin()) {
T_FileStream_close(in);
}
if(fileCount==0) {
fprintf(stderr, "gencmn: no files listed in %s\n", argc==2 ? "<stdin>" : argv[2]);
return 0;
}
/* sort the files by basename */
qsort(files, fileCount, sizeof(File), compareFiles);
if(!sourceTOC) {
UNewDataMemory *out;
/* determine the offsets of all basenames and files in this common one */
basenameOffset=4+8*fileCount;
fileOffset=(basenameOffset+(basenameTotal+15))&~0xf;
for(i=0; i<fileCount; ++i) {
files[i].fileOffset=fileOffset;
fileOffset+=(files[i].fileSize+15)&~0xf;
files[i].basenameOffset=basenameOffset;
basenameOffset+=files[i].basenameLength;
}
/* create the output file */
out=udata_create(options[4].value, options[7].value, options[6].value,
&dataInfo,
options[3].doesOccur ? U_COPYRIGHT_STRING : options[5].value,
&errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gencmn: udata_create(-d %s -n %s -t %s) failed - %s\n",
options[4].value, options[6].value, options[7].value,
u_errorName(errorCode));
exit(errorCode);
}
/* write the table of contents */
udata_write32(out, fileCount);
for(i=0; i<fileCount; ++i) {
udata_write32(out, files[i].basenameOffset);
udata_write32(out, files[i].fileOffset);
}
/* write the basenames */
for(i=0; i<fileCount; ++i) {
udata_writeString(out, files[i].basename, files[i].basenameLength);
}
length=4+8*fileCount+basenameTotal;
/* copy the files */
for(i=0; i<fileCount; ++i) {
/* pad to 16-align the next file */
length&=0xf;
if(length!=0) {
udata_writePadding(out, 16-length);
}
if (verbose) {
printf("adding %s (%ld byte%s)\n", files[i].pathname, (long)files[i].fileSize, files[i].fileSize == 1 ? "" : "s");
}
/* copy the next file */
file=T_FileStream_open(files[i].pathname, "rb");
if(file==NULL) {
fprintf(stderr, "gencmn: unable to open listed file %s\n", files[i].pathname);
exit(U_FILE_ACCESS_ERROR);
}
for(nread = 0;;) {
length=T_FileStream_read(file, buffer, sizeof(buffer));
if(length <= 0) {
break;
}
nread += length;
udata_writeBlock(out, buffer, length);
}
T_FileStream_close(file);
length=files[i].fileSize;
if (nread != files[i].fileSize) {
fprintf(stderr, "gencmn: unable to read %s properly (got %ld/%ld byte%s)\n", files[i].pathname, (long)nread, (long)files[i].fileSize, files[i].fileSize == 1 ? "" : "s");
exit(U_FILE_ACCESS_ERROR);
}
}
/* pad to 16-align the last file (cleaner, avoids growing .dat files in icuswap) */
length&=0xf;
if(length!=0) {
udata_writePadding(out, 16-length);
}
/* finish */
udata_finish(out, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gencmn: udata_finish() failed - %s\n", u_errorName(errorCode));
exit(errorCode);
}
} else {
/* write a .c source file with the table of contents */
char *filename;
FileStream *out;
/* create the output filename */
filename=s=buffer;
uprv_strcpy(filename, options[4].value);
s=filename+uprv_strlen(filename);
if(s>filename && *(s-1)!=U_FILE_SEP_CHAR) {
*s++=U_FILE_SEP_CHAR;
}
uprv_strcpy(s, options[6].value);
if(*(options[7].value)!=0) {
s+=uprv_strlen(s);
*s++='_';
uprv_strcpy(s, options[7].value);
}
s+=uprv_strlen(s);
uprv_strcpy(s, ".c");
/* open the output file */
out=T_FileStream_open(filename, "w");
if(out==NULL) {
fprintf(stderr, "gencmn: unable to open .c output file %s\n", filename);
exit(U_FILE_ACCESS_ERROR);
}
/* If an entrypoint is specified, use it. */
if(options[9].doesOccur) {
entrypointName = options[9].value;
} else {
entrypointName = options[6].value;
}
/* write the source file */
sprintf(buffer,
"/*\n"
" * ICU common data table of contents for %s.%s ,\n"
" * Automatically generated by icu/source/tools/gencmn/gencmn .\n"
" */\n\n"
"#include \"unicode/utypes.h\"\n"
"#include \"unicode/udata.h\"\n"
"\n"
"/* external symbol declarations for data */\n",
options[6].value, options[7].value);
T_FileStream_writeLine(out, buffer);
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?symPrefix:"", files[i].pathname);
T_FileStream_writeLine(out, buffer);
}
T_FileStream_writeLine(out, ";\n\n");
sprintf(
buffer,
"U_EXPORT struct {\n"
" uint16_t headerSize;\n"
" uint8_t magic1, magic2;\n"
" UDataInfo info;\n"
" char padding[%lu];\n"
" uint32_t count, reserved;\n"
" struct {\n"
" const char *name;\n"
" const void *data;\n"
" } toc[%lu];\n"
"} U_EXPORT2 %s_dat = {\n"
" 32, 0xda, 0x27, {\n"
" %lu, 0,\n"
" %u, %u, %u, 0,\n"
" {0x54, 0x6f, 0x43, 0x50},\n"
" {1, 0, 0, 0},\n"
" {0, 0, 0, 0}\n"
" },\n"
" \"\", %lu, 0, {\n",
(unsigned long)32-4-sizeof(UDataInfo),
(unsigned long)fileCount,
entrypointName,
(unsigned long)sizeof(UDataInfo),
U_IS_BIG_ENDIAN,
U_CHARSET_FAMILY,
U_SIZEOF_UCHAR,
(unsigned long)fileCount
);
T_FileStream_writeLine(out, buffer);
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?symPrefix:"", files[i].pathname);
T_FileStream_writeLine(out, buffer);
}
T_FileStream_writeLine(out, "\n }\n};\n");
T_FileStream_close(out);
uprv_free(symPrefix);
}
createCommonDataFile(options[4].doesOccur ? options[4].value : NULL,
options[6].doesOccur ? options[6].value : NULL,
options[9].doesOccur ? options[9].value : options[6].doesOccur ? options[6].value : NULL,
options[7].doesOccur ? options[7].value : NULL,
options[10].doesOccur ? options[10].value : NULL,
options[3].doesOccur ? U_COPYRIGHT_STRING : options[5].doesOccur ? options[5].value : NULL,
argc == 2 ? NULL : argv[2],
maxSize, sourceTOC, verbose, NULL);
return 0;
}
static void
addFile(const char *filename, UBool sourceTOC, UBool verbose) {
char *s;
uint32_t length;
char *fullPath = NULL;
if(fileCount==MAX_FILE_COUNT) {
fprintf(stderr, "gencmn: too many files, maximum is %d\n", MAX_FILE_COUNT);
exit(U_BUFFER_OVERFLOW_ERROR);
}
if(!sourceTOC) {
FileStream *file;
if(uprv_pathIsAbsolute(filename)) {
fprintf(stderr, "gencmn: Error: absolute path encountered. Old style paths are not supported. Use relative paths such as 'fur.res' or 'translit%cfur.res'.\n\tBad path: '%s'\n", U_FILE_SEP_CHAR, filename);
exit(U_ILLEGAL_ARGUMENT_ERROR);
}
fullPath = pathToFullPath(filename);
/* store the pathname */
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1);
s=allocString(length);
uprv_strcpy(s, options[6].value);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
/* get the basename */
fixDirToTreePath(s);
files[fileCount].basename=s;
files[fileCount].basenameLength=length;
files[fileCount].pathname=fullPath;
basenameTotal+=length;
/* try to open the file */
file=T_FileStream_open(fullPath, "rb");
if(file==NULL) {
fprintf(stderr, "gencmn: unable to open listed file %s\n", fullPath);
exit(U_FILE_ACCESS_ERROR);
}
/* get the file length */
length=T_FileStream_size(file);
if(T_FileStream_error(file) || length<=20) {
fprintf(stderr, "gencmn: unable to get length of listed file %s\n", fullPath);
exit(U_FILE_ACCESS_ERROR);
}
T_FileStream_close(file);
/* do not add files that are longer than maxSize */
if(maxSize && length>maxSize) {
if (verbose) {
printf("%s ignored (size %ld > %ld)\n", fullPath, (long)length, (long)maxSize);
}
return;
}
files[fileCount].fileSize=length;
} else {
char *t;
/* get and store the basename */
/* need to include the package name */
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(options[6].value) + 1);
s=allocString(length);
uprv_strcpy(s, options[6].value);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
fixDirToTreePath(s);
files[fileCount].basename=s;
/* turn the basename into an entry point name and store in the pathname field */
t=files[fileCount].pathname=allocString(length);
while(--length>0) {
if(*s=='.' || *s=='-' || *s=='/') {
*t='_';
} else {
*t=*s;
}
++s;
++t;
}
*t=0;
}
++fileCount;
}
static char *
allocString(uint32_t length) {
uint32_t top=stringTop+length;
char *p;
if(top>STRING_STORE_SIZE) {
fprintf(stderr, "gencmn: out of memory\n");
exit(U_MEMORY_ALLOCATION_ERROR);
}
p=stringStore+stringTop;
stringTop=top;
return p;
}
static char *
pathToFullPath(const char *path) {
int32_t length;
int32_t newLength;
char *fullPath;
int32_t n;
length = (uint32_t)(uprv_strlen(path) + 1);
newLength = (length + 1 + (int32_t)uprv_strlen(options[10].value));
fullPath = uprv_malloc(newLength);
if(options[10].doesOccur) {
uprv_strcpy(fullPath, options[10].value);
uprv_strcat(fullPath, U_FILE_SEP_STRING);
} else {
fullPath[0] = 0;
}
n = (int32_t)uprv_strlen(fullPath);
uprv_strcat(fullPath, path);
#if (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR)
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_FILE_ALT_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
}
#endif
#endif
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
}
#endif
return fullPath;
}
static int
compareFiles(const void *file1, const void *file2) {
/* sort by basename */
return uprv_strcmp(((File *)file1)->basename, ((File *)file2)->basename);
}
static void
fixDirToTreePath(char *s)
{
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) || ((U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) && (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR))
char *t;
#endif
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
for(t=s;t=uprv_strchr(t,U_FILE_SEP_CHAR);) {
*t = U_TREE_ENTRY_SEP_CHAR;
}
#endif
#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) && (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
for(t=s;t=uprv_strchr(t,U_FILE_ALT_SEP_CHAR);) {
*t = U_TREE_ENTRY_SEP_CHAR;
}
#endif
}
/*
* Hey, Emacs, please set the following:
*

View File

@ -1,7 +1,7 @@
/*
*******************************************************************************
*
* Copyright (C) 2005-2007, International Business Machines
* Copyright (C) 2005-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
@ -34,6 +34,7 @@
#include "uoptions.h"
#include "uparse.h"
#include "package.h"
#include "pkg_icu.h"
#include <stdio.h>
#include <stdlib.h>
@ -47,133 +48,6 @@ U_NAMESPACE_USE
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
// read a file list -------------------------------------------------------- ***
static const char *reservedChars="\"%&'()*+,-./:;<=>?_";
static const struct {
const char *suffix;
int32_t length;
} listFileSuffixes[]={
{ ".txt", 4 },
{ ".lst", 4 },
{ ".tmp", 4 }
};
/* check for multiple text file suffixes to see if this list name is a text file name */
static UBool
isListTextFile(const char *listname) {
const char *listNameEnd=strchr(listname, 0);
const char *suffix;
int32_t i, length;
for(i=0; i<LENGTHOF(listFileSuffixes); ++i) {
suffix=listFileSuffixes[i].suffix;
length=listFileSuffixes[i].length;
if((listNameEnd-listname)>length && 0==memcmp(listNameEnd-length, suffix, length)) {
return TRUE;
}
}
return FALSE;
}
/*
* Read a file list.
* If the listname ends with ".txt", then read the list file
* (in the system/ invariant charset).
* If the listname ends with ".dat", then read the ICU .dat package file.
* Otherwise, read the file itself as a single-item list.
*/
static Package *
readList(const char *filesPath, const char *listname, UBool readContents) {
Package *listPkg;
FILE *file;
const char *listNameEnd;
if(listname==NULL || listname[0]==0) {
fprintf(stderr, "missing list file\n");
return NULL;
}
listPkg=new Package();
if(listPkg==NULL) {
fprintf(stderr, "icupkg: not enough memory\n");
exit(U_MEMORY_ALLOCATION_ERROR);
}
listNameEnd=strchr(listname, 0);
if(isListTextFile(listname)) {
// read the list file
char line[1024];
char *end;
const char *start;
file=fopen(listname, "r");
if(file==NULL) {
fprintf(stderr, "icupkg: unable to open list file \"%s\"\n", listname);
delete listPkg;
exit(U_FILE_ACCESS_ERROR);
}
while(fgets(line, sizeof(line), file)) {
// remove comments
end=strchr(line, '#');
if(end!=NULL) {
*end=0;
} else {
// remove trailing CR LF
end=strchr(line, 0);
while(line<end && (*(end-1)=='\r' || *(end-1)=='\n')) {
*--end=0;
}
}
// check first non-whitespace character and
// skip empty lines and
// skip lines starting with reserved characters
start=u_skipWhitespace(line);
if(*start==0 || NULL!=strchr(reservedChars, *start)) {
continue;
}
// take whitespace-separated items from the line
for(;;) {
// find whitespace after the item or the end of the line
for(end=(char *)start; *end!=0 && *end!=' ' && *end!='\t'; ++end) {}
if(*end==0) {
// this item is the last one on the line
end=NULL;
} else {
// the item is terminated by whitespace, terminate it with NUL
*end=0;
}
if(readContents) {
listPkg->addFile(filesPath, start);
} else {
listPkg->addItem(start);
}
// find the start of the next item or exit the loop
if(end==NULL || *(start=u_skipWhitespace(end+1))==0) {
break;
}
}
}
fclose(file);
} else if((listNameEnd-listname)>4 && 0==memcmp(listNameEnd-4, ".dat", 4)) {
// read the ICU .dat package
listPkg->readPackage(listname);
} else {
// list the single file itself
if(readContents) {
listPkg->addFile(filesPath, listname);
} else {
listPkg->addItem(listname);
}
}
return listPkg;
}
// main() ------------------------------------------------------------------ ***
static void
@ -333,7 +207,6 @@ isPackageName(const char *filename) {
len=(int32_t)strlen(filename)-4; /* -4: subtract the length of ".dat" */
return (UBool)(len>0 && 0==strcmp(filename+len, ".dat"));
}
/*
This line is required by MinGW because it incorrectly globs the arguments.
So when \* is used, it turns into a list of files instead of a literal "*"
@ -345,6 +218,7 @@ main(int argc, char *argv[]) {
const char *pname, *sourcePath, *destPath, *inFilename, *outFilename, *outComment;
char outType;
UBool isHelp, isModified, isPackage;
int result = 0;
Package *pkg, *listPkg, *addListPkg;
@ -468,7 +342,7 @@ main(int argc, char *argv[]) {
}
delete pkg;
return 0;
return result;
}
/* Work with a package. */
@ -575,12 +449,12 @@ main(int argc, char *argv[]) {
}
outFilename=outFilenameBuffer;
}
pkg->writePackage(outFilename, outType, outComment);
result = writePackageDatFile(outFilename, outComment, NULL, NULL, pkg, outType);
}
delete addListPkg;
delete pkg;
return 0;
return result;
}
/*

View File

@ -1,710 +0,0 @@
/******************************************************************************
* Copyright (C) 2000-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
* file name: pkgdata.c
* encoding: ANSI X3.4 (1968)
* tab size: 8 (not used)
* indentation:4
*
* created on: 2000may15
* created by: Steven \u24C7 Loomis
*
* This program packages the ICU data into different forms
* (DLL, common data, etc.)
*/
/*
* We define _XOPEN_SOURCE so that we can get popen and pclose.
*/
#if !defined(_XOPEN_SOURCE)
#if __STDC_VERSION__ >= 199901L
/* It is invalid to compile an XPG3, XPG4, XPG4v2 or XPG5 application using c99 on Solaris */
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE 4
#endif
#endif
#include "unicode/utypes.h"
#include "unicode/putil.h"
#include "cmemory.h"
#include "cstring.h"
#include "filestrm.h"
#include "toolutil.h"
#include "unicode/uclean.h"
#include "unewdata.h"
#include "uoptions.h"
#include "putilimp.h"
#if U_HAVE_POPEN
# include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
U_CDECL_BEGIN
#include "pkgtypes.h"
#include "makefile.h"
U_CDECL_END
static int executeMakefile(const UPKGOptions *o);
static void loadLists(UPKGOptions *o, UErrorCode *status);
/* always have this fcn, just might not do anything */
static void fillInMakefileFromICUConfig(UOption *option);
/* This sets the modes that are available */
static struct
{
const char *name, *alt_name;
UPKGMODE *fcn;
const char *desc;
} modes[] =
{
{ "files", 0, pkg_mode_files, "Uses raw data files (no effect). Installation copies all files to the target location." },
#ifdef U_MAKE_IS_NMAKE
{ "dll", "library", pkg_mode_windows, "Generates one common data file and one shared library, <package>.dll"},
{ "common", "archive", pkg_mode_windows, "Generates just the common file, <package>.dat"},
{ "static", "static", pkg_mode_windows, "Generates one statically linked library, " LIB_PREFIX "<package>" UDATA_LIB_SUFFIX }
#else /*#ifdef U_MAKE_IS_NMAKE*/
#ifdef UDATA_SO_SUFFIX
{ "dll", "library", pkg_mode_dll, "Generates one shared library, <package>" UDATA_SO_SUFFIX },
#endif
{ "common", "archive", pkg_mode_common, "Generates one common data file, <package>.dat" },
{ "static", "static", pkg_mode_static, "Generates one statically linked library, " LIB_PREFIX "<package>" UDATA_LIB_SUFFIX }
#endif /*#ifdef U_MAKE_IS_NMAKE*/
};
enum {
NAME,
BLDOPT,
MODE,
HELP,
HELP_QUESTION_MARK,
VERBOSE,
COPYRIGHT,
COMMENT,
DESTDIR,
CLEAN,
NOOUTPUT,
REBUILD,
TEMPDIR,
INSTALL,
SOURCEDIR,
ENTRYPOINT,
REVISION,
MAKEARG,
FORCE_PREFIX,
LIBNAME,
QUIET
};
static UOption options[]={
/*00*/ UOPTION_DEF( "name", 'p', UOPT_REQUIRES_ARG),
/*01*/ UOPTION_DEF( "bldopt", 'O', UOPT_REQUIRES_ARG), /* on Win32 it is release or debug */
/*02*/ UOPTION_DEF( "mode", 'm', UOPT_REQUIRES_ARG),
/*03*/ UOPTION_HELP_H, /* -h */
/*04*/ UOPTION_HELP_QUESTION_MARK, /* -? */
/*05*/ UOPTION_VERBOSE, /* -v */
/*06*/ UOPTION_COPYRIGHT, /* -c */
/*07*/ UOPTION_DEF( "comment", 'C', UOPT_REQUIRES_ARG),
/*08*/ UOPTION_DESTDIR, /* -d */
/*09*/ UOPTION_DEF( "clean", 'k', UOPT_NO_ARG),
/*10*/ UOPTION_DEF( "nooutput",'n', UOPT_NO_ARG),
/*11*/ UOPTION_DEF( "rebuild", 'F', UOPT_NO_ARG),
/*12*/ UOPTION_DEF( "tempdir", 'T', UOPT_REQUIRES_ARG),
/*13*/ UOPTION_DEF( "install", 'I', UOPT_REQUIRES_ARG),
/*14*/ UOPTION_SOURCEDIR ,
/*15*/ UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG),
/*16*/ UOPTION_DEF( "revision", 'r', UOPT_REQUIRES_ARG),
/*17*/ UOPTION_DEF( "makearg", 'M', UOPT_REQUIRES_ARG),
/*18*/ UOPTION_DEF( "force-prefix", 'f', UOPT_NO_ARG),
/*19*/ UOPTION_DEF( "libname", 'L', UOPT_REQUIRES_ARG),
/*20*/ UOPTION_DEF( "quiet", 'q', UOPT_NO_ARG)
};
const char options_help[][320]={
"Set the data name",
#ifdef U_MAKE_IS_NMAKE
"The directory where the ICU is located (e.g. <ICUROOT> which contains the bin directory)",
#else
"Specify options for the builder. (Autdetected if icu-config is available)",
#endif
"Specify the mode of building (see below; default: common)",
"This usage text",
"This usage text",
"Make the output verbose",
"Use the standard ICU copyright",
"Use a custom comment (instead of the copyright)",
"Specify the destination directory for files",
"Clean out generated & temporary files",
"Suppress output of data, just list files to be created",
"Force rebuilding of all data",
"Specify temporary dir (default: output dir)",
"Install the data (specify target)",
"Specify a custom source directory",
"Specify a custom entrypoint name (default: short name)",
"Specify a version when packaging in DLL or static mode",
"Pass the next argument to make(1)",
"Add package to all file names if not present",
"Library name to build (if different than package name)",
"Quite mode. (e.g. Do not output a readme file for static libraries)"
};
const char *progname = "PKGDATA";
int
main(int argc, char* argv[]) {
FileStream *out;
UPKGOptions o;
CharList *tail;
UBool needsHelp = FALSE;
UErrorCode status = U_ZERO_ERROR;
char tmp[1024];
int32_t i;
U_MAIN_INIT_ARGS(argc, argv);
progname = argv[0];
options[MODE].value = "common";
options[MAKEARG].value = "";
/* read command line options */
argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
/* error handling, printing usage message */
/* I've decided to simply print an error and quit. This tool has too
many options to just display them all of the time. */
if(options[HELP].doesOccur || options[HELP_QUESTION_MARK].doesOccur) {
needsHelp = TRUE;
}
else {
if(!needsHelp && argc<0) {
fprintf(stderr,
"%s: error in command line argument \"%s\"\n",
progname,
argv[-argc]);
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
}
if(!options[BLDOPT].doesOccur) {
/* Try to fill in from icu-config or equivalent */
fillInMakefileFromICUConfig(&options[1]);
}
#ifdef U_MAKE_IS_NMAKE
else {
fprintf(stderr, "Warning: You are using the deprecated -O option\n"
"\tYou can fix this warning by installing pkgdata, gencmn and genccode\n"
"\tinto the same directory and not specifying the -O option to pkgdata.\n");
}
#endif
if(!options[BLDOPT].doesOccur) {
fprintf(stderr, " required parameter is missing: -O is required \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
}
if(!options[NAME].doesOccur) /* -O we already have - don't report it. */
{
fprintf(stderr, " required parameter -p is missing \n");
fprintf(stderr, "Run '%s --help' for help.\n", progname);
return 1;
}
if(argc == 1) {
fprintf(stderr,
"No input files specified.\n"
"Run '%s --help' for help.\n", progname);
return 1;
}
} /* end !needsHelp */
if(argc<0 || needsHelp ) {
fprintf(stderr,
"usage: %s [-options] [-] [packageFile] \n"
"\tProduce packaged ICU data from the given list(s) of files.\n"
"\t'-' by itself means to read from stdin.\n"
"\tpackageFile is a text file containing the list of files to package.\n",
progname);
fprintf(stderr, "\n options:\n");
for(i=0;i<(sizeof(options)/sizeof(options[0]));i++) {
fprintf(stderr, "%-5s -%c %s%-10s %s\n",
(i<1?"[REQ]":""),
options[i].shortName,
options[i].longName ? "or --" : " ",
options[i].longName ? options[i].longName : "",
options_help[i]);
}
fprintf(stderr, "modes: (-m option)\n");
for(i=0;i<(sizeof(modes)/sizeof(modes[0]));i++) {
fprintf(stderr, " %-9s ", modes[i].name);
if (modes[i].alt_name) {
fprintf(stderr, "/ %-9s", modes[i].alt_name);
} else {
fprintf(stderr, " ");
}
fprintf(stderr, " %s\n", modes[i].desc);
}
return 1;
}
/* OK, fill in the options struct */
uprv_memset(&o, 0, sizeof(o));
o.mode = options[MODE].value;
o.version = options[REVISION].doesOccur ? options[REVISION].value : 0;
o.makeArgs = options[MAKEARG].value;
o.fcn = NULL;
for(i=0;i<sizeof(modes)/sizeof(modes[0]);i++) {
if(!uprv_strcmp(modes[i].name, o.mode)) {
o.fcn = modes[i].fcn;
break;
} else if (modes[i].alt_name && !uprv_strcmp(modes[i].alt_name, o.mode)) {
o.mode = modes[i].name;
o.fcn = modes[i].fcn;
break;
}
}
if(o.fcn == NULL) {
fprintf(stderr, "Error: invalid mode '%s' specified. Run '%s --help' to list valid modes.\n", o.mode, progname);
return 1;
}
o.shortName = options[0].value;
{
int32_t len = (int32_t)uprv_strlen(o.shortName);
char *csname, *cp;
const char *sp;
cp = csname = (char *) uprv_malloc((len + 1 + 1) * sizeof(*o.cShortName));
if (*(sp = o.shortName)) {
*cp++ = isalpha(*sp) ? * sp : '_';
for (++sp; *sp; ++sp) {
*cp++ = isalnum(*sp) ? *sp : '_';
}
}
*cp = 0;
o.cShortName = csname;
}
if(options[LIBNAME].doesOccur) { /* get libname from shortname, or explicit -L parameter */
o.libName = options[LIBNAME].value;
} else {
o.libName = o.shortName;
}
if(options[QUIET].doesOccur) {
o.quiet = TRUE;
} else {
o.quiet = FALSE;
}
o.verbose = options[VERBOSE].doesOccur;
#ifdef U_MAKE_IS_NMAKE /* format is R:pathtoICU or D:pathtoICU */
{
char *pathstuff = (char *)options[BLDOPT].value;
if(options[1].value[uprv_strlen(options[BLDOPT].value)-1] == '\\') {
pathstuff[uprv_strlen(options[BLDOPT].value)-1] = '\0';
}
if(*pathstuff == PKGDATA_DERIVED_PATH || *pathstuff == 'R' || *pathstuff == 'D') {
o.options = pathstuff;
pathstuff++;
if(*pathstuff == ':') {
*pathstuff = '\0';
pathstuff++;
}
else {
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n");
return 1;
}
} else {
fprintf(stderr, "Error: invalid windows build mode, should be R (release) or D (debug).\n");
return 1;
}
o.icuroot = pathstuff;
if (o.verbose) {
fprintf(stdout, "# ICUROOT is %s\n", o.icuroot);
}
}
#else /* on UNIX, we'll just include the file... */
o.options = options[BLDOPT].value;
#endif
if(options[COPYRIGHT].doesOccur) {
o.comment = U_COPYRIGHT_STRING;
} else if (options[COMMENT].doesOccur) {
o.comment = options[COMMENT].value;
}
if( options[DESTDIR].doesOccur ) {
o.targetDir = options[DESTDIR].value;
} else {
o.targetDir = "."; /* cwd */
}
o.clean = options[CLEAN].doesOccur;
o.nooutput = options[NOOUTPUT].doesOccur;
o.rebuild = options[REBUILD].doesOccur;
if( options[TEMPDIR].doesOccur ) {
o.tmpDir = options[TEMPDIR].value;
} else {
o.tmpDir = o.targetDir;
}
if( options[INSTALL].doesOccur ) {
o.install = options[INSTALL].value;
}
if( options[SOURCEDIR].doesOccur ) {
o.srcDir = options[SOURCEDIR].value;
} else {
o.srcDir = ".";
}
if( options[ENTRYPOINT].doesOccur ) {
o.entryName = options[ENTRYPOINT].value;
} else {
o.entryName = o.cShortName;
}
/* OK options are set up. Now the file lists. */
tail = NULL;
for( i=1; i<argc; i++) {
if ( !uprv_strcmp(argv[i] , "-") ) {
/* stdin */
if( o.hadStdin == TRUE ) {
fprintf(stderr, "Error: can't specify '-' twice!\n"
"Run '%s --help' for help.\n", progname);
return 1;
}
o.hadStdin = TRUE;
}
o.fileListFiles = pkg_appendToList(o.fileListFiles, &tail, uprv_strdup(argv[i]));
}
/* load the files */
loadLists(&o, &status);
if( U_FAILURE(status) ) {
fprintf(stderr, "error loading input file lists: %s\n", u_errorName(status));
return 2;
}
/* Makefile pathname */
uprv_strcpy(tmp, o.tmpDir);
#ifdef U_MAKE_IS_NMAKE
uprv_strcat(tmp, U_FILE_SEP_STRING);
#else
uprv_strcat(tmp, U_FILE_ALT_SEP_STRING);
#endif
uprv_strcat(tmp, o.shortName);
uprv_strcat(tmp, "_");
uprv_strcat(tmp, o.mode);
uprv_strcat(tmp, ".mak"); /* MAY NEED TO CHANGE PER PLATFORM */
o.makeFile = uprv_strdup(tmp);
out = T_FileStream_open(o.makeFile, "w");
if (out) {
pkg_mak_writeHeader(out, &o); /* need to take status */
o.fcn(&o, out, &status);
pkg_mak_writeFooter(out, &o);
T_FileStream_close(out);
} else {
fprintf(stderr, "warning: couldn't create %s, will use existing file if any\n", o.makeFile);
/*status = U_FILE_ACCESS_ERROR;*/
}
if(U_FAILURE(status)) {
fprintf(stderr, "Error creating makefile [%s]: %s\n", o.mode,
u_errorName(status));
return 1;
}
if(o.nooutput == TRUE) {
return 0; /* nothing to do. */
}
return executeMakefile(&o);
}
/* POSIX - execute makefile */
static int executeMakefile(const UPKGOptions *o)
{
char cmd[1024];
/*char pwd[1024];*/
const char *make;
int rc;
make = getenv("MAKE");
if(!make || !make[0]) {
make = U_MAKE;
}
/*getcwd(pwd, 1024);*/
#ifdef U_WINDOWS
sprintf(cmd, "%s %s%s -f \"%s\" %s %s %s %s",
make,
o->install ? "INSTALLTO=" : "",
o->install ? o->install : "",
o->makeFile,
o->clean ? "clean" : "",
o->rebuild ? "rebuild" : "",
o->install ? "install" : "",
o->makeArgs);
#elif defined(OS400)
sprintf(cmd, "CALL GNU/GMAKE PARM(%s%s%s '-f' '%s' %s %s %s %s%s%s)",
o->install ? "'INSTALLTO=" : "",
o->install ? o->install : "",
o->install ? "'" : "",
o->makeFile,
o->clean ? "'clean'" : "",
o->rebuild ? "'rebuild'" : "",
o->install ? "'install'" : "",
o->makeArgs && *o->makeArgs ? "'" : "",
o->makeArgs && *o->makeArgs ? o->makeArgs : "",
o->makeArgs && *o->makeArgs ? "'" : "");
#else
sprintf(cmd, "%s %s%s -f %s %s %s %s %s",
make,
o->install ? "INSTALLTO=" : "",
o->install ? o->install : "",
o->makeFile,
o->clean ? "clean" : "",
o->rebuild ? "rebuild" : "",
o->install ? "install" : "",
o->makeArgs);
#endif
#ifdef U_MAKE_IS_NMAKE
strcat(cmd, " /NOLOGO");
#endif
if(o->verbose) {
puts(cmd);
}
rc = system(cmd);
if(rc < 0) {
fprintf(stderr, "# Failed, rc=%d\n", rc);
}
return rc < 128 ? rc : (rc >> 8);
}
static void loadLists(UPKGOptions *o, UErrorCode *status)
{
CharList *l, *tail = NULL, *tail2 = NULL;
FileStream *in;
char line[16384];
char *linePtr, *lineNext;
const uint32_t lineMax = 16300;
char tmp[1024];
char *s;
int32_t ln=0; /* line number */
for(l = o->fileListFiles; l; l = l->next) {
if(o->verbose) {
fprintf(stdout, "# Reading %s..\n", l->str);
}
/* TODO: stdin */
in = T_FileStream_open(l->str, "r"); /* open files list */
if(!in) {
fprintf(stderr, "Error opening <%s>.\n", l->str);
*status = U_FILE_ACCESS_ERROR;
return;
}
while(T_FileStream_readLine(in, line, sizeof(line))!=NULL) { /* for each line */
ln++;
if(uprv_strlen(line)>lineMax) {
fprintf(stderr, "%s:%d - line too long (over %d chars)\n", l->str, (int)ln, (int)lineMax);
exit(1);
}
/* remove spaces at the beginning */
linePtr = line;
while(isspace(*linePtr)) {
linePtr++;
}
s=linePtr;
/* remove trailing newline characters */
while(*s!=0) {
if(*s=='\r' || *s=='\n') {
*s=0;
break;
}
++s;
}
if((*linePtr == 0) || (*linePtr == '#')) {
continue; /* comment or empty line */
}
/* Now, process the line */
lineNext = NULL;
while(linePtr && *linePtr) { /* process space-separated items */
while(*linePtr == ' ') {
linePtr++;
}
/* Find the next quote */
if(linePtr[0] == '"')
{
lineNext = uprv_strchr(linePtr+1, '"');
if(lineNext == NULL) {
fprintf(stderr, "%s:%d - missing trailing double quote (\")\n",
l->str, (int)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, (int)ln, (int)(lineNext-line), (*lineNext)?*lineNext:'0');
exit(1);
}
*lineNext = 0;
lineNext++;
}
}
} else {
lineNext = uprv_strchr(linePtr, ' ');
if(lineNext) {
*lineNext = 0; /* terminate at space */
lineNext++;
}
}
/* add the file */
s = (char*)getLongPathname(linePtr);
/* normal mode.. o->files is just the bare list without package names */
o->files = pkg_appendToList(o->files, &tail, uprv_strdup(linePtr));
if(uprv_pathIsAbsolute(s)) {
fprintf(stderr, "pkgdata: Error: absolute path encountered. Old style paths are not supported. Use relative paths such as 'fur.res' or 'translit%cfur.res'.\n\tBad path: '%s'\n", U_FILE_SEP_CHAR, s);
exit(U_ILLEGAL_ARGUMENT_ERROR);
}
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));
linePtr = lineNext;
} /* for each entry on line */
} /* for each line */
T_FileStream_close(in);
} /* for each file list file */
}
/* Try calling icu-config directly to get information */
static void fillInMakefileFromICUConfig(UOption *option)
{
#if U_HAVE_POPEN
FILE *p;
size_t n;
static char buf[512] = "";
static const char cmd[] = "icu-config --incfile";
if(options[5].doesOccur)
{
/* informational */
fprintf(stderr, "%s: No -O option found, trying '%s'.\n", progname, cmd);
}
p = popen(cmd, "r");
if(p == NULL)
{
fprintf(stderr, "%s: icu-config: No icu-config found. (fix PATH or use -O option)\n", progname);
return;
}
n = fread(buf, 1, 511, p);
pclose(p);
if(n<=0)
{
fprintf(stderr,"%s: icu-config: Could not read from icu-config. (fix PATH or use -O option)\n", progname);
return;
}
if(buf[strlen(buf)-1]=='\n')
{
buf[strlen(buf)-1]=0;
}
if(buf[0] == 0)
{
fprintf(stderr, "%s: icu-config: invalid response from icu-config (fix PATH or use -O option)\n", progname);
return;
}
if(options[5].doesOccur)
{
/* informational */
fprintf(stderr, "%s: icu-config: using '-O %s'\n", progname, buf);
}
option->value = buf;
option->doesOccur = TRUE;
#else /* ! U_HAVE_POPEN */
#ifdef U_WINDOWS
char pathbuffer[_MAX_PATH] = {0};
char *fullEXEpath = NULL;
char *pathstuff = NULL;
if (strchr(progname, U_FILE_SEP_CHAR) != NULL || strchr(progname, U_FILE_ALT_SEP_CHAR) != NULL) {
/* pkgdata was executed with relative path */
fullEXEpath = _fullpath(pathbuffer, progname, sizeof(pathbuffer));
pathstuff = (char *)options[1].value;
if (fullEXEpath) {
pathstuff = strrchr(fullEXEpath, U_FILE_SEP_CHAR);
if (pathstuff) {
pathstuff[1] = 0;
uprv_memmove(fullEXEpath + 2, fullEXEpath, uprv_strlen(fullEXEpath)+1);
fullEXEpath[0] = PKGDATA_DERIVED_PATH;
fullEXEpath[1] = ':';
option->value = uprv_strdup(fullEXEpath);
option->doesOccur = TRUE;
}
}
}
else {
/* pkgdata was executed from the path */
/* Search for file in PATH environment variable: */
_searchenv("pkgdata.exe", "PATH", pathbuffer );
if( *pathbuffer != '\0' ) {
fullEXEpath = pathbuffer;
pathstuff = strrchr(pathbuffer, U_FILE_SEP_CHAR);
if (pathstuff) {
pathstuff[1] = 0;
uprv_memmove(fullEXEpath + 2, fullEXEpath, uprv_strlen(fullEXEpath)+1);
fullEXEpath[0] = PKGDATA_DERIVED_PATH;
fullEXEpath[1] = ':';
option->value = uprv_strdup(fullEXEpath);
option->doesOccur = TRUE;
}
}
}
/* else can't determine the path */
#endif
/* no popen available */
/* Put other OS specific ways to search for the Makefile.inc type
information or else fail.. */
#endif
}

File diff suppressed because it is too large Load Diff

View File

@ -403,7 +403,7 @@
>
</File>
<File
RelativePath=".\pkgdata.c"
RelativePath=".\pkgdata.cpp"
>
</File>
<File

View File

@ -1,6 +1,6 @@
/**************************************************************************
*
* Copyright (C) 2000-2007, International Business Machines
* Copyright (C) 2000-2008, International Business Machines
* Corporation and others. All Rights Reserved.
*
***************************************************************************
@ -103,7 +103,7 @@ const char *pkg_writeCharList(FileStream *s, CharList *l, const char *delim, int
}
T_FileStream_write(s, buffer, (int32_t)uprv_strlen(buffer));
}
if(l->next && delim)
{
T_FileStream_write(s, delim, (int32_t)uprv_strlen(delim));
@ -129,7 +129,7 @@ uint32_t pkg_countCharList(CharList *l)
return c;
}
/*
/*
* Prepend string to CharList
*/
CharList *pkg_prependToList(CharList *l, const char *str)
@ -147,8 +147,8 @@ CharList *pkg_prependToList(CharList *l, const char *str)
return newList;
}
/*
* append string to CharList. *end or even end can be null if you don't
/*
* append string to CharList. *end or even end can be null if you don't
* know it.[slow]
* Str is adopted!
*/
@ -160,7 +160,7 @@ CharList *pkg_appendToList(CharList *l, CharList** end, const char *str)
{
end = &endptr;
}
/* FIND the end */
if((*end == NULL) && (l != NULL))
{
@ -208,7 +208,7 @@ char * convertToNativePathSeparators(char *path) {
CharList *pkg_appendUniqueDirToList(CharList *l, CharList** end, const char *strAlias) {
char aBuf[1024];
char *rPtr;
char *rPtr;
rPtr = uprv_strrchr(strAlias, U_FILE_SEP_CHAR);
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
{
@ -254,7 +254,7 @@ pkg_appendFromStrings(CharList *l, CharList** end, const char *s, int32_t len)
len = uprv_strlen(s);
}
targ = s+len;
while(*s && s<targ) {
while(s<targ&&isspace(*s)) s++;
for(p=s;s<targ&&!isspace(*p);p++);
@ -267,22 +267,24 @@ pkg_appendFromStrings(CharList *l, CharList** end, const char *s, int32_t len)
}
s=p;
}
return l;
}
#endif
/*
* Delete list
* Delete list
*/
void pkg_deleteList(CharList *l)
{
CharList *tmp;
while(l != NULL)
{
uprv_free((void*)l->str);
tmp = l;
l = l->next;
uprv_free(tmp);
}
}

View File

@ -53,7 +53,7 @@ LIBS = $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS)
OBJECTS = filestrm.o package.o pkgitems.o swapimpl.o toolutil.o unewdata.o \
ucm.o ucmstate.o uoptions.o uparse.o \
ucbuf.o xmlparser.o writesrc.o
ucbuf.o xmlparser.o writesrc.o pkg_icu.o pkg_genc.o pkg_gencmn.o
STATIC_OBJECTS = $(OBJECTS:.o=.$(STATIC_O))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,27 @@
/******************************************************************************
* Copyright (C) 2008, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#ifndef __PKG_GENC_H__
#define __PKG_GENC_H__
#include "unicode/utypes.h"
U_CAPI void U_EXPORT2
printAssemblyHeadersToStdErr();
U_CAPI UBool U_EXPORT2
checkAssemblyHeaderName(const char* optAssembly);
U_CAPI void U_EXPORT2
writeCCode(const char *filename, const char *destdir, const char *optName, const char *optFilename, char *outFilePath);
U_CAPI void U_EXPORT2
writeAssemblyCode(const char *filename, const char *destdir, const char *optEntryPoint, const char *optFilename, char *outFilePath);
U_CAPI void U_EXPORT2
writeObjectCode(const char *filename, const char *destdir, const char *optEntryPoint, const char *optMatchArch, const char *optFilename, char *outFilePath);
#endif

View File

@ -0,0 +1,546 @@
/******************************************************************************
* Copyright (C) 2008, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#include "unicode/utypes.h"
#include <stdio.h>
#include <stdlib.h>
#include "unicode/utypes.h"
#include "unicode/putil.h"
#include "cmemory.h"
#include "cstring.h"
#include "filestrm.h"
#include "toolutil.h"
#include "unicode/uclean.h"
#include "unewdata.h"
#include "putilimp.h"
#include "pkg_gencmn.h"
#define STRING_STORE_SIZE 100000
#define MAX_FILE_COUNT 2000
#define COMMON_DATA_NAME U_ICUDATA_NAME
#define DATA_TYPE "dat"
/* ICU package data file format (.dat files) ------------------------------- ***
Description of the data format after the usual ICU data file header
(UDataInfo etc.).
Format version 1
A .dat package file contains a simple Table of Contents of item names,
followed by the items themselves:
1. ToC table
uint32_t count; - number of items
UDataOffsetTOCEntry entry[count]; - pair of uint32_t values per item:
uint32_t nameOffset; - offset of the item name
uint32_t dataOffset; - offset of the item data
both are byte offsets from the beginning of the data
2. item name strings
All item names are stored as char * strings in one block between the ToC table
and the data items.
3. data items
The data items are stored following the item names block.
Each data item is 16-aligned.
The data items are stored in the sorted order of their names.
Therefore, the top of the name strings block is the offset of the first item,
the length of the last item is the difference between its offset and
the .dat file length, and the length of all previous items is the difference
between its offset and the next one.
----------------------------------------------------------------------------- */
/* UDataInfo cf. udata.h */
static const UDataInfo dataInfo={
sizeof(UDataInfo),
0,
U_IS_BIG_ENDIAN,
U_CHARSET_FAMILY,
sizeof(UChar),
0,
{0x43, 0x6d, 0x6e, 0x44}, /* dataFormat="CmnD" */
{1, 0, 0, 0}, /* formatVersion */
{3, 0, 0, 0} /* dataVersion */
};
static uint32_t maxSize;
static char stringStore[STRING_STORE_SIZE];
static uint32_t stringTop=0, basenameTotal=0;
typedef struct {
char *pathname, *basename;
uint32_t basenameLength, basenameOffset, fileSize, fileOffset;
} File;
static File files[MAX_FILE_COUNT];
static uint32_t fileCount=0;
static char *symPrefix = NULL;
/* prototypes --------------------------------------------------------------- */
static void
addFile(const char *filename, const char *name, const char *source, UBool sourceTOC, UBool verbose);
static char *
allocString(uint32_t length);
static int
compareFiles(const void *file1, const void *file2);
static char *
pathToFullPath(const char *path, const char *source);
/* map non-tree separator (such as '\') to tree separator ('/') inplace. */
static void
fixDirToTreePath(char *s);
/* -------------------------------------------------------------------------- */
U_CAPI void U_EXPORT2
createCommonDataFile(const char *destDir, const char *name, const char *entrypointName, const char *type, const char *source, const char *copyRight,
const char *dataFile, uint32_t max_size, UBool sourceTOC, UBool verbose, char *gencmnFileName) {
static char buffer[4096];
char line[512];
char *s;
UErrorCode errorCode=U_ZERO_ERROR;
uint32_t i, fileOffset, basenameOffset, length, nread;
FileStream *in, *file;
maxSize = max_size;
if (destDir == NULL) {
destDir = u_getDataDirectory();
}
if (name == NULL) {
name = COMMON_DATA_NAME;
}
if (type == NULL) {
type = DATA_TYPE;
}
if (source == NULL) {
source = ".";
}
if (dataFile == NULL) {
in = T_FileStream_stdin();
} else {
in = T_FileStream_open(dataFile, "r");
if(in == NULL) {
fprintf(stderr, "gencmn: unable to open input file %s\n", dataFile);
exit(U_FILE_ACCESS_ERROR);
}
}
if (verbose) {
if(sourceTOC) {
printf("generating %s_%s.c (table of contents source file)\n", name, type);
} else {
printf("generating %s.%s (common data file with table of contents)\n", name, type);
}
}
/* read the list of files and get their lengths */
while(T_FileStream_readLine(in, line, sizeof(line))!=NULL) {
/* remove trailing newline characters */
s=line;
while(*s!=0) {
if(*s=='\r' || *s=='\n') {
*s=0;
break;
}
++s;
}
/* check for comment */
if (*line == '#') {
continue;
}
/* add the file */
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
{
char *t;
while((t = uprv_strchr(line,U_FILE_ALT_SEP_CHAR))) {
*t = U_FILE_SEP_CHAR;
}
}
#endif
addFile(getLongPathname(line), name, source, sourceTOC, verbose);
}
if(in!=T_FileStream_stdin()) {
T_FileStream_close(in);
}
if(fileCount==0) {
fprintf(stderr, "gencmn: no files listed in %s\n", dataFile == NULL ? "<stdin>" : dataFile);
return;
}
/* sort the files by basename */
qsort(files, fileCount, sizeof(File), compareFiles);
if(!sourceTOC) {
UNewDataMemory *out;
/* determine the offsets of all basenames and files in this common one */
basenameOffset=4+8*fileCount;
fileOffset=(basenameOffset+(basenameTotal+15))&~0xf;
for(i=0; i<fileCount; ++i) {
files[i].fileOffset=fileOffset;
fileOffset+=(files[i].fileSize+15)&~0xf;
files[i].basenameOffset=basenameOffset;
basenameOffset+=files[i].basenameLength;
}
/* create the output file */
out=udata_create(destDir, type, name,
&dataInfo,
copyRight == NULL ? U_COPYRIGHT_STRING : copyRight,
&errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gencmn: udata_create(-d %s -n %s -t %s) failed - %s\n",
destDir, name, type,
u_errorName(errorCode));
exit(errorCode);
}
/* write the table of contents */
udata_write32(out, fileCount);
for(i=0; i<fileCount; ++i) {
udata_write32(out, files[i].basenameOffset);
udata_write32(out, files[i].fileOffset);
}
/* write the basenames */
for(i=0; i<fileCount; ++i) {
udata_writeString(out, files[i].basename, files[i].basenameLength);
}
length=4+8*fileCount+basenameTotal;
/* copy the files */
for(i=0; i<fileCount; ++i) {
/* pad to 16-align the next file */
length&=0xf;
if(length!=0) {
udata_writePadding(out, 16-length);
}
if (verbose) {
printf("adding %s (%ld byte%s)\n", files[i].pathname, (long)files[i].fileSize, files[i].fileSize == 1 ? "" : "s");
}
/* copy the next file */
file=T_FileStream_open(files[i].pathname, "rb");
if(file==NULL) {
fprintf(stderr, "gencmn: unable to open listed file %s\n", files[i].pathname);
exit(U_FILE_ACCESS_ERROR);
}
for(nread = 0;;) {
length=T_FileStream_read(file, buffer, sizeof(buffer));
if(length <= 0) {
break;
}
nread += length;
udata_writeBlock(out, buffer, length);
}
T_FileStream_close(file);
length=files[i].fileSize;
if (nread != files[i].fileSize) {
fprintf(stderr, "gencmn: unable to read %s properly (got %ld/%ld byte%s)\n", files[i].pathname, (long)nread, (long)files[i].fileSize, files[i].fileSize == 1 ? "" : "s");
exit(U_FILE_ACCESS_ERROR);
}
}
/* pad to 16-align the last file (cleaner, avoids growing .dat files in icuswap) */
length&=0xf;
if(length!=0) {
udata_writePadding(out, 16-length);
}
/* finish */
udata_finish(out, &errorCode);
if(U_FAILURE(errorCode)) {
fprintf(stderr, "gencmn: udata_finish() failed - %s\n", u_errorName(errorCode));
exit(errorCode);
}
} else {
/* write a .c source file with the table of contents */
char *filename;
FileStream *out;
/* create the output filename */
filename=s=buffer;
uprv_strcpy(filename, destDir);
s=filename+uprv_strlen(filename);
if(s>filename && *(s-1)!=U_FILE_SEP_CHAR) {
*s++=U_FILE_SEP_CHAR;
}
uprv_strcpy(s, name);
if(*(type)!=0) {
s+=uprv_strlen(s);
*s++='_';
uprv_strcpy(s, type);
}
s+=uprv_strlen(s);
uprv_strcpy(s, ".c");
/* open the output file */
out=T_FileStream_open(filename, "w");
if (gencmnFileName != NULL) {
uprv_strcpy(gencmnFileName, filename);
}
if(out==NULL) {
fprintf(stderr, "gencmn: unable to open .c output file %s\n", filename);
exit(U_FILE_ACCESS_ERROR);
}
/* write the source file */
sprintf(buffer,
"/*\n"
" * ICU common data table of contents for %s.%s ,\n"
" * Automatically generated by icu/source/tools/gencmn/gencmn .\n"
" */\n\n"
"#include \"unicode/utypes.h\"\n"
"#include \"unicode/udata.h\"\n"
"\n"
"/* external symbol declarations for data */\n",
name, type);
T_FileStream_writeLine(out, buffer);
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?symPrefix:"", files[i].pathname);
T_FileStream_writeLine(out, buffer);
}
T_FileStream_writeLine(out, ";\n\n");
sprintf(
buffer,
"U_EXPORT struct {\n"
" uint16_t headerSize;\n"
" uint8_t magic1, magic2;\n"
" UDataInfo info;\n"
" char padding[%lu];\n"
" uint32_t count, reserved;\n"
" struct {\n"
" const char *name;\n"
" const void *data;\n"
" } toc[%lu];\n"
"} U_EXPORT2 %s_dat = {\n"
" 32, 0xda, 0x27, {\n"
" %lu, 0,\n"
" %u, %u, %u, 0,\n"
" {0x54, 0x6f, 0x43, 0x50},\n"
" {1, 0, 0, 0},\n"
" {0, 0, 0, 0}\n"
" },\n"
" \"\", %lu, 0, {\n",
(unsigned long)32-4-sizeof(UDataInfo),
(unsigned long)fileCount,
entrypointName,
(unsigned long)sizeof(UDataInfo),
U_IS_BIG_ENDIAN,
U_CHARSET_FAMILY,
U_SIZEOF_UCHAR,
(unsigned long)fileCount
);
T_FileStream_writeLine(out, buffer);
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?symPrefix:"", files[i].pathname);
T_FileStream_writeLine(out, buffer);
}
T_FileStream_writeLine(out, "\n }\n};\n");
T_FileStream_close(out);
uprv_free(symPrefix);
}
}
static void
addFile(const char *filename, const char *name, const char *source, UBool sourceTOC, UBool verbose) {
char *s;
uint32_t length;
char *fullPath = NULL;
if(fileCount==MAX_FILE_COUNT) {
fprintf(stderr, "gencmn: too many files, maximum is %d\n", MAX_FILE_COUNT);
exit(U_BUFFER_OVERFLOW_ERROR);
}
if(!sourceTOC) {
FileStream *file;
if(uprv_pathIsAbsolute(filename)) {
fprintf(stderr, "gencmn: Error: absolute path encountered. Old style paths are not supported. Use relative paths such as 'fur.res' or 'translit%cfur.res'.\n\tBad path: '%s'\n", U_FILE_SEP_CHAR, filename);
exit(U_ILLEGAL_ARGUMENT_ERROR);
}
fullPath = pathToFullPath(filename, source);
/* store the pathname */
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(name) + 1);
s=allocString(length);
uprv_strcpy(s, name);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
/* get the basename */
fixDirToTreePath(s);
files[fileCount].basename=s;
files[fileCount].basenameLength=length;
files[fileCount].pathname=fullPath;
basenameTotal+=length;
/* try to open the file */
file=T_FileStream_open(fullPath, "rb");
if(file==NULL) {
fprintf(stderr, "gencmn: unable to open listed file %s\n", fullPath);
exit(U_FILE_ACCESS_ERROR);
}
/* get the file length */
length=T_FileStream_size(file);
if(T_FileStream_error(file) || length<=20) {
fprintf(stderr, "gencmn: unable to get length of listed file %s\n", fullPath);
exit(U_FILE_ACCESS_ERROR);
}
T_FileStream_close(file);
/* do not add files that are longer than maxSize */
if(maxSize && length>maxSize) {
if (verbose) {
printf("%s ignored (size %ld > %ld)\n", fullPath, (long)length, (long)maxSize);
}
return;
}
files[fileCount].fileSize=length;
} else {
char *t;
/* get and store the basename */
/* need to include the package name */
length = (uint32_t)(uprv_strlen(filename) + 1 + uprv_strlen(name) + 1);
s=allocString(length);
uprv_strcpy(s, name);
uprv_strcat(s, U_TREE_ENTRY_SEP_STRING);
uprv_strcat(s, filename);
fixDirToTreePath(s);
files[fileCount].basename=s;
/* turn the basename into an entry point name and store in the pathname field */
t=files[fileCount].pathname=allocString(length);
while(--length>0) {
if(*s=='.' || *s=='-' || *s=='/') {
*t='_';
} else {
*t=*s;
}
++s;
++t;
}
*t=0;
}
++fileCount;
}
static char *
allocString(uint32_t length) {
uint32_t top=stringTop+length;
char *p;
if(top>STRING_STORE_SIZE) {
fprintf(stderr, "gencmn: out of memory\n");
exit(U_MEMORY_ALLOCATION_ERROR);
}
p=stringStore+stringTop;
stringTop=top;
return p;
}
static char *
pathToFullPath(const char *path, const char *source) {
int32_t length;
int32_t newLength;
char *fullPath;
int32_t n;
length = (uint32_t)(uprv_strlen(path) + 1);
newLength = (length + 1 + (int32_t)uprv_strlen(source));
fullPath = uprv_malloc(newLength);
if(source != NULL) {
uprv_strcpy(fullPath, source);
uprv_strcat(fullPath, U_FILE_SEP_STRING);
} else {
fullPath[0] = 0;
}
n = (int32_t)uprv_strlen(fullPath);
uprv_strcat(fullPath, path);
#if (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR)
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_FILE_ALT_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
}
#endif
#endif
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
/* replace tree separator (such as '/') with file sep char (such as ':' or '\\') */
for(;fullPath[n];n++) {
if(fullPath[n] == U_TREE_ENTRY_SEP_CHAR) {
fullPath[n] = U_FILE_SEP_CHAR;
}
}
#endif
return fullPath;
}
static int
compareFiles(const void *file1, const void *file2) {
/* sort by basename */
return uprv_strcmp(((File *)file1)->basename, ((File *)file2)->basename);
}
static void
fixDirToTreePath(char *s)
{
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR) || ((U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) && (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR))
char *t;
#endif
#if (U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
for(t=s;t=uprv_strchr(t,U_FILE_SEP_CHAR);) {
*t = U_TREE_ENTRY_SEP_CHAR;
}
#endif
#if (U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR) && (U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR)
for(t=s;t=uprv_strchr(t,U_FILE_ALT_SEP_CHAR);) {
*t = U_TREE_ENTRY_SEP_CHAR;
}
#endif
}

View File

@ -0,0 +1,16 @@
/******************************************************************************
* Copyright (C) 2008, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#ifndef __PKG_GENCMN_H__
#define __PKG_GENCMN_H__
#include "unicode/utypes.h"
U_CAPI void U_EXPORT2
createCommonDataFile(const char *destDir, const char *name, const char *entrypointName, const char *type, const char *source, const char *copyRight,
const char *dataFile, uint32_t max_size, UBool sourceTOC, UBool verbose, char *gencmnFileName);
#endif

View File

@ -0,0 +1,178 @@
/******************************************************************************
* Copyright (C) 2008, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#include "unicode/utypes.h"
#include "unicode/putil.h"
#include "cstring.h"
#include "toolutil.h"
#include "uoptions.h"
#include "uparse.h"
#include "package.h"
#include "pkg_icu.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define LENGTHOF(array) (int32_t)(sizeof(array)/sizeof((array)[0]))
// read a file list -------------------------------------------------------- ***
static const struct {
const char *suffix;
int32_t length;
} listFileSuffixes[]={
{ ".txt", 4 },
{ ".lst", 4 },
{ ".tmp", 4 }
};
/* check for multiple text file suffixes to see if this list name is a text file name */
static UBool
isListTextFile(const char *listname) {
const char *listNameEnd=strchr(listname, 0);
const char *suffix;
int32_t i, length;
for(i=0; i<LENGTHOF(listFileSuffixes); ++i) {
suffix=listFileSuffixes[i].suffix;
length=listFileSuffixes[i].length;
if((listNameEnd-listname)>length && 0==memcmp(listNameEnd-length, suffix, length)) {
return TRUE;
}
}
return FALSE;
}
/*
* Read a file list.
* If the listname ends with ".txt", then read the list file
* (in the system/ invariant charset).
* If the listname ends with ".dat", then read the ICU .dat package file.
* Otherwise, read the file itself as a single-item list.
*/
U_CAPI Package * U_EXPORT2
readList(const char *filesPath, const char *listname, UBool readContents) {
Package *listPkg;
FILE *file;
const char *listNameEnd;
if(listname==NULL || listname[0]==0) {
fprintf(stderr, "missing list file\n");
return NULL;
}
listPkg=new Package();
if(listPkg==NULL) {
fprintf(stderr, "icupkg: not enough memory\n");
exit(U_MEMORY_ALLOCATION_ERROR);
}
listNameEnd=strchr(listname, 0);
if(isListTextFile(listname)) {
// read the list file
char line[1024];
char *end;
const char *start;
file=fopen(listname, "r");
if(file==NULL) {
fprintf(stderr, "icupkg: unable to open list file \"%s\"\n", listname);
delete listPkg;
exit(U_FILE_ACCESS_ERROR);
}
while(fgets(line, sizeof(line), file)) {
// remove comments
end=strchr(line, '#');
if(end!=NULL) {
*end=0;
} else {
// remove trailing CR LF
end=strchr(line, 0);
while(line<end && (*(end-1)=='\r' || *(end-1)=='\n')) {
*--end=0;
}
}
// check first non-whitespace character and
// skip empty lines and
// skip lines starting with reserved characters
start=u_skipWhitespace(line);
if(*start==0 || NULL!=strchr(reservedChars, *start)) {
continue;
}
// take whitespace-separated items from the line
for(;;) {
// find whitespace after the item or the end of the line
for(end=(char *)start; *end!=0 && *end!=' ' && *end!='\t'; ++end) {}
if(*end==0) {
// this item is the last one on the line
end=NULL;
} else {
// the item is terminated by whitespace, terminate it with NUL
*end=0;
}
if(readContents) {
listPkg->addFile(filesPath, start);
} else {
listPkg->addItem(start);
}
// find the start of the next item or exit the loop
if(end==NULL || *(start=u_skipWhitespace(end+1))==0) {
break;
}
}
}
fclose(file);
} else if((listNameEnd-listname)>4 && 0==memcmp(listNameEnd-4, ".dat", 4)) {
// read the ICU .dat package
listPkg->readPackage(listname);
} else {
// list the single file itself
if(readContents) {
listPkg->addFile(filesPath, listname);
} else {
listPkg->addItem(listname);
}
}
return listPkg;
}
U_CAPI int U_EXPORT2
writePackageDatFile(const char *outFilename, const char *outComment, const char *sourcePath, const char *addList, Package *pkg, char outType) {
Package *addListPkg = NULL;
UBool pkgDelete = FALSE;
if (pkg == NULL) {
pkg = new Package;
if(pkg == NULL) {
fprintf(stderr, "icupkg: not enough memory\n");
return U_MEMORY_ALLOCATION_ERROR;
}
addListPkg = readList(sourcePath, addList, TRUE);
if(addListPkg != NULL) {
pkg->addItems(*addListPkg);
} else {
return U_ILLEGAL_ARGUMENT_ERROR;
}
pkgDelete = TRUE;
}
pkg->writePackage(outFilename, outType, outComment);
if (pkgDelete) {
delete pkg;
delete addListPkg;
}
return 0;
}

View File

@ -0,0 +1,22 @@
/******************************************************************************
* Copyright (C) 2008, International Business Machines
* Corporation and others. All Rights Reserved.
*******************************************************************************
*/
#ifndef __PKG_ICU_H__
#define __PKG_ICU_H__
#include "unicode/utypes.h"
static const char *reservedChars="\"%&'()*+,-./:;<=>?_";
U_CAPI int U_EXPORT2
writePackageDatFile(const char *outFilename, const char *outComment,
const char *sourcePath, const char *addList, Package *pkg,
char outType);
U_CAPI Package * U_EXPORT2
readList(const char *filesPath, const char *listname, UBool readContents);
#endif

View File

@ -130,6 +130,24 @@ uprv_mkdir(const char *pathname, UErrorCode *status) {
}
}
/*U_CAPI UDate U_EXPORT2
uprv_getModificationDate(const char *pathname, UErrorCode *status)
{
if(U_FAILURE(*status)) {
return;
}
// TODO: handle case where stat is not available
struct stat st;
if(stat(pathname,&st) != 0)
{
*status = U_FILE_ACCESS_ERROR;
} else {
return st.st_mtime;
}
}
*/
/* tool memory helper ------------------------------------------------------- */
struct UToolMemory {

View File

@ -56,13 +56,29 @@ U_CAPI int32_t U_EXPORT2
getCurrentYear(void);
/*
* Creates a diretory with pathname.
* Creates a directory with pathname.
*
* @param status Set to an error code when mkdir failed.
*/
U_CAPI void U_EXPORT2
uprv_mkdir(const char *pathname, UErrorCode *status);
/**
* Return the modification date for the specified file or directory.
* Return value is undefined if there was an error.
*/
/*U_CAPI UDate U_EXPORT2
uprv_getModificationDate(const char *pathname, UErrorCode *status);
*/
/*
* Returns the modification
*
* @param status Set to an error code when mkdir failed.
*/
U_CAPI void U_EXPORT2
uprv_mkdir(const char *pathname, UErrorCode *status);
/*
* UToolMemory is used for generic, custom memory management.
* It is allocated with enough space for count*size bytes starting

View File

@ -420,6 +420,82 @@
RelativePath=".\package.cpp"
>
</File>
<File
RelativePath=".\pkg_genc.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pkg_gencmn.c"
>
<FileConfiguration
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
DisableLanguageExtensions="false"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\pkg_icu.cpp"
>
</File>
<File
RelativePath=".\pkgitems.cpp"
>
@ -509,6 +585,18 @@
RelativePath=".\package.h"
>
</File>
<File
RelativePath=".\pkg_genc.h"
>
</File>
<File
RelativePath=".\pkg_gencmn.h"
>
</File>
<File
RelativePath=".\pkg_icu.h"
>
</File>
<File
RelativePath=".\pkg_imp.h"
>