OLD | NEW |
1 /* | 1 /* |
2 ******************************************************************************* | 2 ******************************************************************************* |
3 * | 3 * |
4 * Copyright (C) 1998-2012, International Business Machines | 4 * Copyright (C) 1998-2014, International Business Machines |
5 * Corporation and others. All Rights Reserved. | 5 * Corporation and others. All Rights Reserved. |
6 * | 6 * |
7 ******************************************************************************* | 7 ******************************************************************************* |
8 * | 8 * |
9 * File genrb.c | 9 * File genrb.c |
10 * | 10 * |
11 * Modification History: | 11 * Modification History: |
12 * | 12 * |
13 * Date Name Description | 13 * Date Name Description |
14 * 05/25/99 stephen Creation. | 14 * 05/25/99 stephen Creation. |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 UOPTION_DEF("formatVersion", '\x01', UOPT_REQUIRES_ARG),/*
18 */ | 85 UOPTION_DEF("formatVersion", '\x01', UOPT_REQUIRES_ARG),/*
18 */ |
86 UOPTION_DEF("writePoolBundle", '\x01', UOPT_NO_ARG),/* 19
*/ | 86 UOPTION_DEF("writePoolBundle", '\x01', UOPT_NO_ARG),/* 19
*/ |
87 UOPTION_DEF("usePoolBundle", '\x01', UOPT_OPTIONAL_ARG),/*
20 */ | 87 UOPTION_DEF("usePoolBundle", '\x01', UOPT_OPTIONAL_ARG),/*
20 */ |
88 UOPTION_DEF("includeUnihanColl", '\x01', UOPT_NO_ARG),/* 2
1 */ /* temporary, don't display in usage info */ | 88 UOPTION_DEF("includeUnihanColl", '\x01', UOPT_NO_ARG),/* 2
1 */ /* temporary, don't display in usage info */ |
89 }; | 89 }; |
90 | 90 |
91 static UBool write_java = FALSE; | 91 static UBool write_java = FALSE; |
92 static UBool write_xliff = FALSE; | 92 static UBool write_xliff = FALSE; |
93 static const char* outputEnc =""; | 93 static const char* outputEnc =""; |
94 static struct SRBRoot *newPoolBundle = NULL; | 94 static struct SRBRoot *newPoolBundle = NULL; |
95 UBool gIncludeUnihanColl = FALSE; | |
96 | 95 |
97 /* TODO: separate header file for ResFile? */ | 96 /* TODO: separate header file for ResFile? */ |
98 typedef struct ResFile { | 97 typedef struct ResFile { |
99 uint8_t *fBytes; | 98 uint8_t *fBytes; |
100 const int32_t *fIndexes; | 99 const int32_t *fIndexes; |
101 const char *fKeys; | 100 const char *fKeys; |
102 int32_t fKeysLength; | 101 int32_t fKeysLength; |
103 int32_t fKeysCount; | 102 int32_t fKeysCount; |
104 int32_t fChecksum; | 103 int32_t fChecksum; |
105 } ResFile; | 104 } ResFile; |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 outputEnc = options[WRITE_JAVA].value; | 272 outputEnc = options[WRITE_JAVA].value; |
274 } | 273 } |
275 | 274 |
276 if(options[WRITE_XLIFF].doesOccur) { | 275 if(options[WRITE_XLIFF].doesOccur) { |
277 write_xliff = TRUE; | 276 write_xliff = TRUE; |
278 if(options[WRITE_XLIFF].value != NULL){ | 277 if(options[WRITE_XLIFF].value != NULL){ |
279 xliffOutputFileName = options[WRITE_XLIFF].value; | 278 xliffOutputFileName = options[WRITE_XLIFF].value; |
280 } | 279 } |
281 } | 280 } |
282 | 281 |
283 initParser(options[NO_COLLATION_RULES].doesOccur); | 282 initParser(); |
284 | 283 |
285 /*added by Jing*/ | 284 /*added by Jing*/ |
286 if(options[LANGUAGE].doesOccur) { | 285 if(options[LANGUAGE].doesOccur) { |
287 language = options[LANGUAGE].value; | 286 language = options[LANGUAGE].value; |
288 } | 287 } |
289 | 288 |
290 if(options[WRITE_POOL_BUNDLE].doesOccur) { | 289 if(options[WRITE_POOL_BUNDLE].doesOccur) { |
291 newPoolBundle = bundle_open(NULL, TRUE, &status); | 290 newPoolBundle = bundle_open(NULL, TRUE, &status); |
292 if(U_FAILURE(status)) { | 291 if(U_FAILURE(status)) { |
293 fprintf(stderr, "unable to create an empty bundle for the pool keys:
%s\n", u_errorName(status)); | 292 fprintf(stderr, "unable to create an empty bundle for the pool keys:
%s\n", u_errorName(status)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 for (i = 0; i < poolBundle.fKeysLength; ++i) { | 389 for (i = 0; i < poolBundle.fKeysLength; ++i) { |
391 if (poolBundle.fKeys[i] == 0) { | 390 if (poolBundle.fKeys[i] == 0) { |
392 ++poolBundle.fKeysCount; | 391 ++poolBundle.fKeysCount; |
393 } | 392 } |
394 } | 393 } |
395 T_FileStream_close(poolFile); | 394 T_FileStream_close(poolFile); |
396 setUsePoolBundle(TRUE); | 395 setUsePoolBundle(TRUE); |
397 } | 396 } |
398 | 397 |
399 if(options[INCLUDE_UNIHAN_COLL].doesOccur) { | 398 if(options[INCLUDE_UNIHAN_COLL].doesOccur) { |
400 gIncludeUnihanColl = TRUE; | 399 puts("genrb option --includeUnihanColl ignored: \n" |
| 400 "CLDR 26/ICU 54 unihan data is small, except\n" |
| 401 "the ucadata-unihan.icu version of the collation root data\n" |
| 402 "is about 300kB larger than the ucadata-implicithan.icu version.
"); |
401 } | 403 } |
402 | 404 |
403 if((argc-1)!=1) { | 405 if((argc-1)!=1) { |
404 printf("genrb number of files: %d\n", argc - 1); | 406 printf("genrb number of files: %d\n", argc - 1); |
405 } | 407 } |
406 /* generate the binary files */ | 408 /* generate the binary files */ |
407 for(i = 1; i < argc; ++i) { | 409 for(i = 1; i < argc; ++i) { |
408 status = U_ZERO_ERROR; | 410 status = U_ZERO_ERROR; |
409 arg = getLongPathname(argv[i]); | 411 arg = getLongPathname(argv[i]); |
410 | 412 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 } | 552 } |
551 if (ucbuf == NULL || U_FAILURE(*status)) { | 553 if (ucbuf == NULL || U_FAILURE(*status)) { |
552 fprintf(stderr, "An error occured processing file %s. Error: %s\n", open
FileName == NULL ? filename : openFileName,u_errorName(*status)); | 554 fprintf(stderr, "An error occured processing file %s. Error: %s\n", open
FileName == NULL ? filename : openFileName,u_errorName(*status)); |
553 goto finish; | 555 goto finish; |
554 } | 556 } |
555 /* auto detected popular encodings? */ | 557 /* auto detected popular encodings? */ |
556 if (cp!=NULL && isVerbose()) { | 558 if (cp!=NULL && isVerbose()) { |
557 printf("autodetected encoding %s\n", cp); | 559 printf("autodetected encoding %s\n", cp); |
558 } | 560 } |
559 /* Parse the data into an SRBRoot */ | 561 /* Parse the data into an SRBRoot */ |
560 data = parse(ucbuf, inputDir, outputDir, !omitBinaryCollation, status); | 562 data = parse(ucbuf, inputDir, outputDir, filename, |
| 563 !omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, st
atus); |
561 | 564 |
562 if (data == NULL || U_FAILURE(*status)) { | 565 if (data == NULL || U_FAILURE(*status)) { |
563 fprintf(stderr, "couldn't parse the file %s. Error:%s\n", filename,u_err
orName(*status)); | 566 fprintf(stderr, "couldn't parse the file %s. Error:%s\n", filename,u_err
orName(*status)); |
564 goto finish; | 567 goto finish; |
565 } | 568 } |
566 if(options[WRITE_POOL_BUNDLE].doesOccur) { | 569 if(options[WRITE_POOL_BUNDLE].doesOccur) { |
567 int32_t newKeysLength; | 570 int32_t newKeysLength; |
568 const char *newKeys, *newKeysLimit; | 571 const char *newKeys, *newKeysLimit; |
569 bundle_compactKeys(data, status); | 572 bundle_compactKeys(data, status); |
570 newKeys = bundle_getKeyBytes(data, &newKeysLength); | 573 newKeys = bundle_getKeyBytes(data, &newKeysLength); |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
723 uprv_free(dirname); | 726 uprv_free(dirname); |
724 | 727 |
725 return resName; | 728 return resName; |
726 } | 729 } |
727 | 730 |
728 /* | 731 /* |
729 * Local Variables: | 732 * Local Variables: |
730 * indent-tabs-mode: nil | 733 * indent-tabs-mode: nil |
731 * End: | 734 * End: |
732 */ | 735 */ |
OLD | NEW |