From 2145eb11bed9568f12cb9ef216d9dd2d2fde3a68 Mon Sep 17 00:00:00 2001 From: "Steven R. Loomis" Date: Thu, 25 Sep 2008 20:24:14 +0000 Subject: [PATCH] ICU-6551 reduce use of common words in rename. X-SVN-Rev: 24652 --- icu4c/source/common/unicode/urename.h | 8 +- icu4c/source/i18n/astro.cpp | 6 +- icu4c/source/i18n/calendar.cpp | 4 +- icu4c/source/i18n/cecal.cpp | 4 +- icu4c/source/i18n/chnsecal.cpp | 6 +- icu4c/source/i18n/gregocal.cpp | 18 ++-- icu4c/source/i18n/gregoimp.cpp | 24 ++--- icu4c/source/i18n/gregoimp.h | 13 +-- icu4c/source/i18n/indiancal.cpp | 4 +- icu4c/source/i18n/islamcal.cpp | 8 +- icu4c/source/i18n/olsontz.cpp | 6 +- icu4c/source/i18n/translit.cpp | 4 +- icu4c/source/i18n/transreg.cpp | 150 +++++++++++++------------- icu4c/source/i18n/transreg.h | 28 ++--- icu4c/source/i18n/tridpars.cpp | 2 +- icu4c/source/i18n/ucln_in.h | 2 +- 16 files changed, 144 insertions(+), 143 deletions(-) diff --git a/icu4c/source/common/unicode/urename.h b/icu4c/source/common/unicode/urename.h index 1e23f4dc7ab..fa82a525b79 100644 --- a/icu4c/source/common/unicode/urename.h +++ b/icu4c/source/common/unicode/urename.h @@ -160,7 +160,6 @@ #define res_getTableItemByKey res_getTableItemByKey_4_1 #define res_load res_load_4_1 #define res_unload res_unload_4_1 -#define transliterator_cleanup transliterator_cleanup_4_1 #define triedict_swap triedict_swap_4_1 #define u_UCharsToChars u_UCharsToChars_4_1 #define u_austrcpy u_austrcpy_4_1 @@ -1346,6 +1345,7 @@ #define utrans_transIncremental utrans_transIncremental_4_1 #define utrans_transIncrementalUChars utrans_transIncrementalUChars_4_1 #define utrans_transUChars utrans_transUChars_4_1 +#define utrans_transliterator_cleanup utrans_transliterator_cleanup_4_1 #define utrans_unregister utrans_unregister_4_1 #define utrans_unregisterID utrans_unregisterID_4_1 #define utrie_clone utrie_clone_4_1 @@ -1460,6 +1460,7 @@ #define ClassDefFormat1Table ClassDefFormat1Table_4_1 #define ClassDefFormat2Table ClassDefFormat2Table_4_1 #define ClassDefinitionTable ClassDefinitionTable_4_1 +#define ClockMath ClockMath_4_1 #define CollationElementIterator CollationElementIterator_4_1 #define CollationKey CollationKey_4_1 #define CollationLocaleListEnumeration CollationLocaleListEnumeration_4_1 @@ -1500,7 +1501,6 @@ #define DictionaryBreakEngine DictionaryBreakEngine_4_1 #define DigitList DigitList_4_1 #define DistanceInfo DistanceInfo_4_1 -#define Entry Entry_4_1 #define EnumToOffset EnumToOffset_4_1 #define EscapeTransliterator EscapeTransliterator_4_1 #define EthiopicCalendar EthiopicCalendar_4_1 @@ -1594,7 +1594,6 @@ #define MarkToBasePositioningSubtable MarkToBasePositioningSubtable_4_1 #define MarkToLigaturePositioningSubtable MarkToLigaturePositioningSubtable_4_1 #define MarkToMarkPositioningSubtable MarkToMarkPositioningSubtable_4_1 -#define Math Math_4_1 #define Measure Measure_4_1 #define MeasureFormat MeasureFormat_4_1 #define MeasureUnit MeasureUnit_4_1 @@ -1701,7 +1700,6 @@ #define SingleSubstitutionFormat2Subtable SingleSubstitutionFormat2Subtable_4_1 #define SingleSubstitutionSubtable SingleSubstitutionSubtable_4_1 #define SingleTableProcessor SingleTableProcessor_4_1 -#define Spec Spec_4_1 #define StateTableProcessor StateTableProcessor_4_1 #define StringCharacterIterator StringCharacterIterator_4_1 #define StringEnumeration StringEnumeration_4_1 @@ -1739,9 +1737,11 @@ #define TransliterationRuleSet TransliterationRuleSet_4_1 #define Transliterator Transliterator_4_1 #define TransliteratorAlias TransliteratorAlias_4_1 +#define TransliteratorEntry TransliteratorEntry_4_1 #define TransliteratorIDParser TransliteratorIDParser_4_1 #define TransliteratorParser TransliteratorParser_4_1 #define TransliteratorRegistry TransliteratorRegistry_4_1 +#define TransliteratorSpec TransliteratorSpec_4_1 #define TrieWordDictionary TrieWordDictionary_4_1 #define TrimmedArrayProcessor TrimmedArrayProcessor_4_1 #define UCharCharacterIterator UCharCharacterIterator_4_1 diff --git a/icu4c/source/i18n/astro.cpp b/icu4c/source/i18n/astro.cpp index 46bfec8acfe..cc06597e6b5 100644 --- a/icu4c/source/i18n/astro.cpp +++ b/icu4c/source/i18n/astro.cpp @@ -207,7 +207,7 @@ const double CalendarAstronomer::PI = 3.14159265358979323846; * The modulus operator. */ inline static double normalize(double value, double range) { - return value - range * Math::floorDivide(value, range); + return value - range * ClockMath::floorDivide(value, range); } /** @@ -417,7 +417,7 @@ double CalendarAstronomer::lstToUT(double lst) { double lt = normalize((lst - getSiderealOffset()) * 0.9972695663, 24); // Then find local midnight on this day - double base = (DAY_MS * Math::floorDivide(fTime + fGmtOffset,(double)DAY_MS)) - fGmtOffset; + double base = (DAY_MS * ClockMath::floorDivide(fTime + fGmtOffset,(double)DAY_MS)) - fGmtOffset; //out(" lt =" + lt + " hours"); //out(" base=" + new Date(base)); @@ -742,7 +742,7 @@ UDate CalendarAstronomer::getSunRiseSet(UBool rise) UDate t0 = fTime; // Make a rough guess: 6am or 6pm local time on the current day - double noon = Math::floorDivide(fTime + fGmtOffset, (double)DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS); + double noon = ClockMath::floorDivide(fTime + fGmtOffset, (double)DAY_MS)*DAY_MS - fGmtOffset + (12*HOUR_MS); U_DEBUG_ASTRO_MSG(("Noon=%.2lf, %sL, gmtoff %.2lf\n", noon, debug_astro_date(noon+fGmtOffset), fGmtOffset)); setTime(noon + ((rise ? -6 : 6) * HOUR_MS)); diff --git a/icu4c/source/i18n/calendar.cpp b/icu4c/source/i18n/calendar.cpp index bfd843d8be1..f46db605239 100644 --- a/icu4c/source/i18n/calendar.cpp +++ b/icu4c/source/i18n/calendar.cpp @@ -1156,7 +1156,7 @@ void Calendar::computeFields(UErrorCode &ec) // JULIAN_DAY field and also removes some inelegant code. - Liu // 11/6/00 - int32_t days = (int32_t)Math::floorDivide(localMillis, (double)kOneDay); + int32_t days = (int32_t)ClockMath::floorDivide(localMillis, (double)kOneDay); internalSet(UCAL_JULIAN_DAY,days + kEpochStartAsJulianDay); @@ -2349,7 +2349,7 @@ void Calendar::computeTime(UErrorCode& status) { double millis = Grego::julianDayToMillis(julianDay); #if defined (U_DEBUG_CAL) - // int32_t julianInsanityCheck = (int32_t)Math::floorDivide(millis, kOneDay); + // int32_t julianInsanityCheck = (int32_t)ClockMath::floorDivide(millis, kOneDay); // julianInsanityCheck += kEpochStartAsJulianDay; // if(1 || julianInsanityCheck != julianDay) { // fprintf(stderr, "%s:%d- D'oh- computed jules %d, to mills (%s)%.lf, recomputed %d\n", diff --git a/icu4c/source/i18n/cecal.cpp b/icu4c/source/i18n/cecal.cpp index 84fe09dbeba..90468a7f9af 100644 --- a/icu4c/source/i18n/cecal.cpp +++ b/icu4c/source/i18n/cecal.cpp @@ -112,7 +112,7 @@ CECalendar::ceToJD(int32_t year, int32_t month, int32_t date, int32_t jdEpochOff return (int32_t) ( (jdEpochOffset+365) // difference from Julian epoch to 1,1,1 + 365 * (year - 1) // number of days from years - + Math::floorDivide(year, 4) // extra day of leap year + + ClockMath::floorDivide(year, 4) // extra day of leap year + 30 * (month + 1) // number of days from months + date // number of days for present month - 31 // slack? @@ -125,7 +125,7 @@ CECalendar::jdToCE(int32_t julianDay, int32_t jdEpochOffset, int32_t& year, int3 int32_t c4; // number of 4 year cycle (1461 days) int32_t r4; // remainder of 4 year cycle, always positive - c4 = Math::floorDivide(julianDay - jdEpochOffset, 1461, r4); + c4 = ClockMath::floorDivide(julianDay - jdEpochOffset, 1461, r4); year = 4 * c4 + (r4/365 - r4/1460); // 4 * + diff --git a/icu4c/source/i18n/chnsecal.cpp b/icu4c/source/i18n/chnsecal.cpp index 337903189fe..0f22812bde4 100644 --- a/icu4c/source/i18n/chnsecal.cpp +++ b/icu4c/source/i18n/chnsecal.cpp @@ -291,7 +291,7 @@ int32_t ChineseCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, U // modify the extended year value accordingly. if (month < 0 || month > 11) { double m = month; - eyear += (int32_t)Math::floorDivide(m, 12.0, m); + eyear += (int32_t)ClockMath::floorDivide(m, 12.0, m); month = (int32_t)m; } @@ -446,7 +446,7 @@ double ChineseCalendar::daysToMillis(double days) { * @return days after January 1, 1970 0:00 Asia/Shanghai */ double ChineseCalendar::millisToDays(double millis) { - return Math::floorDivide(millis + CHINA_OFFSET, kOneDay); + return ClockMath::floorDivide(millis + CHINA_OFFSET, kOneDay); } //------------------------------------------------------------------ @@ -662,7 +662,7 @@ void ChineseCalendar::computeChineseFields(int32_t days, int32_t gyear, int32_t // 0->0,60 1->1,1 60->1,60 61->2,1 etc. int32_t yearOfCycle; - int32_t cycle = Math::floorDivide(year - 1, 60, yearOfCycle); + int32_t cycle = ClockMath::floorDivide(year - 1, 60, yearOfCycle); internalSet(UCAL_ERA, cycle + 1); internalSet(UCAL_YEAR, yearOfCycle + 1); diff --git a/icu4c/source/i18n/gregocal.cpp b/icu4c/source/i18n/gregocal.cpp index 842ff769eda..9c64950cb14 100644 --- a/icu4c/source/i18n/gregocal.cpp +++ b/icu4c/source/i18n/gregocal.cpp @@ -330,7 +330,7 @@ GregorianCalendar::setGregorianChange(UDate date, UErrorCode& status) // normalized cutover is in pure date milliseconds; it contains no time // of day or timezone component, and it used to compare against other // pure date values. - int32_t cutoverDay = (int32_t)Math::floorDivide(fGregorianCutover, (double)kOneDay); + int32_t cutoverDay = (int32_t)ClockMath::floorDivide(fGregorianCutover, (double)kOneDay); fNormalizedGregorianCutover = cutoverDay * kOneDay; // Handle the rare case of numeric overflow. If the user specifies a @@ -386,10 +386,10 @@ void GregorianCalendar::handleComputeFields(int32_t julianDay, UErrorCode& statu // The Julian epoch day (not the same as Julian Day) // is zero on Saturday December 30, 0 (Gregorian). int32_t julianEpochDay = julianDay - (kJan1_1JulianDay - 2); - eyear = (int32_t) Math::floorDivide(4*julianEpochDay + 1464, 1461); + eyear = (int32_t) ClockMath::floorDivide(4*julianEpochDay + 1464, 1461); // Compute the Julian calendar day number for January 1, eyear - int32_t january1 = 365*(eyear-1) + Math::floorDivide(eyear-1, (int32_t)4); + int32_t january1 = 365*(eyear-1) + ClockMath::floorDivide(eyear-1, (int32_t)4); dayOfYear = (julianEpochDay - january1); // 0-based // Julian leap years occurred historically every 4 years starting @@ -535,12 +535,12 @@ int32_t GregorianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, // If the month is out of range, adjust it into range, and // modify the extended year value accordingly. if (month < 0 || month > 11) { - eyear += Math::floorDivide(month, 12, month); + eyear += ClockMath::floorDivide(month, 12, month); } UBool isLeap = eyear%4 == 0; int32_t y = eyear-1; - int32_t julianDay = 365*y + Math::floorDivide(y, 4) + (kJan1_1JulianDay - 3); + int32_t julianDay = 365*y + ClockMath::floorDivide(y, 4) + (kJan1_1JulianDay - 3); nonConstThis->fIsGregorian = (eyear >= fGregorianCutoverYear); #if defined (U_DEBUG_CAL) @@ -578,7 +578,7 @@ int32_t GregorianCalendar::handleGetMonthLength(int32_t extendedYear, int32_t mo // If the month is out of range, adjust it into range, and // modify the extended year value accordingly. if (month < 0 || month > 11) { - extendedYear += Math::floorDivide(month, 12, month); + extendedYear += ClockMath::floorDivide(month, 12, month); } return isLeapYear(extendedYear) ? kLeapMonthLength[month] : kMonthLength[month]; @@ -697,7 +697,7 @@ GregorianCalendar::getEpochDay(UErrorCode& status) // dealing with UDate(Long.MIN_VALUE) and UDate(Long.MAX_VALUE). double wallSec = internalGetTime()/1000 + (internalGet(UCAL_ZONE_OFFSET) + internalGet(UCAL_DST_OFFSET))/1000; - return Math::floorDivide(wallSec, kOneDay/1000.0); + return ClockMath::floorDivide(wallSec, kOneDay/1000.0); } // ------------------------------------- @@ -716,7 +716,7 @@ double GregorianCalendar::computeJulianDayOfYear(UBool isGregorian, { isLeap = year%4 == 0; int32_t y = year - 1; - double julianDay = 365.0*y + Math::floorDivide(y, 4) + (kJan1_1JulianDay - 3); + double julianDay = 365.0*y + ClockMath::floorDivide(y, 4) + (kJan1_1JulianDay - 3); if (isGregorian) { isLeap = isLeap && ((year%100 != 0) || (year%400 == 0)); @@ -785,7 +785,7 @@ double GregorianCalendar::computeJulianDayOfYear(UBool isGregorian, double GregorianCalendar::millisToJulianDay(UDate millis) { - return (double)kEpochStartAsJulianDay + Math::floorDivide(millis, (double)kOneDay); + return (double)kEpochStartAsJulianDay + ClockMath::floorDivide(millis, (double)kOneDay); } // ------------------------------------- diff --git a/icu4c/source/i18n/gregoimp.cpp b/icu4c/source/i18n/gregoimp.cpp index 22c22ca0139..08a3fbcef4c 100644 --- a/icu4c/source/i18n/gregoimp.cpp +++ b/icu4c/source/i18n/gregoimp.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (c) 2003-2007, International Business Machines + * Copyright (c) 2003-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -24,12 +24,12 @@ U_NAMESPACE_BEGIN -int32_t Math::floorDivide(int32_t numerator, int32_t denominator) { +int32_t ClockMath::floorDivide(int32_t numerator, int32_t denominator) { return (numerator >= 0) ? numerator / denominator : ((numerator + 1) / denominator) - 1; } -int32_t Math::floorDivide(double numerator, int32_t denominator, +int32_t ClockMath::floorDivide(double numerator, int32_t denominator, int32_t& remainder) { double quotient; quotient = uprv_floor(numerator / denominator); @@ -37,7 +37,7 @@ int32_t Math::floorDivide(double numerator, int32_t denominator, return (int32_t) quotient; } -double Math::floorDivide(double dividend, double divisor, +double ClockMath::floorDivide(double dividend, double divisor, double& remainder) { // Only designed to work for positive divisors U_ASSERT(divisor > 0); @@ -86,8 +86,8 @@ double Grego::fieldsToDay(int32_t year, int32_t month, int32_t dom) { int32_t y = year - 1; - double julian = 365 * y + Math::floorDivide(y, 4) + (JULIAN_1_CE - 3) + // Julian cal - Math::floorDivide(y, 400) - Math::floorDivide(y, 100) + 2 + // => Gregorian cal + double julian = 365 * y + ClockMath::floorDivide(y, 4) + (JULIAN_1_CE - 3) + // Julian cal + ClockMath::floorDivide(y, 400) - ClockMath::floorDivide(y, 100) + 2 + // => Gregorian cal DAYS_BEFORE[month + (isLeapYear(year) ? 12 : 0)] + dom; // => month/dom return julian - JULIAN_1970_CE; // JD => epoch day @@ -103,10 +103,10 @@ void Grego::dayToFields(double day, int32_t& year, int32_t& month, // representation. We use 400-year, 100-year, and 4-year cycles. // For example, the 4-year cycle has 4 years + 1 leap day; giving // 1461 == 365*4 + 1 days. - int32_t n400 = Math::floorDivide(day, 146097, doy); // 400-year cycle length - int32_t n100 = Math::floorDivide(doy, 36524, doy); // 100-year cycle length - int32_t n4 = Math::floorDivide(doy, 1461, doy); // 4-year cycle length - int32_t n1 = Math::floorDivide(doy, 365, doy); + int32_t n400 = ClockMath::floorDivide(day, 146097, doy); // 400-year cycle length + int32_t n100 = ClockMath::floorDivide(doy, 36524, doy); // 100-year cycle length + int32_t n4 = ClockMath::floorDivide(doy, 1461, doy); // 4-year cycle length + int32_t n1 = ClockMath::floorDivide(doy, 365, doy); year = 400*n400 + 100*n100 + 4*n4 + n1; if (n100 == 4 || n1 == 4) { doy = 365; // Dec 31 at end of 4- or 400-year cycle @@ -134,14 +134,14 @@ void Grego::dayToFields(double day, int32_t& year, int32_t& month, void Grego::timeToFields(UDate time, int32_t& year, int32_t& month, int32_t& dom, int32_t& dow, int32_t& doy, int32_t& mid) { double millisInDay; - double day = Math::floorDivide((double)time, (double)U_MILLIS_PER_DAY, millisInDay); + double day = ClockMath::floorDivide((double)time, (double)U_MILLIS_PER_DAY, millisInDay); mid = (int32_t)millisInDay; dayToFields(day, year, month, dom, dow, doy); } int32_t Grego::dayOfWeek(double day) { int32_t dow; - Math::floorDivide(day + UCAL_THURSDAY, 7, dow); + ClockMath::floorDivide(day + UCAL_THURSDAY, 7, dow); return (dow == 0) ? UCAL_SATURDAY : dow; } diff --git a/icu4c/source/i18n/gregoimp.h b/icu4c/source/i18n/gregoimp.h index d8ab8de48b0..f65d1410139 100644 --- a/icu4c/source/i18n/gregoimp.h +++ b/icu4c/source/i18n/gregoimp.h @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (c) 2003-2007, International Business Machines + * Copyright (c) 2003-2008, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -22,9 +22,10 @@ U_NAMESPACE_BEGIN /** * A utility class providing mathematical functions used by time zone - * and calendar code. Do not instantiate. + * and calendar code. Do not instantiate. Formerly just named 'Math'. + * @internal */ -class Math { +class ClockMath { public: /** * Divide two integers, returning the floor of the quotient. @@ -250,7 +251,7 @@ class Grego { static const int8_t MONTH_LENGTH[24]; }; -inline double Math::floorDivide(double numerator, double denominator) { +inline double ClockMath::floorDivide(double numerator, double denominator) { return uprv_floor(numerator / denominator); } @@ -281,12 +282,12 @@ inline double Grego::julianDayToMillis(int32_t julian) } inline int32_t Grego::millisToJulianDay(double millis) { - return (int32_t) (kEpochStartAsJulianDay + Math::floorDivide(millis, (double)kOneDay)); + return (int32_t) (kEpochStartAsJulianDay + ClockMath::floorDivide(millis, (double)kOneDay)); } inline int32_t Grego::gregorianShift(int32_t eyear) { int32_t y = eyear-1; - int32_t gregShift = Math::floorDivide(y, 400) - Math::floorDivide(y, 100) + 2; + int32_t gregShift = ClockMath::floorDivide(y, 400) - ClockMath::floorDivide(y, 100) + 2; return gregShift; } diff --git a/icu4c/source/i18n/indiancal.cpp b/icu4c/source/i18n/indiancal.cpp index 6563a4f16a0..d4fdc449b57 100644 --- a/icu4c/source/i18n/indiancal.cpp +++ b/icu4c/source/i18n/indiancal.cpp @@ -110,7 +110,7 @@ static UBool isGregorianLeap(int32_t year) */ int32_t IndianCalendar::handleGetMonthLength(int32_t eyear, int32_t month) const { if (month < 0 || month > 11) { - eyear += Math::floorDivide(month, 12, month); + eyear += ClockMath::floorDivide(month, 12, month); } if (isGregorianLeap(eyear + INDIAN_ERA_START) && month == 0) { @@ -244,7 +244,7 @@ int32_t IndianCalendar::handleComputeMonthStart(int32_t eyear, int32_t month, UB // If the month is out of range, adjust it into range, and adjust the extended eyar accordingly if (month < 0 || month > 11) { - eyear += (int32_t)Math::floorDivide(month, 12, month); + eyear += (int32_t)ClockMath::floorDivide(month, 12, month); } if(month == 12){ diff --git a/icu4c/source/i18n/islamcal.cpp b/icu4c/source/i18n/islamcal.cpp index c70dbe70877..31630915991 100644 --- a/icu4c/source/i18n/islamcal.cpp +++ b/icu4c/source/i18n/islamcal.cpp @@ -194,7 +194,7 @@ UBool IslamicCalendar::civilLeapYear(int32_t year) */ int32_t IslamicCalendar::yearStart(int32_t year) { if (civil == CIVIL) { - return (year-1)*354 + Math::floorDivide((3+11*year),30); + return (year-1)*354 + ClockMath::floorDivide((3+11*year),30); } else { return trueMonthStart(12*(year-1)); } @@ -210,7 +210,7 @@ int32_t IslamicCalendar::yearStart(int32_t year) { int32_t IslamicCalendar::monthStart(int32_t year, int32_t month) const { if (civil == CIVIL) { return (int32_t)uprv_ceil(29.5*month) - + (year-1)*354 + (int32_t)Math::floorDivide((3+11*year),30); + + (year-1)*354 + (int32_t)ClockMath::floorDivide((3+11*year),30); } else { return trueMonthStart(12*(year-1) + month); } @@ -260,7 +260,7 @@ int32_t IslamicCalendar::trueMonthStart(int32_t month) const } } while (age < 0); } - start = (int32_t)Math::floorDivide((origin - HIJRA_MILLIS), (double)kOneDay) + 1; + start = (int32_t)ClockMath::floorDivide((origin - HIJRA_MILLIS), (double)kOneDay) + 1; CalendarCache::put(&gMonthCache, month, start, status); } trueMonthStartEnd : @@ -397,7 +397,7 @@ void IslamicCalendar::handleComputeFields(int32_t julianDay, UErrorCode &status) if (civil == CIVIL) { // Use the civil calendar approximation, which is just arithmetic - year = (int)Math::floorDivide( (double)(30 * days + 10646) , 10631.0 ); + year = (int)ClockMath::floorDivide( (double)(30 * days + 10646) , 10631.0 ); month = (int32_t)uprv_ceil((days - 29 - yearStart(year)) / 29.5 ); month = month<11?month:11; startDate = monthStart(year, month); diff --git a/icu4c/source/i18n/olsontz.cpp b/icu4c/source/i18n/olsontz.cpp index dc4e94d6f9a..62fb8e0b2a8 100644 --- a/icu4c/source/i18n/olsontz.cpp +++ b/icu4c/source/i18n/olsontz.cpp @@ -138,7 +138,7 @@ OlsonTimeZone::OlsonTimeZone(const UResourceBundle* top, for(jj=0;jjsize(); ++i) { - if (e == (Entry*) DEBUG_entries->elementAt(i)) { + if (e == (TransliteratorEntry*) DEBUG_entries->elementAt(i)) { return i; } } @@ -364,7 +364,7 @@ static int DEBUG_findEntry(Entry* e) { } // Track object creation -static void DEBUG_newEntry(Entry* e) { +static void DEBUG_newEntry(TransliteratorEntry* e) { DEBUG_setup(); if (DEBUG_findEntry(e) >= 0) { // This should really never happen unless the heap is broken @@ -376,7 +376,7 @@ static void DEBUG_newEntry(Entry* e) { } // Track object deletion -static void DEBUG_delEntry(Entry* e) { +static void DEBUG_delEntry(TransliteratorEntry* e) { DEBUG_setup(); int i = DEBUG_findEntry(e); if (i < 0) { @@ -387,7 +387,7 @@ static void DEBUG_delEntry(Entry* e) { } // Track object usage -static void DEBUG_useEntry(Entry* e) { +static void DEBUG_useEntry(TransliteratorEntry* e) { if (e == NULL) return; DEBUG_setup(); int i = DEBUG_findEntry(e); @@ -417,7 +417,7 @@ static void DEBUG_useEntry(Entry* e) { * for it. We could easily add this if there is a need for it in the * future. */ -class Entry : public UMemory { +class TransliteratorEntry : public UMemory { public: enum Type { RULES_FORWARD, @@ -444,26 +444,26 @@ public: Transliterator::Token context; } factory; // For FACTORY } u; - Entry(); - ~Entry(); + TransliteratorEntry(); + ~TransliteratorEntry(); void adoptPrototype(Transliterator* adopted); void setFactory(Transliterator::Factory factory, Transliterator::Token context); private: - Entry(const Entry &other); // forbid copying of this class - Entry &operator=(const Entry &other); // forbid copying of this class + TransliteratorEntry(const TransliteratorEntry &other); // forbid copying of this class + TransliteratorEntry &operator=(const TransliteratorEntry &other); // forbid copying of this class }; -Entry::Entry() { +TransliteratorEntry::TransliteratorEntry() { u.prototype = 0; compoundFilter = NULL; entryType = NONE; DEBUG_newEntry(this); } -Entry::~Entry() { +TransliteratorEntry::~TransliteratorEntry() { DEBUG_delEntry(this); if (entryType == PROTOTYPE) { delete u.prototype; @@ -481,7 +481,7 @@ Entry::~Entry() { delete compoundFilter; } -void Entry::adoptPrototype(Transliterator* adopted) { +void TransliteratorEntry::adoptPrototype(Transliterator* adopted) { if (entryType == PROTOTYPE) { delete u.prototype; } @@ -489,7 +489,7 @@ void Entry::adoptPrototype(Transliterator* adopted) { u.prototype = adopted; } -void Entry::setFactory(Transliterator::Factory factory, +void TransliteratorEntry::setFactory(Transliterator::Factory factory, Transliterator::Token context) { if (entryType == PROTOTYPE) { delete u.prototype; @@ -503,7 +503,7 @@ void Entry::setFactory(Transliterator::Factory factory, U_CDECL_BEGIN static void U_CALLCONV deleteEntry(void* obj) { - delete (Entry*) obj; + delete (TransliteratorEntry*) obj; } U_CDECL_END @@ -530,7 +530,7 @@ Transliterator* TransliteratorRegistry::get(const UnicodeString& ID, TransliteratorAlias*& aliasReturn, UErrorCode& status) { U_ASSERT(aliasReturn == NULL); - Entry *entry = find(ID); + TransliteratorEntry *entry = find(ID); return (entry == 0) ? 0 : instantiateEntry(ID, entry, aliasReturn, status); } @@ -540,7 +540,7 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID, TransliteratorAlias*& aliasReturn, UErrorCode& status) { U_ASSERT(aliasReturn == NULL); - Entry *entry = find(ID); + TransliteratorEntry *entry = find(ID); if (entry == 0) { // We get to this point if there are two threads, one of which @@ -561,26 +561,26 @@ Transliterator* TransliteratorRegistry::reget(const UnicodeString& ID, // We have to detect this so we don't stomp over existing entry // data members and potentially leak memory (u.data and compoundFilter). - if (entry->entryType == Entry::RULES_FORWARD || - entry->entryType == Entry::RULES_REVERSE || - entry->entryType == Entry::LOCALE_RULES) { + if (entry->entryType == TransliteratorEntry::RULES_FORWARD || + entry->entryType == TransliteratorEntry::RULES_REVERSE || + entry->entryType == TransliteratorEntry::LOCALE_RULES) { if (parser.idBlockVector.isEmpty() && parser.dataVector.isEmpty()) { entry->u.data = 0; - entry->entryType = Entry::ALIAS; + entry->entryType = TransliteratorEntry::ALIAS; entry->stringArg = UNICODE_STRING_SIMPLE("Any-NULL"); } else if (parser.idBlockVector.isEmpty() && parser.dataVector.size() == 1) { entry->u.data = (TransliterationRuleData*)parser.dataVector.orphanElementAt(0); - entry->entryType = Entry::RBT_DATA; + entry->entryType = TransliteratorEntry::RBT_DATA; } else if (parser.idBlockVector.size() == 1 && parser.dataVector.isEmpty()) { entry->stringArg = *(UnicodeString*)(parser.idBlockVector.elementAt(0)); entry->compoundFilter = parser.orphanCompoundFilter(); - entry->entryType = Entry::ALIAS; + entry->entryType = TransliteratorEntry::ALIAS; } else { - entry->entryType = Entry::COMPOUND_RBT; + entry->entryType = TransliteratorEntry::COMPOUND_RBT; entry->compoundFilter = parser.orphanCompoundFilter(); entry->u.dataVector = new UVector(status); entry->stringArg.remove(); @@ -613,7 +613,7 @@ void TransliteratorRegistry::put(Transliterator* adoptedProto, UBool visible, UErrorCode& ec) { - Entry *entry = new Entry(); + TransliteratorEntry *entry = new TransliteratorEntry(); if (entry == NULL) { ec = U_MEMORY_ALLOCATION_ERROR; return; @@ -627,7 +627,7 @@ void TransliteratorRegistry::put(const UnicodeString& ID, Transliterator::Token context, UBool visible, UErrorCode& ec) { - Entry *entry = new Entry(); + TransliteratorEntry *entry = new TransliteratorEntry(); if (entry == NULL) { ec = U_MEMORY_ALLOCATION_ERROR; return; @@ -642,13 +642,13 @@ void TransliteratorRegistry::put(const UnicodeString& ID, UBool readonlyResourceAlias, UBool visible, UErrorCode& ec) { - Entry *entry = new Entry(); + TransliteratorEntry *entry = new TransliteratorEntry(); if (entry == NULL) { ec = U_MEMORY_ALLOCATION_ERROR; return; } - entry->entryType = (dir == UTRANS_FORWARD) ? Entry::RULES_FORWARD - : Entry::RULES_REVERSE; + entry->entryType = (dir == UTRANS_FORWARD) ? TransliteratorEntry::RULES_FORWARD + : TransliteratorEntry::RULES_REVERSE; if (readonlyResourceAlias) { entry->stringArg.setTo(TRUE, resourceName.getBuffer(), -1); } @@ -663,10 +663,10 @@ void TransliteratorRegistry::put(const UnicodeString& ID, UBool readonlyAliasAlias, UBool visible, UErrorCode& /*ec*/) { - Entry *entry = new Entry(); + TransliteratorEntry *entry = new TransliteratorEntry(); // Null pointer check if (entry != NULL) { - entry->entryType = Entry::ALIAS; + entry->entryType = TransliteratorEntry::ALIAS; if (readonlyAliasAlias) { entry->stringArg.setTo(TRUE, alias.getBuffer(), -1); } @@ -863,7 +863,7 @@ UOBJECT_DEFINE_RTTI_IMPLEMENTATION(TransliteratorRegistry::Enumeration) void TransliteratorRegistry::registerEntry(const UnicodeString& source, const UnicodeString& target, const UnicodeString& variant, - Entry* adopted, + TransliteratorEntry* adopted, UBool visible) { UnicodeString ID; UnicodeString s(source); @@ -878,7 +878,7 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& source, * Convenience method. Calls 6-arg registerEntry(). */ void TransliteratorRegistry::registerEntry(const UnicodeString& ID, - Entry* adopted, + TransliteratorEntry* adopted, UBool visible) { UnicodeString source, target, variant; UBool sawSource; @@ -897,7 +897,7 @@ void TransliteratorRegistry::registerEntry(const UnicodeString& ID, const UnicodeString& source, const UnicodeString& target, const UnicodeString& variant, - Entry* adopted, + TransliteratorEntry* adopted, UBool visible) { UErrorCode status = U_ZERO_ERROR; registry.put(ID, adopted, status); @@ -999,12 +999,12 @@ void TransliteratorRegistry::removeSTV(const UnicodeString& source, * * Caller does NOT own returned object. */ -Entry* TransliteratorRegistry::findInDynamicStore(const Spec& src, - const Spec& trg, +TransliteratorEntry* TransliteratorRegistry::findInDynamicStore(const TransliteratorSpec& src, + const TransliteratorSpec& trg, const UnicodeString& variant) const { UnicodeString ID; TransliteratorIDParser::STVtoID(src, trg, variant, ID); - Entry *e = (Entry*) registry.get(ID); + TransliteratorEntry *e = (TransliteratorEntry*) registry.get(ID); DEBUG_useEntry(e); return e; } @@ -1020,10 +1020,10 @@ Entry* TransliteratorRegistry::findInDynamicStore(const Spec& src, * * Caller does NOT own returned object. */ -Entry* TransliteratorRegistry::findInStaticStore(const Spec& src, - const Spec& trg, +TransliteratorEntry* TransliteratorRegistry::findInStaticStore(const TransliteratorSpec& src, + const TransliteratorSpec& trg, const UnicodeString& variant) { - Entry* entry = 0; + TransliteratorEntry* entry = 0; if (src.isLocale()) { entry = findInBundle(src, trg, variant, UTRANS_FORWARD); } else if (trg.isLocale()) { @@ -1056,8 +1056,8 @@ static const UChar TRANSLITERATE[] = {84,114,97,110,115,108,105,116,101,114,97,1 * On success, create a new Entry object, populate it, and return it. * The caller owns the returned object. */ -Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen, - const Spec& specToFind, +TransliteratorEntry* TransliteratorRegistry::findInBundle(const TransliteratorSpec& specToOpen, + const TransliteratorSpec& specToFind, const UnicodeString& variant, UTransDirection direction) { @@ -1120,7 +1120,7 @@ Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen, // We have succeeded in loading a string from the locale // resources. Create a new registry entry to hold it and return it. - Entry *entry = new Entry(); + TransliteratorEntry *entry = new TransliteratorEntry(); if (entry != 0) { // The direction is always forward for the // TransliterateTo_xxx and TransliterateFrom_xxx @@ -1129,7 +1129,7 @@ Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen, // the direction is the value passed in to this // function. int32_t dir = (pass == 0) ? UTRANS_FORWARD : direction; - entry->entryType = Entry::LOCALE_RULES; + entry->entryType = TransliteratorEntry::LOCALE_RULES; entry->stringArg = resStr; entry->intArg = dir; } @@ -1140,7 +1140,7 @@ Entry* TransliteratorRegistry::findInBundle(const Spec& specToOpen, /** * Convenience method. Calls 3-arg find(). */ -Entry* TransliteratorRegistry::find(const UnicodeString& ID) { +TransliteratorEntry* TransliteratorRegistry::find(const UnicodeString& ID) { UnicodeString source, target, variant; UBool sawSource; TransliteratorIDParser::IDtoSTV(ID, source, target, variant, sawSource); @@ -1168,13 +1168,13 @@ Entry* TransliteratorRegistry::find(const UnicodeString& ID) { * * Caller does NOT own returned object. Return 0 on failure. */ -Entry* TransliteratorRegistry::find(UnicodeString& source, +TransliteratorEntry* TransliteratorRegistry::find(UnicodeString& source, UnicodeString& target, UnicodeString& variant) { - Spec src(source); - Spec trg(target); - Entry* entry; + TransliteratorSpec src(source); + TransliteratorSpec trg(target); + TransliteratorEntry* entry; if (variant.length() != 0) { @@ -1232,38 +1232,38 @@ Entry* TransliteratorRegistry::find(UnicodeString& source, * modified. */ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID, - Entry *entry, + TransliteratorEntry *entry, TransliteratorAlias* &aliasReturn, UErrorCode& status) { Transliterator *t = 0; U_ASSERT(aliasReturn == 0); switch (entry->entryType) { - case Entry::RBT_DATA: + case TransliteratorEntry::RBT_DATA: t = new RuleBasedTransliterator(ID, entry->u.data); if (t == 0) { status = U_MEMORY_ALLOCATION_ERROR; } return t; - case Entry::PROTOTYPE: + case TransliteratorEntry::PROTOTYPE: t = entry->u.prototype->clone(); if (t == 0) { status = U_MEMORY_ALLOCATION_ERROR; } return t; - case Entry::ALIAS: + case TransliteratorEntry::ALIAS: aliasReturn = new TransliteratorAlias(entry->stringArg, entry->compoundFilter); if (aliasReturn == 0) { status = U_MEMORY_ALLOCATION_ERROR; } return 0; - case Entry::FACTORY: + case TransliteratorEntry::FACTORY: t = entry->u.factory.function(ID, entry->u.factory.context); if (t == 0) { status = U_MEMORY_ALLOCATION_ERROR; } return t; - case Entry::COMPOUND_RBT: + case TransliteratorEntry::COMPOUND_RBT: { UVector* rbts = new UVector(entry->u.dataVector->size(), status); // Check for null pointer @@ -1290,15 +1290,15 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID status = U_MEMORY_ALLOCATION_ERROR; } return 0; - case Entry::LOCALE_RULES: + case TransliteratorEntry::LOCALE_RULES: aliasReturn = new TransliteratorAlias(ID, entry->stringArg, (UTransDirection) entry->intArg); if (aliasReturn == 0) { status = U_MEMORY_ALLOCATION_ERROR; } return 0; - case Entry::RULES_FORWARD: - case Entry::RULES_REVERSE: + case TransliteratorEntry::RULES_FORWARD: + case TransliteratorEntry::RULES_REVERSE: // Process the rule data into a TransliteratorRuleData object, // and possibly also into an ::id header and/or footer. Then // we modify the registry with the parsed data and retry. @@ -1330,7 +1330,7 @@ Transliterator* TransliteratorRegistry::instantiateEntry(const UnicodeString& ID // transliterators; if it lists something that's not // installed, we'll get an error from ResourceBundle. aliasReturn = new TransliteratorAlias(ID, rules, - ((entry->entryType == Entry::RULES_REVERSE) ? + ((entry->entryType == TransliteratorEntry::RULES_REVERSE) ? UTRANS_REVERSE : UTRANS_FORWARD)); if (aliasReturn == 0) { status = U_MEMORY_ALLOCATION_ERROR; diff --git a/icu4c/source/i18n/transreg.h b/icu4c/source/i18n/transreg.h index c14ebbf3923..483e74f4560 100644 --- a/icu4c/source/i18n/transreg.h +++ b/icu4c/source/i18n/transreg.h @@ -21,8 +21,8 @@ U_NAMESPACE_BEGIN -class Entry; -class Spec; +class TransliteratorEntry; +class TransliteratorSpec; class UnicodeString; //------------------------------------------------------------------ @@ -359,40 +359,40 @@ class TransliteratorRegistry : public UMemory { // Private implementation //---------------------------------------------------------------- - Entry* find(const UnicodeString& ID); + TransliteratorEntry* find(const UnicodeString& ID); - Entry* find(UnicodeString& source, + TransliteratorEntry* find(UnicodeString& source, UnicodeString& target, UnicodeString& variant); - Entry* findInDynamicStore(const Spec& src, - const Spec& trg, + TransliteratorEntry* findInDynamicStore(const TransliteratorSpec& src, + const TransliteratorSpec& trg, const UnicodeString& variant) const; - Entry* findInStaticStore(const Spec& src, - const Spec& trg, + TransliteratorEntry* findInStaticStore(const TransliteratorSpec& src, + const TransliteratorSpec& trg, const UnicodeString& variant); - static Entry* findInBundle(const Spec& specToOpen, - const Spec& specToFind, + static TransliteratorEntry* findInBundle(const TransliteratorSpec& specToOpen, + const TransliteratorSpec& specToFind, const UnicodeString& variant, UTransDirection direction); void registerEntry(const UnicodeString& source, const UnicodeString& target, const UnicodeString& variant, - Entry* adopted, + TransliteratorEntry* adopted, UBool visible); void registerEntry(const UnicodeString& ID, - Entry* adopted, + TransliteratorEntry* adopted, UBool visible); void registerEntry(const UnicodeString& ID, const UnicodeString& source, const UnicodeString& target, const UnicodeString& variant, - Entry* adopted, + TransliteratorEntry* adopted, UBool visible); void registerSTV(const UnicodeString& source, @@ -404,7 +404,7 @@ class TransliteratorRegistry : public UMemory { const UnicodeString& variant); Transliterator* instantiateEntry(const UnicodeString& ID, - Entry *entry, + TransliteratorEntry *entry, TransliteratorAlias*& aliasReturn, UErrorCode& status); diff --git a/icu4c/source/i18n/tridpars.cpp b/icu4c/source/i18n/tridpars.cpp index 31bb034d6bb..f851aadaf14 100644 --- a/icu4c/source/i18n/tridpars.cpp +++ b/icu4c/source/i18n/tridpars.cpp @@ -920,7 +920,7 @@ void TransliteratorIDParser::init(UErrorCode &status) { umtx_unlock(&LOCK); delete special_inverses; /*null instance*/ - ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, transliterator_cleanup); + ucln_i18n_registerCleanup(UCLN_I18N_TRANSLITERATOR, utrans_transliterator_cleanup); } /** diff --git a/icu4c/source/i18n/ucln_in.h b/icu4c/source/i18n/ucln_in.h index 720bf03392f..d133db0b917 100644 --- a/icu4c/source/i18n/ucln_in.h +++ b/icu4c/source/i18n/ucln_in.h @@ -53,6 +53,6 @@ typedef enum ECleanupI18NType { U_CFUNC void U_EXPORT2 ucln_i18n_registerCleanup(ECleanupI18NType type, cleanupFunc *func); -U_CFUNC UBool transliterator_cleanup(void); +U_CFUNC UBool utrans_transliterator_cleanup(void); #endif