|
|
ical.h - ics2txt - convert icalendar .ics file to plain text |
|
|
 |
git clone git://bitreich.org/ics2txt git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/ics2txt (git://bitreich.org) |
|
|
 |
Log |
|
|
 |
Files |
|
|
 |
Refs |
|
|
 |
Tags |
|
|
 |
README |
|
|
|
--- |
|
|
|
ical.h (1170B) |
|
|
|
--- |
|
|
|
1 #ifndef ICAL_H |
|
|
|
2 #define ICAL_H |
|
|
|
3 |
|
|
|
4 #include <stdio.h> |
|
|
|
5 #include <time.h> |
|
|
|
6 |
|
|
|
7 #define ICAL_STACK_SIZE 10 |
|
|
|
8 |
|
|
|
9 typedef enum { |
|
|
|
10 ICAL_BLOCK_VEVENT, |
|
|
|
11 ICAL_BLOCK_VTODO, |
|
|
|
12 ICAL_BLOCK_VJOURNAL, |
|
|
|
13 ICAL_BLOCK_VFREEBUSY, |
|
|
|
14 ICAL_BLOCK_VALARM, |
|
|
|
15 ICAL_BLOCK_OTHER, |
|
|
|
16 } IcalBlock; |
|
|
|
17 |
|
|
|
18 typedef struct { |
|
|
|
19 char name[32]; |
|
|
|
20 char tzid[32]; |
|
|
|
21 } IcalStack; |
|
|
|
22 |
|
|
|
23 typedef struct IcalParser IcalParser; |
|
|
|
24 struct IcalParser { |
|
|
|
25 /* function called while parsing in this order */ |
|
|
|
26 int (*fn_field_name)(IcalParser *, char *); |
|
|
|
27 int (*fn_param_name)(IcalParser *, char *); |
|
|
|
28 int (*fn_param_value)(IcalParser *, char *, char *); |
|
|
|
29 int (*fn_field_value)(IcalParser *, char *, char *); |
|
|
|
30 int (*fn_block_begin)(IcalParser *, char *); |
|
|
|
31 int (*fn_block_end)(IcalParser *, char *); |
|
|
|
32 /* if returning non-zero then halt the parser */ |
|
|
|
33 |
|
|
|
34 int base64; |
|
|
|
35 char *errmsg; |
|
|
|
36 size_t linenum; |
|
|
|
37 char *tzid; |
|
|
|
38 IcalBlock blocktype; |
|
|
|
39 IcalStack stack[ICAL_STACK_SIZE], *current; |
|
|
|
40 }; |
|
|
|
41 |
|
|
|
42 extern char *ical_block_name[ICAL_BLOCK_OTHER + 1]; |
|
|
|
43 |
|
|
|
44 int ical_parse(IcalParser *, FILE *); |
|
|
|
45 int ical_get_level(IcalParser *); |
|
|
|
46 int ical_get_time(IcalParser *, char *, time_t *); |
|
|
|
47 int ical_get_value(IcalParser *, char *, size_t *); |
|
|
|
48 int ical_err(IcalParser *, char *); |
|
|
|
49 |
|
|
|
50 #endif |
|