w32tex
About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

zic.c File Reference
#include "private.h"
#include "locale.h"
#include "tzfile.h"
#include <stdarg.h>
#include "sys/stat.h"
#include "tz2icu.h"
#include "ctype.h"
Include dependency graph for zic.c:

Go to the source code of this file.

Classes

struct  rule
 
struct  zone
 
struct  link
 
struct  lookup
 
struct  attype
 

Macros

#define ICU
 
#define ICU_LINKS
 
#define LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH
 
#define ZIC_VERSION_PRE_2013   '2'
 
#define ZIC_VERSION   '3'
 
#define ZIC_MIN   INT_FAST64_MIN
 
#define ZIC_MAX   INT_FAST64_MAX
 
#define SCNdZIC   SCNdFAST64
 
#define ZIC_MAX_ABBR_LEN_WO_WARN   6
 
#define MKDIR_UMASK   0755
 
#define isascii(x)   1
 
#define end(cp)   (strchr((cp), '\0'))
 
#define DC_DOM   0 /* 1..31 */ /* unused */
 
#define DC_DOWGEQ   1 /* 1..31 */ /* 0..6 (Sun..Sat) */
 
#define DC_DOWLEQ   2 /* 1..31 */ /* 0..6 (Sun..Sat) */
 
#define LC_RULE   0
 
#define LC_ZONE   1
 
#define LC_LINK   2
 
#define LC_LEAP   3
 
#define ZF_NAME   1
 
#define ZF_GMTOFF   2
 
#define ZF_RULE   3
 
#define ZF_FORMAT   4
 
#define ZF_TILYEAR   5
 
#define ZF_TILMONTH   6
 
#define ZF_TILDAY   7
 
#define ZF_TILTIME   8
 
#define ZONE_MINFIELDS   5
 
#define ZONE_MAXFIELDS   9
 
#define ZFC_GMTOFF   0
 
#define ZFC_RULE   1
 
#define ZFC_FORMAT   2
 
#define ZFC_TILYEAR   3
 
#define ZFC_TILMONTH   4
 
#define ZFC_TILDAY   5
 
#define ZFC_TILTIME   6
 
#define ZONEC_MINFIELDS   3
 
#define ZONEC_MAXFIELDS   7
 
#define RF_NAME   1
 
#define RF_LOYEAR   2
 
#define RF_HIYEAR   3
 
#define RF_COMMAND   4
 
#define RF_MONTH   5
 
#define RF_DAY   6
 
#define RF_TOD   7
 
#define RF_STDOFF   8
 
#define RF_ABBRVAR   9
 
#define RULE_FIELDS   10
 
#define LF_FROM   1
 
#define LF_TO   2
 
#define LINK_FIELDS   3
 
#define LP_YEAR   1
 
#define LP_MONTH   2
 
#define LP_DAY   3
 
#define LP_TIME   4
 
#define LP_CORR   5
 
#define LP_ROLL   6
 
#define LEAP_FIELDS   7
 
#define YR_MINIMUM   0
 
#define YR_MAXIMUM   1
 
#define YR_ONLY   2
 
#define emalloc(size)   memcheck(malloc(size))
 
#define erealloc(ptr, size)   memcheck(realloc(ptr, size))
 
#define ecpyalloc(ptr)   memcheck(icpyalloc(ptr))
 
#define ecatalloc(oldp, newp)   memcheck(icatalloc((oldp), (newp)))
 
#define TIME_T_BITS_IN_FILE   64
 
#define DO(field)   ((void) fwrite(tzh.field, sizeof tzh.field, 1, fp))
 
#define LDAYSPERWEEK   ((zic_t) DAYSPERWEEK)
 

Typedefs

typedef int_fast64_t zic_t
 

Enumerations

enum  { YEAR_BY_YEAR_ZONE = 1 }
 

Functions

int getopt (int argc, char *const argv[], const char *options)
 
int link (const char *fromname, const char *toname)
 
static void addtt (zic_t starttime, int type)
 
static int addtype (const zic_t gmtoff, const zic_t rawoff, const zic_t dstoff, char *const abbr, int isdst, int ttisstd, int ttisgmt)
 
static void leapadd (zic_t t, int positive, int rolling, int count)
 
static void adjleap (void)
 
static void associate (void)
 
static void dolink (const char *fromfield, const char *tofield)
 
static char ** getfields (char *buf)
 
static zic_t gethms (const char *string, const char *errstrng, int signable)
 
static void infile (const char *filename)
 
static void inleap (char **fields, int nfields)
 
static void inlink (char **fields, int nfields)
 
static void inrule (char **fields, int nfields)
 
static int inzcont (char **fields, int nfields)
 
static int inzone (char **fields, int nfields)
 
static int inzsub (char **fields, int nfields, int iscont)
 
static int itsdir (const char *name)
 
static int lowerit (int c)
 
static int mkdirs (char *filename)
 
static void newabbr (const char *abbr)
 
static zic_t oadd (zic_t t1, zic_t t2)
 
static void outzone (const struct zone *zp, int ntzones)
 
static zic_t rpytime (const struct rule *rp, zic_t wantedy)
 
static void rulesub (struct rule *rp, const char *loyearp, const char *hiyearp, const char *typep, const char *monthp, const char *dayp, const char *timep)
 
static zic_t tadd (zic_t t1, zic_t t2)
 
static int yearistype (int year, const char *type)
 
static void emit_icu_zone (FILE *f, const char *zoneName, int zoneOffset, const struct rule *rule, int ruleIndex, int startYear)
 
static void emit_icu_link (FILE *f, const char *from, const char *to)
 
static void emit_icu_rule (FILE *f, const struct rule *r, int ruleIndex)
 
static int add_icu_final_rules (const struct rule *r1, const struct rule *r2)
 
static struct lookup constbyword (const char *string, const struct lookup *lp)
 
static void memory_exhausted (const char *msg)
 
static size_t size_product (size_t nitems, size_t itemsize)
 
static voidmemcheck (void *const ptr)
 
static voidgrowalloc (void *ptr, size_t itemsize, int nitems, int *nitems_alloc)
 
static void eats (const char *const name, const int num, const char *const rname, const int rnum)
 
static void eat (const char *const name, const int num)
 
static void verror (const char *const string, va_list args)
 
static void error (const char *const string,...)
 
static void warning (const char *const string,...)
 
static void usage (FILE *stream, int status)
 
int main (int argc, char **argv)
 
static int rcomp (const void *cp1, const void *cp2)
 
static void inrule (register char **const fields, const int nfields)
 
static int inzone (register char **const fields, const int nfields)
 
static int inzcont (register char **const fields, const int nfields)
 
static int inzsub (register char **const fields, const int nfields, const int iscont)
 
static void inleap (register char **const fields, const int nfields)
 
static void inlink (register char **const fields, const int nfields)
 
static void rulesub (register struct rule *const rp, const char *const loyearp, const char *const hiyearp, const char *const typep, const char *const monthp, const char *const dayp, const char *const timep)
 
static void convert (const int_fast32_t val, char *const buf)
 
static void convert64 (const zic_t val, char *const buf)
 
static void puttzcode (const int_fast32_t val, FILE *const fp)
 
static void puttzcode64 (const zic_t val, FILE *const fp)
 
static int atcomp (const void *avp, const void *bvp)
 
static int is32 (const zic_t x)
 
static void writezone (const char *const name, const char *const string, char version)
 
static void doabbr (char *const abbr, const char *const format, const char *const letters, const int isdst, const int doquotes)
 
static void updateminmax (const zic_t x)
 
static int stringoffset (char *result, zic_t offset)
 
static int stringrule (char *result, const struct rule *const rp, const zic_t dstoff, const zic_t gmtoff)
 
static int rule_cmp (struct rule const *a, struct rule const *b)
 
static int stringzone (char *result, const struct zone *const zpfirst, const int zonecount)
 
static int ciequal (register const char *ap, register const char *bp)
 
static int itsabbr (register const char *abbr, register const char *word)
 
static const struct lookupbyword (register const char *const word, register const struct lookup *const table)
 
static char ** getfields (register char *cp)
 
static zic_t rpytime (register const struct rule *const rp, register const zic_t wantedy)
 

Variables

static char const PKGVERSION [] ="N/A"
 
static char const TZVERSION [] ="N/A"
 
static char const REPORT_BUGS_TO [] ="N/A"
 
char * optarg
 
int optind
 
static int charcnt
 
static int errors
 
static const char * filename
 
static int leapcnt
 
static int leapseen
 
static zic_t leapminyear
 
static zic_t leapmaxyear
 
static int linenum
 
static int max_abbrvar_len
 
static int max_format_len
 
static zic_t max_year
 
static zic_t min_year
 
static int noise
 
static const char * rfilename
 
static int rlinenum
 
static const char * progname
 
static int timecnt
 
static int timecnt_alloc
 
static int typecnt
 
static struct rulerules
 
static int nrules
 
static int nrules_alloc
 
static struct zonezones
 
static int nzones
 
static int nzones_alloc
 
static struct linklinks
 
static int nlinks
 
static int nlinks_alloc
 
static const struct rule ** finalRules = NULL
 
static int finalRulesCount = 0
 
static struct lookup const line_codes []
 
static struct lookup const mon_names []
 
static struct lookup const wday_names []
 
static struct lookup const lasts []
 
static struct lookup const begin_years []
 
static struct lookup const end_years []
 
static struct lookup const leap_types []
 
static const int len_months [2][12]
 
static const int len_years [2]
 
static struct attypeattypes
 
static zic_t gmtoffs [256]
 
static zic_t rawoffs [256]
 
static zic_t dstoffs [256]
 
static char isdsts [256]
 
static unsigned char abbrinds [256]
 
static char ttisstds [256]
 
static char ttisgmts [256]
 
static char chars [50]
 
static zic_t trans [50]
 
static zic_t corr [50]
 
static char roll [50]
 
static FILEicuFile
 
static const char * DYCODE [] = {"DOM", "DOWGEQ", "DOWLEQ"}
 
static const char * psxrules
 
static const char * lcltime
 
static const char * directory
 
static const char * leapsec
 
static const char * yitcommand
 
static const zic_t min_time = (zic_t) -1 << ( 64 - 1)
 
static const zic_t max_time = -1 - ((zic_t) -1 << ( 64 - 1))
 

Macro Definition Documentation

◆ DC_DOM

#define DC_DOM   0 /* 1..31 */ /* unused */

Definition at line 106 of file zic.c.

◆ DC_DOWGEQ

#define DC_DOWGEQ   1 /* 1..31 */ /* 0..6 (Sun..Sat) */

Definition at line 107 of file zic.c.

◆ DC_DOWLEQ

#define DC_DOWLEQ   2 /* 1..31 */ /* 0..6 (Sun..Sat) */

Definition at line 108 of file zic.c.

◆ DO

#define DO (   field)    ((void) fwrite(tzh.field, sizeof tzh.field, 1, fp))

◆ ecatalloc

#define ecatalloc (   oldp,
  newp 
)    memcheck(icatalloc((oldp), (newp)))

Definition at line 446 of file zic.c.

◆ ecpyalloc

#define ecpyalloc (   ptr)    memcheck(icpyalloc(ptr))

Definition at line 445 of file zic.c.

◆ emalloc

#define emalloc (   size)    memcheck(malloc(size))

Definition at line 443 of file zic.c.

◆ end

#define end (   cp)    (strchr((cp), '\0'))

Definition at line 71 of file zic.c.

◆ erealloc

#define erealloc (   ptr,
  size 
)    memcheck(realloc(ptr, size))

Definition at line 444 of file zic.c.

◆ ICU

#define ICU

Definition at line 7 of file zic.c.

◆ ICU_LINKS

#define ICU_LINKS

Definition at line 14 of file zic.c.

◆ isascii

#define isascii (   x)    1

Definition at line 68 of file zic.c.

◆ LC_LEAP

#define LC_LEAP   3

Definition at line 213 of file zic.c.

◆ LC_LINK

#define LC_LINK   2

Definition at line 212 of file zic.c.

◆ LC_RULE

#define LC_RULE   0

Definition at line 210 of file zic.c.

◆ LC_ZONE

#define LC_ZONE   1

Definition at line 211 of file zic.c.

◆ LDAYSPERWEEK

#define LDAYSPERWEEK   ((zic_t) DAYSPERWEEK)

◆ LEAP_FIELDS

#define LEAP_FIELDS   7

Definition at line 277 of file zic.c.

◆ LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH

#define LEAVE_SOME_PRE_2011_SYSTEMS_IN_THE_LURCH

Definition at line 16 of file zic.c.

◆ LF_FROM

#define LF_FROM   1

Definition at line 263 of file zic.c.

◆ LF_TO

#define LF_TO   2

Definition at line 264 of file zic.c.

◆ LINK_FIELDS

#define LINK_FIELDS   3

Definition at line 265 of file zic.c.

◆ LP_CORR

#define LP_CORR   5

Definition at line 275 of file zic.c.

◆ LP_DAY

#define LP_DAY   3

Definition at line 273 of file zic.c.

◆ LP_MONTH

#define LP_MONTH   2

Definition at line 272 of file zic.c.

◆ LP_ROLL

#define LP_ROLL   6

Definition at line 276 of file zic.c.

◆ LP_TIME

#define LP_TIME   4

Definition at line 274 of file zic.c.

◆ LP_YEAR

#define LP_YEAR   1

Definition at line 271 of file zic.c.

◆ MKDIR_UMASK

#define MKDIR_UMASK   0755

Definition at line 51 of file zic.c.

◆ RF_ABBRVAR

#define RF_ABBRVAR   9

Definition at line 256 of file zic.c.

◆ RF_COMMAND

#define RF_COMMAND   4

Definition at line 251 of file zic.c.

◆ RF_DAY

#define RF_DAY   6

Definition at line 253 of file zic.c.

◆ RF_HIYEAR

#define RF_HIYEAR   3

Definition at line 250 of file zic.c.

◆ RF_LOYEAR

#define RF_LOYEAR   2

Definition at line 249 of file zic.c.

◆ RF_MONTH

#define RF_MONTH   5

Definition at line 252 of file zic.c.

◆ RF_NAME

#define RF_NAME   1

Definition at line 248 of file zic.c.

◆ RF_STDOFF

#define RF_STDOFF   8

Definition at line 255 of file zic.c.

◆ RF_TOD

#define RF_TOD   7

Definition at line 254 of file zic.c.

◆ RULE_FIELDS

#define RULE_FIELDS   10

Definition at line 257 of file zic.c.

◆ SCNdZIC

#define SCNdZIC   SCNdFAST64

Definition at line 39 of file zic.c.

◆ TIME_T_BITS_IN_FILE

#define TIME_T_BITS_IN_FILE   64

Definition at line 864 of file zic.c.

◆ YR_MAXIMUM

#define YR_MAXIMUM   1

Definition at line 284 of file zic.c.

◆ YR_MINIMUM

#define YR_MINIMUM   0

Definition at line 283 of file zic.c.

◆ YR_ONLY

#define YR_ONLY   2

Definition at line 285 of file zic.c.

◆ ZF_FORMAT

#define ZF_FORMAT   4

Definition at line 222 of file zic.c.

◆ ZF_GMTOFF

#define ZF_GMTOFF   2

Definition at line 220 of file zic.c.

◆ ZF_NAME

#define ZF_NAME   1

Definition at line 219 of file zic.c.

◆ ZF_RULE

#define ZF_RULE   3

Definition at line 221 of file zic.c.

◆ ZF_TILDAY

#define ZF_TILDAY   7

Definition at line 225 of file zic.c.

◆ ZF_TILMONTH

#define ZF_TILMONTH   6

Definition at line 224 of file zic.c.

◆ ZF_TILTIME

#define ZF_TILTIME   8

Definition at line 226 of file zic.c.

◆ ZF_TILYEAR

#define ZF_TILYEAR   5

Definition at line 223 of file zic.c.

◆ ZFC_FORMAT

#define ZFC_FORMAT   2

Definition at line 236 of file zic.c.

◆ ZFC_GMTOFF

#define ZFC_GMTOFF   0

Definition at line 234 of file zic.c.

◆ ZFC_RULE

#define ZFC_RULE   1

Definition at line 235 of file zic.c.

◆ ZFC_TILDAY

#define ZFC_TILDAY   5

Definition at line 239 of file zic.c.

◆ ZFC_TILMONTH

#define ZFC_TILMONTH   4

Definition at line 238 of file zic.c.

◆ ZFC_TILTIME

#define ZFC_TILTIME   6

Definition at line 240 of file zic.c.

◆ ZFC_TILYEAR

#define ZFC_TILYEAR   3

Definition at line 237 of file zic.c.

◆ ZIC_MAX

#define ZIC_MAX   INT_FAST64_MAX

Definition at line 38 of file zic.c.

◆ ZIC_MAX_ABBR_LEN_WO_WARN

#define ZIC_MAX_ABBR_LEN_WO_WARN   6

Definition at line 42 of file zic.c.

◆ ZIC_MIN

#define ZIC_MIN   INT_FAST64_MIN

Definition at line 37 of file zic.c.

◆ ZIC_VERSION

#define ZIC_VERSION   '3'

Definition at line 34 of file zic.c.

◆ ZIC_VERSION_PRE_2013

#define ZIC_VERSION_PRE_2013   '2'

Definition at line 33 of file zic.c.

◆ ZONE_MAXFIELDS

#define ZONE_MAXFIELDS   9

Definition at line 228 of file zic.c.

◆ ZONE_MINFIELDS

#define ZONE_MINFIELDS   5

Definition at line 227 of file zic.c.

◆ ZONEC_MAXFIELDS

#define ZONEC_MAXFIELDS   7

Definition at line 242 of file zic.c.

◆ ZONEC_MINFIELDS

#define ZONEC_MINFIELDS   3

Definition at line 241 of file zic.c.

Typedef Documentation

◆ zic_t

Definition at line 36 of file zic.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
YEAR_BY_YEAR_ZONE 

Definition at line 2103 of file zic.c.

Function Documentation

◆ add_icu_final_rules()

static int add_icu_final_rules ( const struct rule r1,
const struct rule r2 
)
static

Definition at line 588 of file zic.c.

References erealloc, finalRules, finalRulesCount, i, r1, and r2.

Referenced by outzone().

◆ addtt()

static void addtt ( zic_t  starttime,
int  type 
)
static

◆ addtype()

static int addtype ( const zic_t  gmtoff,
const zic_t  rawoff,
const zic_t  dstoff,
char *const  abbr,
int  isdst,
int  ttisstd,
int  ttisgmt 
)
static

◆ adjleap()

static void adjleap ( void  )
static

Definition at line 2814 of file zic.c.

References corr, i, last, leapcnt, tadd(), and trans.

Referenced by main().

◆ associate()

◆ atcomp()

static int atcomp ( const void avp,
const void bvp 
)
static

Definition at line 1583 of file zic.c.

References a, and b.

Referenced by writezone().

◆ byword() [1/2]

static struct lookup const* byword ( const char *  string,
const struct lookup lp 
)
static

Referenced by infile(), inleap(), and rulesub().

◆ byword() [2/2]

static const struct lookup* byword ( register const char *const  word,
register const struct lookup *const  table 
)
static

Definition at line 2884 of file zic.c.

References ciequal(), itsabbr(), lp, and NULL.

◆ ciequal()

static int ciequal ( register const char *  ap,
register const char *  bp 
)
static

Definition at line 2861 of file zic.c.

References ap, bp, FALSE, lowerit(), and TRUE.

Referenced by byword().

◆ convert()

static void convert ( const int_fast32_t  val,
char *const  buf 
)
static

Definition at line 1543 of file zic.c.

References b, buf, i, and shift.

Referenced by puttzcode(), and writezone().

◆ convert64()

static void convert64 ( const zic_t  val,
char *const  buf 
)
static

Definition at line 1554 of file zic.c.

References b, buf, i, and shift.

Referenced by puttzcode64().

◆ doabbr()

static void doabbr ( char *const  abbr,
const char *const  format,
const char *const  letters,
const int  isdst,
const int  doquotes 
)
static

Definition at line 1946 of file zic.c.

References abbr(), cp, format, len, letters, NULL, sprintf, strchr, strcpy(), strlen(), strncpy(), and void.

Referenced by outzone(), and stringzone().

◆ dolink()

static void dolink ( const char *  fromfield,
const char *  tofield 
)
static

◆ eat()

static void eat ( const char *const  name,
const int  num 
)
static

Definition at line 477 of file zic.c.

References eats(), name, NULL, and num.

Referenced by associate(), infile(), main(), and outzone().

◆ eats()

static void eats ( const char *const  name,
const int  num,
const char *const  rname,
const int  rnum 
)
static

Definition at line 467 of file zic.c.

References filename, linenum, name, num, rfilename, and rlinenum.

Referenced by eat(), and outzone().

◆ emit_icu_link()

static void emit_icu_link ( FILE f,
const char *  from,
const char *  to 
)
static

Definition at line 549 of file zic.c.

References f, fprintf, and to.

Referenced by main().

◆ emit_icu_rule()

static void emit_icu_rule ( FILE f,
const struct rule r,
int  ruleIndex 
)
static

Definition at line 557 of file zic.c.

References DC_DOM, DYCODE, f, fprintf, lookup::l_word, mon_names, NULL, r, warning(), and wday_names.

Referenced by main().

◆ emit_icu_zone()

static void emit_icu_zone ( FILE f,
const char *  zoneName,
int  zoneOffset,
const struct rule rule,
int  ruleIndex,
int  startYear 
)
static

Definition at line 536 of file zic.c.

References f, fprintf, and rule::r_name.

Referenced by outzone().

◆ error()

static void error ( const char *const  string,
  ... 
)
static

◆ getfields() [1/2]

static char** getfields ( char *  buf)
static

Referenced by infile().

◆ getfields() [2/2]

static char** getfields ( register char *  cp)
static

Definition at line 2912 of file zic.c.

References _, cp, dp, emalloc, error(), exit(), isascii, isspace, NULL, size_product(), and strlen().

◆ gethms()

static zic_t gethms ( const char *  string,
const char *  errstrng,
int  signable 
)
static

◆ getopt()

int getopt ( int  argc,
char *const  argv[],
const char *  options 
)

Definition at line 53 of file getopt.c.

References BADARG, BADCH, EMSG, fprintf, NULL, optarg, opterr, optind, optopt, optreset, strchr, and void.

Referenced by getOption(), and main().

◆ growalloc()

static void* growalloc ( void ptr,
size_t  itemsize,
int  nitems,
int nitems_alloc 
)
static

Definition at line 449 of file zic.c.

References erealloc, INT_MAX, memory_exhausted(), ptr, SIZE_MAX, and size_product().

Referenced by addtt(), inlink(), inrule(), and inzsub().

◆ infile()

◆ inleap() [1/2]

static void inleap ( char **  fields,
int  nfields 
)
static

Referenced by infile().

◆ inleap() [2/2]

◆ inlink() [1/2]

static void inlink ( char **  fields,
int  nfields 
)
static

Referenced by infile().

◆ inlink() [2/2]

static void inlink ( register char **const  fields,
const int  nfields 
)
static

◆ inrule() [1/2]

static void inrule ( char **  fields,
int  nfields 
)
static

Referenced by infile().

◆ inrule() [2/2]

◆ inzcont() [1/2]

static int inzcont ( char **  fields,
int  nfields 
)
static

Referenced by infile().

◆ inzcont() [2/2]

static int inzcont ( register char **const  fields,
const int  nfields 
)
static

Definition at line 1178 of file zic.c.

References _, error(), FALSE, gen-indic-table::fields, inzsub(), TRUE, and ZONEC_MAXFIELDS.

◆ inzone() [1/2]

static int inzone ( char **  fields,
int  nfields 
)
static

Referenced by infile().

◆ inzone() [2/2]

static int inzone ( register char **const  fields,
const int  nfields 
)
static

◆ inzsub() [1/2]

static int inzsub ( char **  fields,
int  nfields,
int  iscont 
)
static

Referenced by inzcont(), and inzone().

◆ inzsub() [2/2]

◆ is32()

static int is32 ( const zic_t  x)
static

Definition at line 1592 of file zic.c.

References INT32_MAX, INT32_MIN, and cordic::x.

Referenced by writezone().

◆ itsabbr()

static int itsabbr ( register const char *  abbr,
register const char *  word 
)
static

Definition at line 2870 of file zic.c.

References abbr(), FALSE, lowerit(), and TRUE.

Referenced by byword().

◆ itsdir()

static int itsdir ( const char *  name)
static

Definition at line 870 of file zic.c.

References access, ecatalloc, ecpyalloc, F_OK, free, myname, and name.

Referenced by dolink(), mkdirs(), and writezone().

◆ leapadd()

static void leapadd ( zic_t  t,
int  positive,
int  rolling,
int  count 
)
static

Definition at line 2784 of file zic.c.

References _, corr, count, error(), exit(), EXIT_FAILURE, i, j, leapcnt, roll, rolling, t, trans, and TZ_MAX_LEAPS.

Referenced by inleap().

◆ link()

int link ( const char *  fromname,
const char *  toname 
)

Referenced by dolink().

◆ lowerit()

static int lowerit ( int  c)
static

Definition at line 2853 of file zic.c.

References a, isascii, isupper, and tolower.

Referenced by ciequal(), itsabbr(), and rulesub().

◆ main()

int main ( int  argc,
char **  argv 
)

© 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html

COPYRIGHT: Copyright (c) 1999-2003, International Business Machines Corporation and others. All Rights Reserved.

© 2016 and later: Unicode, Inc. and others. License & terms of use: http://www.unicode.org/copyright.html

COPYRIGHT: Copyright (c) 1999-2002, International Business Machines Corporation and others. All Rights Reserved.

Definition at line 610 of file zic.c.

References _, adjleap(), argc, argv, associate(), bindtextdomain, c, dolink(), e, eat(), emit_icu_link(), emit_icu_rule(), EOF, errno, errors, exit(), EXIT_FAILURE, EXIT_SUCCESS, finalRules, finalRulesCount, fopen, fprintf, getopt(), i, ICU_ZONE_FILE, icuFile, infile(), j, lcltime, leapsec, links, nlinks, noise, NULL, nzones, optarg, optind, outzone(), PKGVERSION, printf(), progname, psxrules, S_IWGRP, S_IWOTH, setlocale, fc-lang::stdout, strcmp(), strerror(), textdomain, TRUE, TYPE_BIT, TZ_DOMAIN, TZDEFAULT, TZDEFRULES, TZDIR, TZVERSION, umask, usage(), void, warning(), yitcommand, zone::z_name, and zones.

◆ memcheck()

static void* memcheck ( void *const  ptr)
static

Definition at line 436 of file zic.c.

References errno, memory_exhausted(), NULL, ptr, and strerror().

◆ memory_exhausted()

static void memory_exhausted ( const char *  msg)
static

Definition at line 421 of file zic.c.

References _, exit(), EXIT_FAILURE, fprintf, and progname.

Referenced by growalloc(), memcheck(), and size_product().

◆ mkdirs()

static int mkdirs ( char *  filename)
static

Definition at line 3108 of file zic.c.

References _, cp, e, ecpyalloc, errno, fprintf, free, isalpha, itsdir(), mkdir(), MKDIR_UMASK, name, NULL, progname, strchr, strerror(), and void.

Referenced by dolink(), and writezone().

◆ newabbr()

static void newabbr ( const char *  abbr)
static

◆ oadd()

static zic_t oadd ( zic_t  t1,
zic_t  t2 
)
static

Definition at line 2952 of file zic.c.

References _, error(), exit(), EXIT_FAILURE, t1, t2, ZIC_MAX, and ZIC_MIN.

Referenced by gethms(), inleap(), outzone(), and rpytime().

◆ outzone()

◆ puttzcode()

static void puttzcode ( const int_fast32_t  val,
FILE *const  fp 
)
static

Definition at line 1565 of file zic.c.

References buf, convert(), fp, fwrite(), and void.

Referenced by writezone().

◆ puttzcode64()

static void puttzcode64 ( const zic_t  val,
FILE *const  fp 
)
static

Definition at line 1574 of file zic.c.

References buf, convert64(), fp, fwrite(), and void.

Referenced by writezone().

◆ rcomp()

static int rcomp ( const void cp1,
const void cp2 
)
static

Definition at line 891 of file zic.c.

References rule::r_name, and strcmp().

Referenced by associate().

◆ rpytime() [1/2]

static zic_t rpytime ( const struct rule rp,
zic_t  wantedy 
)
static

Referenced by inzsub(), and outzone().

◆ rpytime() [2/2]

static zic_t rpytime ( register const struct rule *const  rp,
register const zic_t  wantedy 
)
static

◆ rule_cmp()

static int rule_cmp ( struct rule const a,
struct rule const b 
)
static

Definition at line 2090 of file zic.c.

References a, and b.

Referenced by stringzone().

◆ rulesub() [1/2]

static void rulesub ( register struct rule *const  rp,
const char *const  loyearp,
const char *const  hiyearp,
const char *const  typep,
const char *const  monthp,
const char *const  dayp,
const char *const  timep 
)
static

◆ rulesub() [2/2]

static void rulesub ( struct rule rp,
const char *  loyearp,
const char *  hiyearp,
const char *  typep,
const char *  monthp,
const char *  dayp,
const char *  timep 
)
static

Referenced by inrule(), and inzsub().

◆ size_product()

static size_t size_product ( size_t  nitems,
size_t  itemsize 
)
static

Definition at line 428 of file zic.c.

References memory_exhausted(), and SIZE_MAX.

Referenced by getfields(), growalloc(), and writezone().

◆ stringoffset()

static int stringoffset ( char *  result,
zic_t  offset 
)
static

◆ stringrule()

static int stringrule ( char *  result,
const struct rule *const  rp,
const zic_t  dstoff,
const zic_t  gmtoff 
)
static

◆ stringzone()

◆ tadd()

static zic_t tadd ( zic_t  t1,
zic_t  t2 
)
static

Definition at line 2962 of file zic.c.

References _, error(), exit(), EXIT_FAILURE, max_time, min_time, t1, and t2.

Referenced by adjleap(), inleap(), outzone(), rpytime(), and writezone().

◆ updateminmax()

static void updateminmax ( const zic_t  x)
static

Definition at line 1982 of file zic.c.

References max_year, min_year, and cordic::x.

Referenced by outzone().

◆ usage()

static void usage ( FILE stream,
int  status 
)
static

Definition at line 520 of file zic.c.

References _, exit(), fprintf, progname, REPORT_BUGS_TO, status, and void.

Referenced by main().

◆ verror()

static void verror ( const char *const  string,
va_list  args 
)
static

Definition at line 483 of file zic.c.

References _, errors, filename, fprintf, linenum, NULL, rfilename, rlinenum, and void.

Referenced by error(), and warning().

◆ warning()

static void warning ( const char *const  string,
  ... 
)
static

Definition at line 509 of file zic.c.

References _, args, errors, fprintf, va_end, va_start, and verror().

Referenced by associate(), dolink(), emit_icu_rule(), gethms(), main(), newabbr(), outzone(), and rpytime().

◆ writezone()

◆ yearistype()

static int yearistype ( int  year,
const char *  type 
)
static

Variable Documentation

◆ abbrinds

unsigned char abbrinds[256]
static

Definition at line 408 of file zic.c.

Referenced by addtt(), addtype(), outzone(), and writezone().

◆ attypes

struct attype * attypes
static

Referenced by addtt(), outzone(), and writezone().

◆ begin_years

struct lookup const begin_years[]
static
Initial value:
= {
{ "minimum", 0 },
{ "maximum", 1 },
{ NULL, 0 }
}
#define NULL
Definition: ftobjs.h:61

Definition at line 320 of file zic.c.

Referenced by rulesub().

◆ charcnt

int charcnt
static

◆ chars

char chars[50]
static

Definition at line 411 of file zic.c.

Referenced by addtt(), addtype(), newabbr(), and writezone().

◆ corr

zic_t corr[50]
static

Definition at line 413 of file zic.c.

Referenced by adjleap(), dev_rast_initfontdict(), getpdlist(), leapadd(), main(), sum_aux(), timesub(), and writezone().

◆ directory

const char* directory
static

Definition at line 605 of file zic.c.

◆ dstoffs

zic_t dstoffs[256]
static

Definition at line 405 of file zic.c.

Referenced by addtt(), addtype(), and writezone().

◆ DYCODE

const char* DYCODE[] = {"DOM", "DOWGEQ", "DOWLEQ"}
static

Definition at line 554 of file zic.c.

Referenced by emit_icu_rule().

◆ end_years

struct lookup const end_years[]
static
Initial value:
= {
{ "minimum", 0 },
{ "maximum", 1 },
{ "only", 2 },
{ NULL, 0 }
}

Definition at line 320 of file zic.c.

Referenced by rulesub().

◆ errors

int errors
static

Definition at line 187 of file zic.c.

Referenced by associate(), main(), verror(), and warning().

◆ filename

const char* filename
static

Definition at line 188 of file zic.c.

Referenced by eats(), infile(), inlink(), inrule(), inzsub(), and verror().

◆ finalRules

const struct rule** finalRules = NULL
static

Definition at line 316 of file zic.c.

Referenced by add_icu_final_rules(), and main().

◆ finalRulesCount

int finalRulesCount = 0
static

Definition at line 317 of file zic.c.

Referenced by add_icu_final_rules(), and main().

◆ gmtoffs

zic_t gmtoffs[256]
static

Definition at line 401 of file zic.c.

Referenced by addtt(), addtype(), outzone(), and writezone().

◆ icuFile

FILE* icuFile
static

Definition at line 533 of file zic.c.

Referenced by main(), and outzone().

◆ isdsts

char isdsts[256]
static

Definition at line 407 of file zic.c.

Referenced by addtt(), addtype(), outzone(), and writezone().

◆ lasts

struct lookup const lasts[]
static
Initial value:
= {
{ "last-Sunday", 0 },
{ "last-Monday", 1 },
{ "last-Tuesday", 2 },
{ "last-Wednesday", 3 },
{ "last-Thursday", 4 },
{ "last-Friday", 5 },
{ "last-Saturday", 6 },
{ NULL, 0 }
}

Definition at line 320 of file zic.c.

Referenced by rulesub().

◆ lcltime

const char* lcltime
static

Definition at line 604 of file zic.c.

Referenced by inzone(), and main().

◆ leap_types

struct lookup const leap_types[]
static
Initial value:
= {
{ "Rolling", ((bool)1) },
{ "Stationary", ((bool)0) },
{ NULL, 0 }
}
#define bool
Definition: autosp.c:101

Definition at line 320 of file zic.c.

Referenced by inleap().

◆ leapcnt

int leapcnt
static

Definition at line 189 of file zic.c.

Referenced by adjleap(), leapadd(), readzoneinfo(), and writezone().

◆ leapmaxyear

zic_t leapmaxyear
static

Definition at line 192 of file zic.c.

Referenced by inleap(), and outzone().

◆ leapminyear

zic_t leapminyear
static

Definition at line 191 of file zic.c.

Referenced by inleap(), and outzone().

◆ leapsec

const char* leapsec
static

Definition at line 606 of file zic.c.

Referenced by infile(), and main().

◆ leapseen

int leapseen
static

Definition at line 190 of file zic.c.

Referenced by inleap(), and outzone().

◆ len_months

const int len_months[2][12]
static
Initial value:
= {
{ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 },
{ 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
}

Definition at line 388 of file zic.c.

Referenced by inleap(), rpytime(), rulesub(), and stringrule().

◆ len_years

const int len_years[2]
static
Initial value:
= {
365 , 366
}

Definition at line 393 of file zic.c.

Referenced by inleap(), and rpytime().

◆ line_codes

struct lookup const line_codes[]
static
Initial value:
= {
{ "Rule", 0 },
{ "Zone", 1 },
{ "Link", 2 },
{ "Leap", 3 },
{ NULL, 0}
}

Definition at line 320 of file zic.c.

Referenced by infile().

◆ linenum

int linenum
static

Definition at line 193 of file zic.c.

Referenced by eats(), inlink(), inrule(), inzsub(), and verror().

◆ links

struct link* links
static

Definition at line 302 of file zic.c.

Referenced by inlink(), and main().

◆ max_abbrvar_len

int max_abbrvar_len
static

Definition at line 194 of file zic.c.

Referenced by inrule(), and outzone().

◆ max_format_len

int max_format_len
static

Definition at line 195 of file zic.c.

Referenced by inzsub(), and outzone().

◆ max_time

const zic_t max_time = -1 - ((zic_t) -1 << ( 64 - 1))
static

Definition at line 867 of file zic.c.

Referenced by inleap(), inzsub(), outzone(), rpytime(), and tadd().

◆ max_year

zic_t max_year
static

Definition at line 196 of file zic.c.

Referenced by outzone(), and updateminmax().

◆ min_time

const zic_t min_time = (zic_t) -1 << ( 64 - 1)
static

Definition at line 866 of file zic.c.

Referenced by addtt(), inleap(), inzsub(), outzone(), rpytime(), tadd(), and writezone().

◆ min_year

zic_t min_year
static

Definition at line 197 of file zic.c.

Referenced by outzone(), and updateminmax().

◆ mon_names

struct lookup const mon_names[]
static
Initial value:
= {
{ "January", 0 },
{ "February", 1 },
{ "March", 2 },
{ "April", 3 },
{ "May", 4 },
{ "June", 5 },
{ "July", 6 },
{ "August", 7 },
{ "September", 8 },
{ "October", 9 },
{ "November", 10 },
{ "December", 11 },
{ NULL, 0 }
}

Definition at line 320 of file zic.c.

Referenced by emit_icu_rule(), inleap(), and rulesub().

◆ nlinks

int nlinks
static

Definition at line 303 of file zic.c.

Referenced by do_subdir(), inlink(), kpathsea_dir_links(), and main().

◆ nlinks_alloc

int nlinks_alloc
static

Definition at line 304 of file zic.c.

Referenced by inlink().

◆ noise

int noise
static

Definition at line 198 of file zic.c.

Referenced by gethms(), main(), newabbr(), outzone(), and rpytime().

◆ nrules

int nrules
static

Definition at line 288 of file zic.c.

Referenced by associate(), build_equiv_class(), inrule(), parse_bracket_exp(), and pattern_search().

◆ nrules_alloc

int nrules_alloc
static

Definition at line 289 of file zic.c.

Referenced by inrule().

◆ nzones

int nzones
static

Definition at line 292 of file zic.c.

Referenced by associate(), gssentry(), inzone(), inzsub(), and main().

◆ nzones_alloc

int nzones_alloc
static

Definition at line 293 of file zic.c.

Referenced by inzsub().

◆ optarg

char* optarg
extern

Definition at line 42 of file getopt.c.

Referenced by main().

◆ optind

int optind
extern

Definition at line 39 of file getopt.c.

Referenced by main().

◆ PKGVERSION

char const PKGVERSION[] ="N/A"
static

Definition at line 21 of file zic.c.

Referenced by main().

◆ progname

const char* progname
static

Definition at line 201 of file zic.c.

Referenced by dolink(), infile(), main(), memory_exhausted(), mkdirs(), rulesub(), usage(), writezone(), and yearistype().

◆ psxrules

const char* psxrules
static

Definition at line 603 of file zic.c.

Referenced by inzone(), and main().

◆ rawoffs

zic_t rawoffs[256]
static

Definition at line 404 of file zic.c.

Referenced by addtt(), addtype(), and writezone().

◆ REPORT_BUGS_TO

char const REPORT_BUGS_TO[] ="N/A"
static

Definition at line 23 of file zic.c.

Referenced by usage().

◆ rfilename

const char* rfilename
static

Definition at line 199 of file zic.c.

Referenced by eats(), and verror().

◆ rlinenum

int rlinenum
static

Definition at line 200 of file zic.c.

Referenced by eats(), and verror().

◆ roll

char roll[50]
static

Definition at line 414 of file zic.c.

Referenced by gencraters(), leapadd(), ChineseCalendar::roll(), HebrewCalendar::roll(), and writezone().

◆ rules

struct rule* rules
static

Definition at line 287 of file zic.c.

Referenced by associate(), and inrule().

◆ timecnt

int timecnt
static

Definition at line 202 of file zic.c.

Referenced by addtt(), outzone(), readzoneinfo(), tzload(), tzparse(), and writezone().

◆ timecnt_alloc

int timecnt_alloc
static

Definition at line 203 of file zic.c.

Referenced by addtt().

◆ trans

zic_t trans[50]
static

Definition at line 412 of file zic.c.

Referenced by _SPLCopyTransformedHintMasks(), adjleap(), AnyActiveSubstrings(), ASMFromClassFPST(), bmeps_configure(), bmeps_setup(), build_charclass_op(), convertpnm(), DumpRefsHints(), dxf_path(), ExpandRef2(), FailureTrans(), formatarg(), geojson_curveto(), geojson_lineto(), geojson_moveto(), OT::glyf::CompositeGlyphChain::get_transformation(), HintMaskFromTransformedRef(), InstanciateReference(), leapadd(), main(), MatMultiply(), morx_dumpASM(), morx_dumpLigaFeature(), PageTransition::PageTransition(), pgm_path(), png_image_read_colormap(), png_run(), printComments(), re_string_allocate(), re_string_construct(), re_string_construct_common(), readttfencodings(), readttfwidths(), RSC2PS2(), SetTransformedHintMask(), SFDGetChar(), SMSetState(), SPLCopyTransformedHintMasks(), SPLCopyTranslatedHintMasks(), SplineChar2PS2(), SplineSetStroke(), TransByFontMatrix(), Transform(), OT::glyf::CompositeGlyphChain::transform_points(), utrans_clone_68(), utrans_close_68(), utrans_getID_68(), utrans_getSourceSet_68(), utrans_getUnicodeID_68(), utrans_openInverse_68(), utrans_openU_68(), utrans_setFilter_68(), utrans_toRules_68(), utrans_trans_68(), utrans_transIncremental_68(), utrans_transIncrementalUChars_68(), utrans_transUChars_68(), write_png(), writezone(), xfig_point(), ztrans_adoptFrom_68(), ztrans_adoptTo_68(), ztrans_clone_68(), ztrans_close_68(), ztrans_getDynamicClassID_68(), ztrans_getFrom_68(), ztrans_getStaticClassID_68(), ztrans_getTime_68(), ztrans_getTo_68(), ztrans_setFrom_68(), ztrans_setTime_68(), and ztrans_setTo_68().

◆ ttisgmts

char ttisgmts[256]
static

Definition at line 410 of file zic.c.

Referenced by addtt(), addtype(), outzone(), and writezone().

◆ ttisstds

char ttisstds[256]
static

Definition at line 409 of file zic.c.

Referenced by addtt(), addtype(), outzone(), and writezone().

◆ typecnt

int typecnt
static

Definition at line 204 of file zic.c.

Referenced by addtt(), addtype(), outzone(), readzoneinfo(), and writezone().

◆ TZVERSION

char const TZVERSION[] ="N/A"
static

Definition at line 22 of file zic.c.

Referenced by main().

◆ wday_names

struct lookup const wday_names[]
static
Initial value:
= {
{ "Sunday", 0 },
{ "Monday", 1 },
{ "Tuesday", 2 },
{ "Wednesday", 3 },
{ "Thursday", 4 },
{ "Friday", 5 },
{ "Saturday", 6 },
{ NULL, 0 }
}

Definition at line 320 of file zic.c.

Referenced by emit_icu_rule(), and rulesub().

◆ yitcommand

const char* yitcommand
static

Definition at line 607 of file zic.c.

Referenced by main(), and yearistype().

◆ zones

struct zone* zones
static