ICU-4803 Use icupkg instead of icuswap and decmn

X-SVN-Rev: 18939
This commit is contained in:
George Rhoten 2006-01-03 17:59:44 +00:00
parent 56f410c999
commit 8302032efc
9 changed files with 17 additions and 585 deletions

View File

@ -18,12 +18,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ctestfw", "..\tools\ctestfw
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "decmn", "..\tools\gencmn\decmn.vcproj", "{20869594-A3DD-4A75-8068-99B03A5CF4E4}"
ProjectSection(ProjectDependencies) = postProject
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "derb", "..\tools\genrb\derb.vcproj", "{D3065ADB-8820-4CC7-9B6C-9510833961A3}"
ProjectSection(ProjectDependencies) = postProject
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
@ -144,10 +138,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "makedata", "..\data\makedat
{DB312A49-12A9-4E07-9E96-451DC2D8FF62} = {DB312A49-12A9-4E07-9E96-451DC2D8FF62}
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
{77C78066-746F-4EA6-B3FE-B8C8A4A97891} = {77C78066-746F-4EA6-B3FE-B8C8A4A97891}
{6FC24387-370C-4561-9582-7A819749E2C5} = {6FC24387-370C-4561-9582-7A819749E2C5}
{203EC78A-0531-43F0-A636-285439BDE025} = {203EC78A-0531-43F0-A636-285439BDE025}
{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F} = {A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}
{20869594-A3DD-4A75-8068-99B03A5CF4E4} = {20869594-A3DD-4A75-8068-99B03A5CF4E4}
{86829694-A375-4C58-B4EA-96EF514E3225} = {86829694-A375-4C58-B4EA-96EF514E3225}
{631C23CE-6C1D-4875-88F0-85E0A42B36EA} = {631C23CE-6C1D-4875-88F0-85E0A42B36EA}
{FDD3C4F2-9805-44EB-9A77-BC1C1C95B547} = {FDD3C4F2-9805-44EB-9A77-BC1C1C95B547}
@ -192,13 +184,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gensprep", "..\tools\genspr
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "icuswap", "..\tools\icuswap\icuswap.vcproj", "{6FC24387-370C-4561-9582-7A819749E2C5}"
ProjectSection(ProjectDependencies) = postProject
{0178B127-6269-407D-B112-93877BB62776} = {0178B127-6269-407D-B112-93877BB62776}
{6B231032-3CB5-4EED-9210-810D666A23A0} = {6B231032-3CB5-4EED-9210-810D666A23A0}
{73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D} = {73C0A65B-D1F2-4DE1-B3A6-15DAD2C23F3D}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "iotest", "..\test\iotest\iotest.vcproj", "{E4993E82-D68A-46CA-BAE0-9D35E172E46F}"
ProjectSection(ProjectDependencies) = postProject
{C2B04507-2521-4801-BF0D-5FD79D6D518C} = {C2B04507-2521-4801-BF0D-5FD79D6D518C}
@ -243,10 +228,6 @@ Global
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Debug.Build.0 = Debug|Win32
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Release.ActiveCfg = Release|Win32
{ECA6B435-B4FA-4F9F-BF95-F451D078FC47}.Release.Build.0 = Release|Win32
{20869594-A3DD-4A75-8068-99B03A5CF4E4}.Debug.ActiveCfg = Debug|Win32
{20869594-A3DD-4A75-8068-99B03A5CF4E4}.Debug.Build.0 = Debug|Win32
{20869594-A3DD-4A75-8068-99B03A5CF4E4}.Release.ActiveCfg = Release|Win32
{20869594-A3DD-4A75-8068-99B03A5CF4E4}.Release.Build.0 = Release|Win32
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Debug.ActiveCfg = Debug|Win32
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Debug.Build.0 = Debug|Win32
{D3065ADB-8820-4CC7-9B6C-9510833961A3}.Release.ActiveCfg = Release|Win32
@ -343,10 +324,6 @@ Global
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Debug.Build.0 = Debug|Win32
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Release.ActiveCfg = Release|Win32
{631C23CE-6C1D-4875-88F0-85E0A42B36EA}.Release.Build.0 = Release|Win32
{6FC24387-370C-4561-9582-7A819749E2C5}.Debug.ActiveCfg = Debug|Win32
{6FC24387-370C-4561-9582-7A819749E2C5}.Debug.Build.0 = Debug|Win32
{6FC24387-370C-4561-9582-7A819749E2C5}.Release.ActiveCfg = Release|Win32
{6FC24387-370C-4561-9582-7A819749E2C5}.Release.Build.0 = Release|Win32
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Debug.ActiveCfg = Debug|Win32
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Debug.Build.0 = Debug|Win32
{E4993E82-D68A-46CA-BAE0-9D35E172E46F}.Release.ActiveCfg = Release|Win32

View File

@ -8101,7 +8101,7 @@ then
CXXFLAGS="$CXXFLAGS \$(THREADSCXXFLAGS)"
fi
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/makeconv/Makefile tools/genrb/Makefile tools/genuca/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/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/toolutil/Makefile tools/dumpce/Makefile test/Makefile test/testdata/Makefile test/testdata/pkgdata.inc test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/thaitest/Makefile test/testmap/Makefile test/letest/Makefile test/threadtest/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/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/makeconv/Makefile tools/genrb/Makefile tools/genuca/Makefile tools/genccode/Makefile tools/gencmn/Makefile tools/gencnval/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/pkgdata/Makefile tools/toolutil/Makefile tools/dumpce/Makefile test/Makefile test/testdata/Makefile test/testdata/pkgdata.inc test/hdrtst/Makefile test/intltest/Makefile test/cintltst/Makefile test/iotest/Makefile test/thaitest/Makefile test/testmap/Makefile test/letest/Makefile test/threadtest/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
# tests run on this system so they can be shared between configure
@ -8659,7 +8659,6 @@ do
"tools/genbrk/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/genbrk/Makefile" ;;
"tools/gensprep/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/gensprep/Makefile" ;;
"tools/icupkg/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/icupkg/Makefile" ;;
"tools/icuswap/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/icuswap/Makefile" ;;
"tools/pkgdata/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/pkgdata/Makefile" ;;
"tools/toolutil/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/toolutil/Makefile" ;;
"tools/dumpce/Makefile" ) CONFIG_FILES="$CONFIG_FILES tools/dumpce/Makefile" ;;

View File

@ -1,6 +1,6 @@
dnl -*-m4-*-
dnl configure.in for ICU
dnl Copyright (c) 1999-2005, International Business Machines Corporation and
dnl Copyright (c) 1999-2006, International Business Machines Corporation and
dnl others. All Rights Reserved.
dnl Stephen F. Booth, heavily modified by Yves and others
@ -1050,7 +1050,6 @@ AC_OUTPUT([icudefs.mk \
tools/genbrk/Makefile \
tools/gensprep/Makefile \
tools/icupkg/Makefile \
tools/icuswap/Makefile \
tools/pkgdata/Makefile \
tools/toolutil/Makefile \
tools/dumpce/Makefile \

View File

@ -1,5 +1,5 @@
## Makefile.in for ICU data
## Copyright (c) 1999-2005, International Business Machines Corporation and
## Copyright (c) 1999-2006, International Business Machines Corporation and
## others. All Rights Reserved.
## Source directory information
@ -141,7 +141,7 @@ ICUDATA_ARCHIVE = $(firstword $(wildcard $(srcdir)/in/$(ICUDATA_BASENAME_VERSION
ifneq ($(ICUDATA_ARCHIVE),)
ICUDATA_SOURCE_ARCHIVE = $(OUTDIR)/$(ICUDATA_PLATFORM_NAME).dat
$(ICUDATA_SOURCE_ARCHIVE): $(ICUDATA_ARCHIVE) $(OUTDIR)
$(INVOKE) $(BINDIR)/icuswap -t$(ICUDATA_CHAR) $(ICUDATA_ARCHIVE) $(ICUDATA_SOURCE_ARCHIVE)
$(INVOKE) $(BINDIR)/icupkg -t$(ICUDATA_CHAR) $(ICUDATA_ARCHIVE) $(ICUDATA_SOURCE_ARCHIVE)
endif
else
ifneq ($(ENABLE_STATIC),YES)
@ -325,7 +325,7 @@ $(OUTTMPDIR)/icudata.lst: $(SRCLISTDEPS) $(ICUDATA_SOURCE_ARCHIVE) $(MAINBUILDDI
ifneq ($(ICUDATA_SOURCE_IS_NATIVE_TARGET),YES)
@echo "Unpacking $(ICUDATA_SOURCE_ARCHIVE) and generating $@ (list of data files)"
@-$(RMV) $@
$(INVOKE) $(BINDIR)/decmn -d $(MAINBUILDDIR) --pkgdata $(ICUDATA_SOURCE_ARCHIVE) > $@
$(INVOKE) $(BINDIR)/icupkg -d $(BUILDDIR) --list -x \* $(ICUDATA_SOURCE_ARCHIVE) > $@
else
@echo "$@" > $@
endif

View File

@ -1,5 +1,5 @@
#**********************************************************************
#* Copyright (C) 1999-2005, International Business Machines Corporation
#* Copyright (C) 1999-2006, International Business Machines Corporation
#* and others. All Rights Reserved.
#**********************************************************************
# nmake file for creating data files on win32
@ -364,10 +364,9 @@ uni-core-data: GODATA "$(ICUBLD_PKG)\uprops.icu" "$(ICUBLD_PKG)\ucase.icu" "$(IC
!IFDEF ICUDATA_SOURCE_ARCHIVE
"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : $(COMMON_ICUDATA_DEPENDENCIES) "$(ICUDATA_SOURCE_ARCHIVE)"
@echo Building icu data from $(ICUDATA_SOURCE_ARCHIVE)
cd "$(ICUBLD)"
decmn --pkgdata "$(ICUDATA_SOURCE_ARCHIVE)" > "$(ICUTMP)\pkgdatain.txt"
cd "$(ICUBLD_PKG)"
@"$(ICUP)\bin\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) "$(ICUTMP)\pkgdatain.txt"
"$(ICUP)\bin\icupkg" -x * --list "$(ICUDATA_SOURCE_ARCHIVE)" > "$(ICUTMP)\icudata.lst"
"$(ICUP)\bin\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) "$(ICUTMP)\icudata.lst"
copy "$(U_ICUDATA_NAME).dll" "$(DLL_OUTPUT)"
-@erase "$(U_ICUDATA_NAME).dll"
copy "$(ICUPKG).dat" "$(ICUOUT)\$(U_ICUDATA_NAME)$(U_ICUDATA_ENDIAN_SUFFIX).dat"
@ -376,7 +375,7 @@ uni-core-data: GODATA "$(ICUBLD_PKG)\uprops.icu" "$(ICUBLD_PKG)\ucase.icu" "$(IC
"$(DLL_OUTPUT)\$(U_ICUDATA_NAME).dll" : $(COMMON_ICUDATA_DEPENDENCIES) $(CNV_FILES) "$(ICUBLD_PKG)\unames.icu" "$(ICUBLD_PKG)\pnames.icu" "$(ICUBLD_PKG)\cnvalias.icu" "$(ICUBLD_PKG)\ucadata.icu" "$(ICUBLD_PKG)\invuca.icu" "$(ICUBLD_PKG)\uidna.spp" $(BRK_FILES) $(COL_COL_FILES) $(RBNF_RES_FILES) $(TRANSLIT_RES_FILES) $(ALL_RES)
@echo Building icu data
cd "$(ICUBLD_PKG)"
@"$(ICUP)\bin\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) <<"$(ICUTMP)\pkgdatain.txt"
"$(ICUP)\bin\pkgdata" $(COMMON_ICUDATA_ARGUMENTS) <<"$(ICUTMP)\icudata.lst"
pnames.icu
unames.icu
ucadata.icu
@ -442,6 +441,7 @@ CLEAN : GODATA
-@erase "*.dat"
@cd "$(ICUTMP)"
-@erase "*.txt"
-@erase "*.lst"
-@erase "*.mak"
-@erase "*.obj"
-@erase "*.res"
@ -588,8 +588,8 @@ res_index:table(nofallback) {
"$(ICUTOOLS)\gensprep\$(CFG)\gensprep" -s "$(ICUMISC)" -d "$(ICUBLD_PKG)\\" -b uidna -n "$(ICUUNIDATA)" -k -u 3.2.0 NamePrepProfile.txt
!IFDEF ICUDATA_ARCHIVE
"$(ICUDATA_SOURCE_ARCHIVE)": CREATE_DIRS $(ICUDATA_ARCHIVE) "$(ICUTOOLS)\icuswap\$(CFG)\icuswap.exe"
"$(ICUTOOLS)\icuswap\$(CFG)\icuswap" -t$(U_ICUDATA_ENDIAN_SUFFIX) "$(ICUDATA_ARCHIVE)" "$(ICUDATA_SOURCE_ARCHIVE)"
"$(ICUDATA_SOURCE_ARCHIVE)": CREATE_DIRS $(ICUDATA_ARCHIVE) "$(ICUTOOLS)\icupkg\$(CFG)\icupkg.exe"
"$(ICUTOOLS)\icupkg\$(CFG)\icupkg" -t$(U_ICUDATA_ENDIAN_SUFFIX) "$(ICUDATA_ARCHIVE)" "$(ICUDATA_SOURCE_ARCHIVE)"
!ENDIF
# Dependencies on the tools for the batch inference rules

View File

@ -1,5 +1,5 @@
## Makefile.in for ICU - tools/gencmn
## Copyright (c) 1999-2005, International Business Machines Corporation and
## Copyright (c) 1999-2006, International Business Machines Corporation and
## others. All Rights Reserved.
## Steven R. Loomis
@ -15,19 +15,17 @@ include $(top_builddir)/icudefs.mk
subdir = tools/gencmn
TARGET_STUB_NAME = gencmn
DECMN_STUB_NAME = decmn
SECTION = 8
MAN_FILES = $(TARGET_STUB_NAME).$(SECTION) $(DECMN_STUB_NAME).$(SECTION)
MAN_FILES = $(TARGET_STUB_NAME).$(SECTION)
## Extra files to remove for 'make clean'
CLEANFILES = *~ $(DEPS) $(DECMN_DEP) $(MAN_FILES)
CLEANFILES = *~ $(DEPS) $(MAN_FILES)
## Target information
TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT)
DECMN = $(BINDIR)/$(DECMN_STUB_NAME)$(EXEEXT)
ifneq ($(top_builddir),$(top_srcdir))
CPPFLAGS += -I$(top_builddir)/common
@ -36,10 +34,8 @@ CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil $(BIR_CPPFLAGS)
LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M)
OBJECTS = gencmn.o
DECMN_OBJ = decmn.o
DEPS = $(OBJECTS:.o=.d)
DECMN_DEP = $(DECMN_OBJ:.o=.d)
## List of phony targets
.PHONY : all all-local install install-local clean clean-local \
@ -56,12 +52,11 @@ distclean : distclean-local
dist: dist-local
check: all check-local
all-local: $(TARGET) $(DECMN) $(MAN_FILES)
all-local: $(TARGET) $(MAN_FILES)
install-local: all-local install-man
$(MKINSTALLDIRS) $(DESTDIR)$(sbindir)
$(INSTALL) $(TARGET) $(DESTDIR)$(sbindir)
$(INSTALL) $(DECMN) $(DESTDIR)$(sbindir)
install-man: $(MAN_FILES)
$(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION)
@ -71,7 +66,7 @@ dist-local:
clean-local:
test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES)
$(RMV) $(TARGET) $(OBJECTS) $(DECMN) $(DECMN_OBJ)
$(RMV) $(TARGET) $(OBJECTS)
distclean-local: clean-local
$(RMV) Makefile
@ -85,12 +80,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
$(TARGET) : $(OBJECTS)
$(LINK.c) $(OUTOPT)$@ $^ $(LIBS)
$(DECMN) : $(DECMN_OBJ)
$(LINK.c) $(OUTOPT)$@ $^ $(LIBS)
# This line is needed to serialize builds when the gmake -j option is used.
$(DECMN:$(EXEEXT)=).$(SECTION): $(TARGET:$(EXEEXT)=).$(SECTION)
%.$(SECTION): $(srcdir)/%.$(SECTION).in
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
@ -98,11 +87,9 @@ $(DECMN:$(EXEEXT)=).$(SECTION): $(TARGET:$(EXEEXT)=).$(SECTION)
ifeq (,$(MAKECMDGOALS))
-include $(DEPS)
-include $(DECMN_DEP)
else
ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),)
-include $(DEPS)
-include $(DECMN_DEP)
endif
endif

View File

@ -1,68 +0,0 @@
.\" Hey, Emacs! This is -*-nroff-*- you know...
.\"
.\" decmn.8: manual page for the decmn utility
.\"
.\" Copyright (C) 2001 IBM, Inc. and others.
.\"
.\" Manual page by Yves Arrouye <yves@realnames.com>.
.\"
.TH DECMN 8 "5 November 2001" "ICU MANPAGE" "ICU @VERSION@ Manual"
.SH NAME
.B decmn
\- explodes an ICU memory-mappable data file
.SH SYNOPSIS
.B decmn
[
.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
]
[
.B "\-n\"
]
[
.BI "\-C\fP, \fB\-\-comment"
]
[
.BI "\-d\fP, \fB\-\-destdir" " destination"
]
.I archive
.SH DESCRIPTION
.B decmn
reads the ICU memory-mappable data file
.I archive
and writes each of the
packaged files that it contains as a separate file in the destination
directory.
.PP
.B decmn
also writes a list of these files on its standard output. This list of
files can later be used, along with the individual files that have
been generated, to produce a new common data file using
.BR gencmn (8).
.\" Note that the output of
.\" .B decmn
.\" is not in the format expected by
.\" .BR gencmn (8).
.\" One can obtain a suitable file by filtering the output through
.\" .B "sed -e '1,2d' -e 's/[^=]*=//' -e '/^endfiles$/d"
.\" which transforms it into a simple list of filenames.
.SH OPTIONS
.TP
.BR "\-h\fP, \fB\-?\fP, \fB\-\-help"
Print help about usage and exit.
.TP
.B \-n
Do not create the output files.
.TP
.BI "\-C\fP, \fB\-\-comment"
Print the comment embedded in the archive file and exit.
.TP
.BI "\-d\fP, \fB\-\-destdir" " destination"
Set the destination directory to
.IR destination .
The default destination directory is the current directory.
.SH VERSION
@VERSION@
.SH COPYRIGHT
Copyright (C) 2001 IBM, Inc. and others.
.SH SEE ALSO
.BR gencmn (8)

View File

@ -1,303 +0,0 @@
/*
*******************************************************************************
*
* Copyright (C) 2000-2005, International Business Machines
* Corporation and others. All Rights Reserved.
*
*******************************************************************************
* file name: decmn.c
* encoding: US-ASCII
* tab size: 8 (not used)
* indentation:4
*
* created on: 2001mar05
* created by: Markus W. Scherer
* changes by: Yves Arrouye
*
* This tool takes an ICU common data file (icuxyz.dat),
* outputs a list of components,
* and writes one file per packaged data piece in the common file.
* This can be used to add, remove, or replace data.
*/
#include <stdio.h>
#include <stdlib.h>
#include "unicode/utypes.h"
#include "unicode/putil.h"
#include "unicode/udata.h"
#include "uoptions.h"
#include "cstring.h"
#include "toolutil.h"
static uint8_t buffer[100000], buffer2[128*1024];
static const char *pname;
static UOption options[]={
/*0*/ UOPTION_HELP_H,
/*1*/ UOPTION_HELP_QUESTION_MARK,
/*2*/ UOPTION_DESTDIR,
/*3*/ UOPTION_DEF(0, 'n', UOPT_NO_ARG),
/*4*/ UOPTION_DEF("comment", 'C', UOPT_NO_ARG),
/*5*/ UOPTION_DEF("pkgdata", 0, UOPT_NO_ARG),
};
static int
compareFiles(const void *file1, const void *file2) {
/* sort by file offset */
int32_t diff=*((int32_t *)file1+1)-*((int32_t *)file2+1);
if(diff!=0) {
return (int)(diff>>15)|1;
} else {
return 0;
}
}
static int
copyFile(FILE *in, int32_t offset, int32_t size, const char *dir, const char *name) {
FILE *out;
int32_t length;
char path[512], *p, *endDir;
UErrorCode status = U_ZERO_ERROR;
if(0!=fseek(in, offset, SEEK_SET)) {
fprintf(stderr, "%s: cannot seek to position %ld for file \"%s\"\n", pname,
(long)offset, name);
return 4;
}
/* Make sure that subdirectories are created first */
uprv_strcpy(path, dir);
p = path + strlen(path);
if (p[-1] != U_FILE_SEP_CHAR) {
*p++ = U_FILE_SEP_CHAR;
}
uprv_strcpy(p, name);
endDir = uprv_strrchr(p, U_TREE_ENTRY_SEP_CHAR);
if (endDir != NULL) {
/* Create the parent directories before creating the current directory. */
for (;;) {
p = uprv_strchr(p, U_TREE_ENTRY_SEP_CHAR);
if (p == NULL) {
break;
}
*p = 0;
uprv_mkdir(path, &status);
if (U_FAILURE(status)) {
fprintf(stderr, "%s: unable to create directory \"%s\"\n", pname, path);
return 5;
}
*(p++) = U_FILE_SEP_CHAR;
}
}
/* Set up the path with the real name now */
uprv_strcpy(path, dir);
p = path + strlen(path);
if (p[-1] != U_FILE_SEP_CHAR) {
*p++ = U_FILE_SEP_CHAR;
}
uprv_strcpy(p, name);
out=fopen(path, "wb");
if(out==NULL) {
fprintf(stderr, "%s: unable to open output file \"%s\"\n", pname, path);
return 5;
}
/* copy the contents into the new, separate file */
while(size>sizeof(buffer2)) {
length=(int32_t)fread(buffer2, 1, sizeof(buffer2), in);
if(length<=0) {
fprintf(stderr, "%s: read error while copying output file \"%s\"\n", pname, path);
fclose(out);
return 4;
}
if(length!=(int32_t)fwrite(buffer2, 1, length, out)) {
fprintf(stderr, "%s: write error while copying output file \"%s\"\n", pname, path);
fclose(out);
return 5;
}
size-=length;
}
while(size>0) {
length=(int32_t)fread(buffer2, 1, size, in);
if(length<=0) {
fprintf(stderr, "%s: read error while copying output file \"%s\"\n", pname, path);
fclose(out);
return 4;
}
if(length!=(int32_t)fwrite(buffer2, 1, length, out)) {
fprintf(stderr, "%s: write error while copying output file \"%s\"\n", pname, path);
fclose(out);
return 5;
}
size-=length;
}
fclose(out);
return 0;
}
extern int
main(int argc, char *argv[]) {
FILE *in;
UDataInfo *info;
uint8_t *base;
int32_t *p;
int32_t i, length, count, baseOffset;
int result, ishelp = 0, usePkgdataFormat = 0;
U_MAIN_INIT_ARGS(argc, argv);
pname = uprv_strchr(*argv, U_FILE_SEP_CHAR);
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
if (!pname) {
pname = uprv_strchr(*argv, U_FILE_ALT_SEP_CHAR);
}
#endif
if (pname) {
++pname;
} else {
pname = argv[0];
}
options[2].value = ".";
argc = u_parseArgs(argc, argv, sizeof(options) / sizeof(*options), options);
ishelp = options[0].doesOccur || options[1].doesOccur;
if (ishelp || argc != 2) {
fprintf(stderr,
"%csage: %s [ -h, -?, --help ] [ -n ] [ -C, --comment ] [ --pkgdata ] [ -d, --destdir destination ] archive\n", ishelp ? 'U' : 'u', pname);
if (ishelp) {
fprintf(stderr, "\nOptions:\n"
" -h, -?, --help print this message and exit\n"
" -n do not create files\n"
" -C, --comment print the comment embedded in the file and exit\n"
" --pkgdata Display the files in the package in a format for pkgdata\n"
" -d, --destdir destination create files in destination\n");
}
return ishelp ? 0 : 1;
}
usePkgdataFormat = options[5].doesOccur;
in=fopen(argv[1], "rb");
if(in==NULL) {
fprintf(stderr, "%s: unable to open input file \"%s\"\n", pname, argv[1]);
return 2;
}
/* read the beginning of the file */
length=(int32_t)fread(buffer, 1, sizeof(buffer), in);
if(length<20) {
fprintf(stderr, "%s: input file too short\n", pname);
fclose(in);
return 3;
}
/* check the validity of the file */
if(buffer[2]!=0xda || buffer[3]!=0x27) {
fprintf(stderr, "%s: not an ICU data file\n", pname);
fclose(in);
return 3;
}
/* check the platform properties for the file */
info=(UDataInfo *)(buffer+4);
if(info->isBigEndian!=U_IS_BIG_ENDIAN) {
fprintf(stderr, "%s: the file is in the wrong byte endianness\n", pname);
fclose(in);
return 3;
}
if(info->charsetFamily!=U_CHARSET_FAMILY) {
fprintf(stderr, "%s: the file is not built for this machine's charset family\n", pname);
fclose(in);
return 3;
}
/* check that this is a common data file */
if(info->dataFormat[0]!=0x43 || info->dataFormat[1]!=0x6d || info->dataFormat[2]!=0x6e || info->dataFormat[3]!=0x44) {
fprintf(stderr, "%s: this file is not a common data (archive) file\n", pname);
fclose(in);
return 3;
}
/* check for version 1 */
if(info->formatVersion[0]!=1) {
fprintf(stderr, "%s: the format version %d.%d.%d.%d is not known\n", pname,
info->formatVersion[0], info->formatVersion[1], info->formatVersion[2], info->formatVersion[3]);
fclose(in);
return 3;
}
/* do we want to show the comment, and is there a comment? */
if (options[4].doesOccur && *(uint16_t *)buffer>4+info->size) {
printf("%s\n", (const char *)(buffer+4+info->size));
return 0;
}
/* output all filenames */
baseOffset=*(uint16_t *)buffer;
base=buffer+baseOffset;
p=(int32_t *)base;
count=*p++;
/* printf("files[%ld]\n", (long)count); */
for(i=0; i<count; ++i) {
if (usePkgdataFormat) {
printf("%s\n", uprv_strchr((const char *)(base+*p), U_TREE_ENTRY_SEP_CHAR)+1);
}
else {
printf("%s%c%s\n", options[2].value, U_FILE_SEP_CHAR, base+*p);
}
p+=2;
}
/* puts("endfiles"); */
if (options[3].doesOccur) { /* Do not extract. */
return 0;
}
/* sort all files by their offsets in the common file */
qsort(base+4, count, 8, compareFiles);
/* write all files except the last one */
p=(int32_t *)(base+4);
--count;
for(i=0; i<count; ++i) {
/* the size is the difference between this file's offset and the next one's */
result=copyFile(in, baseOffset+p[1], p[3]-p[1], options[2].value, (const char *)(base+*p));
if(result!=0) {
fclose(in);
return result;
}
p+=2;
}
/* write the last file */
if(count>=0) {
/* the size is the number of bytes to the end of the common file */
if(0!=fseek(in, 0, SEEK_END)) {
fprintf(stderr, "%s: unable to seek to the end of the common file\n", pname);
return 4;
}
result=copyFile(in, baseOffset+p[1], (int32_t)ftell(in)-baseOffset-p[1], options[2].value, (const char *)(base+*p));
if(result!=0) {
fclose(in);
return result;
}
}
fclose(in);
return 0;
}
/*
* Hey, Emacs, please set the following:
*
* Local Variables:
* indent-tabs-mode: nil
* End:
*
*/

View File

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