From acfe30c3c5ce3eb9df1e3d371af77791bfe607ca Mon Sep 17 00:00:00 2001 From: Markus Scherer Date: Wed, 3 Oct 2007 22:39:28 +0000 Subject: [PATCH] ICU-5968 apply --omitCollationRules to UCARules as well X-SVN-Rev: 22743 --- icu4c/source/tools/genrb/parse.c | 3 +++ icu4c/source/tools/genrb/reslist.c | 17 ++++++++++++++++- icu4c/source/tools/genrb/reslist.h | 9 ++++++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/icu4c/source/tools/genrb/parse.c b/icu4c/source/tools/genrb/parse.c index edf10ac4c6..8ffabee6f3 100644 --- a/icu4c/source/tools/genrb/parse.c +++ b/icu4c/source/tools/genrb/parse.c @@ -309,6 +309,9 @@ parseUCARules(char *tag, uint32_t startline, const struct UString* comment, UErr } uprv_strcat(filename, cs); + if(gOmitCollationRules) { + return res_none(); + } ucbuf = ucbuf_open(filename, &cp, getShowWarning(),FALSE, status); diff --git a/icu4c/source/tools/genrb/reslist.c b/icu4c/source/tools/genrb/reslist.c index 9f30ca9c10..c99e68bf39 100644 --- a/icu4c/source/tools/genrb/reslist.c +++ b/icu4c/source/tools/genrb/reslist.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2000-2006, International Business Machines +* Copyright (C) 2000-2007, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -27,6 +27,13 @@ static UBool gIncludeCopyright = FALSE; +/* + * res_none() returns the address of kNoResource, + * for use in non-error cases when no resource is to be added to the bundle. + * (NULL is used in error cases.) + */ +static struct SResource kNoResource = { RES_NONE }; + uint32_t res_write(UNewDataMemory *mem, struct SResource *res, uint32_t usedOffset, UErrorCode *status); @@ -460,6 +467,11 @@ struct SResource* res_open(const struct UString* comment, UErrorCode* status){ return res; } + +struct SResource* res_none() { + return &kNoResource; +} + struct SResource* table_open(struct SRBRoot *bundle, char *tag, const struct UString* comment, UErrorCode *status) { struct SResource *res = res_open(comment, status); @@ -872,6 +884,9 @@ void table_add(struct SResource *table, struct SResource *res, int linenumber, U if (U_FAILURE(*status)) { return; } + if (res == &kNoResource) { + return; + } /* remember this linenumber to report to the user if there is a duplicate key */ res->line = linenumber; diff --git a/icu4c/source/tools/genrb/reslist.h b/icu4c/source/tools/genrb/reslist.h index 2d6a3783df..55be5d91cc 100644 --- a/icu4c/source/tools/genrb/reslist.h +++ b/icu4c/source/tools/genrb/reslist.h @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 2000-2006, International Business Machines +* Copyright (C) 2000-2007, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -67,6 +67,13 @@ int32_t bundle_addtag(struct SRBRoot *bundle, const char *tag, UErrorCode *statu /* Various resource types */ struct SResource* res_open(const struct UString* comment, UErrorCode* status); +/* + * Return a unique pointer to a dummy object, + * for use in non-error cases when no resource is to be added to the bundle. + * (NULL is used in error cases.) + */ +struct SResource* res_none(void); + struct SResTable { uint32_t fCount; uint32_t fChildrenSize;