summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2007-02-12 15:17:50 +0000
committerAndrew Haley <aph@redhat.com>2007-02-12 15:17:50 +0000
commit9bbbb4d119fdf6305f20f62f45e4d4bd0478d3d6 (patch)
tree920c56be757c4de6abd53dd0718f0929cd679e62 /scripts
parent15545182f57eba7093498633a401f19014c4609a (diff)
downloadclasspath-9bbbb4d119fdf6305f20f62f45e4d4bd0478d3d6.tar.gz
2007-02-12 Jakub Jelinek <jakub@redhat.com>
PR 23566 * scripts/timezones.pl: Parse each file in 2 passes, in one parse just Rule lines, in the other everything else. Pass 0 instead of $savings as second argument to parseRule when parsing the start rule. * java/util/TimeZone.java (timezones): Regenerate from tzdata2007a. 2007-02-12 Jakub Jelinek <jakub@redhat.com> * vm/reference/java/util/VMTimeZone.java: Rewrite to handle both the old 'TZif\0' format and the new one. * java/util/TimeZone.java: Handle default (one hour) daylight savings.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/timezones.pl35
1 files changed, 34 insertions, 1 deletions
diff --git a/scripts/timezones.pl b/scripts/timezones.pl
index 142ea4b75..a069dedf6 100755
--- a/scripts/timezones.pl
+++ b/scripts/timezones.pl
@@ -213,6 +213,10 @@ foreach $file (@TIMEZONEFILES) {
# print STDERR "$file\n";
open INPUT, "$TIMEZONEDIR/$file" or die "Can't open $TIMEZONEDIR/$file";
my $in_time_zone = 0;
+ # As Zone can reference even Rule which is defined after the
+ # current line, parse the file in 2 passes.
+
+ # First pass, parse just Rule lines:
while (<INPUT>) {
$_ = $1 if /^([^\#]*)\#/;
next if /^\s*$/;
@@ -239,6 +243,35 @@ foreach $file (@TIMEZONEFILES) {
} elsif ($entries[0] eq "Zone") {
$in_time_zone = 1;
shift @entries;
+ shift @entries;
+ } elsif (!(($entries[0] eq "Remove") || ($entries[0] eq "Link"))) {
+ die "Unknown command: $_";
+ }
+ }
+ if ($in_time_zone) {
+ die "early end of Zone: $_" if ($entries[0] =~ /^[A-Za-z]+/);
+ if (@entries <= 3) {
+ $in_time_zone = 0;
+ }
+ }
+ }
+ close INPUT;
+ open INPUT, "$TIMEZONEDIR/$file" or die "Can't open $TIMEZONEDIR/$file";
+ $in_time_zone = 0;
+
+ # Second pass, parse all but Rule lines.
+ while (<INPUT>) {
+ $_ = $1 if /^([^\#]*)\#/;
+ next if /^\s*$/;
+ my @entries = split;
+# $, = ","; print "'$_' -> [",@entries,"]\n";
+ if (!$in_time_zone) {
+ if ($entries[0] eq "Rule") {
+ # Do nothing, this was already handled in the
+ # first pass.
+ } elsif ($entries[0] eq "Zone") {
+ $in_time_zone = 1;
+ shift @entries;
$timezonename = shift @entries;
} elsif ($entries[0] eq "Remove") {
my $found = 0;
@@ -295,7 +328,7 @@ foreach $file (@TIMEZONEFILES) {
my $savings = $rule->[2];
my $endrule = parseRule($rawoffset, $savings,
$rule->[0]);
- my $startrule = parseRule($rawoffset, $savings,
+ my $startrule = parseRule($rawoffset, 0,
$rule->[1]);
$rule = [ $endrule, $startrule, $savings ];
# print "start",@{$rule->[1]}, "end", @{$rule->[0]},