mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
Issue #1971 - Part 2: Update ICU source to 63.2.
This commit is contained in:
parent
8df84683be
commit
1e69214382
3160 changed files with 275815 additions and 234203 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (C) 2016 and later: Unicode, Inc. and others.
|
||||
// © 2016 and later: Unicode, Inc. and others.
|
||||
// License & terms of use: http://www.unicode.org/copyright.html
|
||||
/*
|
||||
**********************************************************************
|
||||
|
|
@ -830,7 +830,7 @@ struct FinalRulePart {
|
|||
if (mode != DOM && (dow < 0 || dow >= 7)) {
|
||||
os << "Invalid input day of week " << dow;
|
||||
}
|
||||
if (offset < 0 || offset > (2 * HOUR)) {
|
||||
if (offset < (-1 * HOUR) || offset > (2 * HOUR)) {
|
||||
os << "Invalid input offset " << offset;
|
||||
}
|
||||
if (isgmt && !isstd) {
|
||||
|
|
@ -903,7 +903,6 @@ map<string,FinalRule> finalRules;
|
|||
|
||||
map<string, set<string> > links;
|
||||
map<string, string> reverseLinks;
|
||||
map<string, string> linkSource; // id => "Olson link" or "ICU alias"
|
||||
|
||||
/**
|
||||
* Predicate used to find FinalRule objects that do not have both
|
||||
|
|
@ -975,9 +974,6 @@ void readFinalZonesAndRules(istream& in) {
|
|||
|
||||
links[fromid].insert(toid);
|
||||
reverseLinks[toid] = fromid;
|
||||
|
||||
linkSource[fromid] = "Olson link";
|
||||
linkSource[toid] = "Olson link";
|
||||
} else if (token.length() > 0 && token[0] == '#') {
|
||||
consumeLine(in);
|
||||
} else {
|
||||
|
|
@ -1430,6 +1426,9 @@ void FinalRule::print(ostream& os) const {
|
|||
os << part[whichpart].offset << endl;
|
||||
}
|
||||
|
||||
#define ICU_ZONE_OVERRIDE_SUFFIX "--ICU"
|
||||
#define ICU_ZONE_OVERRIDE_SUFFIX_LEN 5
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
string rootpath, zonetab, version;
|
||||
bool validArgs = FALSE;
|
||||
|
|
@ -1493,6 +1492,82 @@ int main(int argc, char *argv[]) {
|
|||
<< (ZONEINFO.begin())->first << ".."
|
||||
<< (--ZONEINFO.end())->first << "]" << endl;
|
||||
|
||||
// Overrides TZ database zones with ICU custom zone definition.
|
||||
// These ICU zone overrides are defined in icuzones, with suffix --ICU.
|
||||
// If there is a matching TZ database zone, the zoneinfo is replaced
|
||||
// with the ICU definition. Then, the zone ID with --ICU suffix
|
||||
// will be deleted from the final list.
|
||||
// For example, zoneinfo for Europe/Dublin imported from the TZ database
|
||||
// will be replaced with the zone definition for Europe/Dublin--ICU
|
||||
// in icuzones.
|
||||
|
||||
// Collect zone IDs to be modified with ICU definition.
|
||||
vector<string> customZones;
|
||||
for (ZoneMapIter i = ZONEINFO.begin(); i != ZONEINFO.end(); ++i) {
|
||||
const string& id = i->first;
|
||||
size_t idx = id.rfind(ICU_ZONE_OVERRIDE_SUFFIX);
|
||||
if (idx != string::npos && idx == id.length() - ICU_ZONE_OVERRIDE_SUFFIX_LEN) {
|
||||
cout << "ICU zone override: " << id << endl;
|
||||
customZones.push_back(id.substr(0, idx));
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// BEGIN ICU Custom ZoneInfo Override Handling
|
||||
//
|
||||
|
||||
// Replace zoneinfo with ICU definition, then remove ICU zone ID with
|
||||
// the special suffix.
|
||||
for (vector<string>::iterator i = customZones.begin(); i != customZones.end(); i++) {
|
||||
string& origId = *i;
|
||||
string custId = origId + ICU_ZONE_OVERRIDE_SUFFIX;
|
||||
|
||||
map<string,ZoneInfo>::iterator origZi = ZONEINFO.find(origId);
|
||||
map<string,ZoneInfo>::iterator custZi = ZONEINFO.find(custId);
|
||||
if (origZi != ZONEINFO.end() && custZi != ZONEINFO.end()) {
|
||||
// replace original zone info with custom override,
|
||||
// then delete one custom ID
|
||||
cout << "Replacing ZoneInfo " << origId << " with " << custId << endl;
|
||||
origZi->second = custZi->second;
|
||||
ZONEINFO.erase(custZi);
|
||||
}
|
||||
|
||||
// Also replace final rule
|
||||
map<string,FinalZone>::iterator origFz = finalZones.find(origId);
|
||||
map<string,FinalZone>::iterator custFz = finalZones.find(custId);
|
||||
if (origFz != finalZones.end() && custFz != finalZones.end()) {
|
||||
// replace original final zone with custom override,
|
||||
// then delete one for custom ID
|
||||
cout << "Replacing FinalZone for " << origId << " with " << custId << endl;
|
||||
origFz->second = custFz->second;
|
||||
finalZones.erase(custFz);
|
||||
}
|
||||
}
|
||||
|
||||
// Also remove aliases for ICU custom zoneinfo overrides.
|
||||
for (map<string,set<string>>::const_iterator i = links.begin(); i != links.end(); ) {
|
||||
const string& id = i->first;
|
||||
size_t idx = id.rfind(ICU_ZONE_OVERRIDE_SUFFIX);
|
||||
if (idx != string::npos && idx == id.length() - ICU_ZONE_OVERRIDE_SUFFIX_LEN) {
|
||||
const set<string>& aliases = i->second;
|
||||
// Also remove all revserse links
|
||||
for (set<string>::const_iterator j = aliases.begin(); j != aliases.end(); j++) {
|
||||
const string& alias = *j;
|
||||
cout << "Removing alias " << alias << endl;
|
||||
reverseLinks.erase(alias);
|
||||
}
|
||||
|
||||
links.erase(i++);
|
||||
} else {
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// END ICU Custom ZoneInfo Override Handling
|
||||
//
|
||||
|
||||
try {
|
||||
for_each(finalZones.begin(), finalZones.end(), mergeFinalZone);
|
||||
} catch (const exception& error) {
|
||||
|
|
@ -1510,7 +1585,7 @@ int main(int argc, char *argv[]) {
|
|||
const string& olson = i->first;
|
||||
const set<string>& aliases = i->second;
|
||||
if (ZONEINFO.find(olson) == ZONEINFO.end()) {
|
||||
cerr << "Error: Invalid " << linkSource[olson] << " to non-existent \""
|
||||
cerr << "Error: Invalid 'Link' to non-existent \""
|
||||
<< olson << "\"" << endl;
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue