libkcal
vzic.h
Go to the documentation of this file.00001 /* 00002 * Vzic - a program to convert Olson timezone database files into VZTIMEZONE 00003 * files compatible with the iCalendar specification (RFC2445). 00004 * 00005 * Copyright (C) 2000-2001 Ximian, Inc. 00006 * Copyright (C) 2003 Damon Chaplin. 00007 * 00008 * Author: Damon Chaplin <damon@gnome.org> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; either version 2 of the License, or 00013 * (at your option) any later version. 00014 * 00015 * This program is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00018 * GNU General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU General Public License 00021 * along with this program; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 00023 */ 00024 00025 #ifndef _VZIC_H_ 00026 #define _VZIC_H_ 00027 00028 #include <glib.h> 00029 00030 00031 /* 00032 * Global command-line options. 00033 */ 00034 00035 /* By default we output Outlook-compatible output. If --pure is used we output 00036 pure output, with no changes to be compatible with Outlook. */ 00037 extern gboolean VzicPureOutput; 00038 00039 extern gboolean VzicDumpOutput; 00040 extern gboolean VzicDumpChanges; 00041 extern gboolean VzicDumpZoneNamesAndCoords; 00042 extern gboolean VzicDumpZoneTranslatableStrings; 00043 extern gboolean VzicNoRRules; 00044 extern gboolean VzicNoRDates; 00045 extern char* VzicUrlPrefix; 00046 00047 extern GList* VzicTimeZoneNames; 00048 00049 /* The minimum & maximum years we can use. */ 00050 #define YEAR_MINIMUM G_MININT 00051 #define YEAR_MAXIMUM G_MAXINT 00052 00053 /* The maximum size of any complete pathname. */ 00054 #define PATHNAME_BUFFER_SIZE 1024 00055 00056 /* Days can be expressed either as a simple month day number, 1-31, or a rule 00057 such as the last Sunday, or the first Monday on or after the 8th. */ 00058 typedef enum 00059 { 00060 DAY_SIMPLE, 00061 DAY_WEEKDAY_ON_OR_AFTER, 00062 DAY_WEEKDAY_ON_OR_BEFORE, 00063 DAY_LAST_WEEKDAY 00064 } DayCode; 00065 00066 00067 /* Times can be given either as universal time (UTC), local standard time 00068 (without daylight-saving adjustments) or wall clock time (local standard 00069 time plus daylight-saving adjustments, i.e. what you would see on a clock 00070 on the wall!). */ 00071 typedef enum 00072 { 00073 TIME_WALL, 00074 TIME_STANDARD, 00075 TIME_UNIVERSAL 00076 } TimeCode; 00077 00078 00079 /* This represents one timezone, e.g. "Africa/Algiers". 00080 It contains the timezone name, and an array of ZoneLineData structs which 00081 hold data from each Zone line, including the continuation lines. */ 00082 typedef struct _ZoneData ZoneData; 00083 struct _ZoneData 00084 { 00085 char *zone_name; 00086 00087 /* An array of ZoneLineData, one for each Zone & Zone continuation line 00088 read in. */ 00089 GArray *zone_line_data; 00090 }; 00091 00092 00093 typedef struct _ZoneLineData ZoneLineData; 00094 struct _ZoneLineData 00095 { 00096 /* The amount of time to add to UTC to get local standard time for the 00097 current time range, in seconds. */ 00098 int stdoff_seconds; 00099 00100 /* Either rules is set to the name of a set of rules, or rules is NULL and 00101 save is set to the time to add to local standard time to get wall time, in 00102 seconds. If save is 0 as well, then standard time always applies. */ 00103 char *rules; 00104 int save_seconds; 00105 00106 /* The format to use for the abbreviated timezone name, e.g. WE%sT. 00107 The %s is replaced by variable part of the name. (See the letter_s field 00108 in the RuleData struct below). */ 00109 char *format; 00110 00111 /* TRUE if an UNTIL time is given. */ 00112 gboolean until_set; 00113 00114 /* The UNTIL year, e.g. 2000. */ 00115 int until_year; 00116 00117 /* The UNTIL month 0 (Jan) to 11 (Dec). */ 00118 int until_month; 00119 00120 /* The UNTIL day, either a simple month day number, 1-31, or a rule such as 00121 the last Sunday, or the first Monday on or after the 8th. */ 00122 DayCode until_day_code; 00123 int until_day_number; /* 1 to 31. */ 00124 int until_day_weekday; /* 0 (Sun) to 6 (Sat). */ 00125 00126 /* The UNTIL time, in seconds from midnight. The code specifies whether the 00127 time is a wall clock time, local standard time, or universal time. */ 00128 int until_time_seconds; 00129 TimeCode until_time_code; 00130 }; 00131 00132 00133 typedef struct _RuleData RuleData; 00134 struct _RuleData 00135 { 00136 /* The first year that the rule applies to, e.g. 1996. 00137 Can also be YEAR_MINIMUM. */ 00138 int from_year; 00139 00140 /* The last year that the rule applies to, e.g. 1996. 00141 Can also be YEAR_MAXIMUM. */ 00142 int to_year; 00143 00144 /* A string used to only match certain years between from and to. 00145 The rule only applies to the years which match. If type is NULL the rule 00146 applies to all years betweeen from and to. 00147 zic uses an external program called yearistype to check the string. 00148 Currently it is not used in the Olson database. */ 00149 char *type; 00150 00151 /* The month of the rule 0 (Jan) to 11 (Dec). */ 00152 int in_month; 00153 00154 /* The day, either a simple month day number, 1-31, or a rule such as 00155 the last Sunday, or the first Monday on or after the 8th. */ 00156 DayCode on_day_code; 00157 int on_day_number; 00158 int on_day_weekday; /* 0 (Sun) to 6 (Sat). */ 00159 00160 /* The time, in seconds from midnight. The code specifies whether the 00161 time is a wall clock time, local standard time, or universal time. */ 00162 int at_time_seconds; 00163 TimeCode at_time_code; 00164 00165 /* The amount of time to add to local standard time when the rule is in 00166 effect, in seconds. If this is not 0 then it must be a daylight-saving 00167 time. */ 00168 int save_seconds; 00169 00170 /* The letter(s) to use as the variable part in the abbreviated timezone 00171 name. If this is NULL then no variable part is used. (See the format field 00172 in the ZoneLineData struct above.) */ 00173 char *letter_s; 00174 00175 00176 /* This is set to TRUE if this element is a shallow copy of another one, 00177 in which case we don't free any of the fields. */ 00178 gboolean is_shallow_copy; 00179 }; 00180 00181 00182 typedef struct _ZoneDescription ZoneDescription; 00183 struct _ZoneDescription 00184 { 00185 /* 2-letter ISO 3166 country code. */ 00186 char country_code[2]; 00187 00188 /* latitude and longitude in degrees, minutes & seconds. The degrees value 00189 holds the sign of the entire latitude/longitude. */ 00190 int latitude[3]; 00191 int longitude[3]; 00192 00193 char *comment; 00194 }; 00195 00196 #endif /* _VZIC_H_ */