2 *******************************************************************************
4 * Copyright (C) 1999-2016, International Business Machines
5 * Corporation and others. All Rights Reserved.
7 *******************************************************************************
10 * tab size: 8 (not used)
13 * created on: 1999nov01
14 * created by: Markus W. Scherer
16 * This program reads a list of data files and combines them
17 * into one common, memory-mappable file.
22 #include "unicode/utypes.h"
23 #include "unicode/putil.h"
28 #include "unicode/uclean.h"
32 #include "pkg_gencmn.h"
34 static UOption options
[]={
36 /*1*/ UOPTION_HELP_QUESTION_MARK
,
37 /*2*/ UOPTION_VERBOSE
,
38 /*3*/ UOPTION_COPYRIGHT
,
39 /*4*/ UOPTION_DESTDIR
,
40 /*5*/ UOPTION_DEF( "comment", 'C', UOPT_REQUIRES_ARG
),
41 /*6*/ UOPTION_DEF( "name", 'n', UOPT_REQUIRES_ARG
),
42 /*7*/ UOPTION_DEF( "type", 't', UOPT_REQUIRES_ARG
),
43 /*8*/ UOPTION_DEF( "source", 'S', UOPT_NO_ARG
),
44 /*9*/ UOPTION_DEF( "entrypoint", 'e', UOPT_REQUIRES_ARG
),
45 /*10*/UOPTION_SOURCEDIR
,
49 main(int argc
, char* argv
[]) {
50 UBool sourceTOC
, verbose
;
53 U_MAIN_INIT_ARGS(argc
, argv
);
55 /* preset then read command line options */
56 argc
=u_parseArgs(argc
, argv
, UPRV_LENGTHOF(options
), options
);
58 /* error handling, printing usage message */
61 "error in command line argument \"%s\"\n",
67 if(argc
<0 || options
[0].doesOccur
|| options
[1].doesOccur
) {
68 FILE *where
= argc
< 0 ? stderr
: stdout
;
71 * Broken into chucks because the C89 standard says the minimum
72 * required supported string length is 509 bytes.
75 "%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
);
76 if (options
[0].doesOccur
|| options
[1].doesOccur
) {
78 "Read the list file (default: standard input) and create a common data\n"
79 "file from specified files. Omit any files larger than maxsize, if maxsize > 0.\n");
82 "\t-h, -?, --help this usage text\n"
83 "\t-v, --verbose verbose output\n"
84 "\t-c, --copyright include the ICU copyright notice\n"
85 "\t-C, --comment comment include a comment string\n"
86 "\t-d, --destdir dir destination directory\n");
88 "\t-n, --name filename output filename, without .type extension\n"
89 "\t (default: " U_ICUDATA_NAME
")\n"
90 "\t-t, --type filetype type of the destination file\n"
91 "\t (default: \" dat \")\n"
92 "\t-S, --source tocfile write a .c source file with the table of\n"
94 "\t-e, --entrypoint name override the c entrypoint name\n"
95 "\t (default: \"<name>_<type>\")\n");
97 return argc
<0 ? U_ILLEGAL_ARGUMENT_ERROR
: U_ZERO_ERROR
;
100 sourceTOC
=options
[8].doesOccur
;
102 verbose
= options
[2].doesOccur
;
104 maxSize
=(uint32_t)uprv_strtoul(argv
[1], NULL
, 0);
106 createCommonDataFile(options
[4].doesOccur
? options
[4].value
: NULL
,
107 options
[6].doesOccur
? options
[6].value
: NULL
,
108 options
[9].doesOccur
? options
[9].value
: options
[6].doesOccur
? options
[6].value
: NULL
,
109 options
[7].doesOccur
? options
[7].value
: NULL
,
110 options
[10].doesOccur
? options
[10].value
: NULL
,
111 options
[3].doesOccur
? U_COPYRIGHT_STRING
: options
[5].doesOccur
? options
[5].value
: NULL
,
112 argc
== 2 ? NULL
: argv
[2],
113 maxSize
, sourceTOC
, verbose
, NULL
);
118 * Hey, Emacs, please set the following:
121 * indent-tabs-mode: nil