mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
ICU-2966 character ordering must be computed at runtime
X-SVN-Rev: 12871
This commit is contained in:
parent
fe3583ad46
commit
e897911f83
3 changed files with 39 additions and 82 deletions
|
@ -3,7 +3,7 @@
|
|||
// Corporation and others. All Rights Reserved.
|
||||
//---------------------------------------------------------
|
||||
// Build tool: tz2icu
|
||||
// Build date: Mon Aug 18 17:58:03 2003
|
||||
// Build date: Mon Aug 18 21:34:07 2003
|
||||
// Olson source: ftp://elsie.nci.nih.gov/pub/
|
||||
//---------------------------------------------------------
|
||||
// >> !!! >> THIS IS A MACHINE-GENERATED FILE << !!! <<
|
||||
|
@ -2934,9 +2934,5 @@ zoneinfo {
|
|||
%ZA:intvector { 29 }
|
||||
%ZM:intvector { 39 }
|
||||
%ZW:intvector { 28, 318 }
|
||||
_:intvector {
|
||||
238, 562, // zone start,count
|
||||
801, 43, // rule start,count
|
||||
0, 238 // country start,count
|
||||
}
|
||||
_:intvector { 562, 44, 238 } // zone, rule, country counts
|
||||
}
|
||||
|
|
|
@ -102,15 +102,20 @@ U_NAMESPACE_BEGIN
|
|||
* The Olson data is stored the "zoneinfo" resource bundle.
|
||||
* Sub-resources are organized into three ranges of data: Zones, final
|
||||
* rules, and country tables. There is also a meta-data resource
|
||||
* which has six integers: The start and count values for the three
|
||||
* ranges. E.g., 10, 15, 3, 7, 0, 3 means that sub resources at index
|
||||
* 0..2 are country maps, 3..9 are final rules, and 10..24 are zones.
|
||||
*
|
||||
* We currently only need to know the zone range.
|
||||
* which has 3 integers: The number of zones, rules, and countries,
|
||||
* respectively. The country count includes the non-country '%' and
|
||||
* the rule count includes the non-rule '_' (the metadata).
|
||||
*/
|
||||
static int32_t OLSON_ZONE_START = -1; // starting index of zones
|
||||
static int32_t OLSON_ZONE_COUNT = 0; // count of zones
|
||||
|
||||
/* We could compute all of the following, but we don't need them
|
||||
static int32_t OLSON_RULE_START = 0; // starting index of rules
|
||||
static int32_t OLSON_RULE_COUNT = 0; // count of zones
|
||||
static int32_t OLSON_COUNTRY_START = 0; // starting index of countries
|
||||
static int32_t OLSON_COUNTRY_COUNT = 0; // count of zones
|
||||
*/
|
||||
|
||||
/**
|
||||
* Given a pointer to an open "zoneinfo" resource, load up the Olson
|
||||
* meta-data. Return TRUE if successful.
|
||||
|
@ -123,11 +128,26 @@ static UBool getOlsonMeta(const UResourceBundle* top) {
|
|||
ures_getByKey(top, "_", &res, &ec);
|
||||
int32_t len;
|
||||
const int32_t* v = ures_getIntVector(&res, &len, &ec);
|
||||
if (U_SUCCESS(ec) && len == 6) {
|
||||
OLSON_ZONE_START = v[0];
|
||||
OLSON_ZONE_COUNT = v[1];
|
||||
// We don't use the rule start/count @ v[2..3]
|
||||
// We don't use the country start/count @ v[4..5]
|
||||
if (U_SUCCESS(ec) && len == 3) {
|
||||
OLSON_ZONE_COUNT = v[0];
|
||||
// Note: Remove the following `int32_t' declarations if you
|
||||
// uncomment the declarations above!
|
||||
int32_t OLSON_RULE_COUNT = v[1];
|
||||
int32_t OLSON_COUNTRY_COUNT = v[2];
|
||||
|
||||
// Try to figure out how strcmp in genrb is going to sort
|
||||
// things. This has to be done here, dynamically, rather
|
||||
// than at build time.
|
||||
char zoneCh='A', ruleCh='_', countryCh='%'; // [sic]
|
||||
OLSON_ZONE_START = ((ruleCh < zoneCh) ? OLSON_RULE_COUNT : 0) +
|
||||
((countryCh < zoneCh) ? OLSON_COUNTRY_COUNT : 0);
|
||||
|
||||
/* We could compute the following, but we don't need them -- yet
|
||||
OLSON_RULE_START = ((zoneCh < ruleCh) ? OLSON_ZONE_COUNT : 0) +
|
||||
((countryCh < ruleCh) ? OLSON_COUNTRY_COUNT : 0);
|
||||
OLSON_COUNTRY_START = ((ruleCh < countryCh) ? OLSON_RULE_COUNT : 0) +
|
||||
((zoneCh < countryCh) ? OLSON_ZONE_COUNT : 0);
|
||||
*/
|
||||
}
|
||||
ures_close(&res);
|
||||
}
|
||||
|
@ -1185,4 +1205,4 @@ U_NAMESPACE_END
|
|||
|
||||
#endif /* #if !UCONFIG_NO_FORMATTING */
|
||||
|
||||
//eof
|
||||
//eof
|
||||
|
|
|
@ -46,48 +46,6 @@
|
|||
|
||||
#include "tz2icu.h"
|
||||
|
||||
// Excerpt from tzfile.h:
|
||||
|
||||
//|#define TZ_MAGIC "TZif"
|
||||
//|
|
||||
//|struct tzhead {
|
||||
//| char tzh_magic[4]; /* TZ_MAGIC */
|
||||
//| char tzh_reserved[16]; /* reserved for future use */
|
||||
//| char tzh_ttisgmtcnt[4]; /* coded number of trans. time flags */
|
||||
//| char tzh_ttisstdcnt[4]; /* coded number of trans. time flags */
|
||||
//| char tzh_leapcnt[4]; /* coded number of leap seconds */
|
||||
//| char tzh_timecnt[4]; /* coded number of transition times */
|
||||
//| char tzh_typecnt[4]; /* coded number of local time types */
|
||||
//| char tzh_charcnt[4]; /* coded number of abbr. chars */
|
||||
//|};
|
||||
//|
|
||||
//|/*
|
||||
//|** . . .followed by. . .
|
||||
//|**
|
||||
//|** tzh_timecnt (char [4])s coded transition times a la time(2)
|
||||
//|** tzh_timecnt (unsigned char)s types of local time starting at above
|
||||
//|** tzh_typecnt repetitions of
|
||||
//|** one (char [4]) coded UTC offset in seconds
|
||||
//|** one (unsigned char) used to set tm_isdst
|
||||
//|** one (unsigned char) that's an abbreviation list index
|
||||
//|** tzh_charcnt (char)s '\0'-terminated zone abbreviations
|
||||
//|** tzh_leapcnt repetitions of
|
||||
//|** one (char [4]) coded leap second transition times
|
||||
//|** one (char [4]) total correction after above
|
||||
//|** tzh_ttisstdcnt (char)s indexed by type; if TRUE, transition
|
||||
//|** time is standard time, if FALSE,
|
||||
//|** transition time is wall clock time
|
||||
//|** if absent, transition times are
|
||||
//|** assumed to be wall clock time
|
||||
//|** tzh_ttisgmtcnt (char)s indexed by type; if TRUE, transition
|
||||
//|** time is UTC, if FALSE,
|
||||
//|** transition time is local time
|
||||
//|** if absent, transition times are
|
||||
//|** assumed to be local time
|
||||
//|*/
|
||||
|
||||
// But we know from zic.c that ttisgmtcnt == ttisstdcnt == typecnt
|
||||
|
||||
using namespace std;
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
|
@ -1425,24 +1383,9 @@ int main(int argc, char *argv[]) {
|
|||
// contains all non-country zones. That counts as an ordinary
|
||||
// country. There is also a meta-data entry named "_" which does
|
||||
// NOT count as a rule.
|
||||
int32_t zoneStart=0,
|
||||
zoneCount=ZONEINFO.size(),
|
||||
ruleStart=0,
|
||||
ruleCount=finalRules.size() + 1, // include meta '_' for now
|
||||
countryStart=0,
|
||||
countryCount=countryMap.size();
|
||||
// Try to figure out how strcmp in genrb is going to sort things.
|
||||
char zoneCh='A', ruleCh='_', countryCh='%';
|
||||
if (zoneCh < ruleCh) ruleStart += zoneCount;
|
||||
else zoneStart += ruleCount;
|
||||
if (zoneCh < countryCh) countryStart += zoneCount;
|
||||
else zoneStart += countryCount;
|
||||
if (ruleCh < countryCh) countryStart += ruleCount;
|
||||
else ruleStart += countryCount;
|
||||
// Remove the meta element, '_', which will be at the start of the
|
||||
// real rules.
|
||||
ruleStart++;
|
||||
ruleCount--;
|
||||
int32_t zoneCount=ZONEINFO.size(),
|
||||
ruleCount=finalRules.size() + 1, // include meta '_' for now
|
||||
countryCount=countryMap.size();
|
||||
|
||||
// Get local time & year for below
|
||||
time_t sec;
|
||||
|
@ -1507,11 +1450,9 @@ int main(int argc, char *argv[]) {
|
|||
}
|
||||
|
||||
// Emit meta-data.
|
||||
file << " _:intvector {" << endl
|
||||
<< " " << zoneStart << ", " << zoneCount << ", // zone start,count" << endl
|
||||
<< " " << ruleStart << ", " << ruleCount << ", // rule start,count" << endl
|
||||
<< " " << countryStart << ", " << countryCount << " // country start,count" << endl
|
||||
<< " }" << endl;
|
||||
file << " _:intvector { "
|
||||
<< zoneCount << ", " << ruleCount << ", " << countryCount
|
||||
<< " } // zone, rule, country counts" << endl;
|
||||
|
||||
file << "}" << endl;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue