1 # Convert tzdata source into vanguard or rearguard form.
3 # Contributed by Paul Eggert. This file is in the public domain.
5 # This is not a general-purpose converter; it is designed for current tzdata.
7 # When converting to vanguard form, the output can use negative SAVE
10 # When converting to rearguard form, the output uses only nonnegative
11 # SAVE values. The idea is for the output data to simulate the behavior
12 # of the input data as best it can within the constraints of the
16 dataform_type
["vanguard"] =
1
17 dataform_type
["main"] =
1
18 dataform_type
["rearguard"] =
1
20 # The command line should set DATAFORM.
21 if (!dataform_type
[DATAFORM
]) exit 1
22 vanguard = DATAFORM ==
"vanguard"
29 uncomment = comment_out =
0
31 # If the line should differ due to Czechoslovakia using negative SAVE values,
32 # uncomment the desired version and comment out the undesired one.
33 if (zone ==
"Europe/Prague" && /1947 Feb
23/) {
34 if (($
(in_comment
+ 2) != "-") == vanguard
) {
35 uncomment = in_comment
37 comment_out = !in_comment
41 # If this line should differ due to Ireland using negative SAVE values,
42 # uncomment the desired version and comment out the undesired one.
43 Rule_Eire =
/^
#?Rule[\t ]+Eire[\t ]/
44 Zone_Dublin_post_1968 \
45 =
(zone ==
"Europe/Dublin" && /^
#?[\t ]+[01]:00[\t ]/ \
46 && (!$
(in_comment
+ 4) || 1968 < $
(in_comment
+ 4)))
47 if (Rule_Eire
|| Zone_Dublin_post_1968
) {
49 || (Zone_Dublin_post_1968
&& $
(in_comment
+ 3) ==
"IST/GMT")) \
51 uncomment = in_comment
53 comment_out = !in_comment
57 # If this line should differ due to Namibia using Rule SAVE suffixes,
58 # uncomment the desired version and comment out the undesired one.
59 Rule_Namibia =
/^
#?Rule[\t ]+Namibia[\t ]/
60 Zone_using_Namibia_rule \
61 =
(zone ==
"Africa/Windhoek" \
62 && ($
(in_comment
+ 2) ==
"Namibia" \
63 || (1994 <= $
(in_comment
+ 4) && $
(in_comment
+ 4) <=
2017) \
64 || in_comment
+ 3 ==
NF))
65 if (Rule_Namibia
|| Zone_using_Namibia_rule
) {
67 ?
($
(in_comment
+ 9) ~
/^
-/ \
68 || ($
(in_comment
+ 9) ==
0 && $
(in_comment
+ 10) ==
"CAT")) \
69 : $
(in_comment
+ 1) ==
"2:00" && $
(in_comment
+ 2) ==
"Namibia") \
71 uncomment = in_comment
73 comment_out = !in_comment
84 # In rearguard format, change the Japan rule line with "Sat>=8 25:00"
85 # to "Sun>=9 1:00", to cater to zic before 2007 and to older Java.
86 if (!vanguard
&& $
1 ==
"Rule" && $
7 ==
"Sat>=8" && $
8 ==
"25:00") {
87 sub(/Sat
>=
8/, "Sun>=9")
92 # If a Link line is followed by a Zone line for the same data, comment
93 # out the Link line. This can happen if backzone overrides a Link
99 sub(/^Link
/, "#Link", line
[linkline
[$
2]])
105 for (i =
1; i
<=
NR; i
++)