CUBRID Engine  latest
tz_compile.c File Reference
#include "config.h"
#include <stdio.h>
#include <assert.h>
#include "tz_support.h"
#include "authenticate.h"
#include "porting.h"
#include "byte_order.h"
#include "utility.h"
#include "db_date.h"
#include "environment_variable.h"
#include "chartype.h"
#include "error_manager.h"
#include "memory_alloc.h"
#include "tz_compile.h"
#include "xml_parser.h"
#include "crypt_opfunc.h"
#include "db_query.h"
#include "dbtype.h"
Include dependency graph for tz_compile.c:

Go to the source code of this file.

Classes

struct  tz_file_descriptor
 
struct  tz_raw_country
 
struct  tz_raw_link
 
struct  tz_raw_offset_rule
 
struct  tz_raw_zone_info
 
struct  tz_raw_ds_rule
 
struct  tz_raw_ds_ruleset
 
struct  tz_raw_context
 
struct  tz_raw_data
 
struct  offset_rule_interval
 

Macros

#define strlen(s1)   ((int) strlen(s1))
 
#define TZ_FILENAME_MAX_LEN   17
 
#define TZ_MAX_LINE_LEN   512
 
#define TZ_OFFRULE_PREFIX_TAB_COUNT   3
 
#define TZ_COORDINATES_MAX_SIZE   16
 
#define TZ_COMMENTS_MAX_SIZE   92
 
#define TZ_RULE_LETTER_ABBREV_MAX_SIZE   8
 
#define TZ_RULE_TYPE_MAX_SIZE   4
 
#define PATH_PARTIAL_TIMEZONES_FILE   "timezones/tzlib/timezones.c"
 
#define TZ_CAL_ABBREV_SIZE   4
 
#define STR_SKIP_LEADING_SPACES(str)
 
#define TZC_ERR_GENERIC   -1
 
#define TZC_ERR_INVALID_PACKAGE   -2
 
#define TZC_ERR_BAD_TZ_LINK   -3
 
#define TZC_ERR_OUT_OF_MEMORY   -4
 
#define TZC_ERR_INVALID_VALUE   -5
 
#define TZC_ERR_INVALID_TIME   -6
 
#define TZC_ERR_ZONE_RULE_UNORDERED   -7
 
#define TZC_ERR_INVALID_DATETIME   -8
 
#define TZC_ERR_INVALID_DS_RULE   -9
 
#define TZC_ERR_CANT_READ_VALUE   -10
 
#define TZC_ERR_PARSING_FAILED   -11
 
#define TZC_ERR_DS_INVALID_DATE   -12
 
#define TZC_ERR_FILE_NOT_ACCESSIBLE   -13
 
#define TZC_ERR_INVALID_COUNTRY   -14
 
#define TZC_ERR_INVALID_ZONE   -15
 
#define TZC_ERR_ADD_ZONE   -16
 
#define TZC_ERR_LINKING_TRUE_ZONES   -17
 
#define TZC_ERR_LAST_ERROR   -18
 
#define LOG_TZC_SET_CURRENT_CONTEXT(tzd_raw, f, l)
 
#define TZC_ERR_MSG_MAX_SIZE   512
 
#define TZC_CONTEXT(tzd_raw)   (&((tzd_raw)->context))
 
#define TZC_LOG_ERROR_1ARG(context, err_code, s1)   tzc_log_error ((context), (err_code), (s1), "")
 
#define TZC_LOG_ERROR_2ARG(context, err_code, s1, s2)   tzc_log_error ((context), (err_code), (s1), (s2))
 
#define DUPLICATE_STR(a, b)
 
#define INIT_COUNTRY(dst, src)
 
#define PRINT_STRING_TO_C_FILE(fp, val, len)
 
#define PRINT_STRING_VAR_TO_C_FILE(fp, valname, val)
 
#define BUF_PUT_INT32(buf, v)
 
#define BUF_PUT_INT16(buf, v)
 
#define ABS(i)   ((i) >= 0 ? (i) : -(i))
 
#define MAX_DS_CHANGES_YEAR   1000
 

Typedefs

typedef struct tz_file_descriptor TZ_FILE_DESCRIPTOR
 
typedef struct tz_raw_country TZ_RAW_COUNTRY
 
typedef struct tz_raw_link TZ_RAW_LINK
 
typedef struct tz_raw_offset_rule TZ_RAW_OFFSET_RULE
 
typedef struct tz_raw_zone_info TZ_RAW_ZONE_INFO
 
typedef struct tz_raw_ds_rule TZ_RAW_DS_RULE
 
typedef struct tz_raw_ds_ruleset TZ_RAW_DS_RULESET
 
typedef struct tz_raw_context TZ_RAW_CONTEXT
 
typedef struct tz_raw_data TZ_RAW_DATA
 
typedef struct offset_rule_interval OFFSET_RULE_INTERVAL
 

Enumerations

enum  TZ_FILE_TYPE {
  TZF_COUNTRIES = 0, TZF_ZONES, TZF_RULES, TZF_BACKWARD,
  TZF_LEAP
}
 

Functions

static int tzc_check_new_package_validity (const char *input_folder)
 
static int tzc_load_countries (TZ_RAW_DATA *tzd_raw, const char *input_folder)
 
static int tzc_load_zone_names (TZ_RAW_DATA *tzd_raw, const char *input_folder)
 
static int tzc_load_rule_file (TZ_RAW_DATA *tzd_raw, const int file_index, const char *input_folder)
 
static int tzc_load_backward_zones (TZ_RAW_DATA *tzd_raw, const char *input_folder)
 
static int tzc_load_leap_secs (TZ_RAW_DATA *tzd_raw, const char *input_folder)
 
static int tzc_get_zone (const TZ_RAW_DATA *tzd_raw, const char *zone_name, TZ_RAW_ZONE_INFO **zone)
 
static int tzc_add_zone (const char *zone, const char *coord, const char *code, const char *comments, TZ_RAW_DATA *tzd_raw, TZ_RAW_ZONE_INFO **new_zone)
 
static int tzc_add_link (TZ_RAW_DATA *tzd_raw, const char *zone, const char *alias)
 
static int tzc_add_offset_rule (TZ_RAW_ZONE_INFO *zone, char *rule_text)
 
static int tzc_add_leap_sec (TZ_RAW_DATA *tzd_raw, int year, int month, int day, unsigned char hour, unsigned char min, unsigned char sec, bool corr_minus, bool leap_is_rolling)
 
static int tzc_read_time_type (const char *str, const char **next, TZ_TIME_TYPE *time_type)
 
static int tzc_add_ds_rule (TZ_RAW_DATA *tzd_raw, char *rule_text)
 
static int tzc_parse_ds_change_on (TZ_RAW_DS_RULE *dest, const char *str)
 
static bool tzc_is_valid_date (const int day, const int month, const int year_start, const int year_end)
 
static int tzc_get_ds_ruleset_by_name (const TZ_DS_RULESET *ds_rulesets, int ds_ruleset_count, const char *ruleset)
 
static void tzc_free_raw_data (TZ_RAW_DATA *tzd_raw)
 
static int tzc_check_links_raw_data (TZ_RAW_DATA *tzd_raw)
 
static void tzc_sort_raw_data (TZ_RAW_DATA *tzd_raw)
 
static void tzc_index_raw_data (TZ_RAW_DATA *tzd_raw)
 
static int tzc_index_raw_data_w_static (TZ_RAW_DATA *tzd_raw, const TZ_GEN_TYPE mode)
 
static int tzc_index_raw_subdata (TZ_RAW_DATA *tzd_raw, const TZ_GEN_TYPE mode)
 
static int compare_ints (const void *a, const void *b)
 
static int tzc_compile_data (TZ_RAW_DATA *tzd_raw, TZ_DATA *tzd)
 
static int tzc_compile_ds_rules (TZ_RAW_DATA *tzd_raw, TZ_DATA *tzd)
 
static int str_to_offset_rule_until (TZ_RAW_OFFSET_RULE *offset_rule, char *str)
 
static int str_month_to_int (const char *month, int *month_num, const char **str_next)
 
static int str_day_to_int (const char *str_in, int *day_num, const char **str_next)
 
static int str_read_day_var (const char *str, const int month, int *type, int *day, int *bound, const char **str_next)
 
static int comp_func_raw_countries (const void *arg1, const void *arg2)
 
static int comp_func_raw_zones (const void *arg1, const void *arg2)
 
static int comp_func_raw_links (const void *arg1, const void *arg2)
 
static int comp_func_raw_offset_rules (const void *arg1, const void *arg2)
 
static int comp_func_raw_ds_rulesets (const void *arg1, const void *arg2)
 
static int comp_func_raw_ds_rules (const void *arg1, const void *arg2)
 
static int comp_func_tz_names (const void *arg1, const void *arg2)
 
static void print_seconds_as_time_hms_var (int seconds)
 
static void tzc_get_timezones_dot_c_filepath (size_t size, char *timezones_dot_c_file_path)
 
static int tzc_export_timezone_dot_c (const TZ_DATA *tzd, const char *tz_C_filepath)
 
static int tzc_load_raw_data (TZ_RAW_DATA *tzd_raw, const char *input_folder)
 
static int tzc_import_old_data (TZ_RAW_DATA *tzd_raw, const TZ_GEN_TYPE mode)
 
static int tzc_del_unused_raw_data (TZ_RAW_DATA *tzd_raw)
 
static int tzc_index_data (TZ_RAW_DATA *tzd_raw, const TZ_GEN_TYPE mode)
 
static void tzc_free_tz_data (TZ_DATA *tzd, bool full)
 
static void tzc_build_filepath (char *path, size_t size, const char *dir, const char *filename)
 
static void trim_comments_whitespaces (char *str)
 
static int tzc_get_timezone_aliases (const TZ_DATA *tzd, const int zone_id, int **aliases, int *alias_count)
 
static void tzc_dump_one_offset_rule (const TZ_DATA *tzd, const TZ_OFFSET_RULE *offset_rule)
 
static void tzc_dump_ds_ruleset (const TZ_DATA *tzd, const int ruleset_id)
 
static void tzc_log_error (const TZ_RAW_CONTEXT *context, const int code, const char *msg1, const char *msg2)
 
static void tzc_summary (TZ_RAW_DATA *tzd_raw, TZ_DATA *tzd)
 
static int tzc_find_timezone_names (const TZ_DATA *tzd, const char *timezone_name)
 
static int tzc_find_country_names (const TZ_COUNTRY *countries, const int country_count, const char *country_name)
 
static bool comp_ds_rules (const TZ_DS_RULE *rule1, const TZ_DS_RULE *rule2)
 
static bool comp_offset_rules (const TZ_OFFSET_RULE *rule1, const TZ_OFFSET_RULE *rule2)
 
static int copy_offset_rule (TZ_OFFSET_RULE *dst, const TZ_DATA *tzd, const int index)
 
static int init_ds_ruleset (TZ_DS_RULESET *dst_ruleset, const TZ_DATA *tzd, const int index, const int start)
 
static int copy_ds_rule (TZ_DS_RULE *dst, const TZ_DATA *tzd, const int index)
 
static int tz_data_partial_clone (char **timezone_names, TZ_TIMEZONE *timezones, TZ_NAME *names, const TZ_DATA *tzd)
 
static int init_tz_name (TZ_NAME *dst, TZ_NAME *src)
 
static int tzc_compute_timezone_checksum (TZ_DATA *tzd, TZ_GEN_TYPE type)
 
static int get_day_of_week_for_raw_rule (const TZ_RAW_DS_RULE *rule, const int year)
 
static int tzc_check_ds_ruleset (const TZ_DATA *tzd, const TZ_DS_RULESET *ds_rule_set, int *ds_changes_cnt)
 
void tzc_dump_summary (const TZ_DATA *tzd)
 
void tzc_dump_countries (const TZ_DATA *tzd)
 
void tzc_dump_timezones (const TZ_DATA *tzd)
 
void tzc_dump_one_timezone (const TZ_DATA *tzd, const int zone_id)
 
void tzc_dump_leap_sec (const TZ_DATA *tzd)
 

Variables

static const TZ_FILE_DESCRIPTOR tz_Files []
 
static int tz_File_count = DIM (tz_Files)
 
static const char MONTH_NAMES_ABBREV [TZ_MON_COUNT][TZ_CAL_ABBREV_SIZE]
 
static const char DAY_NAMES_ABBREV [TZ_WEEK_DAY_COUNT][TZ_CAL_ABBREV_SIZE]
 
static const char * tzc_Err_messages []
 
static const int tzc_Err_message_count = -TZC_ERR_LAST_ERROR
 
const char * tz_timezone_names []
 
const TZ_COUNTRY tz_countries []
 

Macro Definition Documentation

#define ABS (   i)    ((i) >= 0 ? (i) : -(i))

Referenced by tzc_check_ds_ruleset().

#define BUF_PUT_INT16 (   buf,
 
)
Value:
do { \
unsigned short nv = htons(v); \
*((unsigned char *) (buf)) = ((unsigned char *) &nv)[1];\
buf = (char *) (buf) + 1; \
*((unsigned char *) (buf)) = ((unsigned char *) &nv)[0];\
buf = (char *) (buf) + 1; \
} while (0)
unsigned short htons(unsigned short from)

Definition at line 386 of file tz_compile.c.

Referenced by tzc_compute_timezone_checksum().

#define BUF_PUT_INT32 (   buf,
 
)
Value:
do { \
unsigned int nv = htonl(v); \
*((unsigned char *) (buf)) = ((unsigned char *) &nv)[3]; \
buf = (char *) (buf) + 1; \
*((unsigned char *) (buf)) = ((unsigned char *) &nv)[2]; \
buf = (char *) (buf) + 1; \
*((unsigned char *) (buf)) = ((unsigned char *) &nv)[1]; \
buf = (char *) (buf) + 1; \
*((unsigned char *) (buf)) = ((unsigned char *) &nv)[0]; \
buf = (char *) (buf) + 1; \
} while (0)
unsigned int htonl(unsigned int from)

Definition at line 373 of file tz_compile.c.

Referenced by tzc_compute_timezone_checksum().

#define DUPLICATE_STR (   a,
 
)
Value:
do { \
(a) = strdup((b)); \
if((a) == NULL) { \
er_set (ER_ERROR_SEVERITY, ARG_FILE_LINE, err_status, 1, (size_t) 0); \
goto exit; \
} \
} while (0)
void er_set(int severity, const char *file_name, const int line_no, int err_id, int num_args,...)
#define ER_OUT_OF_VIRTUAL_MEMORY
Definition: error_code.h:50
#define NULL
Definition: freelistheap.h:34
if(extra_options)
Definition: dynamic_load.c:958
#define ARG_FILE_LINE
Definition: error_manager.h:44
char * strdup(const char *str)
Definition: porting.c:901

Definition at line 339 of file tz_compile.c.

Referenced by copy_ds_rule(), copy_offset_rule(), init_ds_ruleset(), init_tz_name(), and tz_data_partial_clone().

#define INIT_COUNTRY (   dst,
  src 
)
Value:
do { \
strcpy ((dst)->code, (src)->code); \
strcpy ((dst)->full_name, (src)->full_name); \
} while (0)

Definition at line 349 of file tz_compile.c.

Referenced by init_tz_name().

#define LOG_TZC_SET_CURRENT_CONTEXT (   tzd_raw,
  f,
 
)
Value:
do { \
strcpy (tzd_raw->context.current_file, f); \
tzd_raw->context.current_line = l; \
} while (0)

Definition at line 323 of file tz_compile.c.

Referenced by tzc_load_backward_zones(), tzc_load_countries(), tzc_load_leap_secs(), tzc_load_raw_data(), tzc_load_rule_file(), and tzc_load_zone_names().

#define MAX_DS_CHANGES_YEAR   1000

Referenced by tzc_check_ds_ruleset().

#define PATH_PARTIAL_TIMEZONES_FILE   "timezones/tzlib/timezones.c"

Definition at line 65 of file tz_compile.c.

Referenced by tzc_get_timezones_dot_c_filepath().

#define PRINT_STRING_TO_C_FILE (   fp,
  val,
  len 
)
Value:
do { \
int istr; \
fprintf (fp, "\""); \
for (istr = 0; istr < len; istr++) \
{ \
fprintf (fp, "\\x%02X", (unsigned char) val[istr]); \
} \
fprintf (fp, "\""); \
} while (0)
for(p=libs;*p;p++)
Definition: dynamic_load.c:968

Definition at line 355 of file tz_compile.c.

#define PRINT_STRING_VAR_TO_C_FILE (   fp,
  valname,
  val 
)
Value:
do { \
fprintf (fp, "\n" SHLIB_EXPORT_PREFIX "const char " valname "[] = "); \
PRINT_STRING_TO_C_FILE (fp, val, strlen (val)); \
fprintf (fp, ";\n"); \
} while (0);
#define PRINT_STRING_TO_C_FILE(fp, val, len)
Definition: tz_compile.c:355
#define strlen(s1)
Definition: tz_compile.c:50
#define SHLIB_EXPORT_PREFIX
Definition: tz_support.h:58

Definition at line 366 of file tz_compile.c.

Referenced by tzc_export_timezone_dot_c().

#define STR_SKIP_LEADING_SPACES (   str)
Value:
while ((str) != NULL && *(str) == ' ') \
{ \
(str)++; \
}
#define NULL
Definition: freelistheap.h:34

Definition at line 245 of file tz_compile.c.

Referenced by tzc_add_ds_rule().

#define TZ_CAL_ABBREV_SIZE   4

Definition at line 238 of file tz_compile.c.

#define TZ_COMMENTS_MAX_SIZE   92

Definition at line 58 of file tz_compile.c.

#define TZ_COORDINATES_MAX_SIZE   16

Definition at line 57 of file tz_compile.c.

#define TZ_FILENAME_MAX_LEN   17

Definition at line 53 of file tz_compile.c.

#define TZ_MAX_LINE_LEN   512
#define TZ_OFFRULE_PREFIX_TAB_COUNT   3

Definition at line 55 of file tz_compile.c.

Referenced by tzc_load_rule_file().

#define TZ_RULE_LETTER_ABBREV_MAX_SIZE   8

Definition at line 59 of file tz_compile.c.

#define TZ_RULE_TYPE_MAX_SIZE   4

Definition at line 60 of file tz_compile.c.

Referenced by tzc_add_ds_rule().

#define TZC_ERR_ADD_ZONE   -16

Definition at line 275 of file tz_compile.c.

Referenced by tzc_load_rule_file().

#define TZC_ERR_BAD_TZ_LINK   -3

Definition at line 262 of file tz_compile.c.

Referenced by tzc_load_backward_zones(), and tzc_load_rule_file().

#define TZC_ERR_CANT_READ_VALUE   -10

Definition at line 269 of file tz_compile.c.

Referenced by str_read_day_var(), str_to_offset_rule_until(), and tzc_add_ds_rule().

#define TZC_ERR_DS_INVALID_DATE   -12

Definition at line 271 of file tz_compile.c.

Referenced by str_to_offset_rule_until(), and tzc_parse_ds_change_on().

#define TZC_ERR_FILE_NOT_ACCESSIBLE   -13
#define TZC_ERR_GENERIC   -1
#define TZC_ERR_INVALID_COUNTRY   -14

Definition at line 273 of file tz_compile.c.

Referenced by tzc_load_countries().

#define TZC_ERR_INVALID_DATETIME   -8

Definition at line 267 of file tz_compile.c.

#define TZC_ERR_INVALID_DS_RULE   -9

Definition at line 268 of file tz_compile.c.

Referenced by tzc_add_ds_rule().

#define TZC_ERR_INVALID_PACKAGE   -2

Definition at line 261 of file tz_compile.c.

Referenced by tzc_check_new_package_validity().

#define TZC_ERR_INVALID_TIME   -6
#define TZC_ERR_INVALID_ZONE   -15

Definition at line 274 of file tz_compile.c.

Referenced by tzc_compile_data(), and tzc_load_zone_names().

#define TZC_ERR_LAST_ERROR   -18

Definition at line 277 of file tz_compile.c.

#define TZC_ERR_LINKING_TRUE_ZONES   -17

Definition at line 276 of file tz_compile.c.

Referenced by tzc_check_links_raw_data().

#define TZC_ERR_PARSING_FAILED   -11

Definition at line 270 of file tz_compile.c.

#define TZC_ERR_ZONE_RULE_UNORDERED   -7

Definition at line 266 of file tz_compile.c.

Referenced by tzc_add_offset_rule().

#define TZC_LOG_ERROR_1ARG (   context,
  err_code,
  s1 
)    tzc_log_error ((context), (err_code), (s1), "")

Typedef Documentation

Definition at line 230 of file tz_compile.c.

Definition at line 86 of file tz_compile.c.

Definition at line 201 of file tz_compile.c.

Definition at line 125 of file tz_compile.c.

typedef struct tz_raw_data TZ_RAW_DATA

Definition at line 214 of file tz_compile.c.

Definition at line 177 of file tz_compile.c.

Definition at line 192 of file tz_compile.c.

typedef struct tz_raw_link TZ_RAW_LINK

Definition at line 134 of file tz_compile.c.

Definition at line 142 of file tz_compile.c.

Definition at line 158 of file tz_compile.c.

Enumeration Type Documentation

Enumerator
TZF_COUNTRIES 
TZF_ZONES 
TZF_RULES 
TZF_BACKWARD 
TZF_LEAP 

Definition at line 71 of file tz_compile.c.

Function Documentation

static bool comp_ds_rules ( const TZ_DS_RULE rule1,
const TZ_DS_RULE rule2 
)
static
static int comp_func_raw_countries ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 3889 of file tz_compile.c.

References assert, tz_raw_country::full_name, tz_raw_country::id, IS_EMPTY_STR, and NULL.

Referenced by tzc_sort_raw_data().

Here is the caller graph for this function:

static int comp_func_raw_ds_rules ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 4107 of file tz_compile.c.

References assert, tz_raw_ds_rule::from_year, get_day_of_week_for_raw_rule(), tz_raw_ds_rule::in_month, and NULL.

Referenced by tzc_sort_raw_data().

Here is the caller graph for this function:

static int comp_func_raw_ds_rulesets ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 4052 of file tz_compile.c.

References assert, IS_EMPTY_STR, tz_raw_ds_ruleset::name, and NULL.

Referenced by tzc_sort_raw_data().

Here is the caller graph for this function:

static int comp_func_raw_links ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 3972 of file tz_compile.c.

References tz_raw_link::alias, assert, IS_EMPTY_STR, and NULL.

Referenced by tzc_sort_raw_data().

Here is the caller graph for this function:

static int comp_func_raw_offset_rules ( const void *  arg1,
const void *  arg2 
)
static
static int comp_func_raw_zones ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 3930 of file tz_compile.c.

References assert, tz_raw_zone_info::full_name, tz_raw_zone_info::id, IS_EMPTY_STR, and NULL.

Referenced by tzc_sort_raw_data().

Here is the caller graph for this function:

static int comp_func_tz_names ( const void *  arg1,
const void *  arg2 
)
static

Definition at line 4144 of file tz_compile.c.

References assert, IS_EMPTY_STR, tz_name::name, and NULL.

Referenced by init_tz_name(), and tzc_compile_data().

Here is the caller graph for this function:

static bool comp_offset_rules ( const TZ_OFFSET_RULE rule1,
const TZ_OFFSET_RULE rule2 
)
static
static int compare_ints ( const void *  a,
const void *  b 
)
static

Definition at line 2800 of file tz_compile.c.

Referenced by tzc_check_ds_ruleset().

Here is the caller graph for this function:

static int copy_ds_rule ( TZ_DS_RULE dst,
const TZ_DATA tzd,
const int  index 
)
static

Definition at line 5340 of file tz_compile.c.

References tz_data::ds_rules, DUPLICATE_STR, tz_ds_rule::letter_abbrev, NO_ERROR, and NULL.

Referenced by init_tz_name().

Here is the caller graph for this function:

static int copy_offset_rule ( TZ_OFFSET_RULE dst,
const TZ_DATA tzd,
const int  index 
)
static
static int get_day_of_week_for_raw_rule ( const TZ_RAW_DS_RULE rule,
const int  year 
)
static
static int init_ds_ruleset ( TZ_DS_RULESET dst_ruleset,
const TZ_DATA tzd,
const int  index,
const int  start 
)
static
static void print_seconds_as_time_hms_var ( int  seconds)
static

Definition at line 4165 of file tz_compile.c.

Referenced by tzc_dump_ds_ruleset(), and tzc_dump_one_offset_rule().

Here is the caller graph for this function:

static int str_day_to_int ( const char *  str_in,
int *  day_num,
const char **  str_next 
)
static

Definition at line 3714 of file tz_compile.c.

References assert, char_isspace(), DAY_NAMES_ABBREV, i, IS_EMPTY_STR, NO_ERROR, strlen, TZ_WEEK_DAY_COUNT, and TZC_ERR_INVALID_VALUE.

Referenced by str_read_day_var().

Here is the caller graph for this function:

static int str_month_to_int ( const char *  month,
int *  month_num,
const char **  str_next 
)
static

Definition at line 3665 of file tz_compile.c.

References assert, char_isspace(), i, IS_EMPTY_STR, MONTH_NAMES_ABBREV, NO_ERROR, strlen, TZ_MON_COUNT, and TZC_ERR_INVALID_VALUE.

Referenced by str_to_offset_rule_until(), tzc_add_ds_rule(), and tzc_load_leap_secs().

Here is the caller graph for this function:

static int str_read_day_var ( const char *  str,
const int  month,
int *  type,
int *  day,
int *  bound,
const char **  str_next 
)
static
static void trim_comments_whitespaces ( char *  str)
static

Definition at line 552 of file tz_compile.c.

References char_isspace(), i, IS_EMPTY_STR, NULL, and strlen.

Referenced by tzc_load_backward_zones(), tzc_load_countries(), tzc_load_leap_secs(), tzc_load_rule_file(), and tzc_load_zone_names().

Here is the caller graph for this function:

static int tz_data_partial_clone ( char **  timezone_names,
TZ_TIMEZONE timezones,
TZ_NAME names,
const TZ_DATA tzd 
)
static

Definition at line 5369 of file tz_compile.c.

References DUPLICATE_STR, i, tz_file_descriptor::name, tz_name::name, tz_data::name_count, tz_data::names, NO_ERROR, tz_data::timezone_count, tz_data::timezone_names, and tz_data::timezones.

Referenced by init_tz_name().

Here is the caller graph for this function:

static int tzc_add_leap_sec ( TZ_RAW_DATA tzd_raw,
int  year,
int  month,
int  day,
unsigned char  hour,
unsigned char  min,
unsigned char  sec,
bool  corr_minus,
bool  leap_is_rolling 
)
static
static int tzc_add_link ( TZ_RAW_DATA tzd_raw,
const char *  zone,
const char *  alias 
)
static
static int tzc_add_zone ( const char *  zone,
const char *  coord,
const char *  code,
const char *  comments,
TZ_RAW_DATA tzd_raw,
TZ_RAW_ZONE_INFO **  new_zone 
)
static
static void tzc_build_filepath ( char *  path,
size_t  size,
const char *  dir,
const char *  filename 
)
static
static int tzc_compile_data ( TZ_RAW_DATA tzd_raw,
TZ_DATA tzd 
)
static

Definition at line 2954 of file tz_compile.c.

References tz_raw_zone_info::alias_count, tz_raw_zone_info::aliases, assert, tz_raw_zone_info::clone_of_id, tz_country::code, tz_raw_country::code, comp_func_tz_names(), tz_data::countries, tz_raw_data::countries, tz_data::country_count, tz_raw_data::country_count, tz_timezone::country_id, tz_raw_zone_info::country_id, tz_data::ds_leap_sec, tz_data::ds_leap_sec_count, tz_offset_rule::ds_ruleset, tz_data::ds_ruleset_count, tz_raw_offset_rule::ds_ruleset_name, tz_data::ds_rulesets, tz_offset_rule::ds_type, DS_TYPE_FIXED, DS_TYPE_RULESET_ID, tz_raw_offset_rule::format, tz_country::full_name, tz_raw_country::full_name, tz_raw_zone_info::full_name, tz_offset_rule::gmt_off, tz_raw_offset_rule::gmt_off, tz_timezone::gmt_off_rule_count, tz_timezone::gmt_off_rule_start, i, tz_raw_country::id, tz_raw_zone_info::id, tz_name::is_alias, IS_EMPTY_STR, tz_raw_data::leap_sec, tz_raw_data::leap_sec_count, tz_name::name, tz_data::name_count, tz_data::names, NO_ERROR, NULL, tz_raw_zone_info::offset_rule_count, tz_data::offset_rule_count, tz_raw_zone_info::offset_rules, tz_data::offset_rules, tz_offset_rule::save_format, tz_offset_rule::std_format, strdup(), strlen, tz_data::timezone_count, tz_data::timezone_names, tz_data::timezones, tz_str_to_seconds(), tzc_check_ds_ruleset(), tzc_compile_ds_rules(), TZC_CONTEXT, TZC_ERR_INVALID_TIME, TZC_ERR_INVALID_ZONE, TZC_ERR_MSG_MAX_SIZE, TZC_ERR_OUT_OF_MEMORY, tzc_get_ds_ruleset_by_name(), TZC_LOG_ERROR_1ARG, TZC_LOG_ERROR_2ARG, tz_offset_rule::until_day, tz_raw_offset_rule::until_day, tz_offset_rule::until_flag, tz_raw_offset_rule::until_flag, tz_offset_rule::until_hour, tz_raw_offset_rule::until_hour, tz_offset_rule::until_min, tz_raw_offset_rule::until_min, tz_offset_rule::until_mon, tz_raw_offset_rule::until_mon, tz_offset_rule::until_sec, tz_raw_offset_rule::until_sec, tz_offset_rule::until_time_type, tz_raw_offset_rule::until_time_type, tz_offset_rule::until_year, tz_raw_offset_rule::until_year, tz_offset_rule::var_format, tz_raw_data::zone_count, tz_timezone::zone_id, tz_name::zone_id, and tz_raw_data::zones.

Referenced by tzc_check_new_package_validity().

Here is the caller graph for this function:

static int tzc_compute_timezone_checksum ( TZ_DATA tzd,
TZ_GEN_TYPE  type 
)
static

Definition at line 6263 of file tz_compile.c.

References ARG_FILE_LINE, assert, tz_ds_rule::at_time, tz_ds_rule::at_time_type, AU_DISABLE_PASSWORDS, BUF_PUT_INT16, BUF_PUT_INT32, cfg_free_directory(), cfg_read_directory(), tz_ds_rule::change_on, tz_data::checksum, tz_country::code, tz_leap_sec::corr_negative, tz_ds_ruleset::count, tz_data::countries, tz_data::country_count, tz_timezone::country_id, crypt_md5_buffer_hex(), database_name, tz_leap_sec::day, tz_ds_change_on::day_of_month, tz_ds_change_on::day_of_week, db_abort_transaction(), DB_CLIENT_TYPE_ADMIN_UTILITY, db_close_session(), db_commit_transaction(), db_compile_statement(), DB_CURSOR_SUCCESS, db_execute_statement_local(), db_get_int(), db_get_string(), DB_IS_NULL, db_login(), db_open_buffer(), db_query_end(), db_query_get_tuple_value(), db_query_next_tuple(), db_restart(), db_set_client_type(), db_shutdown(), DB_TYPE_DATETIMELTZ, DB_TYPE_DATETIMETZ, DB_TYPE_INTEGER, DB_TYPE_STRING, DB_TYPE_TIMESTAMPLTZ, DB_TYPE_TIMESTAMPTZ, DB_VALUE_TYPE, tz_data::ds_leap_sec, tz_data::ds_leap_sec_count, tz_data::ds_rule_count, tz_data::ds_rules, tz_offset_rule::ds_ruleset, tz_data::ds_ruleset_count, tz_data::ds_rulesets, tz_offset_rule::ds_type, er_errid(), ER_ERROR_SEVERITY, ER_OUT_OF_VIRTUAL_MEMORY, er_set(), error(), execute_query(), tz_ds_rule::from_year, tz_country::full_name, tz_offset_rule::gmt_off, tz_timezone::gmt_off_rule_count, tz_timezone::gmt_off_rule_start, i, tz_ds_rule::in_month, tz_ds_ruleset::index_start, tz_name::is_alias, tz_leap_sec::is_rolling, tz_offset_rule::julian_date, tz_ds_rule::letter_abbrev, tz_leap_sec::month, database_info::name, tz_name::name, tz_data::name_count, tz_data::names, database_info::next, NO_ERROR, NULL, tz_data::offset_rule_count, tz_data::offset_rules, program_name, tz_ds_ruleset::ruleset_name, tz_offset_rule::save_format, tz_ds_rule::save_time, tz_offset_rule::std_format, strlen, tz_data::timezone_count, tz_data::timezone_names, tz_data::timezones, tz_ds_rule::to_year, TRUE, tz_ds_change_on::type, tz_set_new_timezone_data(), tz_offset_rule::until_day, tz_offset_rule::until_flag, tz_offset_rule::until_hour, tz_offset_rule::until_min, tz_offset_rule::until_mon, tz_offset_rule::until_sec, tz_offset_rule::until_time_type, tz_offset_rule::until_year, tz_offset_rule::var_format, tz_leap_sec::year, tz_timezone::zone_id, and tz_name::zone_id.

Referenced by tzc_check_new_package_validity().

Here is the caller graph for this function:

void tzc_dump_countries ( const TZ_DATA tzd)

Definition at line 4637 of file tz_compile.c.

References assert, tz_country::code, tz_data::countries, tz_data::country_count, tz_country::full_name, i, and NULL.

Referenced by dump_tz().

Here is the caller graph for this function:

void tzc_dump_leap_sec ( const TZ_DATA tzd)
void tzc_dump_summary ( const TZ_DATA tzd)
void tzc_dump_timezones ( const TZ_DATA tzd)

Definition at line 4655 of file tz_compile.c.

References assert, i, NULL, tz_data::timezone_count, and tz_data::timezone_names.

Referenced by dump_tz().

Here is the caller graph for this function:

static int tzc_export_timezone_dot_c ( const TZ_DATA tzd,
const char *  tz_C_filepath 
)
static

Definition at line 4205 of file tz_compile.c.

References tz_ds_rule::at_time, tz_ds_rule::at_time_type, tz_ds_rule::change_on, tz_data::checksum, tz_country::code, tz_leap_sec::corr_negative, tz_ds_ruleset::count, tz_data::countries, tz_data::country_count, tz_timezone::country_id, tz_leap_sec::day, tz_ds_change_on::day_of_month, tz_ds_change_on::day_of_week, tz_ds_ruleset::default_abrev, tz_data::ds_leap_sec, tz_data::ds_leap_sec_count, tz_data::ds_rule_count, tz_data::ds_rules, tz_offset_rule::ds_ruleset, tz_data::ds_ruleset_count, tz_data::ds_rulesets, tz_offset_rule::ds_type, fopen_ex(), tz_ds_rule::from_year, tz_country::full_name, tz_offset_rule::gmt_off, tz_timezone::gmt_off_rule_count, tz_timezone::gmt_off_rule_start, i, tz_ds_rule::in_month, tz_ds_ruleset::index_start, tz_name::is_alias, tz_leap_sec::is_rolling, julian_encode(), tz_ds_rule::letter_abbrev, tz_leap_sec::month, tz_name::name, tz_data::name_count, tz_data::names, NO_ERROR, NULL, tz_data::offset_rule_count, tz_data::offset_rules, PRINT_STRING_VAR_TO_C_FILE, tz_ds_ruleset::ruleset_name, tz_offset_rule::save_format, tz_ds_rule::save_time, SHLIB_EXPORT_PREFIX, tz_offset_rule::std_format, tz_data::timezone_count, tz_data::timezone_names, tz_data::timezones, tz_ds_rule::to_year, tz_ds_ruleset::to_year_max, tz_ds_change_on::type, TZC_ERR_GENERIC, tz_offset_rule::until_day, tz_offset_rule::until_flag, tz_offset_rule::until_hour, tz_offset_rule::until_min, tz_offset_rule::until_mon, tz_offset_rule::until_sec, tz_offset_rule::until_time_type, tz_offset_rule::until_year, tz_offset_rule::var_format, tz_leap_sec::year, tz_timezone::zone_id, and tz_name::zone_id.

Referenced by tzc_check_new_package_validity().

Here is the caller graph for this function:

static int tzc_find_country_names ( const TZ_COUNTRY countries,
const int  country_count,
const char *  country_name 
)
static

Definition at line 5189 of file tz_compile.c.

Referenced by init_tz_name().

Here is the caller graph for this function:

static int tzc_find_timezone_names ( const TZ_DATA tzd,
const char *  timezone_name 
)
static

Definition at line 5151 of file tz_compile.c.

References tz_name::name, tz_data::name_count, tz_data::names, and tz_name::zone_id.

Referenced by init_tz_name().

Here is the caller graph for this function:

static int tzc_get_ds_ruleset_by_name ( const TZ_DS_RULESET ds_rulesets,
int  ds_ruleset_count,
const char *  ruleset 
)
static

Definition at line 4386 of file tz_compile.c.

Referenced by init_tz_name(), and tzc_compile_data().

Here is the caller graph for this function:

static int tzc_get_timezone_aliases ( const TZ_DATA tzd,
const int  zone_id,
int **  aliases,
int *  alias_count 
)
static

Definition at line 4425 of file tz_compile.c.

References assert, i, tz_name::is_alias, tz_data::name_count, tz_data::names, NO_ERROR, NULL, TZC_ERR_MSG_MAX_SIZE, TZC_ERR_OUT_OF_MEMORY, TZC_LOG_ERROR_2ARG, and tz_name::zone_id.

Referenced by tzc_dump_one_timezone().

Here is the caller graph for this function:

static void tzc_get_timezones_dot_c_filepath ( size_t  size,
char *  timezones_dot_c_file_path 
)
static

Definition at line 4189 of file tz_compile.c.

References envvar_cubrid_dir(), PATH_PARTIAL_TIMEZONES_FILE, and tzc_build_filepath().

Referenced by tzc_check_new_package_validity().

Here is the caller graph for this function:

static int tzc_get_zone ( const TZ_RAW_DATA tzd_raw,
const char *  zone_name,
TZ_RAW_ZONE_INFO **  zone 
)
static

Definition at line 1841 of file tz_compile.c.

References assert, tz_raw_zone_info::full_name, i, NO_ERROR, NULL, TZC_ERR_GENERIC, tz_raw_data::zone_count, and tz_raw_data::zones.

Referenced by tzc_load_rule_file().

Here is the caller graph for this function:

static int tzc_import_old_data ( TZ_RAW_DATA tzd_raw,
const TZ_GEN_TYPE  mode 
)
static

Definition at line 930 of file tz_compile.c.

References NO_ERROR, and TZ_GEN_TYPE_NEW.

Referenced by tzc_check_new_package_validity().

Here is the caller graph for this function:

static int tzc_index_data ( TZ_RAW_DATA tzd_raw,
const TZ_GEN_TYPE  mode 
)
static
static void tzc_index_raw_data ( TZ_RAW_DATA tzd_raw)
static
static bool tzc_is_valid_date ( const int  day,
const int  month,
const int  year_start,
const int  year_end 
)
static

Definition at line 2325 of file tz_compile.c.

References DAYS_IN_MONTH, IS_LEAP_YEAR, TZ_MAX_YEAR, TZ_MON_DEC, and TZ_MON_FEB.

Referenced by str_to_offset_rule_until(), and tzc_parse_ds_change_on().

Here is the caller graph for this function:

static int tzc_load_raw_data ( TZ_RAW_DATA tzd_raw,
const char *  input_folder 
)
static
static int tzc_read_time_type ( const char *  str,
const char **  next,
TZ_TIME_TYPE time_type 
)
static

Definition at line 1983 of file tz_compile.c.

References assert, NO_ERROR, NULL, TZ_TIME_TYPE_LOCAL_STD, TZ_TIME_TYPE_LOCAL_WALL, TZ_TIME_TYPE_UTC, and TZC_ERR_GENERIC.

Referenced by str_to_offset_rule_until(), and tzc_add_ds_rule().

Here is the caller graph for this function:

Variable Documentation

const char DAY_NAMES_ABBREV[TZ_WEEK_DAY_COUNT][TZ_CAL_ABBREV_SIZE]
static
Initial value:
=
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }

Definition at line 242 of file tz_compile.c.

Referenced by str_day_to_int(), and tzc_dump_ds_ruleset().

const char MONTH_NAMES_ABBREV[TZ_MON_COUNT][TZ_CAL_ABBREV_SIZE]
static
Initial value:
= { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
}

Definition at line 239 of file tz_compile.c.

Referenced by str_month_to_int(), tzc_check_ds_ruleset(), tzc_dump_ds_ruleset(), tzc_dump_leap_sec(), and tzc_dump_one_offset_rule().

const TZ_COUNTRY tz_countries[]
const TZ_FILE_DESCRIPTOR tz_Files[]
static
Initial value:
= {
{TZF_COUNTRIES, "iso3166.tab"},
{TZF_ZONES, "zone.tab"},
{TZF_RULES, "africa"},
{TZF_RULES, "antarctica"},
{TZF_RULES, "asia"},
{TZF_RULES, "australasia"},
{TZF_RULES, "europe"},
{TZF_RULES, "northamerica"},
{TZF_RULES, "southamerica"},
{TZF_RULES, "etcetera"},
{TZF_RULES, "pacificnew"},
{TZF_BACKWARD, "backward"},
{TZF_LEAP, "leapseconds"},
{TZF_LEAP, "leapseconds"}
}

Definition at line 101 of file tz_compile.c.

const char* tz_timezone_names[]
const int tzc_Err_message_count = -TZC_ERR_LAST_ERROR
static

Definition at line 318 of file tz_compile.c.

Referenced by tzc_log_error().

const char* tzc_Err_messages[]
static

Definition at line 279 of file tz_compile.c.

Referenced by tzc_log_error().