From: Manish Goregaokar Date: Fri, 24 Feb 2023 19:48:47 +0000 (-0800) Subject: ICU-22270 Use hex for mask properties X-Git-Tag: cldr/2023-03-13~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3c94cc062ef83e05b6b1dc1dd699c543efff39a;p=icu ICU-22270 Use hex for mask properties --- diff --git a/icu4c/source/tools/icuexportdata/icuexportdata.cpp b/icu4c/source/tools/icuexportdata/icuexportdata.cpp index 5b4d0ad2f65..9d391f617be 100644 --- a/icu4c/source/tools/icuexportdata/icuexportdata.cpp +++ b/icu4c/source/tools/icuexportdata/icuexportdata.cpp @@ -170,13 +170,18 @@ void dumpBinaryProperty(UProperty uproperty, FILE* f) { // If the value exists, dump an indented entry of the format // `" {discr = , long = , short = , aliases = []},"` -void dumpValueEntry(UProperty uproperty, int v, FILE* f) { +void dumpValueEntry(UProperty uproperty, int v, bool is_mask, FILE* f) { const char* fullValueName = u_getPropertyValueName(uproperty, v, U_LONG_PROPERTY_NAME); const char* shortValueName = u_getPropertyValueName(uproperty, v, U_SHORT_PROPERTY_NAME); if (!fullValueName) { return; } - fprintf(f, " {discr = %i, long = \"%s\"", v, fullValueName); + if (is_mask) { + fprintf(f, " {discr = 0x%X", v); + } else { + fprintf(f, " {discr = %i", v); + } + fprintf(f, ", long = \"%s\"", fullValueName); if (shortValueName) { fprintf(f, ", short = \"%s\"", shortValueName); } @@ -220,7 +225,7 @@ void dumpEnumeratedProperty(UProperty uproperty, FILE* f) { fprintf(f, "values = [\n"); for (int v = minValue; v <= maxValue; v++) { - dumpValueEntry(uproperty, v, f); + dumpValueEntry(uproperty, v, false, f); } fprintf(f, "]\n"); @@ -251,7 +256,7 @@ void dumpEnumeratedProperty(UProperty uproperty, FILE* f) { // after the property in the listing void maybeDumpMaskValue(UProperty uproperty, uint32_t v, uint32_t mask, FILE* f) { if (U_MASK(v) < mask && U_MASK(v + 1) > mask) - dumpValueEntry(uproperty, mask, f); + dumpValueEntry(uproperty, mask, true, f); } void dumpGeneralCategoryMask(FILE* f) { @@ -274,7 +279,7 @@ void dumpGeneralCategoryMask(FILE* f) { fprintf(f, "values = [\n"); for (uint32_t v = minValue; v <= maxValue; v++) { - dumpValueEntry(uproperty, U_MASK(v), f); + dumpValueEntry(uproperty, U_MASK(v), true, f); // We want to dump these masks "in order", which means they // should come immediately after every property they contain