intl/icu-patches/genrb-omitCollationRules.diff

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/intl/icu-patches/genrb-omitCollationRules.diff	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,136 @@
     1.4 +diff --git a/intl/icu/source/tools/genrb/genrb.c b/intl/icu/source/tools/genrb/genrb.c
     1.5 +--- a/intl/icu/source/tools/genrb/genrb.c
     1.6 ++++ b/intl/icu/source/tools/genrb/genrb.c
     1.7 +@@ -1,7 +1,7 @@
     1.8 + /*
     1.9 + *******************************************************************************
    1.10 + *
    1.11 +-*   Copyright (C) 1998-2012, International Business Machines
    1.12 ++*   Copyright (C) 1998-2014, International Business Machines
    1.13 + *   Corporation and others.  All Rights Reserved.
    1.14 + *
    1.15 + *******************************************************************************
    1.16 +@@ -280,7 +280,7 @@
    1.17 +         }
    1.18 +     }
    1.19 + 
    1.20 +-    initParser(options[NO_COLLATION_RULES].doesOccur);
    1.21 ++    initParser();
    1.22 + 
    1.23 +     /*added by Jing*/
    1.24 +     if(options[LANGUAGE].doesOccur) {
    1.25 +@@ -557,7 +557,8 @@
    1.26 +         printf("autodetected encoding %s\n", cp);
    1.27 +     }
    1.28 +     /* Parse the data into an SRBRoot */
    1.29 +-    data = parse(ucbuf, inputDir, outputDir, !omitBinaryCollation, status);
    1.30 ++    data = parse(ucbuf, inputDir, outputDir,
    1.31 ++                 !omitBinaryCollation, options[NO_COLLATION_RULES].doesOccur, status);
    1.32 + 
    1.33 +     if (data == NULL || U_FAILURE(*status)) {
    1.34 +         fprintf(stderr, "couldn't parse the file %s. Error:%s\n", filename,u_errorName(*status));
    1.35 +diff --git a/intl/icu/source/tools/genrb/parse.cpp b/intl/icu/source/tools/genrb/parse.cpp
    1.36 +--- a/intl/icu/source/tools/genrb/parse.cpp
    1.37 ++++ b/intl/icu/source/tools/genrb/parse.cpp
    1.38 +@@ -85,10 +85,9 @@
    1.39 +     const char     *outputdir;
    1.40 +     uint32_t        outputdirLength;
    1.41 +     UBool           makeBinaryCollation;
    1.42 ++    UBool           omitCollationRules;
    1.43 + } ParseState;
    1.44 + 
    1.45 +-static UBool gOmitCollationRules  = FALSE;
    1.46 +-
    1.47 + typedef struct SResource *
    1.48 + ParseResourceFunction(ParseState* state, char *tag, uint32_t startline, const struct UString* comment, UErrorCode *status);
    1.49 + 
    1.50 +@@ -323,7 +322,7 @@
    1.51 +     }
    1.52 +     uprv_strcat(filename, cs);
    1.53 + 
    1.54 +-    if(gOmitCollationRules) {
    1.55 ++    if(state->omitCollationRules) {
    1.56 +         return res_none();
    1.57 +     }
    1.58 + 
    1.59 +@@ -771,7 +770,7 @@
    1.60 +     }
    1.61 + 
    1.62 +     /* Parse the data into an SRBRoot */
    1.63 +-    data = parse(ucbuf, genrbdata->inputDir, genrbdata->outputDir, FALSE, status);
    1.64 ++    data = parse(ucbuf, genrbdata->inputDir, genrbdata->outputDir, FALSE, FALSE, status);
    1.65 + 
    1.66 +     root = data->fRoot;
    1.67 +     collations = resLookup(root, "collations");
    1.68 +@@ -1007,7 +1006,7 @@
    1.69 + #endif
    1.70 +             /* in order to achieve smaller data files, we can direct genrb */
    1.71 +             /* to omit collation rules */
    1.72 +-            if(gOmitCollationRules) {
    1.73 ++            if(state->omitCollationRules) {
    1.74 +                 bundle_closeString(state->bundle, member);
    1.75 +             } else {
    1.76 +                 table_add(result, member, line, status);
    1.77 +@@ -1839,7 +1838,7 @@
    1.78 +     {"reserved", NULL, NULL}
    1.79 + };
    1.80 + 
    1.81 +-void initParser(UBool omitCollationRules)
    1.82 ++void initParser()
    1.83 + {
    1.84 +     U_STRING_INIT(k_type_string,    "string",    6);
    1.85 +     U_STRING_INIT(k_type_binary,    "binary",    6);
    1.86 +@@ -1858,8 +1857,6 @@
    1.87 +     U_STRING_INIT(k_type_plugin_collation,      "process(collation)",        18);
    1.88 +     U_STRING_INIT(k_type_plugin_transliterator, "process(transliterator)",   23);
    1.89 +     U_STRING_INIT(k_type_plugin_dependency,     "process(dependency)",       19);
    1.90 +-
    1.91 +-    gOmitCollationRules = omitCollationRules;
    1.92 + }
    1.93 + 
    1.94 + static inline UBool isTable(enum EResourceType type) {
    1.95 +@@ -2039,8 +2036,8 @@
    1.96 + 
    1.97 + /* parse the top-level resource */
    1.98 + struct SRBRoot *
    1.99 +-parse(UCHARBUF *buf, const char *inputDir, const char *outputDir, UBool makeBinaryCollation,
   1.100 +-      UErrorCode *status)
   1.101 ++parse(UCHARBUF *buf, const char *inputDir, const char *outputDir,
   1.102 ++      UBool makeBinaryCollation, UBool omitCollationRules, UErrorCode *status)
   1.103 + {
   1.104 +     struct UString    *tokenValue;
   1.105 +     struct UString    comment;
   1.106 +@@ -2064,6 +2061,7 @@
   1.107 +     state.outputdir       = outputDir;
   1.108 +     state.outputdirLength = (state.outputdir != NULL) ? (uint32_t)uprv_strlen(state.outputdir) : 0;
   1.109 +     state.makeBinaryCollation = makeBinaryCollation;
   1.110 ++    state.omitCollationRules = omitCollationRules;
   1.111 + 
   1.112 +     ustr_init(&comment);
   1.113 +     expect(&state, TOK_STRING, &tokenValue, &comment, NULL, status);
   1.114 +diff --git a/intl/icu/source/tools/genrb/parse.h b/intl/icu/source/tools/genrb/parse.h
   1.115 +--- a/intl/icu/source/tools/genrb/parse.h
   1.116 ++++ b/intl/icu/source/tools/genrb/parse.h
   1.117 +@@ -1,7 +1,7 @@
   1.118 + /*
   1.119 + *******************************************************************************
   1.120 + *
   1.121 +-*   Copyright (C) 1998-2011, International Business Machines
   1.122 ++*   Copyright (C) 1998-2014, International Business Machines
   1.123 + *   Corporation and others.  All Rights Reserved.
   1.124 + *
   1.125 + *******************************************************************************
   1.126 +@@ -24,11 +24,11 @@
   1.127 + 
   1.128 + U_CDECL_BEGIN
   1.129 + /* One time parser initalisation */
   1.130 +-void initParser(UBool omitCollationRules);
   1.131 ++void initParser();
   1.132 + 
   1.133 + /* Parse a ResourceBundle text file */
   1.134 + struct SRBRoot* parse(UCHARBUF *buf, const char* inputDir, const char* outputDir,
   1.135 +-                      UBool omitBinaryCollation, UErrorCode *status);
   1.136 ++                      UBool makeBinaryCollation, UBool omitCollationRules, UErrorCode *status);
   1.137 + 
   1.138 + U_CDECL_END
   1.139 + 

mercurial