1 /* icalendar.h -- data structures and common code for icalendar scanner,
2 * parser, and application code
4 * This code is Copyright (c) 2014, by the authors of nmh. See the
5 * COPYRIGHT file in the root directory of the nmh distribution for
6 * complete copyright information.
10 * Types used in struct contentline below.
12 typedef struct value_list
{
14 struct value_list
*next
;
17 typedef struct param_list
{
18 char *param_name
; /* Name of property parameter. */
19 struct value_list
*values
; /* List of its values. */
20 struct param_list
*next
; /* Next node in list of property parameters. */
23 typedef enum cr_indicator
{
30 * Each (unfolded) line in the .ics file is represented by a struct
33 typedef struct contentline
{
34 char *name
; /* The name of the property, calprops,
36 struct param_list
*params
; /* List parameters. */
37 char *value
; /* Everything after the ':'. */
39 char *input_line
; /* The (unfolded) input line. */
40 size_t input_line_len
; /* Amount of text stored in input_line. */
41 size_t input_line_size
; /* Size of allocated input_line. */
42 charstring_t unexpected
; /* Accumulate unexpected characters in input. */
44 cr_indicator cr_before_lf
; /* To support CR before LF. If the first
45 line of the input has a CR before its LF,
46 assume that all output lines need to.
47 Only used in root node. */
49 struct contentline
*next
; /* Next node in list of content lines. */
50 struct contentline
*last
; /* Last node of list. Only used in root node. */
55 * List of vevents, each of which is a list of contentlines.
57 typedef struct vevent
{
58 contentline
*contentlines
;
60 /* The following is only used in the root node. */
68 void remove_contentline (contentline
*);
69 contentline
*add_contentline (contentline
*, const char *);
70 void add_param_name (contentline
*, char *);
71 void add_param_value (contentline
*, char *);
72 void remove_value (value_list
*);
73 struct contentline
*find_contentline (contentline
*, const char *,
75 void free_contentlines (contentline
*);
77 typedef struct tzdesc
*tzdesc_t
;
78 tzdesc_t
load_timezones (const contentline
*);
79 void free_timezones (tzdesc_t
);
80 char *format_datetime (tzdesc_t
, const contentline
*);
83 * The following provide access to, and by, the iCalendar parser.
86 /* This YYSTYPE definition prevents problems with Solaris yacc, which
87 has declarations of two variables of type YYSTYPE * in one
89 typedef char *charptr
;
90 #define YYSTYPE charptr
94 extern vevent vevents
;
96 extern int parser_status
;
98 /* And this is for the icalendar scanner. */
99 extern YYSTYPE icallval
;
102 * For directing the scanner to use files other than stdin/stdout.
103 * These don't use the accessors provided by modern flex because
104 * flex 2.5.4 doesn't supply them.
106 void icalset_inputfile (FILE *);
107 void icalset_outputfile (FILE *);