intl/icu-patches/genrb-omitCollationRules.diff

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 diff --git a/intl/icu/source/tools/genrb/genrb.c b/intl/icu/source/tools/genrb/genrb.c
michael@0 2 --- a/intl/icu/source/tools/genrb/genrb.c
michael@0 3 +++ b/intl/icu/source/tools/genrb/genrb.c
michael@0 4 @@ -1,7 +1,7 @@
michael@0 5 /*
michael@0 6 *******************************************************************************
michael@0 7 *
michael@0 8 -* Copyright (C) 1998-2012, International Business Machines
michael@0 9 +* Copyright (C) 1998-2014, International Business Machines
michael@0 10 * Corporation and others. All Rights Reserved.
michael@0 11 *
michael@0 12 *******************************************************************************
michael@0 13 @@ -280,7 +280,7 @@
michael@0 14 }
michael@0 15 }
michael@0 16
michael@0 17 - initParser(options[NO_COLLATION_RULES].doesOccur);
michael@0 18 + initParser();
michael@0 19
michael@0 20 /*added by Jing*/
michael@0 21 if(options[LANGUAGE].doesOccur) {
michael@0 22 @@ -557,7 +557,8 @@
michael@0 23 printf("autodetected encoding %s\n", cp);
michael@0 24 }
michael@0 25 /* Parse the data into an SRBRoot */
michael@0 26 - data = parse(ucbuf, inputDir, outputDir, !omitBinaryCollation, status);
michael@0 27 + data = parse(ucbuf, inputDir, outputDir,
michael@0 28 + !omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, status);
michael@0 29
michael@0 30 if (data == NULL || U_FAILURE(*status)) {
michael@0 31 fprintf(stderr, "couldn't parse the file %s. Error:%s\n", filename,u_errorName(*status));
michael@0 32 diff --git a/intl/icu/source/tools/genrb/parse.cpp b/intl/icu/source/tools/genrb/parse.cpp
michael@0 33 --- a/intl/icu/source/tools/genrb/parse.cpp
michael@0 34 +++ b/intl/icu/source/tools/genrb/parse.cpp
michael@0 35 @@ -85,10 +85,9 @@
michael@0 36 const char *outputdir;
michael@0 37 uint32_t outputdirLength;
michael@0 38 UBool makeBinaryCollation;
michael@0 39 + UBool omitCollationRules;
michael@0 40 } ParseState;
michael@0 41
michael@0 42 -static UBool gOmitCollationRules = FALSE;
michael@0 43 -
michael@0 44 typedef struct SResource *
michael@0 45 ParseResourceFunction(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status);
michael@0 46
michael@0 47 @@ -323,7 +322,7 @@
michael@0 48 }
michael@0 49 uprv_strcat(filename, cs);
michael@0 50
michael@0 51 - if(gOmitCollationRules) {
michael@0 52 + if(state->omitCollationRules) {
michael@0 53 return res_none();
michael@0 54 }
michael@0 55
michael@0 56 @@ -771,7 +770,7 @@
michael@0 57 }
michael@0 58
michael@0 59 /* Parse the data into an SRBRoot */
michael@0 60 - data = parse(ucbuf, genrbdata->inputDir, genrbdata->outputDir, FALSE, status);
michael@0 61 + data = parse(ucbuf, genrbdata->inputDir, genrbdata->outputDir, FALSE, FALSE, status);
michael@0 62
michael@0 63 root = data->fRoot;
michael@0 64 collations = resLookup(root, "collations");
michael@0 65 @@ -1007,7 +1006,7 @@
michael@0 66 #endif
michael@0 67 /* in order to achieve smaller data files, we can direct genrb */
michael@0 68 /* to omit collation rules */
michael@0 69 - if(gOmitCollationRules) {
michael@0 70 + if(state->omitCollationRules) {
michael@0 71 bundle_closeString(state->bundle, member);
michael@0 72 } else {
michael@0 73 table_add(result, member, line, status);
michael@0 74 @@ -1839,7 +1838,7 @@
michael@0 75 {"reserved", NULL, NULL}
michael@0 76 };
michael@0 77
michael@0 78 -void initParser(UBool omitCollationRules)
michael@0 79 +void initParser()
michael@0 80 {
michael@0 81 U_STRING_INIT(k_type_string, "string", 6);
michael@0 82 U_STRING_INIT(k_type_binary, "binary", 6);
michael@0 83 @@ -1858,8 +1857,6 @@
michael@0 84 U_STRING_INIT(k_type_plugin_collation, "process(collation)", 18);
michael@0 85 U_STRING_INIT(k_type_plugin_transliterator, "process(transliterator)", 23);
michael@0 86 U_STRING_INIT(k_type_plugin_dependency, "process(dependency)", 19);
michael@0 87 -
michael@0 88 - gOmitCollationRules = omitCollationRules;
michael@0 89 }
michael@0 90
michael@0 91 static inline UBool isTable(enum EResourceType type) {
michael@0 92 @@ -2039,8 +2036,8 @@
michael@0 93
michael@0 94 /* parse the top-level resource */
michael@0 95 struct SRBRoot *
michael@0 96 -parse(UCHARBUF *buf, const char *inputDir, const char *outputDir, UBool makeBinaryCollation,
michael@0 97 - UErrorCode *status)
michael@0 98 +parse(UCHARBUF *buf, const char *inputDir, const char *outputDir,
michael@0 99 + UBool makeBinaryCollation, UBool omitCollationRules, UErrorCode *status)
michael@0 100 {
michael@0 101 struct UString *tokenValue;
michael@0 102 struct UString comment;
michael@0 103 @@ -2064,6 +2061,7 @@
michael@0 104 state.outputdir = outputDir;
michael@0 105 state.outputdirLength = (state.outputdir != NULL) ? (uint32_t)uprv_strlen(state.outputdir) : 0;
michael@0 106 state.makeBinaryCollation = makeBinaryCollation;
michael@0 107 + state.omitCollationRules = omitCollationRules;
michael@0 108
michael@0 109 ustr_init(&comment);
michael@0 110 expect(&state, TOK_STRING, &tokenValue, &comment, NULL, status);
michael@0 111 diff --git a/intl/icu/source/tools/genrb/parse.h b/intl/icu/source/tools/genrb/parse.h
michael@0 112 --- a/intl/icu/source/tools/genrb/parse.h
michael@0 113 +++ b/intl/icu/source/tools/genrb/parse.h
michael@0 114 @@ -1,7 +1,7 @@
michael@0 115 /*
michael@0 116 *******************************************************************************
michael@0 117 *
michael@0 118 -* Copyright (C) 1998-2011, International Business Machines
michael@0 119 +* Copyright (C) 1998-2014, International Business Machines
michael@0 120 * Corporation and others. All Rights Reserved.
michael@0 121 *
michael@0 122 *******************************************************************************
michael@0 123 @@ -24,11 +24,11 @@
michael@0 124
michael@0 125 U_CDECL_BEGIN
michael@0 126 /* One time parser initalisation */
michael@0 127 -void initParser(UBool omitCollationRules);
michael@0 128 +void initParser();
michael@0 129
michael@0 130 /* Parse a ResourceBundle text file */
michael@0 131 struct SRBRoot* parse(UCHARBUF *buf, const char* inputDir, const char* outputDir,
michael@0 132 - UBool omitBinaryCollation, UErrorCode *status);
michael@0 133 + UBool makeBinaryCollation, UBool omitCollationRules, UErrorCode *status);
michael@0 134
michael@0 135 U_CDECL_END
michael@0 136

mercurial