Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(62)

Side by Side Diff: source/tools/gencnval/gencnval.c

Issue 1621843002: ICU 56 update step 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/deps/icu.git@561
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « source/tools/gencmn/gencmn.vcxproj.filters ('k') | source/tools/gencnval/gencnval.vcxproj » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 ******************************************************************************* 2 *******************************************************************************
3 * 3 *
4 * Copyright (C) 1999-2012, International Business Machines 4 * Copyright (C) 1999-2015 International Business Machines
5 * Corporation and others. All Rights Reserved. 5 * Corporation and others. All Rights Reserved.
6 * 6 *
7 ******************************************************************************* 7 *******************************************************************************
8 * file name: gencnval.c 8 * file name: gencnval.c
9 * encoding: US-ASCII 9 * encoding: US-ASCII
10 * tab size: 8 (not used) 10 * tab size: 8 (not used)
11 * indentation:4 11 * indentation:4
12 * 12 *
13 * created on: 1999nov05 13 * created on: 1999nov05
14 * created by: Markus W. Scherer 14 * created by: Markus W. Scherer
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 static uint16_t knownAliasesCount = 0; 128 static uint16_t knownAliasesCount = 0;
129 /*static uint16_t duplicateKnownAliasesCount = 0;*/ 129 /*static uint16_t duplicateKnownAliasesCount = 0;*/
130 130
131 /* Used for storing the lists section that point to aliases */ 131 /* Used for storing the lists section that point to aliases */
132 static uint16_t aliasLists[MAX_LIST_SIZE]; 132 static uint16_t aliasLists[MAX_LIST_SIZE];
133 static uint16_t aliasListsSize = 0; 133 static uint16_t aliasListsSize = 0;
134 134
135 /* Were the standard tags declared before the aliases. */ 135 /* Were the standard tags declared before the aliases. */
136 static UBool standardTagsUsed = FALSE; 136 static UBool standardTagsUsed = FALSE;
137 static UBool verbose = FALSE; 137 static UBool verbose = FALSE;
138 static UBool quiet = FALSE;
138 static int lineNum = 1; 139 static int lineNum = 1;
139 140
140 static UConverterAliasOptions tableOptions = { 141 static UConverterAliasOptions tableOptions = {
141 UCNV_IO_STD_NORMALIZED, 142 UCNV_IO_STD_NORMALIZED,
142 1 /* containsCnvOptionInfo */ 143 1 /* containsCnvOptionInfo */
143 }; 144 };
144 145
145 146
146 /** 147 /**
147 * path to convrtrs.txt 148 * path to convrtrs.txt
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 #define GET_ALIAS_NUM(str) ((uint16_t)((str - stringStore) >> 1)) 197 #define GET_ALIAS_NUM(str) ((uint16_t)((str - stringStore) >> 1))
197 #define GET_TAG_NUM(str) ((uint16_t)((str - tagStore) >> 1)) 198 #define GET_TAG_NUM(str) ((uint16_t)((str - tagStore) >> 1))
198 199
199 enum 200 enum
200 { 201 {
201 HELP1, 202 HELP1,
202 HELP2, 203 HELP2,
203 VERBOSE, 204 VERBOSE,
204 COPYRIGHT, 205 COPYRIGHT,
205 DESTDIR, 206 DESTDIR,
206 SOURCEDIR 207 SOURCEDIR,
208 QUIET
207 }; 209 };
208 210
209 static UOption options[]={ 211 static UOption options[]={
210 UOPTION_HELP_H, 212 UOPTION_HELP_H,
211 UOPTION_HELP_QUESTION_MARK, 213 UOPTION_HELP_QUESTION_MARK,
212 UOPTION_VERBOSE, 214 UOPTION_VERBOSE,
213 UOPTION_COPYRIGHT, 215 UOPTION_COPYRIGHT,
214 UOPTION_DESTDIR, 216 UOPTION_DESTDIR,
215 UOPTION_SOURCEDIR 217 UOPTION_SOURCEDIR,
218 UOPTION_QUIET
216 }; 219 };
217 220
218 extern int 221 extern int
219 main(int argc, char* argv[]) { 222 main(int argc, char* argv[]) {
220 int i, n; 223 int i, n;
221 char pathBuf[512]; 224 char pathBuf[512];
222 FileStream *in; 225 FileStream *in;
223 UNewDataMemory *out; 226 UNewDataMemory *out;
224 UErrorCode errorCode=U_ZERO_ERROR; 227 UErrorCode errorCode=U_ZERO_ERROR;
225 228
226 U_MAIN_INIT_ARGS(argc, argv); 229 U_MAIN_INIT_ARGS(argc, argv);
227 230
228 /* preset then read command line options */ 231 /* preset then read command line options */
229 options[DESTDIR].value=options[SOURCEDIR].value=u_getDataDirectory(); 232 options[DESTDIR].value=options[SOURCEDIR].value=u_getDataDirectory();
230 argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options); 233 argc=u_parseArgs(argc, argv, sizeof(options)/sizeof(options[0]), options);
231 234
232 /* error handling, printing usage message */ 235 /* error handling, printing usage message */
233 if(argc<0) { 236 if(argc<0) {
234 fprintf(stderr, 237 fprintf(stderr,
235 "error in command line argument \"%s\"\n", 238 "error in command line argument \"%s\"\n",
236 argv[-argc]); 239 argv[-argc]);
237 } 240 }
238 if(argc<0 || options[HELP1].doesOccur || options[HELP2].doesOccur) { 241 if(argc<0 || options[HELP1].doesOccur || options[HELP2].doesOccur) {
239 fprintf(stderr, 242 fprintf(stderr,
240 "usage: %s [-options] [convrtrs.txt]\n" 243 "usage: %s [-options] [convrtrs.txt]\n"
241 "\tread convrtrs.txt and create " U_ICUDATA_NAME "_" DATA_NAME "." D ATA_TYPE "\n" 244 "\tread convrtrs.txt and create " U_ICUDATA_NAME "_" DATA_NAME "." D ATA_TYPE "\n"
242 "options:\n" 245 "options:\n"
243 "\t-h or -? or --help this usage text\n" 246 "\t-h or -? or --help this usage text\n"
244 "\t-v or --verbose prints out extra information about the alias table\n" 247 "\t-v or --verbose prints out extra information about the alias table\n"
248 "\t-q or --quiet do not display warnings and progress\n"
245 "\t-c or --copyright include a copyright notice\n" 249 "\t-c or --copyright include a copyright notice\n"
246 "\t-d or --destdir destination directory, followed by the path\n " 250 "\t-d or --destdir destination directory, followed by the path\n "
247 "\t-s or --sourcedir source directory, followed by the path\n", 251 "\t-s or --sourcedir source directory, followed by the path\n",
248 argv[0]); 252 argv[0]);
249 return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR; 253 return argc<0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR;
250 } 254 }
251 255
252 if(options[VERBOSE].doesOccur) { 256 if(options[VERBOSE].doesOccur) {
253 verbose = TRUE; 257 verbose = TRUE;
254 } 258 }
255 259
260 if(options[QUIET].doesOccur) {
261 quiet = TRUE;
262 }
263
256 if(argc>=2) { 264 if(argc>=2) {
257 path=argv[1]; 265 path=argv[1];
258 } else { 266 } else {
259 path=options[SOURCEDIR].value; 267 path=options[SOURCEDIR].value;
260 if(path!=NULL && *path!=0) { 268 if(path!=NULL && *path!=0) {
261 char *end; 269 char *end;
262 270
263 uprv_strcpy(pathBuf, path); 271 uprv_strcpy(pathBuf, path);
264 end = uprv_strchr(pathBuf, 0); 272 end = uprv_strchr(pathBuf, 0);
265 if(*(end-1)!=U_FILE_SEP_CHAR) { 273 if(*(end-1)!=U_FILE_SEP_CHAR) {
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
922 GET_TAG_STR(tags[tag].tag), 930 GET_TAG_STR(tags[tag].tag),
923 GET_ALIAS_STR(converters[converter].converter));*/ 931 GET_ALIAS_STR(converters[converter].converter));*/
924 for (aliasNum = 0; aliasNum < aliasList->aliasCount; aliasNum++) { 932 for (aliasNum = 0; aliasNum < aliasList->aliasCount; aliasNum++) {
925 uint16_t value; 933 uint16_t value;
926 /* printf(" %s\n", 934 /* printf(" %s\n",
927 GET_ALIAS_STR(aliasList->aliases[aliasNum]));*/ 935 GET_ALIAS_STR(aliasList->aliases[aliasNum]));*/
928 if (aliasList->aliases[aliasNum]) { 936 if (aliasList->aliases[aliasNum]) {
929 value = aliasList->aliases[aliasNum] + offset; 937 value = aliasList->aliases[aliasNum] + offset;
930 } else { 938 } else {
931 value = 0; 939 value = 0;
932 if (tag != 0) { /* Only show the warning when it's not the lefto ver tag. */ 940 if (tag != 0 && !quiet) { /* Only show the warning when it's not the leftover tag. */
933 fprintf(stderr, "%s: warning: tag %s does not have a default alias for %s\n", 941 fprintf(stderr, "%s: warning: tag %s does not have a default alias for %s\n",
934 path, 942 path,
935 GET_TAG_STR(tags[tag].tag), 943 GET_TAG_STR(tags[tag].tag),
936 GET_ALIAS_STR(converters[converter].converter)); 944 GET_ALIAS_STR(converters[converter].converter));
937 } 945 }
938 } 946 }
939 aliasLists[aliasListsSize++] = value; 947 aliasLists[aliasListsSize++] = value;
940 if (aliasListsSize >= MAX_LIST_SIZE) { 948 if (aliasListsSize >= MAX_LIST_SIZE) {
941 fprintf(stderr, "%s: error: Too many alias lists\n", path); 949 fprintf(stderr, "%s: error: Too many alias lists\n", path);
942 exit(U_BUFFER_OVERFLOW_ERROR); 950 exit(U_BUFFER_OVERFLOW_ERROR);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1119 1127
1120 /* 1128 /*
1121 * Hey, Emacs, please set the following: 1129 * Hey, Emacs, please set the following:
1122 * 1130 *
1123 * Local Variables: 1131 * Local Variables:
1124 * indent-tabs-mode: nil 1132 * indent-tabs-mode: nil
1125 * End: 1133 * End:
1126 * 1134 *
1127 */ 1135 */
1128 1136
OLDNEW
« no previous file with comments | « source/tools/gencmn/gencmn.vcxproj.filters ('k') | source/tools/gencnval/gencnval.vcxproj » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698