ICU-953 Export fewer static symbols and fix an os/390 porting problem

X-SVN-Rev: 5149
This commit is contained in:
George Rhoten 2001-07-02 17:23:27 +00:00
parent c4cc4f56ea
commit 72159af00c
2 changed files with 22 additions and 96 deletions

View File

@ -44,28 +44,31 @@
#include "cstring.h"
// static initialization
char TimeZone::fgClassID = 0; // Value is irrelevant
char TimeZone::fgClassID = 0; // Value is irrelevant
TimeZone* TimeZone::fgDefaultZone = NULL;
TimeZone* TimeZone::fgDefaultZone = NULL;
const UChar TimeZone::GMT_ID[] = {0x47, 0x4D, 0x54, 0x00}; /* "GMT" */
const int32_t TimeZone::GMT_ID_LENGTH = 3;
const UChar TimeZone::CUSTOM_ID[] =
static const UChar GMT_ID[] = {0x47, 0x4D, 0x54, 0x00}; /* "GMT" */
static const int32_t GMT_ID_LENGTH = 3;
static const UChar CUSTOM_ID[] =
{
0x43, 0x75, 0x73, 0x74, 0x6F, 0x6D, 0x00 /* "Custom" */
};
const TimeZone* TimeZone::GMT = getGMT();
const TimeZone* TimeZone::GMT = getGMT();
// See header file for documentation of the following
const TZHeader * TimeZone::DATA = 0;
const uint32_t* TimeZone::INDEX_BY_ID = 0;
const OffsetIndex* TimeZone::INDEX_BY_OFFSET = 0;
const CountryIndex* TimeZone::INDEX_BY_COUNTRY = 0;
UnicodeString* TimeZone::ZONE_IDS = 0;
UBool TimeZone::DATA_LOADED = FALSE;
UDataMemory* TimeZone::UDATA_POINTER = 0;
UMTX TimeZone::LOCK;
static const TZHeader * DATA = 0;
static const uint32_t* INDEX_BY_ID = 0;
static const OffsetIndex* INDEX_BY_OFFSET = 0;
static const CountryIndex* INDEX_BY_COUNTRY = 0;
static UnicodeString* ZONE_IDS = 0;
static UBool DATA_LOADED = FALSE;
static UDataMemory* UDATA_POINTER = 0;
static UMTX LOCK;
static void loadZoneData(void);
static const TZEquivalencyGroup* lookupEquivalencyGroup(const UnicodeString& id);
// -------------------------------------
@ -80,7 +83,7 @@ TimeZone::getGMT(void)
* udata callback to verify the zone data.
*/
U_CDECL_BEGIN
static UBool
static UBool U_CALLCONV
isTimeZoneDataAcceptable(void * /*context*/,
const char * /*type*/, const char * /*name*/,
const UDataInfo *pInfo) {
@ -109,7 +112,7 @@ U_CDECL_END
* we are guaranteed that all associated data structures are
* initialized.
*/
void TimeZone::loadZoneData() {
static void loadZoneData() {
if (!DATA_LOADED) {
Mutex lock(&LOCK);
if (!DATA_LOADED) {
@ -245,8 +248,8 @@ TimeZone::createSystemTimeZone(const UnicodeString& name) {
* Return a pointer to the equivalency group, or NULL if not found.
* DATA MUST BE INITIALIZED AND NON-NULL.
*/
const TZEquivalencyGroup*
TimeZone::lookupEquivalencyGroup(const UnicodeString& id) {
static const TZEquivalencyGroup*
lookupEquivalencyGroup(const UnicodeString& id) {
// Perform a binary search. Possible optimization: Unroll the
// search. Not worth it given the small number of zones (416 in
// 1999j).

View File

@ -25,16 +25,7 @@
#ifndef TIMEZONE_H
#define TIMEZONE_H
#include "unicode/unistr.h"
#include "unicode/locid.h"
#include "unicode/udata.h"
struct TZHeader;
struct OffsetIndex;
struct CountryIndex;
struct TZEquivalencyGroup;
/**
* <code>TimeZone</code> represents a time zone offset, and also figures out daylight
@ -527,71 +518,9 @@ protected:
private:
static char fgClassID;
static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
static TimeZone* fgDefaultZone; // default time zone (lazy evaluated)
static const UChar GMT_ID[];
static const int32_t GMT_ID_LENGTH;
static const UChar CUSTOM_ID[];
////////////////////////////////////////////////////////////////
// Pointers into memory-mapped icudata. Writing to this memory
// will segfault! See tzdat.h for more details.
////////////////////////////////////////////////////////////////
/**
* DATA is the start of the memory-mapped zone data, and
* specifically points to the header object located there.
* May be zero if loading failed for some reason.
*/
static const TZHeader * DATA;
/**
* INDEX_BY_ID is an index table in lexicographic order of ID.
* Each entry is an offset from DATA to an equivalency group.
*/
static const uint32_t* INDEX_BY_ID;
/**
* INDEX_BY_OFFSET is an OffsetIndex table. This table can only
* be walked through sequentially because the entries are of
* variable size.
*/
static const OffsetIndex* INDEX_BY_OFFSET;
/**
* INDEX_BY_COUNTRY is a CountryIndex table. This table can
* be walked through sequentially because the entries are of
* variable size.
*/
static const CountryIndex* INDEX_BY_COUNTRY;
////////////////////////////////////////////////////////////////
// Other system zone data structures
////////////////////////////////////////////////////////////////
/**
* ZONE_IDS is an array of all the system zone ID strings, in
* lexicographic order. The createAvailableIDs() methods return
* arrays of pointers into this array.
*/
static UnicodeString* ZONE_IDS;
/**
* If DATA_LOADED is true, then an attempt has already been made
* to load the system zone data, and further attempts will not be
* made. If DATA_LOADED is true, DATA itself will be zero if
* loading failed, or non-zero if it succeeded.
*/
static UBool DATA_LOADED;
static UDataMemory* UDATA_POINTER;
/**
* The mutex object used to control write access to DATA,
* INDEX_BY_ID, INDEX_BY_OFFSET, and ZONE_IDS. Also used to
* control read/write access to fgDefaultZone.
*/
static UMTX LOCK;
static TimeZone* createCustomTimeZone(const UnicodeString&); // Creates a time zone based on the string.
/**
* Responsible for setting up fgDefaultZone. Uses routines in TPlatformUtilities
@ -605,15 +534,9 @@ private:
*/
static const TimeZone *getGMT(void);
// See source file for documentation
static void loadZoneData(void);
// See source file for documentation
static TimeZone* createSystemTimeZone(const UnicodeString& name);
// See source file for documentation
static const TZEquivalencyGroup* lookupEquivalencyGroup(const UnicodeString& id);
UnicodeString fID; // this time zone's ID
};