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. */
43 cr_indicator cr_before_lf
; /* To support CR before LF. If the first
44 line of the input has a CR before its LF,
45 assume that all output lines need to.
46 Only used in root node. */
48 struct contentline
*next
; /* Next node in list of content lines. */
49 struct contentline
*last
; /* Last node of list. Only used in root node. */
54 * List of vevents, each of which is a list of contentlines.
56 typedef struct vevent
{
57 contentline
*contentlines
;
59 /* The following is only used in the root node. */
67 void remove_contentline (contentline
*);
68 contentline
*add_contentline (contentline
*, const char *);
69 void add_param_name (contentline
*, char *);
70 void add_param_value (contentline
*, char *);
71 void remove_value (value_list
*);
72 struct contentline
*find_contentline (contentline
*, const char *,
74 void free_contentlines (contentline
*);
76 typedef struct tzdesc
*tzdesc_t
;
77 tzdesc_t
load_timezones (const contentline
*);
78 void free_timezones (tzdesc_t
);
79 char *format_datetime (tzdesc_t
, const contentline
*);
82 * The following provide access to, and by, the iCalendar parser.
85 /* This YYSTYPE definition prevents problems with Solaris yacc, which
86 has declarations of two variables of type YYSTYPE * in one
88 typedef char *charptr
;
89 #define YYSTYPE charptr
93 extern vevent vevents
;
96 /* And this is for the icalendar scanner. */
97 extern YYSTYPE icallval
;
100 * For directing the scanner to use a files other than stdin/stdout.
101 * These don't use the accessors provided by modern flex because
102 * flex 2.5.4 doesn't supply them.
104 void icalset_inputfile (FILE *);
105 void icalset_outputfile (FILE *);