[sword-cvs] icu-sword/source/tools/gentz/tzcode patch-icu-tzcode,NONE,1.1 readme.txt,NONE,1.1 tz.alias,NONE,1.1 tz2icu.cpp,NONE,1.1 tz2icu.h,NONE,1.1

sword@www.crosswire.org sword@www.crosswire.org
Tue, 6 Apr 2004 03:10:25 -0700


Update of /cvs/core/icu-sword/source/tools/gentz/tzcode
In directory www:/tmp/cvs-serv8911/source/tools/gentz/tzcode

Added Files:
	patch-icu-tzcode readme.txt tz.alias tz2icu.cpp tz2icu.h 
Log Message:
ICU 2.8 sync

--- NEW FILE: patch-icu-tzcode ---
diff --unified --recursive ../tzcode.orig/Makefile ./Makefile
--- ../tzcode.orig/Makefile	2003-02-14 10:09:05.000000000 -0800
+++ ./Makefile	2003-08-18 13:16:32.000000000 -0700
@@ -40,7 +40,7 @@
 # (and subdirectories).
 # Use an absolute path name for TZDIR unless you're just testing the software.
 
-TZDIR=		$(TOPDIR)/etc/zoneinfo
+TZDIR=		zoneinfo
 
 # The "tzselect", "zic", and "zdump" commands get installed in. . .
 
@@ -239,9 +239,11 @@
 
 ###############################################################################
 
-cc=		cc
+cc=		gcc
 CC=		$(cc) -DTZDIR=\"$(TZDIR)\"
 
+CPP=		g++
+
 TZCSRCS=	zic.c localtime.c asctime.c scheck.c ialloc.c
 TZCOBJS=	zic.o localtime.o asctime.o scheck.o ialloc.o
 TZDSRCS=	zdump.c localtime.c asctime.c ialloc.c
@@ -275,7 +277,7 @@
 
 SHELL=		/bin/sh
 
-all:		tzselect zic zdump $(LIBOBJS)
+all:		tzselect zic zdump $(LIBOBJS) tz2icu
 
 ALL:		all date
 
@@ -308,9 +310,12 @@
 zdump:		$(TZDOBJS)
 		$(CC) $(CFLAGS) $(LFLAGS) $(TZDOBJS) $(LDLIBS) -o $@
 
-zic:		$(TZCOBJS) yearistype
+zic:		$(TZCOBJS) yearistype tz2icu.h
 		$(CC) $(CFLAGS) $(LFLAGS) $(TZCOBJS) $(LDLIBS) -o $@
 
+tz2icu:		tz2icu.cpp tz2icu.h
+		$(CPP) -W -Wall -pedantic tz2icu.cpp -o $@
+
 yearistype:	yearistype.sh
 		cp yearistype.sh yearistype
 		chmod +x yearistype
@@ -321,6 +326,9 @@
 right_only:	zic leapseconds $(TDATA)
 		$(ZIC) -y $(YEARISTYPE) -d $(TZDIR) -L leapseconds $(TDATA)
 
+icu_data:	tz2icu posix_only
+		./tz2icu zoneinfo zone.tab
+
 # In earlier versions of this makefile, the other two directories were
 # subdirectories of $(TZDIR).  However, this led to configuration errors.
 # For example, with posix_right under the earlier scheme,
diff --unified --recursive ../tzcode.orig/zic.c ./zic.c
--- ../tzcode.orig/zic.c	2003-02-24 08:09:14.000000000 -0800
+++ ./zic.c	2003-08-18 09:16:02.000000000 -0700
@@ -17,6 +17,20 @@
 #define MKDIR_UMASK 0755
 #endif
 
+/* Enable extensions and modifications for ICU. */
+#define ICU
+
+/* Continue executing after link failure. Even if ICU is undefined
+ * (for vanilla zic behavior), ICU_LINKS should be defined, since zic
+ * appears to fail on the 2003 data the first time through during the
+ * linking phase. Running zic twice, with ICU_LINKS defined, causes
+ * links to be handled correctly. */
+#define ICU_LINKS
+
+#ifdef ICU
+#include "tz2icu.h"
+#endif
+
 /*
 ** On some ancient hosts, predicates like `isspace(C)' are defined
 ** only if isascii(C) || C == EOF.  Modern hosts obey the C Standard,
@@ -90,8 +104,14 @@
 extern int	optind;
 
 static void	addtt P((time_t starttime, int type));
+#ifdef ICU
+static int	addtype P((long gmtoff, long rawoff, long dstoff,
+				const char * abbr, int isdst,
+				int ttisstd, int ttisgmt));
+#else
 static int	addtype P((long gmtoff, const char * abbr, int isdst,
 				int ttisstd, int ttisgmt));
+#endif
 static void	leapadd P((time_t t, int positive, int rolling, int count));
 static void	adjleap P((void));
 static void	associate P((void));
@@ -260,6 +280,18 @@
 	const int	l_value;
 };
 
+#ifdef ICU
+
+/* Indices into rules[] for final rules.  They will occur in pairs,
+ * with finalRules[i] occurring before finalRules[i+1] in the year.
+ * Each zone need only store a start year, a standard offset, and an
+ * index into finalRules[].  FinalRules[] are aliases into rules[]. */
+
+static const struct rule **   finalRules;
+static int                    finalRulesCount;
+
+#endif
+
 static struct lookup const *	byword P((const char * string,
 					const struct lookup * lp));
 
@@ -342,6 +374,11 @@
 	unsigned char	type;
 }			attypes[TZ_MAX_TIMES];
 static long		gmtoffs[TZ_MAX_TYPES];
+#ifdef ICU
+/* gmtoffs[i] = rawoffs[i] + dstoffs[i] */
+static long		rawoffs[TZ_MAX_TYPES];
+static long		dstoffs[TZ_MAX_TYPES];
+#endif
 static char		isdsts[TZ_MAX_TYPES];
 static unsigned char	abbrinds[TZ_MAX_TYPES];
 static char		ttisstds[TZ_MAX_TYPES];
@@ -451,6 +488,62 @@
 	(void) exit(EXIT_FAILURE);
 }
 
+#ifdef ICU
+
+/* File into which we will write supplemental ICU data. */
+static FILE *                 icuFile;
+
+void emit_icu_zone(FILE* f, const char* zoneName, int zoneOffset,
+                   const struct rule* rule,
+                   int ruleIndex, int startYear) {
+    /* machine-readable section */
+    fprintf(f, "zone %s %d %d %s", zoneName, zoneOffset, startYear, rule->r_name);
+
+    /* human-readable section */
+    fprintf(f, " # zone %s, offset %d, year >= %d, rule %s (%d)\n",
+            zoneName, zoneOffset, startYear,
+            rule->r_name, ruleIndex);
+}
+
+void emit_icu_link(FILE* f, const char* from, const char* to) {
+    /* machine-readable section */
+    fprintf(f, "link %s %s\n", from, to);
+}
+
+static const char* DYCODE[] = {"DOM", "DOWGEQ", "DOWLEQ"};
+
+void emit_icu_rule(FILE* f, const struct rule* r, int ruleIndex) {
+    if (r->r_yrtype != NULL) {
+        warning("year types not supported by ICU");
+        fprintf(stderr, "rule %s, file %s, line %d\n",
+                r->r_name, r->r_filename, r->r_linenum);
+    }
+
+    /* machine-readable section */
+    fprintf(f, "rule %s %s %d %d %d %d %d %d %d",
+            r->r_name, DYCODE[r->r_dycode],
+            r->r_month, r->r_dayofmonth,
+            (r->r_dycode == DC_DOM ? -1 : r->r_wday),
+            r->r_tod, r->r_todisstd, r->r_todisgmt, r->r_stdoff
+            );
+
+    /* human-readable section */
+    fprintf(f, " # %d: %s, file %s, line %d",
+            ruleIndex, r->r_name, r->r_filename, r->r_linenum);
+    fprintf(f, ", mode %s", DYCODE[r->r_dycode]);
+    fprintf(f, ", %s, dom %d", mon_names[r->r_month].l_word, r->r_dayofmonth);
+    if (r->r_dycode != DC_DOM) {
+        fprintf(f, ", %s", wday_names[r->r_wday].l_word);
+    }
+    fprintf(f, ", time %d", r->r_tod);
+    fprintf(f, ", isstd %d", r->r_todisstd);
+    fprintf(f, ", isgmt %d", r->r_todisgmt);
+    fprintf(f, ", offset %ld", r->r_stdoff);
+    fprintf(f, "\n");
+}
+
+#endif
+
 static const char *	psxrules;
 static const char *	lcltime;
 static const char *	directory;
@@ -553,6 +646,14 @@
 		adjleap();
 	}
 
+#ifdef ICU
+	if ((icuFile = fopen(ICU_ZONE_FILE, "w")) == NULL) {
+            const char *e = strerror(errno);
+            (void) fprintf(stderr, _("%s: Can't open %s: %s\n"),
+                           progname, ICU_ZONE_FILE, e);
+            (void) exit(EXIT_FAILURE);
+        }
+#endif
 	for (i = optind; i < argc; ++i)
 		infile(argv[i]);
 	if (errors)
@@ -572,6 +673,9 @@
 	for (i = 0; i < nlinks; ++i) {
 		eat(links[i].l_filename, links[i].l_linenum);
 		dolink(links[i].l_from, links[i].l_to);
+#ifdef ICU
+                emit_icu_link(icuFile, links[i].l_from, links[i].l_to);
+#endif
 	}
 	if (lcltime != NULL) {
 		eat("command line", 1);
@@ -581,6 +685,11 @@
 		eat("command line", 1);
 		dolink(psxrules, TZDEFRULES);
 	}
+#ifdef ICU
+        for (i=0; i<finalRulesCount; ++i) {
+            emit_icu_rule(icuFile, finalRules[i], i);
+        }
+#endif /*ICU*/
 	return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
 }
 
@@ -641,7 +750,9 @@
 			(void) fprintf(stderr,
 				_("%s: Can't link from %s to %s: %s\n"),
 				progname, fromname, toname, e);
+#ifndef ICU_LINKS
 			(void) exit(EXIT_FAILURE);
+#endif
 		}
 	}
 	ifree(fromname);
@@ -1499,7 +1610,12 @@
 	convert(eitol(timecnt), tzh.tzh_timecnt);
 	convert(eitol(typecnt), tzh.tzh_typecnt);
 	convert(eitol(charcnt), tzh.tzh_charcnt);
+#ifdef ICU
+        * (ICUZoneinfoVersion*) &tzh.tzh_reserved = TZ_ICU_VERSION;
+	(void) strncpy(tzh.tzh_magic, TZ_ICU_MAGIC, sizeof tzh.tzh_magic);
+#else
 	(void) strncpy(tzh.tzh_magic, TZ_MAGIC, sizeof tzh.tzh_magic);
+#endif
 #define DO(field)	(void) fwrite((void *) tzh.field, (size_t) sizeof tzh.field, (size_t) 1, fp)
 	DO(tzh_magic);
 	DO(tzh_reserved);
@@ -1523,7 +1639,12 @@
 		(void) fwrite((void *) types, (size_t) sizeof types[0],
 			(size_t) timecnt, fp);
 	for (i = 0; i < typecnt; ++i) {
+#ifdef ICU
+		puttzcode((long) rawoffs[i], fp);
+		puttzcode((long) dstoffs[i], fp);
+#else
 		puttzcode((long) gmtoffs[i], fp);
+#endif
 		(void) putc(isdsts[i], fp);
 		(void) putc(abbrinds[i], fp);
 	}
@@ -1579,6 +1700,24 @@
 	}
 }
 
+#ifdef ICU
+
+int add_icu_final_rules(const struct rule* r1, const struct rule* r2) {
+    int i;
+
+    for (i=0; i<finalRulesCount; ++i) { /* i+=2 should work too */
+        if (r1==finalRules[i]) return i; /* [sic] pointer comparison */
+    }
+
+    finalRules = (const struct rule**) (void*) erealloc((char *) finalRules,
+                 (finalRulesCount + 2) * sizeof(*finalRules));
+    finalRules[finalRulesCount++] = r1;
+    finalRules[finalRulesCount++] = r2;
+    return finalRulesCount - 2;
+}
+
+#endif /*ICU*/
+
 static void
 outzone(zpfirst, zonecount)
 const struct zone * const	zpfirst;
@@ -1597,6 +1736,11 @@
 	register int			startttisgmt;
 	register int			type;
 	char				startbuf[BUFSIZ];
+#ifdef ICU
+        int                  finalRuleYear, finalRuleIndex;
+        const struct rule*   finalRule1;
+        const struct rule*   finalRule2;
+#endif
 
 	INITIALIZE(untiltime);
 	INITIALIZE(starttime);
@@ -1626,11 +1770,55 @@
 		eat(zp->z_filename, zp->z_linenum);
 		*startbuf = '\0';
 		startoff = zp->z_gmtoff;
+#ifdef ICU
+                finalRuleYear = finalRuleIndex = -1;
+                finalRule1 = finalRule2 = NULL;
+                if (i == (zonecount - 1)) { /* !useuntil */
+                    /* Look for exactly 2 rules that end at 'max' and
+                     * note them. Determine max(r_loyear) for the 2 of
+                     * them. */
+                    for (j=0; j<zp->z_nrules; ++j) {
+                        rp = &zp->z_rules[j];
+                        if (rp->r_hiyear == INT_MAX) {
+                            if (finalRule1 == NULL) {
+                                finalRule1 = rp;
+                                finalRuleYear = rp->r_loyear;
+                            } else if (finalRule2 == NULL) {
+                                finalRule2 = rp;
+                                if (rp->r_loyear > finalRuleYear) {
+                                    finalRuleYear = rp->r_loyear;
+                                }
+                            } else {
+                                error("more than two max rules found (ICU)");
+                                exit(EXIT_FAILURE);
+                            }
+                        }
+                    }
+                    if (finalRule1 != NULL && finalRule2 == NULL) {
+                        error("only one max rule found (ICU)");
+                        exit(EXIT_FAILURE);
+                    }
+                    if (finalRule1 != NULL) {
+                        /* Swap if necessary so finalRule1 occurs before
+                         * finalRule2 */
+                        if (finalRule1->r_month > finalRule2->r_month) {
+                            const struct rule* t = finalRule1;
+                            finalRule1 = finalRule2;
+                            finalRule2 = t;
+                        }
+                        /* Add final rule to our list */
+                        finalRuleIndex = add_icu_final_rules(finalRule1, finalRule2);
+                    }
+                }
+#endif
 		if (zp->z_nrules == 0) {
 			stdoff = zp->z_stdoff;
 			doabbr(startbuf, zp->z_format,
 				(char *) NULL, stdoff != 0);
 			type = addtype(oadd(zp->z_gmtoff, stdoff),
+#ifdef ICU
+                                zp->z_gmtoff, stdoff,
+#endif
 				startbuf, stdoff != 0, startttisstd,
 				startttisgmt);
 			if (usestart) {
@@ -1704,6 +1892,15 @@
 					break;	/* go on to next year */
 				rp = &zp->z_rules[k];
 				rp->r_todo = FALSE;
+#ifdef ICU
+                                if (year >= finalRuleYear && rp == finalRule1) {
+                                    emit_icu_zone(icuFile,
+                                                  zpfirst->z_name, zp->z_gmtoff,
+                                                  rp, finalRuleIndex, year);
+                                    /* only emit this for the first year */
+                                    finalRule1 = NULL;
+                                }
+#endif
 				if (useuntil && ktime >= untiltime)
 					break;
 				stdoff = rp->r_stdoff;
@@ -1731,8 +1928,14 @@
 				doabbr(buf, zp->z_format, rp->r_abbrvar,
 					rp->r_stdoff != 0);
 				offset = oadd(zp->z_gmtoff, rp->r_stdoff);
+#ifdef ICU
+				type = addtype(offset, zp->z_gmtoff, rp->r_stdoff,
+                                        buf, rp->r_stdoff != 0,
+					rp->r_todisstd, rp->r_todisgmt);
+#else
 				type = addtype(offset, buf, rp->r_stdoff != 0,
 					rp->r_todisstd, rp->r_todisgmt);
+#endif
 				addtt(ktime, type);
 			}
 		}
@@ -1746,10 +1949,19 @@
 			if (*startbuf == '\0')
 error(_("can't determine time zone abbreviation to use just after until time"));
 			else	addtt(starttime,
+#ifdef ICU
+					addtype(startoff,
+                                                zp->z_gmtoff, startoff - zp->z_gmtoff,
+                                                startbuf,
+						startoff != zp->z_gmtoff,
+						startttisstd,
+						startttisgmt));
+#else
 					addtype(startoff, startbuf,
 						startoff != zp->z_gmtoff,
 						startttisstd,
 						startttisgmt));
+#endif
 		}
 		/*
 		** Now we may get to set starttime for the next zone line.
@@ -1775,6 +1987,10 @@
 	if (starttime <= min_time ||
 		(timecnt == 1 && attypes[0].at < min_time)) {
 		gmtoffs[0] = gmtoffs[type];
+#ifdef ICU
+		rawoffs[0] = rawoffs[type];
+		dstoffs[0] = dstoffs[type];
+#endif
 		isdsts[0] = isdsts[type];
 		ttisstds[0] = ttisstds[type];
 		ttisgmts[0] = ttisgmts[type];
@@ -1796,8 +2012,15 @@
 }
 
 static int
+#ifdef ICU
+addtype(gmtoff, rawoff, dstoff, abbr, isdst, ttisstd, ttisgmt)
+const long		gmtoff;
+const long		rawoff;
+const long		dstoff;
+#else
 addtype(gmtoff, abbr, isdst, ttisstd, ttisgmt)
 const long		gmtoff;
+#endif
 const char * const	abbr;
 const int		isdst;
 const int		ttisstd;
@@ -1817,12 +2040,25 @@
 		error(_("internal error - addtype called with bad ttisgmt"));
 		(void) exit(EXIT_FAILURE);
 	}
+#ifdef ICU
+	if (isdst != (dstoff != 0)) {
+		error(_("internal error - addtype called with bad isdst/dstoff"));
+		(void) exit(EXIT_FAILURE);
+	}
+        if (gmtoff != (rawoff + dstoff)) {
+		error(_("internal error - addtype called with bad gmt/raw/dstoff"));
+		(void) exit(EXIT_FAILURE);
+        }
+#endif
 	/*
 	** See if there's already an entry for this zone type.
 	** If so, just return its index.
 	*/
 	for (i = 0; i < typecnt; ++i) {
 		if (gmtoff == gmtoffs[i] && isdst == isdsts[i] &&
+#ifdef ICU
+                        rawoff == rawoffs[i] && dstoff == dstoffs[i] &&
+#endif
 			strcmp(abbr, &chars[abbrinds[i]]) == 0 &&
 			ttisstd == ttisstds[i] &&
 			ttisgmt == ttisgmts[i])
@@ -1837,6 +2073,10 @@
 		(void) exit(EXIT_FAILURE);
 	}
 	gmtoffs[i] = gmtoff;
+#ifdef ICU
+        rawoffs[i] = rawoff;
+        dstoffs[i] = dstoff;
+#endif
 	isdsts[i] = isdst;
 	ttisstds[i] = ttisstd;
 	ttisgmts[i] = ttisgmt;

--- NEW FILE: readme.txt ---
**********************************************************************
* Copyright (c) 2003, International Business Machines
* Corporation and others.  All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: August 18 2003
* Since: ICU 2.8
**********************************************************************

----------------------------------------------------------------------
OVERVIEW

This file describes the tools in icu/source/tools/gentz/tzcode

The purpose of these tools is to process the zoneinfo or "Olson" time
zone database into a form usable by ICU4C (release 2.8 and later).
Unlike earlier releases, ICU4C 2.8 supports historical time zone
behavior, as well as the full set of Olson compatibility IDs.

References:

ICU4C:  http://oss.software.ibm.com/icu/
Olson:  ftp://elsie.nci.nih.gov/pub/

----------------------------------------------------------------------
ICU4C vs. ICU4J

As of release 2.8, the ICU time zone implementations in C and Java
have diverged for various reasons.  The C implementation is a full
implementation, whereas ICU4J (as of 2.8) uses the underlying JDK
1.3 or 1.4 time zone implementation.

The "present day snapshot" only reflects current time zone behavior,
without historical variation.  Furthermore, it lacks the full set of
Olson compatibility IDs.  The "present day snapshot" is implemented in
ICU (C and Java) <= 2.6.

----------------------------------------------------------------------
BACKGROUND

The zoneinfo or "Olson" time zone package is used by various systems
to describe the behavior of time zones.  The package consists of
several parts.  E.g.:

  Index of ftp://elsie.nci.nih.gov/pub/

  classictzcode.tar.gz    65 KB        12/10/1994    12:00:00 AM
  classictzdata.tar.gz    67 KB        12/10/1994    12:00:00 AM
  e5+57.tar.gz            2909 KB      3/22/1993     12:00:00 AM
  iso8601.ps.gz           16 KB        7/27/1996     12:00:00 AM
  leastsq.xls             49 KB        4/24/1997     12:00:00 AM
  ltroff.tar.gz           36 KB        7/16/1993     12:00:00 AM
  pi.shar.gz              4 KB         3/9/1994      12:00:00 AM
  tzarchive.gz            3412 KB      8/18/2003     4:00:00 AM
  tzcode2003a.tar.gz      98 KB        3/24/2003     2:32:00 PM
  tzdata2003a.tar.gz      132 KB       3/24/2003     2:32:00 PM

ICU only uses the tzcodeYYYYV.tar.gz and tzdataYYYYV.tar.gz files,
where YYYY is the year and V is the version letter ('a'...'z').

----------------------------------------------------------------------
HOWTO

1. Obtain the current versions of tzcodeYYYYV.tar.gz (aka `tzcode')
   and tzdataYYYYV.tar.gz (aka `tzdata') from the FTP site given
   above.  Either manually download or use wget:

   $ cd {path_to}/icu/source/tools/gentz/tzcode
   $ wget "ftp://elsie.nci.nih.gov/pub/tz*.tar.gz"

2. Unpack tzcode and tzdata directly into the directory gentz/tzcode:

   $ tar xzvf tzcode*.tar.gz
   $ tar xzvf tzdata*.tar.gz

3. Apply the ICU patch to zic.c:

   $ patch < patch-icu-tzcode

   If patch complains at this point, there is a mismatch that must be
   manually addressed.  See the CVS log of `patch-icu-tzcode' for
   version details.

4. Build:

   $ make icu_data

5. Copy the data file to the correct location in the ICU source tree:

   $ cp zoneinfo.txt ../../../data/misc/

6. Rebuild ICU:

   $ cd ../../../
   $ {*make}

7. Don't forget to check in the new zoneinfo.txt (from its location at
   {path_to}/icu/source/data/misc/zoneinfo.txt) into CVS.

----------------------------------------------------------------------
eof

--- NEW FILE: tz.alias ---
######################################################################
# Copyright (C) 1999-2003, International Business Machines
# Corporation and others.  All Rights Reserved.
######################################################################
# A simple alias list. We use this to retain backward compatibility.
# For example, ICU has always defined the zone name "PST" to indicate
# the zone America/Los_Angeles. Unless we continue to have a zone with
# this ID, legacy code may break.
# 
# This list is read by tz2icu to incorporate legacy ICU zone aliases
# into the ICU system zone data.
#
# Format: alias_name unix_name # optional comment

#### Aliases that conflict with Olson compatibility links

ACT Australia/Darwin
AET Australia/Sydney
AGT America/Buenos_Aires
ART Africa/Cairo
AST America/Anchorage
BET America/Sao_Paulo
BST Asia/Dhaka # spelling changed in 2000h; was Asia/Dacca
CAT Africa/Harare
CNT America/St_Johns
CST America/Chicago
CTT Asia/Shanghai
EAT Africa/Addis_Ababa
ECT Europe/Paris
# EET Europe/Istanbul # EET is a standard UNIX zone
#### EST America/New_York # Linked to America/Indianapolis in Olson
# HST Pacific/Honolulu # Olson LINK
IET America/Indianapolis
IST Asia/Calcutta
JST Asia/Tokyo
# MET Asia/Tehran # MET is a standard UNIX zone
MIT Pacific/Apia
#### MST America/Denver # Linked to America/Phoenix in Olson
NET Asia/Yerevan
NST Pacific/Auckland
PLT Asia/Karachi
PNT America/Phoenix
PRT America/Puerto_Rico
PST America/Los_Angeles
SST Pacific/Guadalcanal
# UTC Etc/UTC # Olson LINK
VST Asia/Saigon

--- NEW FILE: tz2icu.cpp ---
/*
**********************************************************************
* Copyright (c) 2003, International Business Machines
* Corporation and others.  All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: July 10 2003
* Since: ICU 2.8
**********************************************************************
*/
#include "tzfile.h" // from Olson tzcode archive, copied to this dir

#ifdef WIN32

 #include <windows.h>
 #undef min // windows.h/STL conflict
 #undef max // windows.h/STL conflict
 // "identifier was truncated to 'number' characters" warning
 #pragma warning(disable: 4786)
[...1508 lines suppressed...]
        }
        java << endl
             << "  };" << endl;

        java << "}" << endl;
    }

    java.close();

    if (java) { // recheck error bit
        cout << "Finished writing " ICU4J_TZ_CLASS ".java" << endl;
    } else {
        cerr << "Error: Unable to open/write to " ICU4J_TZ_CLASS ".java" << endl;
        return 1;
    }

    return 0;
}

//eof

--- NEW FILE: tz2icu.h ---
/*
**********************************************************************
* Copyright (c) 2003, International Business Machines
* Corporation and others.  All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: July 10 2003
* Since: ICU 2.8
**********************************************************************
*/

#ifndef _TZ2ICU_H_
#define _TZ2ICU_H_

/* We have modified the zoneinfo binary format (we write raw offset
 * and DST offset separately instead of their sum) so we notate the
 * file with a distinct signature.  This prevents someone from trying
 * to use our output files as normal zoneinfo files, and also prevents
 * someone from trying to use normal zoneinfo files for ICU.  We also
 * use the first byte of the reserved section as a version integer, to
 * be incremented each time the data format changes.
 */

#define TZ_ICU_MAGIC "TZic" /* cf. TZ_MAGIC = "TZif" */

typedef unsigned char ICUZoneinfoVersion;

#define TZ_ICU_VERSION ((ICUZoneinfoVersion) 1)

/* File into which we will write supplemental ICU data.  This allows
 * zic to communicate final zone data to tz2icu. */
#define ICU_ZONE_FILE "icu_zone.txt"

/* File containing legacy aliases.  Read by tz2icu. */
#define ICU_TZ_ALIAS  "tz.alias"

/* Output resource name.  This determines both the file name and the
 * resource name within the file.  That is, the output will be to the
 * file ICU_TZ_RESOURCE ".txt" and the resource within it will be
 * ICU_TZ_RESOURCE. */
#define ICU_TZ_RESOURCE "zoneinfo"

#endif