diff options
Diffstat (limited to 'intl/icu/source/tools/gencmn')
-rw-r--r-- | intl/icu/source/tools/gencmn/Makefile.in | 96 | ||||
-rw-r--r-- | intl/icu/source/tools/gencmn/gencmn.8.in | 131 | ||||
-rw-r--r-- | intl/icu/source/tools/gencmn/gencmn.c | 126 | ||||
-rw-r--r-- | intl/icu/source/tools/gencmn/gencmn.vcxproj | 80 | ||||
-rw-r--r-- | intl/icu/source/tools/gencmn/gencmn.vcxproj.filters | 22 | ||||
-rw-r--r-- | intl/icu/source/tools/gencmn/sources.txt | 1 |
6 files changed, 456 insertions, 0 deletions
diff --git a/intl/icu/source/tools/gencmn/Makefile.in b/intl/icu/source/tools/gencmn/Makefile.in new file mode 100644 index 0000000000..bb7fc4e7b4 --- /dev/null +++ b/intl/icu/source/tools/gencmn/Makefile.in @@ -0,0 +1,96 @@ +## Makefile.in for ICU - tools/gencmn +## Copyright (C) 2016 and later: Unicode, Inc. and others. +## License & terms of use: http://www.unicode.org/copyright.html +## Copyright (c) 1999-2011, International Business Machines Corporation and +## others. All Rights Reserved. +## Steven R. Loomis + +## Source directory information +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ + +top_builddir = ../.. + +include $(top_builddir)/icudefs.mk + +## Build directory information +subdir = tools/gencmn + +TARGET_STUB_NAME = gencmn + +SECTION = 8 + +MAN_FILES = $(TARGET_STUB_NAME).$(SECTION) + + +## Extra files to remove for 'make clean' +CLEANFILES = *~ $(DEPS) $(MAN_FILES) + +## Target information +TARGET = $(BINDIR)/$(TARGET_STUB_NAME)$(EXEEXT) + +CPPFLAGS += -I$(top_srcdir)/common -I$(srcdir)/../toolutil +LIBS = $(LIBICUTOOLUTIL) $(LIBICUI18N) $(LIBICUUC) $(DEFAULT_LIBS) $(LIB_M) + +SOURCES = $(shell cat $(srcdir)/sources.txt) +OBJECTS = $(SOURCES:.c=.o) + +DEPS = $(OBJECTS:.o=.d) + +## List of phony targets +.PHONY : all all-local install install-local clean clean-local \ +distclean distclean-local dist dist-local check check-local install-man + +## 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) $(MAN_FILES) + +install-local: all-local install-man + $(MKINSTALLDIRS) $(DESTDIR)$(sbindir) + $(INSTALL) $(TARGET) $(DESTDIR)$(sbindir) + +install-man: $(MAN_FILES) + $(MKINSTALLDIRS) $(DESTDIR)$(mandir)/man$(SECTION) + $(INSTALL_DATA) $? $(DESTDIR)$(mandir)/man$(SECTION) + +dist-local: + +clean-local: + test -z "$(CLEANFILES)" || $(RMV) $(CLEANFILES) + $(RMV) $(TARGET) $(OBJECTS) + +distclean-local: clean-local + $(RMV) Makefile + +check-local: all-local + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + +$(TARGET) : $(OBJECTS) + $(LINK.cc) $(OUTOPT)$@ $^ $(LIBS) + $(POST_BUILD_STEP) + +%.$(SECTION): $(srcdir)/%.$(SECTION).in + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +ifeq (,$(MAKECMDGOALS)) +-include $(DEPS) +else +ifneq ($(patsubst %clean,,$(MAKECMDGOALS)),) +-include $(DEPS) +endif +endif + diff --git a/intl/icu/source/tools/gencmn/gencmn.8.in b/intl/icu/source/tools/gencmn/gencmn.8.in new file mode 100644 index 0000000000..c48fbeeab6 --- /dev/null +++ b/intl/icu/source/tools/gencmn/gencmn.8.in @@ -0,0 +1,131 @@ +.\" Hey, Emacs! This is -*-nroff-*- you know... +.\" +.\" gencmn.8: manual page for the gencmn utility +.\" +.\" Copyright (C) 2016 and later: Unicode, Inc. and others. +.\" License & terms of use: http://www.unicode.org/copyright.html +.\" Copyright (C) 2000-2001 IBM, Inc. and others. +.\" +.\" Manual page by Yves Arrouye <yves@realnames.com>. +.\" +.TH GENCMN 8 "5 November 2001" "ICU MANPAGE" "ICU @VERSION@ Manual" +.SH NAME +.B gencmn +\- generate an ICU memory-mappable data file +.SH SYNOPSIS +.B gencmn +[ +.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" +] +[ +.BR "\-v\fP, \fB\-\-verbose" +] +[ +.BR "\-c\fP, \fB\-\-copyright" +| +.BI "\-C\fP, \fB\-\-comment" " comment" +] +[ +.BI "\-d\fP, \fB\-\-destdir" " destination" +] +[ +.BI "\-n\fP, \fB\-\-name" " name" +] +[ +.BI "\-t\fP, \fB\-\-type" " fileext" +] +[ +.BI "\-S\fP, \fB\-\-source" +] +[ +.BI "\-e\fP, \fB\-\-entrypoint" " name" +] +.I maxsize +[ +.I listfilename +] +.SH DESCRIPTION +.B gencmn +takes a set of files and packages them as an ICU memory-mappable data +file. The resulting data file can then be used directly by ICU. +.PP +.B gencmn +reads a list of files to be packaged from either the +supplied +.I listfilename +file, or from its standard output. It packages all the files from +the list that are not bigger than +.I maxsize +bytes, except if +.I maxsize +is 0, which indicates that there is no size limit on files. +.SH OPTIONS +.TP +.BR "\-h\fP, \fB\-?\fP, \fB\-\-help" +Print help about usage and exit. +.TP +.BR "\-v\fP, \fB\-\-verbose" +Display extra informative messages during execution. +.TP +.BR \-c\fP, \fB\-\-copyright +Include the ICU copyright notice in the resulting data. +.TP +.BI "\-C\fP, \fB\-\-comment" " comment" +Include the specified +.I comment +in the resulting data instead of the ICU copyright notice. +.TP +.BI "\-d\fP, \fB\-\-destdir" " destination" +Set the destination directory to +.IR destination . +The default destination directory is specified by the environment variable +.BR ICU_DATA . +.TP +.BI "\-n\fP, \fB\-\-name" " name" +Set the data name to +.I name +instead of the default. This name is also used as the base name of the +output. The default name is made of the +.I icudt +prefix, followed by a two-digit version number corresponding to +the current version of the ICU release, and a single letter indicating +the endianness of the data (the letter +.I b +indicated big endian data, and the letter +.I l +indicates little endian ones). +.TP +.BI "\-t\fP, \fB\-\-type" " type" +Use +.I type +as the type of the data. This type is also used as the extension of +the generated data file. The default type ie +.IR dat . +.TP +.BI "\-S\fP, \fB\-\-source" +Write a C source file with the table of contents of the data. +.TP +.BI "\-e\fP, \fB\-\-entrypoint" " name" +Set the data entry point (used for linking against the data in a +shared library form) to +.IR name . +The default entry point name is made of the data (set by the +.BI "\-n\fP, \fB\-\-name" +option) followed by an underscore and the type of the data (set by the +.BI "\-t\fP, \fB\-\-type" +option). +.SH ENVIRONMENT +.TP 10 +.B ICU_DATA +Specifies the directory containing ICU data. Defaults to +.BR @thepkgicudatadir@/@PACKAGE@/@VERSION@/ . +Some tools in ICU depend on the presence of the trailing slash. It is thus +important to make sure that it is present if +.B ICU_DATA +is set. +.SH VERSION +@VERSION@ +.SH COPYRIGHT +Copyright (C) 2000-2001 IBM, Inc. and others. +.SH SEE ALSO +.BR decmn (8) diff --git a/intl/icu/source/tools/gencmn/gencmn.c b/intl/icu/source/tools/gencmn/gencmn.c new file mode 100644 index 0000000000..77f0c20c61 --- /dev/null +++ b/intl/icu/source/tools/gencmn/gencmn.c @@ -0,0 +1,126 @@ +// © 2016 and later: Unicode, Inc. and others. +// License & terms of use: http://www.unicode.org/copyright.html +/* +******************************************************************************* +* +* Copyright (C) 1999-2016, International Business Machines +* Corporation and others. All Rights Reserved. +* +******************************************************************************* +* file name: gencmn.c +* encoding: UTF-8 +* tab size: 8 (not used) +* indentation:4 +* +* created on: 1999nov01 +* created by: Markus W. Scherer +* +* This program reads a list of data files and combines them +* into one common, memory-mappable file. +*/ + +#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 "uoptions.h" +#include "putilimp.h" +#include "pkg_gencmn.h" + +static UOption options[]={ +/*0*/ UOPTION_HELP_H, +/*1*/ UOPTION_HELP_QUESTION_MARK, +/*2*/ UOPTION_VERBOSE, +/*3*/ UOPTION_COPYRIGHT, +/*4*/ UOPTION_DESTDIR, +/*5*/ UOPTION_DEF( "comment", 'C', UOPT_REQUIRES_ARG), +/*6*/ UOPTION_DEF( "name", 'n', UOPT_REQUIRES_ARG), +/*7*/ UOPTION_DEF( "type", 't', UOPT_REQUIRES_ARG), +/*8*/ UOPTION_DEF( "source", 'S', UOPT_NO_ARG), +/*9*/ UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG), +/*10*/UOPTION_SOURCEDIR, +}; + +extern int +main(int argc, char* argv[]) { + UBool sourceTOC, verbose; + uint32_t maxSize; + + U_MAIN_INIT_ARGS(argc, argv); + + /* preset then read command line options */ + argc=u_parseArgs(argc, argv, UPRV_LENGTHOF(options), options); + + /* error handling, printing usage message */ + if(argc<0) { + fprintf(stderr, + "error in command line argument \"%s\"\n", + argv[-argc]); + } else if(argc<2) { + argc=-1; + } + + 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. + */ + fprintf(where, + "%csage: %s [ -h, -?, --help ] [ -v, --verbose ] [ -c, --copyright ] [ -C, --comment comment ] [ -d, --destdir dir ] [ -n, --name filename ] [ -t, --type filetype ] [ -S, --source tocfile ] [ -e, --entrypoint name ] maxsize listfile\n", argc < 0 ? 'u' : 'U', *argv); + if (options[0].doesOccur || options[1].doesOccur) { + fprintf(where, "\n" + "Read the list file (default: standard input) and create a common data\n" + "file from specified files. Omit any files larger than maxsize, if maxsize > 0.\n"); + fprintf(where, "\n" + "Options:\n" + "\t-h, -?, --help this usage text\n" + "\t-v, --verbose verbose output\n" + "\t-c, --copyright include the ICU copyright notice\n" + "\t-C, --comment comment include a comment string\n" + "\t-d, --destdir dir destination directory\n"); + fprintf(where, + "\t-n, --name filename output filename, without .type extension\n" + "\t (default: " U_ICUDATA_NAME ")\n" + "\t-t, --type filetype type of the destination file\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" + "\t (default: \"<name>_<type>\")\n"); + } + return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR; + } + + sourceTOC=options[8].doesOccur; + + verbose = options[2].doesOccur; + + maxSize=(uint32_t)uprv_strtoul(argv[1], NULL, 0); + + 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; +} +/* + * Hey, Emacs, please set the following: + * + * Local Variables: + * indent-tabs-mode: nil + * End: + * + */ diff --git a/intl/icu/source/tools/gencmn/gencmn.vcxproj b/intl/icu/source/tools/gencmn/gencmn.vcxproj new file mode 100644 index 0000000000..94c18b6ac5 --- /dev/null +++ b/intl/icu/source/tools/gencmn/gencmn.vcxproj @@ -0,0 +1,80 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <PropertyGroup Label="Globals"> + <ProjectGuid>{A8D36F8D-09E6-4174-91C3-7BEAA9C3F04F}</ProjectGuid> + </PropertyGroup> + <PropertyGroup Label="Configuration"> + <ConfigurationType>Application</ConfigurationType> + <UseOfMfc>false</UseOfMfc> + <CharacterSet>MultiByte</CharacterSet> + </PropertyGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> + <!-- The following import will include the 'default' configuration options for VS projects. --> + <Import Project="..\..\allinone\Build.Windows.ProjectConfiguration.props" /> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> + <ImportGroup Label="ExtensionSettings"> + </ImportGroup> + <PropertyGroup Label="UserMacros" /> + <PropertyGroup> + <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> + <OutDir>.\$(Platform)\$(Configuration)\</OutDir> + <IntDir>.\$(Platform)\$(Configuration)\</IntDir> + <!-- The ICU projects use "Win32" to mean "x86", so we need to special case it. --> + <OutDir Condition="'$(Platform)'=='Win32'">.\x86\$(Configuration)\</OutDir> + <IntDir Condition="'$(Platform)'=='Win32'">.\x86\$(Configuration)\</IntDir> + <!-- Disable Incremental Linking for Release builds as it prevents Link-time Code Generation --> + <LinkIncremental Condition="'$(Configuration)'=='Debug'">true</LinkIncremental> + <LinkIncremental Condition="'$(Configuration)'=='Release'">false</LinkIncremental> + </PropertyGroup> + <!-- Options that are common to *all* configurations --> + <ItemDefinitionGroup> + <Midl> + <TypeLibraryName>$(OutDir)/gencmn.tlb</TypeLibraryName> + </Midl> + <ClCompile> + <WarningLevel>Level3</WarningLevel> + <CompileAs>Default</CompileAs> + <DisableLanguageExtensions>true</DisableLanguageExtensions> + <AdditionalIncludeDirectories>..\..\common;..\toolutil;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> + <PrecompiledHeaderOutputFile>$(OutDir)/gencmn.pch</PrecompiledHeaderOutputFile> + <AssemblerListingLocation>$(OutDir)/</AssemblerListingLocation> + <ObjectFileName>$(OutDir)/</ObjectFileName> + <ProgramDataBaseFileName>$(OutDir)/gencmn.pdb</ProgramDataBaseFileName> + </ClCompile> + <Link> + <SubSystem>Console</SubSystem> + <OutputFile>$(OutDir)/gencmn.exe</OutputFile> + <AdditionalLibraryDirectories>..\..\..\$(IcuLibOutputDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> + </Link> + <CustomBuildStep> + <Command>copy "$(TargetPath)" ..\..\..\$(IcuBinOutputDir)</Command> + <Outputs>..\..\..\$(IcuBinOutputDir)\$(TargetFileName);%(Outputs)</Outputs> + </CustomBuildStep> + </ItemDefinitionGroup> + <!-- Options that are common to all 'Debug' project configurations --> + <ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'"> + <ClCompile> + <BrowseInformation>true</BrowseInformation> + <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> + </ClCompile> + <Link> + <AdditionalDependencies>icuucd.lib;icutud.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <!-- Options that are common to all 'Release' project configurations --> + <ItemDefinitionGroup Condition="'$(Configuration)'=='Release'"> + <ClCompile> + <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> + <FunctionLevelLinking>true</FunctionLevelLinking> + </ClCompile> + <Link> + <AdditionalDependencies>icuuc.lib;icutu.lib;%(AdditionalDependencies)</AdditionalDependencies> + </Link> + </ItemDefinitionGroup> + <ItemGroup> + <ClCompile Include="gencmn.c" /> + </ItemGroup> + <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> + <ImportGroup Label="ExtensionTargets"> + </ImportGroup> +</Project>
\ No newline at end of file diff --git a/intl/icu/source/tools/gencmn/gencmn.vcxproj.filters b/intl/icu/source/tools/gencmn/gencmn.vcxproj.filters new file mode 100644 index 0000000000..d69b206638 --- /dev/null +++ b/intl/icu/source/tools/gencmn/gencmn.vcxproj.filters @@ -0,0 +1,22 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + <ItemGroup> + <Filter Include="Source Files"> + <UniqueIdentifier>{5be5a226-8538-4456-89d2-b20fb1906561}</UniqueIdentifier> + <Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions> + </Filter> + <Filter Include="Header Files"> + <UniqueIdentifier>{56407937-8dde-450c-b05f-115430ced4a1}</UniqueIdentifier> + <Extensions>h;hpp;hxx;hm;inl</Extensions> + </Filter> + <Filter Include="Resource Files"> + <UniqueIdentifier>{7de2655e-2d51-47cf-8e41-c3fe55c0f921}</UniqueIdentifier> + <Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions> + </Filter> + </ItemGroup> + <ItemGroup> + <ClCompile Include="gencmn.c"> + <Filter>Source Files</Filter> + </ClCompile> + </ItemGroup> +</Project>
\ No newline at end of file diff --git a/intl/icu/source/tools/gencmn/sources.txt b/intl/icu/source/tools/gencmn/sources.txt new file mode 100644 index 0000000000..6ffa7777aa --- /dev/null +++ b/intl/icu/source/tools/gencmn/sources.txt @@ -0,0 +1 @@ +gencmn.c |