summaryrefslogtreecommitdiffabout
path: root/libical/src/libical
Unidiff
Diffstat (limited to 'libical/src/libical') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libical/config.h0
-rw-r--r--libical/src/libical/defines.h0
-rw-r--r--libical/src/libical/ical.h2996
-rw-r--r--libical/src/libical/icalattendee.c30
-rw-r--r--libical/src/libical/icalattendee.h69
-rw-r--r--libical/src/libical/icalcomponent.c1488
-rw-r--r--libical/src/libical/icalcomponent.h240
-rw-r--r--libical/src/libical/icalderivedparameter.c1205
-rw-r--r--libical/src/libical/icalderivedparameter.h307
-rw-r--r--libical/src/libical/icalderivedproperty.c2014
-rw-r--r--libical/src/libical/icalderivedproperty.h403
-rw-r--r--libical/src/libical/icalderivedvalue.c981
-rw-r--r--libical/src/libical/icalderivedvalue.h283
-rw-r--r--libical/src/libical/icalduration.c323
-rw-r--r--libical/src/libical/icalduration.h60
-rw-r--r--libical/src/libical/icalenums.c135
-rw-r--r--libical/src/libical/icalenums.h157
-rw-r--r--libical/src/libical/icalerror.c209
-rw-r--r--libical/src/libical/icalerror.h156
-rw-r--r--libical/src/libical/icallangbind.c275
-rw-r--r--libical/src/libical/icallangbind.h49
-rw-r--r--libical/src/libical/icallexer.c1793
-rw-r--r--libical/src/libical/icallexer.l170
-rw-r--r--libical/src/libical/icalmemory.c287
-rw-r--r--libical/src/libical/icalmemory.h85
-rw-r--r--libical/src/libical/icalmime.c388
-rw-r--r--libical/src/libical/icalmime.h43
-rw-r--r--libical/src/libical/icalparameter.c382
-rw-r--r--libical/src/libical/icalparameter.h69
-rw-r--r--libical/src/libical/icalparameterimpl.h52
-rw-r--r--libical/src/libical/icalparser.c1111
-rw-r--r--libical/src/libical/icalparser.h93
-rw-r--r--libical/src/libical/icalperiod.c170
-rw-r--r--libical/src/libical/icalperiod.h55
-rw-r--r--libical/src/libical/icalproperty.c810
-rw-r--r--libical/src/libical/icalproperty.h122
-rw-r--r--libical/src/libical/icalrecur.c2315
-rw-r--r--libical/src/libical/icalrecur.h189
-rw-r--r--libical/src/libical/icalrestriction.c1781
-rw-r--r--libical/src/libical/icalrestriction.c.in447
-rw-r--r--libical/src/libical/icalrestriction.h63
-rw-r--r--libical/src/libical/icaltime.c577
-rw-r--r--libical/src/libical/icaltime.h145
-rw-r--r--libical/src/libical/icaltypes.c285
-rw-r--r--libical/src/libical/icaltypes.h138
-rw-r--r--libical/src/libical/icalvalue.c1215
-rw-r--r--libical/src/libical/icalvalue.h85
-rw-r--r--libical/src/libical/icalvalueimpl.h93
-rw-r--r--libical/src/libical/icalversion.h7
-rw-r--r--libical/src/libical/icalversion.h.in7
-rw-r--r--libical/src/libical/icalyacc.c1447
-rw-r--r--libical/src/libical/icalyacc.h137
-rw-r--r--libical/src/libical/icalyacc.y404
-rw-r--r--libical/src/libical/libical.pro68
-rw-r--r--libical/src/libical/libicalE.pro66
-rw-r--r--libical/src/libical/pvl.c761
-rw-r--r--libical/src/libical/pvl.h94
-rw-r--r--libical/src/libical/sspm.c1621
-rw-r--r--libical/src/libical/sspm.h143
-rw-r--r--libical/src/libical/vsnprintf.c180
60 files changed, 29278 insertions, 0 deletions
diff --git a/libical/src/libical/config.h b/libical/src/libical/config.h
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/libical/src/libical/config.h
diff --git a/libical/src/libical/defines.h b/libical/src/libical/defines.h
new file mode 100644
index 0000000..e69de29
--- a/dev/null
+++ b/libical/src/libical/defines.h
diff --git a/libical/src/libical/ical.h b/libical/src/libical/ical.h
new file mode 100644
index 0000000..69a2c3a
--- a/dev/null
+++ b/libical/src/libical/ical.h
@@ -0,0 +1,2996 @@
1#ifndef ICAL_VERSION_H
2#define ICAL_VERSION_H
3
4#define ICAL_PACKAGE "libical"
5#define ICAL_VERSION "0.23"
6
7#endif
8/* -*- Mode: C -*- */
9/*======================================================================
10 FILE: icaltime.h
11 CREATOR: eric 02 June 2000
12
13
14 $Id$
15 $Locker$
16
17 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
18
19 This program is free software; you can redistribute it and/or modify
20 it under the terms of either:
21
22 The LGPL as published by the Free Software Foundation, version
23 2.1, available at: http://www.fsf.org/copyleft/lesser.html
24
25 Or:
26
27 The Mozilla Public License Version 1.0. You may obtain a copy of
28 the License at http://www.mozilla.org/MPL/
29
30 The Original Code is eric. The Initial Developer of the Original
31 Code is Eric Busboom
32
33
34======================================================================*/
35
36#ifndef ICALTIME_H
37#define ICALTIME_H
38
39#include <time.h>
40
41/* icaltime_span is returned by icalcomponent_get_span() */
42struct icaltime_span {
43 time_t start; /* in UTC */
44 time_t end; /* in UTC */
45 int is_busy; /* 1->busy time, 0-> free time */
46};
47
48
49struct icaltimetype
50{
51 int year;
52 int month;
53 int day;
54 int hour;
55 int minute;
56 int second;
57
58 int is_utc; /* 1-> time is in UTC timezone */
59
60 int is_date; /* 1 -> interpret this as date. */
61
62 const char* zone; /*Ptr to Olsen placename. Libical does not own mem*/
63 };
64
65/* Convert seconds past UNIX epoch to a timetype*/
66struct icaltimetype icaltime_from_timet(time_t v, int is_date);
67
68/* Return the time as seconds past the UNIX epoch */
69time_t icaltime_as_timet(struct icaltimetype);
70
71/* Return a string represention of the time, in RFC2445 format. The
72 string is owned by libical */
73char* icaltime_as_ical_string(struct icaltimetype tt);
74
75/* Like icaltime_from_timet(), except that the input may be in seconds
76 past the epoch in floating time. This routine is deprecated */
77struct icaltimetype icaltime_from_int(int v, int is_date, int is_utc);
78
79/* Like icaltime_as_timet, but in a floating epoch. This routine is deprecated */
80int icaltime_as_int(struct icaltimetype);
81
82/* create a time from an ISO format string */
83struct icaltimetype icaltime_from_string(const char* str);
84
85/* Routines for handling timezones */
86/* Return the offset of the named zone as seconds. tt is a time
87 indicating the date for which you want the offset */
88int icaltime_utc_offset(struct icaltimetype tt, const char* tzid);
89
90/* convert tt, of timezone tzid, into a utc time. Does nothing if the
91 time is already UTC. */
92struct icaltimetype icaltime_as_utc(struct icaltimetype tt,
93 const char* tzid);
94
95/* convert tt, a time in UTC, into a time in timezone tzid */
96struct icaltimetype icaltime_as_zone(struct icaltimetype tt,
97 const char* tzid);
98
99/* Return a null time, which indicates no time has been set. This time represent the beginning of the epoch */
100struct icaltimetype icaltime_null_time(void);
101
102/* Return true of the time is null. */
103int icaltime_is_null_time(struct icaltimetype t);
104
105/* Returns false if the time is clearly invalid, but is not null. This
106 is usually the result of creating a new time type buy not clearing
107 it, or setting one of the flags to an illegal value. */
108int icaltime_is_valid_time(struct icaltimetype t);
109
110/* Reset all of the time components to be in their normal ranges. For
111 instance, given a time with minutes=70, the minutes will be reduces
112 to 10, and the hour incremented. This allows the caller to do
113 arithmetic on times without worrying about overflow or
114 underflow. */
115struct icaltimetype icaltime_normalize(struct icaltimetype t);
116
117/* Return the day of the year of the given time */
118short icaltime_day_of_year(struct icaltimetype t);
119
120/* Create a new time, given a day of year and a year. */
121struct icaltimetype icaltime_from_day_of_year(short doy, short year);
122
123/* Return the day of the week of the given time. Sunday is 1 */
124short icaltime_day_of_week(struct icaltimetype t);
125
126/* Return the day of the year for the Sunday of the week that the
127 given time is within. */
128short icaltime_start_doy_of_week(struct icaltimetype t);
129
130/* Return a string with the time represented in the same format as ctime(). THe string is owned by libical */
131char* icaltime_as_ctime(struct icaltimetype);
132
133/* Return the week number for the week the given time is within */
134short icaltime_week_number(struct icaltimetype t);
135
136/* Create a new time from a weeknumber and a year. */
137struct icaltimetype icaltime_from_week_number(short week_number, short year);
138
139/* Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
140int icaltime_compare(struct icaltimetype a,struct icaltimetype b);
141
142/* like icaltime_compare, but only use the date parts. */
143int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b);
144
145/* Return the number of days in the given month */
146short icaltime_days_in_month(short month,short year);
147
148
149#endif /* !ICALTIME_H */
150
151
152
153/* -*- Mode: C -*- */
154/*======================================================================
155 FILE: icalduration.h
156 CREATOR: eric 26 Jan 2001
157
158
159 $Id$
160 $Locker$
161
162 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
163
164 This program is free software; you can redistribute it and/or modify
165 it under the terms of either:
166
167 The LGPL as published by the Free Software Foundation, version
168 2.1, available at: http://www.fsf.org/copyleft/lesser.html
169
170 Or:
171
172 The Mozilla Public License Version 1.0. You may obtain a copy of
173 the License at http://www.mozilla.org/MPL/
174
175 The Original Code is eric. The Initial Developer of the Original
176 Code is Eric Busboom
177
178
179======================================================================*/
180
181#ifndef ICALDURATION_H
182#define ICALDURATION_H
183
184
185struct icaldurationtype
186{
187 int is_neg;
188 unsigned int days;
189 unsigned int weeks;
190 unsigned int hours;
191 unsigned int minutes;
192 unsigned int seconds;
193};
194
195struct icaldurationtype icaldurationtype_from_int(int t);
196struct icaldurationtype icaldurationtype_from_string(const char*);
197int icaldurationtype_as_int(struct icaldurationtype duration);
198char* icaldurationtype_as_ical_string(struct icaldurationtype d);
199struct icaldurationtype icaldurationtype_null_duration();
200int icaldurationtype_is_null_duration(struct icaldurationtype d);
201
202struct icaltimetype icaltime_add(struct icaltimetype t,
203 struct icaldurationtype d);
204
205struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
206 struct icaltimetype t2);
207
208#endif /* !ICALDURATION_H */
209
210
211
212/* -*- Mode: C -*- */
213/*======================================================================
214 FILE: icalperiod.h
215 CREATOR: eric 26 Jan 2001
216
217
218 $Id$
219 $Locker$
220
221 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
222
223 This program is free software; you can redistribute it and/or modify
224 it under the terms of either:
225
226 The LGPL as published by the Free Software Foundation, version
227 2.1, available at: http://www.fsf.org/copyleft/lesser.html
228
229 Or:
230
231 The Mozilla Public License Version 1.0. You may obtain a copy of
232 the License at http://www.mozilla.org/MPL/
233
234 The Original Code is eric. The Initial Developer of the Original
235 Code is Eric Busboom
236
237
238======================================================================*/
239
240#ifndef ICALPERIOD_H
241#define ICALPERIOD_H
242
243
244struct icalperiodtype
245{
246 struct icaltimetype start;
247 struct icaltimetype end;
248 struct icaldurationtype duration;
249};
250
251struct icalperiodtype icalperiodtype_from_string (const char* str);
252
253const char* icalperiodtype_as_ical_string(struct icalperiodtype p);
254struct icalperiodtype icalperiodtype_null_period();
255int icalperiodtype_is_null_period(struct icalperiodtype p);
256int icalperiodtype_is_valid_period(struct icalperiodtype p);
257
258
259
260
261#endif /* !ICALTIME_H */
262
263
264
265
266/* -*- Mode: C -*-*/
267/*======================================================================
268 FILE: icalenums.h
269
270
271
272 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
273
274 This program is free software; you can redistribute it and/or modify
275 it under the terms of either:
276
277 The LGPL as published by the Free Software Foundation, version
278 2.1, available at: http://www.fsf.org/copyleft/lesser.html
279
280 Or:
281
282 The Mozilla Public License Version 1.0. You may obtain a copy of
283 the License at http://www.mozilla.org/MPL/
284
285 The original code is icalenums.h
286
287 Contributions from:
288 Graham Davison (g.m.davison@computer.org)
289
290======================================================================*/
291
292#ifndef ICALENUMS_H
293#define ICALENUMS_H
294
295
296
297/***********************************************************************
298 * Component enumerations
299**********************************************************************/
300
301typedef enum icalcomponent_kind {
302 ICAL_NO_COMPONENT,
303 ICAL_ANY_COMPONENT,/* Used to select all components*/
304 ICAL_XROOT_COMPONENT,
305 ICAL_XATTACH_COMPONENT, /* MIME attached data, returned by parser. */
306 ICAL_VEVENT_COMPONENT,
307 ICAL_VTODO_COMPONENT,
308 ICAL_VJOURNAL_COMPONENT,
309 ICAL_VCALENDAR_COMPONENT,
310 ICAL_VFREEBUSY_COMPONENT,
311 ICAL_VALARM_COMPONENT,
312 ICAL_XAUDIOALARM_COMPONENT,
313 ICAL_XDISPLAYALARM_COMPONENT,
314 ICAL_XEMAILALARM_COMPONENT,
315 ICAL_XPROCEDUREALARM_COMPONENT,
316 ICAL_VTIMEZONE_COMPONENT,
317 ICAL_XSTANDARD_COMPONENT,
318 ICAL_XDAYLIGHT_COMPONENT,
319 ICAL_X_COMPONENT,
320 ICAL_VSCHEDULE_COMPONENT,
321 ICAL_VQUERY_COMPONENT,
322 ICAL_VCAR_COMPONENT,
323 ICAL_VCOMMAND_COMPONENT,
324 ICAL_XLICINVALID_COMPONENT,
325 ICAL_XLICMIMEPART_COMPONENT /* a non-stardard component that mirrors
326 structure of MIME data */
327
328} icalcomponent_kind;
329
330
331
332/***********************************************************************
333 * Request Status codes
334 **********************************************************************/
335
336typedef enum icalrequeststatus {
337 ICAL_UNKNOWN_STATUS,
338 ICAL_2_0_SUCCESS_STATUS,
339 ICAL_2_1_FALLBACK_STATUS,
340 ICAL_2_2_IGPROP_STATUS,
341 ICAL_2_3_IGPARAM_STATUS,
342 ICAL_2_4_IGXPROP_STATUS,
343 ICAL_2_5_IGXPARAM_STATUS,
344 ICAL_2_6_IGCOMP_STATUS,
345 ICAL_2_7_FORWARD_STATUS,
346 ICAL_2_8_ONEEVENT_STATUS,
347 ICAL_2_9_TRUNC_STATUS,
348 ICAL_2_10_ONETODO_STATUS,
349 ICAL_2_11_TRUNCRRULE_STATUS,
350 ICAL_3_0_INVPROPNAME_STATUS,
351 ICAL_3_1_INVPROPVAL_STATUS,
352 ICAL_3_2_INVPARAM_STATUS,
353 ICAL_3_3_INVPARAMVAL_STATUS,
354 ICAL_3_4_INVCOMP_STATUS,
355 ICAL_3_5_INVTIME_STATUS,
356 ICAL_3_6_INVRULE_STATUS,
357 ICAL_3_7_INVCU_STATUS,
358 ICAL_3_8_NOAUTH_STATUS,
359 ICAL_3_9_BADVERSION_STATUS,
360 ICAL_3_10_TOOBIG_STATUS,
361 ICAL_3_11_MISSREQCOMP_STATUS,
362 ICAL_3_12_UNKCOMP_STATUS,
363 ICAL_3_13_BADCOMP_STATUS,
364 ICAL_3_14_NOCAP_STATUS,
365 ICAL_4_0_BUSY_STATUS,
366 ICAL_5_0_MAYBE_STATUS,
367 ICAL_5_1_UNAVAIL_STATUS,
368 ICAL_5_2_NOSERVICE_STATUS,
369 ICAL_5_3_NOSCHED_STATUS
370} icalrequeststatus;
371
372
373const char* icalenum_reqstat_desc(icalrequeststatus stat);
374short icalenum_reqstat_major(icalrequeststatus stat);
375short icalenum_reqstat_minor(icalrequeststatus stat);
376icalrequeststatus icalenum_num_to_reqstat(short major, short minor);
377
378/***********************************************************************
379 * Conversion functions
380**********************************************************************/
381
382
383/* Thse routines used to be in icalenums.c, but were moved into the
384 icalproperty, icalparameter, icalvalue, or icalcomponent modules. */
385
386/* const char* icalproperty_kind_to_string(icalproperty_kind kind);*/
387#define icalenum_property_kind_to_string(x) icalproperty_kind_to_string(x)
388
389/*icalproperty_kind icalproperty_string_to_kind(const char* string)*/
390#define icalenum_string_to_property_kind(x) icalproperty_string_to_kind(x)
391
392/*icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);*/
393#define icalenum_property_kind_to_value_kind(x) icalproperty_kind_to_value_kind(x)
394
395/*const char* icalenum_method_to_string(icalproperty_method);*/
396#define icalenum_method_to_string(x) icalproperty_method_to_string(x)
397
398/*icalproperty_method icalenum_string_to_method(const char* string);*/
399#define icalenum_string_to_method(x) icalproperty_string_to_method(x)
400
401/*const char* icalenum_status_to_string(icalproperty_status);*/
402#define icalenum_status_to_string(x) icalproperty_status_to_string(x)
403
404/*icalproperty_status icalenum_string_to_status(const char* string);*/
405#define icalenum_string_to_status(x) icalproperty_string_to_status(x)
406
407/*icalvalue_kind icalenum_string_to_value_kind(const char* str);*/
408#define icalenum_string_to_value_kind(x) icalvalue_string_to_kind(x)
409
410/*const char* icalenum_value_kind_to_string(icalvalue_kind kind);*/
411#define icalenum_value_kind_to_string(x) icalvalue_kind_to_string(x)
412
413/*const char* icalenum_component_kind_to_string(icalcomponent_kind kind);*/
414#define icalenum_component_kind_to_string(x) icalcomponent_kind_to_string(x)
415
416/*icalcomponent_kind icalenum_string_to_component_kind(const char* string);*/
417#define icalenum_string_to_component_kind(x) icalcomponent_string_to_kind(x)
418
419
420#endif /* !ICALENUMS_H */
421
422/* -*- Mode: C -*- */
423/*======================================================================
424 FILE: icaltypes.h
425 CREATOR: eric 20 March 1999
426
427
428 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
429
430 This program is free software; you can redistribute it and/or modify
431 it under the terms of either:
432
433 The LGPL as published by the Free Software Foundation, version
434 2.1, available at: http://www.fsf.org/copyleft/lesser.html
435
436 Or:
437
438 The Mozilla Public License Version 1.0. You may obtain a copy of
439 the License at http://www.mozilla.org/MPL/
440
441 The original code is icaltypes.h
442
443======================================================================*/
444
445#ifndef ICALTYPES_H
446#define ICALTYPES_H
447
448#include <time.h>
449
450
451/* This type type should probably be an opaque type... */
452struct icalattachtype
453{
454 void* binary;
455 int owns_binary;
456
457 char* base64;
458 int owns_base64;
459
460 char* url;
461
462 int refcount;
463
464};
465
466/* converts base64 to binary, fetches url and stores as binary, or
467 just returns data */
468
469struct icalattachtype* icalattachtype_new(void);
470void icalattachtype_add_reference(struct icalattachtype* v);
471void icalattachtype_free(struct icalattachtype* v);
472
473void icalattachtype_set_url(struct icalattachtype* v, char* url);
474char* icalattachtype_get_url(struct icalattachtype* v);
475
476void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
477 int owns);
478char* icalattachtype_get_base64(struct icalattachtype* v);
479
480void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
481 int owns);
482void* icalattachtype_get_binary(struct icalattachtype* v);
483
484struct icalgeotype
485{
486 float lat;
487 float lon;
488};
489
490
491struct icaldatetimeperiodtype
492{
493 struct icaltimetype time;
494 struct icalperiodtype period;
495};
496
497
498struct icaltriggertype
499{
500 struct icaltimetype time;
501 struct icaldurationtype duration;
502};
503
504struct icaltriggertype icaltriggertype_from_string(const char* str);
505
506int icaltriggertype_is_null_trigger(struct icaltriggertype tr);
507
508/* struct icalreqstattype. This struct contains two string pointers,
509but don't try to free either of them. The "desc" string is a pointer
510to a static table inside the library. Don't try to free it. The
511"debug" string is a pointer into the string that the called passed
512into to icalreqstattype_from_string. Don't try to free it either, and
513don't use it after the original string has been freed.
514
515BTW, you would get that original string from
516*icalproperty_get_requeststatus() or icalvalue_get_text(), when
517operating on a the value of a request_status property. */
518
519struct icalreqstattype {
520
521 icalrequeststatus code;
522 const char* desc;
523 const char* debug;
524};
525
526struct icalreqstattype icalreqstattype_from_string(const char* str);
527const char* icalreqstattype_as_string(struct icalreqstattype);
528
529
530
531struct icaltimezonephase {
532 const char* tzname;
533 int is_stdandard; /* 1 = standard tme, 0 = daylight savings time */
534 struct icaltimetype dtstart;
535 int offsetto;
536 int tzoffsetfrom;
537 const char* comment;
538 struct icaldatetimeperiodtype rdate;
539 const char* rrule;
540};
541
542
543struct icaltimezonetype {
544 const char* tzid;
545 struct icaltimetype last_mod;
546 const char* tzurl;
547
548 /* Array of phases. The end of the array is a phase with tzname == 0 */
549 struct icaltimezonephase *phases;
550};
551
552void icaltimezonetype_free(struct icaltimezonetype tzt);
553
554
555#endif /* !ICALTYPES_H */
556/* -*- Mode: C -*- */
557/*======================================================================
558 FILE: icalrecur.h
559 CREATOR: eric 20 March 2000
560
561
562 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
563
564 This program is free software; you can redistribute it and/or modify
565 it under the terms of either:
566
567 The LGPL as published by the Free Software Foundation, version
568 2.1, available at: http://www.fsf.org/copyleft/lesser.html
569
570 Or:
571
572 The Mozilla Public License Version 1.0. You may obtain a copy of
573 the License at http://www.mozilla.org/MPL/
574
575How to use:
576
5771) Get a rule and a start time from a component
578 icalproperty rrule;
579 struct icalrecurrencetype recur;
580 struct icaltimetype dtstart;
581
582 rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY);
583 recur = icalproperty_get_rrule(rrule);
584 start = icalproperty_get_dtstart(dtstart);
585
586Or, just make them up:
587 recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE");
588 dtstart = icaltime_from_string("19970101T123000")
589
5902) Create an iterator
591 icalrecur_iterator* ritr;
592 ritr = icalrecur_iterator_new(recur,start);
593
5943) Iterator over the occurrences
595 struct icaltimetype next;
596 while (next = icalrecur_iterator_next(ritr)
597 && !icaltime_is_null_time(next){
598 Do something with next
599 }
600
601Note that that the time returned by icalrecur_iterator_next is in
602whatever timezone that dtstart is in.
603
604======================================================================*/
605
606#ifndef ICALRECUR_H
607#define ICALRECUR_H
608
609#include <time.h>
610
611/***********************************************************************
612 * Recurrance enumerations
613**********************************************************************/
614
615typedef enum icalrecurrencetype_frequency
616{
617 /* These enums are used to index an array, so don't change the
618 order or the integers */
619
620 ICAL_SECONDLY_RECURRENCE=0,
621 ICAL_MINUTELY_RECURRENCE=1,
622 ICAL_HOURLY_RECURRENCE=2,
623 ICAL_DAILY_RECURRENCE=3,
624 ICAL_WEEKLY_RECURRENCE=4,
625 ICAL_MONTHLY_RECURRENCE=5,
626 ICAL_YEARLY_RECURRENCE=6,
627 ICAL_NO_RECURRENCE=7
628
629} icalrecurrencetype_frequency;
630
631typedef enum icalrecurrencetype_weekday
632{
633 ICAL_NO_WEEKDAY,
634 ICAL_SUNDAY_WEEKDAY,
635 ICAL_MONDAY_WEEKDAY,
636 ICAL_TUESDAY_WEEKDAY,
637 ICAL_WEDNESDAY_WEEKDAY,
638 ICAL_THURSDAY_WEEKDAY,
639 ICAL_FRIDAY_WEEKDAY,
640 ICAL_SATURDAY_WEEKDAY
641} icalrecurrencetype_weekday;
642
643enum {
644 ICAL_RECURRENCE_ARRAY_MAX = 0x7f7f,
645 ICAL_RECURRENCE_ARRAY_MAX_BYTE = 0x7f
646};
647
648
649
650/********************** Recurrence type routines **************/
651
652/* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of
653 the values and fields in struct icalrecurrencetype */
654
655#define ICAL_BY_SECOND_SIZE 61
656#define ICAL_BY_MINUTE_SIZE 61
657#define ICAL_BY_HOUR_SIZE 25
658#define ICAL_BY_DAY_SIZE 364 /* 7 days * 52 weeks */
659#define ICAL_BY_MONTHDAY_SIZE 32
660#define ICAL_BY_YEARDAY_SIZE 367
661#define ICAL_BY_WEEKNO_SIZE 54
662#define ICAL_BY_MONTH_SIZE 13
663#define ICAL_BY_SETPOS_SIZE 367
664
665/* Main struct for holding digested recurrence rules */
666struct icalrecurrencetype
667{
668 icalrecurrencetype_frequency freq;
669
670
671 /* until and count are mutually exclusive. */
672 struct icaltimetype until;
673 int count;
674
675 short interval;
676
677 icalrecurrencetype_weekday week_start;
678
679 /* The BY* parameters can each take a list of values. Here I
680 * assume that the list of values will not be larger than the
681 * range of the value -- that is, the client will not name a
682 * value more than once.
683
684 * Each of the lists is terminated with the value
685 * ICAL_RECURRENCE_ARRAY_MAX unless the the list is full.
686 */
687
688 short by_second[ICAL_BY_SECOND_SIZE];
689 short by_minute[ICAL_BY_MINUTE_SIZE];
690 short by_hour[ICAL_BY_HOUR_SIZE];
691 short by_day[ICAL_BY_DAY_SIZE]; /* Encoded value, see below */
692 short by_month_day[ICAL_BY_MONTHDAY_SIZE];
693 short by_year_day[ ICAL_BY_YEARDAY_SIZE];
694 short by_week_no[ICAL_BY_WEEKNO_SIZE];
695 short by_month[ICAL_BY_MONTH_SIZE];
696 short by_set_pos[ICAL_BY_SETPOS_SIZE];
697};
698
699
700void icalrecurrencetype_clear(struct icalrecurrencetype *r);
701
702/* The 'day' element of the by_day array is encoded to allow
703representation of both the day of the week ( Monday, Tueday), but also
704the Nth day of the week ( First tuesday of the month, last thursday of
705the year) These routines decode the day values */
706
707/* 1 == Monday, etc. */
708enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day);
709
710/* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
711short icalrecurrencetype_day_position(short day);
712
713
714/***********************************************************************
715 * Recurrance rule parser
716**********************************************************************/
717
718/* Convert between strings ans recurrencetype structures. */
719struct icalrecurrencetype icalrecurrencetype_from_string(const char* str);
720char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur);
721
722
723/********** recurrence iteration routines ********************/
724
725typedef void icalrecur_iterator;
726
727/* Create a new recurrence rule iterator */
728icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
729 struct icaltimetype dtstart);
730
731/* Get the next occurrence from an iterator */
732struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*);
733
734/* Free the iterator */
735void icalrecur_iterator_free(icalrecur_iterator*);
736
737/* Fills array up with at most 'count' time_t values, each
738 representing an occurrence time in seconds past the POSIX epoch */
739int icalrecur_expand_recurrence(char* rule, time_t start,
740 int count, time_t* array);
741
742
743#endif
744/* -*- Mode: C -*- */
745/*======================================================================
746 FILE: icalvalue.h
747 CREATOR: eric 20 March 1999
748
749
750 $Id$
751 $Locker$
752
753
754
755 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
756
757 This program is free software; you can redistribute it and/or modify
758 it under the terms of either:
759
760 The LGPL as published by the Free Software Foundation, version
761 2.1, available at: http://www.fsf.org/copyleft/lesser.html
762
763 Or:
764
765 The Mozilla Public License Version 1.0. You may obtain a copy of
766 the License at http://www.mozilla.org/MPL/
767
768 The original code is icalvalue.h
769
770 ======================================================================*/
771
772#ifndef ICALDERIVEDVALUE_H
773#define ICALDERIVEDVALUE_H
774
775
776typedef void icalvalue;
777
778
779
780void icalvalue_set_x(icalvalue* value, const char* v);
781icalvalue* icalvalue_new_x(const char* v);
782const char* icalvalue_get_x(icalvalue* value);
783
784icalvalue* icalvalue_new_attach (struct icalattachtype* v);
785void icalvalue_set_attach(icalvalue* value, struct icalattachtype* v);
786struct icalattachtype* icalvalue_get_attach(icalvalue* value);
787
788icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
789void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
790struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
791
792icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
793void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
794struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
795
796icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
797void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v);
798struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
799
800void icalvalue_reset_kind(icalvalue* value);
801
802/* Everything below this line is machine generated. Do not edit. */
803typedef enum icalvalue_kind {
804 ICAL_ANY_VALUE=5000,
805 ICAL_QUERY_VALUE=5001,
806 ICAL_TRIGGER_VALUE=5002,
807 ICAL_STATUS_VALUE=5003,
808 ICAL_TRANSP_VALUE=5004,
809 ICAL_CLASS_VALUE=5005,
810 ICAL_DATE_VALUE=5006,
811 ICAL_STRING_VALUE=5007,
812 ICAL_INTEGER_VALUE=5008,
813 ICAL_PERIOD_VALUE=5009,
814 ICAL_TEXT_VALUE=5010,
815 ICAL_DURATION_VALUE=5011,
816 ICAL_BOOLEAN_VALUE=5012,
817 ICAL_URI_VALUE=5013,
818 ICAL_DATETIMEPERIOD_VALUE=5014,
819 ICAL_GEO_VALUE=5015,
820 ICAL_DATETIME_VALUE=5016,
821 ICAL_UTCOFFSET_VALUE=5017,
822 ICAL_ATTACH_VALUE=5018,
823 ICAL_ACTION_VALUE=5019,
824 ICAL_CALADDRESS_VALUE=5020,
825 ICAL_X_VALUE=5021,
826 ICAL_FLOAT_VALUE=5022,
827 ICAL_REQUESTSTATUS_VALUE=5023,
828 ICAL_METHOD_VALUE=5024,
829 ICAL_BINARY_VALUE=5025,
830 ICAL_RECUR_VALUE=5026,
831 ICAL_NO_VALUE=5027
832} icalvalue_kind ;
833
834#define ICALPROPERTY_FIRST_ENUM 10000
835
836typedef enum icalproperty_action {
837 ICAL_ACTION_X = 10000,
838 ICAL_ACTION_AUDIO = 10001,
839 ICAL_ACTION_DISPLAY = 10002,
840 ICAL_ACTION_EMAIL = 10003,
841 ICAL_ACTION_PROCEDURE = 10004,
842 ICAL_ACTION_NONE = 10005
843} icalproperty_action;
844
845typedef enum icalproperty_class {
846 ICAL_CLASS_X = 10006,
847 ICAL_CLASS_PUBLIC = 10007,
848 ICAL_CLASS_PRIVATE = 10008,
849 ICAL_CLASS_CONFIDENTIAL = 10009,
850 ICAL_CLASS_NONE = 10010
851} icalproperty_class;
852
853typedef enum icalproperty_method {
854 ICAL_METHOD_X = 10011,
855 ICAL_METHOD_PUBLISH = 10012,
856 ICAL_METHOD_REQUEST = 10013,
857 ICAL_METHOD_REPLY = 10014,
858 ICAL_METHOD_ADD = 10015,
859 ICAL_METHOD_CANCEL = 10016,
860 ICAL_METHOD_REFRESH = 10017,
861 ICAL_METHOD_COUNTER = 10018,
862 ICAL_METHOD_DECLINECOUNTER = 10019,
863 ICAL_METHOD_CREATE = 10020,
864 ICAL_METHOD_READ = 10021,
865 ICAL_METHOD_RESPONSE = 10022,
866 ICAL_METHOD_MOVE = 10023,
867 ICAL_METHOD_MODIFY = 10024,
868 ICAL_METHOD_GENERATEUID = 10025,
869 ICAL_METHOD_DELETE = 10026,
870 ICAL_METHOD_NONE = 10027
871} icalproperty_method;
872
873typedef enum icalproperty_status {
874 ICAL_STATUS_X = 10028,
875 ICAL_STATUS_TENTATIVE = 10029,
876 ICAL_STATUS_CONFIRMED = 10030,
877 ICAL_STATUS_COMPLETED = 10031,
878 ICAL_STATUS_NEEDSACTION = 10032,
879 ICAL_STATUS_CANCELLED = 10033,
880 ICAL_STATUS_INPROCESS = 10034,
881 ICAL_STATUS_DRAFT = 10035,
882 ICAL_STATUS_FINAL = 10036,
883 ICAL_STATUS_NONE = 10037
884} icalproperty_status;
885
886typedef enum icalproperty_transp {
887 ICAL_TRANSP_X = 10038,
888 ICAL_TRANSP_OPAQUE = 10039,
889 ICAL_TRANSP_TRANSPARENT = 10040,
890 ICAL_TRANSP_NONE = 10041
891} icalproperty_transp;
892
893#define ICALPROPERTY_LAST_ENUM 10042
894
895
896 /* QUERY */
897icalvalue* icalvalue_new_query(const char* v);
898const char* icalvalue_get_query(icalvalue* value);
899void icalvalue_set_query(icalvalue* value, const char* v);
900
901
902 /* STATUS */
903icalvalue* icalvalue_new_status(enum icalproperty_status v);
904enum icalproperty_status icalvalue_get_status(icalvalue* value);
905void icalvalue_set_status(icalvalue* value, enum icalproperty_status v);
906
907
908 /* TRANSP */
909icalvalue* icalvalue_new_transp(enum icalproperty_transp v);
910enum icalproperty_transp icalvalue_get_transp(icalvalue* value);
911void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v);
912
913
914 /* CLASS */
915icalvalue* icalvalue_new_class(enum icalproperty_class v);
916enum icalproperty_class icalvalue_get_class(icalvalue* value);
917void icalvalue_set_class(icalvalue* value, enum icalproperty_class v);
918
919
920 /* DATE */
921icalvalue* icalvalue_new_date(struct icaltimetype v);
922struct icaltimetype icalvalue_get_date(icalvalue* value);
923void icalvalue_set_date(icalvalue* value, struct icaltimetype v);
924
925
926 /* STRING */
927icalvalue* icalvalue_new_string(const char* v);
928const char* icalvalue_get_string(icalvalue* value);
929void icalvalue_set_string(icalvalue* value, const char* v);
930
931
932 /* INTEGER */
933icalvalue* icalvalue_new_integer(int v);
934int icalvalue_get_integer(icalvalue* value);
935void icalvalue_set_integer(icalvalue* value, int v);
936
937
938 /* PERIOD */
939icalvalue* icalvalue_new_period(struct icalperiodtype v);
940struct icalperiodtype icalvalue_get_period(icalvalue* value);
941void icalvalue_set_period(icalvalue* value, struct icalperiodtype v);
942
943
944 /* TEXT */
945icalvalue* icalvalue_new_text(const char* v);
946const char* icalvalue_get_text(icalvalue* value);
947void icalvalue_set_text(icalvalue* value, const char* v);
948
949
950 /* DURATION */
951icalvalue* icalvalue_new_duration(struct icaldurationtype v);
952struct icaldurationtype icalvalue_get_duration(icalvalue* value);
953void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v);
954
955
956 /* BOOLEAN */
957icalvalue* icalvalue_new_boolean(int v);
958int icalvalue_get_boolean(icalvalue* value);
959void icalvalue_set_boolean(icalvalue* value, int v);
960
961
962 /* URI */
963icalvalue* icalvalue_new_uri(const char* v);
964const char* icalvalue_get_uri(icalvalue* value);
965void icalvalue_set_uri(icalvalue* value, const char* v);
966
967
968 /* GEO */
969icalvalue* icalvalue_new_geo(struct icalgeotype v);
970struct icalgeotype icalvalue_get_geo(icalvalue* value);
971void icalvalue_set_geo(icalvalue* value, struct icalgeotype v);
972
973
974 /* DATE-TIME */
975icalvalue* icalvalue_new_datetime(struct icaltimetype v);
976struct icaltimetype icalvalue_get_datetime(icalvalue* value);
977void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v);
978
979
980 /* UTC-OFFSET */
981icalvalue* icalvalue_new_utcoffset(int v);
982int icalvalue_get_utcoffset(icalvalue* value);
983void icalvalue_set_utcoffset(icalvalue* value, int v);
984
985
986 /* ACTION */
987icalvalue* icalvalue_new_action(enum icalproperty_action v);
988enum icalproperty_action icalvalue_get_action(icalvalue* value);
989void icalvalue_set_action(icalvalue* value, enum icalproperty_action v);
990
991
992 /* CAL-ADDRESS */
993icalvalue* icalvalue_new_caladdress(const char* v);
994const char* icalvalue_get_caladdress(icalvalue* value);
995void icalvalue_set_caladdress(icalvalue* value, const char* v);
996
997
998 /* FLOAT */
999icalvalue* icalvalue_new_float(float v);
1000float icalvalue_get_float(icalvalue* value);
1001void icalvalue_set_float(icalvalue* value, float v);
1002
1003
1004 /* REQUEST-STATUS */
1005icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v);
1006struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value);
1007void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
1008
1009
1010 /* METHOD */
1011icalvalue* icalvalue_new_method(enum icalproperty_method v);
1012enum icalproperty_method icalvalue_get_method(icalvalue* value);
1013void icalvalue_set_method(icalvalue* value, enum icalproperty_method v);
1014
1015
1016 /* BINARY */
1017icalvalue* icalvalue_new_binary(const char* v);
1018const char* icalvalue_get_binary(icalvalue* value);
1019void icalvalue_set_binary(icalvalue* value, const char* v);
1020
1021#endif /*ICALVALUE_H*/
1022/* -*- Mode: C -*- */
1023/*======================================================================
1024 FILE: icalparam.h
1025 CREATOR: eric 20 March 1999
1026
1027
1028 $Id$
1029 $Locker$
1030
1031
1032
1033 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
1034
1035 This program is free software; you can redistribute it and/or modify
1036 it under the terms of either:
1037
1038 The LGPL as published by the Free Software Foundation, version
1039 2.1, available at: http://www.fsf.org/copyleft/lesser.html
1040
1041 Or:
1042
1043 The Mozilla Public License Version 1.0. You may obtain a copy of
1044 the License at http://www.mozilla.org/MPL/
1045
1046 The original code is icalparam.h
1047
1048 ======================================================================*/
1049
1050#ifndef ICALDERIVEDPARAMETER_H
1051#define ICALDERIVEDPARAMETER_H
1052
1053
1054typedef void icalparameter;
1055
1056const char* icalparameter_enum_to_string(int e);
1057int icalparameter_string_to_enum(const char* str);
1058
1059/* Everything below this line is machine generated. Do not edit. */
1060typedef enum icalparameter_kind {
1061 ICAL_ANY_PARAMETER = 0,
1062 ICAL_ALTREP_PARAMETER,
1063 ICAL_CN_PARAMETER,
1064 ICAL_CUTYPE_PARAMETER,
1065 ICAL_DELEGATEDFROM_PARAMETER,
1066 ICAL_DELEGATEDTO_PARAMETER,
1067 ICAL_DIR_PARAMETER,
1068 ICAL_ENCODING_PARAMETER,
1069 ICAL_FBTYPE_PARAMETER,
1070 ICAL_FMTTYPE_PARAMETER,
1071 ICAL_LANGUAGE_PARAMETER,
1072 ICAL_MEMBER_PARAMETER,
1073 ICAL_PARTSTAT_PARAMETER,
1074 ICAL_RANGE_PARAMETER,
1075 ICAL_RELATED_PARAMETER,
1076 ICAL_RELTYPE_PARAMETER,
1077 ICAL_ROLE_PARAMETER,
1078 ICAL_RSVP_PARAMETER,
1079 ICAL_SENTBY_PARAMETER,
1080 ICAL_TZID_PARAMETER,
1081 ICAL_VALUE_PARAMETER,
1082 ICAL_X_PARAMETER,
1083 ICAL_XLICCOMPARETYPE_PARAMETER,
1084 ICAL_XLICERRORTYPE_PARAMETER,
1085 ICAL_NO_PARAMETER
1086} icalparameter_kind;
1087
1088#define ICALPARAMETER_FIRST_ENUM 20000
1089
1090typedef enum icalparameter_cutype {
1091 ICAL_CUTYPE_X = 20000,
1092 ICAL_CUTYPE_INDIVIDUAL = 20001,
1093 ICAL_CUTYPE_GROUP = 20002,
1094 ICAL_CUTYPE_RESOURCE = 20003,
1095 ICAL_CUTYPE_ROOM = 20004,
1096 ICAL_CUTYPE_UNKNOWN = 20005,
1097 ICAL_CUTYPE_NONE = 20006
1098} icalparameter_cutype;
1099
1100typedef enum icalparameter_encoding {
1101 ICAL_ENCODING_X = 20007,
1102 ICAL_ENCODING_8BIT = 20008,
1103 ICAL_ENCODING_BASE64 = 20009,
1104 ICAL_ENCODING_NONE = 20010
1105} icalparameter_encoding;
1106
1107typedef enum icalparameter_fbtype {
1108 ICAL_FBTYPE_X = 20011,
1109 ICAL_FBTYPE_FREE = 20012,
1110 ICAL_FBTYPE_BUSY = 20013,
1111 ICAL_FBTYPE_BUSYUNAVAILABLE = 20014,
1112 ICAL_FBTYPE_BUSYTENTATIVE = 20015,
1113 ICAL_FBTYPE_NONE = 20016
1114} icalparameter_fbtype;
1115
1116typedef enum icalparameter_partstat {
1117 ICAL_PARTSTAT_X = 20017,
1118 ICAL_PARTSTAT_NEEDSACTION = 20018,
1119 ICAL_PARTSTAT_ACCEPTED = 20019,
1120 ICAL_PARTSTAT_DECLINED = 20020,
1121 ICAL_PARTSTAT_TENTATIVE = 20021,
1122 ICAL_PARTSTAT_DELEGATED = 20022,
1123 ICAL_PARTSTAT_COMPLETED = 20023,
1124 ICAL_PARTSTAT_INPROCESS = 20024,
1125 ICAL_PARTSTAT_NONE = 20025
1126} icalparameter_partstat;
1127
1128typedef enum icalparameter_range {
1129 ICAL_RANGE_X = 20026,
1130 ICAL_RANGE_THISANDPRIOR = 20027,
1131 ICAL_RANGE_THISANDFUTURE = 20028,
1132 ICAL_RANGE_NONE = 20029
1133} icalparameter_range;
1134
1135typedef enum icalparameter_related {
1136 ICAL_RELATED_X = 20030,
1137 ICAL_RELATED_START = 20031,
1138 ICAL_RELATED_END = 20032,
1139 ICAL_RELATED_NONE = 20033
1140} icalparameter_related;
1141
1142typedef enum icalparameter_reltype {
1143 ICAL_RELTYPE_X = 20034,
1144 ICAL_RELTYPE_PARENT = 20035,
1145 ICAL_RELTYPE_CHILD = 20036,
1146 ICAL_RELTYPE_SIBLING = 20037,
1147 ICAL_RELTYPE_NONE = 20038
1148} icalparameter_reltype;
1149
1150typedef enum icalparameter_role {
1151 ICAL_ROLE_X = 20039,
1152 ICAL_ROLE_CHAIR = 20040,
1153 ICAL_ROLE_REQPARTICIPANT = 20041,
1154 ICAL_ROLE_OPTPARTICIPANT = 20042,
1155 ICAL_ROLE_NONPARTICIPANT = 20043,
1156 ICAL_ROLE_NONE = 20044
1157} icalparameter_role;
1158
1159typedef enum icalparameter_rsvp {
1160 ICAL_RSVP_X = 20045,
1161 ICAL_RSVP_TRUE = 20046,
1162 ICAL_RSVP_FALSE = 20047,
1163 ICAL_RSVP_NONE = 20048
1164} icalparameter_rsvp;
1165
1166typedef enum icalparameter_value {
1167 ICAL_VALUE_X = 20049,
1168 ICAL_VALUE_BINARY = 20050,
1169 ICAL_VALUE_BOOLEAN = 20051,
1170 ICAL_VALUE_DATE = 20052,
1171 ICAL_VALUE_DURATION = 20053,
1172 ICAL_VALUE_FLOAT = 20054,
1173 ICAL_VALUE_INTEGER = 20055,
1174 ICAL_VALUE_PERIOD = 20056,
1175 ICAL_VALUE_RECUR = 20057,
1176 ICAL_VALUE_TEXT = 20058,
1177 ICAL_VALUE_URI = 20059,
1178 ICAL_VALUE_ERROR = 20060,
1179 ICAL_VALUE_DATETIME = 20061,
1180 ICAL_VALUE_UTCOFFSET = 20062,
1181 ICAL_VALUE_CALADDRESS = 20063,
1182 ICAL_VALUE_NONE = 20064
1183} icalparameter_value;
1184
1185typedef enum icalparameter_xliccomparetype {
1186 ICAL_XLICCOMPARETYPE_X = 20065,
1187 ICAL_XLICCOMPARETYPE_EQUAL = 20066,
1188 ICAL_XLICCOMPARETYPE_NOTEQUAL = 20067,
1189 ICAL_XLICCOMPARETYPE_LESS = 20068,
1190 ICAL_XLICCOMPARETYPE_GREATER = 20069,
1191 ICAL_XLICCOMPARETYPE_LESSEQUAL = 20070,
1192 ICAL_XLICCOMPARETYPE_GREATEREQUAL = 20071,
1193 ICAL_XLICCOMPARETYPE_REGEX = 20072,
1194 ICAL_XLICCOMPARETYPE_NONE = 20073
1195} icalparameter_xliccomparetype;
1196
1197typedef enum icalparameter_xlicerrortype {
1198 ICAL_XLICERRORTYPE_X = 20074,
1199 ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20075,
1200 ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20076,
1201 ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20077,
1202 ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20078,
1203 ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20079,
1204 ICAL_XLICERRORTYPE_INVALIDITIP = 20080,
1205 ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20081,
1206 ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20082,
1207 ICAL_XLICERRORTYPE_NONE = 20083
1208} icalparameter_xlicerrortype;
1209
1210#define ICALPARAMETER_LAST_ENUM 20084
1211
1212/* DELEGATED-FROM */
1213icalparameter* icalparameter_new_delegatedfrom(const char* v);
1214const char* icalparameter_get_delegatedfrom(icalparameter* value);
1215void icalparameter_set_delegatedfrom(icalparameter* value, const char* v);
1216
1217/* DELEGATED-TO */
1218icalparameter* icalparameter_new_delegatedto(const char* v);
1219const char* icalparameter_get_delegatedto(icalparameter* value);
1220void icalparameter_set_delegatedto(icalparameter* value, const char* v);
1221
1222/* RANGE */
1223icalparameter* icalparameter_new_range(icalparameter_range v);
1224icalparameter_range icalparameter_get_range(icalparameter* value);
1225void icalparameter_set_range(icalparameter* value, icalparameter_range v);
1226
1227/* ENCODING */
1228icalparameter* icalparameter_new_encoding(icalparameter_encoding v);
1229icalparameter_encoding icalparameter_get_encoding(icalparameter* value);
1230void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v);
1231
1232/* RSVP */
1233icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v);
1234icalparameter_rsvp icalparameter_get_rsvp(icalparameter* value);
1235void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v);
1236
1237/* PARTSTAT */
1238icalparameter* icalparameter_new_partstat(icalparameter_partstat v);
1239icalparameter_partstat icalparameter_get_partstat(icalparameter* value);
1240void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
1241
1242/* RELTYPE */
1243icalparameter* icalparameter_new_reltype(icalparameter_reltype v);
1244icalparameter_reltype icalparameter_get_reltype(icalparameter* value);
1245void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v);
1246
1247/* CUTYPE */
1248icalparameter* icalparameter_new_cutype(icalparameter_cutype v);
1249icalparameter_cutype icalparameter_get_cutype(icalparameter* value);
1250void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v);
1251
1252/* MEMBER */
1253icalparameter* icalparameter_new_member(const char* v);
1254const char* icalparameter_get_member(icalparameter* value);
1255void icalparameter_set_member(icalparameter* value, const char* v);
1256
1257/* FMTTYPE */
1258icalparameter* icalparameter_new_fmttype(const char* v);
1259const char* icalparameter_get_fmttype(icalparameter* value);
1260void icalparameter_set_fmttype(icalparameter* value, const char* v);
1261
1262/* SENT-BY */
1263icalparameter* icalparameter_new_sentby(const char* v);
1264const char* icalparameter_get_sentby(icalparameter* value);
1265void icalparameter_set_sentby(icalparameter* value, const char* v);
1266
1267/* VALUE */
1268icalparameter* icalparameter_new_value(icalparameter_value v);
1269icalparameter_value icalparameter_get_value(icalparameter* value);
1270void icalparameter_set_value(icalparameter* value, icalparameter_value v);
1271
1272/* ALTREP */
1273icalparameter* icalparameter_new_altrep(const char* v);
1274const char* icalparameter_get_altrep(icalparameter* value);
1275void icalparameter_set_altrep(icalparameter* value, const char* v);
1276
1277/* DIR */
1278icalparameter* icalparameter_new_dir(const char* v);
1279const char* icalparameter_get_dir(icalparameter* value);
1280void icalparameter_set_dir(icalparameter* value, const char* v);
1281
1282/* RELATED */
1283icalparameter* icalparameter_new_related(icalparameter_related v);
1284icalparameter_related icalparameter_get_related(icalparameter* value);
1285void icalparameter_set_related(icalparameter* value, icalparameter_related v);
1286
1287/* CN */
1288icalparameter* icalparameter_new_cn(const char* v);
1289const char* icalparameter_get_cn(icalparameter* value);
1290void icalparameter_set_cn(icalparameter* value, const char* v);
1291
1292/* X-LIC-ERRORTYPE */
1293icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v);
1294icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value);
1295void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v);
1296
1297/* X */
1298icalparameter* icalparameter_new_x(const char* v);
1299const char* icalparameter_get_x(icalparameter* value);
1300void icalparameter_set_x(icalparameter* value, const char* v);
1301
1302/* LANGUAGE */
1303icalparameter* icalparameter_new_language(const char* v);
1304const char* icalparameter_get_language(icalparameter* value);
1305void icalparameter_set_language(icalparameter* value, const char* v);
1306
1307/* ROLE */
1308icalparameter* icalparameter_new_role(icalparameter_role v);
1309icalparameter_role icalparameter_get_role(icalparameter* value);
1310void icalparameter_set_role(icalparameter* value, icalparameter_role v);
1311
1312/* X-LIC-COMPARETYPE */
1313icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v);
1314icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value);
1315void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v);
1316
1317/* FBTYPE */
1318icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v);
1319icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value);
1320void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v);
1321
1322/* TZID */
1323icalparameter* icalparameter_new_tzid(const char* v);
1324const char* icalparameter_get_tzid(icalparameter* value);
1325void icalparameter_set_tzid(icalparameter* value, const char* v);
1326
1327#endif /*ICALPARAMETER_H*/
1328
1329/* -*- Mode: C -*-
1330 ======================================================================
1331 FILE: icalderivedproperties.{c,h}
1332 CREATOR: eric 09 May 1999
1333
1334 $Id$
1335
1336 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
1337 ======================================================================*/
1338
1339
1340#ifndef ICALDERIVEDPROPERTY_H
1341#define ICALDERIVEDPROPERTY_H
1342
1343#include <time.h>
1344
1345typedef void icalproperty;
1346
1347
1348/* Everything below this line is machine generated. Do not edit. */
1349typedef enum icalproperty_kind {
1350 ICAL_ANY_PROPERTY = 0,
1351 ICAL_ACTION_PROPERTY,
1352 ICAL_ATTACH_PROPERTY,
1353 ICAL_ATTENDEE_PROPERTY,
1354 ICAL_CALSCALE_PROPERTY,
1355 ICAL_CATEGORIES_PROPERTY,
1356 ICAL_CLASS_PROPERTY,
1357 ICAL_COMMENT_PROPERTY,
1358 ICAL_COMPLETED_PROPERTY,
1359 ICAL_CONTACT_PROPERTY,
1360 ICAL_CREATED_PROPERTY,
1361 ICAL_DESCRIPTION_PROPERTY,
1362 ICAL_DTEND_PROPERTY,
1363 ICAL_DTSTAMP_PROPERTY,
1364 ICAL_DTSTART_PROPERTY,
1365 ICAL_DUE_PROPERTY,
1366 ICAL_DURATION_PROPERTY,
1367 ICAL_EXDATE_PROPERTY,
1368 ICAL_EXRULE_PROPERTY,
1369 ICAL_FREEBUSY_PROPERTY,
1370 ICAL_GEO_PROPERTY,
1371 ICAL_LASTMODIFIED_PROPERTY,
1372 ICAL_LOCATION_PROPERTY,
1373 ICAL_MAXRESULTS_PROPERTY,
1374 ICAL_MAXRESULTSSIZE_PROPERTY,
1375 ICAL_METHOD_PROPERTY,
1376 ICAL_ORGANIZER_PROPERTY,
1377 ICAL_PERCENTCOMPLETE_PROPERTY,
1378 ICAL_PRIORITY_PROPERTY,
1379 ICAL_PRODID_PROPERTY,
1380 ICAL_QUERY_PROPERTY,
1381 ICAL_QUERYNAME_PROPERTY,
1382 ICAL_RDATE_PROPERTY,
1383 ICAL_RECURRENCEID_PROPERTY,
1384 ICAL_RELATEDTO_PROPERTY,
1385 ICAL_REPEAT_PROPERTY,
1386 ICAL_REQUESTSTATUS_PROPERTY,
1387 ICAL_RESOURCES_PROPERTY,
1388 ICAL_RRULE_PROPERTY,
1389 ICAL_SCOPE_PROPERTY,
1390 ICAL_SEQUENCE_PROPERTY,
1391 ICAL_STATUS_PROPERTY,
1392 ICAL_SUMMARY_PROPERTY,
1393 ICAL_TARGET_PROPERTY,
1394 ICAL_TRANSP_PROPERTY,
1395 ICAL_TRIGGER_PROPERTY,
1396 ICAL_TZID_PROPERTY,
1397 ICAL_TZNAME_PROPERTY,
1398 ICAL_TZOFFSETFROM_PROPERTY,
1399 ICAL_TZOFFSETTO_PROPERTY,
1400 ICAL_TZURL_PROPERTY,
1401 ICAL_UID_PROPERTY,
1402 ICAL_URL_PROPERTY,
1403 ICAL_VERSION_PROPERTY,
1404 ICAL_X_PROPERTY,
1405 ICAL_XLICCLUSTERCOUNT_PROPERTY,
1406 ICAL_XLICERROR_PROPERTY,
1407 ICAL_XLICMIMECHARSET_PROPERTY,
1408 ICAL_XLICMIMECID_PROPERTY,
1409 ICAL_XLICMIMECONTENTTYPE_PROPERTY,
1410 ICAL_XLICMIMEENCODING_PROPERTY,
1411 ICAL_XLICMIMEFILENAME_PROPERTY,
1412 ICAL_XLICMIMEOPTINFO_PROPERTY,
1413 ICAL_NO_PROPERTY
1414} icalproperty_kind;
1415
1416icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...);
1417
1418/* ACTION */
1419icalproperty* icalproperty_new_action(enum icalproperty_action v);
1420void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v);
1421enum icalproperty_action icalproperty_get_action(icalproperty* prop);icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...);
1422
1423/* ATTACH */
1424icalproperty* icalproperty_new_attach(struct icalattachtype* v);
1425void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v);
1426struct icalattachtype* icalproperty_get_attach(icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...);
1427
1428/* ATTENDEE */
1429icalproperty* icalproperty_new_attendee(const char* v);
1430void icalproperty_set_attendee(icalproperty* prop, const char* v);
1431const char* icalproperty_get_attendee(icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...);
1432
1433/* CALSCALE */
1434icalproperty* icalproperty_new_calscale(const char* v);
1435void icalproperty_set_calscale(icalproperty* prop, const char* v);
1436const char* icalproperty_get_calscale(icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...);
1437
1438/* CATEGORIES */
1439icalproperty* icalproperty_new_categories(const char* v);
1440void icalproperty_set_categories(icalproperty* prop, const char* v);
1441const char* icalproperty_get_categories(icalproperty* prop);icalproperty* icalproperty_vanew_class(const char* v, ...);
1442
1443/* CLASS */
1444icalproperty* icalproperty_new_class(const char* v);
1445void icalproperty_set_class(icalproperty* prop, const char* v);
1446const char* icalproperty_get_class(icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...);
1447
1448/* COMMENT */
1449icalproperty* icalproperty_new_comment(const char* v);
1450void icalproperty_set_comment(icalproperty* prop, const char* v);
1451const char* icalproperty_get_comment(icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...);
1452
1453/* COMPLETED */
1454icalproperty* icalproperty_new_completed(struct icaltimetype v);
1455void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v);
1456struct icaltimetype icalproperty_get_completed(icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...);
1457
1458/* CONTACT */
1459icalproperty* icalproperty_new_contact(const char* v);
1460void icalproperty_set_contact(icalproperty* prop, const char* v);
1461const char* icalproperty_get_contact(icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...);
1462
1463/* CREATED */
1464icalproperty* icalproperty_new_created(struct icaltimetype v);
1465void icalproperty_set_created(icalproperty* prop, struct icaltimetype v);
1466struct icaltimetype icalproperty_get_created(icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...);
1467
1468/* DESCRIPTION */
1469icalproperty* icalproperty_new_description(const char* v);
1470void icalproperty_set_description(icalproperty* prop, const char* v);
1471const char* icalproperty_get_description(icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...);
1472
1473/* DTEND */
1474icalproperty* icalproperty_new_dtend(struct icaltimetype v);
1475void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v);
1476struct icaltimetype icalproperty_get_dtend(icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...);
1477
1478/* DTSTAMP */
1479icalproperty* icalproperty_new_dtstamp(struct icaltimetype v);
1480void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v);
1481struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...);
1482
1483/* DTSTART */
1484icalproperty* icalproperty_new_dtstart(struct icaltimetype v);
1485void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v);
1486struct icaltimetype icalproperty_get_dtstart(icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...);
1487
1488/* DUE */
1489icalproperty* icalproperty_new_due(struct icaltimetype v);
1490void icalproperty_set_due(icalproperty* prop, struct icaltimetype v);
1491struct icaltimetype icalproperty_get_due(icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...);
1492
1493/* DURATION */
1494icalproperty* icalproperty_new_duration(struct icaldurationtype v);
1495void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v);
1496struct icaldurationtype icalproperty_get_duration(icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...);
1497
1498/* EXDATE */
1499icalproperty* icalproperty_new_exdate(struct icaltimetype v);
1500void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v);
1501struct icaltimetype icalproperty_get_exdate(icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...);
1502
1503/* EXRULE */
1504icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v);
1505void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v);
1506struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...);
1507
1508/* FREEBUSY */
1509icalproperty* icalproperty_new_freebusy(struct icalperiodtype v);
1510void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v);
1511struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...);
1512
1513/* GEO */
1514icalproperty* icalproperty_new_geo(struct icalgeotype v);
1515void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v);
1516struct icalgeotype icalproperty_get_geo(icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...);
1517
1518/* LAST-MODIFIED */
1519icalproperty* icalproperty_new_lastmodified(struct icaltimetype v);
1520void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v);
1521struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...);
1522
1523/* LOCATION */
1524icalproperty* icalproperty_new_location(const char* v);
1525void icalproperty_set_location(icalproperty* prop, const char* v);
1526const char* icalproperty_get_location(icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...);
1527
1528/* MAXRESULTS */
1529icalproperty* icalproperty_new_maxresults(int v);
1530void icalproperty_set_maxresults(icalproperty* prop, int v);
1531int icalproperty_get_maxresults(icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...);
1532
1533/* MAXRESULTSSIZE */
1534icalproperty* icalproperty_new_maxresultssize(int v);
1535void icalproperty_set_maxresultssize(icalproperty* prop, int v);
1536int icalproperty_get_maxresultssize(icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...);
1537
1538/* METHOD */
1539icalproperty* icalproperty_new_method(enum icalproperty_method v);
1540void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v);
1541enum icalproperty_method icalproperty_get_method(icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...);
1542
1543/* ORGANIZER */
1544icalproperty* icalproperty_new_organizer(const char* v);
1545void icalproperty_set_organizer(icalproperty* prop, const char* v);
1546const char* icalproperty_get_organizer(icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...);
1547
1548/* PERCENT-COMPLETE */
1549icalproperty* icalproperty_new_percentcomplete(int v);
1550void icalproperty_set_percentcomplete(icalproperty* prop, int v);
1551int icalproperty_get_percentcomplete(icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...);
1552
1553/* PRIORITY */
1554icalproperty* icalproperty_new_priority(int v);
1555void icalproperty_set_priority(icalproperty* prop, int v);
1556int icalproperty_get_priority(icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...);
1557
1558/* PRODID */
1559icalproperty* icalproperty_new_prodid(const char* v);
1560void icalproperty_set_prodid(icalproperty* prop, const char* v);
1561const char* icalproperty_get_prodid(icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...);
1562
1563/* QUERY */
1564icalproperty* icalproperty_new_query(const char* v);
1565void icalproperty_set_query(icalproperty* prop, const char* v);
1566const char* icalproperty_get_query(icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...);
1567
1568/* QUERYNAME */
1569icalproperty* icalproperty_new_queryname(const char* v);
1570void icalproperty_set_queryname(icalproperty* prop, const char* v);
1571const char* icalproperty_get_queryname(icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...);
1572
1573/* RDATE */
1574icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v);
1575void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v);
1576struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...);
1577
1578/* RECURRENCE-ID */
1579icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v);
1580void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v);
1581struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...);
1582
1583/* RELATED-TO */
1584icalproperty* icalproperty_new_relatedto(const char* v);
1585void icalproperty_set_relatedto(icalproperty* prop, const char* v);
1586const char* icalproperty_get_relatedto(icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...);
1587
1588/* REPEAT */
1589icalproperty* icalproperty_new_repeat(int v);
1590void icalproperty_set_repeat(icalproperty* prop, int v);
1591int icalproperty_get_repeat(icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...);
1592
1593/* REQUEST-STATUS */
1594icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v);
1595void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v);
1596struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...);
1597
1598/* RESOURCES */
1599icalproperty* icalproperty_new_resources(const char* v);
1600void icalproperty_set_resources(icalproperty* prop, const char* v);
1601const char* icalproperty_get_resources(icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...);
1602
1603/* RRULE */
1604icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v);
1605void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v);
1606struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...);
1607
1608/* SCOPE */
1609icalproperty* icalproperty_new_scope(const char* v);
1610void icalproperty_set_scope(icalproperty* prop, const char* v);
1611const char* icalproperty_get_scope(icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...);
1612
1613/* SEQUENCE */
1614icalproperty* icalproperty_new_sequence(int v);
1615void icalproperty_set_sequence(icalproperty* prop, int v);
1616int icalproperty_get_sequence(icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...);
1617
1618/* STATUS */
1619icalproperty* icalproperty_new_status(enum icalproperty_status v);
1620void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v);
1621enum icalproperty_status icalproperty_get_status(icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...);
1622
1623/* SUMMARY */
1624icalproperty* icalproperty_new_summary(const char* v);
1625void icalproperty_set_summary(icalproperty* prop, const char* v);
1626const char* icalproperty_get_summary(icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...);
1627
1628/* TARGET */
1629icalproperty* icalproperty_new_target(const char* v);
1630void icalproperty_set_target(icalproperty* prop, const char* v);
1631const char* icalproperty_get_target(icalproperty* prop);icalproperty* icalproperty_vanew_transp(const char* v, ...);
1632
1633/* TRANSP */
1634icalproperty* icalproperty_new_transp(const char* v);
1635void icalproperty_set_transp(icalproperty* prop, const char* v);
1636const char* icalproperty_get_transp(icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...);
1637
1638/* TRIGGER */
1639icalproperty* icalproperty_new_trigger(struct icaltriggertype v);
1640void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v);
1641struct icaltriggertype icalproperty_get_trigger(icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...);
1642
1643/* TZID */
1644icalproperty* icalproperty_new_tzid(const char* v);
1645void icalproperty_set_tzid(icalproperty* prop, const char* v);
1646const char* icalproperty_get_tzid(icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...);
1647
1648/* TZNAME */
1649icalproperty* icalproperty_new_tzname(const char* v);
1650void icalproperty_set_tzname(icalproperty* prop, const char* v);
1651const char* icalproperty_get_tzname(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...);
1652
1653/* TZOFFSETFROM */
1654icalproperty* icalproperty_new_tzoffsetfrom(int v);
1655void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v);
1656int icalproperty_get_tzoffsetfrom(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...);
1657
1658/* TZOFFSETTO */
1659icalproperty* icalproperty_new_tzoffsetto(int v);
1660void icalproperty_set_tzoffsetto(icalproperty* prop, int v);
1661int icalproperty_get_tzoffsetto(icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...);
1662
1663/* TZURL */
1664icalproperty* icalproperty_new_tzurl(const char* v);
1665void icalproperty_set_tzurl(icalproperty* prop, const char* v);
1666const char* icalproperty_get_tzurl(icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...);
1667
1668/* UID */
1669icalproperty* icalproperty_new_uid(const char* v);
1670void icalproperty_set_uid(icalproperty* prop, const char* v);
1671const char* icalproperty_get_uid(icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...);
1672
1673/* URL */
1674icalproperty* icalproperty_new_url(const char* v);
1675void icalproperty_set_url(icalproperty* prop, const char* v);
1676const char* icalproperty_get_url(icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...);
1677
1678/* VERSION */
1679icalproperty* icalproperty_new_version(const char* v);
1680void icalproperty_set_version(icalproperty* prop, const char* v);
1681const char* icalproperty_get_version(icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...);
1682
1683/* X */
1684icalproperty* icalproperty_new_x(const char* v);
1685void icalproperty_set_x(icalproperty* prop, const char* v);
1686const char* icalproperty_get_x(icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...);
1687
1688/* X-LIC-CLUSTERCOUNT */
1689icalproperty* icalproperty_new_xlicclustercount(const char* v);
1690void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v);
1691const char* icalproperty_get_xlicclustercount(icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...);
1692
1693/* X-LIC-ERROR */
1694icalproperty* icalproperty_new_xlicerror(const char* v);
1695void icalproperty_set_xlicerror(icalproperty* prop, const char* v);
1696const char* icalproperty_get_xlicerror(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...);
1697
1698/* X-LIC-MIMECHARSET */
1699icalproperty* icalproperty_new_xlicmimecharset(const char* v);
1700void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v);
1701const char* icalproperty_get_xlicmimecharset(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...);
1702
1703/* X-LIC-MIMECID */
1704icalproperty* icalproperty_new_xlicmimecid(const char* v);
1705void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v);
1706const char* icalproperty_get_xlicmimecid(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...);
1707
1708/* X-LIC-MIMECONTENTTYPE */
1709icalproperty* icalproperty_new_xlicmimecontenttype(const char* v);
1710void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v);
1711const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...);
1712
1713/* X-LIC-MIMEENCODING */
1714icalproperty* icalproperty_new_xlicmimeencoding(const char* v);
1715void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v);
1716const char* icalproperty_get_xlicmimeencoding(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...);
1717
1718/* X-LIC-MIMEFILENAME */
1719icalproperty* icalproperty_new_xlicmimefilename(const char* v);
1720void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v);
1721const char* icalproperty_get_xlicmimefilename(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...);
1722
1723/* X-LIC-MIMEOPTINFO */
1724icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v);
1725void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v);
1726const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop);
1727
1728#endif /*ICALPROPERTY_H*/
1729/* -*- Mode: C -*- */
1730/*======================================================================
1731 FILE: icalvalue.h
1732 CREATOR: eric 20 March 1999
1733
1734
1735 $Id$
1736 $Locker$
1737
1738
1739
1740 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
1741
1742 This program is free software; you can redistribute it and/or modify
1743 it under the terms of either:
1744
1745 The LGPL as published by the Free Software Foundation, version
1746 2.1, available at: http://www.fsf.org/copyleft/lesser.html
1747
1748 Or:
1749
1750 The Mozilla Public License Version 1.0. You may obtain a copy of
1751 the License at http://www.mozilla.org/MPL/
1752
1753 The original code is icalvalue.h
1754
1755 ======================================================================*/
1756
1757#ifndef ICALVALUE_H
1758#define ICALVALUE_H
1759
1760#include <time.h>
1761
1762/* Defined in icalderivedvalue.h */
1763/*typedef void icalvalue;*/
1764
1765icalvalue* icalvalue_new(icalvalue_kind kind);
1766
1767icalvalue* icalvalue_new_clone(icalvalue* value);
1768
1769icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str);
1770
1771void icalvalue_free(icalvalue* value);
1772
1773int icalvalue_is_valid(icalvalue* value);
1774
1775const char* icalvalue_as_ical_string(icalvalue* value);
1776
1777icalvalue_kind icalvalue_isa(icalvalue* value);
1778
1779int icalvalue_isa_value(void*);
1780
1781icalparameter_xliccomparetype icalvalue_compare(icalvalue* a, icalvalue *b);
1782
1783
1784/* Special, non autogenerated value accessors */
1785
1786icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
1787void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
1788struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
1789
1790icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
1791void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
1792struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
1793
1794icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
1795void icalvalue_set_datetimeperiod(icalvalue* value,
1796 struct icaldatetimeperiodtype v);
1797struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
1798
1799/* Convert enumerations */
1800
1801icalvalue_kind icalvalue_string_to_kind(const char* str);
1802const char* icalvalue_kind_to_string(icalvalue_kind kind);
1803
1804
1805#endif /*ICALVALUE_H*/
1806/* -*- Mode: C -*- */
1807/*======================================================================
1808 FILE: icalparam.h
1809 CREATOR: eric 20 March 1999
1810
1811
1812 $Id$
1813 $Locker$
1814
1815
1816
1817 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
1818
1819 This program is free software; you can redistribute it and/or modify
1820 it under the terms of either:
1821
1822 The LGPL as published by the Free Software Foundation, version
1823 2.1, available at: http://www.fsf.org/copyleft/lesser.html
1824
1825 Or:
1826
1827 The Mozilla Public License Version 1.0. You may obtain a copy of
1828 the License at http://www.mozilla.org/MPL/
1829
1830 The original code is icalparam.h
1831
1832 ======================================================================*/
1833
1834#ifndef ICALPARAM_H
1835#define ICALPARAM_H
1836
1837
1838/* Declared in icalderivedparameter.h */
1839/*typedef void icalparameter;*/
1840
1841icalparameter* icalparameter_new(icalparameter_kind kind);
1842icalparameter* icalparameter_new_clone(icalparameter* p);
1843
1844/* Create from string of form "PARAMNAME=VALUE" */
1845icalparameter* icalparameter_new_from_string(const char* value);
1846
1847/* Create from just the value, the part after the "=" */
1848icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value);
1849
1850void icalparameter_free(icalparameter* parameter);
1851
1852char* icalparameter_as_ical_string(icalparameter* parameter);
1853
1854int icalparameter_is_valid(icalparameter* parameter);
1855
1856icalparameter_kind icalparameter_isa(icalparameter* parameter);
1857
1858int icalparameter_isa_parameter(void* param);
1859
1860/* Acess the name of an X parameer */
1861void icalparameter_set_xname (icalparameter* param, const char* v);
1862const char* icalparameter_get_xname(icalparameter* param);
1863void icalparameter_set_xvalue (icalparameter* param, const char* v);
1864const char* icalparameter_get_xvalue(icalparameter* param);
1865
1866/* Convert enumerations */
1867
1868const char* icalparameter_kind_to_string(icalparameter_kind kind);
1869icalparameter_kind icalparameter_string_to_kind(const char* string);
1870
1871
1872
1873#endif
1874/* -*- Mode: C -*- */
1875/*======================================================================
1876 FILE: icalproperty.h
1877 CREATOR: eric 20 March 1999
1878
1879
1880 $Id$
1881 $Locker$
1882
1883
1884
1885 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
1886
1887 This program is free software; you can redistribute it and/or modify
1888 it under the terms of either:
1889
1890 The LGPL as published by the Free Software Foundation, version
1891 2.1, available at: http://www.fsf.org/copyleft/lesser.html
1892
1893 Or:
1894
1895 The Mozilla Public License Version 1.0. You may obtain a copy of
1896 the License at http://www.mozilla.org/MPL/
1897
1898 The original code is icalparam.h
1899
1900 ======================================================================*/
1901
1902
1903#ifndef ICALPROPERTY_H
1904#define ICALPROPERTY_H
1905
1906#include <time.h>
1907
1908
1909
1910
1911/* Actually in icalderivedproperty.h:
1912 typedef void icalproperty; */
1913
1914
1915icalproperty* icalproperty_new(icalproperty_kind kind);
1916
1917icalproperty* icalproperty_new_clone(icalproperty * prop);
1918
1919icalproperty* icalproperty_new_from_string(const char* str);
1920
1921const char* icalproperty_as_ical_string(icalproperty* prop);
1922
1923void icalproperty_free(icalproperty* prop);
1924
1925icalproperty_kind icalproperty_isa(icalproperty* property);
1926int icalproperty_isa_property(void* property);
1927
1928void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
1929void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter);
1930void icalproperty_set_parameter_from_string(icalproperty* prop,
1931 const char* name, const char* value);
1932const char* icalproperty_get_parameter_as_string(icalproperty* prop,
1933 const char* name);
1934
1935void icalproperty_remove_parameter(icalproperty* prop,
1936 icalparameter_kind kind);
1937
1938int icalproperty_count_parameters(icalproperty* prop);
1939
1940/* Iterate through the parameters */
1941icalparameter* icalproperty_get_first_parameter(icalproperty* prop,
1942 icalparameter_kind kind);
1943icalparameter* icalproperty_get_next_parameter(icalproperty* prop,
1944 icalparameter_kind kind);
1945/* Access the value of the property */
1946void icalproperty_set_value(icalproperty* prop, icalvalue* value);
1947void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind);
1948
1949icalvalue* icalproperty_get_value(icalproperty* prop);
1950const char* icalproperty_get_value_as_string(icalproperty* prop);
1951
1952/* Deal with X properties */
1953
1954void icalproperty_set_x_name(icalproperty* prop, const char* name);
1955const char* icalproperty_get_x_name(icalproperty* prop);
1956
1957/* Return the name of the property -- the type name converted to a
1958 string, or the value of _get_x_name if the type is and X property */
1959const char* icalproperty_get_name (icalproperty* prop);
1960
1961icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
1962
1963/* Convert kinds to string and get default value type */
1964
1965icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);
1966icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
1967const char* icalproperty_kind_to_string(icalproperty_kind kind);
1968icalproperty_kind icalproperty_string_to_kind(const char* string);
1969
1970icalproperty_method icalproperty_string_to_method(const char* str);
1971const char* icalproperty_method_to_string(icalproperty_method method);
1972
1973
1974const char* icalproperty_enum_to_string(int e);
1975int icalproperty_string_to_enum(const char* str);
1976
1977const char* icalproperty_status_to_string(icalproperty_status);
1978icalproperty_status icalproperty_string_to_status(const char* string);
1979
1980int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e);
1981
1982
1983
1984
1985#endif /*ICALPROPERTY_H*/
1986/* -*- Mode: C -*- */
1987/*======================================================================
1988 FILE: icalattendee.h
1989 CREATOR: eric 8 Mar 01
1990
1991
1992 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
1993
1994 This program is free software; you can redistribute it and/or modify
1995 it under the terms of either:
1996
1997 The LGPL as published by the Free Software Foundation, version
1998 2.1, available at: http://www.fsf.org/copyleft/lesser.html
1999
2000 Or:
2001
2002 The Mozilla Public License Version 1.0. You may obtain a copy of
2003 the License at http://www.mozilla.org/MPL/
2004
2005 The original code is icaltypes.h
2006
2007======================================================================*/
2008
2009#ifndef ICALATTENDEE_H
2010#define ICALATTENDEE_H
2011
2012#include <time.h>
2013
2014struct icalorganizertype {
2015 const char* value;
2016 const char* common_name;
2017 const char* dir;
2018 const char* sentby;
2019 const char* language;
2020
2021};
2022
2023/* Create a copy of the given organizer. Libical will not own the
2024 memory for the strings in the copy; the call must free them */
2025struct icalorganizertype icalorganizertype_new_clone(struct icalorganizertype a);
2026
2027
2028struct icalattendeetype {
2029 const char* cuid; /* Cal user id, contents of the property value */
2030 /*icalparameter_cutype cutype;*/
2031 const char* member;
2032 /*icalparameter_role role;*/
2033 int rsvp;
2034 const char* delto;
2035 const char* delfrom;
2036 const char* sentby;
2037 const char* cn;
2038 const char* dir;
2039 const char* language;
2040};
2041
2042/* Create a copy of the given attendee. Libical will not own the
2043 memory for the strings in the copy; the call must free them */
2044struct icalattendeetype icalattendeetype_new_clone(struct icalattendeetype a);
2045
2046
2047#endif /* !ICALATTENDEE_H */
2048/*======================================================================
2049 FILE: pvl.h
2050 CREATOR: eric November, 1995
2051
2052
2053 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2054======================================================================*/
2055
2056
2057#ifndef __PVL_H__
2058#define __PVL_H__
2059
2060typedef void* pvl_list;
2061typedef void* pvl_elem;
2062
2063/*
2064 struct pvl_elem_t
2065
2066 This type is private. Always use pvl_elem instead. The struct would
2067 not even appear in this header except to make code in the USE_MACROS
2068 blocks work
2069
2070 */
2071typedef struct pvl_elem_t
2072{
2073 int MAGIC; /* Magic Identifier */
2074 void *d; /* Pointer to data user is storing */
2075 struct pvl_elem_t *next;/* Next element */
2076 struct pvl_elem_t *prior;/* prior element */
2077} pvl_elem_t;
2078
2079
2080
2081/* This global is incremented for each call to pvl_new_element(); it gives each
2082 * list a unique identifer */
2083
2084extern int pvl_elem_count;
2085extern int pvl_list_count;
2086
2087/* Create new lists or elements */
2088pvl_elem pvl_new_element(void* d, pvl_elem next,pvl_elem prior);
2089pvl_list pvl_newlist(void);
2090void pvl_free(pvl_list);
2091
2092/* Add, remove, or get the head of the list */
2093void pvl_unshift(pvl_list l,void *d);
2094void* pvl_shift(pvl_list l);
2095pvl_elem pvl_head(pvl_list);
2096
2097/* Add, remove or get the tail of the list */
2098void pvl_push(pvl_list l,void *d);
2099void* pvl_pop(pvl_list l);
2100pvl_elem pvl_tail(pvl_list);
2101
2102/* Insert elements in random places */
2103typedef int (*pvl_comparef)(void* a, void* b); /* a, b are of the data type*/
2104void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d);
2105void pvl_insert_after(pvl_list l,pvl_elem e,void *d);
2106void pvl_insert_before(pvl_list l,pvl_elem e,void *d);
2107
2108/* Remove an element, or clear the entire list */
2109void* pvl_remove(pvl_list,pvl_elem); /* Remove element, return data */
2110void pvl_clear(pvl_list); /* Remove all elements, de-allocate all data */
2111
2112int pvl_count(pvl_list);
2113
2114/* Navagate the list */
2115pvl_elem pvl_next(pvl_elem e);
2116pvl_elem pvl_prior(pvl_elem e);
2117
2118/* get the data in the list */
2119#ifndef PVL_USE_MACROS
2120void* pvl_data(pvl_elem);
2121#else
2122#define pvl_data(x) x==0 ? 0 : ((struct pvl_elem_t *)x)->d;
2123#endif
2124
2125
2126/* Find an element for which a function returns true */
2127typedef int (*pvl_findf)(void* a, void* b); /*a is list elem, b is other data*/
2128pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v);
2129pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v);
2130
2131/* Pass each element in the list to a function */
2132typedef void (*pvl_applyf)(void* a, void* b); /*a is list elem, b is other data*/
2133void pvl_apply(pvl_list l,pvl_applyf f, void *v);
2134
2135
2136#endif /* __PVL_H__ */
2137
2138
2139
2140
2141
2142/* -*- Mode: C -*- */
2143/*======================================================================
2144 FILE: icalcomponent.h
2145 CREATOR: eric 20 March 1999
2146
2147
2148 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2149
2150 This program is free software; you can redistribute it and/or modify
2151 it under the terms of either:
2152
2153 The LGPL as published by the Free Software Foundation, version
2154 2.1, available at: http://www.fsf.org/copyleft/lesser.html
2155
2156 Or:
2157
2158 The Mozilla Public License Version 1.0. You may obtain a copy of
2159 the License at http://www.mozilla.org/MPL/
2160
2161 The original code is icalcomponent.h
2162
2163======================================================================*/
2164
2165#ifndef ICALCOMPONENT_H
2166#define ICALCOMPONENT_H
2167
2168
2169typedef void icalcomponent;
2170
2171/* This is exposed so that callers will not have to allocate and
2172 deallocate iterators. Pretend that you can't see it. */
2173typedef struct icalcompiter
2174{
2175 icalcomponent_kind kind;
2176 pvl_elem iter;
2177
2178} icalcompiter;
2179
2180icalcomponent* icalcomponent_new(icalcomponent_kind kind);
2181icalcomponent* icalcomponent_new_clone(icalcomponent* component);
2182icalcomponent* icalcomponent_new_from_string(char* str);
2183icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...);
2184void icalcomponent_free(icalcomponent* component);
2185
2186char* icalcomponent_as_ical_string(icalcomponent* component);
2187
2188int icalcomponent_is_valid(icalcomponent* component);
2189
2190icalcomponent_kind icalcomponent_isa(icalcomponent* component);
2191
2192int icalcomponent_isa_component (void* component);
2193
2194/*
2195 * Working with properties
2196 */
2197
2198void icalcomponent_add_property(icalcomponent* component,
2199 icalproperty* property);
2200
2201void icalcomponent_remove_property(icalcomponent* component,
2202 icalproperty* property);
2203
2204int icalcomponent_count_properties(icalcomponent* component,
2205 icalproperty_kind kind);
2206
2207/* Iterate through the properties */
2208icalproperty* icalcomponent_get_current_property(icalcomponent* component);
2209
2210icalproperty* icalcomponent_get_first_property(icalcomponent* component,
2211 icalproperty_kind kind);
2212icalproperty* icalcomponent_get_next_property(icalcomponent* component,
2213 icalproperty_kind kind);
2214
2215
2216/*
2217 * Working with components
2218 */
2219
2220
2221/* Return the first VEVENT, VTODO or VJOURNAL sub-component of cop, or
2222 comp if it is one of those types */
2223
2224icalcomponent* icalcomponent_get_inner(icalcomponent* comp);
2225
2226
2227void icalcomponent_add_component(icalcomponent* parent,
2228 icalcomponent* child);
2229
2230void icalcomponent_remove_component(icalcomponent* parent,
2231 icalcomponent* child);
2232
2233int icalcomponent_count_components(icalcomponent* component,
2234 icalcomponent_kind kind);
2235
2236/* Iteration Routines. There are two forms of iterators, internal and
2237external. The internal ones came first, and are almost completely
2238sufficient, but they fail badly when you want to construct a loop that
2239removes components from the container.*/
2240
2241
2242/* Iterate through components */
2243icalcomponent* icalcomponent_get_current_component (icalcomponent* component);
2244
2245icalcomponent* icalcomponent_get_first_component(icalcomponent* component,
2246 icalcomponent_kind kind);
2247icalcomponent* icalcomponent_get_next_component(icalcomponent* component,
2248 icalcomponent_kind kind);
2249
2250/* Using external iterators */
2251icalcompiter icalcomponent_begin_component(icalcomponent* component,
2252 icalcomponent_kind kind);
2253icalcompiter icalcomponent_end_component(icalcomponent* component,
2254 icalcomponent_kind kind);
2255icalcomponent* icalcompiter_next(icalcompiter* i);
2256icalcomponent* icalcompiter_prior(icalcompiter* i);
2257icalcomponent* icalcompiter_deref(icalcompiter* i);
2258
2259
2260
2261
2262/* Working with embedded error properties */
2263
2264int icalcomponent_count_errors(icalcomponent* component);
2265
2266/* Remove all X-LIC-ERROR properties*/
2267void icalcomponent_strip_errors(icalcomponent* component);
2268
2269/* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
2270void icalcomponent_convert_errors(icalcomponent* component);
2271
2272/* Internal operations. They are private, and you should not be using them. */
2273icalcomponent* icalcomponent_get_parent(icalcomponent* component);
2274void icalcomponent_set_parent(icalcomponent* component,
2275 icalcomponent* parent);
2276
2277/* Kind conversion routiens */
2278
2279icalcomponent_kind icalcomponent_string_to_kind(const char* string);
2280
2281const char* icalcomponent_kind_to_string(icalcomponent_kind kind);
2282
2283
2284/************* Derived class methods. ****************************
2285
2286If the code was in an OO language, the remaining routines would be
2287members of classes derived from icalcomponent. Don't call them on the
2288wrong component subtypes. */
2289
2290/* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
2291 VJOURNAL */
2292icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c);
2293
2294/* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
2295 times of an event in UTC */
2296struct icaltime_span icalcomponent_get_span(icalcomponent* comp);
2297
2298/******************** Convienience routines **********************/
2299
2300void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v);
2301struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp);
2302
2303/* For the icalcomponent routines only, dtend and duration are tied
2304 together. If you call the set routine for one and the other exists,
2305 the routine will calculate the change to the other. That is, if
2306 there is a DTEND and you call set_duration, the routine will modify
2307 DTEND to be the sum of DTSTART and the duration. If you call a get
2308 routine for one and the other exists, the routine will calculate
2309 the return value. If you call a set routine and neither exists, the
2310 routine will create the apcompriate comperty */
2311
2312
2313struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp);
2314void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
2315
2316void icalcomponent_set_duration(icalcomponent* comp,
2317 struct icaldurationtype v);
2318struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp);
2319
2320void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method);
2321icalproperty_method icalcomponent_get_method(icalcomponent* comp);
2322
2323struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp);
2324void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
2325
2326
2327void icalcomponent_set_summary(icalcomponent* comp, const char* v);
2328const char* icalcomponent_get_summary(icalcomponent* comp);
2329
2330void icalcomponent_set_comment(icalcomponent* comp, const char* v);
2331const char* icalcomponent_get_comment(icalcomponent* comp);
2332
2333void icalcomponent_set_uid(icalcomponent* comp, const char* v);
2334const char* icalcomponent_get_uid(icalcomponent* comp);
2335
2336void icalcomponent_set_recurrenceid(icalcomponent* comp,
2337 struct icaltimetype v);
2338struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
2339
2340
2341void icalcomponent_set_organizer(icalcomponent* comp,
2342 struct icalorganizertype org);
2343 struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp);
2344
2345
2346void icalcomponent_add_attendee(icalcomponent *comp,
2347 struct icalattendeetype attendee);
2348
2349int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid);
2350
2351/* Get the Nth attendee. Out of range indices return an attendee
2352 with cuid == 0 */
2353struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp,
2354 int index);
2355
2356
2357
2358
2359/*************** Type Specific routines ***************/
2360
2361icalcomponent* icalcomponent_new_vcalendar();
2362icalcomponent* icalcomponent_new_vevent();
2363icalcomponent* icalcomponent_new_vtodo();
2364icalcomponent* icalcomponent_new_vjournal();
2365icalcomponent* icalcomponent_new_valarm();
2366icalcomponent* icalcomponent_new_vfreebusy();
2367icalcomponent* icalcomponent_new_vtimezone();
2368icalcomponent* icalcomponent_new_xstandard();
2369icalcomponent* icalcomponent_new_xdaylight();
2370
2371
2372
2373#endif /* !ICALCOMPONENT_H */
2374
2375
2376
2377/* -*- Mode: C -*- */
2378/*======================================================================
2379 FILE: icalparser.h
2380 CREATOR: eric 20 April 1999
2381
2382 $Id$
2383
2384
2385 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2386
2387 This program is free software; you can redistribute it and/or modify
2388 it under the terms of either:
2389
2390 The LGPL as published by the Free Software Foundation, version
2391 2.1, available at: http://www.fsf.org/copyleft/lesser.html
2392
2393 Or:
2394
2395 The Mozilla Public License Version 1.0. You may obtain a copy of
2396 the License at http://www.mozilla.org/MPL/
2397
2398 The original code is icalparser.h
2399
2400======================================================================*/
2401
2402
2403#ifndef ICALPARSER_H
2404#define ICALPARSER_H
2405
2406
2407#include <stdio.h> /* For FILE* */
2408
2409typedef void* icalparser;
2410
2411
2412/***********************************************************************
2413 * Line-oriented parsing.
2414 *
2415 * Create a new parser via icalparse_new_parser, then add ines one at
2416 * a time with icalparse_add_line(). icalparser_add_line() will return
2417 * non-zero when it has finished with a component.
2418 ***********************************************************************/
2419
2420typedef enum icalparser_state {
2421 ICALPARSER_ERROR,
2422 ICALPARSER_SUCCESS,
2423 ICALPARSER_BEGIN_COMP,
2424 ICALPARSER_END_COMP,
2425 ICALPARSER_IN_PROGRESS
2426} icalparser_state;
2427
2428icalparser* icalparser_new(void);
2429icalcomponent* icalparser_add_line(icalparser* parser, char* str );
2430icalcomponent* icalparser_clean(icalparser* parser);
2431icalparser_state icalparser_get_state(icalparser* parser);
2432void icalparser_free(icalparser* parser);
2433
2434
2435/***********************************************************************
2436 * Message oriented parsing. icalparser_parse takes a string that
2437 * holds the text ( in RFC 2445 format ) and returns a pointer to an
2438 * icalcomponent. The caller owns the memory. line_gen_func is a
2439 * pointer to a function that returns one content line per invocation
2440 **********************************************************************/
2441
2442icalcomponent* icalparser_parse(icalparser *parser,
2443 char* (*line_gen_func)(char *s, size_t size, void *d));
2444
2445/* Set the data that icalparser_parse will give to the line_gen_func
2446 as the parameter 'd'*/
2447void icalparser_set_gen_data(icalparser* parser, void* data);
2448
2449
2450icalcomponent* icalparser_parse_string(const char* str);
2451
2452
2453/***********************************************************************
2454 * Parser support functions
2455 ***********************************************************************/
2456
2457/* Use the flex/bison parser to turn a string into a value type */
2458icalvalue* icalparser_parse_value(icalvalue_kind kind,
2459 const char* str, icalcomponent** errors);
2460
2461/* Given a line generator function, return a single iCal content line.*/
2462char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d));
2463
2464char* string_line_generator(char *out, size_t buf_size, void *d);
2465
2466#endif /* !ICALPARSE_H */
2467/* -*- Mode: C -*- */
2468/*======================================================================
2469 FILE: icalmemory.h
2470 CREATOR: eric 30 June 1999
2471
2472
2473 $Id$
2474 $Locker$
2475
2476 This program is free software; you can redistribute it and/or modify
2477 it under the terms of either:
2478
2479 The LGPL as published by the Free Software Foundation, version
2480 2.1, available at: http://www.fsf.org/copyleft/lesser.html
2481
2482 Or:
2483
2484 The Mozilla Public License Version 1.0. You may obtain a copy of
2485 the License at http://www.mozilla.org/MPL/
2486
2487 The Initial Developer of the Original Code is Eric Busboom
2488
2489 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2490======================================================================*/
2491
2492#ifndef ICALMEMORY_H
2493#define ICALMEMORY_H
2494
2495#include <sys/types.h> /* for size_t */
2496
2497
2498/* Tmp buffers are managed by ical. References can be returned to the
2499 caller, although the caller will not own the memory. */
2500
2501void* icalmemory_tmp_buffer(size_t size);
2502char* icalmemory_tmp_copy(const char* str);
2503
2504/* Add an externally allocated buffer to the ring. */
2505void icalmemory_add_tmp_buffer(void*);
2506
2507
2508/* Free all memory used in the ring */
2509void icalmemory_free_ring(void);
2510
2511/* Non-tmp buffers must be freed. These are mostly wrappers around
2512 * malloc, etc, but are used so the caller can change the memory
2513 * allocators in a future version of the library */
2514
2515void* icalmemory_new_buffer(size_t size);
2516void* icalmemory_resize_buffer(void* buf, size_t size);
2517void icalmemory_free_buffer(void* buf);
2518
2519/* icalmemory_append_string will copy the string 'string' to the
2520 buffer 'buf' starting at position 'pos', reallocing 'buf' if it is
2521 too small. 'buf_size' is the size of 'buf' and will be changed if
2522 'buf' is reallocated. 'pos' will point to the last byte of the new
2523 string in 'buf', usually a '\0' */
2524
2525/* THESE ROUTINES CAN NOT BE USED ON TMP BUFFERS. Only use them on
2526 normally allocated memory, or on buffers created from
2527 icalmemory_new_buffer, never with buffers created by
2528 icalmemory_tmp_buffer. If icalmemory_append_string has to resize a
2529 buffer on the ring, the ring will loose track of it an you will
2530 have memory problems. */
2531
2532void icalmemory_append_string(char** buf, char** pos, size_t* buf_size,
2533 const char* string);
2534
2535/* icalmemory_append_char is similar, but is appends a character instead of a string */
2536void icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
2537 char ch);
2538
2539/* A wrapper around strdup. Partly to trap calls to strdup, partly
2540 because in -ansi, gcc on Red Hat claims that strudup is undeclared */
2541char* icalmemory_strdup(const char *s);
2542
2543#endif /* !ICALMEMORY_H */
2544
2545
2546
2547/* -*- Mode: C -*- */
2548/*======================================================================
2549 FILE: icalerror.h
2550 CREATOR: eric 09 May 1999
2551
2552 $Id$
2553
2554
2555 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2556
2557 This program is free software; you can redistribute it and/or modify
2558 it under the terms of either:
2559
2560 The LGPL as published by the Free Software Foundation, version
2561 2.1, available at: http://www.fsf.org/copyleft/lesser.html
2562
2563 Or:
2564
2565 The Mozilla Public License Version 1.0. You may obtain a copy of
2566 the License at http://www.mozilla.org/MPL/
2567
2568 The original code is icalerror.h
2569
2570======================================================================*/
2571
2572
2573#ifndef ICALERROR_H
2574#define ICALERROR_H
2575
2576#include <assert.h>
2577#include <stdio.h> /* For icalerror_warn() */
2578
2579
2580#ifdef HAVE_CONFIG_H
2581#include "config.h"
2582#endif
2583
2584#define ICAL_SETERROR_ISFUNC
2585
2586
2587/* This routine is called before any error is triggered. It is called
2588 by icalerror_set_errno, so it does not appear in all of the macros
2589 below */
2590void icalerror_stop_here(void);
2591
2592void icalerror_crash_here(void);
2593
2594typedef enum icalerrorenum {
2595
2596 ICAL_BADARG_ERROR,
2597 ICAL_NEWFAILED_ERROR,
2598 ICAL_ALLOCATION_ERROR,
2599 ICAL_MALFORMEDDATA_ERROR,
2600 ICAL_PARSE_ERROR,
2601 ICAL_INTERNAL_ERROR, /* Like assert --internal consist. prob */
2602 ICAL_FILE_ERROR,
2603 ICAL_USAGE_ERROR,
2604 ICAL_UNIMPLEMENTED_ERROR,
2605 ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/
2606 ICAL_NO_ERROR
2607
2608} icalerrorenum;
2609
2610/* The libical error enumeration, like errno*/
2611extern icalerrorenum icalerrno;
2612
2613/* If true, libicl aborts after a call to icalerror_set_error*/
2614extern int icalerror_errors_are_fatal;
2615
2616/* Warning messages */
2617
2618#ifdef __GNUC__ca
2619#define icalerror_warn(message) {fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);}
2620#else /* __GNU_C__ */
2621#define icalerror_warn(message) {fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);}
2622#endif /* __GNU_C__ */
2623
2624
2625void icalerror_clear_errno(void);
2626
2627/* Make an individual error fatal or non-fatal. */
2628typedef enum icalerrorstate {
2629 ICAL_ERROR_FATAL, /* Not fata */
2630 ICAL_ERROR_NONFATAL, /* Fatal */
2631 ICAL_ERROR_DEFAULT, /* Use the value of icalerror_errors_are_fatal*/
2632 ICAL_ERROR_UNKNOWN /* Asked state for an unknown error type */
2633} icalerrorstate ;
2634
2635char* icalerror_strerror(icalerrorenum e);
2636char* icalerror_perror();
2637void icalerror_set_error_state( icalerrorenum error, icalerrorstate);
2638icalerrorstate icalerror_get_error_state( icalerrorenum error);
2639
2640#ifndef ICAL_SETERROR_ISFUNC
2641#define icalerror_set_errno(x) \
2642icalerrno = x; \
2643if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \
2644 (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \
2645 icalerror_errors_are_fatal == 1 )){ \
2646 icalerror_warn(icalerror_strerror(x)); \
2647 assert(0); \
2648}
2649#else
2650void icalerror_set_errno(icalerrorenum);
2651#endif
2652
2653#ifdef ICAL_ERRORS_ARE_FATAL
2654#undef NDEBUG
2655#endif
2656
2657#define icalerror_check_value_type(value,type);
2658#define icalerror_check_property_type(value,type);
2659#define icalerror_check_parameter_type(value,type);
2660#define icalerror_check_component_type(value,type);
2661
2662/* Assert with a message */
2663#ifdef ICAL_ERRORS_ARE_FATAL
2664
2665#ifdef __GNUC__
2666#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);icalerror_stop_here(); abort();}
2667#else /*__GNUC__*/
2668#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);icalerror_stop_here(); abort();}
2669#endif /*__GNUC__*/
2670
2671#else /* ICAL_ERRORS_ARE_FATAL */
2672#define icalerror_assert(test,message)
2673#endif /* ICAL_ERRORS_ARE_FATAL */
2674
2675/* Check & abort if check fails */
2676#define icalerror_check_arg(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); }
2677
2678/* Check & return void if check fails*/
2679#define icalerror_check_arg_rv(test,arg) if(!(test)) {icalerror_set_errno(ICAL_BADARG_ERROR); return; }
2680
2681/* Check & return 0 if check fails*/
2682#define icalerror_check_arg_rz(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return 0;}
2683
2684/* Check & return an error if check fails*/
2685#define icalerror_check_arg_re(test,arg,error) if(!(test)) { icalerror_stop_here(); assert(0); return error;}
2686
2687/* Check & return something*/
2688#define icalerror_check_arg_rx(test,arg,x) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return x;}
2689
2690
2691
2692/* String interfaces to set an error to NONFATAL and restore it to its
2693 original value */
2694
2695icalerrorstate icalerror_supress(const char* error);
2696void icalerror_restore(const char* error, icalerrorstate es);
2697
2698
2699#endif /* !ICALERROR_H */
2700
2701
2702
2703/* -*- Mode: C -*- */
2704/*======================================================================
2705 FILE: icalrestriction.h
2706 CREATOR: eric 24 April 1999
2707
2708 $Id$
2709
2710
2711 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2712
2713 This program is free software; you can redistribute it and/or modify
2714 it under the terms of either:
2715
2716 The LGPL as published by the Free Software Foundation, version
2717 2.1, available at: http://www.fsf.org/copyleft/lesser.html
2718
2719 Or:
2720
2721 The Mozilla Public License Version 1.0. You may obtain a copy of
2722 the License at http://www.mozilla.org/MPL/
2723
2724 The original code is icalrestriction.h
2725
2726 Contributions from:
2727 Graham Davison (g.m.davison@computer.org)
2728
2729
2730======================================================================*/
2731
2732
2733#ifndef ICALRESTRICTION_H
2734#define ICALRESTRICTION_H
2735
2736/* These must stay in this order for icalrestriction_compare to work */
2737typedef enum icalrestriction_kind {
2738 ICAL_RESTRICTION_NONE=0, /* 0 */
2739 ICAL_RESTRICTION_ZERO, /* 1 */
2740 ICAL_RESTRICTION_ONE, /* 2 */
2741 ICAL_RESTRICTION_ZEROPLUS, /* 3 */
2742 ICAL_RESTRICTION_ONEPLUS, /* 4 */
2743 ICAL_RESTRICTION_ZEROORONE, /* 5 */
2744 ICAL_RESTRICTION_ONEEXCLUSIVE,/* 6 */
2745 ICAL_RESTRICTION_ONEMUTUAL, /* 7 */
2746 ICAL_RESTRICTION_UNKNOWN /* 8 */
2747} icalrestriction_kind;
2748
2749int
2750icalrestriction_compare(icalrestriction_kind restr, int count);
2751
2752
2753int
2754icalrestriction_is_parameter_allowed(icalproperty_kind property,
2755 icalparameter_kind parameter);
2756
2757int icalrestriction_check(icalcomponent* comp);
2758
2759
2760#endif /* !ICALRESTRICTION_H */
2761
2762
2763
2764/* -*- Mode: C -*-
2765 ======================================================================
2766 FILE: sspm.h Mime Parser
2767 CREATOR: eric 25 June 2000
2768
2769 $Id$
2770 $Locker$
2771
2772 The contents of this file are subject to the Mozilla Public License
2773 Version 1.0 (the "License"); you may not use this file except in
2774 compliance with the License. You may obtain a copy of the License at
2775 http://www.mozilla.org/MPL/
2776
2777 Software distributed under the License is distributed on an "AS IS"
2778 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
2779 the License for the specific language governing rights and
2780 limitations under the License.
2781
2782
2783 This program is free software; you can redistribute it and/or modify
2784 it under the terms of either:
2785
2786 The LGPL as published by the Free Software Foundation, version
2787 2.1, available at: http://www.fsf.org/copyleft/lesser.html
2788
2789 Or:
2790
2791 The Mozilla Public License Version 1.0. You may obtain a copy of
2792 the License at http://www.mozilla.org/MPL/
2793
2794 The Initial Developer of the Original Code is Eric Busboom
2795
2796 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2797 ======================================================================*/
2798
2799#ifndef SSPM_H
2800#define SSPM_H
2801
2802enum sspm_major_type {
2803 SSPM_NO_MAJOR_TYPE,
2804 SSPM_TEXT_MAJOR_TYPE,
2805 SSPM_IMAGE_MAJOR_TYPE,
2806 SSPM_AUDIO_MAJOR_TYPE,
2807 SSPM_VIDEO_MAJOR_TYPE,
2808 SSPM_APPLICATION_MAJOR_TYPE,
2809 SSPM_MULTIPART_MAJOR_TYPE,
2810 SSPM_MESSAGE_MAJOR_TYPE,
2811 SSPM_UNKNOWN_MAJOR_TYPE
2812};
2813
2814enum sspm_minor_type {
2815 SSPM_NO_MINOR_TYPE,
2816 SSPM_ANY_MINOR_TYPE,
2817 SSPM_PLAIN_MINOR_TYPE,
2818 SSPM_RFC822_MINOR_TYPE,
2819 SSPM_DIGEST_MINOR_TYPE,
2820 SSPM_CALENDAR_MINOR_TYPE,
2821 SSPM_MIXED_MINOR_TYPE,
2822 SSPM_RELATED_MINOR_TYPE,
2823 SSPM_ALTERNATIVE_MINOR_TYPE,
2824 SSPM_PARALLEL_MINOR_TYPE,
2825 SSPM_UNKNOWN_MINOR_TYPE
2826};
2827
2828enum sspm_encoding {
2829 SSPM_NO_ENCODING,
2830 SSPM_QUOTED_PRINTABLE_ENCODING,
2831 SSPM_8BIT_ENCODING,
2832 SSPM_7BIT_ENCODING,
2833 SSPM_BINARY_ENCODING,
2834 SSPM_BASE64_ENCODING,
2835 SSPM_UNKNOWN_ENCODING
2836};
2837
2838enum sspm_error{
2839 SSPM_NO_ERROR,
2840 SSPM_UNEXPECTED_BOUNDARY_ERROR,
2841 SSPM_WRONG_BOUNDARY_ERROR,
2842 SSPM_NO_BOUNDARY_ERROR,
2843 SSPM_NO_HEADER_ERROR,
2844 SSPM_MALFORMED_HEADER_ERROR
2845};
2846
2847
2848struct sspm_header
2849{
2850 int def;
2851 char* boundary;
2852 enum sspm_major_type major;
2853 enum sspm_minor_type minor;
2854 char *minor_text;
2855 char ** content_type_params;
2856 char* charset;
2857 enum sspm_encoding encoding;
2858 char* filename;
2859 char* content_id;
2860 enum sspm_error error;
2861 char* error_text;
2862};
2863
2864struct sspm_part {
2865 struct sspm_header header;
2866 int level;
2867 size_t data_size;
2868 void *data;
2869};
2870
2871struct sspm_action_map {
2872 enum sspm_major_type major;
2873 enum sspm_minor_type minor;
2874 void* (*new_part)();
2875 void (*add_line)(void *part, struct sspm_header *header,
2876 char* line, size_t size);
2877 void* (*end_part)(void* part);
2878 void (*free_part)(void *part);
2879};
2880
2881char* sspm_major_type_string(enum sspm_major_type type);
2882char* sspm_minor_type_string(enum sspm_minor_type type);
2883char* sspm_encoding_string(enum sspm_encoding type);
2884
2885int sspm_parse_mime(struct sspm_part *parts,
2886 size_t max_parts,
2887 struct sspm_action_map *actions,
2888 char* (*get_string)(char *s, size_t size, void* data),
2889 void *get_string_data,
2890 struct sspm_header *first_header
2891 );
2892
2893void sspm_free_parts(struct sspm_part *parts, size_t max_parts);
2894
2895char *decode_quoted_printable(char *dest,
2896 char *src,
2897 size_t *size);
2898char *decode_base64(char *dest,
2899 char *src,
2900 size_t *size);
2901
2902
2903int sspm_write_mime(struct sspm_part *parts,size_t num_parts,
2904 char **output_string, char* header);
2905
2906#endif /*SSPM_H*/
2907/* -*- Mode: C -*- */
2908/*======================================================================
2909 FILE: icalmime.h
2910 CREATOR: eric 26 July 2000
2911
2912
2913 $Id$
2914 $Locker$
2915
2916 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
2917
2918 This program is free software; you can redistribute it and/or modify
2919 it under the terms of either:
2920
2921 The LGPL as published by the Free Software Foundation, version
2922 2.1, available at: http://www.fsf.org/copyleft/lesser.html
2923
2924 Or:
2925
2926 The Mozilla Public License Version 1.0. You may obtain a copy of
2927 the License at http://www.mozilla.org/MPL/
2928
2929======================================================================*/
2930
2931#ifndef ICALMIME_H
2932#define ICALMIME_H
2933
2934
2935 icalcomponent* icalmime_parse(char* (*line_gen_func)(char *s, size_t size,
2936 void *d),
2937 void *data);
2938
2939/* The inverse of icalmime_parse, not implemented yet. Use sspm.h directly. */
2940char* icalmime_as_mime_string(char* component);
2941
2942
2943
2944#endif /* !ICALMIME_H */
2945
2946
2947
2948/* -*- Mode: C -*-
2949 ======================================================================
2950 FILE: icallangbind.h
2951 CREATOR: eric 25 jan 2001
2952
2953 DESCRIPTION:
2954
2955 $Id$
2956 $Locker$
2957
2958 (C) COPYRIGHT 1999 Eric Busboom
2959 http://www.softwarestudio.org
2960
2961 This package is free software and is provided "as is" without
2962 express or implied warranty. It may be used, redistributed and/or
2963 modified under the same terms as perl itself. ( Either the Artistic
2964 License or the GPL. )
2965
2966 ======================================================================*/
2967
2968#ifndef __ICALLANGBIND_H__
2969#define __ICALLANGBIND_H__
2970
2971int* icallangbind_new_array(int size);
2972void icallangbind_free_array(int* array);
2973int icallangbind_access_array(int* array, int index);
2974icalproperty* icallangbind_get_property(icalcomponent *c, int n, const char* prop);
2975const char* icallangbind_get_property_val(icalproperty* p);
2976const char* icallangbind_get_parameter(icalproperty *p, const char* parameter);
2977icalcomponent* icallangbind_get_component(icalcomponent *c, const char* comp);
2978
2979icalproperty* icallangbind_get_first_property(icalcomponent *c,
2980 const char* prop);
2981
2982icalproperty* icallangbind_get_next_property(icalcomponent *c,
2983 const char* prop);
2984
2985icalcomponent* icallangbind_get_first_component(icalcomponent *c,
2986 const char* comp);
2987
2988icalcomponent* icallangbind_get_next_component(icalcomponent *c,
2989 const char* comp);
2990
2991
2992const char* icallangbind_property_eval_string(icalproperty* prop, char* sep);
2993
2994
2995int icallangbind_string_to_open_flag(const char* str);
2996#endif /*__ICALLANGBIND_H__*/
diff --git a/libical/src/libical/icalattendee.c b/libical/src/libical/icalattendee.c
new file mode 100644
index 0000000..30cb949
--- a/dev/null
+++ b/libical/src/libical/icalattendee.c
@@ -0,0 +1,30 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalattendee.c
4 CREATOR: eric 08 Mar 01
5
6 $Id$
7 $Locker$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icaltypes.c
24
25 ======================================================================*/
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
30#include "icalattendee.h"
diff --git a/libical/src/libical/icalattendee.h b/libical/src/libical/icalattendee.h
new file mode 100644
index 0000000..914e51a
--- a/dev/null
+++ b/libical/src/libical/icalattendee.h
@@ -0,0 +1,69 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalattendee.h
4 CREATOR: eric 8 Mar 01
5
6
7 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of either:
11
12 The LGPL as published by the Free Software Foundation, version
13 2.1, available at: http://www.fsf.org/copyleft/lesser.html
14
15 Or:
16
17 The Mozilla Public License Version 1.0. You may obtain a copy of
18 the License at http://www.mozilla.org/MPL/
19
20 The original code is icaltypes.h
21
22======================================================================*/
23
24#ifndef ICALATTENDEE_H
25#define ICALATTENDEE_H
26
27
28#include <time.h>
29#include "icalenums.h"
30#include "icaltime.h"
31#include "icalduration.h"
32#include "icalperiod.h"
33#include "icalderivedparameter.h"
34#include "icalderivedvalue.h"
35
36struct icalorganizertype {
37 const char* value;
38 const char* common_name;
39 const char* dir;
40 const char* sentby;
41 const char* language;
42
43};
44
45/* Create a copy of the given organizer. Libical will not own the
46 memory for the strings in the copy; the call must free them */
47struct icalorganizertype icalorganizertype_new_clone(struct icalorganizertype a);
48
49
50struct icalattendeetype {
51 const char* cuid; /* Cal user id, contents of the property value */
52 /*icalparameter_cutype cutype;*/
53 const char* member;
54 /*icalparameter_role role;*/
55 int rsvp;
56 const char* delto;
57 const char* delfrom;
58 const char* sentby;
59 const char* cn;
60 const char* dir;
61 const char* language;
62};
63
64/* Create a copy of the given attendee. Libical will not own the
65 memory for the strings in the copy; the call must free them */
66struct icalattendeetype icalattendeetype_new_clone(struct icalattendeetype a);
67
68
69#endif /* !ICALATTENDEE_H */
diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c
new file mode 100644
index 0000000..af0d3ec
--- a/dev/null
+++ b/libical/src/libical/icalcomponent.c
@@ -0,0 +1,1488 @@
1/*======================================================================
2 FILE: icalcomponent.c
3 CREATOR: eric 28 April 1999
4
5 $Id$
6
7
8 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of either:
12
13 The LGPL as published by the Free Software Foundation, version
14 2.1, available at: http://www.fsf.org/copyleft/lesser.html
15
16 Or:
17
18 The Mozilla Public License Version 1.0. You may obtain a copy of
19 the License at http://www.mozilla.org/MPL/
20
21 The original code is icalcomponent.c
22
23======================================================================*/
24
25
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
30#include "icalcomponent.h"
31#include "pvl.h" /* "Pointer-to-void list" */
32#include "icalerror.h"
33#include "icalmemory.h"
34#include "icalenums.h"
35#include "icaltime.h"
36#include "icalduration.h"
37#include "icalperiod.h"
38#include "icalparser.h"
39
40#include <stdlib.h> /* for malloc */
41#include <stdarg.h> /* for va_list, etc */
42#include <errno.h>
43#include <assert.h>
44#include <stdio.h> /* for fprintf */
45#include <string.h>
46
47#define MAX_TMP 1024
48
49struct icalcomponent_impl
50{
51 char id[5];
52 icalcomponent_kind kind;
53 char* x_name;
54 pvl_list properties;
55 pvl_elem property_iterator;
56 pvl_list components;
57 pvl_elem component_iterator;
58 icalcomponent* parent;
59};
60
61/* icalproperty functions that only components get to use */
62void icalproperty_set_parent(icalproperty* property,
63 icalcomponent* component);
64icalcomponent* icalproperty_get_parent(icalproperty* property);
65void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args);
66icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind);
67int icalcomponent_property_sorter(void *a, void *b);
68
69
70void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args)
71{
72 void* vp;
73
74 while((vp = va_arg(args, void*)) != 0) {
75
76 assert (icalcomponent_isa_component(vp) != 0 ||
77 icalproperty_isa_property(vp) != 0 ) ;
78
79 if (icalcomponent_isa_component(vp) != 0 ){
80
81 icalcomponent_add_component((icalcomponent*)impl,
82 (icalcomponent*)vp);
83
84 } else if (icalproperty_isa_property(vp) != 0 ){
85
86 icalcomponent_add_property((icalcomponent*)impl,
87 (icalproperty*)vp);
88 }
89 }
90}
91
92icalcomponent*
93icalcomponent_new_impl (icalcomponent_kind kind)
94{
95 struct icalcomponent_impl* comp;
96
97 if ( ( comp = (struct icalcomponent_impl*)
98 malloc(sizeof(struct icalcomponent_impl))) == 0) {
99 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
100 return 0;
101 }
102
103 strcpy(comp->id,"comp");
104
105 comp->kind = kind;
106 comp->properties = pvl_newlist();
107 comp->property_iterator = 0;
108 comp->components = pvl_newlist();
109 comp->component_iterator = 0;
110 comp->x_name = 0;
111 comp->parent = 0;
112
113 return comp;
114}
115
116icalcomponent*
117icalcomponent_new (icalcomponent_kind kind)
118{
119 return (icalcomponent*)icalcomponent_new_impl(kind);
120}
121
122icalcomponent*
123icalcomponent_vanew (icalcomponent_kind kind, ...)
124{
125 va_list args;
126
127 struct icalcomponent_impl *impl = icalcomponent_new_impl(kind);
128
129 if (impl == 0){
130 return 0;
131 }
132
133 va_start(args,kind);
134 icalcomponent_add_children(impl, args);
135 va_end(args);
136
137 return (icalcomponent*) impl;
138}
139
140icalcomponent* icalcomponent_new_from_string(char* str)
141{
142 return icalparser_parse_string(str);
143}
144
145icalcomponent* icalcomponent_new_clone(icalcomponent* component)
146{
147 struct icalcomponent_impl *old = (struct icalcomponent_impl*)component;
148 struct icalcomponent_impl *new;
149 icalproperty *p;
150 icalcomponent *c;
151 pvl_elem itr;
152
153 icalerror_check_arg_rz( (component!=0), "component");
154
155 new = icalcomponent_new_impl(old->kind);
156
157 if (new == 0){
158 return 0;
159 }
160
161
162 for( itr = pvl_head(old->properties);
163 itr != 0;
164 itr = pvl_next(itr))
165 {
166 p = (icalproperty*)pvl_data(itr);
167 icalcomponent_add_property(new,icalproperty_new_clone(p));
168 }
169
170
171 for( itr = pvl_head(old->components);
172 itr != 0;
173 itr = pvl_next(itr))
174 {
175 c = (icalcomponent*)pvl_data(itr);
176 icalcomponent_add_component(new,icalcomponent_new_clone(c));
177 }
178
179 return new;
180
181}
182
183
184void
185icalcomponent_free (icalcomponent* component)
186{
187 icalproperty* prop;
188 icalcomponent* comp;
189 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
190
191 icalerror_check_arg_rv( (component!=0), "component");
192
193#ifdef ICAL_FREE_ON_LIST_IS_ERROR
194 icalerror_assert( (c->parent ==0),"Tried to free a component that is still attached to a parent component");
195#else
196 if(c->parent != 0){
197 return;
198 }
199#endif
200
201 if(component != 0 ){
202
203 while( (prop=pvl_pop(c->properties)) != 0){
204 assert(prop != 0);
205 icalproperty_set_parent(prop,0);
206 icalproperty_free(prop);
207 }
208
209 pvl_free(c->properties);
210
211 while( (comp=pvl_data(pvl_head(c->components))) != 0){
212 assert(comp!=0);
213 icalcomponent_remove_component(component,comp);
214 icalcomponent_free(comp);
215 }
216
217 pvl_free(c->components);
218
219 if (c->x_name != 0) {
220 free(c->x_name);
221 }
222
223 c->kind = ICAL_NO_COMPONENT;
224 c->properties = 0;
225 c->property_iterator = 0;
226 c->components = 0;
227 c->component_iterator = 0;
228 c->x_name = 0;
229 c->id[0] = 'X';
230
231 free(c);
232 }
233}
234
235char*
236icalcomponent_as_ical_string (icalcomponent* component)
237{
238 char* buf, *out_buf;
239 const char* tmp_buf;
240 size_t buf_size = 1024;
241 char* buf_ptr = 0;
242 pvl_elem itr;
243 struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
244
245#ifdef ICAL_UNIX_NEWLINE
246 char newline[] = "\n";
247#else
248 char newline[] = "\n";
249#endif
250 icalcomponent *c;
251 icalproperty *p;
252 icalcomponent_kind kind = icalcomponent_isa(component);
253
254 const char* kind_string;
255
256 buf = icalmemory_new_buffer(buf_size);
257 buf_ptr = buf;
258
259 icalerror_check_arg_rz( (component!=0), "component");
260 icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT");
261
262 kind_string = icalcomponent_kind_to_string(kind);
263
264 icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component");
265
266 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:");
267 icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
268 icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
269
270
271 for( itr = pvl_head(impl->properties);
272 itr != 0;
273 itr = pvl_next(itr))
274 {
275 // printf("3333calcomponent_as_ical_string System Timezone2: %s %s \n", *tzname, getenv("TZ") );
276
277 p = (icalproperty*)pvl_data(itr);
278
279 icalerror_assert((p!=0),"Got a null property");
280 tmp_buf = icalproperty_as_ical_string(p);
281
282 icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);
283 }
284
285
286 for( itr = pvl_head(impl->components);
287 itr != 0;
288 itr = pvl_next(itr))
289 {
290
291 c = (icalcomponent*)pvl_data(itr);
292
293 tmp_buf = icalcomponent_as_ical_string(c);
294 icalmemory_append_string(&buf, &buf_ptr, &buf_size, tmp_buf);
295
296 }
297
298 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:"); //tzset();
299 icalmemory_append_string(&buf, &buf_ptr, &buf_size,
300 icalcomponent_kind_to_string(kind));
301 icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline); //tzset();
302
303 out_buf = icalmemory_tmp_copy(buf);
304 free(buf);
305
306 return out_buf;
307}
308
309
310int
311icalcomponent_is_valid (icalcomponent* component)
312{
313 struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
314
315
316 if ( (strcmp(impl->id,"comp") == 0) &&
317 impl->kind != ICAL_NO_COMPONENT){
318 return 1;
319 } else {
320 return 0;
321 }
322
323}
324
325
326icalcomponent_kind
327icalcomponent_isa (icalcomponent* component)
328{
329 struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
330 icalerror_check_arg_rz( (component!=0), "component");
331
332 if(component != 0)
333 {
334 return impl->kind;
335 }
336
337 return ICAL_NO_COMPONENT;
338}
339
340
341int
342icalcomponent_isa_component (void* component)
343{
344 struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
345
346 icalerror_check_arg_rz( (component!=0), "component");
347
348 if (strcmp(impl->id,"comp") == 0) {
349 return 1;
350 } else {
351 return 0;
352 }
353
354}
355
356int icalcomponent_property_sorter(void *a, void *b)
357{
358 icalproperty_kind kinda, kindb;
359 const char *ksa, *ksb;
360
361 kinda = icalproperty_isa((icalproperty*)a);
362 kindb = icalproperty_isa((icalproperty*)b);
363
364 ksa = icalproperty_kind_to_string(kinda);
365 ksb = icalproperty_kind_to_string(kindb);
366
367 return strcmp(ksa,ksb);
368}
369
370
371void
372icalcomponent_add_property (icalcomponent* component, icalproperty* property)
373{
374 struct icalcomponent_impl *impl;
375
376 icalerror_check_arg_rv( (component!=0), "component");
377 icalerror_check_arg_rv( (property!=0), "property");
378
379 impl = (struct icalcomponent_impl*)component;
380
381 icalerror_assert( (!icalproperty_get_parent(property)),"The property has already been added to a component. Remove the property with icalcomponent_remove_property before calling icalcomponent_add_property");
382
383 icalproperty_set_parent(property,component);
384
385#ifdef ICAL_INSERT_ORDERED
386 pvl_insert_ordered(impl->properties,
387 icalcomponent_property_sorter,property);
388#else
389 pvl_push(impl->properties,property);
390#endif
391
392}
393
394
395void
396icalcomponent_remove_property (icalcomponent* component, icalproperty* property)
397{
398 struct icalcomponent_impl *impl;
399 pvl_elem itr, next_itr;
400 struct icalproperty_impl *pimpl;
401
402 icalerror_check_arg_rv( (component!=0), "component");
403 icalerror_check_arg_rv( (property!=0), "property");
404
405 impl = (struct icalcomponent_impl*)component;
406
407 pimpl = (struct icalproperty_impl*)property;
408
409 icalerror_assert( (icalproperty_get_parent(property)),"The property is not a member of a component");
410
411
412 for( itr = pvl_head(impl->properties);
413 itr != 0;
414 itr = next_itr)
415 {
416 next_itr = pvl_next(itr);
417
418 if( pvl_data(itr) == (void*)property ){
419
420 if (impl->property_iterator == itr){
421 impl->property_iterator = pvl_next(itr);
422 }
423
424 pvl_remove( impl->properties, itr);
425 icalproperty_set_parent(property,0);
426 }
427 }
428}
429
430int
431icalcomponent_count_properties (icalcomponent* component,
432 icalproperty_kind kind)
433{
434 int count=0;
435 pvl_elem itr;
436 struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
437
438 icalerror_check_arg_rz( (component!=0), "component");
439
440 for( itr = pvl_head(impl->properties);
441 itr != 0;
442 itr = pvl_next(itr))
443 {
444 if(kind == icalproperty_isa((icalproperty*)pvl_data(itr)) ||
445 kind == ICAL_ANY_PROPERTY){
446 count++;
447 }
448 }
449
450
451 return count;
452
453}
454
455icalproperty* icalcomponent_get_current_property (icalcomponent* component)
456{
457
458 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
459 icalerror_check_arg_rz( (component!=0),"component");
460
461 if ((c->property_iterator==0)){
462 return 0;
463 }
464
465 return (icalproperty*) pvl_data(c->property_iterator);
466
467}
468
469icalproperty*
470icalcomponent_get_first_property (icalcomponent* component, icalproperty_kind kind)
471{
472 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
473 icalerror_check_arg_rz( (component!=0),"component");
474
475 for( c->property_iterator = pvl_head(c->properties);
476 c->property_iterator != 0;
477 c->property_iterator = pvl_next(c->property_iterator)) {
478
479 icalproperty *p = (icalproperty*) pvl_data(c->property_iterator);
480
481 if (icalproperty_isa(p) == kind || kind == ICAL_ANY_PROPERTY) {
482
483 return p;
484 }
485 }
486 return 0;
487}
488
489icalproperty*
490icalcomponent_get_next_property (icalcomponent* component, icalproperty_kind kind)
491{
492 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
493 icalerror_check_arg_rz( (component!=0),"component");
494
495 if (c->property_iterator == 0){
496 return 0;
497 }
498
499 for( c->property_iterator = pvl_next(c->property_iterator);
500 c->property_iterator != 0;
501 c->property_iterator = pvl_next(c->property_iterator)) {
502
503 icalproperty *p = (icalproperty*) pvl_data(c->property_iterator);
504
505 if (icalproperty_isa(p) == kind || kind == ICAL_ANY_PROPERTY) {
506
507 return p;
508 }
509 }
510
511 return 0;
512}
513
514
515icalproperty**
516icalcomponent_get_properties (icalcomponent* component, icalproperty_kind kind);
517
518
519void
520icalcomponent_add_component (icalcomponent* parent, icalcomponent* child)
521{
522 struct icalcomponent_impl *impl, *cimpl;
523
524 icalerror_check_arg_rv( (parent!=0), "parent");
525 icalerror_check_arg_rv( (child!=0), "child");
526
527 impl = (struct icalcomponent_impl*)parent;
528 cimpl = (struct icalcomponent_impl*)child;
529
530 if (cimpl->parent !=0) {
531 icalerror_set_errno(ICAL_USAGE_ERROR);
532 }
533
534 cimpl->parent = parent;
535
536 pvl_push(impl->components,child);
537}
538
539
540void
541icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child)
542{
543 struct icalcomponent_impl *impl,*cimpl;
544 pvl_elem itr, next_itr;
545
546 icalerror_check_arg_rv( (parent!=0), "parent");
547 icalerror_check_arg_rv( (child!=0), "child");
548
549 impl = (struct icalcomponent_impl*)parent;
550 cimpl = (struct icalcomponent_impl*)child;
551
552 for( itr = pvl_head(impl->components);
553 itr != 0;
554 itr = next_itr)
555 {
556 next_itr = pvl_next(itr);
557
558 if( pvl_data(itr) == (void*)child ){
559
560 if (impl->component_iterator == itr){
561 /* Don't let the current iterator become invalid */
562
563 /* HACK. The semantics for this are troubling. */
564 impl->component_iterator =
565 pvl_next(impl->component_iterator);
566
567 }
568 pvl_remove( impl->components, itr);
569 cimpl->parent = 0;
570 break;
571 }
572 }
573}
574
575
576int
577icalcomponent_count_components (icalcomponent* component,
578 icalcomponent_kind kind)
579{
580 int count=0;
581 pvl_elem itr;
582 struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
583
584 icalerror_check_arg_rz( (component!=0), "component");
585
586 for( itr = pvl_head(impl->components);
587 itr != 0;
588 itr = pvl_next(itr))
589 {
590 if(kind == icalcomponent_isa((icalcomponent*)pvl_data(itr)) ||
591 kind == ICAL_ANY_COMPONENT){
592 count++;
593 }
594 }
595
596 return count;
597}
598
599icalcomponent*
600icalcomponent_get_current_component(icalcomponent* component)
601{
602 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
603
604 icalerror_check_arg_rz( (component!=0),"component");
605
606 if (c->component_iterator == 0){
607 return 0;
608 }
609
610 return (icalcomponent*) pvl_data(c->component_iterator);
611}
612
613icalcomponent*
614icalcomponent_get_first_component (icalcomponent* component,
615 icalcomponent_kind kind)
616{
617 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
618
619 icalerror_check_arg_rz( (component!=0),"component");
620
621 for( c->component_iterator = pvl_head(c->components);
622 c->component_iterator != 0;
623 c->component_iterator = pvl_next(c->component_iterator)) {
624
625 icalcomponent *p = (icalcomponent*) pvl_data(c->component_iterator);
626
627 if (icalcomponent_isa(p) == kind || kind == ICAL_ANY_COMPONENT) {
628
629 return p;
630 }
631 }
632
633 return 0;
634}
635
636
637icalcomponent*
638icalcomponent_get_next_component (icalcomponent* component, icalcomponent_kind kind)
639{
640 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
641
642 icalerror_check_arg_rz( (component!=0),"component");
643
644 if (c->component_iterator == 0){
645 return 0;
646 }
647
648 for( c->component_iterator = pvl_next(c->component_iterator);
649 c->component_iterator != 0;
650 c->component_iterator = pvl_next(c->component_iterator)) {
651
652 icalcomponent *p = (icalcomponent*) pvl_data(c->component_iterator);
653
654 if (icalcomponent_isa(p) == kind || kind == ICAL_ANY_COMPONENT) {
655
656 return p;
657 }
658 }
659
660 return 0;
661}
662
663icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c)
664{
665 icalcomponent *comp;
666
667 for(comp = icalcomponent_get_first_component(c,ICAL_ANY_COMPONENT);
668 comp != 0;
669 comp = icalcomponent_get_next_component(c,ICAL_ANY_COMPONENT)){
670
671 icalcomponent_kind kind = icalcomponent_isa(comp);
672
673 if(kind == ICAL_VEVENT_COMPONENT ||
674 kind == ICAL_VTODO_COMPONENT ||
675 kind == ICAL_VJOURNAL_COMPONENT ||
676 kind == ICAL_VFREEBUSY_COMPONENT ){
677 return comp;
678 }
679 }
680 return 0;
681}
682
683time_t icalcomponent_convert_time(icalproperty *p)
684{
685 struct icaltimetype sict;
686 time_t convt;
687 icalproperty *tzp;
688
689
690 /* Though it says _dtstart, it will work for dtend too */
691 sict = icalproperty_get_dtstart(p);
692
693 tzp = icalproperty_get_first_parameter(p,ICAL_TZID_PARAMETER);
694
695 if (sict.is_utc == 1 && tzp != 0){
696 icalerror_warn("icalcomponent_get_span: component has a UTC DTSTART with a timezone specified ");
697 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
698 return 0;
699 }
700
701 if(sict.is_utc == 1){
702 /* _as_timet will use gmtime() to do the conversion */
703 convt = icaltime_as_timet(sict);
704
705#ifdef TEST_CONVERT_TIME
706 printf("convert time: use as_timet:\n %s\n %s",
707 icalproperty_as_ical_string(p), ctime(&convt));
708#endif
709
710 } else if (sict.is_utc == 0 && tzp == 0 ) {
711 time_t offset;
712
713 /* _as_timet will use localtime() to do the conversion */
714 convt = icaltime_as_timet(sict);
715 offset = icaltime_utc_offset(sict,0);
716 convt += offset;
717
718#ifdef TEST_CONVERT_TIME
719 printf("convert time: use as_timet and adjust:\n %s\n %s",
720 icalproperty_as_ical_string(p), ctime(&convt));
721#endif
722 } else {
723 /* Convert the time to UTC for the named timezone*/
724 const char* timezone = icalparameter_get_tzid(tzp);
725 convt = icaltime_as_timet(icaltime_as_utc(sict,timezone));
726
727#ifdef TEST_CONVERT_TIME
728 printf("convert time: use _as_utc:\n %s\n %s",
729 icalproperty_as_ical_string(p), ctime(&convt));
730#endif
731 }
732
733 return convt;
734}
735struct icaltime_span icalcomponent_get_span(icalcomponent* comp)
736{
737 icalcomponent *inner;
738 icalproperty *p, *duration;
739 icalcomponent_kind kind;
740 struct icaltime_span span;
741 struct icaltimetype start;
742
743 span.start = 0;
744 span.end = 0;
745 span.is_busy= 1;
746
747 /* initial Error checking */
748
749/* icalerror_check_arg_rz( (comp!=0),"comp");*/
750
751 kind = icalcomponent_isa(comp);
752
753 if(kind == ICAL_VCALENDAR_COMPONENT){
754 inner = icalcomponent_get_first_real_component(comp);
755
756 /* Maybe there is a VTIMEZONE in there */
757 if (inner == 0){
758 inner = icalcomponent_get_first_component(comp,
759 ICAL_VTIMEZONE_COMPONENT);
760 }
761
762 } else {
763 inner = comp;
764 }
765
766 if (inner == 0){
767 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
768 /*icalerror_warn("icalcomponent_get_span: no component specified, or empty VCALENDAR component");*/
769 return span;
770 }
771
772 kind = icalcomponent_isa(inner);
773
774 if( !( kind == ICAL_VEVENT_COMPONENT ||
775 kind == ICAL_VJOURNAL_COMPONENT ||
776 kind == ICAL_VTODO_COMPONENT ||
777 kind == ICAL_VFREEBUSY_COMPONENT )) {
778 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
779 /*icalerror_warn("icalcomponent_get_span: no component specified, or empty VCALENDAR component");*/
780 return span;
781
782 }
783
784
785
786 /* Get to work. starting with DTSTART */
787
788 p = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY);
789
790 if (p ==0 ) {
791 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
792 /*icalerror_warn("icalcomponent_get_span: component has no DTSTART time");*/
793 return span;
794 }
795
796
797 start = icalproperty_get_dtstart(p);
798
799 icalerror_clear_errno();
800
801 span.start = icalcomponent_convert_time(p);
802
803#ifdef TEST_CONVERT_TIME
804 printf("convert time:\n %s %s",
805 icalproperty_as_ical_string(p), ctime(&span.start));
806#endif
807
808 if(icalerrno != ICAL_NO_ERROR){
809 span.start = 0;
810 return span;
811 }
812
813 /* The end time could be specified as either a DTEND or a DURATION */
814 p = icalcomponent_get_first_property(inner, ICAL_DTEND_PROPERTY);
815 duration = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
816
817 if (p==0 && duration == 0 && start.is_date != 1) {
818 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
819 /*icalerror_warn("icalcomponent_get_span: component has neither DTEND nor DURATION time");*/
820 span.start = 0;
821 return span;
822 }
823
824 if (p!=0){
825 span.end = icalcomponent_convert_time(p);
826 } else if (start.is_date == 1) {
827 /* Duration is all day */
828 span.end = span.start + 60*60*24;
829 } else {
830 /* Use the duration */
831 struct icaldurationtype dur;
832 time_t durt;
833
834
835 dur = icalproperty_get_duration(duration);
836
837 durt = icaldurationtype_as_int(dur);
838 span.end = span.start+durt;
839 }
840
841 return span;
842
843}
844
845
846int icalcomponent_count_errors(icalcomponent* component)
847{
848 int errors = 0;
849 icalproperty *p;
850 icalcomponent *c;
851 pvl_elem itr;
852 struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
853
854 for( itr = pvl_head(impl->properties);
855 itr != 0;
856 itr = pvl_next(itr))
857 {
858 p = (icalproperty*)pvl_data(itr);
859
860 if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY)
861 {
862 errors++;
863 }
864 }
865
866
867 for( itr = pvl_head(impl->components);
868 itr != 0;
869 itr = pvl_next(itr))
870 {
871 c = (icalcomponent*)pvl_data(itr);
872
873 errors += icalcomponent_count_errors(c);
874
875 }
876
877 return errors;
878}
879
880
881void icalcomponent_strip_errors(icalcomponent* component)
882{
883 icalproperty *p;
884 icalcomponent *c;
885 pvl_elem itr, next_itr;
886 struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
887
888 for( itr = pvl_head(impl->properties);
889 itr != 0;
890 itr = next_itr)
891 {
892 p = (icalproperty*)pvl_data(itr);
893 next_itr = pvl_next(itr);
894
895 if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY)
896 {
897 icalcomponent_remove_property(component,p);
898 }
899 }
900
901 for( itr = pvl_head(impl->components);
902 itr != 0;
903 itr = pvl_next(itr))
904 {
905 c = (icalcomponent*)pvl_data(itr);
906 icalcomponent_strip_errors(c);
907 }
908}
909
910/* Hack. This will change the state of the iterators */
911void icalcomponent_convert_errors(icalcomponent* component)
912{
913 icalproperty *p, *next_p;
914 icalcomponent *c;
915
916 for(p = icalcomponent_get_first_property(component,ICAL_ANY_PROPERTY);
917 p != 0;
918 p = next_p){
919
920 next_p = icalcomponent_get_next_property(component,ICAL_ANY_PROPERTY);
921
922 if(icalproperty_isa(p) == ICAL_XLICERROR_PROPERTY)
923 {
924 struct icalreqstattype rst;
925 icalparameter *param = icalproperty_get_first_parameter
926 (p,ICAL_XLICERRORTYPE_PARAMETER);
927
928 rst.code = ICAL_UNKNOWN_STATUS;
929 rst.desc = 0;
930
931 switch(icalparameter_get_xlicerrortype(param)){
932
933 case ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR: {
934 rst.code = ICAL_3_2_INVPARAM_STATUS;
935 break;
936 }
937 case ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR: {
938 rst.code = ICAL_3_3_INVPARAMVAL_STATUS;
939 break;
940 }
941 case ICAL_XLICERRORTYPE_PROPERTYPARSEERROR: {
942 rst.code = ICAL_3_0_INVPROPNAME_STATUS;
943 break;
944 }
945 case ICAL_XLICERRORTYPE_VALUEPARSEERROR: {
946 rst.code = ICAL_3_1_INVPROPVAL_STATUS;
947 break;
948 }
949 case ICAL_XLICERRORTYPE_COMPONENTPARSEERROR: {
950 rst.code = ICAL_3_4_INVCOMP_STATUS;
951 break;
952 }
953
954 default: {
955 }
956 }
957 if (rst.code != ICAL_UNKNOWN_STATUS){
958
959 rst.debug = icalproperty_get_xlicerror(p);
960 icalcomponent_add_property(component,
961 icalproperty_new_requeststatus(rst));
962
963 icalcomponent_remove_property(component,p);
964 }
965 }
966 }
967
968 for(c = icalcomponent_get_first_component(component,ICAL_ANY_COMPONENT);
969 c != 0;
970 c = icalcomponent_get_next_component(component,ICAL_ANY_COMPONENT)){
971
972 icalcomponent_convert_errors(c);
973 }
974}
975
976
977icalcomponent* icalcomponent_get_parent(icalcomponent* component)
978{
979 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
980
981 return c->parent;
982}
983
984void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent)
985{
986 struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
987
988 c->parent = parent;
989}
990
991icalcompiter icalcompiter_null = {ICAL_NO_COMPONENT,0};
992
993
994struct icalcomponent_kind_map {
995 icalcomponent_kind kind;
996 char name[20];
997};
998
999
1000
1001static struct icalcomponent_kind_map component_map[] =
1002{
1003 { ICAL_VEVENT_COMPONENT, "VEVENT" },
1004 { ICAL_VTODO_COMPONENT, "VTODO" },
1005 { ICAL_VJOURNAL_COMPONENT, "VJOURNAL" },
1006 { ICAL_VCALENDAR_COMPONENT, "VCALENDAR" },
1007 { ICAL_VFREEBUSY_COMPONENT, "VFREEBUSY" },
1008 { ICAL_VTIMEZONE_COMPONENT, "VTIMEZONE" },
1009 { ICAL_VALARM_COMPONENT, "VALARM" },
1010 { ICAL_XSTANDARD_COMPONENT, "STANDARD" }, /*These are part of RFC2445 */
1011 { ICAL_XDAYLIGHT_COMPONENT, "DAYLIGHT" }, /*but are not really components*/
1012 { ICAL_X_COMPONENT, "X" },
1013 { ICAL_VSCHEDULE_COMPONENT, "SCHEDULE" },
1014
1015 /* CAP components */
1016 { ICAL_VQUERY_COMPONENT, "VQUERY" },
1017 { ICAL_VCAR_COMPONENT, "VCAR" },
1018 { ICAL_VCOMMAND_COMPONENT, "VCOMMAND" },
1019
1020 /* libical private components */
1021 { ICAL_XLICINVALID_COMPONENT, "X-LIC-UNKNOWN" },
1022 { ICAL_XLICMIMEPART_COMPONENT, "X-LIC-MIME-PART" },
1023 { ICAL_ANY_COMPONENT, "ANY" },
1024 { ICAL_XROOT_COMPONENT, "XROOT" },
1025
1026 /* End of list */
1027 { ICAL_NO_COMPONENT, "" },
1028};
1029
1030
1031
1032const char* icalcomponent_kind_to_string(icalcomponent_kind kind)
1033{
1034 int i;
1035
1036 for (i=0; component_map[i].kind != ICAL_NO_COMPONENT; i++) {
1037 if (component_map[i].kind == kind) {
1038 return component_map[i].name;
1039 }
1040 }
1041
1042 return 0;
1043
1044}
1045
1046icalcomponent_kind icalcomponent_string_to_kind(const char* string)
1047{
1048 int i;
1049
1050 if (string ==0 ) {
1051 return ICAL_NO_COMPONENT;
1052 }
1053
1054 for (i=0; component_map[i].kind != ICAL_NO_COMPONENT; i++) {
1055 if (strcmp(component_map[i].name, string) == 0) {
1056 return component_map[i].kind;
1057 }
1058 }
1059
1060 return ICAL_NO_COMPONENT;
1061}
1062
1063
1064
1065icalcompiter
1066icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind)
1067{
1068 struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
1069 icalcompiter itr = icalcompiter_null;
1070 pvl_elem i;
1071
1072 itr.kind = kind;
1073
1074 icalerror_check_arg_re( (component!=0),"component",icalcompiter_null);
1075
1076 for( i = pvl_head(impl->components); i != 0; i = pvl_next(itr.iter)) {
1077
1078 icalcomponent *c = (icalcomponent*) pvl_data(i);
1079
1080 if (icalcomponent_isa(c) == kind || kind == ICAL_ANY_COMPONENT) {
1081
1082 itr.iter = i;
1083
1084 return itr;
1085 }
1086 }
1087
1088 return icalcompiter_null;
1089}
1090
1091icalcompiter
1092icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind)
1093{
1094 struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
1095 icalcompiter itr;
1096 pvl_elem i;
1097
1098 itr.kind = kind;
1099
1100 icalerror_check_arg_re( (component!=0),"component",icalcompiter_null);
1101
1102 for( i = pvl_tail(impl->components); i != 0; i = pvl_prior(i)) {
1103
1104 icalcomponent *c = (icalcomponent*) pvl_data(i);
1105
1106 if (icalcomponent_isa(c) == kind || kind == ICAL_ANY_COMPONENT) {
1107
1108 itr.iter = pvl_next(i);
1109
1110 return itr;
1111 }
1112 }
1113
1114 return icalcompiter_null;;
1115}
1116
1117
1118icalcomponent* icalcompiter_next(icalcompiter* i)
1119{
1120 if (i->iter == 0){
1121 return 0;
1122 }
1123
1124 icalerror_check_arg_rz( (i!=0),"i");
1125
1126 for( i->iter = pvl_next(i->iter);
1127 i->iter != 0;
1128 i->iter = pvl_next(i->iter)) {
1129
1130 icalcomponent *c = (icalcomponent*) pvl_data(i->iter);
1131
1132 if (icalcomponent_isa(c) == i->kind
1133 || i->kind == ICAL_ANY_COMPONENT) {
1134
1135 return icalcompiter_deref(i);;
1136 }
1137 }
1138
1139 return 0;
1140
1141}
1142
1143icalcomponent* icalcompiter_prior(icalcompiter* i)
1144{
1145 if (i->iter == 0){
1146 return 0;
1147 }
1148
1149 for( i->iter = pvl_prior(i->iter);
1150 i->iter != 0;
1151 i->iter = pvl_prior(i->iter)) {
1152
1153 icalcomponent *c = (icalcomponent*) pvl_data(i->iter);
1154
1155 if (icalcomponent_isa(c) == i->kind
1156 || i->kind == ICAL_ANY_COMPONENT) {
1157
1158 return icalcompiter_deref(i);;
1159 }
1160 }
1161
1162 return 0;
1163
1164}
1165icalcomponent* icalcompiter_deref(icalcompiter* i)
1166{
1167 if(i->iter ==0){
1168 return 0;
1169 }
1170
1171 return pvl_data(i->iter);
1172}
1173
1174icalcomponent* icalcomponent_get_inner(icalcomponent* comp)
1175{
1176 if (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT){
1177 return icalcomponent_get_first_real_component(comp);
1178 } else {
1179 return comp;
1180 }
1181}
1182
1183
1184void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v)
1185{
1186
1187 icalcomponent *inner = icalcomponent_get_inner(comp);
1188 icalproperty *prop
1189 = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY);
1190
1191
1192 if (prop == 0){
1193 prop = icalproperty_new_dtstart(v);
1194 icalcomponent_add_property(inner, prop);
1195 }
1196
1197 icalproperty_set_dtstart(prop,v);
1198
1199}
1200
1201
1202struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp)
1203{
1204 icalcomponent *inner = icalcomponent_get_inner(comp);
1205 icalproperty *prop
1206 = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY);
1207
1208 if (prop == 0){
1209 return icaltime_null_time();
1210 }
1211
1212 return icalproperty_get_dtstart(prop);
1213}
1214
1215
1216struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp)
1217{
1218 icalcomponent *inner = icalcomponent_get_inner(comp);
1219
1220 icalproperty *end_prop
1221 = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
1222
1223 icalproperty *dur_prop
1224 = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
1225
1226
1227 if( end_prop == 0 && dur_prop == 0){
1228 return icaltime_null_time();
1229 } else if ( end_prop != 0) {
1230 return icalproperty_get_dtend(end_prop);
1231 } else if ( dur_prop != 0) {
1232
1233 struct icaltimetype start =
1234 icalcomponent_get_dtstart(inner);
1235 struct icaldurationtype duration =
1236 icalproperty_get_duration(dur_prop);
1237
1238 struct icaltimetype end = icaltime_add(start,duration);
1239
1240 return end;
1241
1242 } else {
1243 /* Error, both duration and dtend have been specified */
1244 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
1245 return icaltime_null_time();
1246
1247 }
1248
1249}
1250
1251
1252void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v)
1253{
1254 icalcomponent *inner = icalcomponent_get_inner(comp);
1255
1256 icalproperty *end_prop
1257 = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
1258
1259 icalproperty *dur_prop
1260 = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
1261
1262
1263 if( end_prop == 0 && dur_prop == 0){
1264 end_prop = icalproperty_new_dtend(v);
1265 icalcomponent_add_property(inner,end_prop);
1266 } else if ( end_prop != 0) {
1267 icalproperty_set_dtend(end_prop,v);
1268 } else if ( dur_prop != 0) {
1269 struct icaltimetype start =
1270 icalcomponent_get_dtstart(inner);
1271
1272 struct icaltimetype end =
1273 icalcomponent_get_dtend(inner);
1274
1275 struct icaldurationtype dur
1276 = icaltime_subtract(end,start);
1277
1278 icalproperty_set_duration(dur_prop,dur);
1279
1280 } else {
1281 /* Error, both duration and dtend have been specified */
1282 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
1283 }
1284}
1285
1286void icalcomponent_set_duration(icalcomponent* comp,
1287 struct icaldurationtype v)
1288{
1289 icalcomponent *inner = icalcomponent_get_inner(comp);
1290
1291 icalproperty *end_prop
1292 = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
1293
1294 icalproperty *dur_prop
1295 = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
1296
1297
1298 if( end_prop == 0 && dur_prop == 0){
1299 dur_prop = icalproperty_new_duration(v);
1300 icalcomponent_add_property(inner, dur_prop);
1301 } else if ( end_prop != 0) {
1302 struct icaltimetype start =
1303 icalcomponent_get_dtstart(inner);
1304
1305 struct icaltimetype new_end = icaltime_add(start,v);
1306
1307 icalproperty_set_dtend(end_prop,new_end);
1308
1309 } else if ( dur_prop != 0) {
1310 icalproperty_set_duration(dur_prop,v);
1311 } else {
1312 /* Error, both duration and dtend have been specified */
1313 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
1314 }
1315}
1316
1317struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp)
1318{
1319 icalcomponent *inner = icalcomponent_get_inner(comp);
1320
1321 icalproperty *end_prop
1322 = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
1323
1324 icalproperty *dur_prop
1325 = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
1326
1327 struct icaldurationtype null_duration;
1328 memset(&null_duration,0,sizeof(struct icaldurationtype));
1329
1330
1331 if( end_prop == 0 && dur_prop == 0){
1332 return null_duration;
1333 } else if ( end_prop != 0) {
1334 struct icaltimetype start =
1335 icalcomponent_get_dtstart(inner);
1336 time_t startt = icaltime_as_timet(start);
1337
1338 struct icaltimetype end =
1339 icalcomponent_get_dtend(inner);
1340 time_t endt = icaltime_as_timet(end);
1341
1342 return icaldurationtype_from_int(endt-startt);
1343 } else if ( dur_prop != 0) {
1344 return icalproperty_get_duration(dur_prop);
1345 } else {
1346 /* Error, both duration and dtend have been specified */
1347 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
1348 return null_duration;
1349 }
1350}
1351
1352void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method)
1353{
1354 icalproperty *prop
1355 = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY);
1356
1357
1358 if (prop == 0){
1359 prop = icalproperty_new_method(method);
1360 icalcomponent_add_property(comp, prop);
1361 }
1362
1363 icalproperty_set_method(prop,method);
1364
1365}
1366
1367icalproperty_method icalcomponent_get_method(icalcomponent* comp)
1368{
1369 icalproperty *prop
1370 = icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY);
1371
1372 if (prop == 0){
1373 return ICAL_METHOD_NONE;
1374 }
1375
1376 return icalproperty_get_method(prop);
1377}
1378
1379void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v)
1380{
1381
1382 icalcomponent *inner = icalcomponent_get_inner(comp);
1383 icalproperty *prop
1384 = icalcomponent_get_first_property(inner, ICAL_DTSTAMP_PROPERTY);
1385
1386
1387 if (prop == 0){
1388 prop = icalproperty_new_dtstamp(v);
1389 icalcomponent_add_property(inner, prop);
1390 }
1391
1392 icalproperty_set_dtstamp(prop,v);
1393
1394}
1395
1396
1397struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp)
1398{
1399 icalcomponent *inner = icalcomponent_get_inner(comp);
1400 icalproperty *prop
1401 = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
1402
1403 if (prop == 0){
1404 return icaltime_null_time();
1405 }
1406
1407 return icalproperty_get_dtstamp(prop);
1408}
1409
1410
1411void icalcomponent_set_summary(icalcomponent* comp, const char* v)
1412{
1413 icalcomponent *inner = icalcomponent_get_inner(comp);
1414 icalproperty *prop
1415 = icalcomponent_get_first_property(inner, ICAL_SUMMARY_PROPERTY);
1416
1417 if (prop == 0){
1418 prop = icalproperty_new_summary(v);
1419 icalcomponent_add_property(inner, prop);
1420 }
1421
1422 icalproperty_set_summary(prop,v);
1423}
1424
1425
1426const char* icalcomponent_get_summary(icalcomponent* comp)
1427{
1428 icalcomponent *inner = icalcomponent_get_inner(comp);
1429 icalproperty *prop
1430 = icalcomponent_get_first_property(inner,ICAL_SUMMARY_PROPERTY);
1431
1432 if (prop == 0){
1433 return 0;
1434 }
1435
1436 return icalproperty_get_summary(prop);
1437
1438}
1439
1440void icalcomponent_set_comment(icalcomponent* comp, const char* v);
1441const char* icalcomponent_get_comment(icalcomponent* comp);
1442
1443void icalcomponent_set_uid(icalcomponent* comp, const char* v);
1444const char* icalcomponent_get_uid(icalcomponent* comp);
1445
1446void icalcomponent_set_recurrenceid(icalcomponent* comp,
1447 struct icaltimetype v);
1448struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
1449
1450
1451
1452
1453icalcomponent* icalcomponent_new_vcalendar()
1454{
1455 return icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
1456}
1457icalcomponent* icalcomponent_new_vevent()
1458{
1459 return icalcomponent_new(ICAL_VEVENT_COMPONENT);
1460}
1461icalcomponent* icalcomponent_new_vtodo()
1462{
1463 return icalcomponent_new(ICAL_VTODO_COMPONENT);
1464}
1465icalcomponent* icalcomponent_new_vjournal()
1466{
1467 return icalcomponent_new(ICAL_VJOURNAL_COMPONENT);
1468}
1469icalcomponent* icalcomponent_new_valarm()
1470{
1471 return icalcomponent_new(ICAL_VALARM_COMPONENT);
1472}
1473icalcomponent* icalcomponent_new_vfreebusy()
1474{
1475 return icalcomponent_new(ICAL_VFREEBUSY_COMPONENT);
1476}
1477icalcomponent* icalcomponent_new_vtimezone()
1478{
1479 return icalcomponent_new(ICAL_VTIMEZONE_COMPONENT);
1480}
1481icalcomponent* icalcomponent_new_xstandard()
1482{
1483 return icalcomponent_new(ICAL_XSTANDARD_COMPONENT);
1484}
1485icalcomponent* icalcomponent_new_xdaylight()
1486{
1487 return icalcomponent_new(ICAL_XDAYLIGHT_COMPONENT);
1488}
diff --git a/libical/src/libical/icalcomponent.h b/libical/src/libical/icalcomponent.h
new file mode 100644
index 0000000..6046bbe
--- a/dev/null
+++ b/libical/src/libical/icalcomponent.h
@@ -0,0 +1,240 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalcomponent.h
4 CREATOR: eric 20 March 1999
5
6
7 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of either:
11
12 The LGPL as published by the Free Software Foundation, version
13 2.1, available at: http://www.fsf.org/copyleft/lesser.html
14
15 Or:
16
17 The Mozilla Public License Version 1.0. You may obtain a copy of
18 the License at http://www.mozilla.org/MPL/
19
20 The original code is icalcomponent.h
21
22======================================================================*/
23
24#ifndef ICALCOMPONENT_H
25#define ICALCOMPONENT_H
26
27#include "icalproperty.h"
28#include "icalvalue.h"
29#include "icalenums.h" /* defines icalcomponent_kind */
30#include "icalattendee.h"
31#include "pvl.h"
32
33typedef void icalcomponent;
34
35/* This is exposed so that callers will not have to allocate and
36 deallocate iterators. Pretend that you can't see it. */
37typedef struct icalcompiter
38{
39 icalcomponent_kind kind;
40 pvl_elem iter;
41
42} icalcompiter;
43
44icalcomponent* icalcomponent_new(icalcomponent_kind kind);
45icalcomponent* icalcomponent_new_clone(icalcomponent* component);
46icalcomponent* icalcomponent_new_from_string(char* str);
47icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...);
48void icalcomponent_free(icalcomponent* component);
49
50char* icalcomponent_as_ical_string(icalcomponent* component);
51
52int icalcomponent_is_valid(icalcomponent* component);
53
54icalcomponent_kind icalcomponent_isa(icalcomponent* component);
55
56int icalcomponent_isa_component (void* component);
57
58/*
59 * Working with properties
60 */
61
62void icalcomponent_add_property(icalcomponent* component,
63 icalproperty* property);
64
65void icalcomponent_remove_property(icalcomponent* component,
66 icalproperty* property);
67
68int icalcomponent_count_properties(icalcomponent* component,
69 icalproperty_kind kind);
70
71/* Iterate through the properties */
72icalproperty* icalcomponent_get_current_property(icalcomponent* component);
73
74icalproperty* icalcomponent_get_first_property(icalcomponent* component,
75 icalproperty_kind kind);
76icalproperty* icalcomponent_get_next_property(icalcomponent* component,
77 icalproperty_kind kind);
78
79
80/*
81 * Working with components
82 */
83
84
85/* Return the first VEVENT, VTODO or VJOURNAL sub-component of cop, or
86 comp if it is one of those types */
87
88icalcomponent* icalcomponent_get_inner(icalcomponent* comp);
89
90
91void icalcomponent_add_component(icalcomponent* parent,
92 icalcomponent* child);
93
94void icalcomponent_remove_component(icalcomponent* parent,
95 icalcomponent* child);
96
97int icalcomponent_count_components(icalcomponent* component,
98 icalcomponent_kind kind);
99
100/* Iteration Routines. There are two forms of iterators, internal and
101external. The internal ones came first, and are almost completely
102sufficient, but they fail badly when you want to construct a loop that
103removes components from the container.*/
104
105
106/* Iterate through components */
107icalcomponent* icalcomponent_get_current_component (icalcomponent* component);
108
109icalcomponent* icalcomponent_get_first_component(icalcomponent* component,
110 icalcomponent_kind kind);
111icalcomponent* icalcomponent_get_next_component(icalcomponent* component,
112 icalcomponent_kind kind);
113
114/* Using external iterators */
115icalcompiter icalcomponent_begin_component(icalcomponent* component,
116 icalcomponent_kind kind);
117icalcompiter icalcomponent_end_component(icalcomponent* component,
118 icalcomponent_kind kind);
119icalcomponent* icalcompiter_next(icalcompiter* i);
120icalcomponent* icalcompiter_prior(icalcompiter* i);
121icalcomponent* icalcompiter_deref(icalcompiter* i);
122
123
124
125
126/* Working with embedded error properties */
127
128int icalcomponent_count_errors(icalcomponent* component);
129
130/* Remove all X-LIC-ERROR properties*/
131void icalcomponent_strip_errors(icalcomponent* component);
132
133/* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
134void icalcomponent_convert_errors(icalcomponent* component);
135
136/* Internal operations. They are private, and you should not be using them. */
137icalcomponent* icalcomponent_get_parent(icalcomponent* component);
138void icalcomponent_set_parent(icalcomponent* component,
139 icalcomponent* parent);
140
141/* Kind conversion routiens */
142
143icalcomponent_kind icalcomponent_string_to_kind(const char* string);
144
145const char* icalcomponent_kind_to_string(icalcomponent_kind kind);
146
147
148/************* Derived class methods. ****************************
149
150If the code was in an OO language, the remaining routines would be
151members of classes derived from icalcomponent. Don't call them on the
152wrong component subtypes. */
153
154/* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
155 VJOURNAL */
156icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c);
157
158/* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
159 times of an event in UTC */
160struct icaltime_span icalcomponent_get_span(icalcomponent* comp);
161
162/******************** Convienience routines **********************/
163
164void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v);
165struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp);
166
167/* For the icalcomponent routines only, dtend and duration are tied
168 together. If you call the set routine for one and the other exists,
169 the routine will calculate the change to the other. That is, if
170 there is a DTEND and you call set_duration, the routine will modify
171 DTEND to be the sum of DTSTART and the duration. If you call a get
172 routine for one and the other exists, the routine will calculate
173 the return value. If you call a set routine and neither exists, the
174 routine will create the apcompriate comperty */
175
176
177struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp);
178void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
179
180void icalcomponent_set_duration(icalcomponent* comp,
181 struct icaldurationtype v);
182struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp);
183
184void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method);
185icalproperty_method icalcomponent_get_method(icalcomponent* comp);
186
187struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp);
188void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
189
190
191void icalcomponent_set_summary(icalcomponent* comp, const char* v);
192const char* icalcomponent_get_summary(icalcomponent* comp);
193
194void icalcomponent_set_comment(icalcomponent* comp, const char* v);
195const char* icalcomponent_get_comment(icalcomponent* comp);
196
197void icalcomponent_set_uid(icalcomponent* comp, const char* v);
198const char* icalcomponent_get_uid(icalcomponent* comp);
199
200void icalcomponent_set_recurrenceid(icalcomponent* comp,
201 struct icaltimetype v);
202struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
203
204
205void icalcomponent_set_organizer(icalcomponent* comp,
206 struct icalorganizertype org);
207 struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp);
208
209
210void icalcomponent_add_attendee(icalcomponent *comp,
211 struct icalattendeetype attendee);
212
213int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid);
214
215/* Get the Nth attendee. Out of range indices return an attendee
216 with cuid == 0 */
217struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp,
218 int index);
219
220
221
222
223/*************** Type Specific routines ***************/
224
225icalcomponent* icalcomponent_new_vcalendar();
226icalcomponent* icalcomponent_new_vevent();
227icalcomponent* icalcomponent_new_vtodo();
228icalcomponent* icalcomponent_new_vjournal();
229icalcomponent* icalcomponent_new_valarm();
230icalcomponent* icalcomponent_new_vfreebusy();
231icalcomponent* icalcomponent_new_vtimezone();
232icalcomponent* icalcomponent_new_xstandard();
233icalcomponent* icalcomponent_new_xdaylight();
234
235
236
237#endif /* !ICALCOMPONENT_H */
238
239
240
diff --git a/libical/src/libical/icalderivedparameter.c b/libical/src/libical/icalderivedparameter.c
new file mode 100644
index 0000000..6898eb6
--- a/dev/null
+++ b/libical/src/libical/icalderivedparameter.c
@@ -0,0 +1,1205 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalderivedparameters.{c,h}
4 CREATOR: eric 09 May 1999
5
6 $Id$
7 $Locker$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icalderivedparameters.{c,h}
24
25 Contributions from:
26 Graham Davison (g.m.davison@computer.org)
27
28 ======================================================================*/
29/*#line 29 "icalparameter.c.in"*/
30#ifdef HAVE_CONFIG_H
31#include <config.h>
32#endif
33
34
35#include "icalparameter.h"
36#include "icalparameterimpl.h"
37
38#include "icalproperty.h"
39#include "icalerror.h"
40#include "icalmemory.h"
41
42#include <stdlib.h> /* for malloc() */
43#include <errno.h>
44#include <string.h> /* for memset() */
45
46icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
47
48struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind);
49
50/* This map associates each of the parameters with the string
51 representation of the paramter's name */
52struct icalparameter_kind_map {
53 icalparameter_kind kind;
54 char *name;
55
56};
57
58extern struct icalparameter_kind_map parameter_map[];
59
60
61const char* icalparameter_kind_to_string(icalparameter_kind kind)
62{
63 int i;
64
65 for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
66 if (parameter_map[i].kind == kind) {
67 return parameter_map[i].name;
68 }
69 }
70
71 return 0;
72
73}
74
75icalparameter_kind icalparameter_string_to_kind(const char* string)
76{
77 int i;
78
79 if (string ==0 ) {
80 return ICAL_NO_PARAMETER;
81 }
82
83 for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
84
85 if (strcmp(parameter_map[i].name, string) == 0) {
86 return parameter_map[i].kind;
87 }
88 }
89
90 if(strncmp(string,"X-",2)==0){
91 return ICAL_X_PARAMETER;
92 }
93
94 return ICAL_NO_PARAMETER;
95}
96
97/* This map associates the enumerations for the VALUE parameter with
98 the kinds of VALUEs. */
99
100struct icalparameter_value_kind_map {
101 icalparameter_value value;
102 icalvalue_kind kind;
103};
104
105extern struct icalparameter_value_kind_map value_kind_map[];
106
107
108icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value)
109{
110 int i;
111
112 for (i=0; value_kind_map[i].kind != ICAL_NO_VALUE; i++) {
113
114 if (value_kind_map[i].value == value) {
115 return value_kind_map[i].kind;
116 }
117 }
118
119 return ICAL_NO_VALUE;
120}
121
122
123/* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */
124
125struct icalparameter_map {
126 icalparameter_kind kind;
127 int enumeration;
128 const char* str;
129};
130
131
132extern struct icalparameter_map icalparameter_map[];
133
134
135const char* icalparameter_enum_to_string(int e)
136{
137 int i;
138
139 icalerror_check_arg_rz(e >= ICALPARAMETER_FIRST_ENUM,"e");
140 icalerror_check_arg_rz(e <= ICALPARAMETER_LAST_ENUM,"e");
141
142 for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
143 if(e == icalparameter_map[i].enumeration){
144 return icalparameter_map[i].str;
145 }
146 }
147
148 return 0;
149}
150
151int icalparameter_string_to_enum(const char* str)
152{
153 int i;
154
155 icalerror_check_arg_rz(str != 0,"str");
156
157 for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
158 if(strcmp(str,icalparameter_map[i].str) == 0) {
159 return icalparameter_map[i].enumeration;
160 }
161 }
162
163 return 0;
164}
165
166icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val)
167{
168
169 struct icalparameter_impl* param=0;
170 int found_kind = 0;
171 int i;
172
173 icalerror_check_arg_rz((val!=0),"val");
174
175 /* Search through the parameter map to find a matching kind */
176
177 param = icalparameter_new_impl(kind);
178
179 for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
180 if(kind == icalparameter_map[i].kind) {
181 found_kind = 1;
182 if(strcmp(val,icalparameter_map[i].str) == 0) {
183
184 param->data = (int)icalparameter_map[i].enumeration;
185 return param;
186 }
187 }
188 }
189
190 if(found_kind == 1){
191 /* The kind was in the parameter map, but the string did not
192 match, so assume that it is an alternate value, like an
193 X-value.*/
194
195 icalparameter_set_xvalue(param, val);
196
197 } else {
198
199 /* If the kind was not found, then it must be a string type */
200
201 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(val);
202
203 }
204
205 return param;
206}
207
208
209
210
211/* Everything below this line is machine generated. Do not edit. */
212struct icalparameter_value_kind_map value_kind_map[] = {
213 {ICAL_VALUE_BINARY,ICAL_BINARY_VALUE},
214 {ICAL_VALUE_BOOLEAN,ICAL_BOOLEAN_VALUE},
215 {ICAL_VALUE_DATE,ICAL_DATE_VALUE},
216 {ICAL_VALUE_DURATION,ICAL_DURATION_VALUE},
217 {ICAL_VALUE_FLOAT,ICAL_FLOAT_VALUE},
218 {ICAL_VALUE_INTEGER,ICAL_INTEGER_VALUE},
219 {ICAL_VALUE_PERIOD,ICAL_PERIOD_VALUE},
220 {ICAL_VALUE_RECUR,ICAL_RECUR_VALUE},
221 {ICAL_VALUE_TEXT,ICAL_TEXT_VALUE},
222 {ICAL_VALUE_URI,ICAL_URI_VALUE},
223 {ICAL_VALUE_DATETIME,ICAL_DATETIME_VALUE},
224 {ICAL_VALUE_UTCOFFSET,ICAL_UTCOFFSET_VALUE},
225 {ICAL_VALUE_CALADDRESS,ICAL_CALADDRESS_VALUE},
226 {ICAL_VALUE_X,ICAL_X_VALUE},
227 {ICAL_VALUE_NONE,ICAL_NO_VALUE}
228};
229
230static struct icalparameter_kind_map parameter_map[] = {
231 {ICAL_ALTREP_PARAMETER,"ALTREP"},
232 {ICAL_CN_PARAMETER,"CN"},
233 {ICAL_CUTYPE_PARAMETER,"CUTYPE"},
234 {ICAL_DELEGATEDFROM_PARAMETER,"DELEGATED-FROM"},
235 {ICAL_DELEGATEDTO_PARAMETER,"DELEGATED-TO"},
236 {ICAL_DIR_PARAMETER,"DIR"},
237 {ICAL_ENCODING_PARAMETER,"ENCODING"},
238 {ICAL_FBTYPE_PARAMETER,"FBTYPE"},
239 {ICAL_FMTTYPE_PARAMETER,"FMTTYPE"},
240 {ICAL_LANGUAGE_PARAMETER,"LANGUAGE"},
241 {ICAL_MEMBER_PARAMETER,"MEMBER"},
242 {ICAL_PARTSTAT_PARAMETER,"PARTSTAT"},
243 {ICAL_RANGE_PARAMETER,"RANGE"},
244 {ICAL_RELATED_PARAMETER,"RELATED"},
245 {ICAL_RELTYPE_PARAMETER,"RELTYPE"},
246 {ICAL_ROLE_PARAMETER,"ROLE"},
247 {ICAL_RSVP_PARAMETER,"RSVP"},
248 {ICAL_SENTBY_PARAMETER,"SENT-BY"},
249 {ICAL_TZID_PARAMETER,"TZID"},
250 {ICAL_VALUE_PARAMETER,"VALUE"},
251 {ICAL_X_PARAMETER,"X"},
252 {ICAL_XLICCOMPARETYPE_PARAMETER,"X-LIC-COMPARETYPE"},
253 {ICAL_XLICERRORTYPE_PARAMETER,"X-LIC-ERRORTYPE"},
254 { ICAL_NO_PARAMETER, ""}
255};
256
257static struct icalparameter_map icalparameter_map[] = {
258{ICAL_ANY_PARAMETER,0,""},
259 {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_INDIVIDUAL,"INDIVIDUAL"},
260 {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_GROUP,"GROUP"},
261 {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_RESOURCE,"RESOURCE"},
262 {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_ROOM,"ROOM"},
263 {ICAL_CUTYPE_PARAMETER,ICAL_CUTYPE_UNKNOWN,"UNKNOWN"},
264 {ICAL_ENCODING_PARAMETER,ICAL_ENCODING_8BIT,"8BIT"},
265 {ICAL_ENCODING_PARAMETER,ICAL_ENCODING_BASE64,"BASE64"},
266 {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_FREE,"FREE"},
267 {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSY,"BUSY"},
268 {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYUNAVAILABLE,"BUSYUNAVAILABLE"},
269 {ICAL_FBTYPE_PARAMETER,ICAL_FBTYPE_BUSYTENTATIVE,"BUSYTENTATIVE"},
270 {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_NEEDSACTION,"NEEDS-ACTION"},
271 {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_ACCEPTED,"ACCEPTED"},
272 {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DECLINED,"DECLINED"},
273 {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_TENTATIVE,"TENTATIVE"},
274 {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_DELEGATED,"DELEGATED"},
275 {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_COMPLETED,"COMPLETED"},
276 {ICAL_PARTSTAT_PARAMETER,ICAL_PARTSTAT_INPROCESS,"INPROCESS"},
277 {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDPRIOR,"THISANDPRIOR"},
278 {ICAL_RANGE_PARAMETER,ICAL_RANGE_THISANDFUTURE,"THISANDFUTURE"},
279 {ICAL_RELATED_PARAMETER,ICAL_RELATED_START,"START"},
280 {ICAL_RELATED_PARAMETER,ICAL_RELATED_END ,"END "},
281 {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_PARENT,"PARENT"},
282 {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_CHILD,"CHILD"},
283 {ICAL_RELTYPE_PARAMETER,ICAL_RELTYPE_SIBLING,"SIBLING"},
284 {ICAL_ROLE_PARAMETER,ICAL_ROLE_CHAIR,"CHAIR"},
285 {ICAL_ROLE_PARAMETER,ICAL_ROLE_REQPARTICIPANT,"REQ-PARTICIPANT"},
286 {ICAL_ROLE_PARAMETER,ICAL_ROLE_OPTPARTICIPANT,"OPT-PARTICIPANT"},
287 {ICAL_ROLE_PARAMETER,ICAL_ROLE_NONPARTICIPANT,"NON-PARTICIPANT"},
288 {ICAL_RSVP_PARAMETER,ICAL_RSVP_TRUE,"TRUE"},
289 {ICAL_RSVP_PARAMETER,ICAL_RSVP_FALSE,"FALSE"},
290 {ICAL_VALUE_PARAMETER,ICAL_VALUE_BINARY,"BINARY"},
291 {ICAL_VALUE_PARAMETER,ICAL_VALUE_BOOLEAN,"BOOLEAN"},
292 {ICAL_VALUE_PARAMETER,ICAL_VALUE_DATE,"DATE"},
293 {ICAL_VALUE_PARAMETER,ICAL_VALUE_DURATION,"DURATION"},
294 {ICAL_VALUE_PARAMETER,ICAL_VALUE_FLOAT,"FLOAT"},
295 {ICAL_VALUE_PARAMETER,ICAL_VALUE_INTEGER,"INTEGER"},
296 {ICAL_VALUE_PARAMETER,ICAL_VALUE_PERIOD,"PERIOD"},
297 {ICAL_VALUE_PARAMETER,ICAL_VALUE_RECUR,"RECUR"},
298 {ICAL_VALUE_PARAMETER,ICAL_VALUE_TEXT,"TEXT"},
299 {ICAL_VALUE_PARAMETER,ICAL_VALUE_URI,"URI"},
300 {ICAL_VALUE_PARAMETER,ICAL_VALUE_ERROR,"ERROR"},
301 {ICAL_VALUE_PARAMETER,ICAL_VALUE_DATETIME,"DATE-TIME"},
302 {ICAL_VALUE_PARAMETER,ICAL_VALUE_UTCOFFSET,"UTC-OFFSET"},
303 {ICAL_VALUE_PARAMETER,ICAL_VALUE_CALADDRESS,"CAL-ADDRESS"},
304 {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_EQUAL,"EQUAL"},
305 {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_NOTEQUAL,"NOTEQUAL"},
306 {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESS,"LESS"},
307 {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATER,"GREATER"},
308 {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_LESSEQUAL,"LESSEQUAL"},
309 {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_GREATEREQUAL,"GREATEREQUAL"},
310 {ICAL_XLICCOMPARETYPE_PARAMETER,ICAL_XLICCOMPARETYPE_REGEX,"REGEX"},
311 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_COMPONENTPARSEERROR,"COMPONENT-PARSE-ERROR"},
312 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PROPERTYPARSEERROR,"PROPERTY-PARSE-ERROR"},
313 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR,"PARAMETER-NAME-PARSE-ERROR"},
314 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR,"PARAMETER-VALUE-PARSE-ERROR"},
315 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_VALUEPARSEERROR,"VALUE-PARSE-ERROR"},
316 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_INVALIDITIP,"INVALID-ITIP"},
317 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR,"UNKNOWN-VCAL-PROP-ERROR"},
318 {ICAL_XLICERRORTYPE_PARAMETER,ICAL_XLICERRORTYPE_MIMEPARSEERROR,"MIME-PARSE-ERROR"},
319 {ICAL_NO_PARAMETER,0,""}};
320
321/* DELEGATED-FROM */
322icalparameter* icalparameter_new_delegatedfrom(const char* v)
323{
324 struct icalparameter_impl *impl;
325 icalerror_clear_errno();
326 icalerror_check_arg_rz( (v!=0),"v");
327 impl = icalparameter_new_impl(ICAL_DELEGATEDFROM_PARAMETER);
328 if (impl == 0) {
329 return 0;
330 }
331
332 icalparameter_set_delegatedfrom((icalparameter*) impl,v);
333 if (icalerrno != ICAL_NO_ERROR) {
334 icalparameter_free((icalparameter*) impl);
335 return 0;
336 }
337
338 return (icalparameter*) impl;
339}
340
341const char* icalparameter_get_delegatedfrom(icalparameter* param)
342{
343 icalerror_clear_errno();
344 icalerror_check_arg_rz( (param!=0), "param");
345 return (const char*)((struct icalparameter_impl*)param)->string;
346}
347
348void icalparameter_set_delegatedfrom(icalparameter* param, const char* v)
349{
350 icalerror_check_arg_rv( (v!=0),"v");
351 icalerror_check_arg_rv( (param!=0), "param");
352 icalerror_clear_errno();
353
354 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
355}
356
357/* DELEGATED-TO */
358icalparameter* icalparameter_new_delegatedto(const char* v)
359{
360 struct icalparameter_impl *impl;
361 icalerror_clear_errno();
362 icalerror_check_arg_rz( (v!=0),"v");
363 impl = icalparameter_new_impl(ICAL_DELEGATEDTO_PARAMETER);
364 if (impl == 0) {
365 return 0;
366 }
367
368 icalparameter_set_delegatedto((icalparameter*) impl,v);
369 if (icalerrno != ICAL_NO_ERROR) {
370 icalparameter_free((icalparameter*) impl);
371 return 0;
372 }
373
374 return (icalparameter*) impl;
375}
376
377const char* icalparameter_get_delegatedto(icalparameter* param)
378{
379 icalerror_clear_errno();
380 icalerror_check_arg_rz( (param!=0), "param");
381 return (const char*)((struct icalparameter_impl*)param)->string;
382}
383
384void icalparameter_set_delegatedto(icalparameter* param, const char* v)
385{
386 icalerror_check_arg_rv( (v!=0),"v");
387 icalerror_check_arg_rv( (param!=0), "param");
388 icalerror_clear_errno();
389
390 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
391}
392
393/* RANGE */
394icalparameter* icalparameter_new_range(icalparameter_range v)
395{
396 struct icalparameter_impl *impl;
397 icalerror_clear_errno();
398 icalerror_check_arg_rz(v >= ICAL_RANGE_X,"v");
399 icalerror_check_arg_rz(v < ICAL_RANGE_NONE,"v");
400 impl = icalparameter_new_impl(ICAL_RANGE_PARAMETER);
401 if (impl == 0) {
402 return 0;
403 }
404
405 icalparameter_set_range((icalparameter*) impl,v);
406 if (icalerrno != ICAL_NO_ERROR) {
407 icalparameter_free((icalparameter*) impl);
408 return 0;
409 }
410
411 return (icalparameter*) impl;
412}
413
414icalparameter_range icalparameter_get_range(icalparameter* param)
415{
416 icalerror_clear_errno();
417icalerror_check_arg( (param!=0), "param");
418
419return (icalparameter_range)((struct icalparameter_impl*)param)->data;
420}
421
422void icalparameter_set_range(icalparameter* param, icalparameter_range v)
423{
424 icalerror_check_arg_rv(v >= ICAL_RANGE_X,"v");
425 icalerror_check_arg_rv(v < ICAL_RANGE_NONE,"v");
426 icalerror_check_arg_rv( (param!=0), "param");
427 icalerror_clear_errno();
428
429 ((struct icalparameter_impl*)param)->data = (int)v;
430}
431
432/* ENCODING */
433icalparameter* icalparameter_new_encoding(icalparameter_encoding v)
434{
435 struct icalparameter_impl *impl;
436 icalerror_clear_errno();
437 icalerror_check_arg_rz(v >= ICAL_ENCODING_X,"v");
438 icalerror_check_arg_rz(v < ICAL_ENCODING_NONE,"v");
439 impl = icalparameter_new_impl(ICAL_ENCODING_PARAMETER);
440 if (impl == 0) {
441 return 0;
442 }
443
444 icalparameter_set_encoding((icalparameter*) impl,v);
445 if (icalerrno != ICAL_NO_ERROR) {
446 icalparameter_free((icalparameter*) impl);
447 return 0;
448 }
449
450 return (icalparameter*) impl;
451}
452
453icalparameter_encoding icalparameter_get_encoding(icalparameter* param)
454{
455 icalerror_clear_errno();
456icalerror_check_arg( (param!=0), "param");
457 if ( ((struct icalparameter_impl*)param)->string != 0){
458 return ICAL_ENCODING_X;
459 }
460
461return (icalparameter_encoding)((struct icalparameter_impl*)param)->data;
462}
463
464void icalparameter_set_encoding(icalparameter* param, icalparameter_encoding v)
465{
466 icalerror_check_arg_rv(v >= ICAL_ENCODING_X,"v");
467 icalerror_check_arg_rv(v < ICAL_ENCODING_NONE,"v");
468 icalerror_check_arg_rv( (param!=0), "param");
469 icalerror_clear_errno();
470
471 ((struct icalparameter_impl*)param)->data = (int)v;
472}
473
474/* RSVP */
475icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v)
476{
477 struct icalparameter_impl *impl;
478 icalerror_clear_errno();
479 icalerror_check_arg_rz(v >= ICAL_RSVP_X,"v");
480 icalerror_check_arg_rz(v < ICAL_RSVP_NONE,"v");
481 impl = icalparameter_new_impl(ICAL_RSVP_PARAMETER);
482 if (impl == 0) {
483 return 0;
484 }
485
486 icalparameter_set_rsvp((icalparameter*) impl,v);
487 if (icalerrno != ICAL_NO_ERROR) {
488 icalparameter_free((icalparameter*) impl);
489 return 0;
490 }
491
492 return (icalparameter*) impl;
493}
494
495icalparameter_rsvp icalparameter_get_rsvp(icalparameter* param)
496{
497 icalerror_clear_errno();
498icalerror_check_arg( (param!=0), "param");
499
500return (icalparameter_rsvp)((struct icalparameter_impl*)param)->data;
501}
502
503void icalparameter_set_rsvp(icalparameter* param, icalparameter_rsvp v)
504{
505 icalerror_check_arg_rv(v >= ICAL_RSVP_X,"v");
506 icalerror_check_arg_rv(v < ICAL_RSVP_NONE,"v");
507 icalerror_check_arg_rv( (param!=0), "param");
508 icalerror_clear_errno();
509
510 ((struct icalparameter_impl*)param)->data = (int)v;
511}
512
513/* PARTSTAT */
514icalparameter* icalparameter_new_partstat(icalparameter_partstat v)
515{
516 struct icalparameter_impl *impl;
517 icalerror_clear_errno();
518 icalerror_check_arg_rz(v >= ICAL_PARTSTAT_X,"v");
519 icalerror_check_arg_rz(v < ICAL_PARTSTAT_NONE,"v");
520 impl = icalparameter_new_impl(ICAL_PARTSTAT_PARAMETER);
521 if (impl == 0) {
522 return 0;
523 }
524
525 icalparameter_set_partstat((icalparameter*) impl,v);
526 if (icalerrno != ICAL_NO_ERROR) {
527 icalparameter_free((icalparameter*) impl);
528 return 0;
529 }
530
531 return (icalparameter*) impl;
532}
533
534icalparameter_partstat icalparameter_get_partstat(icalparameter* param)
535{
536 icalerror_clear_errno();
537icalerror_check_arg( (param!=0), "param");
538 if ( ((struct icalparameter_impl*)param)->string != 0){
539 return ICAL_PARTSTAT_X;
540 }
541
542return (icalparameter_partstat)((struct icalparameter_impl*)param)->data;
543}
544
545void icalparameter_set_partstat(icalparameter* param, icalparameter_partstat v)
546{
547 icalerror_check_arg_rv(v >= ICAL_PARTSTAT_X,"v");
548 icalerror_check_arg_rv(v < ICAL_PARTSTAT_NONE,"v");
549 icalerror_check_arg_rv( (param!=0), "param");
550 icalerror_clear_errno();
551
552 ((struct icalparameter_impl*)param)->data = (int)v;
553}
554
555/* RELTYPE */
556icalparameter* icalparameter_new_reltype(icalparameter_reltype v)
557{
558 struct icalparameter_impl *impl;
559 icalerror_clear_errno();
560 icalerror_check_arg_rz(v >= ICAL_RELTYPE_X,"v");
561 icalerror_check_arg_rz(v < ICAL_RELTYPE_NONE,"v");
562 impl = icalparameter_new_impl(ICAL_RELTYPE_PARAMETER);
563 if (impl == 0) {
564 return 0;
565 }
566
567 icalparameter_set_reltype((icalparameter*) impl,v);
568 if (icalerrno != ICAL_NO_ERROR) {
569 icalparameter_free((icalparameter*) impl);
570 return 0;
571 }
572
573 return (icalparameter*) impl;
574}
575
576icalparameter_reltype icalparameter_get_reltype(icalparameter* param)
577{
578 icalerror_clear_errno();
579icalerror_check_arg( (param!=0), "param");
580 if ( ((struct icalparameter_impl*)param)->string != 0){
581 return ICAL_RELTYPE_X;
582 }
583
584return (icalparameter_reltype)((struct icalparameter_impl*)param)->data;
585}
586
587void icalparameter_set_reltype(icalparameter* param, icalparameter_reltype v)
588{
589 icalerror_check_arg_rv(v >= ICAL_RELTYPE_X,"v");
590 icalerror_check_arg_rv(v < ICAL_RELTYPE_NONE,"v");
591 icalerror_check_arg_rv( (param!=0), "param");
592 icalerror_clear_errno();
593
594 ((struct icalparameter_impl*)param)->data = (int)v;
595}
596
597/* CUTYPE */
598icalparameter* icalparameter_new_cutype(icalparameter_cutype v)
599{
600 struct icalparameter_impl *impl;
601 icalerror_clear_errno();
602 icalerror_check_arg_rz(v >= ICAL_CUTYPE_X,"v");
603 icalerror_check_arg_rz(v < ICAL_CUTYPE_NONE,"v");
604 impl = icalparameter_new_impl(ICAL_CUTYPE_PARAMETER);
605 if (impl == 0) {
606 return 0;
607 }
608
609 icalparameter_set_cutype((icalparameter*) impl,v);
610 if (icalerrno != ICAL_NO_ERROR) {
611 icalparameter_free((icalparameter*) impl);
612 return 0;
613 }
614
615 return (icalparameter*) impl;
616}
617
618icalparameter_cutype icalparameter_get_cutype(icalparameter* param)
619{
620 icalerror_clear_errno();
621icalerror_check_arg( (param!=0), "param");
622 if ( ((struct icalparameter_impl*)param)->string != 0){
623 return ICAL_CUTYPE_X;
624 }
625
626return (icalparameter_cutype)((struct icalparameter_impl*)param)->data;
627}
628
629void icalparameter_set_cutype(icalparameter* param, icalparameter_cutype v)
630{
631 icalerror_check_arg_rv(v >= ICAL_CUTYPE_X,"v");
632 icalerror_check_arg_rv(v < ICAL_CUTYPE_NONE,"v");
633 icalerror_check_arg_rv( (param!=0), "param");
634 icalerror_clear_errno();
635
636 ((struct icalparameter_impl*)param)->data = (int)v;
637}
638
639/* MEMBER */
640icalparameter* icalparameter_new_member(const char* v)
641{
642 struct icalparameter_impl *impl;
643 icalerror_clear_errno();
644 icalerror_check_arg_rz( (v!=0),"v");
645 impl = icalparameter_new_impl(ICAL_MEMBER_PARAMETER);
646 if (impl == 0) {
647 return 0;
648 }
649
650 icalparameter_set_member((icalparameter*) impl,v);
651 if (icalerrno != ICAL_NO_ERROR) {
652 icalparameter_free((icalparameter*) impl);
653 return 0;
654 }
655
656 return (icalparameter*) impl;
657}
658
659const char* icalparameter_get_member(icalparameter* param)
660{
661 icalerror_clear_errno();
662 icalerror_check_arg_rz( (param!=0), "param");
663 return (const char*)((struct icalparameter_impl*)param)->string;
664}
665
666void icalparameter_set_member(icalparameter* param, const char* v)
667{
668 icalerror_check_arg_rv( (v!=0),"v");
669 icalerror_check_arg_rv( (param!=0), "param");
670 icalerror_clear_errno();
671
672 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
673}
674
675/* FMTTYPE */
676icalparameter* icalparameter_new_fmttype(const char* v)
677{
678 struct icalparameter_impl *impl;
679 icalerror_clear_errno();
680 icalerror_check_arg_rz( (v!=0),"v");
681 impl = icalparameter_new_impl(ICAL_FMTTYPE_PARAMETER);
682 if (impl == 0) {
683 return 0;
684 }
685
686 icalparameter_set_fmttype((icalparameter*) impl,v);
687 if (icalerrno != ICAL_NO_ERROR) {
688 icalparameter_free((icalparameter*) impl);
689 return 0;
690 }
691
692 return (icalparameter*) impl;
693}
694
695const char* icalparameter_get_fmttype(icalparameter* param)
696{
697 icalerror_clear_errno();
698 icalerror_check_arg_rz( (param!=0), "param");
699 return (const char*)((struct icalparameter_impl*)param)->string;
700}
701
702void icalparameter_set_fmttype(icalparameter* param, const char* v)
703{
704 icalerror_check_arg_rv( (v!=0),"v");
705 icalerror_check_arg_rv( (param!=0), "param");
706 icalerror_clear_errno();
707
708 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
709}
710
711/* SENT-BY */
712icalparameter* icalparameter_new_sentby(const char* v)
713{
714 struct icalparameter_impl *impl;
715 icalerror_clear_errno();
716 icalerror_check_arg_rz( (v!=0),"v");
717 impl = icalparameter_new_impl(ICAL_SENTBY_PARAMETER);
718 if (impl == 0) {
719 return 0;
720 }
721
722 icalparameter_set_sentby((icalparameter*) impl,v);
723 if (icalerrno != ICAL_NO_ERROR) {
724 icalparameter_free((icalparameter*) impl);
725 return 0;
726 }
727
728 return (icalparameter*) impl;
729}
730
731const char* icalparameter_get_sentby(icalparameter* param)
732{
733 icalerror_clear_errno();
734 icalerror_check_arg_rz( (param!=0), "param");
735 return (const char*)((struct icalparameter_impl*)param)->string;
736}
737
738void icalparameter_set_sentby(icalparameter* param, const char* v)
739{
740 icalerror_check_arg_rv( (v!=0),"v");
741 icalerror_check_arg_rv( (param!=0), "param");
742 icalerror_clear_errno();
743
744 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
745}
746
747/* VALUE */
748icalparameter* icalparameter_new_value(icalparameter_value v)
749{
750 struct icalparameter_impl *impl;
751 icalerror_clear_errno();
752 icalerror_check_arg_rz(v >= ICAL_VALUE_X,"v");
753 icalerror_check_arg_rz(v < ICAL_VALUE_NONE,"v");
754 impl = icalparameter_new_impl(ICAL_VALUE_PARAMETER);
755 if (impl == 0) {
756 return 0;
757 }
758
759 icalparameter_set_value((icalparameter*) impl,v);
760 if (icalerrno != ICAL_NO_ERROR) {
761 icalparameter_free((icalparameter*) impl);
762 return 0;
763 }
764
765 return (icalparameter*) impl;
766}
767
768icalparameter_value icalparameter_get_value(icalparameter* param)
769{
770 icalerror_clear_errno();
771icalerror_check_arg( (param!=0), "param");
772 if ( ((struct icalparameter_impl*)param)->string != 0){
773 return ICAL_VALUE_X;
774 }
775
776return (icalparameter_value)((struct icalparameter_impl*)param)->data;
777}
778
779void icalparameter_set_value(icalparameter* param, icalparameter_value v)
780{
781 icalerror_check_arg_rv(v >= ICAL_VALUE_X,"v");
782 icalerror_check_arg_rv(v < ICAL_VALUE_NONE,"v");
783 icalerror_check_arg_rv( (param!=0), "param");
784 icalerror_clear_errno();
785
786 ((struct icalparameter_impl*)param)->data = (int)v;
787}
788
789/* ALTREP */
790icalparameter* icalparameter_new_altrep(const char* v)
791{
792 struct icalparameter_impl *impl;
793 icalerror_clear_errno();
794 icalerror_check_arg_rz( (v!=0),"v");
795 impl = icalparameter_new_impl(ICAL_ALTREP_PARAMETER);
796 if (impl == 0) {
797 return 0;
798 }
799
800 icalparameter_set_altrep((icalparameter*) impl,v);
801 if (icalerrno != ICAL_NO_ERROR) {
802 icalparameter_free((icalparameter*) impl);
803 return 0;
804 }
805
806 return (icalparameter*) impl;
807}
808
809const char* icalparameter_get_altrep(icalparameter* param)
810{
811 icalerror_clear_errno();
812 icalerror_check_arg_rz( (param!=0), "param");
813 return (const char*)((struct icalparameter_impl*)param)->string;
814}
815
816void icalparameter_set_altrep(icalparameter* param, const char* v)
817{
818 icalerror_check_arg_rv( (v!=0),"v");
819 icalerror_check_arg_rv( (param!=0), "param");
820 icalerror_clear_errno();
821
822 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
823}
824
825/* DIR */
826icalparameter* icalparameter_new_dir(const char* v)
827{
828 struct icalparameter_impl *impl;
829 icalerror_clear_errno();
830 icalerror_check_arg_rz( (v!=0),"v");
831 impl = icalparameter_new_impl(ICAL_DIR_PARAMETER);
832 if (impl == 0) {
833 return 0;
834 }
835
836 icalparameter_set_dir((icalparameter*) impl,v);
837 if (icalerrno != ICAL_NO_ERROR) {
838 icalparameter_free((icalparameter*) impl);
839 return 0;
840 }
841
842 return (icalparameter*) impl;
843}
844
845const char* icalparameter_get_dir(icalparameter* param)
846{
847 icalerror_clear_errno();
848 icalerror_check_arg_rz( (param!=0), "param");
849 return (const char*)((struct icalparameter_impl*)param)->string;
850}
851
852void icalparameter_set_dir(icalparameter* param, const char* v)
853{
854 icalerror_check_arg_rv( (v!=0),"v");
855 icalerror_check_arg_rv( (param!=0), "param");
856 icalerror_clear_errno();
857
858 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
859}
860
861/* RELATED */
862icalparameter* icalparameter_new_related(icalparameter_related v)
863{
864 struct icalparameter_impl *impl;
865 icalerror_clear_errno();
866 icalerror_check_arg_rz(v >= ICAL_RELATED_X,"v");
867 icalerror_check_arg_rz(v < ICAL_RELATED_NONE,"v");
868 impl = icalparameter_new_impl(ICAL_RELATED_PARAMETER);
869 if (impl == 0) {
870 return 0;
871 }
872
873 icalparameter_set_related((icalparameter*) impl,v);
874 if (icalerrno != ICAL_NO_ERROR) {
875 icalparameter_free((icalparameter*) impl);
876 return 0;
877 }
878
879 return (icalparameter*) impl;
880}
881
882icalparameter_related icalparameter_get_related(icalparameter* param)
883{
884 icalerror_clear_errno();
885icalerror_check_arg( (param!=0), "param");
886
887return (icalparameter_related)((struct icalparameter_impl*)param)->data;
888}
889
890void icalparameter_set_related(icalparameter* param, icalparameter_related v)
891{
892 icalerror_check_arg_rv(v >= ICAL_RELATED_X,"v");
893 icalerror_check_arg_rv(v < ICAL_RELATED_NONE,"v");
894 icalerror_check_arg_rv( (param!=0), "param");
895 icalerror_clear_errno();
896
897 ((struct icalparameter_impl*)param)->data = (int)v;
898}
899
900/* CN */
901icalparameter* icalparameter_new_cn(const char* v)
902{
903 struct icalparameter_impl *impl;
904 icalerror_clear_errno();
905 icalerror_check_arg_rz( (v!=0),"v");
906 impl = icalparameter_new_impl(ICAL_CN_PARAMETER);
907 if (impl == 0) {
908 return 0;
909 }
910
911 icalparameter_set_cn((icalparameter*) impl,v);
912 if (icalerrno != ICAL_NO_ERROR) {
913 icalparameter_free((icalparameter*) impl);
914 return 0;
915 }
916
917 return (icalparameter*) impl;
918}
919
920const char* icalparameter_get_cn(icalparameter* param)
921{
922 icalerror_clear_errno();
923 icalerror_check_arg_rz( (param!=0), "param");
924 return (const char*)((struct icalparameter_impl*)param)->string;
925}
926
927void icalparameter_set_cn(icalparameter* param, const char* v)
928{
929 icalerror_check_arg_rv( (v!=0),"v");
930 icalerror_check_arg_rv( (param!=0), "param");
931 icalerror_clear_errno();
932
933 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
934}
935
936/* X-LIC-ERRORTYPE */
937icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v)
938{
939 struct icalparameter_impl *impl;
940 icalerror_clear_errno();
941 icalerror_check_arg_rz(v >= ICAL_XLICERRORTYPE_X,"v");
942 icalerror_check_arg_rz(v < ICAL_XLICERRORTYPE_NONE,"v");
943 impl = icalparameter_new_impl(ICAL_XLICERRORTYPE_PARAMETER);
944 if (impl == 0) {
945 return 0;
946 }
947
948 icalparameter_set_xlicerrortype((icalparameter*) impl,v);
949 if (icalerrno != ICAL_NO_ERROR) {
950 icalparameter_free((icalparameter*) impl);
951 return 0;
952 }
953
954 return (icalparameter*) impl;
955}
956
957icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* param)
958{
959 icalerror_clear_errno();
960icalerror_check_arg( (param!=0), "param");
961
962return (icalparameter_xlicerrortype)((struct icalparameter_impl*)param)->data;
963}
964
965void icalparameter_set_xlicerrortype(icalparameter* param, icalparameter_xlicerrortype v)
966{
967 icalerror_check_arg_rv(v >= ICAL_XLICERRORTYPE_X,"v");
968 icalerror_check_arg_rv(v < ICAL_XLICERRORTYPE_NONE,"v");
969 icalerror_check_arg_rv( (param!=0), "param");
970 icalerror_clear_errno();
971
972 ((struct icalparameter_impl*)param)->data = (int)v;
973}
974
975/* X */
976icalparameter* icalparameter_new_x(const char* v)
977{
978 struct icalparameter_impl *impl;
979 icalerror_clear_errno();
980 icalerror_check_arg_rz( (v!=0),"v");
981 impl = icalparameter_new_impl(ICAL_X_PARAMETER);
982 if (impl == 0) {
983 return 0;
984 }
985
986 icalparameter_set_x((icalparameter*) impl,v);
987 if (icalerrno != ICAL_NO_ERROR) {
988 icalparameter_free((icalparameter*) impl);
989 return 0;
990 }
991
992 return (icalparameter*) impl;
993}
994
995const char* icalparameter_get_x(icalparameter* param)
996{
997 icalerror_clear_errno();
998 icalerror_check_arg_rz( (param!=0), "param");
999 return (const char*)((struct icalparameter_impl*)param)->string;
1000}
1001
1002void icalparameter_set_x(icalparameter* param, const char* v)
1003{
1004 icalerror_check_arg_rv( (v!=0),"v");
1005 icalerror_check_arg_rv( (param!=0), "param");
1006 icalerror_clear_errno();
1007
1008 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
1009}
1010
1011/* LANGUAGE */
1012icalparameter* icalparameter_new_language(const char* v)
1013{
1014 struct icalparameter_impl *impl;
1015 icalerror_clear_errno();
1016 icalerror_check_arg_rz( (v!=0),"v");
1017 impl = icalparameter_new_impl(ICAL_LANGUAGE_PARAMETER);
1018 if (impl == 0) {
1019 return 0;
1020 }
1021
1022 icalparameter_set_language((icalparameter*) impl,v);
1023 if (icalerrno != ICAL_NO_ERROR) {
1024 icalparameter_free((icalparameter*) impl);
1025 return 0;
1026 }
1027
1028 return (icalparameter*) impl;
1029}
1030
1031const char* icalparameter_get_language(icalparameter* param)
1032{
1033 icalerror_clear_errno();
1034 icalerror_check_arg_rz( (param!=0), "param");
1035 return (const char*)((struct icalparameter_impl*)param)->string;
1036}
1037
1038void icalparameter_set_language(icalparameter* param, const char* v)
1039{
1040 icalerror_check_arg_rv( (v!=0),"v");
1041 icalerror_check_arg_rv( (param!=0), "param");
1042 icalerror_clear_errno();
1043
1044 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
1045}
1046
1047/* ROLE */
1048icalparameter* icalparameter_new_role(icalparameter_role v)
1049{
1050 struct icalparameter_impl *impl;
1051 icalerror_clear_errno();
1052 icalerror_check_arg_rz(v >= ICAL_ROLE_X,"v");
1053 icalerror_check_arg_rz(v < ICAL_ROLE_NONE,"v");
1054 impl = icalparameter_new_impl(ICAL_ROLE_PARAMETER);
1055 if (impl == 0) {
1056 return 0;
1057 }
1058
1059 icalparameter_set_role((icalparameter*) impl,v);
1060 if (icalerrno != ICAL_NO_ERROR) {
1061 icalparameter_free((icalparameter*) impl);
1062 return 0;
1063 }
1064
1065 return (icalparameter*) impl;
1066}
1067
1068icalparameter_role icalparameter_get_role(icalparameter* param)
1069{
1070 icalerror_clear_errno();
1071icalerror_check_arg( (param!=0), "param");
1072 if ( ((struct icalparameter_impl*)param)->string != 0){
1073 return ICAL_ROLE_X;
1074 }
1075
1076return (icalparameter_role)((struct icalparameter_impl*)param)->data;
1077}
1078
1079void icalparameter_set_role(icalparameter* param, icalparameter_role v)
1080{
1081 icalerror_check_arg_rv(v >= ICAL_ROLE_X,"v");
1082 icalerror_check_arg_rv(v < ICAL_ROLE_NONE,"v");
1083 icalerror_check_arg_rv( (param!=0), "param");
1084 icalerror_clear_errno();
1085
1086 ((struct icalparameter_impl*)param)->data = (int)v;
1087}
1088
1089/* X-LIC-COMPARETYPE */
1090icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v)
1091{
1092 struct icalparameter_impl *impl;
1093 icalerror_clear_errno();
1094 icalerror_check_arg_rz(v >= ICAL_XLICCOMPARETYPE_X,"v");
1095 icalerror_check_arg_rz(v < ICAL_XLICCOMPARETYPE_NONE,"v");
1096 impl = icalparameter_new_impl(ICAL_XLICCOMPARETYPE_PARAMETER);
1097 if (impl == 0) {
1098 return 0;
1099 }
1100
1101 icalparameter_set_xliccomparetype((icalparameter*) impl,v);
1102 if (icalerrno != ICAL_NO_ERROR) {
1103 icalparameter_free((icalparameter*) impl);
1104 return 0;
1105 }
1106
1107 return (icalparameter*) impl;
1108}
1109
1110icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* param)
1111{
1112 icalerror_clear_errno();
1113icalerror_check_arg( (param!=0), "param");
1114
1115return (icalparameter_xliccomparetype)((struct icalparameter_impl*)param)->data;
1116}
1117
1118void icalparameter_set_xliccomparetype(icalparameter* param, icalparameter_xliccomparetype v)
1119{
1120 icalerror_check_arg_rv(v >= ICAL_XLICCOMPARETYPE_X,"v");
1121 icalerror_check_arg_rv(v < ICAL_XLICCOMPARETYPE_NONE,"v");
1122 icalerror_check_arg_rv( (param!=0), "param");
1123 icalerror_clear_errno();
1124
1125 ((struct icalparameter_impl*)param)->data = (int)v;
1126}
1127
1128/* FBTYPE */
1129icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v)
1130{
1131 struct icalparameter_impl *impl;
1132 icalerror_clear_errno();
1133 icalerror_check_arg_rz(v >= ICAL_FBTYPE_X,"v");
1134 icalerror_check_arg_rz(v < ICAL_FBTYPE_NONE,"v");
1135 impl = icalparameter_new_impl(ICAL_FBTYPE_PARAMETER);
1136 if (impl == 0) {
1137 return 0;
1138 }
1139
1140 icalparameter_set_fbtype((icalparameter*) impl,v);
1141 if (icalerrno != ICAL_NO_ERROR) {
1142 icalparameter_free((icalparameter*) impl);
1143 return 0;
1144 }
1145
1146 return (icalparameter*) impl;
1147}
1148
1149icalparameter_fbtype icalparameter_get_fbtype(icalparameter* param)
1150{
1151 icalerror_clear_errno();
1152icalerror_check_arg( (param!=0), "param");
1153 if ( ((struct icalparameter_impl*)param)->string != 0){
1154 return ICAL_FBTYPE_X;
1155 }
1156
1157return (icalparameter_fbtype)((struct icalparameter_impl*)param)->data;
1158}
1159
1160void icalparameter_set_fbtype(icalparameter* param, icalparameter_fbtype v)
1161{
1162 icalerror_check_arg_rv(v >= ICAL_FBTYPE_X,"v");
1163 icalerror_check_arg_rv(v < ICAL_FBTYPE_NONE,"v");
1164 icalerror_check_arg_rv( (param!=0), "param");
1165 icalerror_clear_errno();
1166
1167 ((struct icalparameter_impl*)param)->data = (int)v;
1168}
1169
1170/* TZID */
1171icalparameter* icalparameter_new_tzid(const char* v)
1172{
1173 struct icalparameter_impl *impl;
1174 icalerror_clear_errno();
1175 icalerror_check_arg_rz( (v!=0),"v");
1176 impl = icalparameter_new_impl(ICAL_TZID_PARAMETER);
1177 if (impl == 0) {
1178 return 0;
1179 }
1180
1181 icalparameter_set_tzid((icalparameter*) impl,v);
1182 if (icalerrno != ICAL_NO_ERROR) {
1183 icalparameter_free((icalparameter*) impl);
1184 return 0;
1185 }
1186
1187 return (icalparameter*) impl;
1188}
1189
1190const char* icalparameter_get_tzid(icalparameter* param)
1191{
1192 icalerror_clear_errno();
1193 icalerror_check_arg_rz( (param!=0), "param");
1194 return (const char*)((struct icalparameter_impl*)param)->string;
1195}
1196
1197void icalparameter_set_tzid(icalparameter* param, const char* v)
1198{
1199 icalerror_check_arg_rv( (v!=0),"v");
1200 icalerror_check_arg_rv( (param!=0), "param");
1201 icalerror_clear_errno();
1202
1203 ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);
1204}
1205
diff --git a/libical/src/libical/icalderivedparameter.h b/libical/src/libical/icalderivedparameter.h
new file mode 100644
index 0000000..adf4724
--- a/dev/null
+++ b/libical/src/libical/icalderivedparameter.h
@@ -0,0 +1,307 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalparam.h
4 CREATOR: eric 20 March 1999
5
6
7 $Id$
8 $Locker$
9
10
11
12 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of either:
16
17 The LGPL as published by the Free Software Foundation, version
18 2.1, available at: http://www.fsf.org/copyleft/lesser.html
19
20 Or:
21
22 The Mozilla Public License Version 1.0. You may obtain a copy of
23 the License at http://www.mozilla.org/MPL/
24
25 The original code is icalparam.h
26
27 ======================================================================*/
28
29#ifndef ICALDERIVEDPARAMETER_H
30#define ICALDERIVEDPARAMETER_H
31
32
33typedef void icalparameter;
34
35const char* icalparameter_enum_to_string(int e);
36int icalparameter_string_to_enum(const char* str);
37
38/* Everything below this line is machine generated. Do not edit. */
39typedef enum icalparameter_kind {
40 ICAL_ANY_PARAMETER = 0,
41 ICAL_ALTREP_PARAMETER,
42 ICAL_CN_PARAMETER,
43 ICAL_CUTYPE_PARAMETER,
44 ICAL_DELEGATEDFROM_PARAMETER,
45 ICAL_DELEGATEDTO_PARAMETER,
46 ICAL_DIR_PARAMETER,
47 ICAL_ENCODING_PARAMETER,
48 ICAL_FBTYPE_PARAMETER,
49 ICAL_FMTTYPE_PARAMETER,
50 ICAL_LANGUAGE_PARAMETER,
51 ICAL_MEMBER_PARAMETER,
52 ICAL_PARTSTAT_PARAMETER,
53 ICAL_RANGE_PARAMETER,
54 ICAL_RELATED_PARAMETER,
55 ICAL_RELTYPE_PARAMETER,
56 ICAL_ROLE_PARAMETER,
57 ICAL_RSVP_PARAMETER,
58 ICAL_SENTBY_PARAMETER,
59 ICAL_TZID_PARAMETER,
60 ICAL_VALUE_PARAMETER,
61 ICAL_X_PARAMETER,
62 ICAL_XLICCOMPARETYPE_PARAMETER,
63 ICAL_XLICERRORTYPE_PARAMETER,
64 ICAL_NO_PARAMETER
65} icalparameter_kind;
66
67#define ICALPARAMETER_FIRST_ENUM 20000
68
69typedef enum icalparameter_cutype {
70 ICAL_CUTYPE_X = 20000,
71 ICAL_CUTYPE_INDIVIDUAL = 20001,
72 ICAL_CUTYPE_GROUP = 20002,
73 ICAL_CUTYPE_RESOURCE = 20003,
74 ICAL_CUTYPE_ROOM = 20004,
75 ICAL_CUTYPE_UNKNOWN = 20005,
76 ICAL_CUTYPE_NONE = 20006
77} icalparameter_cutype;
78
79typedef enum icalparameter_encoding {
80 ICAL_ENCODING_X = 20007,
81 ICAL_ENCODING_8BIT = 20008,
82 ICAL_ENCODING_BASE64 = 20009,
83 ICAL_ENCODING_NONE = 20010
84} icalparameter_encoding;
85
86typedef enum icalparameter_fbtype {
87 ICAL_FBTYPE_X = 20011,
88 ICAL_FBTYPE_FREE = 20012,
89 ICAL_FBTYPE_BUSY = 20013,
90 ICAL_FBTYPE_BUSYUNAVAILABLE = 20014,
91 ICAL_FBTYPE_BUSYTENTATIVE = 20015,
92 ICAL_FBTYPE_NONE = 20016
93} icalparameter_fbtype;
94
95typedef enum icalparameter_partstat {
96 ICAL_PARTSTAT_X = 20017,
97 ICAL_PARTSTAT_NEEDSACTION = 20018,
98 ICAL_PARTSTAT_ACCEPTED = 20019,
99 ICAL_PARTSTAT_DECLINED = 20020,
100 ICAL_PARTSTAT_TENTATIVE = 20021,
101 ICAL_PARTSTAT_DELEGATED = 20022,
102 ICAL_PARTSTAT_COMPLETED = 20023,
103 ICAL_PARTSTAT_INPROCESS = 20024,
104 ICAL_PARTSTAT_NONE = 20025
105} icalparameter_partstat;
106
107typedef enum icalparameter_range {
108 ICAL_RANGE_X = 20026,
109 ICAL_RANGE_THISANDPRIOR = 20027,
110 ICAL_RANGE_THISANDFUTURE = 20028,
111 ICAL_RANGE_NONE = 20029
112} icalparameter_range;
113
114typedef enum icalparameter_related {
115 ICAL_RELATED_X = 20030,
116 ICAL_RELATED_START = 20031,
117 ICAL_RELATED_END = 20032,
118 ICAL_RELATED_NONE = 20033
119} icalparameter_related;
120
121typedef enum icalparameter_reltype {
122 ICAL_RELTYPE_X = 20034,
123 ICAL_RELTYPE_PARENT = 20035,
124 ICAL_RELTYPE_CHILD = 20036,
125 ICAL_RELTYPE_SIBLING = 20037,
126 ICAL_RELTYPE_NONE = 20038
127} icalparameter_reltype;
128
129typedef enum icalparameter_role {
130 ICAL_ROLE_X = 20039,
131 ICAL_ROLE_CHAIR = 20040,
132 ICAL_ROLE_REQPARTICIPANT = 20041,
133 ICAL_ROLE_OPTPARTICIPANT = 20042,
134 ICAL_ROLE_NONPARTICIPANT = 20043,
135 ICAL_ROLE_NONE = 20044
136} icalparameter_role;
137
138typedef enum icalparameter_rsvp {
139 ICAL_RSVP_X = 20045,
140 ICAL_RSVP_TRUE = 20046,
141 ICAL_RSVP_FALSE = 20047,
142 ICAL_RSVP_NONE = 20048
143} icalparameter_rsvp;
144
145typedef enum icalparameter_value {
146 ICAL_VALUE_X = 20049,
147 ICAL_VALUE_BINARY = 20050,
148 ICAL_VALUE_BOOLEAN = 20051,
149 ICAL_VALUE_DATE = 20052,
150 ICAL_VALUE_DURATION = 20053,
151 ICAL_VALUE_FLOAT = 20054,
152 ICAL_VALUE_INTEGER = 20055,
153 ICAL_VALUE_PERIOD = 20056,
154 ICAL_VALUE_RECUR = 20057,
155 ICAL_VALUE_TEXT = 20058,
156 ICAL_VALUE_URI = 20059,
157 ICAL_VALUE_ERROR = 20060,
158 ICAL_VALUE_DATETIME = 20061,
159 ICAL_VALUE_UTCOFFSET = 20062,
160 ICAL_VALUE_CALADDRESS = 20063,
161 ICAL_VALUE_NONE = 20064
162} icalparameter_value;
163
164typedef enum icalparameter_xliccomparetype {
165 ICAL_XLICCOMPARETYPE_X = 20065,
166 ICAL_XLICCOMPARETYPE_EQUAL = 20066,
167 ICAL_XLICCOMPARETYPE_NOTEQUAL = 20067,
168 ICAL_XLICCOMPARETYPE_LESS = 20068,
169 ICAL_XLICCOMPARETYPE_GREATER = 20069,
170 ICAL_XLICCOMPARETYPE_LESSEQUAL = 20070,
171 ICAL_XLICCOMPARETYPE_GREATEREQUAL = 20071,
172 ICAL_XLICCOMPARETYPE_REGEX = 20072,
173 ICAL_XLICCOMPARETYPE_NONE = 20073
174} icalparameter_xliccomparetype;
175
176typedef enum icalparameter_xlicerrortype {
177 ICAL_XLICERRORTYPE_X = 20074,
178 ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20075,
179 ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20076,
180 ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20077,
181 ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20078,
182 ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20079,
183 ICAL_XLICERRORTYPE_INVALIDITIP = 20080,
184 ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20081,
185 ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20082,
186 ICAL_XLICERRORTYPE_NONE = 20083
187} icalparameter_xlicerrortype;
188
189#define ICALPARAMETER_LAST_ENUM 20084
190
191/* DELEGATED-FROM */
192icalparameter* icalparameter_new_delegatedfrom(const char* v);
193const char* icalparameter_get_delegatedfrom(icalparameter* value);
194void icalparameter_set_delegatedfrom(icalparameter* value, const char* v);
195
196/* DELEGATED-TO */
197icalparameter* icalparameter_new_delegatedto(const char* v);
198const char* icalparameter_get_delegatedto(icalparameter* value);
199void icalparameter_set_delegatedto(icalparameter* value, const char* v);
200
201/* RANGE */
202icalparameter* icalparameter_new_range(icalparameter_range v);
203icalparameter_range icalparameter_get_range(icalparameter* value);
204void icalparameter_set_range(icalparameter* value, icalparameter_range v);
205
206/* ENCODING */
207icalparameter* icalparameter_new_encoding(icalparameter_encoding v);
208icalparameter_encoding icalparameter_get_encoding(icalparameter* value);
209void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v);
210
211/* RSVP */
212icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v);
213icalparameter_rsvp icalparameter_get_rsvp(icalparameter* value);
214void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v);
215
216/* PARTSTAT */
217icalparameter* icalparameter_new_partstat(icalparameter_partstat v);
218icalparameter_partstat icalparameter_get_partstat(icalparameter* value);
219void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
220
221/* RELTYPE */
222icalparameter* icalparameter_new_reltype(icalparameter_reltype v);
223icalparameter_reltype icalparameter_get_reltype(icalparameter* value);
224void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v);
225
226/* CUTYPE */
227icalparameter* icalparameter_new_cutype(icalparameter_cutype v);
228icalparameter_cutype icalparameter_get_cutype(icalparameter* value);
229void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v);
230
231/* MEMBER */
232icalparameter* icalparameter_new_member(const char* v);
233const char* icalparameter_get_member(icalparameter* value);
234void icalparameter_set_member(icalparameter* value, const char* v);
235
236/* FMTTYPE */
237icalparameter* icalparameter_new_fmttype(const char* v);
238const char* icalparameter_get_fmttype(icalparameter* value);
239void icalparameter_set_fmttype(icalparameter* value, const char* v);
240
241/* SENT-BY */
242icalparameter* icalparameter_new_sentby(const char* v);
243const char* icalparameter_get_sentby(icalparameter* value);
244void icalparameter_set_sentby(icalparameter* value, const char* v);
245
246/* VALUE */
247icalparameter* icalparameter_new_value(icalparameter_value v);
248icalparameter_value icalparameter_get_value(icalparameter* value);
249void icalparameter_set_value(icalparameter* value, icalparameter_value v);
250
251/* ALTREP */
252icalparameter* icalparameter_new_altrep(const char* v);
253const char* icalparameter_get_altrep(icalparameter* value);
254void icalparameter_set_altrep(icalparameter* value, const char* v);
255
256/* DIR */
257icalparameter* icalparameter_new_dir(const char* v);
258const char* icalparameter_get_dir(icalparameter* value);
259void icalparameter_set_dir(icalparameter* value, const char* v);
260
261/* RELATED */
262icalparameter* icalparameter_new_related(icalparameter_related v);
263icalparameter_related icalparameter_get_related(icalparameter* value);
264void icalparameter_set_related(icalparameter* value, icalparameter_related v);
265
266/* CN */
267icalparameter* icalparameter_new_cn(const char* v);
268const char* icalparameter_get_cn(icalparameter* value);
269void icalparameter_set_cn(icalparameter* value, const char* v);
270
271/* X-LIC-ERRORTYPE */
272icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v);
273icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value);
274void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v);
275
276/* X */
277icalparameter* icalparameter_new_x(const char* v);
278const char* icalparameter_get_x(icalparameter* value);
279void icalparameter_set_x(icalparameter* value, const char* v);
280
281/* LANGUAGE */
282icalparameter* icalparameter_new_language(const char* v);
283const char* icalparameter_get_language(icalparameter* value);
284void icalparameter_set_language(icalparameter* value, const char* v);
285
286/* ROLE */
287icalparameter* icalparameter_new_role(icalparameter_role v);
288icalparameter_role icalparameter_get_role(icalparameter* value);
289void icalparameter_set_role(icalparameter* value, icalparameter_role v);
290
291/* X-LIC-COMPARETYPE */
292icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v);
293icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value);
294void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v);
295
296/* FBTYPE */
297icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v);
298icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value);
299void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v);
300
301/* TZID */
302icalparameter* icalparameter_new_tzid(const char* v);
303const char* icalparameter_get_tzid(icalparameter* value);
304void icalparameter_set_tzid(icalparameter* value, const char* v);
305
306#endif /*ICALPARAMETER_H*/
307
diff --git a/libical/src/libical/icalderivedproperty.c b/libical/src/libical/icalderivedproperty.c
new file mode 100644
index 0000000..b41562b
--- a/dev/null
+++ b/libical/src/libical/icalderivedproperty.c
@@ -0,0 +1,2014 @@
1/* -*- Mode: C -*- */
2
3/*======================================================================
4 FILE: icalderivedproperty.c
5 CREATOR: eric 15 Feb 2001
6
7 $Id$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icalproperty.c
24
25======================================================================*/
26
27#ifdef HAVE_CONFIG_H
28#include <config.h>
29#endif
30
31#include "icalproperty.h"
32#include "icalcomponent.h"
33#include "pvl.h"
34#include "icalenums.h"
35#include "icalerror.h"
36#include "icalmemory.h"
37#include "icalparser.h"
38
39#include <string.h> /* For icalmemory_strdup, rindex */
40#include <assert.h>
41#include <stdlib.h>
42#include <errno.h>
43#include <stdio.h> /* for printf */
44#include <stdarg.h> /* for va_list, va_start, etc. */
45
46#define TMP_BUF_SIZE 1024
47
48struct icalproperty_impl*
49icalproperty_new_impl (icalproperty_kind kind);
50
51/* This map associates the property kinds with the string
52 representation of the property name and the kind of VALUE that the
53 property uses as a default */
54
55struct icalproperty_map {
56 icalproperty_kind kind;
57 const char *name;
58 icalvalue_kind value;
59
60};
61
62extern struct icalproperty_map property_map[];
63extern void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
64const char* icalproperty_kind_to_string(icalproperty_kind kind)
65{
66 int i;
67
68 for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
69 if (property_map[i].kind == kind) {
70 return property_map[i].name;
71 }
72 }
73
74 return 0;
75
76}
77
78
79icalproperty_kind icalproperty_string_to_kind(const char* string)
80{
81 int i;
82
83 if (string ==0 ) {
84 return ICAL_NO_PROPERTY;
85 }
86
87
88 for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
89 if (strcmp(property_map[i].name, string) == 0) {
90 return property_map[i].kind;
91 }
92 }
93
94 if(strncmp(string,"X-",2)==0){
95 return ICAL_X_PROPERTY;
96 }
97
98
99 return ICAL_NO_PROPERTY;
100}
101
102
103icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind)
104{
105 int i;
106
107 for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
108 if ( property_map[i].value == kind ) {
109 return property_map[i].kind;
110 }
111 }
112
113 return ICAL_NO_VALUE;
114}
115
116
117
118icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind)
119{
120 int i;
121
122 for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
123 if ( property_map[i].kind == kind ) {
124 return property_map[i].value;
125 }
126 }
127
128 return ICAL_NO_VALUE;
129}
130
131
132/* This map associates the property enumerations with the king of
133 property that they are used in and the string representation of the
134 enumeration */
135
136struct icalproperty_enum_map {
137 icalproperty_kind prop;
138 int prop_enum;
139 const char* str;
140};
141
142extern struct icalproperty_enum_map enum_map[];
143
144
145const char* icalproperty_enum_to_string(int e)
146{
147 icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e");
148 icalerror_check_arg_rz(e <= ICALPROPERTY_LAST_ENUM,"e");
149
150 return enum_map[e-ICALPROPERTY_FIRST_ENUM].str;
151}
152
153int icalproperty_string_to_enum(const char* str)
154{
155 int i;
156
157 icalerror_check_arg_rz(str!=0,"str")
158
159 while(*str == ' '){
160 str++;
161 }
162
163 for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
164 if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
165 return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
166 }
167 }
168
169 return 0;
170}
171
172int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e)
173{
174 int i;
175
176
177 for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
178 if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum == e &&
179 enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == kind ){
180 return 1;
181 }
182 }
183
184 return 0;
185}
186
187
188const char* icalproperty_method_to_string(icalproperty_method method)
189{
190 icalerror_check_arg_rz(method >= ICAL_METHOD_X,"method");
191 icalerror_check_arg_rz(method <= ICAL_METHOD_NONE,"method");
192
193 return enum_map[method-ICALPROPERTY_FIRST_ENUM].str;
194}
195
196icalproperty_method icalproperty_string_to_method(const char* str)
197{
198 int i;
199
200 icalerror_check_arg_rx(str!=0,"str",ICAL_METHOD_NONE)
201
202 while(*str == ' '){
203 str++;
204 }
205
206 for (i=ICAL_METHOD_X-ICALPROPERTY_FIRST_ENUM;
207 i != ICAL_METHOD_NONE-ICALPROPERTY_FIRST_ENUM;
208 i++) {
209 if ( strcmp(enum_map[i].str, str) == 0) {
210 return (icalproperty_method)enum_map[i].prop_enum;
211 }
212 }
213
214 return ICAL_METHOD_NONE;
215}
216
217
218const char* icalenum_status_to_string(icalproperty_status status)
219{
220 icalerror_check_arg_rz(status >= ICAL_STATUS_X,"status");
221 icalerror_check_arg_rz(status <= ICAL_STATUS_NONE,"status");
222
223 return enum_map[status-ICALPROPERTY_FIRST_ENUM].str;
224}
225
226icalproperty_status icalenum_string_to_status(const char* str)
227{
228 int i;
229
230 icalerror_check_arg_rx(str!=0,"str",ICAL_STATUS_NONE)
231
232 while(*str == ' '){
233 str++;
234 }
235
236 for (i=ICAL_STATUS_X-ICALPROPERTY_FIRST_ENUM;
237 i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM;
238 i++) {
239 if ( strcmp(enum_map[i].str, str) == 0) {
240 return (icalproperty_method)enum_map[i].prop_enum;
241 }
242 }
243
244 return ICAL_STATUS_NONE;
245
246}
247
248
249
250/* Everything below this line is machine generated. Do not edit. */
251static struct icalproperty_map property_map[] = {
252{ICAL_ACTION_PROPERTY,"ACTION",ICAL_ACTION_VALUE},
253{ICAL_ANY_PROPERTY,"ANY",ICAL_NO_VALUE},
254{ICAL_ATTACH_PROPERTY,"ATTACH",ICAL_ATTACH_VALUE},
255{ICAL_ATTENDEE_PROPERTY,"ATTENDEE",ICAL_CALADDRESS_VALUE},
256{ICAL_CALSCALE_PROPERTY,"CALSCALE",ICAL_TEXT_VALUE},
257{ICAL_CATEGORIES_PROPERTY,"CATEGORIES",ICAL_TEXT_VALUE},
258{ICAL_CLASS_PROPERTY,"CLASS",ICAL_TEXT_VALUE},
259{ICAL_COMMENT_PROPERTY,"COMMENT",ICAL_TEXT_VALUE},
260{ICAL_COMPLETED_PROPERTY,"COMPLETED",ICAL_DATETIME_VALUE},
261{ICAL_CONTACT_PROPERTY,"CONTACT",ICAL_TEXT_VALUE},
262{ICAL_CREATED_PROPERTY,"CREATED",ICAL_DATETIME_VALUE},
263{ICAL_DESCRIPTION_PROPERTY,"DESCRIPTION",ICAL_TEXT_VALUE},
264{ICAL_DTEND_PROPERTY,"DTEND",ICAL_DATETIME_VALUE},
265{ICAL_DTSTAMP_PROPERTY,"DTSTAMP",ICAL_DATETIME_VALUE},
266{ICAL_DTSTART_PROPERTY,"DTSTART",ICAL_DATETIME_VALUE},
267{ICAL_DUE_PROPERTY,"DUE",ICAL_DATETIME_VALUE},
268{ICAL_DURATION_PROPERTY,"DURATION",ICAL_DURATION_VALUE},
269{ICAL_EXDATE_PROPERTY,"EXDATE",ICAL_DATETIME_VALUE},
270{ICAL_EXRULE_PROPERTY,"EXRULE",ICAL_RECUR_VALUE},
271{ICAL_FREEBUSY_PROPERTY,"FREEBUSY",ICAL_PERIOD_VALUE},
272{ICAL_GEO_PROPERTY,"GEO",ICAL_GEO_VALUE},
273{ICAL_LASTMODIFIED_PROPERTY,"LAST-MODIFIED",ICAL_DATETIME_VALUE},
274{ICAL_LOCATION_PROPERTY,"LOCATION",ICAL_TEXT_VALUE},
275{ICAL_MAXRESULTS_PROPERTY,"MAXRESULTS",ICAL_INTEGER_VALUE},
276{ICAL_MAXRESULTSSIZE_PROPERTY,"MAXRESULTSSIZE",ICAL_INTEGER_VALUE},
277{ICAL_METHOD_PROPERTY,"METHOD",ICAL_METHOD_VALUE},
278{ICAL_ORGANIZER_PROPERTY,"ORGANIZER",ICAL_CALADDRESS_VALUE},
279{ICAL_PERCENTCOMPLETE_PROPERTY,"PERCENT-COMPLETE",ICAL_INTEGER_VALUE},
280{ICAL_PRIORITY_PROPERTY,"PRIORITY",ICAL_INTEGER_VALUE},
281{ICAL_PRODID_PROPERTY,"PRODID",ICAL_TEXT_VALUE},
282{ICAL_QUERY_PROPERTY,"QUERY",ICAL_QUERY_VALUE},
283{ICAL_QUERYNAME_PROPERTY,"QUERYNAME",ICAL_TEXT_VALUE},
284{ICAL_RDATE_PROPERTY,"RDATE",ICAL_DATETIMEPERIOD_VALUE},
285{ICAL_RECURRENCEID_PROPERTY,"RECURRENCE-ID",ICAL_DATETIME_VALUE},
286{ICAL_RELATEDTO_PROPERTY,"RELATED-TO",ICAL_TEXT_VALUE},
287{ICAL_REPEAT_PROPERTY,"REPEAT",ICAL_INTEGER_VALUE},
288{ICAL_REQUESTSTATUS_PROPERTY,"REQUEST-STATUS",ICAL_REQUESTSTATUS_VALUE},
289{ICAL_RESOURCES_PROPERTY,"RESOURCES",ICAL_TEXT_VALUE},
290{ICAL_RRULE_PROPERTY,"RRULE",ICAL_RECUR_VALUE},
291{ICAL_SCOPE_PROPERTY,"SCOPE",ICAL_TEXT_VALUE},
292{ICAL_SEQUENCE_PROPERTY,"SEQUENCE",ICAL_INTEGER_VALUE},
293{ICAL_STATUS_PROPERTY,"STATUS",ICAL_STATUS_VALUE},
294{ICAL_SUMMARY_PROPERTY,"SUMMARY",ICAL_TEXT_VALUE},
295{ICAL_TARGET_PROPERTY,"TARGET",ICAL_CALADDRESS_VALUE},
296{ICAL_TRANSP_PROPERTY,"TRANSP",ICAL_TEXT_VALUE},
297{ICAL_TRIGGER_PROPERTY,"TRIGGER",ICAL_TRIGGER_VALUE},
298{ICAL_TZID_PROPERTY,"TZID",ICAL_TEXT_VALUE},
299{ICAL_TZNAME_PROPERTY,"TZNAME",ICAL_TEXT_VALUE},
300{ICAL_TZOFFSETFROM_PROPERTY,"TZOFFSETFROM",ICAL_UTCOFFSET_VALUE},
301{ICAL_TZOFFSETTO_PROPERTY,"TZOFFSETTO",ICAL_UTCOFFSET_VALUE},
302{ICAL_TZURL_PROPERTY,"TZURL",ICAL_URI_VALUE},
303{ICAL_UID_PROPERTY,"UID",ICAL_TEXT_VALUE},
304{ICAL_URL_PROPERTY,"URL",ICAL_URI_VALUE},
305{ICAL_VERSION_PROPERTY,"VERSION",ICAL_TEXT_VALUE},
306{ICAL_X_PROPERTY,"X",ICAL_TEXT_VALUE},
307{ICAL_XLICCLUSTERCOUNT_PROPERTY,"X-LIC-CLUSTERCOUNT",ICAL_STRING_VALUE},
308{ICAL_XLICERROR_PROPERTY,"X-LIC-ERROR",ICAL_TEXT_VALUE},
309{ICAL_XLICMIMECHARSET_PROPERTY,"X-LIC-MIMECHARSET",ICAL_STRING_VALUE},
310{ICAL_XLICMIMECID_PROPERTY,"X-LIC-MIMECID",ICAL_STRING_VALUE},
311{ICAL_XLICMIMECONTENTTYPE_PROPERTY,"X-LIC-MIMECONTENTTYPE",ICAL_STRING_VALUE},
312{ICAL_XLICMIMEENCODING_PROPERTY,"X-LIC-MIMEENCODING",ICAL_STRING_VALUE},
313{ICAL_XLICMIMEFILENAME_PROPERTY,"X-LIC-MIMEFILENAME",ICAL_STRING_VALUE},
314{ICAL_XLICMIMEOPTINFO_PROPERTY,"X-LIC-MIMEOPTINFO",ICAL_STRING_VALUE},
315{ICAL_NO_PROPERTY,"",ICAL_NO_VALUE}};
316
317static struct icalproperty_enum_map enum_map[] = {
318 {ICAL_ACTION_PROPERTY,ICAL_ACTION_X,"" }, /*10000*/
319 {ICAL_ACTION_PROPERTY,ICAL_ACTION_AUDIO,"AUDIO" }, /*10001*/
320 {ICAL_ACTION_PROPERTY,ICAL_ACTION_DISPLAY,"DISPLAY" }, /*10002*/
321 {ICAL_ACTION_PROPERTY,ICAL_ACTION_EMAIL,"EMAIL" }, /*10003*/
322 {ICAL_ACTION_PROPERTY,ICAL_ACTION_PROCEDURE,"PROCEDURE" }, /*10004*/
323 {ICAL_ACTION_PROPERTY,ICAL_ACTION_NONE,"" }, /*10005*/
324 {ICAL_CLASS_PROPERTY,ICAL_CLASS_X,"" }, /*10006*/
325 {ICAL_CLASS_PROPERTY,ICAL_CLASS_PUBLIC,"PUBLIC" }, /*10007*/
326 {ICAL_CLASS_PROPERTY,ICAL_CLASS_PRIVATE,"PRIVATE" }, /*10008*/
327 {ICAL_CLASS_PROPERTY,ICAL_CLASS_CONFIDENTIAL,"CONFIDENTIAL" }, /*10009*/
328 {ICAL_CLASS_PROPERTY,ICAL_CLASS_NONE,"" }, /*10010*/
329 {ICAL_METHOD_PROPERTY,ICAL_METHOD_X,"" }, /*10011*/
330 {ICAL_METHOD_PROPERTY,ICAL_METHOD_PUBLISH,"PUBLISH" }, /*10012*/
331 {ICAL_METHOD_PROPERTY,ICAL_METHOD_REQUEST,"REQUEST" }, /*10013*/
332 {ICAL_METHOD_PROPERTY,ICAL_METHOD_REPLY,"REPLY" }, /*10014*/
333 {ICAL_METHOD_PROPERTY,ICAL_METHOD_ADD,"ADD" }, /*10015*/
334 {ICAL_METHOD_PROPERTY,ICAL_METHOD_CANCEL,"CANCEL" }, /*10016*/
335 {ICAL_METHOD_PROPERTY,ICAL_METHOD_REFRESH,"REFRESH" }, /*10017*/
336 {ICAL_METHOD_PROPERTY,ICAL_METHOD_COUNTER,"COUNTER" }, /*10018*/
337 {ICAL_METHOD_PROPERTY,ICAL_METHOD_DECLINECOUNTER,"DECLINECOUNTER" }, /*10019*/
338 {ICAL_METHOD_PROPERTY,ICAL_METHOD_CREATE,"CREATE" }, /*10020*/
339 {ICAL_METHOD_PROPERTY,ICAL_METHOD_READ,"READ" }, /*10021*/
340 {ICAL_METHOD_PROPERTY,ICAL_METHOD_RESPONSE,"RESPONSE" }, /*10022*/
341 {ICAL_METHOD_PROPERTY,ICAL_METHOD_MOVE,"MOVE" }, /*10023*/
342 {ICAL_METHOD_PROPERTY,ICAL_METHOD_MODIFY,"MODIFY" }, /*10024*/
343 {ICAL_METHOD_PROPERTY,ICAL_METHOD_GENERATEUID,"GENERATEUID" }, /*10025*/
344 {ICAL_METHOD_PROPERTY,ICAL_METHOD_DELETE,"DELETE" }, /*10026*/
345 {ICAL_METHOD_PROPERTY,ICAL_METHOD_NONE,"" }, /*10027*/
346 {ICAL_STATUS_PROPERTY,ICAL_STATUS_X,"" }, /*10028*/
347 {ICAL_STATUS_PROPERTY,ICAL_STATUS_TENTATIVE,"TENTATIVE" }, /*10029*/
348 {ICAL_STATUS_PROPERTY,ICAL_STATUS_CONFIRMED,"CONFIRMED" }, /*10030*/
349 {ICAL_STATUS_PROPERTY,ICAL_STATUS_COMPLETED,"COMPLETED" }, /*10031*/
350 {ICAL_STATUS_PROPERTY,ICAL_STATUS_NEEDSACTION,"NEEDS-ACTION" }, /*10032*/
351 {ICAL_STATUS_PROPERTY,ICAL_STATUS_CANCELLED,"CANCELLED" }, /*10033*/
352 {ICAL_STATUS_PROPERTY,ICAL_STATUS_INPROCESS,"IN-PROCESS" }, /*10034*/
353 {ICAL_STATUS_PROPERTY,ICAL_STATUS_DRAFT,"DRAFT" }, /*10035*/
354 {ICAL_STATUS_PROPERTY,ICAL_STATUS_FINAL,"FINAL" }, /*10036*/
355 {ICAL_STATUS_PROPERTY,ICAL_STATUS_NONE,"" }, /*10037*/
356 {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_X,"" }, /*10038*/
357 {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_OPAQUE,"OPAQUE" }, /*10039*/
358 {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_TRANSPARENT,"TRANSPARENT" }, /*10040*/
359 {ICAL_TRANSP_PROPERTY,ICAL_TRANSP_NONE,"" }, /*10041*/
360 {ICAL_NO_PROPERTY,0,""}
361};
362
363icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...){
364 va_list args;
365 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ACTION_PROPERTY);
366 icalproperty_set_action((icalproperty*)impl,v);
367 va_start(args,v);
368 icalproperty_add_parameters(impl, args);
369 va_end(args);
370 return (icalproperty*)impl;
371}
372/* ACTION */
373icalproperty* icalproperty_new_action(enum icalproperty_action v) {
374 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ACTION_PROPERTY);
375 icalproperty_set_action((icalproperty*)impl,v);
376 return (icalproperty*)impl;
377}
378
379void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v){
380
381 icalerror_check_arg_rv( (prop!=0),"prop");
382 icalproperty_set_value(prop,icalvalue_new_action(v));
383}
384enum icalproperty_action icalproperty_get_action(icalproperty* prop){
385 icalerror_check_arg( (prop!=0),"prop");
386 return icalvalue_get_action(icalproperty_get_value(prop));
387}
388icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...){
389 va_list args;
390 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
391
392 icalproperty_set_attach((icalproperty*)impl,v);
393 va_start(args,v);
394 icalproperty_add_parameters(impl, args);
395 va_end(args);
396 return (icalproperty*)impl;
397}
398/* ATTACH */
399icalproperty* icalproperty_new_attach(struct icalattachtype* v) {
400 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTACH_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
401
402 icalproperty_set_attach((icalproperty*)impl,v);
403 return (icalproperty*)impl;
404}
405
406void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v){
407 icalerror_check_arg_rv( (v!=0),"v");
408
409 icalerror_check_arg_rv( (prop!=0),"prop");
410 icalproperty_set_value(prop,icalvalue_new_attach(v));
411}
412struct icalattachtype* icalproperty_get_attach(icalproperty* prop){
413 icalerror_check_arg( (prop!=0),"prop");
414 return icalvalue_get_attach(icalproperty_get_value(prop));
415}
416icalproperty* icalproperty_vanew_attendee(const char* v, ...){
417 va_list args;
418 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
419
420 icalproperty_set_attendee((icalproperty*)impl,v);
421 va_start(args,v);
422 icalproperty_add_parameters(impl, args);
423 va_end(args);
424 return (icalproperty*)impl;
425}
426/* ATTENDEE */
427icalproperty* icalproperty_new_attendee(const char* v) {
428 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ATTENDEE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
429
430 icalproperty_set_attendee((icalproperty*)impl,v);
431 return (icalproperty*)impl;
432}
433
434void icalproperty_set_attendee(icalproperty* prop, const char* v){
435 icalerror_check_arg_rv( (v!=0),"v");
436
437 icalerror_check_arg_rv( (prop!=0),"prop");
438 icalproperty_set_value(prop,icalvalue_new_caladdress(v));
439}
440const char* icalproperty_get_attendee(icalproperty* prop){
441 icalerror_check_arg( (prop!=0),"prop");
442 return icalvalue_get_caladdress(icalproperty_get_value(prop));
443}
444icalproperty* icalproperty_vanew_calscale(const char* v, ...){
445 va_list args;
446 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
447
448 icalproperty_set_calscale((icalproperty*)impl,v);
449 va_start(args,v);
450 icalproperty_add_parameters(impl, args);
451 va_end(args);
452 return (icalproperty*)impl;
453}
454/* CALSCALE */
455icalproperty* icalproperty_new_calscale(const char* v) {
456 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CALSCALE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
457
458 icalproperty_set_calscale((icalproperty*)impl,v);
459 return (icalproperty*)impl;
460}
461
462void icalproperty_set_calscale(icalproperty* prop, const char* v){
463 icalerror_check_arg_rv( (v!=0),"v");
464
465 icalerror_check_arg_rv( (prop!=0),"prop");
466 icalproperty_set_value(prop,icalvalue_new_text(v));
467}
468const char* icalproperty_get_calscale(icalproperty* prop){
469 icalerror_check_arg( (prop!=0),"prop");
470 return icalvalue_get_text(icalproperty_get_value(prop));
471}
472icalproperty* icalproperty_vanew_categories(const char* v, ...){
473 va_list args;
474 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
475
476 icalproperty_set_categories((icalproperty*)impl,v);
477 va_start(args,v);
478 icalproperty_add_parameters(impl, args);
479 va_end(args);
480 return (icalproperty*)impl;
481}
482/* CATEGORIES */
483icalproperty* icalproperty_new_categories(const char* v) {
484 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CATEGORIES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
485
486 icalproperty_set_categories((icalproperty*)impl,v);
487 return (icalproperty*)impl;
488}
489
490void icalproperty_set_categories(icalproperty* prop, const char* v){
491 icalerror_check_arg_rv( (v!=0),"v");
492
493 icalerror_check_arg_rv( (prop!=0),"prop");
494 icalproperty_set_value(prop,icalvalue_new_text(v));
495}
496const char* icalproperty_get_categories(icalproperty* prop){
497 icalerror_check_arg( (prop!=0),"prop");
498 return icalvalue_get_text(icalproperty_get_value(prop));
499}
500icalproperty* icalproperty_vanew_class(const char* v, ...){
501 va_list args;
502 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
503
504 icalproperty_set_class((icalproperty*)impl,v);
505 va_start(args,v);
506 icalproperty_add_parameters(impl, args);
507 va_end(args);
508 return (icalproperty*)impl;
509}
510/* CLASS */
511icalproperty* icalproperty_new_class(const char* v) {
512 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CLASS_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
513
514 icalproperty_set_class((icalproperty*)impl,v);
515 return (icalproperty*)impl;
516}
517
518void icalproperty_set_class(icalproperty* prop, const char* v){
519 icalerror_check_arg_rv( (v!=0),"v");
520
521 icalerror_check_arg_rv( (prop!=0),"prop");
522 icalproperty_set_value(prop,icalvalue_new_text(v));
523}
524const char* icalproperty_get_class(icalproperty* prop){
525 icalerror_check_arg( (prop!=0),"prop");
526 return icalvalue_get_text(icalproperty_get_value(prop));
527}
528icalproperty* icalproperty_vanew_comment(const char* v, ...){
529 va_list args;
530 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
531
532 icalproperty_set_comment((icalproperty*)impl,v);
533 va_start(args,v);
534 icalproperty_add_parameters(impl, args);
535 va_end(args);
536 return (icalproperty*)impl;
537}
538/* COMMENT */
539icalproperty* icalproperty_new_comment(const char* v) {
540 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMMENT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
541
542 icalproperty_set_comment((icalproperty*)impl,v);
543 return (icalproperty*)impl;
544}
545
546void icalproperty_set_comment(icalproperty* prop, const char* v){
547 icalerror_check_arg_rv( (v!=0),"v");
548
549 icalerror_check_arg_rv( (prop!=0),"prop");
550 icalproperty_set_value(prop,icalvalue_new_text(v));
551}
552const char* icalproperty_get_comment(icalproperty* prop){
553 icalerror_check_arg( (prop!=0),"prop");
554 return icalvalue_get_text(icalproperty_get_value(prop));
555}
556icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...){
557 va_list args;
558 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMPLETED_PROPERTY);
559 icalproperty_set_completed((icalproperty*)impl,v);
560 va_start(args,v);
561 icalproperty_add_parameters(impl, args);
562 va_end(args);
563 return (icalproperty*)impl;
564}
565/* COMPLETED */
566icalproperty* icalproperty_new_completed(struct icaltimetype v) {
567 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_COMPLETED_PROPERTY);
568 icalproperty_set_completed((icalproperty*)impl,v);
569 return (icalproperty*)impl;
570}
571
572void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v){
573
574 icalerror_check_arg_rv( (prop!=0),"prop");
575 icalproperty_set_value(prop,icalvalue_new_datetime(v));
576}
577struct icaltimetype icalproperty_get_completed(icalproperty* prop){
578 icalerror_check_arg( (prop!=0),"prop");
579 return icalvalue_get_datetime(icalproperty_get_value(prop));
580}
581icalproperty* icalproperty_vanew_contact(const char* v, ...){
582 va_list args;
583 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
584
585 icalproperty_set_contact((icalproperty*)impl,v);
586 va_start(args,v);
587 icalproperty_add_parameters(impl, args);
588 va_end(args);
589 return (icalproperty*)impl;
590}
591/* CONTACT */
592icalproperty* icalproperty_new_contact(const char* v) {
593 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CONTACT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
594
595 icalproperty_set_contact((icalproperty*)impl,v);
596 return (icalproperty*)impl;
597}
598
599void icalproperty_set_contact(icalproperty* prop, const char* v){
600 icalerror_check_arg_rv( (v!=0),"v");
601
602 icalerror_check_arg_rv( (prop!=0),"prop");
603 icalproperty_set_value(prop,icalvalue_new_text(v));
604}
605const char* icalproperty_get_contact(icalproperty* prop){
606 icalerror_check_arg( (prop!=0),"prop");
607 return icalvalue_get_text(icalproperty_get_value(prop));
608}
609icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...){
610 va_list args;
611 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CREATED_PROPERTY);
612 icalproperty_set_created((icalproperty*)impl,v);
613 va_start(args,v);
614 icalproperty_add_parameters(impl, args);
615 va_end(args);
616 return (icalproperty*)impl;
617}
618/* CREATED */
619icalproperty* icalproperty_new_created(struct icaltimetype v) {
620 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_CREATED_PROPERTY);
621 icalproperty_set_created((icalproperty*)impl,v);
622 return (icalproperty*)impl;
623}
624
625void icalproperty_set_created(icalproperty* prop, struct icaltimetype v){
626
627 icalerror_check_arg_rv( (prop!=0),"prop");
628 icalproperty_set_value(prop,icalvalue_new_datetime(v));
629}
630struct icaltimetype icalproperty_get_created(icalproperty* prop){
631 icalerror_check_arg( (prop!=0),"prop");
632 return icalvalue_get_datetime(icalproperty_get_value(prop));
633}
634icalproperty* icalproperty_vanew_description(const char* v, ...){
635 va_list args;
636 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
637
638 icalproperty_set_description((icalproperty*)impl,v);
639 va_start(args,v);
640 icalproperty_add_parameters(impl, args);
641 va_end(args);
642 return (icalproperty*)impl;
643}
644/* DESCRIPTION */
645icalproperty* icalproperty_new_description(const char* v) {
646 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DESCRIPTION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
647
648 icalproperty_set_description((icalproperty*)impl,v);
649 return (icalproperty*)impl;
650}
651
652void icalproperty_set_description(icalproperty* prop, const char* v){
653 icalerror_check_arg_rv( (v!=0),"v");
654
655 icalerror_check_arg_rv( (prop!=0),"prop");
656 icalproperty_set_value(prop,icalvalue_new_text(v));
657}
658const char* icalproperty_get_description(icalproperty* prop){
659 icalerror_check_arg( (prop!=0),"prop");
660 return icalvalue_get_text(icalproperty_get_value(prop));
661}
662icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...){
663 va_list args;
664 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTEND_PROPERTY);
665 icalproperty_set_dtend((icalproperty*)impl,v);
666 va_start(args,v);
667 icalproperty_add_parameters(impl, args);
668 va_end(args);
669 return (icalproperty*)impl;
670}
671/* DTEND */
672icalproperty* icalproperty_new_dtend(struct icaltimetype v) {
673 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTEND_PROPERTY);
674 icalproperty_set_dtend((icalproperty*)impl,v);
675 return (icalproperty*)impl;
676}
677
678void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v){
679
680 icalerror_check_arg_rv( (prop!=0),"prop");
681 icalproperty_set_value(prop,icalvalue_new_datetime(v));
682}
683struct icaltimetype icalproperty_get_dtend(icalproperty* prop){
684 icalerror_check_arg( (prop!=0),"prop");
685 return icalvalue_get_datetime(icalproperty_get_value(prop));
686}
687icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...){
688 va_list args;
689 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTAMP_PROPERTY);
690 icalproperty_set_dtstamp((icalproperty*)impl,v);
691 va_start(args,v);
692 icalproperty_add_parameters(impl, args);
693 va_end(args);
694 return (icalproperty*)impl;
695}
696/* DTSTAMP */
697icalproperty* icalproperty_new_dtstamp(struct icaltimetype v) {
698 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTAMP_PROPERTY);
699 icalproperty_set_dtstamp((icalproperty*)impl,v);
700 return (icalproperty*)impl;
701}
702
703void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v){
704
705 icalerror_check_arg_rv( (prop!=0),"prop");
706 icalproperty_set_value(prop,icalvalue_new_datetime(v));
707}
708struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop){
709 icalerror_check_arg( (prop!=0),"prop");
710 return icalvalue_get_datetime(icalproperty_get_value(prop));
711}
712icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...){
713 va_list args;
714 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTART_PROPERTY);
715 icalproperty_set_dtstart((icalproperty*)impl,v);
716 va_start(args,v);
717 icalproperty_add_parameters(impl, args);
718 va_end(args);
719 return (icalproperty*)impl;
720}
721/* DTSTART */
722icalproperty* icalproperty_new_dtstart(struct icaltimetype v) {
723 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DTSTART_PROPERTY);
724 icalproperty_set_dtstart((icalproperty*)impl,v);
725 return (icalproperty*)impl;
726}
727
728void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v){
729
730 icalerror_check_arg_rv( (prop!=0),"prop");
731 icalproperty_set_value(prop,icalvalue_new_datetime(v));
732}
733struct icaltimetype icalproperty_get_dtstart(icalproperty* prop){
734 icalerror_check_arg( (prop!=0),"prop");
735 return icalvalue_get_datetime(icalproperty_get_value(prop));
736}
737icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...){
738 va_list args;
739 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DUE_PROPERTY);
740 icalproperty_set_due((icalproperty*)impl,v);
741 va_start(args,v);
742 icalproperty_add_parameters(impl, args);
743 va_end(args);
744 return (icalproperty*)impl;
745}
746/* DUE */
747icalproperty* icalproperty_new_due(struct icaltimetype v) {
748 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DUE_PROPERTY);
749 icalproperty_set_due((icalproperty*)impl,v);
750 return (icalproperty*)impl;
751}
752
753void icalproperty_set_due(icalproperty* prop, struct icaltimetype v){
754
755 icalerror_check_arg_rv( (prop!=0),"prop");
756 icalproperty_set_value(prop,icalvalue_new_datetime(v));
757}
758struct icaltimetype icalproperty_get_due(icalproperty* prop){
759 icalerror_check_arg( (prop!=0),"prop");
760 return icalvalue_get_datetime(icalproperty_get_value(prop));
761}
762icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...){
763 va_list args;
764 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DURATION_PROPERTY);
765 icalproperty_set_duration((icalproperty*)impl,v);
766 va_start(args,v);
767 icalproperty_add_parameters(impl, args);
768 va_end(args);
769 return (icalproperty*)impl;
770}
771/* DURATION */
772icalproperty* icalproperty_new_duration(struct icaldurationtype v) {
773 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_DURATION_PROPERTY);
774 icalproperty_set_duration((icalproperty*)impl,v);
775 return (icalproperty*)impl;
776}
777
778void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v){
779
780 icalerror_check_arg_rv( (prop!=0),"prop");
781 icalproperty_set_value(prop,icalvalue_new_duration(v));
782}
783struct icaldurationtype icalproperty_get_duration(icalproperty* prop){
784 icalerror_check_arg( (prop!=0),"prop");
785 return icalvalue_get_duration(icalproperty_get_value(prop));
786}
787icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...){
788 va_list args;
789 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXDATE_PROPERTY);
790 icalproperty_set_exdate((icalproperty*)impl,v);
791 va_start(args,v);
792 icalproperty_add_parameters(impl, args);
793 va_end(args);
794 return (icalproperty*)impl;
795}
796/* EXDATE */
797icalproperty* icalproperty_new_exdate(struct icaltimetype v) {
798 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXDATE_PROPERTY);
799 icalproperty_set_exdate((icalproperty*)impl,v);
800 return (icalproperty*)impl;
801}
802
803void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v){
804
805 icalerror_check_arg_rv( (prop!=0),"prop");
806 icalproperty_set_value(prop,icalvalue_new_datetime(v));
807}
808struct icaltimetype icalproperty_get_exdate(icalproperty* prop){
809 icalerror_check_arg( (prop!=0),"prop");
810 return icalvalue_get_datetime(icalproperty_get_value(prop));
811}
812icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...){
813 va_list args;
814 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY);
815 icalproperty_set_exrule((icalproperty*)impl,v);
816 va_start(args,v);
817 icalproperty_add_parameters(impl, args);
818 va_end(args);
819 return (icalproperty*)impl;
820}
821/* EXRULE */
822icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v) {
823 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_EXRULE_PROPERTY);
824 icalproperty_set_exrule((icalproperty*)impl,v);
825 return (icalproperty*)impl;
826}
827
828void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v){
829
830 icalerror_check_arg_rv( (prop!=0),"prop");
831 icalproperty_set_value(prop,icalvalue_new_recur(v));
832}
833struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop){
834 icalerror_check_arg( (prop!=0),"prop");
835 return icalvalue_get_recur(icalproperty_get_value(prop));
836}
837icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...){
838 va_list args;
839 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_FREEBUSY_PROPERTY);
840 icalproperty_set_freebusy((icalproperty*)impl,v);
841 va_start(args,v);
842 icalproperty_add_parameters(impl, args);
843 va_end(args);
844 return (icalproperty*)impl;
845}
846/* FREEBUSY */
847icalproperty* icalproperty_new_freebusy(struct icalperiodtype v) {
848 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_FREEBUSY_PROPERTY);
849 icalproperty_set_freebusy((icalproperty*)impl,v);
850 return (icalproperty*)impl;
851}
852
853void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v){
854
855 icalerror_check_arg_rv( (prop!=0),"prop");
856 icalproperty_set_value(prop,icalvalue_new_period(v));
857}
858struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop){
859 icalerror_check_arg( (prop!=0),"prop");
860 return icalvalue_get_period(icalproperty_get_value(prop));
861}
862icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...){
863 va_list args;
864 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_GEO_PROPERTY);
865 icalproperty_set_geo((icalproperty*)impl,v);
866 va_start(args,v);
867 icalproperty_add_parameters(impl, args);
868 va_end(args);
869 return (icalproperty*)impl;
870}
871/* GEO */
872icalproperty* icalproperty_new_geo(struct icalgeotype v) {
873 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_GEO_PROPERTY);
874 icalproperty_set_geo((icalproperty*)impl,v);
875 return (icalproperty*)impl;
876}
877
878void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v){
879
880 icalerror_check_arg_rv( (prop!=0),"prop");
881 icalproperty_set_value(prop,icalvalue_new_geo(v));
882}
883struct icalgeotype icalproperty_get_geo(icalproperty* prop){
884 icalerror_check_arg( (prop!=0),"prop");
885 return icalvalue_get_geo(icalproperty_get_value(prop));
886}
887icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...){
888 va_list args;
889 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LASTMODIFIED_PROPERTY);
890 icalproperty_set_lastmodified((icalproperty*)impl,v);
891 va_start(args,v);
892 icalproperty_add_parameters(impl, args);
893 va_end(args);
894 return (icalproperty*)impl;
895}
896/* LAST-MODIFIED */
897icalproperty* icalproperty_new_lastmodified(struct icaltimetype v) {
898 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LASTMODIFIED_PROPERTY);
899 icalproperty_set_lastmodified((icalproperty*)impl,v);
900 return (icalproperty*)impl;
901}
902
903void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v){
904
905 icalerror_check_arg_rv( (prop!=0),"prop");
906 icalproperty_set_value(prop,icalvalue_new_datetime(v));
907}
908struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop){
909 icalerror_check_arg( (prop!=0),"prop");
910 return icalvalue_get_datetime(icalproperty_get_value(prop));
911}
912icalproperty* icalproperty_vanew_location(const char* v, ...){
913 va_list args;
914 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
915
916 icalproperty_set_location((icalproperty*)impl,v);
917 va_start(args,v);
918 icalproperty_add_parameters(impl, args);
919 va_end(args);
920 return (icalproperty*)impl;
921}
922/* LOCATION */
923icalproperty* icalproperty_new_location(const char* v) {
924 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_LOCATION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
925
926 icalproperty_set_location((icalproperty*)impl,v);
927 return (icalproperty*)impl;
928}
929
930void icalproperty_set_location(icalproperty* prop, const char* v){
931 icalerror_check_arg_rv( (v!=0),"v");
932
933 icalerror_check_arg_rv( (prop!=0),"prop");
934 icalproperty_set_value(prop,icalvalue_new_text(v));
935}
936const char* icalproperty_get_location(icalproperty* prop){
937 icalerror_check_arg( (prop!=0),"prop");
938 return icalvalue_get_text(icalproperty_get_value(prop));
939}
940icalproperty* icalproperty_vanew_maxresults(int v, ...){
941 va_list args;
942 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTS_PROPERTY);
943 icalproperty_set_maxresults((icalproperty*)impl,v);
944 va_start(args,v);
945 icalproperty_add_parameters(impl, args);
946 va_end(args);
947 return (icalproperty*)impl;
948}
949/* MAXRESULTS */
950icalproperty* icalproperty_new_maxresults(int v) {
951 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTS_PROPERTY);
952 icalproperty_set_maxresults((icalproperty*)impl,v);
953 return (icalproperty*)impl;
954}
955
956void icalproperty_set_maxresults(icalproperty* prop, int v){
957
958 icalerror_check_arg_rv( (prop!=0),"prop");
959 icalproperty_set_value(prop,icalvalue_new_integer(v));
960}
961int icalproperty_get_maxresults(icalproperty* prop){
962 icalerror_check_arg( (prop!=0),"prop");
963 return icalvalue_get_integer(icalproperty_get_value(prop));
964}
965icalproperty* icalproperty_vanew_maxresultssize(int v, ...){
966 va_list args;
967 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTSSIZE_PROPERTY);
968 icalproperty_set_maxresultssize((icalproperty*)impl,v);
969 va_start(args,v);
970 icalproperty_add_parameters(impl, args);
971 va_end(args);
972 return (icalproperty*)impl;
973}
974/* MAXRESULTSSIZE */
975icalproperty* icalproperty_new_maxresultssize(int v) {
976 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_MAXRESULTSSIZE_PROPERTY);
977 icalproperty_set_maxresultssize((icalproperty*)impl,v);
978 return (icalproperty*)impl;
979}
980
981void icalproperty_set_maxresultssize(icalproperty* prop, int v){
982
983 icalerror_check_arg_rv( (prop!=0),"prop");
984 icalproperty_set_value(prop,icalvalue_new_integer(v));
985}
986int icalproperty_get_maxresultssize(icalproperty* prop){
987 icalerror_check_arg( (prop!=0),"prop");
988 return icalvalue_get_integer(icalproperty_get_value(prop));
989}
990icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...){
991 va_list args;
992 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_METHOD_PROPERTY);
993 icalproperty_set_method((icalproperty*)impl,v);
994 va_start(args,v);
995 icalproperty_add_parameters(impl, args);
996 va_end(args);
997 return (icalproperty*)impl;
998}
999/* METHOD */
1000icalproperty* icalproperty_new_method(enum icalproperty_method v) {
1001 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_METHOD_PROPERTY);
1002 icalproperty_set_method((icalproperty*)impl,v);
1003 return (icalproperty*)impl;
1004}
1005
1006void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v){
1007
1008 icalerror_check_arg_rv( (prop!=0),"prop");
1009 icalproperty_set_value(prop,icalvalue_new_method(v));
1010}
1011enum icalproperty_method icalproperty_get_method(icalproperty* prop){
1012 icalerror_check_arg( (prop!=0),"prop");
1013 return icalvalue_get_method(icalproperty_get_value(prop));
1014}
1015icalproperty* icalproperty_vanew_organizer(const char* v, ...){
1016 va_list args;
1017 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1018
1019 icalproperty_set_organizer((icalproperty*)impl,v);
1020 va_start(args,v);
1021 icalproperty_add_parameters(impl, args);
1022 va_end(args);
1023 return (icalproperty*)impl;
1024}
1025/* ORGANIZER */
1026icalproperty* icalproperty_new_organizer(const char* v) {
1027 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_ORGANIZER_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1028
1029 icalproperty_set_organizer((icalproperty*)impl,v);
1030 return (icalproperty*)impl;
1031}
1032
1033void icalproperty_set_organizer(icalproperty* prop, const char* v){
1034 icalerror_check_arg_rv( (v!=0),"v");
1035
1036 icalerror_check_arg_rv( (prop!=0),"prop");
1037 icalproperty_set_value(prop,icalvalue_new_caladdress(v));
1038}
1039const char* icalproperty_get_organizer(icalproperty* prop){
1040 icalerror_check_arg( (prop!=0),"prop");
1041 return icalvalue_get_caladdress(icalproperty_get_value(prop));
1042}
1043icalproperty* icalproperty_vanew_percentcomplete(int v, ...){
1044 va_list args;
1045 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY);
1046 icalproperty_set_percentcomplete((icalproperty*)impl,v);
1047 va_start(args,v);
1048 icalproperty_add_parameters(impl, args);
1049 va_end(args);
1050 return (icalproperty*)impl;
1051}
1052/* PERCENT-COMPLETE */
1053icalproperty* icalproperty_new_percentcomplete(int v) {
1054 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PERCENTCOMPLETE_PROPERTY);
1055 icalproperty_set_percentcomplete((icalproperty*)impl,v);
1056 return (icalproperty*)impl;
1057}
1058
1059void icalproperty_set_percentcomplete(icalproperty* prop, int v){
1060
1061 icalerror_check_arg_rv( (prop!=0),"prop");
1062 icalproperty_set_value(prop,icalvalue_new_integer(v));
1063}
1064int icalproperty_get_percentcomplete(icalproperty* prop){
1065 icalerror_check_arg( (prop!=0),"prop");
1066 return icalvalue_get_integer(icalproperty_get_value(prop));
1067}
1068icalproperty* icalproperty_vanew_priority(int v, ...){
1069 va_list args;
1070 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRIORITY_PROPERTY);
1071 icalproperty_set_priority((icalproperty*)impl,v);
1072 va_start(args,v);
1073 icalproperty_add_parameters(impl, args);
1074 va_end(args);
1075 return (icalproperty*)impl;
1076}
1077/* PRIORITY */
1078icalproperty* icalproperty_new_priority(int v) {
1079 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRIORITY_PROPERTY);
1080 icalproperty_set_priority((icalproperty*)impl,v);
1081 return (icalproperty*)impl;
1082}
1083
1084void icalproperty_set_priority(icalproperty* prop, int v){
1085
1086 icalerror_check_arg_rv( (prop!=0),"prop");
1087 icalproperty_set_value(prop,icalvalue_new_integer(v));
1088}
1089int icalproperty_get_priority(icalproperty* prop){
1090 icalerror_check_arg( (prop!=0),"prop");
1091 return icalvalue_get_integer(icalproperty_get_value(prop));
1092}
1093icalproperty* icalproperty_vanew_prodid(const char* v, ...){
1094 va_list args;
1095 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1096
1097 icalproperty_set_prodid((icalproperty*)impl,v);
1098 va_start(args,v);
1099 icalproperty_add_parameters(impl, args);
1100 va_end(args);
1101 return (icalproperty*)impl;
1102}
1103/* PRODID */
1104icalproperty* icalproperty_new_prodid(const char* v) {
1105 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_PRODID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1106
1107 icalproperty_set_prodid((icalproperty*)impl,v);
1108 return (icalproperty*)impl;
1109}
1110
1111void icalproperty_set_prodid(icalproperty* prop, const char* v){
1112 icalerror_check_arg_rv( (v!=0),"v");
1113
1114 icalerror_check_arg_rv( (prop!=0),"prop");
1115 icalproperty_set_value(prop,icalvalue_new_text(v));
1116}
1117const char* icalproperty_get_prodid(icalproperty* prop){
1118 icalerror_check_arg( (prop!=0),"prop");
1119 return icalvalue_get_text(icalproperty_get_value(prop));
1120}
1121icalproperty* icalproperty_vanew_query(const char* v, ...){
1122 va_list args;
1123 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1124
1125 icalproperty_set_query((icalproperty*)impl,v);
1126 va_start(args,v);
1127 icalproperty_add_parameters(impl, args);
1128 va_end(args);
1129 return (icalproperty*)impl;
1130}
1131/* QUERY */
1132icalproperty* icalproperty_new_query(const char* v) {
1133 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1134
1135 icalproperty_set_query((icalproperty*)impl,v);
1136 return (icalproperty*)impl;
1137}
1138
1139void icalproperty_set_query(icalproperty* prop, const char* v){
1140 icalerror_check_arg_rv( (v!=0),"v");
1141
1142 icalerror_check_arg_rv( (prop!=0),"prop");
1143 icalproperty_set_value(prop,icalvalue_new_query(v));
1144}
1145const char* icalproperty_get_query(icalproperty* prop){
1146 icalerror_check_arg( (prop!=0),"prop");
1147 return icalvalue_get_query(icalproperty_get_value(prop));
1148}
1149icalproperty* icalproperty_vanew_queryname(const char* v, ...){
1150 va_list args;
1151 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1152
1153 icalproperty_set_queryname((icalproperty*)impl,v);
1154 va_start(args,v);
1155 icalproperty_add_parameters(impl, args);
1156 va_end(args);
1157 return (icalproperty*)impl;
1158}
1159/* QUERYNAME */
1160icalproperty* icalproperty_new_queryname(const char* v) {
1161 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_QUERYNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1162
1163 icalproperty_set_queryname((icalproperty*)impl,v);
1164 return (icalproperty*)impl;
1165}
1166
1167void icalproperty_set_queryname(icalproperty* prop, const char* v){
1168 icalerror_check_arg_rv( (v!=0),"v");
1169
1170 icalerror_check_arg_rv( (prop!=0),"prop");
1171 icalproperty_set_value(prop,icalvalue_new_text(v));
1172}
1173const char* icalproperty_get_queryname(icalproperty* prop){
1174 icalerror_check_arg( (prop!=0),"prop");
1175 return icalvalue_get_text(icalproperty_get_value(prop));
1176}
1177icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...){
1178 va_list args;
1179 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RDATE_PROPERTY);
1180 icalproperty_set_rdate((icalproperty*)impl,v);
1181 va_start(args,v);
1182 icalproperty_add_parameters(impl, args);
1183 va_end(args);
1184 return (icalproperty*)impl;
1185}
1186/* RDATE */
1187icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v) {
1188 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RDATE_PROPERTY);
1189 icalproperty_set_rdate((icalproperty*)impl,v);
1190 return (icalproperty*)impl;
1191}
1192
1193void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v){
1194
1195 icalerror_check_arg_rv( (prop!=0),"prop");
1196 icalproperty_set_value(prop,icalvalue_new_datetimeperiod(v));
1197}
1198struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop){
1199 icalerror_check_arg( (prop!=0),"prop");
1200 return icalvalue_get_datetimeperiod(icalproperty_get_value(prop));
1201}
1202icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...){
1203 va_list args;
1204 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RECURRENCEID_PROPERTY);
1205 icalproperty_set_recurrenceid((icalproperty*)impl,v);
1206 va_start(args,v);
1207 icalproperty_add_parameters(impl, args);
1208 va_end(args);
1209 return (icalproperty*)impl;
1210}
1211/* RECURRENCE-ID */
1212icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v) {
1213 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RECURRENCEID_PROPERTY);
1214 icalproperty_set_recurrenceid((icalproperty*)impl,v);
1215 return (icalproperty*)impl;
1216}
1217
1218void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v){
1219
1220 icalerror_check_arg_rv( (prop!=0),"prop");
1221 icalproperty_set_value(prop,icalvalue_new_datetime(v));
1222}
1223struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop){
1224 icalerror_check_arg( (prop!=0),"prop");
1225 return icalvalue_get_datetime(icalproperty_get_value(prop));
1226}
1227icalproperty* icalproperty_vanew_relatedto(const char* v, ...){
1228 va_list args;
1229 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1230
1231 icalproperty_set_relatedto((icalproperty*)impl,v);
1232 va_start(args,v);
1233 icalproperty_add_parameters(impl, args);
1234 va_end(args);
1235 return (icalproperty*)impl;
1236}
1237/* RELATED-TO */
1238icalproperty* icalproperty_new_relatedto(const char* v) {
1239 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RELATEDTO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1240
1241 icalproperty_set_relatedto((icalproperty*)impl,v);
1242 return (icalproperty*)impl;
1243}
1244
1245void icalproperty_set_relatedto(icalproperty* prop, const char* v){
1246 icalerror_check_arg_rv( (v!=0),"v");
1247
1248 icalerror_check_arg_rv( (prop!=0),"prop");
1249 icalproperty_set_value(prop,icalvalue_new_text(v));
1250}
1251const char* icalproperty_get_relatedto(icalproperty* prop){
1252 icalerror_check_arg( (prop!=0),"prop");
1253 return icalvalue_get_text(icalproperty_get_value(prop));
1254}
1255icalproperty* icalproperty_vanew_repeat(int v, ...){
1256 va_list args;
1257 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REPEAT_PROPERTY);
1258 icalproperty_set_repeat((icalproperty*)impl,v);
1259 va_start(args,v);
1260 icalproperty_add_parameters(impl, args);
1261 va_end(args);
1262 return (icalproperty*)impl;
1263}
1264/* REPEAT */
1265icalproperty* icalproperty_new_repeat(int v) {
1266 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REPEAT_PROPERTY);
1267 icalproperty_set_repeat((icalproperty*)impl,v);
1268 return (icalproperty*)impl;
1269}
1270
1271void icalproperty_set_repeat(icalproperty* prop, int v){
1272
1273 icalerror_check_arg_rv( (prop!=0),"prop");
1274 icalproperty_set_value(prop,icalvalue_new_integer(v));
1275}
1276int icalproperty_get_repeat(icalproperty* prop){
1277 icalerror_check_arg( (prop!=0),"prop");
1278 return icalvalue_get_integer(icalproperty_get_value(prop));
1279}
1280icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...){
1281 va_list args;
1282 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REQUESTSTATUS_PROPERTY);
1283 icalproperty_set_requeststatus((icalproperty*)impl,v);
1284 va_start(args,v);
1285 icalproperty_add_parameters(impl, args);
1286 va_end(args);
1287 return (icalproperty*)impl;
1288}
1289/* REQUEST-STATUS */
1290icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v) {
1291 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_REQUESTSTATUS_PROPERTY);
1292 icalproperty_set_requeststatus((icalproperty*)impl,v);
1293 return (icalproperty*)impl;
1294}
1295
1296void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v){
1297
1298 icalerror_check_arg_rv( (prop!=0),"prop");
1299 icalproperty_set_value(prop,icalvalue_new_requeststatus(v));
1300}
1301struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop){
1302 icalerror_check_arg( (prop!=0),"prop");
1303 return icalvalue_get_requeststatus(icalproperty_get_value(prop));
1304}
1305icalproperty* icalproperty_vanew_resources(const char* v, ...){
1306 va_list args;
1307 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1308
1309 icalproperty_set_resources((icalproperty*)impl,v);
1310 va_start(args,v);
1311 icalproperty_add_parameters(impl, args);
1312 va_end(args);
1313 return (icalproperty*)impl;
1314}
1315/* RESOURCES */
1316icalproperty* icalproperty_new_resources(const char* v) {
1317 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RESOURCES_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1318
1319 icalproperty_set_resources((icalproperty*)impl,v);
1320 return (icalproperty*)impl;
1321}
1322
1323void icalproperty_set_resources(icalproperty* prop, const char* v){
1324 icalerror_check_arg_rv( (v!=0),"v");
1325
1326 icalerror_check_arg_rv( (prop!=0),"prop");
1327 icalproperty_set_value(prop,icalvalue_new_text(v));
1328}
1329const char* icalproperty_get_resources(icalproperty* prop){
1330 icalerror_check_arg( (prop!=0),"prop");
1331 return icalvalue_get_text(icalproperty_get_value(prop));
1332}
1333icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...){
1334 va_list args;
1335 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RRULE_PROPERTY);
1336 icalproperty_set_rrule((icalproperty*)impl,v);
1337 va_start(args,v);
1338 icalproperty_add_parameters(impl, args);
1339 va_end(args);
1340 return (icalproperty*)impl;
1341}
1342/* RRULE */
1343icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v) {
1344 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_RRULE_PROPERTY);
1345 icalproperty_set_rrule((icalproperty*)impl,v);
1346 return (icalproperty*)impl;
1347}
1348
1349void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v){
1350
1351 icalerror_check_arg_rv( (prop!=0),"prop");
1352 icalproperty_set_value(prop,icalvalue_new_recur(v));
1353}
1354struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop){
1355 icalerror_check_arg( (prop!=0),"prop");
1356 return icalvalue_get_recur(icalproperty_get_value(prop));
1357}
1358icalproperty* icalproperty_vanew_scope(const char* v, ...){
1359 va_list args;
1360 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1361
1362 icalproperty_set_scope((icalproperty*)impl,v);
1363 va_start(args,v);
1364 icalproperty_add_parameters(impl, args);
1365 va_end(args);
1366 return (icalproperty*)impl;
1367}
1368/* SCOPE */
1369icalproperty* icalproperty_new_scope(const char* v) {
1370 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SCOPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1371
1372 icalproperty_set_scope((icalproperty*)impl,v);
1373 return (icalproperty*)impl;
1374}
1375
1376void icalproperty_set_scope(icalproperty* prop, const char* v){
1377 icalerror_check_arg_rv( (v!=0),"v");
1378
1379 icalerror_check_arg_rv( (prop!=0),"prop");
1380 icalproperty_set_value(prop,icalvalue_new_text(v));
1381}
1382const char* icalproperty_get_scope(icalproperty* prop){
1383 icalerror_check_arg( (prop!=0),"prop");
1384 return icalvalue_get_text(icalproperty_get_value(prop));
1385}
1386icalproperty* icalproperty_vanew_sequence(int v, ...){
1387 va_list args;
1388 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SEQUENCE_PROPERTY);
1389 icalproperty_set_sequence((icalproperty*)impl,v);
1390 va_start(args,v);
1391 icalproperty_add_parameters(impl, args);
1392 va_end(args);
1393 return (icalproperty*)impl;
1394}
1395/* SEQUENCE */
1396icalproperty* icalproperty_new_sequence(int v) {
1397 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SEQUENCE_PROPERTY);
1398 icalproperty_set_sequence((icalproperty*)impl,v);
1399 return (icalproperty*)impl;
1400}
1401
1402void icalproperty_set_sequence(icalproperty* prop, int v){
1403
1404 icalerror_check_arg_rv( (prop!=0),"prop");
1405 icalproperty_set_value(prop,icalvalue_new_integer(v));
1406}
1407int icalproperty_get_sequence(icalproperty* prop){
1408 icalerror_check_arg( (prop!=0),"prop");
1409 return icalvalue_get_integer(icalproperty_get_value(prop));
1410}
1411icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...){
1412 va_list args;
1413 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_STATUS_PROPERTY);
1414 icalproperty_set_status((icalproperty*)impl,v);
1415 va_start(args,v);
1416 icalproperty_add_parameters(impl, args);
1417 va_end(args);
1418 return (icalproperty*)impl;
1419}
1420/* STATUS */
1421icalproperty* icalproperty_new_status(enum icalproperty_status v) {
1422 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_STATUS_PROPERTY);
1423 icalproperty_set_status((icalproperty*)impl,v);
1424 return (icalproperty*)impl;
1425}
1426
1427void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v){
1428
1429 icalerror_check_arg_rv( (prop!=0),"prop");
1430 icalproperty_set_value(prop,icalvalue_new_status(v));
1431}
1432enum icalproperty_status icalproperty_get_status(icalproperty* prop){
1433 icalerror_check_arg( (prop!=0),"prop");
1434 return icalvalue_get_status(icalproperty_get_value(prop));
1435}
1436icalproperty* icalproperty_vanew_summary(const char* v, ...){
1437 va_list args;
1438 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1439
1440 icalproperty_set_summary((icalproperty*)impl,v);
1441 va_start(args,v);
1442 icalproperty_add_parameters(impl, args);
1443 va_end(args);
1444 return (icalproperty*)impl;
1445}
1446/* SUMMARY */
1447icalproperty* icalproperty_new_summary(const char* v) {
1448 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_SUMMARY_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1449
1450 icalproperty_set_summary((icalproperty*)impl,v);
1451 return (icalproperty*)impl;
1452}
1453
1454void icalproperty_set_summary(icalproperty* prop, const char* v){
1455 icalerror_check_arg_rv( (v!=0),"v");
1456
1457 icalerror_check_arg_rv( (prop!=0),"prop");
1458 icalproperty_set_value(prop,icalvalue_new_text(v));
1459}
1460const char* icalproperty_get_summary(icalproperty* prop){
1461 icalerror_check_arg( (prop!=0),"prop");
1462 return icalvalue_get_text(icalproperty_get_value(prop));
1463}
1464icalproperty* icalproperty_vanew_target(const char* v, ...){
1465 va_list args;
1466 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1467
1468 icalproperty_set_target((icalproperty*)impl,v);
1469 va_start(args,v);
1470 icalproperty_add_parameters(impl, args);
1471 va_end(args);
1472 return (icalproperty*)impl;
1473}
1474/* TARGET */
1475icalproperty* icalproperty_new_target(const char* v) {
1476 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TARGET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1477
1478 icalproperty_set_target((icalproperty*)impl,v);
1479 return (icalproperty*)impl;
1480}
1481
1482void icalproperty_set_target(icalproperty* prop, const char* v){
1483 icalerror_check_arg_rv( (v!=0),"v");
1484
1485 icalerror_check_arg_rv( (prop!=0),"prop");
1486 icalproperty_set_value(prop,icalvalue_new_caladdress(v));
1487}
1488const char* icalproperty_get_target(icalproperty* prop){
1489 icalerror_check_arg( (prop!=0),"prop");
1490 return icalvalue_get_caladdress(icalproperty_get_value(prop));
1491}
1492icalproperty* icalproperty_vanew_transp(const char* v, ...){
1493 va_list args;
1494 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1495
1496 icalproperty_set_transp((icalproperty*)impl,v);
1497 va_start(args,v);
1498 icalproperty_add_parameters(impl, args);
1499 va_end(args);
1500 return (icalproperty*)impl;
1501}
1502/* TRANSP */
1503icalproperty* icalproperty_new_transp(const char* v) {
1504 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRANSP_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1505
1506 icalproperty_set_transp((icalproperty*)impl,v);
1507 return (icalproperty*)impl;
1508}
1509
1510void icalproperty_set_transp(icalproperty* prop, const char* v){
1511 icalerror_check_arg_rv( (v!=0),"v");
1512
1513 icalerror_check_arg_rv( (prop!=0),"prop");
1514 icalproperty_set_value(prop,icalvalue_new_text(v));
1515}
1516const char* icalproperty_get_transp(icalproperty* prop){
1517 icalerror_check_arg( (prop!=0),"prop");
1518 return icalvalue_get_text(icalproperty_get_value(prop));
1519}
1520icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...){
1521 va_list args;
1522 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRIGGER_PROPERTY);
1523 icalproperty_set_trigger((icalproperty*)impl,v);
1524 va_start(args,v);
1525 icalproperty_add_parameters(impl, args);
1526 va_end(args);
1527 return (icalproperty*)impl;
1528}
1529/* TRIGGER */
1530icalproperty* icalproperty_new_trigger(struct icaltriggertype v) {
1531 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TRIGGER_PROPERTY);
1532 icalproperty_set_trigger((icalproperty*)impl,v);
1533 return (icalproperty*)impl;
1534}
1535
1536void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v){
1537
1538 icalerror_check_arg_rv( (prop!=0),"prop");
1539 icalproperty_set_value(prop,icalvalue_new_trigger(v));
1540}
1541struct icaltriggertype icalproperty_get_trigger(icalproperty* prop){
1542 icalerror_check_arg( (prop!=0),"prop");
1543 return icalvalue_get_trigger(icalproperty_get_value(prop));
1544}
1545icalproperty* icalproperty_vanew_tzid(const char* v, ...){
1546 va_list args;
1547 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1548
1549 icalproperty_set_tzid((icalproperty*)impl,v);
1550 va_start(args,v);
1551 icalproperty_add_parameters(impl, args);
1552 va_end(args);
1553 return (icalproperty*)impl;
1554}
1555/* TZID */
1556icalproperty* icalproperty_new_tzid(const char* v) {
1557 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1558
1559 icalproperty_set_tzid((icalproperty*)impl,v);
1560 return (icalproperty*)impl;
1561}
1562
1563void icalproperty_set_tzid(icalproperty* prop, const char* v){
1564 icalerror_check_arg_rv( (v!=0),"v");
1565
1566 icalerror_check_arg_rv( (prop!=0),"prop");
1567 icalproperty_set_value(prop,icalvalue_new_text(v));
1568}
1569const char* icalproperty_get_tzid(icalproperty* prop){
1570 icalerror_check_arg( (prop!=0),"prop");
1571 return icalvalue_get_text(icalproperty_get_value(prop));
1572}
1573icalproperty* icalproperty_vanew_tzname(const char* v, ...){
1574 va_list args;
1575 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1576
1577 icalproperty_set_tzname((icalproperty*)impl,v);
1578 va_start(args,v);
1579 icalproperty_add_parameters(impl, args);
1580 va_end(args);
1581 return (icalproperty*)impl;
1582}
1583/* TZNAME */
1584icalproperty* icalproperty_new_tzname(const char* v) {
1585 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZNAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1586
1587 icalproperty_set_tzname((icalproperty*)impl,v);
1588 return (icalproperty*)impl;
1589}
1590
1591void icalproperty_set_tzname(icalproperty* prop, const char* v){
1592 icalerror_check_arg_rv( (v!=0),"v");
1593
1594 icalerror_check_arg_rv( (prop!=0),"prop");
1595 icalproperty_set_value(prop,icalvalue_new_text(v));
1596}
1597const char* icalproperty_get_tzname(icalproperty* prop){
1598 icalerror_check_arg( (prop!=0),"prop");
1599 return icalvalue_get_text(icalproperty_get_value(prop));
1600}
1601icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...){
1602 va_list args;
1603 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETFROM_PROPERTY);
1604 icalproperty_set_tzoffsetfrom((icalproperty*)impl,v);
1605 va_start(args,v);
1606 icalproperty_add_parameters(impl, args);
1607 va_end(args);
1608 return (icalproperty*)impl;
1609}
1610/* TZOFFSETFROM */
1611icalproperty* icalproperty_new_tzoffsetfrom(int v) {
1612 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETFROM_PROPERTY);
1613 icalproperty_set_tzoffsetfrom((icalproperty*)impl,v);
1614 return (icalproperty*)impl;
1615}
1616
1617void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v){
1618
1619 icalerror_check_arg_rv( (prop!=0),"prop");
1620 icalproperty_set_value(prop,icalvalue_new_utcoffset(v));
1621}
1622int icalproperty_get_tzoffsetfrom(icalproperty* prop){
1623 icalerror_check_arg( (prop!=0),"prop");
1624 return icalvalue_get_utcoffset(icalproperty_get_value(prop));
1625}
1626icalproperty* icalproperty_vanew_tzoffsetto(int v, ...){
1627 va_list args;
1628 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETTO_PROPERTY);
1629 icalproperty_set_tzoffsetto((icalproperty*)impl,v);
1630 va_start(args,v);
1631 icalproperty_add_parameters(impl, args);
1632 va_end(args);
1633 return (icalproperty*)impl;
1634}
1635/* TZOFFSETTO */
1636icalproperty* icalproperty_new_tzoffsetto(int v) {
1637 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZOFFSETTO_PROPERTY);
1638 icalproperty_set_tzoffsetto((icalproperty*)impl,v);
1639 return (icalproperty*)impl;
1640}
1641
1642void icalproperty_set_tzoffsetto(icalproperty* prop, int v){
1643
1644 icalerror_check_arg_rv( (prop!=0),"prop");
1645 icalproperty_set_value(prop,icalvalue_new_utcoffset(v));
1646}
1647int icalproperty_get_tzoffsetto(icalproperty* prop){
1648 icalerror_check_arg( (prop!=0),"prop");
1649 return icalvalue_get_utcoffset(icalproperty_get_value(prop));
1650}
1651icalproperty* icalproperty_vanew_tzurl(const char* v, ...){
1652 va_list args;
1653 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1654
1655 icalproperty_set_tzurl((icalproperty*)impl,v);
1656 va_start(args,v);
1657 icalproperty_add_parameters(impl, args);
1658 va_end(args);
1659 return (icalproperty*)impl;
1660}
1661/* TZURL */
1662icalproperty* icalproperty_new_tzurl(const char* v) {
1663 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_TZURL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1664
1665 icalproperty_set_tzurl((icalproperty*)impl,v);
1666 return (icalproperty*)impl;
1667}
1668
1669void icalproperty_set_tzurl(icalproperty* prop, const char* v){
1670 icalerror_check_arg_rv( (v!=0),"v");
1671
1672 icalerror_check_arg_rv( (prop!=0),"prop");
1673 icalproperty_set_value(prop,icalvalue_new_uri(v));
1674}
1675const char* icalproperty_get_tzurl(icalproperty* prop){
1676 icalerror_check_arg( (prop!=0),"prop");
1677 return icalvalue_get_uri(icalproperty_get_value(prop));
1678}
1679icalproperty* icalproperty_vanew_uid(const char* v, ...){
1680 va_list args;
1681 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1682
1683 icalproperty_set_uid((icalproperty*)impl,v);
1684 va_start(args,v);
1685 icalproperty_add_parameters(impl, args);
1686 va_end(args);
1687 return (icalproperty*)impl;
1688}
1689/* UID */
1690icalproperty* icalproperty_new_uid(const char* v) {
1691 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_UID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1692
1693 icalproperty_set_uid((icalproperty*)impl,v);
1694 return (icalproperty*)impl;
1695}
1696
1697void icalproperty_set_uid(icalproperty* prop, const char* v){
1698 icalerror_check_arg_rv( (v!=0),"v");
1699
1700 icalerror_check_arg_rv( (prop!=0),"prop");
1701 icalproperty_set_value(prop,icalvalue_new_text(v));
1702}
1703const char* icalproperty_get_uid(icalproperty* prop){
1704 icalerror_check_arg( (prop!=0),"prop");
1705 return icalvalue_get_text(icalproperty_get_value(prop));
1706}
1707icalproperty* icalproperty_vanew_url(const char* v, ...){
1708 va_list args;
1709 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1710
1711 icalproperty_set_url((icalproperty*)impl,v);
1712 va_start(args,v);
1713 icalproperty_add_parameters(impl, args);
1714 va_end(args);
1715 return (icalproperty*)impl;
1716}
1717/* URL */
1718icalproperty* icalproperty_new_url(const char* v) {
1719 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_URL_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1720
1721 icalproperty_set_url((icalproperty*)impl,v);
1722 return (icalproperty*)impl;
1723}
1724
1725void icalproperty_set_url(icalproperty* prop, const char* v){
1726 icalerror_check_arg_rv( (v!=0),"v");
1727
1728 icalerror_check_arg_rv( (prop!=0),"prop");
1729 icalproperty_set_value(prop,icalvalue_new_uri(v));
1730}
1731const char* icalproperty_get_url(icalproperty* prop){
1732 icalerror_check_arg( (prop!=0),"prop");
1733 return icalvalue_get_uri(icalproperty_get_value(prop));
1734}
1735icalproperty* icalproperty_vanew_version(const char* v, ...){
1736 va_list args;
1737 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1738
1739 icalproperty_set_version((icalproperty*)impl,v);
1740 va_start(args,v);
1741 icalproperty_add_parameters(impl, args);
1742 va_end(args);
1743 return (icalproperty*)impl;
1744}
1745/* VERSION */
1746icalproperty* icalproperty_new_version(const char* v) {
1747 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_VERSION_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1748
1749 icalproperty_set_version((icalproperty*)impl,v);
1750 return (icalproperty*)impl;
1751}
1752
1753void icalproperty_set_version(icalproperty* prop, const char* v){
1754 icalerror_check_arg_rv( (v!=0),"v");
1755
1756 icalerror_check_arg_rv( (prop!=0),"prop");
1757 icalproperty_set_value(prop,icalvalue_new_text(v));
1758}
1759const char* icalproperty_get_version(icalproperty* prop){
1760 icalerror_check_arg( (prop!=0),"prop");
1761 return icalvalue_get_text(icalproperty_get_value(prop));
1762}
1763icalproperty* icalproperty_vanew_x(const char* v, ...){
1764 va_list args;
1765 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1766
1767 icalproperty_set_x((icalproperty*)impl,v);
1768 va_start(args,v);
1769 icalproperty_add_parameters(impl, args);
1770 va_end(args);
1771 return (icalproperty*)impl;
1772}
1773/* X */
1774icalproperty* icalproperty_new_x(const char* v) {
1775 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_X_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1776
1777 icalproperty_set_x((icalproperty*)impl,v);
1778 return (icalproperty*)impl;
1779}
1780
1781void icalproperty_set_x(icalproperty* prop, const char* v){
1782 icalerror_check_arg_rv( (v!=0),"v");
1783
1784 icalerror_check_arg_rv( (prop!=0),"prop");
1785 icalproperty_set_value(prop,icalvalue_new_text(v));
1786}
1787const char* icalproperty_get_x(icalproperty* prop){
1788 icalerror_check_arg( (prop!=0),"prop");
1789 return icalvalue_get_text(icalproperty_get_value(prop));
1790}
1791icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...){
1792 va_list args;
1793 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1794
1795 icalproperty_set_xlicclustercount((icalproperty*)impl,v);
1796 va_start(args,v);
1797 icalproperty_add_parameters(impl, args);
1798 va_end(args);
1799 return (icalproperty*)impl;
1800}
1801/* X-LIC-CLUSTERCOUNT */
1802icalproperty* icalproperty_new_xlicclustercount(const char* v) {
1803 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICCLUSTERCOUNT_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1804
1805 icalproperty_set_xlicclustercount((icalproperty*)impl,v);
1806 return (icalproperty*)impl;
1807}
1808
1809void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v){
1810 icalerror_check_arg_rv( (v!=0),"v");
1811
1812 icalerror_check_arg_rv( (prop!=0),"prop");
1813 icalproperty_set_value(prop,icalvalue_new_string(v));
1814}
1815const char* icalproperty_get_xlicclustercount(icalproperty* prop){
1816 icalerror_check_arg( (prop!=0),"prop");
1817 return icalvalue_get_string(icalproperty_get_value(prop));
1818}
1819icalproperty* icalproperty_vanew_xlicerror(const char* v, ...){
1820 va_list args;
1821 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1822
1823 icalproperty_set_xlicerror((icalproperty*)impl,v);
1824 va_start(args,v);
1825 icalproperty_add_parameters(impl, args);
1826 va_end(args);
1827 return (icalproperty*)impl;
1828}
1829/* X-LIC-ERROR */
1830icalproperty* icalproperty_new_xlicerror(const char* v) {
1831 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICERROR_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1832
1833 icalproperty_set_xlicerror((icalproperty*)impl,v);
1834 return (icalproperty*)impl;
1835}
1836
1837void icalproperty_set_xlicerror(icalproperty* prop, const char* v){
1838 icalerror_check_arg_rv( (v!=0),"v");
1839
1840 icalerror_check_arg_rv( (prop!=0),"prop");
1841 icalproperty_set_value(prop,icalvalue_new_text(v));
1842}
1843const char* icalproperty_get_xlicerror(icalproperty* prop){
1844 icalerror_check_arg( (prop!=0),"prop");
1845 return icalvalue_get_text(icalproperty_get_value(prop));
1846}
1847icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...){
1848 va_list args;
1849 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1850
1851 icalproperty_set_xlicmimecharset((icalproperty*)impl,v);
1852 va_start(args,v);
1853 icalproperty_add_parameters(impl, args);
1854 va_end(args);
1855 return (icalproperty*)impl;
1856}
1857/* X-LIC-MIMECHARSET */
1858icalproperty* icalproperty_new_xlicmimecharset(const char* v) {
1859 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECHARSET_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1860
1861 icalproperty_set_xlicmimecharset((icalproperty*)impl,v);
1862 return (icalproperty*)impl;
1863}
1864
1865void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v){
1866 icalerror_check_arg_rv( (v!=0),"v");
1867
1868 icalerror_check_arg_rv( (prop!=0),"prop");
1869 icalproperty_set_value(prop,icalvalue_new_string(v));
1870}
1871const char* icalproperty_get_xlicmimecharset(icalproperty* prop){
1872 icalerror_check_arg( (prop!=0),"prop");
1873 return icalvalue_get_string(icalproperty_get_value(prop));
1874}
1875icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...){
1876 va_list args;
1877 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1878
1879 icalproperty_set_xlicmimecid((icalproperty*)impl,v);
1880 va_start(args,v);
1881 icalproperty_add_parameters(impl, args);
1882 va_end(args);
1883 return (icalproperty*)impl;
1884}
1885/* X-LIC-MIMECID */
1886icalproperty* icalproperty_new_xlicmimecid(const char* v) {
1887 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECID_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1888
1889 icalproperty_set_xlicmimecid((icalproperty*)impl,v);
1890 return (icalproperty*)impl;
1891}
1892
1893void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v){
1894 icalerror_check_arg_rv( (v!=0),"v");
1895
1896 icalerror_check_arg_rv( (prop!=0),"prop");
1897 icalproperty_set_value(prop,icalvalue_new_string(v));
1898}
1899const char* icalproperty_get_xlicmimecid(icalproperty* prop){
1900 icalerror_check_arg( (prop!=0),"prop");
1901 return icalvalue_get_string(icalproperty_get_value(prop));
1902}
1903icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...){
1904 va_list args;
1905 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1906
1907 icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v);
1908 va_start(args,v);
1909 icalproperty_add_parameters(impl, args);
1910 va_end(args);
1911 return (icalproperty*)impl;
1912}
1913/* X-LIC-MIMECONTENTTYPE */
1914icalproperty* icalproperty_new_xlicmimecontenttype(const char* v) {
1915 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMECONTENTTYPE_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1916
1917 icalproperty_set_xlicmimecontenttype((icalproperty*)impl,v);
1918 return (icalproperty*)impl;
1919}
1920
1921void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v){
1922 icalerror_check_arg_rv( (v!=0),"v");
1923
1924 icalerror_check_arg_rv( (prop!=0),"prop");
1925 icalproperty_set_value(prop,icalvalue_new_string(v));
1926}
1927const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop){
1928 icalerror_check_arg( (prop!=0),"prop");
1929 return icalvalue_get_string(icalproperty_get_value(prop));
1930}
1931icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...){
1932 va_list args;
1933 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1934
1935 icalproperty_set_xlicmimeencoding((icalproperty*)impl,v);
1936 va_start(args,v);
1937 icalproperty_add_parameters(impl, args);
1938 va_end(args);
1939 return (icalproperty*)impl;
1940}
1941/* X-LIC-MIMEENCODING */
1942icalproperty* icalproperty_new_xlicmimeencoding(const char* v) {
1943 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEENCODING_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1944
1945 icalproperty_set_xlicmimeencoding((icalproperty*)impl,v);
1946 return (icalproperty*)impl;
1947}
1948
1949void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v){
1950 icalerror_check_arg_rv( (v!=0),"v");
1951
1952 icalerror_check_arg_rv( (prop!=0),"prop");
1953 icalproperty_set_value(prop,icalvalue_new_string(v));
1954}
1955const char* icalproperty_get_xlicmimeencoding(icalproperty* prop){
1956 icalerror_check_arg( (prop!=0),"prop");
1957 return icalvalue_get_string(icalproperty_get_value(prop));
1958}
1959icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...){
1960 va_list args;
1961 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1962
1963 icalproperty_set_xlicmimefilename((icalproperty*)impl,v);
1964 va_start(args,v);
1965 icalproperty_add_parameters(impl, args);
1966 va_end(args);
1967 return (icalproperty*)impl;
1968}
1969/* X-LIC-MIMEFILENAME */
1970icalproperty* icalproperty_new_xlicmimefilename(const char* v) {
1971 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEFILENAME_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1972
1973 icalproperty_set_xlicmimefilename((icalproperty*)impl,v);
1974 return (icalproperty*)impl;
1975}
1976
1977void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v){
1978 icalerror_check_arg_rv( (v!=0),"v");
1979
1980 icalerror_check_arg_rv( (prop!=0),"prop");
1981 icalproperty_set_value(prop,icalvalue_new_string(v));
1982}
1983const char* icalproperty_get_xlicmimefilename(icalproperty* prop){
1984 icalerror_check_arg( (prop!=0),"prop");
1985 return icalvalue_get_string(icalproperty_get_value(prop));
1986}
1987icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...){
1988 va_list args;
1989 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
1990
1991 icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v);
1992 va_start(args,v);
1993 icalproperty_add_parameters(impl, args);
1994 va_end(args);
1995 return (icalproperty*)impl;
1996}
1997/* X-LIC-MIMEOPTINFO */
1998icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v) {
1999 struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_XLICMIMEOPTINFO_PROPERTY); icalerror_check_arg_rz( (v!=0),"v");
2000
2001 icalproperty_set_xlicmimeoptinfo((icalproperty*)impl,v);
2002 return (icalproperty*)impl;
2003}
2004
2005void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v){
2006 icalerror_check_arg_rv( (v!=0),"v");
2007
2008 icalerror_check_arg_rv( (prop!=0),"prop");
2009 icalproperty_set_value(prop,icalvalue_new_string(v));
2010}
2011const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop){
2012 icalerror_check_arg( (prop!=0),"prop");
2013 return icalvalue_get_string(icalproperty_get_value(prop));
2014}
diff --git a/libical/src/libical/icalderivedproperty.h b/libical/src/libical/icalderivedproperty.h
new file mode 100644
index 0000000..07e01b0
--- a/dev/null
+++ b/libical/src/libical/icalderivedproperty.h
@@ -0,0 +1,403 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalderivedproperties.{c,h}
4 CREATOR: eric 09 May 1999
5
6 $Id$
7
8 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
9 ======================================================================*/
10
11
12#ifndef ICALDERIVEDPROPERTY_H
13#define ICALDERIVEDPROPERTY_H
14
15#include <time.h>
16#include "icalparameter.h"
17#include "icalderivedvalue.h"
18#include "icalrecur.h"
19
20typedef void icalproperty;
21
22
23/* Everything below this line is machine generated. Do not edit. */
24typedef enum icalproperty_kind {
25 ICAL_ANY_PROPERTY = 0,
26 ICAL_ACTION_PROPERTY,
27 ICAL_ATTACH_PROPERTY,
28 ICAL_ATTENDEE_PROPERTY,
29 ICAL_CALSCALE_PROPERTY,
30 ICAL_CATEGORIES_PROPERTY,
31 ICAL_CLASS_PROPERTY,
32 ICAL_COMMENT_PROPERTY,
33 ICAL_COMPLETED_PROPERTY,
34 ICAL_CONTACT_PROPERTY,
35 ICAL_CREATED_PROPERTY,
36 ICAL_DESCRIPTION_PROPERTY,
37 ICAL_DTEND_PROPERTY,
38 ICAL_DTSTAMP_PROPERTY,
39 ICAL_DTSTART_PROPERTY,
40 ICAL_DUE_PROPERTY,
41 ICAL_DURATION_PROPERTY,
42 ICAL_EXDATE_PROPERTY,
43 ICAL_EXRULE_PROPERTY,
44 ICAL_FREEBUSY_PROPERTY,
45 ICAL_GEO_PROPERTY,
46 ICAL_LASTMODIFIED_PROPERTY,
47 ICAL_LOCATION_PROPERTY,
48 ICAL_MAXRESULTS_PROPERTY,
49 ICAL_MAXRESULTSSIZE_PROPERTY,
50 ICAL_METHOD_PROPERTY,
51 ICAL_ORGANIZER_PROPERTY,
52 ICAL_PERCENTCOMPLETE_PROPERTY,
53 ICAL_PRIORITY_PROPERTY,
54 ICAL_PRODID_PROPERTY,
55 ICAL_QUERY_PROPERTY,
56 ICAL_QUERYNAME_PROPERTY,
57 ICAL_RDATE_PROPERTY,
58 ICAL_RECURRENCEID_PROPERTY,
59 ICAL_RELATEDTO_PROPERTY,
60 ICAL_REPEAT_PROPERTY,
61 ICAL_REQUESTSTATUS_PROPERTY,
62 ICAL_RESOURCES_PROPERTY,
63 ICAL_RRULE_PROPERTY,
64 ICAL_SCOPE_PROPERTY,
65 ICAL_SEQUENCE_PROPERTY,
66 ICAL_STATUS_PROPERTY,
67 ICAL_SUMMARY_PROPERTY,
68 ICAL_TARGET_PROPERTY,
69 ICAL_TRANSP_PROPERTY,
70 ICAL_TRIGGER_PROPERTY,
71 ICAL_TZID_PROPERTY,
72 ICAL_TZNAME_PROPERTY,
73 ICAL_TZOFFSETFROM_PROPERTY,
74 ICAL_TZOFFSETTO_PROPERTY,
75 ICAL_TZURL_PROPERTY,
76 ICAL_UID_PROPERTY,
77 ICAL_URL_PROPERTY,
78 ICAL_VERSION_PROPERTY,
79 ICAL_X_PROPERTY,
80 ICAL_XLICCLUSTERCOUNT_PROPERTY,
81 ICAL_XLICERROR_PROPERTY,
82 ICAL_XLICMIMECHARSET_PROPERTY,
83 ICAL_XLICMIMECID_PROPERTY,
84 ICAL_XLICMIMECONTENTTYPE_PROPERTY,
85 ICAL_XLICMIMEENCODING_PROPERTY,
86 ICAL_XLICMIMEFILENAME_PROPERTY,
87 ICAL_XLICMIMEOPTINFO_PROPERTY,
88 ICAL_NO_PROPERTY
89} icalproperty_kind;
90
91icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...);
92
93/* ACTION */
94icalproperty* icalproperty_new_action(enum icalproperty_action v);
95void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v);
96enum icalproperty_action icalproperty_get_action(icalproperty* prop);icalproperty* icalproperty_vanew_attach(struct icalattachtype* v, ...);
97
98/* ATTACH */
99icalproperty* icalproperty_new_attach(struct icalattachtype* v);
100void icalproperty_set_attach(icalproperty* prop, struct icalattachtype* v);
101struct icalattachtype* icalproperty_get_attach(icalproperty* prop);icalproperty* icalproperty_vanew_attendee(const char* v, ...);
102
103/* ATTENDEE */
104icalproperty* icalproperty_new_attendee(const char* v);
105void icalproperty_set_attendee(icalproperty* prop, const char* v);
106const char* icalproperty_get_attendee(icalproperty* prop);icalproperty* icalproperty_vanew_calscale(const char* v, ...);
107
108/* CALSCALE */
109icalproperty* icalproperty_new_calscale(const char* v);
110void icalproperty_set_calscale(icalproperty* prop, const char* v);
111const char* icalproperty_get_calscale(icalproperty* prop);icalproperty* icalproperty_vanew_categories(const char* v, ...);
112
113/* CATEGORIES */
114icalproperty* icalproperty_new_categories(const char* v);
115void icalproperty_set_categories(icalproperty* prop, const char* v);
116const char* icalproperty_get_categories(icalproperty* prop);icalproperty* icalproperty_vanew_class(const char* v, ...);
117
118/* CLASS */
119icalproperty* icalproperty_new_class(const char* v);
120void icalproperty_set_class(icalproperty* prop, const char* v);
121const char* icalproperty_get_class(icalproperty* prop);icalproperty* icalproperty_vanew_comment(const char* v, ...);
122
123/* COMMENT */
124icalproperty* icalproperty_new_comment(const char* v);
125void icalproperty_set_comment(icalproperty* prop, const char* v);
126const char* icalproperty_get_comment(icalproperty* prop);icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...);
127
128/* COMPLETED */
129icalproperty* icalproperty_new_completed(struct icaltimetype v);
130void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v);
131struct icaltimetype icalproperty_get_completed(icalproperty* prop);icalproperty* icalproperty_vanew_contact(const char* v, ...);
132
133/* CONTACT */
134icalproperty* icalproperty_new_contact(const char* v);
135void icalproperty_set_contact(icalproperty* prop, const char* v);
136const char* icalproperty_get_contact(icalproperty* prop);icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...);
137
138/* CREATED */
139icalproperty* icalproperty_new_created(struct icaltimetype v);
140void icalproperty_set_created(icalproperty* prop, struct icaltimetype v);
141struct icaltimetype icalproperty_get_created(icalproperty* prop);icalproperty* icalproperty_vanew_description(const char* v, ...);
142
143/* DESCRIPTION */
144icalproperty* icalproperty_new_description(const char* v);
145void icalproperty_set_description(icalproperty* prop, const char* v);
146const char* icalproperty_get_description(icalproperty* prop);icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...);
147
148/* DTEND */
149icalproperty* icalproperty_new_dtend(struct icaltimetype v);
150void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v);
151struct icaltimetype icalproperty_get_dtend(icalproperty* prop);icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...);
152
153/* DTSTAMP */
154icalproperty* icalproperty_new_dtstamp(struct icaltimetype v);
155void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v);
156struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop);icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...);
157
158/* DTSTART */
159icalproperty* icalproperty_new_dtstart(struct icaltimetype v);
160void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v);
161struct icaltimetype icalproperty_get_dtstart(icalproperty* prop);icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...);
162
163/* DUE */
164icalproperty* icalproperty_new_due(struct icaltimetype v);
165void icalproperty_set_due(icalproperty* prop, struct icaltimetype v);
166struct icaltimetype icalproperty_get_due(icalproperty* prop);icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...);
167
168/* DURATION */
169icalproperty* icalproperty_new_duration(struct icaldurationtype v);
170void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v);
171struct icaldurationtype icalproperty_get_duration(icalproperty* prop);icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...);
172
173/* EXDATE */
174icalproperty* icalproperty_new_exdate(struct icaltimetype v);
175void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v);
176struct icaltimetype icalproperty_get_exdate(icalproperty* prop);icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...);
177
178/* EXRULE */
179icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v);
180void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v);
181struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop);icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...);
182
183/* FREEBUSY */
184icalproperty* icalproperty_new_freebusy(struct icalperiodtype v);
185void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v);
186struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop);icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...);
187
188/* GEO */
189icalproperty* icalproperty_new_geo(struct icalgeotype v);
190void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v);
191struct icalgeotype icalproperty_get_geo(icalproperty* prop);icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...);
192
193/* LAST-MODIFIED */
194icalproperty* icalproperty_new_lastmodified(struct icaltimetype v);
195void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v);
196struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop);icalproperty* icalproperty_vanew_location(const char* v, ...);
197
198/* LOCATION */
199icalproperty* icalproperty_new_location(const char* v);
200void icalproperty_set_location(icalproperty* prop, const char* v);
201const char* icalproperty_get_location(icalproperty* prop);icalproperty* icalproperty_vanew_maxresults(int v, ...);
202
203/* MAXRESULTS */
204icalproperty* icalproperty_new_maxresults(int v);
205void icalproperty_set_maxresults(icalproperty* prop, int v);
206int icalproperty_get_maxresults(icalproperty* prop);icalproperty* icalproperty_vanew_maxresultssize(int v, ...);
207
208/* MAXRESULTSSIZE */
209icalproperty* icalproperty_new_maxresultssize(int v);
210void icalproperty_set_maxresultssize(icalproperty* prop, int v);
211int icalproperty_get_maxresultssize(icalproperty* prop);icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...);
212
213/* METHOD */
214icalproperty* icalproperty_new_method(enum icalproperty_method v);
215void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v);
216enum icalproperty_method icalproperty_get_method(icalproperty* prop);icalproperty* icalproperty_vanew_organizer(const char* v, ...);
217
218/* ORGANIZER */
219icalproperty* icalproperty_new_organizer(const char* v);
220void icalproperty_set_organizer(icalproperty* prop, const char* v);
221const char* icalproperty_get_organizer(icalproperty* prop);icalproperty* icalproperty_vanew_percentcomplete(int v, ...);
222
223/* PERCENT-COMPLETE */
224icalproperty* icalproperty_new_percentcomplete(int v);
225void icalproperty_set_percentcomplete(icalproperty* prop, int v);
226int icalproperty_get_percentcomplete(icalproperty* prop);icalproperty* icalproperty_vanew_priority(int v, ...);
227
228/* PRIORITY */
229icalproperty* icalproperty_new_priority(int v);
230void icalproperty_set_priority(icalproperty* prop, int v);
231int icalproperty_get_priority(icalproperty* prop);icalproperty* icalproperty_vanew_prodid(const char* v, ...);
232
233/* PRODID */
234icalproperty* icalproperty_new_prodid(const char* v);
235void icalproperty_set_prodid(icalproperty* prop, const char* v);
236const char* icalproperty_get_prodid(icalproperty* prop);icalproperty* icalproperty_vanew_query(const char* v, ...);
237
238/* QUERY */
239icalproperty* icalproperty_new_query(const char* v);
240void icalproperty_set_query(icalproperty* prop, const char* v);
241const char* icalproperty_get_query(icalproperty* prop);icalproperty* icalproperty_vanew_queryname(const char* v, ...);
242
243/* QUERYNAME */
244icalproperty* icalproperty_new_queryname(const char* v);
245void icalproperty_set_queryname(icalproperty* prop, const char* v);
246const char* icalproperty_get_queryname(icalproperty* prop);icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...);
247
248/* RDATE */
249icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v);
250void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v);
251struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop);icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...);
252
253/* RECURRENCE-ID */
254icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v);
255void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v);
256struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop);icalproperty* icalproperty_vanew_relatedto(const char* v, ...);
257
258/* RELATED-TO */
259icalproperty* icalproperty_new_relatedto(const char* v);
260void icalproperty_set_relatedto(icalproperty* prop, const char* v);
261const char* icalproperty_get_relatedto(icalproperty* prop);icalproperty* icalproperty_vanew_repeat(int v, ...);
262
263/* REPEAT */
264icalproperty* icalproperty_new_repeat(int v);
265void icalproperty_set_repeat(icalproperty* prop, int v);
266int icalproperty_get_repeat(icalproperty* prop);icalproperty* icalproperty_vanew_requeststatus(struct icalreqstattype v, ...);
267
268/* REQUEST-STATUS */
269icalproperty* icalproperty_new_requeststatus(struct icalreqstattype v);
270void icalproperty_set_requeststatus(icalproperty* prop, struct icalreqstattype v);
271struct icalreqstattype icalproperty_get_requeststatus(icalproperty* prop);icalproperty* icalproperty_vanew_resources(const char* v, ...);
272
273/* RESOURCES */
274icalproperty* icalproperty_new_resources(const char* v);
275void icalproperty_set_resources(icalproperty* prop, const char* v);
276const char* icalproperty_get_resources(icalproperty* prop);icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...);
277
278/* RRULE */
279icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v);
280void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v);
281struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop);icalproperty* icalproperty_vanew_scope(const char* v, ...);
282
283/* SCOPE */
284icalproperty* icalproperty_new_scope(const char* v);
285void icalproperty_set_scope(icalproperty* prop, const char* v);
286const char* icalproperty_get_scope(icalproperty* prop);icalproperty* icalproperty_vanew_sequence(int v, ...);
287
288/* SEQUENCE */
289icalproperty* icalproperty_new_sequence(int v);
290void icalproperty_set_sequence(icalproperty* prop, int v);
291int icalproperty_get_sequence(icalproperty* prop);icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...);
292
293/* STATUS */
294icalproperty* icalproperty_new_status(enum icalproperty_status v);
295void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v);
296enum icalproperty_status icalproperty_get_status(icalproperty* prop);icalproperty* icalproperty_vanew_summary(const char* v, ...);
297
298/* SUMMARY */
299icalproperty* icalproperty_new_summary(const char* v);
300void icalproperty_set_summary(icalproperty* prop, const char* v);
301const char* icalproperty_get_summary(icalproperty* prop);icalproperty* icalproperty_vanew_target(const char* v, ...);
302
303/* TARGET */
304icalproperty* icalproperty_new_target(const char* v);
305void icalproperty_set_target(icalproperty* prop, const char* v);
306const char* icalproperty_get_target(icalproperty* prop);icalproperty* icalproperty_vanew_transp(const char* v, ...);
307
308/* TRANSP */
309icalproperty* icalproperty_new_transp(const char* v);
310void icalproperty_set_transp(icalproperty* prop, const char* v);
311const char* icalproperty_get_transp(icalproperty* prop);icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...);
312
313/* TRIGGER */
314icalproperty* icalproperty_new_trigger(struct icaltriggertype v);
315void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v);
316struct icaltriggertype icalproperty_get_trigger(icalproperty* prop);icalproperty* icalproperty_vanew_tzid(const char* v, ...);
317
318/* TZID */
319icalproperty* icalproperty_new_tzid(const char* v);
320void icalproperty_set_tzid(icalproperty* prop, const char* v);
321const char* icalproperty_get_tzid(icalproperty* prop);icalproperty* icalproperty_vanew_tzname(const char* v, ...);
322
323/* TZNAME */
324icalproperty* icalproperty_new_tzname(const char* v);
325void icalproperty_set_tzname(icalproperty* prop, const char* v);
326const char* icalproperty_get_tzname(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...);
327
328/* TZOFFSETFROM */
329icalproperty* icalproperty_new_tzoffsetfrom(int v);
330void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v);
331int icalproperty_get_tzoffsetfrom(icalproperty* prop);icalproperty* icalproperty_vanew_tzoffsetto(int v, ...);
332
333/* TZOFFSETTO */
334icalproperty* icalproperty_new_tzoffsetto(int v);
335void icalproperty_set_tzoffsetto(icalproperty* prop, int v);
336int icalproperty_get_tzoffsetto(icalproperty* prop);icalproperty* icalproperty_vanew_tzurl(const char* v, ...);
337
338/* TZURL */
339icalproperty* icalproperty_new_tzurl(const char* v);
340void icalproperty_set_tzurl(icalproperty* prop, const char* v);
341const char* icalproperty_get_tzurl(icalproperty* prop);icalproperty* icalproperty_vanew_uid(const char* v, ...);
342
343/* UID */
344icalproperty* icalproperty_new_uid(const char* v);
345void icalproperty_set_uid(icalproperty* prop, const char* v);
346const char* icalproperty_get_uid(icalproperty* prop);icalproperty* icalproperty_vanew_url(const char* v, ...);
347
348/* URL */
349icalproperty* icalproperty_new_url(const char* v);
350void icalproperty_set_url(icalproperty* prop, const char* v);
351const char* icalproperty_get_url(icalproperty* prop);icalproperty* icalproperty_vanew_version(const char* v, ...);
352
353/* VERSION */
354icalproperty* icalproperty_new_version(const char* v);
355void icalproperty_set_version(icalproperty* prop, const char* v);
356const char* icalproperty_get_version(icalproperty* prop);icalproperty* icalproperty_vanew_x(const char* v, ...);
357
358/* X */
359icalproperty* icalproperty_new_x(const char* v);
360void icalproperty_set_x(icalproperty* prop, const char* v);
361const char* icalproperty_get_x(icalproperty* prop);icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...);
362
363/* X-LIC-CLUSTERCOUNT */
364icalproperty* icalproperty_new_xlicclustercount(const char* v);
365void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v);
366const char* icalproperty_get_xlicclustercount(icalproperty* prop);icalproperty* icalproperty_vanew_xlicerror(const char* v, ...);
367
368/* X-LIC-ERROR */
369icalproperty* icalproperty_new_xlicerror(const char* v);
370void icalproperty_set_xlicerror(icalproperty* prop, const char* v);
371const char* icalproperty_get_xlicerror(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...);
372
373/* X-LIC-MIMECHARSET */
374icalproperty* icalproperty_new_xlicmimecharset(const char* v);
375void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v);
376const char* icalproperty_get_xlicmimecharset(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...);
377
378/* X-LIC-MIMECID */
379icalproperty* icalproperty_new_xlicmimecid(const char* v);
380void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v);
381const char* icalproperty_get_xlicmimecid(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...);
382
383/* X-LIC-MIMECONTENTTYPE */
384icalproperty* icalproperty_new_xlicmimecontenttype(const char* v);
385void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v);
386const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...);
387
388/* X-LIC-MIMEENCODING */
389icalproperty* icalproperty_new_xlicmimeencoding(const char* v);
390void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v);
391const char* icalproperty_get_xlicmimeencoding(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...);
392
393/* X-LIC-MIMEFILENAME */
394icalproperty* icalproperty_new_xlicmimefilename(const char* v);
395void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v);
396const char* icalproperty_get_xlicmimefilename(icalproperty* prop);icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...);
397
398/* X-LIC-MIMEOPTINFO */
399icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v);
400void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v);
401const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop);
402
403#endif /*ICALPROPERTY_H*/
diff --git a/libical/src/libical/icalderivedvalue.c b/libical/src/libical/icalderivedvalue.c
new file mode 100644
index 0000000..db762ea
--- a/dev/null
+++ b/libical/src/libical/icalderivedvalue.c
@@ -0,0 +1,981 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalvalue.c
4 CREATOR: eric 02 May 1999
5
6 $Id$
7
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The original code is icalvalue.c
23
24 Contributions from:
25 Graham Davison (g.m.davison@computer.org)
26
27
28======================================================================*/
29
30#ifdef HAVE_CONFIG_H
31#include <config.h>
32#endif
33
34#include "icalerror.h"
35#include "icalmemory.h"
36#include "icalparser.h"
37#include "icalenums.h"
38
39#include "icalvalueimpl.h"
40
41#include <stdlib.h> /* for malloc */
42#include <stdio.h> /* for sprintf */
43#include <string.h> /* For memset, others */
44#include <stddef.h> /* For offsetof() macro */
45#include <errno.h>
46#include <time.h> /* for mktime */
47#include <stdlib.h> /* for atoi and atof */
48#include <limits.h> /* for SHRT_MAX */
49
50
51
52#define TMP_BUF_SIZE 1024
53
54struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind);
55
56/* This map associates each of the value types with its string
57 representation */
58struct icalvalue_kind_map {
59 icalvalue_kind kind;
60 char name[20];
61};
62
63extern struct icalvalue_kind_map value_map[];
64
65const char* icalvalue_kind_to_string(icalvalue_kind kind)
66{
67 int i;
68
69 for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
70 if (value_map[i].kind == kind) {
71 return value_map[i].name;
72 }
73 }
74
75 return 0;
76}
77
78icalvalue_kind icalvalue_string_to_kind(const char* str)
79{
80 int i;
81
82 for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
83 if (strcmp(value_map[i].name,str) == 0) {
84 return value_map[i].kind;
85 }
86 }
87
88 return value_map[i].kind;
89
90}
91
92icalvalue* icalvalue_new_x (const char* v){
93 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
94 icalerror_check_arg_rz( (v!=0),"v");
95
96 icalvalue_set_x((icalvalue*)impl,v);
97 return (icalvalue*)impl;
98}
99void icalvalue_set_x(icalvalue* value, const char* v) {
100 struct icalvalue_impl* impl;
101 icalerror_check_arg_rv( (value!=0),"value");
102 icalerror_check_arg_rv( (v!=0),"v");
103
104 impl = (struct icalvalue_impl*)value;
105 if(impl->x_value!=0) {free((void*)impl->x_value);}
106
107 impl->x_value = icalmemory_strdup(v);
108
109 if (impl->x_value == 0){
110 errno = ENOMEM;
111 }
112
113 }
114const char* icalvalue_get_x(icalvalue* value) {
115
116 icalerror_check_arg( (value!=0),"value");
117 icalerror_check_value_type(value, ICAL_X_VALUE);
118 return ((struct icalvalue_impl*)value)->x_value;
119}
120
121/* Attachment is a special case, so it is not auto generated. */
122icalvalue*
123icalvalue_new_attach (struct icalattachtype *v)
124{
125 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ATTACH_VALUE);
126
127 icalvalue_set_attach((icalvalue*)impl,v);
128
129 return (icalvalue*)impl;
130}
131
132void
133icalvalue_set_attach(icalvalue* value, struct icalattachtype *v)
134{
135 struct icalvalue_impl* impl;
136
137 icalerror_check_arg_rv( (value!=0),"value");
138 icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
139
140 impl = (struct icalvalue_impl*)value;
141
142 if (impl->data.v_attach != 0){
143 icalattachtype_free(impl->data.v_attach);
144 }
145
146 impl->data.v_attach = v;
147 icalattachtype_add_reference(v);
148}
149
150struct icalattachtype*
151icalvalue_get_attach(icalvalue* value)
152{
153 icalerror_check_arg( (value!=0),"value");
154 icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
155
156 return ((struct icalvalue_impl*)value)->data.v_attach;
157}
158
159
160/* Recur is a special case, so it is not auto generated. */
161icalvalue*
162icalvalue_new_recur (struct icalrecurrencetype v)
163{
164 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE);
165
166 icalvalue_set_recur((icalvalue*)impl,v);
167
168 return (icalvalue*)impl;
169}
170
171void
172icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v)
173{
174 struct icalvalue_impl* impl;
175
176 icalerror_check_arg_rv( (value!=0),"value");
177 icalerror_check_value_type(value, ICAL_RECUR_VALUE);
178
179 impl = (struct icalvalue_impl*)value;
180
181 if (impl->data.v_recur != 0){
182 free(impl->data.v_recur);
183 impl->data.v_recur = 0;
184 }
185
186 impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
187
188 if (impl->data.v_recur == 0){
189 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
190 return;
191 } else {
192 memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
193 }
194
195}
196
197struct icalrecurrencetype
198icalvalue_get_recur(icalvalue* value)
199{
200 icalerror_check_arg( (value!=0),"value");
201 icalerror_check_value_type(value, ICAL_RECUR_VALUE);
202
203 return *(((struct icalvalue_impl*)value)->data.v_recur);
204}
205
206
207
208
209icalvalue*
210icalvalue_new_trigger (struct icaltriggertype v)
211{
212 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE);
213
214 icalvalue_set_trigger((icalvalue*)impl,v);
215
216 return (icalvalue*)impl;
217}
218
219void
220icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
221{
222 struct icalvalue_impl* impl;
223
224 icalerror_check_arg_rv( (value!=0),"value");
225
226 impl = (struct icalvalue_impl*)value;
227
228 if(!icaltime_is_null_time(v.time)){
229 icalvalue_set_datetime((icalvalue*)impl,v.time);
230 impl->kind = ICAL_DATETIME_VALUE;
231 } else {
232 icalvalue_set_duration((icalvalue*)impl,v.duration);
233 impl->kind = ICAL_DURATION_VALUE;
234 }
235
236}
237
238struct icaltriggertype
239icalvalue_get_trigger(icalvalue* value)
240{
241 struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
242 struct icaltriggertype tr;
243
244 icalerror_check_arg( (value!=0),"value");
245 icalerror_check_arg( (value!=0),"value");
246
247 if(impl->kind == ICAL_DATETIME_VALUE){
248 tr.duration = icaldurationtype_from_int(0);
249 tr.time = impl->data.v_time;
250 } else if(impl->kind == ICAL_DURATION_VALUE){
251 tr.time = icaltime_null_time();
252 tr.duration = impl->data.v_duration;
253 } else {
254 tr.duration = icaldurationtype_from_int(0);
255 tr.time = icaltime_null_time();
256 icalerror_set_errno(ICAL_BADARG_ERROR);
257 }
258
259 return tr;
260}
261
262/* DATE-TIME-PERIOD is a special case, and is not auto generated */
263
264icalvalue*
265icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v)
266{
267 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE);
268
269 icalvalue_set_datetimeperiod((icalvalue*)impl,v);
270
271 return (icalvalue*)impl;
272}
273
274void
275icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v)
276{
277 struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
278
279 icalerror_check_arg_rv( (value!=0),"value");
280
281 icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
282
283 if(!icaltime_is_null_time(v.time)){
284 if(!icaltime_is_valid_time(v.time)){
285 icalerror_set_errno(ICAL_BADARG_ERROR);
286 return;
287 }
288 impl->kind = ICAL_DATETIME_VALUE;
289 icalvalue_set_datetime(impl,v.time);
290 } else if (!icalperiodtype_is_null_period(v.period)) {
291 if(!icalperiodtype_is_valid_period(v.period)){
292 icalerror_set_errno(ICAL_BADARG_ERROR);
293 return;
294 }
295 impl->kind = ICAL_PERIOD_VALUE;
296 icalvalue_set_period(impl,v.period);
297 } else {
298 icalerror_set_errno(ICAL_BADARG_ERROR);
299 }
300}
301
302struct icaldatetimeperiodtype
303icalvalue_get_datetimeperiod(icalvalue* value)
304{
305 struct icaldatetimeperiodtype dtp;
306
307 struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
308 icalerror_check_arg( (value!=0),"value");
309 icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
310
311 if(impl->kind == ICAL_DATETIME_VALUE){
312 dtp.period = icalperiodtype_null_period();
313 dtp.time = impl->data.v_time;
314 } else if(impl->kind == ICAL_PERIOD_VALUE) {
315 dtp.period = impl->data.v_period;
316 dtp.time = icaltime_null_time();
317 } else {
318 dtp.period = icalperiodtype_null_period();
319 dtp.time = icaltime_null_time();
320 icalerror_set_errno(ICAL_BADARG_ERROR);
321 }
322
323 return dtp;
324}
325
326
327
328
329
330
331
332
333
334/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
335 types */
336
337
338/* Everything below this line is machine generated. Do not edit. */
339static struct icalvalue_kind_map value_map[]={
340 {ICAL_QUERY_VALUE,"QUERY"},
341 {ICAL_TRIGGER_VALUE,"TRIGGER"},
342 {ICAL_STATUS_VALUE,"STATUS"},
343 {ICAL_TRANSP_VALUE,"TRANSP"},
344 {ICAL_CLASS_VALUE,"CLASS"},
345 {ICAL_DATE_VALUE,"DATE"},
346 {ICAL_STRING_VALUE,"STRING"},
347 {ICAL_INTEGER_VALUE,"INTEGER"},
348 {ICAL_PERIOD_VALUE,"PERIOD"},
349 {ICAL_TEXT_VALUE,"TEXT"},
350 {ICAL_DURATION_VALUE,"DURATION"},
351 {ICAL_BOOLEAN_VALUE,"BOOLEAN"},
352 {ICAL_URI_VALUE,"URI"},
353 {ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"},
354 {ICAL_GEO_VALUE,"GEO"},
355 {ICAL_DATETIME_VALUE,"DATE-TIME"},
356 {ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"},
357 {ICAL_ATTACH_VALUE,"ATTACH"},
358 {ICAL_ACTION_VALUE,"ACTION"},
359 {ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"},
360 {ICAL_X_VALUE,"X"},
361 {ICAL_FLOAT_VALUE,"FLOAT"},
362 {ICAL_REQUESTSTATUS_VALUE,"REQUEST-STATUS"},
363 {ICAL_METHOD_VALUE,"METHOD"},
364 {ICAL_BINARY_VALUE,"BINARY"},
365 {ICAL_RECUR_VALUE,"RECUR"},
366 {ICAL_NO_VALUE,""}
367};
368
369
370icalvalue* icalvalue_new_query (const char* v){
371 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE);
372 icalerror_check_arg_rz( (v!=0),"v");
373
374 icalvalue_set_query((icalvalue*)impl,v);
375 return (icalvalue*)impl;
376}
377void icalvalue_set_query(icalvalue* value, const char* v) {
378 struct icalvalue_impl* impl;
379 icalerror_check_arg_rv( (value!=0),"value");
380 icalerror_check_arg_rv( (v!=0),"v");
381
382 icalerror_check_value_type(value, ICAL_QUERY_VALUE);
383 impl = (struct icalvalue_impl*)value;
384 if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
385
386
387 impl->data.v_string = icalmemory_strdup(v);
388
389 if (impl->data.v_string == 0){
390 errno = ENOMEM;
391 }
392
393
394 icalvalue_reset_kind(impl);
395}
396const char* icalvalue_get_query(icalvalue* value) {
397
398 icalerror_check_arg( (value!=0),"value");
399 icalerror_check_value_type(value, ICAL_QUERY_VALUE);
400 return ((struct icalvalue_impl*)value)->data.v_string;
401}
402
403
404
405icalvalue* icalvalue_new_status (enum icalproperty_status v){
406 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE);
407
408 icalvalue_set_status((icalvalue*)impl,v);
409 return (icalvalue*)impl;
410}
411void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) {
412 struct icalvalue_impl* impl;
413 icalerror_check_arg_rv( (value!=0),"value");
414
415 icalerror_check_value_type(value, ICAL_STATUS_VALUE);
416 impl = (struct icalvalue_impl*)value;
417
418
419 impl->data.v_enum = v;
420
421 icalvalue_reset_kind(impl);
422}
423enum icalproperty_status icalvalue_get_status(icalvalue* value) {
424
425 icalerror_check_arg( (value!=0),"value");
426 icalerror_check_value_type(value, ICAL_STATUS_VALUE);
427 return ((struct icalvalue_impl*)value)->data.v_enum;
428}
429
430
431
432icalvalue* icalvalue_new_transp (enum icalproperty_transp v){
433 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE);
434
435 icalvalue_set_transp((icalvalue*)impl,v);
436 return (icalvalue*)impl;
437}
438void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
439 struct icalvalue_impl* impl;
440 icalerror_check_arg_rv( (value!=0),"value");
441
442 icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
443 impl = (struct icalvalue_impl*)value;
444
445
446 impl->data.v_enum = v;
447
448 icalvalue_reset_kind(impl);
449}
450enum icalproperty_transp icalvalue_get_transp(icalvalue* value) {
451
452 icalerror_check_arg( (value!=0),"value");
453 icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
454 return ((struct icalvalue_impl*)value)->data.v_enum;
455}
456
457
458
459icalvalue* icalvalue_new_class (enum icalproperty_class v){
460 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE);
461
462 icalvalue_set_class((icalvalue*)impl,v);
463 return (icalvalue*)impl;
464}
465void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) {
466 struct icalvalue_impl* impl;
467 icalerror_check_arg_rv( (value!=0),"value");
468
469 icalerror_check_value_type(value, ICAL_CLASS_VALUE);
470 impl = (struct icalvalue_impl*)value;
471
472
473 impl->data.v_enum = v;
474
475 icalvalue_reset_kind(impl);
476}
477enum icalproperty_class icalvalue_get_class(icalvalue* value) {
478
479 icalerror_check_arg( (value!=0),"value");
480 icalerror_check_value_type(value, ICAL_CLASS_VALUE);
481 return ((struct icalvalue_impl*)value)->data.v_enum;
482}
483
484
485
486icalvalue* icalvalue_new_date (struct icaltimetype v){
487 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE);
488
489 icalvalue_set_date((icalvalue*)impl,v);
490 return (icalvalue*)impl;
491}
492void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
493 struct icalvalue_impl* impl;
494 icalerror_check_arg_rv( (value!=0),"value");
495
496 icalerror_check_value_type(value, ICAL_DATE_VALUE);
497 impl = (struct icalvalue_impl*)value;
498
499
500 impl->data.v_time = v;
501
502 icalvalue_reset_kind(impl);
503}
504struct icaltimetype icalvalue_get_date(icalvalue* value) {
505
506 icalerror_check_arg( (value!=0),"value");
507 icalerror_check_value_type(value, ICAL_DATE_VALUE);
508 return ((struct icalvalue_impl*)value)->data.v_time;
509}
510
511
512
513icalvalue* icalvalue_new_string (const char* v){
514 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE);
515 icalerror_check_arg_rz( (v!=0),"v");
516
517 icalvalue_set_string((icalvalue*)impl,v);
518 return (icalvalue*)impl;
519}
520void icalvalue_set_string(icalvalue* value, const char* v) {
521 struct icalvalue_impl* impl;
522 icalerror_check_arg_rv( (value!=0),"value");
523 icalerror_check_arg_rv( (v!=0),"v");
524
525 icalerror_check_value_type(value, ICAL_STRING_VALUE);
526 impl = (struct icalvalue_impl*)value;
527 if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
528
529
530 impl->data.v_string = icalmemory_strdup(v);
531
532 if (impl->data.v_string == 0){
533 errno = ENOMEM;
534 }
535
536
537 icalvalue_reset_kind(impl);
538}
539const char* icalvalue_get_string(icalvalue* value) {
540
541 icalerror_check_arg( (value!=0),"value");
542 icalerror_check_value_type(value, ICAL_STRING_VALUE);
543 return ((struct icalvalue_impl*)value)->data.v_string;
544}
545
546
547
548icalvalue* icalvalue_new_integer (int v){
549 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_INTEGER_VALUE);
550
551 icalvalue_set_integer((icalvalue*)impl,v);
552 return (icalvalue*)impl;
553}
554void icalvalue_set_integer(icalvalue* value, int v) {
555 struct icalvalue_impl* impl;
556 icalerror_check_arg_rv( (value!=0),"value");
557
558 icalerror_check_value_type(value, ICAL_INTEGER_VALUE);
559 impl = (struct icalvalue_impl*)value;
560
561
562 impl->data.v_int = v;
563
564 icalvalue_reset_kind(impl);
565}
566int icalvalue_get_integer(icalvalue* value) {
567
568 icalerror_check_arg( (value!=0),"value");
569 icalerror_check_value_type(value, ICAL_INTEGER_VALUE);
570 return ((struct icalvalue_impl*)value)->data.v_int;
571}
572
573
574
575icalvalue* icalvalue_new_period (struct icalperiodtype v){
576 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE);
577
578 icalvalue_set_period((icalvalue*)impl,v);
579 return (icalvalue*)impl;
580}
581void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
582 struct icalvalue_impl* impl;
583 icalerror_check_arg_rv( (value!=0),"value");
584
585 icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
586 impl = (struct icalvalue_impl*)value;
587
588
589 impl->data.v_period = v;
590
591 icalvalue_reset_kind(impl);
592}
593struct icalperiodtype icalvalue_get_period(icalvalue* value) {
594
595 icalerror_check_arg( (value!=0),"value");
596 icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
597 return ((struct icalvalue_impl*)value)->data.v_period;
598}
599
600
601
602icalvalue* icalvalue_new_text (const char* v){
603 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE);
604 icalerror_check_arg_rz( (v!=0),"v");
605
606 icalvalue_set_text((icalvalue*)impl,v);
607 return (icalvalue*)impl;
608}
609void icalvalue_set_text(icalvalue* value, const char* v) {
610 struct icalvalue_impl* impl;
611 icalerror_check_arg_rv( (value!=0),"value");
612 icalerror_check_arg_rv( (v!=0),"v");
613
614 icalerror_check_value_type(value, ICAL_TEXT_VALUE);
615 impl = (struct icalvalue_impl*)value;
616 if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
617
618
619 impl->data.v_string = icalmemory_strdup(v);
620
621 if (impl->data.v_string == 0){
622 errno = ENOMEM;
623 }
624
625
626 icalvalue_reset_kind(impl);
627}
628const char* icalvalue_get_text(icalvalue* value) {
629
630 icalerror_check_arg( (value!=0),"value");
631 icalerror_check_value_type(value, ICAL_TEXT_VALUE);
632 return ((struct icalvalue_impl*)value)->data.v_string;
633}
634
635
636
637icalvalue* icalvalue_new_duration (struct icaldurationtype v){
638 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DURATION_VALUE);
639
640 icalvalue_set_duration((icalvalue*)impl,v);
641 return (icalvalue*)impl;
642}
643void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) {
644 struct icalvalue_impl* impl;
645 icalerror_check_arg_rv( (value!=0),"value");
646
647 icalerror_check_value_type(value, ICAL_DURATION_VALUE);
648 impl = (struct icalvalue_impl*)value;
649
650
651 impl->data.v_duration = v;
652
653 icalvalue_reset_kind(impl);
654}
655struct icaldurationtype icalvalue_get_duration(icalvalue* value) {
656
657 icalerror_check_arg( (value!=0),"value");
658 icalerror_check_value_type(value, ICAL_DURATION_VALUE);
659 return ((struct icalvalue_impl*)value)->data.v_duration;
660}
661
662
663
664icalvalue* icalvalue_new_boolean (int v){
665 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BOOLEAN_VALUE);
666
667 icalvalue_set_boolean((icalvalue*)impl,v);
668 return (icalvalue*)impl;
669}
670void icalvalue_set_boolean(icalvalue* value, int v) {
671 struct icalvalue_impl* impl;
672 icalerror_check_arg_rv( (value!=0),"value");
673
674 icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE);
675 impl = (struct icalvalue_impl*)value;
676
677
678 impl->data.v_int = v;
679
680 icalvalue_reset_kind(impl);
681}
682int icalvalue_get_boolean(icalvalue* value) {
683
684 icalerror_check_arg( (value!=0),"value");
685 icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE);
686 return ((struct icalvalue_impl*)value)->data.v_int;
687}
688
689
690
691icalvalue* icalvalue_new_uri (const char* v){
692 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE);
693 icalerror_check_arg_rz( (v!=0),"v");
694
695 icalvalue_set_uri((icalvalue*)impl,v);
696 return (icalvalue*)impl;
697}
698void icalvalue_set_uri(icalvalue* value, const char* v) {
699 struct icalvalue_impl* impl;
700 icalerror_check_arg_rv( (value!=0),"value");
701 icalerror_check_arg_rv( (v!=0),"v");
702
703 icalerror_check_value_type(value, ICAL_URI_VALUE);
704 impl = (struct icalvalue_impl*)value;
705 if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
706
707
708 impl->data.v_string = icalmemory_strdup(v);
709
710 if (impl->data.v_string == 0){
711 errno = ENOMEM;
712 }
713
714
715 icalvalue_reset_kind(impl);
716}
717const char* icalvalue_get_uri(icalvalue* value) {
718
719 icalerror_check_arg( (value!=0),"value");
720 icalerror_check_value_type(value, ICAL_URI_VALUE);
721 return ((struct icalvalue_impl*)value)->data.v_string;
722}
723
724
725
726icalvalue* icalvalue_new_geo (struct icalgeotype v){
727 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE);
728
729 icalvalue_set_geo((icalvalue*)impl,v);
730 return (icalvalue*)impl;
731}
732void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
733 struct icalvalue_impl* impl;
734 icalerror_check_arg_rv( (value!=0),"value");
735
736 icalerror_check_value_type(value, ICAL_GEO_VALUE);
737 impl = (struct icalvalue_impl*)value;
738
739
740 impl->data.v_geo = v;
741
742 icalvalue_reset_kind(impl);
743}
744struct icalgeotype icalvalue_get_geo(icalvalue* value) {
745
746 icalerror_check_arg( (value!=0),"value");
747 icalerror_check_value_type(value, ICAL_GEO_VALUE);
748 return ((struct icalvalue_impl*)value)->data.v_geo;
749}
750
751
752
753icalvalue* icalvalue_new_datetime (struct icaltimetype v){
754 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIME_VALUE);
755
756 icalvalue_set_datetime((icalvalue*)impl,v);
757 return (icalvalue*)impl;
758}
759void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) {
760 struct icalvalue_impl* impl;
761 icalerror_check_arg_rv( (value!=0),"value");
762
763 icalerror_check_value_type(value, ICAL_DATETIME_VALUE);
764 impl = (struct icalvalue_impl*)value;
765
766
767 impl->data.v_time = v;
768
769 icalvalue_reset_kind(impl);
770}
771struct icaltimetype icalvalue_get_datetime(icalvalue* value) {
772
773 icalerror_check_arg( (value!=0),"value");
774 icalerror_check_value_type(value, ICAL_DATETIME_VALUE);
775 return ((struct icalvalue_impl*)value)->data.v_time;
776}
777
778
779
780icalvalue* icalvalue_new_utcoffset (int v){
781 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_UTCOFFSET_VALUE);
782
783 icalvalue_set_utcoffset((icalvalue*)impl,v);
784 return (icalvalue*)impl;
785}
786void icalvalue_set_utcoffset(icalvalue* value, int v) {
787 struct icalvalue_impl* impl;
788 icalerror_check_arg_rv( (value!=0),"value");
789
790 icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE);
791 impl = (struct icalvalue_impl*)value;
792
793
794 impl->data.v_int = v;
795
796 icalvalue_reset_kind(impl);
797}
798int icalvalue_get_utcoffset(icalvalue* value) {
799
800 icalerror_check_arg( (value!=0),"value");
801 icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE);
802 return ((struct icalvalue_impl*)value)->data.v_int;
803}
804
805
806
807icalvalue* icalvalue_new_action (enum icalproperty_action v){
808 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE);
809
810 icalvalue_set_action((icalvalue*)impl,v);
811 return (icalvalue*)impl;
812}
813void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
814 struct icalvalue_impl* impl;
815 icalerror_check_arg_rv( (value!=0),"value");
816
817 icalerror_check_value_type(value, ICAL_ACTION_VALUE);
818 impl = (struct icalvalue_impl*)value;
819
820
821 impl->data.v_enum = v;
822
823 icalvalue_reset_kind(impl);
824}
825enum icalproperty_action icalvalue_get_action(icalvalue* value) {
826
827 icalerror_check_arg( (value!=0),"value");
828 icalerror_check_value_type(value, ICAL_ACTION_VALUE);
829 return ((struct icalvalue_impl*)value)->data.v_enum;
830}
831
832
833
834icalvalue* icalvalue_new_caladdress (const char* v){
835 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE);
836 icalerror_check_arg_rz( (v!=0),"v");
837
838 icalvalue_set_caladdress((icalvalue*)impl,v);
839 return (icalvalue*)impl;
840}
841void icalvalue_set_caladdress(icalvalue* value, const char* v) {
842 struct icalvalue_impl* impl;
843 icalerror_check_arg_rv( (value!=0),"value");
844 icalerror_check_arg_rv( (v!=0),"v");
845
846 icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
847 impl = (struct icalvalue_impl*)value;
848 if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
849
850
851 impl->data.v_string = icalmemory_strdup(v);
852
853 if (impl->data.v_string == 0){
854 errno = ENOMEM;
855 }
856
857
858 icalvalue_reset_kind(impl);
859}
860const char* icalvalue_get_caladdress(icalvalue* value) {
861
862 icalerror_check_arg( (value!=0),"value");
863 icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
864 return ((struct icalvalue_impl*)value)->data.v_string;
865}
866
867
868
869icalvalue* icalvalue_new_float (float v){
870 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE);
871
872 icalvalue_set_float((icalvalue*)impl,v);
873 return (icalvalue*)impl;
874}
875void icalvalue_set_float(icalvalue* value, float v) {
876 struct icalvalue_impl* impl;
877 icalerror_check_arg_rv( (value!=0),"value");
878
879 icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
880 impl = (struct icalvalue_impl*)value;
881
882
883 impl->data.v_float = v;
884
885 icalvalue_reset_kind(impl);
886}
887float icalvalue_get_float(icalvalue* value) {
888
889 icalerror_check_arg( (value!=0),"value");
890 icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
891 return ((struct icalvalue_impl*)value)->data.v_float;
892}
893
894
895
896icalvalue* icalvalue_new_requeststatus (struct icalreqstattype v){
897 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_REQUESTSTATUS_VALUE);
898
899 icalvalue_set_requeststatus((icalvalue*)impl,v);
900 return (icalvalue*)impl;
901}
902void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v) {
903 struct icalvalue_impl* impl;
904 icalerror_check_arg_rv( (value!=0),"value");
905
906 icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
907 impl = (struct icalvalue_impl*)value;
908
909
910 impl->data.v_requeststatus = v;
911
912 icalvalue_reset_kind(impl);
913}
914struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value) {
915
916 icalerror_check_arg( (value!=0),"value");
917 icalerror_check_value_type(value, ICAL_REQUESTSTATUS_VALUE);
918 return ((struct icalvalue_impl*)value)->data.v_requeststatus;
919}
920
921
922
923icalvalue* icalvalue_new_method (enum icalproperty_method v){
924 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE);
925
926 icalvalue_set_method((icalvalue*)impl,v);
927 return (icalvalue*)impl;
928}
929void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) {
930 struct icalvalue_impl* impl;
931 icalerror_check_arg_rv( (value!=0),"value");
932
933 icalerror_check_value_type(value, ICAL_METHOD_VALUE);
934 impl = (struct icalvalue_impl*)value;
935
936
937 impl->data.v_enum = v;
938
939 icalvalue_reset_kind(impl);
940}
941enum icalproperty_method icalvalue_get_method(icalvalue* value) {
942
943 icalerror_check_arg( (value!=0),"value");
944 icalerror_check_value_type(value, ICAL_METHOD_VALUE);
945 return ((struct icalvalue_impl*)value)->data.v_enum;
946}
947
948
949
950icalvalue* icalvalue_new_binary (const char* v){
951 struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE);
952 icalerror_check_arg_rz( (v!=0),"v");
953
954 icalvalue_set_binary((icalvalue*)impl,v);
955 return (icalvalue*)impl;
956}
957void icalvalue_set_binary(icalvalue* value, const char* v) {
958 struct icalvalue_impl* impl;
959 icalerror_check_arg_rv( (value!=0),"value");
960 icalerror_check_arg_rv( (v!=0),"v");
961
962 icalerror_check_value_type(value, ICAL_BINARY_VALUE);
963 impl = (struct icalvalue_impl*)value;
964 if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
965
966
967 impl->data.v_string = icalmemory_strdup(v);
968
969 if (impl->data.v_string == 0){
970 errno = ENOMEM;
971 }
972
973
974 icalvalue_reset_kind(impl);
975}
976const char* icalvalue_get_binary(icalvalue* value) {
977
978 icalerror_check_arg( (value!=0),"value");
979 icalerror_check_value_type(value, ICAL_BINARY_VALUE);
980 return ((struct icalvalue_impl*)value)->data.v_string;
981}
diff --git a/libical/src/libical/icalderivedvalue.h b/libical/src/libical/icalderivedvalue.h
new file mode 100644
index 0000000..8324f04
--- a/dev/null
+++ b/libical/src/libical/icalderivedvalue.h
@@ -0,0 +1,283 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalvalue.h
4 CREATOR: eric 20 March 1999
5
6
7 $Id$
8 $Locker$
9
10
11
12 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of either:
16
17 The LGPL as published by the Free Software Foundation, version
18 2.1, available at: http://www.fsf.org/copyleft/lesser.html
19
20 Or:
21
22 The Mozilla Public License Version 1.0. You may obtain a copy of
23 the License at http://www.mozilla.org/MPL/
24
25 The original code is icalvalue.h
26
27 ======================================================================*/
28
29#ifndef ICALDERIVEDVALUE_H
30#define ICALDERIVEDVALUE_H
31
32#include "icaltypes.h"
33#include "icalrecur.h"
34#include "icaltime.h"
35#include "icalduration.h"
36#include "icalperiod.h"
37
38typedef void icalvalue;
39
40
41
42void icalvalue_set_x(icalvalue* value, const char* v);
43icalvalue* icalvalue_new_x(const char* v);
44const char* icalvalue_get_x(icalvalue* value);
45
46icalvalue* icalvalue_new_attach (struct icalattachtype* v);
47void icalvalue_set_attach(icalvalue* value, struct icalattachtype* v);
48struct icalattachtype* icalvalue_get_attach(icalvalue* value);
49
50icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
51void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
52struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
53
54icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
55void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
56struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
57
58icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
59void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v);
60struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
61
62void icalvalue_reset_kind(icalvalue* value);
63
64/* Everything below this line is machine generated. Do not edit. */
65typedef enum icalvalue_kind {
66 ICAL_ANY_VALUE=5000,
67 ICAL_QUERY_VALUE=5001,
68 ICAL_TRIGGER_VALUE=5002,
69 ICAL_STATUS_VALUE=5003,
70 ICAL_TRANSP_VALUE=5004,
71 ICAL_CLASS_VALUE=5005,
72 ICAL_DATE_VALUE=5006,
73 ICAL_STRING_VALUE=5007,
74 ICAL_INTEGER_VALUE=5008,
75 ICAL_PERIOD_VALUE=5009,
76 ICAL_TEXT_VALUE=5010,
77 ICAL_DURATION_VALUE=5011,
78 ICAL_BOOLEAN_VALUE=5012,
79 ICAL_URI_VALUE=5013,
80 ICAL_DATETIMEPERIOD_VALUE=5014,
81 ICAL_GEO_VALUE=5015,
82 ICAL_DATETIME_VALUE=5016,
83 ICAL_UTCOFFSET_VALUE=5017,
84 ICAL_ATTACH_VALUE=5018,
85 ICAL_ACTION_VALUE=5019,
86 ICAL_CALADDRESS_VALUE=5020,
87 ICAL_X_VALUE=5021,
88 ICAL_FLOAT_VALUE=5022,
89 ICAL_REQUESTSTATUS_VALUE=5023,
90 ICAL_METHOD_VALUE=5024,
91 ICAL_BINARY_VALUE=5025,
92 ICAL_RECUR_VALUE=5026,
93 ICAL_NO_VALUE=5027
94} icalvalue_kind ;
95
96#define ICALPROPERTY_FIRST_ENUM 10000
97
98typedef enum icalproperty_action {
99 ICAL_ACTION_X = 10000,
100 ICAL_ACTION_AUDIO = 10001,
101 ICAL_ACTION_DISPLAY = 10002,
102 ICAL_ACTION_EMAIL = 10003,
103 ICAL_ACTION_PROCEDURE = 10004,
104 ICAL_ACTION_NONE = 10005
105} icalproperty_action;
106
107typedef enum icalproperty_class {
108 ICAL_CLASS_X = 10006,
109 ICAL_CLASS_PUBLIC = 10007,
110 ICAL_CLASS_PRIVATE = 10008,
111 ICAL_CLASS_CONFIDENTIAL = 10009,
112 ICAL_CLASS_NONE = 10010
113} icalproperty_class;
114
115typedef enum icalproperty_method {
116 ICAL_METHOD_X = 10011,
117 ICAL_METHOD_PUBLISH = 10012,
118 ICAL_METHOD_REQUEST = 10013,
119 ICAL_METHOD_REPLY = 10014,
120 ICAL_METHOD_ADD = 10015,
121 ICAL_METHOD_CANCEL = 10016,
122 ICAL_METHOD_REFRESH = 10017,
123 ICAL_METHOD_COUNTER = 10018,
124 ICAL_METHOD_DECLINECOUNTER = 10019,
125 ICAL_METHOD_CREATE = 10020,
126 ICAL_METHOD_READ = 10021,
127 ICAL_METHOD_RESPONSE = 10022,
128 ICAL_METHOD_MOVE = 10023,
129 ICAL_METHOD_MODIFY = 10024,
130 ICAL_METHOD_GENERATEUID = 10025,
131 ICAL_METHOD_DELETE = 10026,
132 ICAL_METHOD_NONE = 10027
133} icalproperty_method;
134
135typedef enum icalproperty_status {
136 ICAL_STATUS_X = 10028,
137 ICAL_STATUS_TENTATIVE = 10029,
138 ICAL_STATUS_CONFIRMED = 10030,
139 ICAL_STATUS_COMPLETED = 10031,
140 ICAL_STATUS_NEEDSACTION = 10032,
141 ICAL_STATUS_CANCELLED = 10033,
142 ICAL_STATUS_INPROCESS = 10034,
143 ICAL_STATUS_DRAFT = 10035,
144 ICAL_STATUS_FINAL = 10036,
145 ICAL_STATUS_NONE = 10037
146} icalproperty_status;
147
148typedef enum icalproperty_transp {
149 ICAL_TRANSP_X = 10038,
150 ICAL_TRANSP_OPAQUE = 10039,
151 ICAL_TRANSP_TRANSPARENT = 10040,
152 ICAL_TRANSP_NONE = 10041
153} icalproperty_transp;
154
155#define ICALPROPERTY_LAST_ENUM 10042
156
157
158 /* QUERY */
159icalvalue* icalvalue_new_query(const char* v);
160const char* icalvalue_get_query(icalvalue* value);
161void icalvalue_set_query(icalvalue* value, const char* v);
162
163
164 /* STATUS */
165icalvalue* icalvalue_new_status(enum icalproperty_status v);
166enum icalproperty_status icalvalue_get_status(icalvalue* value);
167void icalvalue_set_status(icalvalue* value, enum icalproperty_status v);
168
169
170 /* TRANSP */
171icalvalue* icalvalue_new_transp(enum icalproperty_transp v);
172enum icalproperty_transp icalvalue_get_transp(icalvalue* value);
173void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v);
174
175
176 /* CLASS */
177icalvalue* icalvalue_new_class(enum icalproperty_class v);
178enum icalproperty_class icalvalue_get_class(icalvalue* value);
179void icalvalue_set_class(icalvalue* value, enum icalproperty_class v);
180
181
182 /* DATE */
183icalvalue* icalvalue_new_date(struct icaltimetype v);
184struct icaltimetype icalvalue_get_date(icalvalue* value);
185void icalvalue_set_date(icalvalue* value, struct icaltimetype v);
186
187
188 /* STRING */
189icalvalue* icalvalue_new_string(const char* v);
190const char* icalvalue_get_string(icalvalue* value);
191void icalvalue_set_string(icalvalue* value, const char* v);
192
193
194 /* INTEGER */
195icalvalue* icalvalue_new_integer(int v);
196int icalvalue_get_integer(icalvalue* value);
197void icalvalue_set_integer(icalvalue* value, int v);
198
199
200 /* PERIOD */
201icalvalue* icalvalue_new_period(struct icalperiodtype v);
202struct icalperiodtype icalvalue_get_period(icalvalue* value);
203void icalvalue_set_period(icalvalue* value, struct icalperiodtype v);
204
205
206 /* TEXT */
207icalvalue* icalvalue_new_text(const char* v);
208const char* icalvalue_get_text(icalvalue* value);
209void icalvalue_set_text(icalvalue* value, const char* v);
210
211
212 /* DURATION */
213icalvalue* icalvalue_new_duration(struct icaldurationtype v);
214struct icaldurationtype icalvalue_get_duration(icalvalue* value);
215void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v);
216
217
218 /* BOOLEAN */
219icalvalue* icalvalue_new_boolean(int v);
220int icalvalue_get_boolean(icalvalue* value);
221void icalvalue_set_boolean(icalvalue* value, int v);
222
223
224 /* URI */
225icalvalue* icalvalue_new_uri(const char* v);
226const char* icalvalue_get_uri(icalvalue* value);
227void icalvalue_set_uri(icalvalue* value, const char* v);
228
229
230 /* GEO */
231icalvalue* icalvalue_new_geo(struct icalgeotype v);
232struct icalgeotype icalvalue_get_geo(icalvalue* value);
233void icalvalue_set_geo(icalvalue* value, struct icalgeotype v);
234
235
236 /* DATE-TIME */
237icalvalue* icalvalue_new_datetime(struct icaltimetype v);
238struct icaltimetype icalvalue_get_datetime(icalvalue* value);
239void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v);
240
241
242 /* UTC-OFFSET */
243icalvalue* icalvalue_new_utcoffset(int v);
244int icalvalue_get_utcoffset(icalvalue* value);
245void icalvalue_set_utcoffset(icalvalue* value, int v);
246
247
248 /* ACTION */
249icalvalue* icalvalue_new_action(enum icalproperty_action v);
250enum icalproperty_action icalvalue_get_action(icalvalue* value);
251void icalvalue_set_action(icalvalue* value, enum icalproperty_action v);
252
253
254 /* CAL-ADDRESS */
255icalvalue* icalvalue_new_caladdress(const char* v);
256const char* icalvalue_get_caladdress(icalvalue* value);
257void icalvalue_set_caladdress(icalvalue* value, const char* v);
258
259
260 /* FLOAT */
261icalvalue* icalvalue_new_float(float v);
262float icalvalue_get_float(icalvalue* value);
263void icalvalue_set_float(icalvalue* value, float v);
264
265
266 /* REQUEST-STATUS */
267icalvalue* icalvalue_new_requeststatus(struct icalreqstattype v);
268struct icalreqstattype icalvalue_get_requeststatus(icalvalue* value);
269void icalvalue_set_requeststatus(icalvalue* value, struct icalreqstattype v);
270
271
272 /* METHOD */
273icalvalue* icalvalue_new_method(enum icalproperty_method v);
274enum icalproperty_method icalvalue_get_method(icalvalue* value);
275void icalvalue_set_method(icalvalue* value, enum icalproperty_method v);
276
277
278 /* BINARY */
279icalvalue* icalvalue_new_binary(const char* v);
280const char* icalvalue_get_binary(icalvalue* value);
281void icalvalue_set_binary(icalvalue* value, const char* v);
282
283#endif /*ICALVALUE_H*/
diff --git a/libical/src/libical/icalduration.c b/libical/src/libical/icalduration.c
new file mode 100644
index 0000000..4468e0f
--- a/dev/null
+++ b/libical/src/libical/icalduration.c
@@ -0,0 +1,323 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icaltime.c
4 CREATOR: eric 02 June 2000
5
6 $Id$
7 $Locker$
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The Original Code is eric. The Initial Developer of the Original
23 Code is Eric Busboom
24
25
26 ======================================================================*/
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32#include "icalduration.h"
33
34#include <assert.h>
35#include <string.h>
36#include <stdlib.h>
37#include <stdio.h>
38
39#ifdef ICAL_NO_LIBICAL
40#define icalerror_set_errno(x)
41#define icalerror_check_arg_rv(x,y)
42#define icalerror_check_arg_re(x,y,z)
43#else
44#include "icalerror.h"
45#include "icalmemory.h"
46#endif
47
48
49
50
51/* From Seth Alves, <alves@hungry.com> */
52struct icaldurationtype icaldurationtype_from_int(int t)
53{
54 struct icaldurationtype dur;
55 int used = 0;
56
57 dur = icaldurationtype_null_duration();
58
59 if(t < 0){
60 dur.is_neg = 1;
61 t = -t;
62 }
63
64 if (t % (60 * 60 * 24 * 7) == 0) {
65 dur.weeks = t / (60 * 60 * 24 * 7);
66 } else {
67 used += dur.weeks * (60 * 60 * 24 * 7);
68 dur.days = (t - used) / (60 * 60 * 24);
69 used += dur.days * (60 * 60 * 24);
70 dur.hours = (t - used) / (60 * 60);
71 used += dur.hours * (60 * 60);
72 dur.minutes = (t - used) / (60);
73 used += dur.minutes * (60);
74 dur.seconds = (t - used);
75 }
76
77 return dur;
78}
79
80#ifndef ICAL_NO_LIBICAL
81#include "icalvalue.h"
82struct icaldurationtype icaldurationtype_from_string(const char* str)
83{
84
85 int i;
86 int begin_flag = 0;
87 int time_flag = 0;
88 int date_flag = 0;
89 int week_flag = 0;
90 int digits=-1;
91 int scan_size = -1;
92 int size = strlen(str);
93 char p;
94 struct icaldurationtype d;
95
96 memset(&d, 0, sizeof(struct icaldurationtype));
97
98 for(i=0;i != size;i++){
99 p = str[i];
100
101 switch(p)
102 {
103 case '-': {
104 if(i != 0 || begin_flag == 1) goto error;
105
106 d.is_neg = 1;
107 break;
108 }
109
110 case 'P': {
111 if (i != 0 && i !=1 ) goto error;
112 begin_flag = 1;
113 break;
114 }
115
116 case 'T': {
117 time_flag = 1;
118 break;
119 }
120
121 case '0':
122 case '1':
123 case '2':
124 case '3':
125 case '4':
126 case '5':
127 case '6':
128 case '7':
129 case '8':
130 case '9':
131 {
132
133 /* HACK. Skip any more digits if the l;ast one
134 read has not been assigned */
135 if(digits != -1){
136 break;
137 }
138
139 if (begin_flag == 0) goto error;
140 /* Get all of the digits, not one at a time */
141 scan_size = sscanf((char*)(str+i),"%d",&digits);
142 if(scan_size == 0) goto error;
143 break;
144 }
145
146 case 'H': {
147 if (time_flag == 0||week_flag == 1||d.hours !=0||digits ==-1)
148 goto error;
149 d.hours = digits; digits = -1;
150 break;
151 }
152 case 'M': {
153 if (time_flag == 0||week_flag==1||d.minutes != 0||digits ==-1)
154 goto error;
155 d.minutes = digits; digits = -1;
156 break;
157 }
158 case 'S': {
159 if (time_flag == 0||week_flag==1||d.seconds!=0||digits ==-1)
160 goto error;
161 d.seconds = digits; digits = -1;
162 break;
163 }
164 case 'W': {
165 if (time_flag==1||date_flag==1||d.weeks!=0||digits ==-1)
166 goto error;
167 week_flag = 1;
168 d.weeks = digits; digits = -1;
169 break;
170 }
171 case 'D': {
172 if (time_flag==1||week_flag==1||d.days!=0||digits ==-1)
173 goto error;
174 date_flag = 1;
175 d.days = digits; digits = -1;
176 break;
177 }
178 default: {
179 goto error;
180 }
181
182 }
183 }
184
185 return d;
186
187
188 error:
189 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
190 memset(&d, 0, sizeof(struct icaldurationtype));
191 return d;
192
193}
194
195#define TMP_BUF_SIZE 1024
196void append_duration_segment(char** buf, char** buf_ptr, size_t* buf_size,
197 char* sep, unsigned int value) {
198
199 char temp[TMP_BUF_SIZE];
200
201 sprintf(temp,"%d",value);
202
203 icalmemory_append_string(buf, buf_ptr, buf_size, temp);
204 icalmemory_append_string(buf, buf_ptr, buf_size, sep);
205
206}
207
208char* icaldurationtype_as_ical_string(struct icaldurationtype d)
209{
210
211 char *buf, *output_line;
212 size_t buf_size = 256;
213 char* buf_ptr = 0;
214 int seconds;
215
216 buf = (char*)icalmemory_new_buffer(buf_size);
217 buf_ptr = buf;
218
219
220 seconds = icaldurationtype_as_int(d);
221
222 if(seconds !=0){
223
224 if(d.is_neg == 1){
225 icalmemory_append_char(&buf, &buf_ptr, &buf_size, '-');
226 }
227
228 icalmemory_append_char(&buf, &buf_ptr, &buf_size, 'P');
229
230 if (d.weeks != 0 ) {
231 append_duration_segment(&buf, &buf_ptr, &buf_size, "W", d.weeks);
232 }
233
234 if (d.days != 0 ) {
235 append_duration_segment(&buf, &buf_ptr, &buf_size, "D", d.days);
236 }
237
238 if (d.hours != 0 || d.minutes != 0 || d.seconds != 0) {
239
240 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "T");
241
242 if (d.hours != 0 ) {
243 append_duration_segment(&buf, &buf_ptr, &buf_size, "H", d.hours);
244 }
245 if (d.minutes != 0 ) {
246 append_duration_segment(&buf, &buf_ptr, &buf_size, "M",
247 d.minutes);
248 }
249 if (d.seconds != 0 ) {
250 append_duration_segment(&buf, &buf_ptr, &buf_size, "S",
251 d.seconds);
252 }
253
254 }
255 } else {
256 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "PTS0");
257 }
258
259 output_line = icalmemory_tmp_copy(buf);
260 icalmemory_free_buffer(buf);
261
262 return output_line;
263
264}
265
266#endif
267
268
269/* From Russel Steinthal */
270int icaldurationtype_as_int(struct icaldurationtype dur)
271{
272 return (int)( (dur.seconds +
273 (60 * dur.minutes) +
274 (60 * 60 * dur.hours) +
275 (60 * 60 * 24 * dur.days) +
276 (60 * 60 * 24 * 7 * dur.weeks))
277 * (dur.is_neg==1? -1 : 1) ) ;
278}
279
280struct icaldurationtype icaldurationtype_null_duration()
281{
282 struct icaldurationtype d;
283
284 memset(&d,0,sizeof(struct icaldurationtype));
285
286 return d;
287}
288
289int icaldurationtype_is_null_duration(struct icaldurationtype d)
290{
291 if(icaldurationtype_as_int(d) == 0){
292 return 1;
293 } else {
294 return 0;
295 }
296}
297
298
299
300struct icaltimetype icaltime_add(struct icaltimetype t,
301 struct icaldurationtype d)
302{
303 int dt = icaldurationtype_as_int(d);
304
305 t.second += dt;
306
307 t = icaltime_normalize(t);
308
309 return t;
310}
311
312struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
313 struct icaltimetype t2)
314{
315
316 time_t t1t = icaltime_as_timet(t1);
317 time_t t2t = icaltime_as_timet(t2);
318
319 return icaldurationtype_from_int(t1t-t2t);
320
321
322}
323
diff --git a/libical/src/libical/icalduration.h b/libical/src/libical/icalduration.h
new file mode 100644
index 0000000..dd6e311
--- a/dev/null
+++ b/libical/src/libical/icalduration.h
@@ -0,0 +1,60 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalduration.h
4 CREATOR: eric 26 Jan 2001
5
6
7 $Id$
8 $Locker$
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The Original Code is eric. The Initial Developer of the Original
24 Code is Eric Busboom
25
26
27======================================================================*/
28
29#ifndef ICALDURATION_H
30#define ICALDURATION_H
31
32#include "icaltime.h"
33
34struct icaldurationtype
35{
36 int is_neg;
37 unsigned int days;
38 unsigned int weeks;
39 unsigned int hours;
40 unsigned int minutes;
41 unsigned int seconds;
42};
43
44struct icaldurationtype icaldurationtype_from_int(int t);
45struct icaldurationtype icaldurationtype_from_string(const char*);
46int icaldurationtype_as_int(struct icaldurationtype duration);
47char* icaldurationtype_as_ical_string(struct icaldurationtype d);
48struct icaldurationtype icaldurationtype_null_duration();
49int icaldurationtype_is_null_duration(struct icaldurationtype d);
50
51struct icaltimetype icaltime_add(struct icaltimetype t,
52 struct icaldurationtype d);
53
54struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
55 struct icaltimetype t2);
56
57#endif /* !ICALDURATION_H */
58
59
60
diff --git a/libical/src/libical/icalenums.c b/libical/src/libical/icalenums.c
new file mode 100644
index 0000000..6751933
--- a/dev/null
+++ b/libical/src/libical/icalenums.c
@@ -0,0 +1,135 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalenum.c
4 CREATOR: eric 29 April 1999
5
6 $Id$
7
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The original code is icalenum.c
23
24 ======================================================================*/
25
26
27#ifdef HAVE_CONFIG_H
28#include "config.h"
29#endif
30
31#include "icalenums.h"
32
33#include <stdio.h> /* For fprintf */
34#include <stdio.h> /* For stderr */
35#include <string.h> /* For strncmp */
36#include <assert.h>
37
38
39
40struct {
41 enum icalrequeststatus kind;
42 int major;
43 int minor;
44 const char* str;
45} request_status_map[] = {
46 {ICAL_2_0_SUCCESS_STATUS, 2,0,"Success."},
47 {ICAL_2_1_FALLBACK_STATUS, 2,1,"Success but fallback taken on one or more property values."},
48 {ICAL_2_2_IGPROP_STATUS, 2,2,"Success, invalid property ignored."},
49 {ICAL_2_3_IGPARAM_STATUS, 2,3,"Success, invalid property parameter ignored."},
50 {ICAL_2_4_IGXPROP_STATUS, 2,4,"Success, unknown non-standard property ignored."},
51 {ICAL_2_5_IGXPARAM_STATUS, 2,5,"Success, unknown non standard property value ignored."},
52 {ICAL_2_6_IGCOMP_STATUS, 2,6,"Success, invalid calendar component ignored."},
53 {ICAL_2_7_FORWARD_STATUS, 2,7,"Success, request forwarded to Calendar User."},
54 {ICAL_2_8_ONEEVENT_STATUS, 2,8,"Success, repeating event ignored. Scheduled as a single component."},
55 {ICAL_2_9_TRUNC_STATUS, 2,9,"Success, truncated end date time to date boundary."},
56 {ICAL_2_10_ONETODO_STATUS, 2,10,"Success, repeating VTODO ignored. Scheduled as a single VTODO."},
57 {ICAL_2_11_TRUNCRRULE_STATUS, 2,11,"Success, unbounded RRULE clipped at some finite number of instances "},
58 {ICAL_3_0_INVPROPNAME_STATUS, 3,0,"Invalid property name."},
59 {ICAL_3_1_INVPROPVAL_STATUS, 3,1,"Invalid property value."},
60 {ICAL_3_2_INVPARAM_STATUS, 3,2,"Invalid property parameter."},
61 {ICAL_3_3_INVPARAMVAL_STATUS, 3,3,"Invalid property parameter value."},
62 {ICAL_3_4_INVCOMP_STATUS, 3,4,"Invalid calendar component."},
63 {ICAL_3_5_INVTIME_STATUS, 3,5,"Invalid date or time."},
64 {ICAL_3_6_INVRULE_STATUS, 3,6,"Invalid rule."},
65 {ICAL_3_7_INVCU_STATUS, 3,7,"Invalid Calendar User."},
66 {ICAL_3_8_NOAUTH_STATUS, 3,8,"No authority."},
67 {ICAL_3_9_BADVERSION_STATUS, 3,9,"Unsupported version."},
68 {ICAL_3_10_TOOBIG_STATUS, 3,10,"Request entity too large."},
69 {ICAL_3_11_MISSREQCOMP_STATUS, 3,11,"Required component or property missing."},
70 {ICAL_3_12_UNKCOMP_STATUS, 3,12,"Unknown component or property found."},
71 {ICAL_3_13_BADCOMP_STATUS, 3,13,"Unsupported component or property found"},
72 {ICAL_3_14_NOCAP_STATUS, 3,14,"Unsupported capability."},
73 {ICAL_4_0_BUSY_STATUS, 4,0,"Event conflict. Date/time is busy."},
74 {ICAL_5_0_MAYBE_STATUS, 5,0,"Request MAY supported."},
75 {ICAL_5_1_UNAVAIL_STATUS, 5,1,"Service unavailable."},
76 {ICAL_5_2_NOSERVICE_STATUS, 5,2,"Invalid calendar service."},
77 {ICAL_5_3_NOSCHED_STATUS, 5,3,"No scheduling support for user."},
78 {ICAL_UNKNOWN_STATUS, 0,0,"Error: Unknown request status"}
79};
80
81
82const char* icalenum_reqstat_desc(icalrequeststatus stat)
83{
84
85 int i;
86
87 for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
88 if ( request_status_map[i].kind == stat) {
89 return request_status_map[i].str;
90 }
91 }
92
93 return 0;
94}
95
96
97short icalenum_reqstat_major(icalrequeststatus stat)
98{
99 int i;
100
101 for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
102 if ( request_status_map[i].kind == stat) {
103 return request_status_map[i].major;
104 }
105 }
106 return -1;
107}
108
109short icalenum_reqstat_minor(icalrequeststatus stat)
110{
111 int i;
112
113 for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
114 if ( request_status_map[i].kind == stat) {
115 return request_status_map[i].minor;
116 }
117 }
118 return -1;
119}
120
121
122icalrequeststatus icalenum_num_to_reqstat(short major, short minor)
123{
124 int i;
125
126 for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
127 if ( request_status_map[i].major == major && request_status_map[i].minor == minor) {
128 return request_status_map[i].kind;
129 }
130 }
131 return 0;
132}
133
134
135
diff --git a/libical/src/libical/icalenums.h b/libical/src/libical/icalenums.h
new file mode 100644
index 0000000..21031dd
--- a/dev/null
+++ b/libical/src/libical/icalenums.h
@@ -0,0 +1,157 @@
1
2/* -*- Mode: C -*-*/
3/*======================================================================
4 FILE: icalenums.h
5
6
7
8 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of either:
12
13 The LGPL as published by the Free Software Foundation, version
14 2.1, available at: http://www.fsf.org/copyleft/lesser.html
15
16 Or:
17
18 The Mozilla Public License Version 1.0. You may obtain a copy of
19 the License at http://www.mozilla.org/MPL/
20
21 The original code is icalenums.h
22
23 Contributions from:
24 Graham Davison (g.m.davison@computer.org)
25
26======================================================================*/
27
28#ifndef ICALENUMS_H
29#define ICALENUMS_H
30
31
32
33/***********************************************************************
34 * Component enumerations
35**********************************************************************/
36
37typedef enum icalcomponent_kind {
38 ICAL_NO_COMPONENT,
39 ICAL_ANY_COMPONENT,/* Used to select all components*/
40 ICAL_XROOT_COMPONENT,
41 ICAL_XATTACH_COMPONENT, /* MIME attached data, returned by parser. */
42 ICAL_VEVENT_COMPONENT,
43 ICAL_VTODO_COMPONENT,
44 ICAL_VJOURNAL_COMPONENT,
45 ICAL_VCALENDAR_COMPONENT,
46 ICAL_VFREEBUSY_COMPONENT,
47 ICAL_VALARM_COMPONENT,
48 ICAL_XAUDIOALARM_COMPONENT,
49 ICAL_XDISPLAYALARM_COMPONENT,
50 ICAL_XEMAILALARM_COMPONENT,
51 ICAL_XPROCEDUREALARM_COMPONENT,
52 ICAL_VTIMEZONE_COMPONENT,
53 ICAL_XSTANDARD_COMPONENT,
54 ICAL_XDAYLIGHT_COMPONENT,
55 ICAL_X_COMPONENT,
56 ICAL_VSCHEDULE_COMPONENT,
57 ICAL_VQUERY_COMPONENT,
58 ICAL_VCAR_COMPONENT,
59 ICAL_VCOMMAND_COMPONENT,
60 ICAL_XLICINVALID_COMPONENT,
61 ICAL_XLICMIMEPART_COMPONENT /* a non-stardard component that mirrors
62 structure of MIME data */
63
64} icalcomponent_kind;
65
66
67
68/***********************************************************************
69 * Request Status codes
70 **********************************************************************/
71
72typedef enum icalrequeststatus {
73 ICAL_UNKNOWN_STATUS,
74 ICAL_2_0_SUCCESS_STATUS,
75 ICAL_2_1_FALLBACK_STATUS,
76 ICAL_2_2_IGPROP_STATUS,
77 ICAL_2_3_IGPARAM_STATUS,
78 ICAL_2_4_IGXPROP_STATUS,
79 ICAL_2_5_IGXPARAM_STATUS,
80 ICAL_2_6_IGCOMP_STATUS,
81 ICAL_2_7_FORWARD_STATUS,
82 ICAL_2_8_ONEEVENT_STATUS,
83 ICAL_2_9_TRUNC_STATUS,
84 ICAL_2_10_ONETODO_STATUS,
85 ICAL_2_11_TRUNCRRULE_STATUS,
86 ICAL_3_0_INVPROPNAME_STATUS,
87 ICAL_3_1_INVPROPVAL_STATUS,
88 ICAL_3_2_INVPARAM_STATUS,
89 ICAL_3_3_INVPARAMVAL_STATUS,
90 ICAL_3_4_INVCOMP_STATUS,
91 ICAL_3_5_INVTIME_STATUS,
92 ICAL_3_6_INVRULE_STATUS,
93 ICAL_3_7_INVCU_STATUS,
94 ICAL_3_8_NOAUTH_STATUS,
95 ICAL_3_9_BADVERSION_STATUS,
96 ICAL_3_10_TOOBIG_STATUS,
97 ICAL_3_11_MISSREQCOMP_STATUS,
98 ICAL_3_12_UNKCOMP_STATUS,
99 ICAL_3_13_BADCOMP_STATUS,
100 ICAL_3_14_NOCAP_STATUS,
101 ICAL_4_0_BUSY_STATUS,
102 ICAL_5_0_MAYBE_STATUS,
103 ICAL_5_1_UNAVAIL_STATUS,
104 ICAL_5_2_NOSERVICE_STATUS,
105 ICAL_5_3_NOSCHED_STATUS
106} icalrequeststatus;
107
108
109const char* icalenum_reqstat_desc(icalrequeststatus stat);
110short icalenum_reqstat_major(icalrequeststatus stat);
111short icalenum_reqstat_minor(icalrequeststatus stat);
112icalrequeststatus icalenum_num_to_reqstat(short major, short minor);
113
114/***********************************************************************
115 * Conversion functions
116**********************************************************************/
117
118
119/* Thse routines used to be in icalenums.c, but were moved into the
120 icalproperty, icalparameter, icalvalue, or icalcomponent modules. */
121
122/* const char* icalproperty_kind_to_string(icalproperty_kind kind);*/
123#define icalenum_property_kind_to_string(x) icalproperty_kind_to_string(x)
124
125/*icalproperty_kind icalproperty_string_to_kind(const char* string)*/
126#define icalenum_string_to_property_kind(x) icalproperty_string_to_kind(x)
127
128/*icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);*/
129#define icalenum_property_kind_to_value_kind(x) icalproperty_kind_to_value_kind(x)
130
131/*const char* icalenum_method_to_string(icalproperty_method);*/
132#define icalenum_method_to_string(x) icalproperty_method_to_string(x)
133
134/*icalproperty_method icalenum_string_to_method(const char* string);*/
135#define icalenum_string_to_method(x) icalproperty_string_to_method(x)
136
137/*const char* icalenum_status_to_string(icalproperty_status);*/
138#define icalenum_status_to_string(x) icalproperty_status_to_string(x)
139
140/*icalproperty_status icalenum_string_to_status(const char* string);*/
141#define icalenum_string_to_status(x) icalproperty_string_to_status(x)
142
143/*icalvalue_kind icalenum_string_to_value_kind(const char* str);*/
144#define icalenum_string_to_value_kind(x) icalvalue_string_to_kind(x)
145
146/*const char* icalenum_value_kind_to_string(icalvalue_kind kind);*/
147#define icalenum_value_kind_to_string(x) icalvalue_kind_to_string(x)
148
149/*const char* icalenum_component_kind_to_string(icalcomponent_kind kind);*/
150#define icalenum_component_kind_to_string(x) icalcomponent_kind_to_string(x)
151
152/*icalcomponent_kind icalenum_string_to_component_kind(const char* string);*/
153#define icalenum_string_to_component_kind(x) icalcomponent_string_to_kind(x)
154
155
156#endif /* !ICALENUMS_H */
157
diff --git a/libical/src/libical/icalerror.c b/libical/src/libical/icalerror.c
new file mode 100644
index 0000000..d44d37a
--- a/dev/null
+++ b/libical/src/libical/icalerror.c
@@ -0,0 +1,209 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalerror.c
4 CREATOR: eric 16 May 1999
5
6 $Id$
7 $Locker$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icalerror.c
24
25 ======================================================================*/
26
27
28#ifdef HAVE_CONFIG_H
29#include "config.h"
30#endif
31
32#include "icalerror.h"
33
34#include <string.h>
35
36icalerrorenum icalerrno;
37
38int foo;
39void icalerror_stop_here(void)
40{
41 foo++; /* Keep optimizers from removing routine */
42}
43
44void icalerror_crash_here(void)
45{
46 int *p=0;
47 *p = 1;
48
49 assert( *p);
50}
51
52#ifdef ICAL_SETERROR_ISFUNC
53void icalerror_set_errno(icalerrorenum x)
54{
55 icalerrno = x;
56 if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL ||
57 (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT &&
58 icalerror_errors_are_fatal == 1 )){
59 icalerror_warn(icalerror_strerror(x));
60 assert(0);
61 }
62
63}
64#endif
65
66void icalerror_clear_errno() {
67
68 icalerrno = ICAL_NO_ERROR;
69}
70
71#ifdef ICAL_ERRORS_ARE_FATAL
72int icalerror_errors_are_fatal = 1;
73#else
74int icalerror_errors_are_fatal = 0;
75#endif
76
77struct icalerror_state {
78 icalerrorenum error;
79 icalerrorstate state;
80};
81
82struct icalerror_state error_state_map[] =
83{
84 { ICAL_BADARG_ERROR,ICAL_ERROR_DEFAULT},
85 { ICAL_NEWFAILED_ERROR,ICAL_ERROR_DEFAULT},
86 { ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_DEFAULT},
87 { ICAL_PARSE_ERROR,ICAL_ERROR_DEFAULT},
88 { ICAL_INTERNAL_ERROR,ICAL_ERROR_DEFAULT},
89 { ICAL_FILE_ERROR,ICAL_ERROR_DEFAULT},
90 { ICAL_USAGE_ERROR,ICAL_ERROR_DEFAULT},
91 { ICAL_UNIMPLEMENTED_ERROR,ICAL_ERROR_DEFAULT},
92 { ICAL_UNKNOWN_ERROR,ICAL_ERROR_DEFAULT},
93 { ICAL_NO_ERROR,ICAL_ERROR_DEFAULT}
94
95};
96
97struct icalerror_string_map {
98 const char* str;
99 icalerrorenum error;
100 char name[160];
101};
102
103static struct icalerror_string_map string_map[] =
104{
105 {"BADARG",ICAL_BADARG_ERROR,"BADARG: Bad argument to function"},
106 { "NEWFAILED",ICAL_NEWFAILED_ERROR,"NEWFAILED: Failed to create a new object via a *_new() routine"},
107 {"MALFORMEDDATA",ICAL_MALFORMEDDATA_ERROR,"MALFORMEDDATA: An input string was not correctly formed or a component has missing or extra properties"},
108 { "PARSE",ICAL_PARSE_ERROR,"PARSE: Failed to parse a part of an iCal component"},
109 {"INTERNAL",ICAL_INTERNAL_ERROR,"INTERNAL: Random internal error. This indicates an error in the library code, not an error in use"},
110 { "FILE",ICAL_FILE_ERROR,"FILE: An operation on a file failed. Check errno for more detail."},
111 { "USAGE",ICAL_USAGE_ERROR,"USAGE: Failed to propertyl sequence calls to a set of interfaces"},
112 { "UNIMPLEMENTED",ICAL_UNIMPLEMENTED_ERROR,"UNIMPLEMENTED: This feature has not been implemented"},
113 { "NO",ICAL_NO_ERROR,"NO: No error"},
114 {"UNKNOWN",ICAL_UNKNOWN_ERROR,"UNKNOWN: Unknown error type -- icalerror_strerror() was probably given bad input"}
115};
116
117
118icalerrorenum icalerror_error_from_string(const char* str){
119
120 icalerrorenum e;
121 int i = 0;
122
123 for( i = 0; string_map[i].error != ICAL_NO_ERROR; i++){
124 if (strcmp(string_map[i].str,str) == 0){
125 e = string_map[i].error;
126 }
127 }
128
129 return e;
130}
131
132icalerrorstate icalerror_supress(const char* error){
133
134 icalerrorenum e = icalerror_error_from_string(error);
135 icalerrorstate es;
136
137 if (e == ICAL_NO_ERROR){
138 return ICAL_ERROR_UNKNOWN;
139 }
140
141
142 es = icalerror_get_error_state(e);
143 icalerror_set_error_state(e,ICAL_ERROR_NONFATAL);
144
145 return es;
146}
147
148char* icalerror_perror()
149{
150 return icalerror_strerror(icalerrno);
151}
152
153void icalerror_restore(const char* error, icalerrorstate es){
154
155
156 icalerrorenum e = icalerror_error_from_string(error);
157
158 if (e != ICAL_NO_ERROR){
159 icalerror_set_error_state(e,es);
160 }
161
162}
163
164
165
166void icalerror_set_error_state( icalerrorenum error,
167 icalerrorstate state)
168{
169 int i;
170
171 for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){
172 if(error_state_map[i].error == error){
173 error_state_map[i].state = state;
174 }
175 }
176}
177
178icalerrorstate icalerror_get_error_state( icalerrorenum error)
179{
180 int i;
181
182 for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){
183 if(error_state_map[i].error == error){
184 return error_state_map[i].state;
185 }
186 }
187
188 return ICAL_ERROR_UNKNOWN;
189}
190
191
192
193
194char* icalerror_strerror(icalerrorenum e) {
195
196 int i;
197
198 for (i=0; string_map[i].error != ICAL_UNKNOWN_ERROR; i++) {
199 if (string_map[i].error == e) {
200 return string_map[i].name;
201 }
202 }
203
204 return string_map[i].name; /* Return string for ICAL_UNKNOWN_ERROR*/
205
206}
207
208
209
diff --git a/libical/src/libical/icalerror.h b/libical/src/libical/icalerror.h
new file mode 100644
index 0000000..52f5ba9
--- a/dev/null
+++ b/libical/src/libical/icalerror.h
@@ -0,0 +1,156 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalerror.h
4 CREATOR: eric 09 May 1999
5
6 $Id$
7
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The original code is icalerror.h
23
24======================================================================*/
25
26
27#ifndef ICALERROR_H
28#define ICALERROR_H
29
30#include <assert.h>
31#include <stdio.h> /* For icalerror_warn() */
32
33
34#ifdef HAVE_CONFIG_H
35#include "config.h"
36#endif
37
38#define ICAL_SETERROR_ISFUNC
39
40
41/* This routine is called before any error is triggered. It is called
42 by icalerror_set_errno, so it does not appear in all of the macros
43 below */
44void icalerror_stop_here(void);
45
46void icalerror_crash_here(void);
47
48typedef enum icalerrorenum {
49
50 ICAL_BADARG_ERROR,
51 ICAL_NEWFAILED_ERROR,
52 ICAL_ALLOCATION_ERROR,
53 ICAL_MALFORMEDDATA_ERROR,
54 ICAL_PARSE_ERROR,
55 ICAL_INTERNAL_ERROR, /* Like assert --internal consist. prob */
56 ICAL_FILE_ERROR,
57 ICAL_USAGE_ERROR,
58 ICAL_UNIMPLEMENTED_ERROR,
59 ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/
60 ICAL_NO_ERROR
61
62} icalerrorenum;
63
64/* The libical error enumeration, like errno*/
65extern icalerrorenum icalerrno;
66
67/* If true, libicl aborts after a call to icalerror_set_error*/
68extern int icalerror_errors_are_fatal;
69
70/* Warning messages */
71
72#ifdef __GNUC__ca
73#define icalerror_warn(message) {fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);}
74#else /* __GNU_C__ */
75#define icalerror_warn(message) {fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);}
76#endif /* __GNU_C__ */
77
78
79void icalerror_clear_errno(void);
80
81/* Make an individual error fatal or non-fatal. */
82typedef enum icalerrorstate {
83 ICAL_ERROR_FATAL, /* Not fata */
84 ICAL_ERROR_NONFATAL, /* Fatal */
85 ICAL_ERROR_DEFAULT, /* Use the value of icalerror_errors_are_fatal*/
86 ICAL_ERROR_UNKNOWN /* Asked state for an unknown error type */
87} icalerrorstate ;
88
89char* icalerror_strerror(icalerrorenum e);
90char* icalerror_perror();
91void icalerror_set_error_state( icalerrorenum error, icalerrorstate);
92icalerrorstate icalerror_get_error_state( icalerrorenum error);
93
94#ifndef ICAL_SETERROR_ISFUNC
95#define icalerror_set_errno(x) \
96icalerrno = x; \
97if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \
98 (icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \
99 icalerror_errors_are_fatal == 1 )){ \
100 icalerror_warn(icalerror_strerror(x)); \
101 assert(0); \
102}
103#else
104void icalerror_set_errno(icalerrorenum);
105#endif
106
107#ifdef ICAL_ERRORS_ARE_FATAL
108#undef NDEBUG
109#endif
110
111#define icalerror_check_value_type(value,type);
112#define icalerror_check_property_type(value,type);
113#define icalerror_check_parameter_type(value,type);
114#define icalerror_check_component_type(value,type);
115
116/* Assert with a message */
117#ifdef ICAL_ERRORS_ARE_FATAL
118
119#ifdef __GNUC__
120#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);icalerror_stop_here(); abort();}
121#else /*__GNUC__*/
122#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);icalerror_stop_here(); abort();}
123#endif /*__GNUC__*/
124
125#else /* ICAL_ERRORS_ARE_FATAL */
126#define icalerror_assert(test,message)
127#endif /* ICAL_ERRORS_ARE_FATAL */
128
129/* Check & abort if check fails */
130#define icalerror_check_arg(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); }
131
132/* Check & return void if check fails*/
133#define icalerror_check_arg_rv(test,arg) if(!(test)) {icalerror_set_errno(ICAL_BADARG_ERROR); return; }
134
135/* Check & return 0 if check fails*/
136#define icalerror_check_arg_rz(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return 0;}
137
138/* Check & return an error if check fails*/
139#define icalerror_check_arg_re(test,arg,error) if(!(test)) { icalerror_stop_here(); assert(0); return error;}
140
141/* Check & return something*/
142#define icalerror_check_arg_rx(test,arg,x) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return x;}
143
144
145
146/* String interfaces to set an error to NONFATAL and restore it to its
147 original value */
148
149icalerrorstate icalerror_supress(const char* error);
150void icalerror_restore(const char* error, icalerrorstate es);
151
152
153#endif /* !ICALERROR_H */
154
155
156
diff --git a/libical/src/libical/icallangbind.c b/libical/src/libical/icallangbind.c
new file mode 100644
index 0000000..c079034
--- a/dev/null
+++ b/libical/src/libical/icallangbind.c
@@ -0,0 +1,275 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icallangbind.c
4 CREATOR: eric 15 dec 2000
5
6 DESCRIPTION:
7
8 $Id$
9 $Locker$
10
11 (C) COPYRIGHT 1999 Eric Busboom
12 http://www.softwarestudio.org
13
14 This package is free software and is provided "as is" without
15 express or implied warranty. It may be used, redistributed and/or
16 modified under the same terms as perl itself. ( Either the Artistic
17 License or the GPL. )
18
19 ======================================================================*/
20
21#include "icalcomponent.h"
22#include "icalproperty.h"
23#include "icalerror.h"
24#include "icalmemory.h"
25#include <stdlib.h>
26#include <string.h>
27#include <stdio.h>
28
29int snprintf(char *str, size_t n, char const *fmt, ...);
30
31int* icallangbind_new_array(int size){
32 int* p = (int*)malloc(size*sizeof(int));
33 return p; /* Caller handles failures */
34}
35
36void icallangbind_free_array(int* array){
37 free(array);
38}
39
40int icallangbind_access_array(int* array, int index) {
41 return array[index];
42}
43
44
45
46/* LIke icalcomponent_get_first_component, buut takes a string for the
47 kind and can iterate over X properties as if each X name was a
48 seperate kind */
49icalproperty* icallangbind_get_first_property(icalcomponent *c,
50 const char* prop)
51{
52 icalproperty_kind kind = icalproperty_string_to_kind(prop);
53 icalproperty *p;
54
55 if (kind == ICAL_NO_PROPERTY){
56 return 0;
57 }
58
59 if(kind == ICAL_X_PROPERTY){
60 for(p = icalcomponent_get_first_property(c,kind);
61 p !=0;
62 p = icalcomponent_get_next_property(c,kind)){
63
64 if(strcmp(icalproperty_get_x_name(p),prop) == 0){
65 return p;
66 }
67 }
68 } else {
69 p=icalcomponent_get_first_property(c,kind);
70
71 return p;
72 }
73
74 return 0;
75
76}
77
78icalproperty* icallangbind_get_next_property(icalcomponent *c,
79 const char* prop)
80{
81 icalproperty_kind kind = icalenum_string_to_property_kind(prop);
82 icalproperty *p;
83
84 if (kind == ICAL_NO_PROPERTY){
85 return 0;
86 }
87
88 if(kind == ICAL_X_PROPERTY){
89 for(p = icalcomponent_get_next_property(c,kind);
90 p !=0;
91 p = icalcomponent_get_next_property(c,kind)){
92
93 if(strcmp(icalproperty_get_x_name(p),prop) == 0){
94 return p;
95 }
96 }
97 } else {
98 p=icalcomponent_get_next_property(c,kind);
99
100 return p;
101 }
102
103 return 0;
104
105}
106
107
108icalcomponent* icallangbind_get_first_component(icalcomponent *c,
109 const char* comp)
110{
111 icalcomponent_kind kind = icalenum_string_to_component_kind(comp);
112
113 if (kind == ICAL_NO_COMPONENT){
114 return 0;
115 }
116 return icalcomponent_get_first_component(c,kind);
117}
118
119icalcomponent* icallangbind_get_next_component(icalcomponent *c,
120 const char* comp)
121{
122 icalcomponent_kind kind = icalenum_string_to_component_kind(comp);
123
124 if (kind == ICAL_NO_COMPONENT){
125 return 0;
126 }
127 return icalcomponent_get_next_component(c,kind);
128}
129
130
131#define APPENDS(x) icalmemory_append_string(&buf, &buf_ptr, &buf_size, x);
132
133#define APPENDC(x) icalmemory_append_char(&buf, &buf_ptr, &buf_size, x);
134
135const char* icallangbind_property_eval_string(icalproperty* prop, char* sep)
136{
137 char tmp[25];
138 size_t buf_size = 1024;
139 char* buf = icalmemory_new_buffer(buf_size);
140 char* buf_ptr = buf;
141 icalparameter *param;
142
143 icalvalue* value;
144
145 if( prop == 0){
146 return 0;
147 }
148
149 APPENDS("{ ");
150
151 value = icalproperty_get_value(prop);
152
153 APPENDS(" 'name' ");
154 APPENDS(sep);
155 APPENDC('\'');
156 APPENDS(icalenum_property_kind_to_string(icalproperty_isa(prop)));
157 APPENDC('\'');
158
159 if(value){
160 APPENDS(", 'value_type' ");
161 APPENDS(sep);
162 APPENDC('\'');
163 APPENDS(icalenum_value_kind_to_string(icalvalue_isa(value)));
164 APPENDC('\'');
165 }
166
167 APPENDS(", 'pid' ");
168 APPENDS(sep);
169 APPENDC('\'');
170 snprintf(tmp,25,"%p",prop);
171 APPENDS(tmp);
172 APPENDC('\'');
173
174
175 if(value){
176 switch (icalvalue_isa(value)){
177
178 case ICAL_ATTACH_VALUE:
179 case ICAL_BINARY_VALUE:
180 case ICAL_NO_VALUE: {
181 icalerror_set_errno(ICAL_INTERNAL_ERROR);
182 break;
183 }
184
185 default:
186 {
187 const char* str = icalvalue_as_ical_string(value);
188 char* copy = (char*) malloc(strlen(str)+1);
189
190 const char *i;
191 char *j;
192
193 if(copy ==0){
194 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
195 break;
196 }
197 /* Remove any newlines */
198
199 for(j=copy, i = str; *i != 0; j++,i++){
200 if(*i=='\n'){
201 i++;
202 }
203 *j = *i;
204 }
205
206 *j = 0;
207
208 APPENDS(", 'value'");
209 APPENDS(sep);
210 APPENDC('\'');
211 APPENDS(copy);
212 APPENDC('\'');
213
214 free(copy);
215 break;
216
217 }
218 }
219 }
220
221 /* Add Parameters */
222
223 for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER);
224 param != 0;
225 param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)){
226
227 const char* str = icalparameter_as_ical_string(param);
228 char *copy = icalmemory_tmp_copy(str);
229 char *v;
230
231 if(copy == 0){
232 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
233 continue;
234 }
235
236 v = strchr(copy,'=');
237
238
239 if(v == 0){
240 continue;
241 }
242
243 *v = 0;
244
245 v++;
246
247 APPENDS(", ");
248 APPENDC('\'');
249 APPENDS(copy);
250 APPENDC('\'');
251 APPENDS(sep);
252 APPENDC('\'');
253 APPENDS(v);
254 APPENDC('\'');
255
256 }
257
258
259 APPENDC('}');
260
261 icalmemory_add_tmp_buffer(buf);
262 return buf;
263
264}
265
266#include "fcntl.h"
267int icallangbind_string_to_open_flag(const char* str)
268{
269 if (strcmp(str,"r") == 0) {return O_RDONLY;}
270 else if (strcmp(str,"r+") == 0) {return O_RDWR;}
271 else if (strcmp(str,"w") == 0) {return O_WRONLY;}
272 else if (strcmp(str,"a") == 0) {return O_WRONLY|O_APPEND;}
273 else return -1;
274}
275
diff --git a/libical/src/libical/icallangbind.h b/libical/src/libical/icallangbind.h
new file mode 100644
index 0000000..2ed5003
--- a/dev/null
+++ b/libical/src/libical/icallangbind.h
@@ -0,0 +1,49 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icallangbind.h
4 CREATOR: eric 25 jan 2001
5
6 DESCRIPTION:
7
8 $Id$
9 $Locker$
10
11 (C) COPYRIGHT 1999 Eric Busboom
12 http://www.softwarestudio.org
13
14 This package is free software and is provided "as is" without
15 express or implied warranty. It may be used, redistributed and/or
16 modified under the same terms as perl itself. ( Either the Artistic
17 License or the GPL. )
18
19 ======================================================================*/
20
21#ifndef __ICALLANGBIND_H__
22#define __ICALLANGBIND_H__
23
24int* icallangbind_new_array(int size);
25void icallangbind_free_array(int* array);
26int icallangbind_access_array(int* array, int index);
27icalproperty* icallangbind_get_property(icalcomponent *c, int n, const char* prop);
28const char* icallangbind_get_property_val(icalproperty* p);
29const char* icallangbind_get_parameter(icalproperty *p, const char* parameter);
30icalcomponent* icallangbind_get_component(icalcomponent *c, const char* comp);
31
32icalproperty* icallangbind_get_first_property(icalcomponent *c,
33 const char* prop);
34
35icalproperty* icallangbind_get_next_property(icalcomponent *c,
36 const char* prop);
37
38icalcomponent* icallangbind_get_first_component(icalcomponent *c,
39 const char* comp);
40
41icalcomponent* icallangbind_get_next_component(icalcomponent *c,
42 const char* comp);
43
44
45const char* icallangbind_property_eval_string(icalproperty* prop, char* sep);
46
47
48int icallangbind_string_to_open_flag(const char* str);
49#endif /*__ICALLANGBIND_H__*/
diff --git a/libical/src/libical/icallexer.c b/libical/src/libical/icallexer.c
new file mode 100644
index 0000000..4dd26c3
--- a/dev/null
+++ b/libical/src/libical/icallexer.c
@@ -0,0 +1,1793 @@
1#define yy_create_buffer ical_yy_create_buffer
2#define yy_delete_buffer ical_yy_delete_buffer
3#define yy_scan_buffer ical_yy_scan_buffer
4#define yy_scan_string ical_yy_scan_string
5#define yy_scan_bytes ical_yy_scan_bytes
6#define yy_flex_debug ical_yy_flex_debug
7#define yy_init_buffer ical_yy_init_buffer
8#define yy_flush_buffer ical_yy_flush_buffer
9#define yy_load_buffer_state ical_yy_load_buffer_state
10#define yy_switch_to_buffer ical_yy_switch_to_buffer
11#define yyin ical_yyin
12#define yyleng ical_yyleng
13#define yylex ical_yylex
14#define yyout ical_yyout
15#define yyrestart ical_yyrestart
16#define yytext ical_yytext
17#define yywrap ical_yywrap
18
19#line 20 "lex.yy.c"
20/* A lexical scanner generated by flex */
21
22/* Scanner skeleton version:
23 * $Header$
24 */
25
26#define FLEX_SCANNER
27#define YY_FLEX_MAJOR_VERSION 2
28#define YY_FLEX_MINOR_VERSION 5
29
30#include <stdio.h>
31
32
33/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
34#ifdef c_plusplus
35#ifndef __cplusplus
36#define __cplusplus
37#endif
38#endif
39
40
41#ifdef __cplusplus
42
43
44#include <stdlib.h>
45// Eugen C. <eug@thekompany.com>
46#ifndef _WIN32
47#include <unistd.h>
48#else
49#include <io.h>
50#include <stdio.h>
51
52#endif
53// Eugen C. <eug@thekompany.com>
54
55/* Use prototypes in function declarations. */
56#define YY_USE_PROTOS
57
58/* The "const" storage-class-modifier is valid. */
59#define YY_USE_CONST
60
61 #else/* ! __cplusplus */
62
63#if __STDC__
64
65#define YY_USE_PROTOS
66#define YY_USE_CONST
67
68 #endif/* __STDC__ */
69 #endif/* ! __cplusplus */
70
71#ifdef __TURBOC__
72 #pragma warn -rch
73 #pragma warn -use
74#include <io.h>
75#include <stdlib.h>
76#define YY_USE_CONST
77#define YY_USE_PROTOS
78#endif
79
80#ifdef YY_USE_CONST
81#define yyconst const
82#else
83#define yyconst
84#endif
85
86
87#ifdef YY_USE_PROTOS
88#define YY_PROTO(proto) proto
89#else
90#define YY_PROTO(proto) ()
91#endif
92
93/* Returned upon end-of-file. */
94#define YY_NULL 0
95
96/* Promotes a possibly negative, possibly signed char to an unsigned
97 * integer for use as an array index. If the signed char is negative,
98 * we want to instead treat it as an 8-bit unsigned char, hence the
99 * double cast.
100 */
101#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
102
103/* Enter a start condition. This macro really ought to take a parameter,
104 * but we do it the disgusting crufty way forced on us by the ()-less
105 * definition of BEGIN.
106 */
107#define BEGIN yy_start = 1 + 2 *
108
109/* Translate the current start state into a value that can be later handed
110 * to BEGIN to return to the state. The YYSTATE alias is for lex
111 * compatibility.
112 */
113#define YY_START ((yy_start - 1) / 2)
114#define YYSTATE YY_START
115
116/* Action number for EOF rule of a given start state. */
117#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
118
119/* Special action meaning "start processing a new file". */
120#define YY_NEW_FILE yyrestart( yyin )
121
122#define YY_END_OF_BUFFER_CHAR 0
123
124/* Size of default input buffer. */
125#define YY_BUF_SIZE 16384
126
127typedef struct yy_buffer_state *YY_BUFFER_STATE;
128
129extern int yyleng;
130extern FILE *yyin, *yyout;
131
132#define EOB_ACT_CONTINUE_SCAN 0
133#define EOB_ACT_END_OF_FILE 1
134#define EOB_ACT_LAST_MATCH 2
135
136/* The funky do-while in the following #define is used to turn the definition
137 * int a single C statement (which needs a semi-colon terminator). This
138 * avoids problems with code like:
139 *
140 * if ( condition_holds )
141 * yyless( 5 );
142 *else
143 * do_something_else();
144 *
145 * Prior to using the do-while the compiler would get upset at the
146 * "else" because it interpreted the "if" statement as being all
147 * done when it reached the ';' after the yyless() call.
148 */
149
150/* Return all but the first 'n' matched characters back to the input stream. */
151
152#define yyless(n) \
153 do \
154 { \
155 /* Undo effects of setting up yytext. */ \
156 *yy_cp = yy_hold_char; \
157 YY_RESTORE_YY_MORE_OFFSET \
158 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
159 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
160 } \
161 while ( 0 )
162
163#define unput(c) yyunput( c, yytext_ptr )
164
165/* The following is because we cannot portably get our hands on size_t
166 * (without autoconf's help, which isn't available because we want
167 * flex-generated scanners to compile on their own).
168 */
169typedef unsigned int yy_size_t;
170
171
172struct yy_buffer_state
173 {
174 FILE *yy_input_file;
175
176 char *yy_ch_buf; /* input buffer */
177 char *yy_buf_pos; /* current position in input buffer */
178
179 /* Size of input buffer in bytes, not including room for EOB
180 * characters.
181 */
182 yy_size_t yy_buf_size;
183
184 /* Number of characters read into yy_ch_buf, not including EOB
185 * characters.
186 */
187 int yy_n_chars;
188
189 /* Whether we "own" the buffer - i.e., we know we created it,
190 * and can realloc() it to grow it, and should free() it to
191 * delete it.
192 */
193 int yy_is_our_buffer;
194
195 /* Whether this is an "interactive" input source; if so, and
196 * if we're using stdio for input, then we want to use getc()
197 * instead of fread(), to make sure we stop fetching input after
198 * each newline.
199 */
200 int yy_is_interactive;
201
202 /* Whether we're considered to be at the beginning of a line.
203 * If so, '^' rules will be active on the next match, otherwise
204 * not.
205 */
206 int yy_at_bol;
207
208 /* Whether to try to fill the input buffer when we reach the
209 * end of it.
210 */
211 int yy_fill_buffer;
212
213 int yy_buffer_status;
214#define YY_BUFFER_NEW 0
215#define YY_BUFFER_NORMAL 1
216 /* When an EOF's been seen but there's still some text to process
217 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
218 * shouldn't try reading from the input source any more. We might
219 * still have a bunch of tokens to match, though, because of
220 * possible backing-up.
221 *
222 * When we actually see the EOF, we change the status to "new"
223 * (via yyrestart()), so that the user can continue scanning by
224 * just pointing yyin at a new input file.
225 */
226#define YY_BUFFER_EOF_PENDING 2
227 };
228
229static YY_BUFFER_STATE yy_current_buffer = 0;
230
231/* We provide macros for accessing buffer states in case in the
232 * future we want to put the buffer states in a more general
233 * "scanner state".
234 */
235#define YY_CURRENT_BUFFER yy_current_buffer
236
237
238/* yy_hold_char holds the character lost when yytext is formed. */
239static char yy_hold_char;
240
241 static int yy_n_chars; /* number of characters read into yy_ch_buf */
242
243
244int yyleng;
245
246/* Points to current character in buffer. */
247static char *yy_c_buf_p = (char *) 0;
248 static int yy_init = 1; /* whether we need to initialize */
249 static int yy_start = 0;/* start state number */
250
251/* Flag which is used to allow yywrap()'s to do buffer switches
252 * instead of setting up a fresh yyin. A bit of a hack ...
253 */
254static int yy_did_buffer_switch_on_eof;
255
256void yyrestart YY_PROTO(( FILE *input_file ));
257
258void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
259void yy_load_buffer_state YY_PROTO(( void ));
260YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
261void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
262void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
263void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
264#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
265
266YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
267YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
268YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
269
270static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
271static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
272static void yy_flex_free YY_PROTO(( void * ));
273
274#define yy_new_buffer yy_create_buffer
275
276#define yy_set_interactive(is_interactive) \
277 { \
278 if ( ! yy_current_buffer ) \
279 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
280 yy_current_buffer->yy_is_interactive = is_interactive; \
281 }
282
283#define yy_set_bol(at_bol) \
284 { \
285 if ( ! yy_current_buffer ) \
286 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
287 yy_current_buffer->yy_at_bol = at_bol; \
288 }
289
290#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
291
292typedef unsigned char YY_CHAR;
293FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
294typedef int yy_state_type;
295extern char yytext[];
296
297
298static yy_state_type yy_get_previous_state YY_PROTO(( void ));
299static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
300static int yy_get_next_buffer YY_PROTO(( void ));
301static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
302
303/* Done after the current pattern has been matched and before the
304 * corresponding action - sets up yytext.
305 */
306#define YY_DO_BEFORE_ACTION \
307 yytext_ptr = yy_bp; \
308 yyleng = (int) (yy_cp - yy_bp); \
309 yy_hold_char = *yy_cp; \
310 *yy_cp = '\0'; \
311 if ( yyleng >= YYLMAX ) \
312 YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
313 yy_flex_strncpy( yytext, yytext_ptr, yyleng + 1 ); \
314 yy_c_buf_p = yy_cp;
315
316#define YY_NUM_RULES 12
317#define YY_END_OF_BUFFER 13
318static yyconst short int yy_accept[67] =
319 { 0,
320 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
321 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
322 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
323 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
324 0, 0, 0, 0, 13, 12, 5, 12, 4, 1,
325 2, 3, 6, 12, 7, 12, 9, 10, 9, 11,
326 5, 1, 6, 8, 10, 0
327 } ;
328
329static yyconst int yy_ec[256] =
330 { 0,
331 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
332 1, 1, 3, 1, 1, 1, 1, 1, 1, 1,
333 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
334 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
335 1, 1, 4, 5, 6, 1, 7, 8, 8, 8,
336 8, 8, 8, 8, 8, 8, 8, 1, 1, 1,
337 1, 1, 1, 1, 1, 1, 1, 7, 1, 1,
338 1, 7, 1, 1, 1, 1, 7, 1, 1, 7,
339 1, 1, 7, 9, 1, 1, 7, 1, 1, 10,
340 1, 1, 1, 1, 1, 1, 1, 1, 1, 7,
341
342 1, 1, 1, 7, 1, 1, 1, 1, 7, 1,
343 1, 7, 1, 1, 7, 9, 1, 1, 7, 1,
344 1, 10, 1, 1, 1, 1, 1, 1, 1, 1,
345 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352
353 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
355 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
356 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
358 1, 1, 1, 1, 1
359 } ;
360
361static yyconst int yy_meta[11] =
362 { 0,
363 1, 1, 1, 1, 1, 1, 1, 1, 1, 1
364 } ;
365
366static yyconst short int yy_base[69] =
367 { 0,
368 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
369 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
370 0, 0, 9, 0, 16, 18, 0, 0, 0, 0,
371 0, 0, 0, 0, 0, 0, 25, 24, 0, 0,
372 0, 0, 0, 0, 28, 31, 31, 25, 31, 18,
373 31, 31, 31, 23, 31, 16, 31, 31, 21, 31,
374 31, 14, 31, 31, 31, 31, 15, 13
375 } ;
376
377static yyconst short int yy_def[69] =
378 { 0,
379 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
380 66, 11, 67, 67, 67, 67, 67, 67, 67, 67,
381 67, 67, 67, 23, 68, 68, 67, 67, 67, 67,
382 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,
383 67, 67, 67, 67, 66, 66, 66, 66, 66, 66,
384 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
385 66, 66, 66, 66, 66, 0, 66, 66
386 } ;
387
388static yyconst short int yy_nxt[42] =
389 { 0,
390 46, 47, 48, 49, 46, 49, 49, 50, 51, 52,
391 53, 54, 55, 57, 55, 46, 56, 58, 59, 58,
392 59, 62, 65, 64, 63, 62, 61, 66, 60, 60,
393 45, 66, 66, 66, 66, 66, 66, 66, 66, 66,
394 66
395 } ;
396
397static yyconst short int yy_chk[42] =
398 { 0,
399 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
400 23, 23, 23, 68, 23, 67, 23, 25, 25, 26,
401 26, 62, 59, 56, 54, 50, 48, 45, 38, 37,
402 66, 66, 66, 66, 66, 66, 66, 66, 66, 66,
403 66
404 } ;
405
406static yy_state_type yy_last_accepting_state;
407static char *yy_last_accepting_cpos;
408
409/* The intent behind this definition is that it'll catch
410 * any uses of REJECT which flex missed.
411 */
412#define REJECT reject_used_but_not_detected
413#define yymore() yymore_used_but_not_detected
414#define YY_MORE_ADJ 0
415#define YY_RESTORE_YY_MORE_OFFSET
416#ifndef YYLMAX
417#define YYLMAX 8192
418#endif
419
420char yytext[YYLMAX];
421char *yytext_ptr;
422#line 1 "../../../../libical/src/libical/icallexer.l"
423#define INITIAL 0
424#line 2 "../../../../libical/src/libical/icallexer.l"
425/* -*- Mode: C -*-
426 ======================================================================
427 FILE: icallexer.l
428 CREATOR: eric 10 June 1999
429
430 DESCRIPTION:
431
432 $Id$
433 $Locker$
434
435 (C) COPYRIGHT 1999 Eric Busboom
436 http://www.softwarestudio.org
437
438 The contents of this file are subject to the Mozilla Public License
439 Version 1.0 (the "License"); you may not use this file except in
440 compliance with the License. You may obtain a copy of the License at
441 http://www.mozilla.org/MPL/
442
443 Software distributed under the License is distributed on an "AS IS"
444 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
445 the License for the specific language governing rights and
446 limitations under the License.
447
448 The original author is Eric Busboom
449 The original code is icalitip.y
450
451
452
453 ======================================================================*/
454#include "icalparser.h"
455#include "icalenums.h"
456#include "icalmemory.h"
457#include "assert.h"
458#include "icalyacc.h"
459
460#ifdef _WIN32
461#include <stdio.h>
462#include <stdlib.h>
463#endif
464
465#include <string.h> /* For strdup() */
466
467int icalparser_flex_input(char* buf, int max_size);
468void icalparser_clear_flex_input(void);
469
470
471#define ICAL_MAX_STR_CONST 1024
472
473#undef YY_INPUT
474#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
475#undef yywrap
476
477#undef YY_FATAL_ERROR
478#define YY_FATAL_ERROR(msg) ical_yyerror(msg)
479
480icalvalue_kind value_kind=ICAL_NO_VALUE;
481void set_parser_value_state(icalvalue_kind kind);
482extern int yydebug;
483
484void ical_yyerror(char *s);
485
486void init_str_buf(void);
487
488int last_state;
489
490char *str_buf;
491char *str_buf_p;
492size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/
493
494/* Define routines that were not propertly defined because of the
495renaming hack applied in icalyacc.y */
496YY_BUFFER_STATE ical_yy_scan_buffer ( char *base, yy_size_t size );
497YY_BUFFER_STATE ical_yy_scan_string ( yyconst char *yy_str );
498YY_BUFFER_STATE ical_yy_scan_bytes ( yyconst char *bytes, int len );
499
500#define quoted_string 1
501
502#define binary_value 2
503#define boolean_value 3
504#define uri_value 4
505#define time_value 5
506#define duration_value 6
507#define number_value 7
508#define period_value 8
509#define recur_value 9
510#define text_value 10
511#define utcoffset_value 11
512
513#define enum_param_value 12
514#define string_param_value 13
515#define stringlist_param_value 14
516#define keyword 15
517#define line_start 16
518#define component 17
519#define seperator 18
520#define parameter 19
521#define end_of_value 20
522#define paramtext 21
523
524#line 511 "lex.yy.c"
525
526/* Macros after this point can all be overridden by user definitions in
527 * section 1.
528 */
529
530#ifndef YY_SKIP_YYWRAP
531#ifdef __cplusplus
532extern "C" int yywrap YY_PROTO(( void ));
533#else
534extern int yywrap YY_PROTO(( void ));
535#endif
536#endif
537
538#ifndef YY_NO_UNPUT
539static void yyunput YY_PROTO(( int c, char *buf_ptr ));
540#endif
541
542#ifndef yytext_ptr
543static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
544#endif
545
546#ifdef YY_NEED_STRLEN
547static int yy_flex_strlen YY_PROTO(( yyconst char * ));
548#endif
549
550#ifndef YY_NO_INPUT
551#ifdef __cplusplus
552static int yyinput YY_PROTO(( void ));
553#else
554static int input YY_PROTO(( void ));
555#endif
556#endif
557
558#if YY_STACK_USED
559static int yy_start_stack_ptr = 0;
560static int yy_start_stack_depth = 0;
561static int *yy_start_stack = 0;
562#ifndef YY_NO_PUSH_STATE
563static void yy_push_state YY_PROTO(( int new_state ));
564#endif
565#ifndef YY_NO_POP_STATE
566static void yy_pop_state YY_PROTO(( void ));
567#endif
568#ifndef YY_NO_TOP_STATE
569static int yy_top_state YY_PROTO(( void ));
570#endif
571
572#else
573#define YY_NO_PUSH_STATE 1
574#define YY_NO_POP_STATE 1
575#define YY_NO_TOP_STATE 1
576#endif
577
578#ifdef YY_MALLOC_DECL
579YY_MALLOC_DECL
580#else
581#if __STDC__
582#ifndef __cplusplus
583#include <stdlib.h>
584#endif
585#else
586/* Just try to get by without declaring the routines. This will fail
587 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
588 * or sizeof(void*) != sizeof(int).
589 */
590#endif
591#endif
592
593/* Amount of stuff to slurp up with each read. */
594#ifndef YY_READ_BUF_SIZE
595#define YY_READ_BUF_SIZE 8192
596#endif
597
598/* Copy whatever the last rule matched to the standard output. */
599
600#ifndef ECHO
601/* This used to be an fputs(), but since the string might contain NUL's,
602 * we now use fwrite().
603 */
604#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
605#endif
606
607/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
608 * is returned in "result".
609 */
610#ifndef YY_INPUT
611#define YY_INPUT(buf,result,max_size) \
612 if ( yy_current_buffer->yy_is_interactive ) \
613 { \
614 int c = '*', n; \
615 for ( n = 0; n < max_size && \
616 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
617 buf[n] = (char) c; \
618 if ( c == '\n' ) \
619 buf[n++] = (char) c; \
620 if ( c == EOF && ferror( yyin ) ) \
621 YY_FATAL_ERROR( "input in flex scanner failed" ); \
622 result = n; \
623 } \
624 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
625 && ferror( yyin ) ) \
626 YY_FATAL_ERROR( "input in flex scanner failed" );
627#endif
628
629/* No semi-colon after return; correct usage is to write "yyterminate();" -
630 * we don't want an extra ';' after the "return" because that will cause
631 * some compilers to complain about unreachable statements.
632 */
633#ifndef yyterminate
634#define yyterminate() return YY_NULL
635#endif
636
637/* Number of entries by which start-condition stack grows. */
638#ifndef YY_START_STACK_INCR
639#define YY_START_STACK_INCR 25
640#endif
641
642/* Report a fatal error. */
643#ifndef YY_FATAL_ERROR
644#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
645#endif
646
647/* Default declaration of generated scanner - a define so the user can
648 * easily add parameters.
649 */
650#ifndef YY_DECL
651#define YY_DECL int yylex YY_PROTO(( void ))
652#endif
653
654/* Code executed at the beginning of each rule, after yytext and yyleng
655 * have been set up.
656 */
657#ifndef YY_USER_ACTION
658#define YY_USER_ACTION
659#endif
660
661/* Code executed at the end of each rule. */
662#ifndef YY_BREAK
663#define YY_BREAK break;
664#endif
665
666#define YY_RULE_SETUP \
667 YY_USER_ACTION
668
669YY_DECL
670 {
671 register yy_state_type yy_current_state;
672 register char *yy_cp, *yy_bp;
673 register int yy_act;
674
675#line 97 "../../../../libical/src/libical/icallexer.l"
676
677
678
679
680
681
682
683#line 670 "lex.yy.c"
684
685 if ( yy_init )
686 {
687 yy_init = 0;
688
689#ifdef YY_USER_INIT
690 YY_USER_INIT;
691#endif
692
693 if ( ! yy_start )
694 yy_start = 1;/* first start state */
695
696 if ( ! yyin )
697 yyin = stdin;
698
699 if ( ! yyout )
700 yyout = stdout;
701
702 if ( ! yy_current_buffer )
703 yy_current_buffer =
704 yy_create_buffer( yyin, YY_BUF_SIZE );
705
706 yy_load_buffer_state();
707 }
708
709 while ( 1 ) /* loops until end-of-file is reached */
710 {
711 yy_cp = yy_c_buf_p;
712
713 /* Support of yytext. */
714 *yy_cp = yy_hold_char;
715
716 /* yy_bp points to the position in yy_ch_buf of the start of
717 * the current run.
718 */
719 yy_bp = yy_cp;
720
721 yy_current_state = yy_start;
722yy_match:
723 do
724 {
725 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
726 if ( yy_accept[yy_current_state] )
727 {
728 yy_last_accepting_state = yy_current_state;
729 yy_last_accepting_cpos = yy_cp;
730 }
731 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
732 {
733 yy_current_state = (int) yy_def[yy_current_state];
734 if ( yy_current_state >= 67 )
735 yy_c = yy_meta[(unsigned int) yy_c];
736 }
737 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
738 ++yy_cp;
739 }
740 while ( yy_base[yy_current_state] != 31 );
741
742yy_find_action:
743 yy_act = yy_accept[yy_current_state];
744 if ( yy_act == 0 )
745 { /* have to back up */
746 yy_cp = yy_last_accepting_cpos;
747 yy_current_state = yy_last_accepting_state;
748 yy_act = yy_accept[yy_current_state];
749 }
750
751 YY_DO_BEFORE_ACTION;
752
753
754 do_action:/* This label is used only to access EOF actions. */
755
756
757 switch ( yy_act )
758 { /* beginning of action switch */
759 case 0: /* must back up */
760 /* undo the effects of YY_DO_BEFORE_ACTION */
761 *yy_cp = yy_hold_char;
762 yy_cp = yy_last_accepting_cpos;
763 yy_current_state = yy_last_accepting_state;
764 goto yy_find_action;
765
766
767case 1:
768YY_RULE_SETUP
769#line 105 "../../../../libical/src/libical/icallexer.l"
770{ ical_yylval.v_string =icalmemory_tmp_copy(yytext) ;
771 return DIGITS; }
772 YY_BREAK
773case 2:
774YY_RULE_SETUP
775#line 107 "../../../../libical/src/libical/icallexer.l"
776{ return TIME_CHAR; }
777 YY_BREAK
778case 3:
779YY_RULE_SETUP
780#line 108 "../../../../libical/src/libical/icallexer.l"
781{ return UTC_CHAR; }
782 YY_BREAK
783case 4:
784YY_RULE_SETUP
785#line 109 "../../../../libical/src/libical/icallexer.l"
786{ return yytext[0]; }
787 YY_BREAK
788case 5:
789YY_RULE_SETUP
790#line 110 "../../../../libical/src/libical/icallexer.l"
791{ return EOL;}
792 YY_BREAK
793
794
795case 6:
796YY_RULE_SETUP
797#line 115 "../../../../libical/src/libical/icallexer.l"
798{ return EOL;}
799 YY_BREAK
800case 7:
801YY_RULE_SETUP
802#line 116 "../../../../libical/src/libical/icallexer.l"
803{ return yytext[0]; }
804 YY_BREAK
805case 8:
806YY_RULE_SETUP
807#line 117 "../../../../libical/src/libical/icallexer.l"
808{ ical_yylval.v_int=atoi(yytext); return INTNUMBER; }
809 YY_BREAK
810
811
812case 9:
813YY_RULE_SETUP
814#line 122 "../../../../libical/src/libical/icallexer.l"
815{ return CHARACTER; }
816 YY_BREAK
817case 10:
818YY_RULE_SETUP
819#line 123 "../../../../libical/src/libical/icallexer.l"
820{ return EOL;}
821 YY_BREAK
822
823
824case 11:
825YY_RULE_SETUP
826#line 128 "../../../../libical/src/libical/icallexer.l"
827{ BEGIN(last_state); return COMMA; }
828 YY_BREAK
829
830case 12:
831YY_RULE_SETUP
832#line 132 "../../../../libical/src/libical/icallexer.l"
833ECHO;
834 YY_BREAK
835#line 822 "lex.yy.c"
836case YY_STATE_EOF(INITIAL):
837case YY_STATE_EOF(quoted_string):
838case YY_STATE_EOF(binary_value):
839case YY_STATE_EOF(boolean_value):
840case YY_STATE_EOF(uri_value):
841case YY_STATE_EOF(time_value):
842case YY_STATE_EOF(duration_value):
843case YY_STATE_EOF(number_value):
844case YY_STATE_EOF(period_value):
845case YY_STATE_EOF(recur_value):
846case YY_STATE_EOF(text_value):
847case YY_STATE_EOF(utcoffset_value):
848case YY_STATE_EOF(enum_param_value):
849case YY_STATE_EOF(string_param_value):
850case YY_STATE_EOF(stringlist_param_value):
851case YY_STATE_EOF(keyword):
852case YY_STATE_EOF(line_start):
853case YY_STATE_EOF(component):
854case YY_STATE_EOF(seperator):
855case YY_STATE_EOF(parameter):
856case YY_STATE_EOF(end_of_value):
857case YY_STATE_EOF(paramtext):
858 yyterminate();
859
860 case YY_END_OF_BUFFER:
861 {
862 /* Amount of text matched not including the EOB char. */
863 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
864
865 /* Undo the effects of YY_DO_BEFORE_ACTION. */
866 *yy_cp = yy_hold_char;
867 YY_RESTORE_YY_MORE_OFFSET
868
869 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
870 {
871 /* We're scanning a new file or input source. It's
872 * possible that this happened because the user
873 * just pointed yyin at a new source and called
874 * yylex(). If so, then we have to assure
875 * consistency between yy_current_buffer and our
876 * globals. Here is the right place to do so, because
877 * this is the first action (other than possibly a
878 * back-up) that will match for the new input source.
879 */
880 yy_n_chars = yy_current_buffer->yy_n_chars;
881 yy_current_buffer->yy_input_file = yyin;
882 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
883 }
884
885 /* Note that here we test for yy_c_buf_p "<=" to the position
886 * of the first EOB in the buffer, since yy_c_buf_p will
887 * already have been incremented past the NUL character
888 * (since all states make transitions on EOB to the
889 * end-of-buffer state). Contrast this with the test
890 * in input().
891 */
892 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
893 { /* This was really a NUL. */
894 yy_state_type yy_next_state;
895
896 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
897
898 yy_current_state = yy_get_previous_state();
899
900 /* Okay, we're now positioned to make the NUL
901 * transition. We couldn't have
902 * yy_get_previous_state() go ahead and do it
903 * for us because it doesn't know how to deal
904 * with the possibility of jamming (and we don't
905 * want to build jamming into it because then it
906 * will run more slowly).
907 */
908
909 yy_next_state = yy_try_NUL_trans( yy_current_state );
910
911 yy_bp = yytext_ptr + YY_MORE_ADJ;
912
913 if ( yy_next_state )
914 {
915 /* Consume the NUL. */
916 yy_cp = ++yy_c_buf_p;
917 yy_current_state = yy_next_state;
918 goto yy_match;
919 }
920
921 else
922 {
923 yy_cp = yy_c_buf_p;
924 goto yy_find_action;
925 }
926 }
927
928 else switch ( yy_get_next_buffer() )
929 {
930 case EOB_ACT_END_OF_FILE:
931 {
932 yy_did_buffer_switch_on_eof = 0;
933
934 if ( yywrap() )
935 {
936 /* Note: because we've taken care in
937 * yy_get_next_buffer() to have set up
938 * yytext, we can now set up
939 * yy_c_buf_p so that if some total
940 * hoser (like flex itself) wants to
941 * call the scanner after we return the
942 * YY_NULL, it'll still work - another
943 * YY_NULL will get returned.
944 */
945 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
946
947 yy_act = YY_STATE_EOF(YY_START);
948 goto do_action;
949 }
950
951 else
952 {
953 if ( ! yy_did_buffer_switch_on_eof )
954 YY_NEW_FILE;
955 }
956 break;
957 }
958
959 case EOB_ACT_CONTINUE_SCAN:
960 yy_c_buf_p =
961 yytext_ptr + yy_amount_of_matched_text;
962
963 yy_current_state = yy_get_previous_state();
964
965 yy_cp = yy_c_buf_p;
966 yy_bp = yytext_ptr + YY_MORE_ADJ;
967 goto yy_match;
968
969 case EOB_ACT_LAST_MATCH:
970 yy_c_buf_p =
971 &yy_current_buffer->yy_ch_buf[yy_n_chars];
972
973 yy_current_state = yy_get_previous_state();
974
975 yy_cp = yy_c_buf_p;
976 yy_bp = yytext_ptr + YY_MORE_ADJ;
977 goto yy_find_action;
978 }
979 break;
980 }
981
982 default:
983 YY_FATAL_ERROR(
984 "fatal flex scanner internal error--no action found" );
985 } /* end of action switch */
986 } /* end of scanning one token */
987 } /* end of yylex */
988
989
990/* yy_get_next_buffer - try to read in a new buffer
991 *
992 * Returns a code representing an action:
993 *EOB_ACT_LAST_MATCH -
994 *EOB_ACT_CONTINUE_SCAN - continue scanning from current position
995 *EOB_ACT_END_OF_FILE - end of file
996 */
997
998static int yy_get_next_buffer()
999 {
1000 register char *dest = yy_current_buffer->yy_ch_buf;
1001 register char *source = yytext_ptr;
1002 register int number_to_move, i;
1003 int ret_val;
1004
1005 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
1006 YY_FATAL_ERROR(
1007 "fatal flex scanner internal error--end of buffer missed" );
1008
1009 if ( yy_current_buffer->yy_fill_buffer == 0 )
1010 { /* Don't try to fill the buffer, so this is an EOF. */
1011 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
1012 {
1013 /* We matched a single character, the EOB, so
1014 * treat this as a final EOF.
1015 */
1016 return EOB_ACT_END_OF_FILE;
1017 }
1018
1019 else
1020 {
1021 /* We matched some text prior to the EOB, first
1022 * process it.
1023 */
1024 return EOB_ACT_LAST_MATCH;
1025 }
1026 }
1027
1028 /* Try to read more data. */
1029
1030 /* First move last chars to start of buffer. */
1031 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
1032
1033 for ( i = 0; i < number_to_move; ++i )
1034 *(dest++) = *(source++);
1035
1036 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1037 /* don't do the read, it's not guaranteed to return an EOF,
1038 * just force an EOF
1039 */
1040 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
1041
1042 else
1043 {
1044 int num_to_read =
1045 yy_current_buffer->yy_buf_size - number_to_move - 1;
1046
1047 while ( num_to_read <= 0 )
1048 { /* Not enough room in the buffer - grow it. */
1049#ifdef YY_USES_REJECT
1050 YY_FATAL_ERROR(
1051"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1052#else
1053
1054 /* just a shorter name for the current buffer */
1055 YY_BUFFER_STATE b = yy_current_buffer;
1056
1057 int yy_c_buf_p_offset =
1058 (int) (yy_c_buf_p - b->yy_ch_buf);
1059
1060 if ( b->yy_is_our_buffer )
1061 {
1062 int new_size = b->yy_buf_size * 2;
1063
1064 if ( new_size <= 0 )
1065 b->yy_buf_size += b->yy_buf_size / 8;
1066 else
1067 b->yy_buf_size *= 2;
1068
1069 b->yy_ch_buf = (char *)
1070 /* Include room in for 2 EOB chars. */
1071 yy_flex_realloc( (void *) b->yy_ch_buf,
1072 b->yy_buf_size + 2 );
1073 }
1074 else
1075 /* Can't grow it, we don't own it. */
1076 b->yy_ch_buf = 0;
1077
1078 if ( ! b->yy_ch_buf )
1079 YY_FATAL_ERROR(
1080 "fatal error - scanner input buffer overflow" );
1081
1082 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
1083
1084 num_to_read = yy_current_buffer->yy_buf_size -
1085 number_to_move - 1;
1086#endif
1087 }
1088
1089 if ( num_to_read > YY_READ_BUF_SIZE )
1090 num_to_read = YY_READ_BUF_SIZE;
1091
1092 /* Read in more data. */
1093 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
1094 yy_n_chars, num_to_read );
1095
1096 yy_current_buffer->yy_n_chars = yy_n_chars;
1097 }
1098
1099 if ( yy_n_chars == 0 )
1100 {
1101 if ( number_to_move == YY_MORE_ADJ )
1102 {
1103 ret_val = EOB_ACT_END_OF_FILE;
1104 yyrestart( yyin );
1105 }
1106
1107 else
1108 {
1109 ret_val = EOB_ACT_LAST_MATCH;
1110 yy_current_buffer->yy_buffer_status =
1111 YY_BUFFER_EOF_PENDING;
1112 }
1113 }
1114
1115 else
1116 ret_val = EOB_ACT_CONTINUE_SCAN;
1117
1118 yy_n_chars += number_to_move;
1119 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
1120 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
1121
1122 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
1123
1124 return ret_val;
1125 }
1126
1127
1128/* yy_get_previous_state - get the state just before the EOB char was reached */
1129
1130static yy_state_type yy_get_previous_state()
1131 {
1132 register yy_state_type yy_current_state;
1133 register char *yy_cp;
1134
1135 yy_current_state = yy_start;
1136
1137 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
1138 {
1139 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1140 if ( yy_accept[yy_current_state] )
1141 {
1142 yy_last_accepting_state = yy_current_state;
1143 yy_last_accepting_cpos = yy_cp;
1144 }
1145 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1146 {
1147 yy_current_state = (int) yy_def[yy_current_state];
1148 if ( yy_current_state >= 67 )
1149 yy_c = yy_meta[(unsigned int) yy_c];
1150 }
1151 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1152 }
1153
1154 return yy_current_state;
1155 }
1156
1157
1158/* yy_try_NUL_trans - try to make a transition on the NUL character
1159 *
1160 * synopsis
1161 *next_state = yy_try_NUL_trans( current_state );
1162 */
1163
1164#ifdef YY_USE_PROTOS
1165static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
1166#else
1167static yy_state_type yy_try_NUL_trans( yy_current_state )
1168yy_state_type yy_current_state;
1169#endif
1170 {
1171 register int yy_is_jam;
1172 register char *yy_cp = yy_c_buf_p;
1173
1174 register YY_CHAR yy_c = 1;
1175 if ( yy_accept[yy_current_state] )
1176 {
1177 yy_last_accepting_state = yy_current_state;
1178 yy_last_accepting_cpos = yy_cp;
1179 }
1180 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1181 {
1182 yy_current_state = (int) yy_def[yy_current_state];
1183 if ( yy_current_state >= 67 )
1184 yy_c = yy_meta[(unsigned int) yy_c];
1185 }
1186 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1187 yy_is_jam = (yy_current_state == 66);
1188
1189 return yy_is_jam ? 0 : yy_current_state;
1190 }
1191
1192
1193#ifndef YY_NO_UNPUT
1194#ifdef YY_USE_PROTOS
1195static void yyunput( int c, register char *yy_bp )
1196#else
1197static void yyunput( c, yy_bp )
1198int c;
1199register char *yy_bp;
1200#endif
1201 {
1202 register char *yy_cp = yy_c_buf_p;
1203
1204 /* undo effects of setting up yytext */
1205 *yy_cp = yy_hold_char;
1206
1207 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1208 { /* need to shift things up to make room */
1209 /* +2 for EOB chars. */
1210 register int number_to_move = yy_n_chars + 2;
1211 register char *dest = &yy_current_buffer->yy_ch_buf[
1212 yy_current_buffer->yy_buf_size + 2];
1213 register char *source =
1214 &yy_current_buffer->yy_ch_buf[number_to_move];
1215
1216 while ( source > yy_current_buffer->yy_ch_buf )
1217 *--dest = *--source;
1218
1219 yy_cp += (int) (dest - source);
1220 yy_bp += (int) (dest - source);
1221 yy_current_buffer->yy_n_chars =
1222 yy_n_chars = yy_current_buffer->yy_buf_size;
1223
1224 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
1225 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1226 }
1227
1228 *--yy_cp = (char) c;
1229
1230
1231 yytext_ptr = yy_bp;
1232 yy_hold_char = *yy_cp;
1233 yy_c_buf_p = yy_cp;
1234 }
1235 #endif/* ifndef YY_NO_UNPUT */
1236
1237
1238#ifdef __cplusplus
1239static int yyinput()
1240#else
1241static int input()
1242#endif
1243 {
1244 int c;
1245
1246 *yy_c_buf_p = yy_hold_char;
1247
1248 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
1249 {
1250 /* yy_c_buf_p now points to the character we want to return.
1251 * If this occurs *before* the EOB characters, then it's a
1252 * valid NUL; if not, then we've hit the end of the buffer.
1253 */
1254 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
1255 /* This was really a NUL. */
1256 *yy_c_buf_p = '\0';
1257
1258 else
1259 { /* need more input */
1260 int offset = yy_c_buf_p - yytext_ptr;
1261 ++yy_c_buf_p;
1262
1263 switch ( yy_get_next_buffer() )
1264 {
1265 case EOB_ACT_LAST_MATCH:
1266 /* This happens because yy_g_n_b()
1267 * sees that we've accumulated a
1268 * token and flags that we need to
1269 * try matching the token before
1270 * proceeding. But for input(),
1271 * there's no matching to consider.
1272 * So convert the EOB_ACT_LAST_MATCH
1273 * to EOB_ACT_END_OF_FILE.
1274 */
1275
1276 /* Reset buffer status. */
1277 yyrestart( yyin );
1278
1279 /* fall through */
1280
1281 case EOB_ACT_END_OF_FILE:
1282 {
1283 if ( yywrap() )
1284 return EOF;
1285
1286 if ( ! yy_did_buffer_switch_on_eof )
1287 YY_NEW_FILE;
1288#ifdef __cplusplus
1289 return yyinput();
1290#else
1291 return input();
1292#endif
1293 }
1294
1295 case EOB_ACT_CONTINUE_SCAN:
1296 yy_c_buf_p = yytext_ptr + offset;
1297 break;
1298 }
1299 }
1300 }
1301
1302 c = *(unsigned char *) yy_c_buf_p;/* cast for 8-bit char's */
1303 *yy_c_buf_p = '\0';/* preserve yytext */
1304 yy_hold_char = *++yy_c_buf_p;
1305
1306
1307 return c;
1308 }
1309
1310
1311#ifdef YY_USE_PROTOS
1312void yyrestart( FILE *input_file )
1313#else
1314void yyrestart( input_file )
1315FILE *input_file;
1316#endif
1317 {
1318 if ( ! yy_current_buffer )
1319 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
1320
1321 yy_init_buffer( yy_current_buffer, input_file );
1322 yy_load_buffer_state();
1323 }
1324
1325
1326#ifdef YY_USE_PROTOS
1327void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
1328#else
1329void yy_switch_to_buffer( new_buffer )
1330YY_BUFFER_STATE new_buffer;
1331#endif
1332 {
1333 if ( yy_current_buffer == new_buffer )
1334 return;
1335
1336 if ( yy_current_buffer )
1337 {
1338 /* Flush out information for old buffer. */
1339 *yy_c_buf_p = yy_hold_char;
1340 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
1341 yy_current_buffer->yy_n_chars = yy_n_chars;
1342 }
1343
1344 yy_current_buffer = new_buffer;
1345 yy_load_buffer_state();
1346
1347 /* We don't actually know whether we did this switch during
1348 * EOF (yywrap()) processing, but the only time this flag
1349 * is looked at is after yywrap() is called, so it's safe
1350 * to go ahead and always set it.
1351 */
1352 yy_did_buffer_switch_on_eof = 1;
1353 }
1354
1355
1356#ifdef YY_USE_PROTOS
1357void yy_load_buffer_state( void )
1358#else
1359void yy_load_buffer_state()
1360#endif
1361 {
1362 yy_n_chars = yy_current_buffer->yy_n_chars;
1363 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
1364 yyin = yy_current_buffer->yy_input_file;
1365 yy_hold_char = *yy_c_buf_p;
1366 }
1367
1368
1369#ifdef YY_USE_PROTOS
1370YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
1371#else
1372YY_BUFFER_STATE yy_create_buffer( file, size )
1373FILE *file;
1374int size;
1375#endif
1376 {
1377 YY_BUFFER_STATE b;
1378
1379 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1380 if ( ! b )
1381 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1382
1383 b->yy_buf_size = size;
1384
1385 /* yy_ch_buf has to be 2 characters longer than the size given because
1386 * we need to put in 2 end-of-buffer characters.
1387 */
1388 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
1389 if ( ! b->yy_ch_buf )
1390 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1391
1392 b->yy_is_our_buffer = 1;
1393
1394 yy_init_buffer( b, file );
1395
1396 return b;
1397 }
1398
1399
1400#ifdef YY_USE_PROTOS
1401void yy_delete_buffer( YY_BUFFER_STATE b )
1402#else
1403void yy_delete_buffer( b )
1404YY_BUFFER_STATE b;
1405#endif
1406 {
1407 if ( ! b )
1408 return;
1409
1410 if ( b == yy_current_buffer )
1411 yy_current_buffer = (YY_BUFFER_STATE) 0;
1412
1413 if ( b->yy_is_our_buffer )
1414 yy_flex_free( (void *) b->yy_ch_buf );
1415
1416 yy_flex_free( (void *) b );
1417 }
1418
1419
1420#ifndef YY_ALWAYS_INTERACTIVE
1421#ifndef YY_NEVER_INTERACTIVE
1422
1423#ifndef _WIN32
1424#include <unistd.h>
1425#else
1426#include <io.h>
1427#include <stdio.h>
1428
1429#endif
1430
1431#endif
1432#endif
1433
1434#ifdef YY_USE_PROTOS
1435void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
1436#else
1437void yy_init_buffer( b, file )
1438YY_BUFFER_STATE b;
1439FILE *file;
1440#endif
1441
1442
1443 {
1444 yy_flush_buffer( b );
1445
1446 b->yy_input_file = file;
1447 b->yy_fill_buffer = 1;
1448
1449#if YY_ALWAYS_INTERACTIVE
1450 b->yy_is_interactive = 1;
1451#else
1452#if YY_NEVER_INTERACTIVE
1453 b->yy_is_interactive = 0;
1454#else
1455
1456#ifdef _WIN32
1457 b->yy_is_interactive = file ? (_isatty( fileno(file) ) > 0) : 0;
1458#else
1459 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1460#endif
1461
1462#endif
1463#endif
1464 }
1465
1466
1467#ifdef YY_USE_PROTOS
1468void yy_flush_buffer( YY_BUFFER_STATE b )
1469#else
1470void yy_flush_buffer( b )
1471YY_BUFFER_STATE b;
1472#endif
1473
1474 {
1475 if ( ! b )
1476 return;
1477
1478 b->yy_n_chars = 0;
1479
1480 /* We always need two end-of-buffer characters. The first causes
1481 * a transition to the end-of-buffer state. The second causes
1482 * a jam in that state.
1483 */
1484 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1485 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1486
1487 b->yy_buf_pos = &b->yy_ch_buf[0];
1488
1489 b->yy_at_bol = 1;
1490 b->yy_buffer_status = YY_BUFFER_NEW;
1491
1492 if ( b == yy_current_buffer )
1493 yy_load_buffer_state();
1494 }
1495
1496
1497#ifndef YY_NO_SCAN_BUFFER
1498#ifdef YY_USE_PROTOS
1499YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
1500#else
1501YY_BUFFER_STATE yy_scan_buffer( base, size )
1502char *base;
1503yy_size_t size;
1504#endif
1505 {
1506 YY_BUFFER_STATE b;
1507
1508 if ( size < 2 ||
1509 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1510 base[size-1] != YY_END_OF_BUFFER_CHAR )
1511 /* They forgot to leave room for the EOB's. */
1512 return 0;
1513
1514 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
1515 if ( ! b )
1516 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1517
1518 b->yy_buf_size = size - 2;/* "- 2" to take care of EOB's */
1519 b->yy_buf_pos = b->yy_ch_buf = base;
1520 b->yy_is_our_buffer = 0;
1521 b->yy_input_file = 0;
1522 b->yy_n_chars = b->yy_buf_size;
1523 b->yy_is_interactive = 0;
1524 b->yy_at_bol = 1;
1525 b->yy_fill_buffer = 0;
1526 b->yy_buffer_status = YY_BUFFER_NEW;
1527
1528 yy_switch_to_buffer( b );
1529
1530 return b;
1531 }
1532#endif
1533
1534
1535#ifndef YY_NO_SCAN_STRING
1536#ifdef YY_USE_PROTOS
1537YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
1538#else
1539YY_BUFFER_STATE yy_scan_string( yy_str )
1540yyconst char *yy_str;
1541#endif
1542 {
1543 int len;
1544 for ( len = 0; yy_str[len]; ++len )
1545 ;
1546
1547 return yy_scan_bytes( yy_str, len );
1548 }
1549#endif
1550
1551
1552#ifndef YY_NO_SCAN_BYTES
1553#ifdef YY_USE_PROTOS
1554YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
1555#else
1556YY_BUFFER_STATE yy_scan_bytes( bytes, len )
1557yyconst char *bytes;
1558int len;
1559#endif
1560 {
1561 YY_BUFFER_STATE b;
1562 char *buf;
1563 yy_size_t n;
1564 int i;
1565
1566 /* Get memory for full buffer, including space for trailing EOB's. */
1567 n = len + 2;
1568 buf = (char *) yy_flex_alloc( n );
1569 if ( ! buf )
1570 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1571
1572 for ( i = 0; i < len; ++i )
1573 buf[i] = bytes[i];
1574
1575 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1576
1577 b = yy_scan_buffer( buf, n );
1578 if ( ! b )
1579 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1580
1581 /* It's okay to grow etc. this buffer, and we should throw it
1582 * away when we're done.
1583 */
1584 b->yy_is_our_buffer = 1;
1585
1586 return b;
1587 }
1588#endif
1589
1590
1591#ifndef YY_NO_PUSH_STATE
1592#ifdef YY_USE_PROTOS
1593static void yy_push_state( int new_state )
1594#else
1595static void yy_push_state( new_state )
1596int new_state;
1597#endif
1598 {
1599 if ( yy_start_stack_ptr >= yy_start_stack_depth )
1600 {
1601 yy_size_t new_size;
1602
1603 yy_start_stack_depth += YY_START_STACK_INCR;
1604 new_size = yy_start_stack_depth * sizeof( int );
1605
1606 if ( ! yy_start_stack )
1607 yy_start_stack = (int *) yy_flex_alloc( new_size );
1608
1609 else
1610 yy_start_stack = (int *) yy_flex_realloc(
1611 (void *) yy_start_stack, new_size );
1612
1613 if ( ! yy_start_stack )
1614 YY_FATAL_ERROR(
1615 "out of memory expanding start-condition stack" );
1616 }
1617
1618 yy_start_stack[yy_start_stack_ptr++] = YY_START;
1619
1620 BEGIN(new_state);
1621 }
1622#endif
1623
1624
1625#ifndef YY_NO_POP_STATE
1626static void yy_pop_state()
1627 {
1628 if ( --yy_start_stack_ptr < 0 )
1629 YY_FATAL_ERROR( "start-condition stack underflow" );
1630
1631 BEGIN(yy_start_stack[yy_start_stack_ptr]);
1632 }
1633#endif
1634
1635
1636#ifndef YY_NO_TOP_STATE
1637static int yy_top_state()
1638 {
1639 return yy_start_stack[yy_start_stack_ptr - 1];
1640 }
1641#endif
1642
1643#ifndef YY_EXIT_FAILURE
1644#define YY_EXIT_FAILURE 2
1645#endif
1646
1647#ifdef YY_USE_PROTOS
1648static void yy_fatal_error( yyconst char msg[] )
1649#else
1650static void yy_fatal_error( msg )
1651char msg[];
1652#endif
1653 {
1654 (void) fprintf( stderr, "%s\n", msg );
1655 exit( YY_EXIT_FAILURE );
1656 }
1657
1658
1659
1660/* Redefine yyless() so it works in section 3 code. */
1661
1662#undef yyless
1663#define yyless(n) \
1664 do \
1665 { \
1666 /* Undo effects of setting up yytext. */ \
1667 yytext[yyleng] = yy_hold_char; \
1668 yy_c_buf_p = yytext + n; \
1669 yy_hold_char = *yy_c_buf_p; \
1670 *yy_c_buf_p = '\0'; \
1671 yyleng = n; \
1672 } \
1673 while ( 0 )
1674
1675
1676/* Internal utility routines. */
1677
1678#ifndef yytext_ptr
1679#ifdef YY_USE_PROTOS
1680static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
1681#else
1682static void yy_flex_strncpy( s1, s2, n )
1683char *s1;
1684yyconst char *s2;
1685int n;
1686#endif
1687 {
1688 register int i;
1689 for ( i = 0; i < n; ++i )
1690 s1[i] = s2[i];
1691 }
1692#endif
1693
1694#ifdef YY_NEED_STRLEN
1695#ifdef YY_USE_PROTOS
1696static int yy_flex_strlen( yyconst char *s )
1697#else
1698static int yy_flex_strlen( s )
1699yyconst char *s;
1700#endif
1701 {
1702 register int n;
1703 for ( n = 0; s[n]; ++n )
1704 ;
1705
1706 return n;
1707 }
1708#endif
1709
1710
1711#ifdef YY_USE_PROTOS
1712static void *yy_flex_alloc( yy_size_t size )
1713#else
1714static void *yy_flex_alloc( size )
1715yy_size_t size;
1716#endif
1717 {
1718 return (void *) malloc( size );
1719 }
1720
1721#ifdef YY_USE_PROTOS
1722static void *yy_flex_realloc( void *ptr, yy_size_t size )
1723#else
1724static void *yy_flex_realloc( ptr, size )
1725void *ptr;
1726yy_size_t size;
1727#endif
1728 {
1729 /* The cast to (char *) in the following accommodates both
1730 * implementations that use char* generic pointers, and those
1731 * that use void* generic pointers. It works with the latter
1732 * because both ANSI C and C++ allow castless assignment from
1733 * any pointer type to void*, and deal with argument conversions
1734 * as though doing an assignment.
1735 */
1736 return (void *) realloc( (char *) ptr, size );
1737 }
1738
1739#ifdef YY_USE_PROTOS
1740static void yy_flex_free( void *ptr )
1741#else
1742static void yy_flex_free( ptr )
1743void *ptr;
1744#endif
1745 {
1746 free( ptr );
1747 }
1748
1749#if YY_MAIN
1750int main()
1751 {
1752 yylex();
1753 return 0;
1754 }
1755#endif
1756#line 132 "../../../../libical/src/libical/icallexer.l"
1757
1758
1759int yywrap()
1760{
1761 return 1;
1762}
1763
1764
1765void set_parser_value_state(icalvalue_kind kind)
1766{
1767
1768 switch (kind){
1769
1770 case ICAL_UTCOFFSET_VALUE:
1771 {BEGIN(utcoffset_value);break;}
1772
1773 case ICAL_DATETIMEPERIOD_VALUE:
1774 case ICAL_DURATION_VALUE:
1775 case ICAL_PERIOD_VALUE:
1776 {BEGIN(time_value);break;}
1777
1778 default:
1779 {
1780 assert(1==0);
1781 }
1782 }
1783}
1784
1785void init_str_buf(void)
1786{
1787 str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST);
1788 str_buf_p = str_buf;
1789 buf_sz = ICAL_MAX_STR_CONST;
1790
1791
1792}
1793
diff --git a/libical/src/libical/icallexer.l b/libical/src/libical/icallexer.l
new file mode 100644
index 0000000..53b396a
--- a/dev/null
+++ b/libical/src/libical/icallexer.l
@@ -0,0 +1,170 @@
1%{
2/* -*- Mode: C -*-
3 ======================================================================
4 FILE: icallexer.l
5 CREATOR: eric 10 June 1999
6
7 DESCRIPTION:
8
9 $Id$
10 $Locker$
11
12 (C) COPYRIGHT 1999 Eric Busboom
13 http://www.softwarestudio.org
14
15 The contents of this file are subject to the Mozilla Public License
16 Version 1.0 (the "License"); you may not use this file except in
17 compliance with the License. You may obtain a copy of the License at
18 http://www.mozilla.org/MPL/
19
20 Software distributed under the License is distributed on an "AS IS"
21 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
22 the License for the specific language governing rights and
23 limitations under the License.
24
25 The original author is Eric Busboom
26 The original code is icalitip.y
27
28
29
30 ======================================================================*/
31#include "icalparser.h"
32#include "icalenums.h"
33#include "icalmemory.h"
34#include "assert.h"
35#include "icalyacc.h"
36
37#include <string.h> /* For strdup() */
38#include <stdlib.h>
39#include <math.h>
40
41int icalparser_flex_input(char* buf, int max_size);
42void icalparser_clear_flex_input(void);
43
44
45#define ICAL_MAX_STR_CONST 1024
46
47#undef YY_INPUT
48#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
49#undef yywrap
50
51#undef YY_FATAL_ERROR
52#define YY_FATAL_ERROR(msg) ical_yyerror(msg)
53
54icalvalue_kind value_kind=ICAL_NO_VALUE;
55void set_parser_value_state(icalvalue_kind kind);
56extern int yydebug;
57
58void ical_yyerror(char *s);
59
60void init_str_buf(void);
61
62int last_state;
63
64char *str_buf;
65char *str_buf_p;
66size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/
67
68/* Define routines that were not propertly defined because of the
69renaming hack applied in icalyacc.y */
70YY_BUFFER_STATE ical_yy_scan_buffer ( char *base, yy_size_t size );
71YY_BUFFER_STATE ical_yy_scan_string ( yyconst char *yy_str );
72YY_BUFFER_STATE ical_yy_scan_bytes ( yyconst char *bytes, int len );
73
74%}
75
76 crlf \x0D?\x0A
77 space [ ]
78 qsafechar[^\x00-\x1F\"]
79 safechar[^\x00-\x1F\"\:\;\,]
80 tsafechar[\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E]
81 valuechar[^\x00-\x08\x10-\x1F]
82 xname X-[a-zA-Z0-9\-]+
83xname2 [a-zA-Z0-9\-\ ]
84 paramtext{safechar}+
85 value {valuechar}+
86 quotedstring\"{qsafechar}+\"
87 digit [0-9]
88
89%array /* Make yytext an array. Slow, but handy. HACK */
90
91%option caseless
92
93%s quoted_string
94%s binary_value boolean_value uri_value time_value duration_value number_value period_value recur_value text_value utcoffset_value
95%s enum_param_value string_param_value stringlist_param_value keyword line_start component seperator parameter end_of_value paramtext
96
97
98
99%%
100
101%{
102%}
103
104
105
106<time_value>{
107 {digit}+ { ical_yylval.v_string =icalmemory_tmp_copy(yytext) ;
108 return DIGITS; }
109 T { return TIME_CHAR; }
110 Z { return UTC_CHAR; }
111 [\/\+\-PWHMSD] { return yytext[0]; }
112{crlf} { return EOL;}
113
114}
115
116<utcoffset_value>{
117{crlf} { return EOL;}
118 \-|\+ { return yytext[0]; }
119 {digit}{digit} { ical_yylval.v_int=atoi(yytext); return INTNUMBER; }
120
121}
122
123<enum_param_value>{
124 . { return CHARACTER; }
125{crlf} { return EOL;}
126
127}
128
129<seperator>{
130, { BEGIN(last_state); return COMMA; }
131}
132
133
134%%
135
136int yywrap()
137{
138 return 1;
139}
140
141
142void set_parser_value_state(icalvalue_kind kind)
143{
144
145 switch (kind){
146
147 case ICAL_UTCOFFSET_VALUE:
148 {BEGIN(utcoffset_value);break;}
149
150 case ICAL_DATETIMEPERIOD_VALUE:
151 case ICAL_DURATION_VALUE:
152 case ICAL_PERIOD_VALUE:
153 {BEGIN(time_value);break;}
154
155 default:
156 {
157 assert(1==0);
158 }
159 }
160}
161
162void init_str_buf(void)
163{
164 str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST);
165 str_buf_p = str_buf;
166 buf_sz = ICAL_MAX_STR_CONST;
167
168
169}
170
diff --git a/libical/src/libical/icalmemory.c b/libical/src/libical/icalmemory.c
new file mode 100644
index 0000000..297ead8
--- a/dev/null
+++ b/libical/src/libical/icalmemory.c
@@ -0,0 +1,287 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalmemory.c
4 CREATOR: eric 30 June 1999
5
6 $Id$
7 $Locker$
8
9 The contents of this file are subject to the Mozilla Public License
10 Version 1.0 (the "License"); you may not use this file except in
11 compliance with the License. You may obtain a copy of the License at
12 http://www.mozilla.org/MPL/
13
14 Software distributed under the License is distributed on an "AS IS"
15 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16 the License for the specific language governing rights and
17 limitations under the License.
18
19
20 This program is free software; you can redistribute it and/or modify
21 it under the terms of either:
22
23 The LGPL as published by the Free Software Foundation, version
24 2.1, available at: http://www.fsf.org/copyleft/lesser.html
25
26 Or:
27
28 The Mozilla Public License Version 1.0. You may obtain a copy of
29 the License at http://www.mozilla.org/MPL/
30
31 The Original Code is icalmemory.h
32
33 ======================================================================*/
34
35/* libical often passes strings back to the caller. To make these
36 * interfaces simple, I did not want the caller to have to pass in a
37 * memory buffer, but having libical pass out newly allocated memory
38 * makes it difficult to de-allocate the memory.
39 *
40 * The ring buffer in this scheme makes it possible for libical to pass
41 * out references to memory which the caller does not own, and be able
42 * to de-allocate the memory later. The ring allows libical to have
43 * several buffers active simultaneously, which is handy when creating
44 * string representations of components. */
45
46#define ICALMEMORY_C
47
48#ifdef HAVE_CONFIG_H
49#include "config.h"
50#endif
51
52#ifdef DMALLOC
53#include "dmalloc.h"
54#endif
55
56#include "icalmemory.h"
57#include "icalerror.h"
58
59#include <stdio.h> /* for printf (debugging) */
60#include <stdlib.h> /* for malloc, realloc */
61#include <string.h> /* for memset(), strdup */
62
63#define BUFFER_RING_SIZE 25
64#define MIN_BUFFER_SIZE 200
65
66void icalmemory_free_tmp_buffer (void* buf);
67
68
69/* HACK. Not threadsafe */
70void* buffer_ring[BUFFER_RING_SIZE];
71int buffer_pos = -1;
72int initialized = 0;
73
74/* Add an existing buffer to the buffer ring */
75void icalmemory_add_tmp_buffer(void* buf)
76{
77 /* I don't think I need this -- I think static arrays are
78 initialized to 0 as a standard part of C, but I am not sure. */
79 if (initialized == 0){
80 int i;
81 for(i=0; i<BUFFER_RING_SIZE; i++){
82 buffer_ring[i] = 0;
83 }
84 initialized = 1;
85 }
86
87 /* Wrap around the ring */
88 if(++buffer_pos == BUFFER_RING_SIZE){
89 buffer_pos = 0;
90 }
91
92 /* Free buffers as their slots are overwritten */
93 if ( buffer_ring[buffer_pos] != 0){
94 free( buffer_ring[buffer_pos]);
95 buffer_ring[buffer_pos] = 0;
96 }
97
98 /* Assign the buffer to a slot */
99 buffer_ring[buffer_pos] = buf;
100}
101
102/* Create a new temporary buffer on the ring. Libical owns these and
103 wil deallocate them. */
104void*
105icalmemory_tmp_buffer (size_t size)
106{
107 char *buf;
108
109 if (size < MIN_BUFFER_SIZE){
110 size = MIN_BUFFER_SIZE;
111 }
112
113 buf = (void*)malloc(size);
114
115 if( buf == 0){
116 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
117 return 0;
118 }
119
120 memset(buf,0,size);
121
122 icalmemory_add_tmp_buffer(buf);
123
124 return buf;
125}
126
127void icalmemory_free_ring()
128{
129
130 int i;
131 for(i=0; i<BUFFER_RING_SIZE; i++){
132 if ( buffer_ring[i] != 0){
133 free( buffer_ring[i]);
134 }
135 buffer_ring[i] = 0;
136 }
137
138 initialized = 1;
139
140}
141
142
143
144/* Like strdup, but the buffer is on the ring. */
145char*
146icalmemory_tmp_copy(const char* str)
147{
148 char* b = icalmemory_tmp_buffer(strlen(str)+1);
149
150 strcpy(b,str);
151
152 return b;
153}
154
155
156char* icalmemory_strdup(const char *s)
157{
158 return strdup(s);
159}
160
161void
162icalmemory_free_tmp_buffer (void* buf)
163{
164 if(buf == 0)
165 {
166 return;
167 }
168
169 free(buf);
170}
171
172
173/* These buffer routines create memory the old fashioned way -- so the
174 caller will have to delocate the new memory */
175
176void* icalmemory_new_buffer(size_t size)
177{
178 void *b = malloc(size);
179
180 if( b == 0){
181 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
182 return 0;
183 }
184
185 memset(b,0,size);
186
187 return b;
188}
189
190void* icalmemory_resize_buffer(void* buf, size_t size)
191{
192 void *b = realloc(buf, size);
193
194 if( b == 0){
195 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
196 return 0;
197 }
198
199 return b;
200}
201
202void icalmemory_free_buffer(void* buf)
203{
204 free(buf);
205}
206
207void
208icalmemory_append_string(char** buf, char** pos, size_t* buf_size,
209 const char* string)
210{
211 char *new_buf;
212 char *new_pos;
213
214 size_t data_length, final_length, string_length;
215
216#ifndef ICAL_NO_INTERNAL_DEBUG
217 icalerror_check_arg_rv( (buf!=0),"buf");
218 icalerror_check_arg_rv( (*buf!=0),"*buf");
219 icalerror_check_arg_rv( (pos!=0),"pos");
220 icalerror_check_arg_rv( (*pos!=0),"*pos");
221 icalerror_check_arg_rv( (buf_size!=0),"buf_size");
222 icalerror_check_arg_rv( (*buf_size!=0),"*buf_size");
223 icalerror_check_arg_rv( (string!=0),"string");
224#endif
225
226 string_length = strlen(string);
227 data_length = (size_t)*pos - (size_t)*buf;
228 final_length = data_length + string_length;
229
230 if ( final_length >= (size_t) *buf_size) {
231
232
233 *buf_size = (*buf_size) * 2 + final_length;
234
235 new_buf = realloc(*buf,*buf_size);
236
237 new_pos = (void*)((size_t)new_buf + data_length);
238
239 *pos = new_pos;
240 *buf = new_buf;
241 }
242
243 strcpy(*pos, string);
244
245 *pos += string_length;
246}
247
248
249void
250icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
251 char ch)
252{
253 char *new_buf;
254 char *new_pos;
255
256 size_t data_length, final_length;
257
258#ifndef ICAL_NO_INTERNAL_DEBUG
259 icalerror_check_arg_rv( (buf!=0),"buf");
260 icalerror_check_arg_rv( (*buf!=0),"*buf");
261 icalerror_check_arg_rv( (pos!=0),"pos");
262 icalerror_check_arg_rv( (*pos!=0),"*pos");
263 icalerror_check_arg_rv( (buf_size!=0),"buf_size");
264 icalerror_check_arg_rv( (*buf_size!=0),"*buf_size");
265#endif
266
267 data_length = (size_t)*pos - (size_t)*buf;
268
269 final_length = data_length + 2;
270
271 if ( final_length > (size_t) *buf_size ) {
272
273
274 *buf_size = (*buf_size) * 2 + final_length +1;
275
276 new_buf = realloc(*buf,*buf_size);
277
278 new_pos = (void*)((size_t)new_buf + data_length);
279
280 *pos = new_pos;
281 *buf = new_buf;
282 }
283
284 **pos = ch;
285 *pos += 1;
286 **pos = 0;
287}
diff --git a/libical/src/libical/icalmemory.h b/libical/src/libical/icalmemory.h
new file mode 100644
index 0000000..f833c6c
--- a/dev/null
+++ b/libical/src/libical/icalmemory.h
@@ -0,0 +1,85 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalmemory.h
4 CREATOR: eric 30 June 1999
5
6
7 $Id$
8 $Locker$
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of either:
12
13 The LGPL as published by the Free Software Foundation, version
14 2.1, available at: http://www.fsf.org/copyleft/lesser.html
15
16 Or:
17
18 The Mozilla Public License Version 1.0. You may obtain a copy of
19 the License at http://www.mozilla.org/MPL/
20
21 The Initial Developer of the Original Code is Eric Busboom
22
23 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
24======================================================================*/
25
26#ifndef ICALMEMORY_H
27#define ICALMEMORY_H
28
29#include <sys/types.h> /* for size_t */
30
31// Eugen C. <eug@thekompany.com>
32#ifdef _WIN32
33#include <stddef.h>
34#endif
35// Eugen C. <eug@thekompany.com>
36
37/* Tmp buffers are managed by ical. References can be returned to the
38 caller, although the caller will not own the memory. */
39
40void* icalmemory_tmp_buffer(size_t size);
41char* icalmemory_tmp_copy(const char* str);
42
43/* Add an externally allocated buffer to the ring. */
44void icalmemory_add_tmp_buffer(void*);
45
46
47/* Free all memory used in the ring */
48void icalmemory_free_ring(void);
49
50/* Non-tmp buffers must be freed. These are mostly wrappers around
51 * malloc, etc, but are used so the caller can change the memory
52 * allocators in a future version of the library */
53
54void* icalmemory_new_buffer(size_t size);
55void* icalmemory_resize_buffer(void* buf, size_t size);
56void icalmemory_free_buffer(void* buf);
57
58/* icalmemory_append_string will copy the string 'string' to the
59 buffer 'buf' starting at position 'pos', reallocing 'buf' if it is
60 too small. 'buf_size' is the size of 'buf' and will be changed if
61 'buf' is reallocated. 'pos' will point to the last byte of the new
62 string in 'buf', usually a '\0' */
63
64/* THESE ROUTINES CAN NOT BE USED ON TMP BUFFERS. Only use them on
65 normally allocated memory, or on buffers created from
66 icalmemory_new_buffer, never with buffers created by
67 icalmemory_tmp_buffer. If icalmemory_append_string has to resize a
68 buffer on the ring, the ring will loose track of it an you will
69 have memory problems. */
70
71void icalmemory_append_string(char** buf, char** pos, size_t* buf_size,
72 const char* string);
73
74/* icalmemory_append_char is similar, but is appends a character instead of a string */
75void icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
76 char ch);
77
78/* A wrapper around strdup. Partly to trap calls to strdup, partly
79 because in -ansi, gcc on Red Hat claims that strudup is undeclared */
80char* icalmemory_strdup(const char *s);
81
82#endif /* !ICALMEMORY_H */
83
84
85
diff --git a/libical/src/libical/icalmime.c b/libical/src/libical/icalmime.c
new file mode 100644
index 0000000..7021746
--- a/dev/null
+++ b/libical/src/libical/icalmime.c
@@ -0,0 +1,388 @@
1/* -*- Mode: C -*-*/
2/*======================================================================
3 FILE: icalmime.c
4 CREATOR: eric 26 July 2000
5
6
7 $Id$
8 $Locker$
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The Original Code is eric. The Initial Developer of the Original
24 Code is Eric Busboom
25
26
27======================================================================*/
28
29#include "icalmime.h"
30#include "icalerror.h"
31#include "icalmemory.h"
32#include "sspm.h"
33#include "stdlib.h"
34#include <string.h> /* For strdup */
35#include <stdio.h> /* for snprintf*/
36
37int snprintf(char *str, size_t n, char const *fmt, ...);
38
39#ifdef DMALLOC
40#include "dmalloc.h"
41#endif
42
43
44/* These *_part routines are called by the MIME parser via the
45 local_action_map */
46
47struct text_part
48{
49 char* buf;
50 char* buf_pos;
51 size_t buf_size;
52};
53
54void* icalmime_text_new_part()
55{
56
57#define BUF_SIZE 2048
58
59 struct text_part* impl;
60
61 if ( ( impl = (struct text_part*)
62 malloc(sizeof(struct text_part))) == 0) {
63 return 0;
64 }
65
66 impl->buf = icalmemory_new_buffer(BUF_SIZE);
67 impl->buf_pos = impl->buf;
68 impl->buf_size = BUF_SIZE;
69
70 return impl;
71}
72void icalmime_text_add_line(void *part,
73 struct sspm_header *header,
74 char* line, size_t size)
75{
76 struct text_part* impl = (struct text_part*) part;
77
78 icalmemory_append_string(&(impl->buf),&(impl->buf_pos),
79 &(impl->buf_size),line);
80
81}
82
83void* icalmime_textcalendar_end_part(void* part)
84{
85
86 struct text_part* impl = (struct text_part*) part;
87 icalcomponent *c = icalparser_parse_string(impl->buf);
88
89 icalmemory_free_buffer(impl->buf);
90 free(impl);
91
92 return c;
93
94}
95
96void* icalmime_text_end_part(void* part)
97{
98 struct text_part* impl = ( struct text_part*) part;
99
100 icalmemory_add_tmp_buffer(impl->buf);
101 free(impl);
102
103 return impl->buf;
104}
105
106void icalmime_text_free_part(void *part)
107{
108 part = part;
109}
110
111
112/* Ignore Attachments for now */
113
114void* icalmime_attachment_new_part()
115{
116 return 0;
117}
118void icalmime_attachment_add_line(void *part, struct sspm_header *header,
119 char* line, size_t size)
120{
121 part = part;
122 header = header;
123 line = line;
124 size = size;
125}
126
127void* icalmime_attachment_end_part(void* part)
128{
129 return 0;
130}
131
132void icalmime_attachment_free_part(void *part)
133{
134}
135
136
137
138
139struct sspm_action_map icalmime_local_action_map[] =
140{
141 {SSPM_TEXT_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_text_new_part,icalmime_text_add_line,icalmime_textcalendar_end_part,icalmime_text_free_part},
142 {SSPM_TEXT_MAJOR_TYPE,SSPM_ANY_MINOR_TYPE,icalmime_text_new_part,icalmime_text_add_line,icalmime_text_end_part,icalmime_text_free_part},
143 {SSPM_TEXT_MAJOR_TYPE,SSPM_PLAIN_MINOR_TYPE,icalmime_text_new_part,icalmime_text_add_line,icalmime_text_end_part,icalmime_text_free_part},
144 {SSPM_APPLICATION_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
145 {SSPM_IMAGE_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
146 {SSPM_AUDIO_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
147 {SSPM_IMAGE_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
148 {SSPM_UNKNOWN_MAJOR_TYPE,SSPM_UNKNOWN_MINOR_TYPE,0,0,0,0}
149};
150
151#define NUM_PARTS 100 /* HACK. Hard Limit */
152
153
154
155struct sspm_part* icalmime_make_part(icalcomponent* comp)
156{
157 comp = comp;
158 return 0;
159}
160
161char* icalmime_as_mime_string(char* icalcomponent);
162
163icalcomponent* icalmime_parse(char* (*get_string)(char *s, size_t size,
164 void *d),
165 void *data)
166{
167 struct sspm_part *parts;
168 int i, last_level=0;
169 icalcomponent *root=0, *parent=0, *comp=0, *last = 0;
170
171 if ( (parts = (struct sspm_part *)
172 malloc(NUM_PARTS*sizeof(struct sspm_part)))==0) {
173 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
174 return 0;
175 }
176
177 memset(parts,0,sizeof(parts));
178
179 sspm_parse_mime(parts,
180 NUM_PARTS, /* Max parts */
181 icalmime_local_action_map, /* Actions */
182 get_string,
183 data, /* data for get_string*/
184 0 /* First header */);
185
186
187
188 for(i = 0; i <NUM_PARTS && parts[i].header.major != SSPM_NO_MAJOR_TYPE ; i++){
189
190#define TMPSZ 1024
191 char mimetype[TMPSZ];
192 char* major = sspm_major_type_string(parts[i].header.major);
193 char* minor = sspm_minor_type_string(parts[i].header.minor);
194
195 if(parts[i].header.minor == SSPM_UNKNOWN_MINOR_TYPE ){
196 assert(parts[i].header.minor_text !=0);
197 minor = parts[i].header.minor_text;
198 }
199
200 sprintf(mimetype,"%s/%s",major,minor);
201
202 comp = icalcomponent_new(ICAL_XLICMIMEPART_COMPONENT);
203
204 if(comp == 0){
205 /* HACK Handle Error */
206 assert(0);
207 }
208
209 if(parts[i].header.error!=SSPM_NO_ERROR){
210 char *str;
211 char* temp[256];
212
213 if(parts[i].header.error==SSPM_UNEXPECTED_BOUNDARY_ERROR){
214 str = "Got an unexpected boundary, possibly due to a MIME header for a MULTIPART part that is missing the Content-Type line";
215 }
216
217 if(parts[i].header.error==SSPM_WRONG_BOUNDARY_ERROR){
218 str = "Got the wrong boundary for the opening of a MULTIPART part.";
219 }
220
221 if(parts[i].header.error==SSPM_NO_BOUNDARY_ERROR){
222 str = "Got a multipart header that did not specify a boundary";
223 }
224
225 if(parts[i].header.error==SSPM_NO_HEADER_ERROR){
226 str = "Did not get a header for the part. Is there a blank\
227line between the header and the previous boundary\?";
228
229 }
230
231 if(parts[i].header.error_text != 0){
232 snprintf((char*)temp,256,
233 "%s: %s",str,parts[i].header.error_text);
234 } else {
235 strcpy((char*)temp,str);
236 }
237
238 icalcomponent_add_property
239 (comp,
240 icalproperty_vanew_xlicerror(
241 (char*)temp,
242 icalparameter_new_xlicerrortype(
243 ICAL_XLICERRORTYPE_MIMEPARSEERROR),
244 0));
245 }
246
247 if(parts[i].header.major != SSPM_NO_MAJOR_TYPE &&
248 parts[i].header.major != SSPM_UNKNOWN_MAJOR_TYPE){
249
250 icalcomponent_add_property(comp,
251 icalproperty_new_xlicmimecontenttype((char*)
252 icalmemory_strdup(mimetype)));
253
254 }
255
256 if (parts[i].header.encoding != SSPM_NO_ENCODING){
257
258 icalcomponent_add_property(comp,
259 icalproperty_new_xlicmimeencoding(
260 sspm_encoding_string(parts[i].header.encoding)));
261 }
262
263 if (parts[i].header.filename != 0){
264 icalcomponent_add_property(comp,
265 icalproperty_new_xlicmimefilename(parts[i].header.filename));
266 }
267
268 if (parts[i].header.content_id != 0){
269 icalcomponent_add_property(comp,
270 icalproperty_new_xlicmimecid(parts[i].header.content_id));
271 }
272
273 if (parts[i].header.charset != 0){
274 icalcomponent_add_property(comp,
275 icalproperty_new_xlicmimecharset(parts[i].header.charset));
276 }
277
278 /* Add iCal components as children of the component */
279 if(parts[i].header.major == SSPM_TEXT_MAJOR_TYPE &&
280 parts[i].header.minor == SSPM_CALENDAR_MINOR_TYPE &&
281 parts[i].data != 0){
282
283 icalcomponent_add_component(comp,
284 (icalcomponent*)parts[i].data);
285 parts[i].data = 0;
286
287 } else if(parts[i].header.major == SSPM_TEXT_MAJOR_TYPE &&
288 parts[i].header.minor != SSPM_CALENDAR_MINOR_TYPE &&
289 parts[i].data != 0){
290
291 /* Add other text components as "DESCRIPTION" properties */
292
293 icalcomponent_add_property(comp,
294 icalproperty_new_description(
295 (char*)icalmemory_strdup((char*)parts[i].data)));
296
297 parts[i].data = 0;
298 }
299
300
301 if(root!= 0 && parts[i].level == 0){
302 /* We've already assigned the root, but there is another
303 part at the root level. This is probably a parse
304 error*/
305 icalcomponent_free(comp);
306 continue;
307 }
308
309 if(parts[i].level == last_level && last_level != 0){
310 icalerror_assert(parent!=0,"No parent for adding component");
311
312 icalcomponent_add_component(parent,comp);
313
314 } else if (parts[i].level == last_level && last_level == 0 &&
315 root == 0) {
316
317 root = comp;
318 parent = comp;
319
320 } else if (parts[i].level > last_level){
321
322 parent = last;
323 icalcomponent_add_component(parent,comp);
324
325 last_level = parts[i].level;
326
327 } else if (parts[i].level < last_level){
328
329 parent = icalcomponent_get_parent(parent);
330 icalcomponent_add_component(parent,comp);
331
332 last_level = parts[i].level;
333 } else {
334 assert(0);
335 }
336
337 last = comp;
338 last_level = parts[i].level;
339 assert(parts[i].data == 0);
340 }
341
342 sspm_free_parts(parts,NUM_PARTS);
343 free(parts);
344
345 return root;
346}
347
348
349
350int icalmime_test(char* (*get_string)(char *s, size_t size, void *d),
351 void *data)
352{
353 char *out;
354 struct sspm_part *parts;
355 int i;
356
357 if ( (parts = (struct sspm_part *)
358 malloc(NUM_PARTS*sizeof(struct sspm_part)))==0) {
359 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
360 return 0;
361 }
362
363 memset(parts,0,sizeof(parts));
364
365 sspm_parse_mime(parts,
366 NUM_PARTS, /* Max parts */
367 icalmime_local_action_map, /* Actions */
368 get_string,
369 data, /* data for get_string*/
370 0 /* First header */);
371
372 for(i = 0; i <NUM_PARTS && parts[i].header.major != SSPM_NO_MAJOR_TYPE ;
373 i++){
374 if(parts[i].header.minor == SSPM_CALENDAR_MINOR_TYPE){
375 parts[i].data = icalmemory_strdup(
376 icalcomponent_as_ical_string((icalcomponent*)parts[i].data));
377 }
378 }
379
380 sspm_write_mime(parts,NUM_PARTS,&out,"To: bob@bob.org");
381
382 printf("%s\n",out);
383
384 return 0;
385
386}
387
388
diff --git a/libical/src/libical/icalmime.h b/libical/src/libical/icalmime.h
new file mode 100644
index 0000000..b222888
--- a/dev/null
+++ b/libical/src/libical/icalmime.h
@@ -0,0 +1,43 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalmime.h
4 CREATOR: eric 26 July 2000
5
6
7 $Id$
8 $Locker$
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23======================================================================*/
24
25#ifndef ICALMIME_H
26#define ICALMIME_H
27
28#include "icalcomponent.h"
29#include "icalparser.h"
30
31 icalcomponent* icalmime_parse(char* (*line_gen_func)(char *s, size_t size,
32 void *d),
33 void *data);
34
35/* The inverse of icalmime_parse, not implemented yet. Use sspm.h directly. */
36char* icalmime_as_mime_string(char* component);
37
38
39
40#endif /* !ICALMIME_H */
41
42
43
diff --git a/libical/src/libical/icalparameter.c b/libical/src/libical/icalparameter.c
new file mode 100644
index 0000000..156ecdb
--- a/dev/null
+++ b/libical/src/libical/icalparameter.c
@@ -0,0 +1,382 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalderivedparameters.{c,h}
4 CREATOR: eric 09 May 1999
5
6 $Id$
7 $Locker$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icalderivedparameters.{c,h}
24
25 Contributions from:
26 Graham Davison (g.m.davison@computer.org)
27
28 ======================================================================*/
29/*#line 29 "icalparameter.c.in"*/
30#ifdef HAVE_CONFIG_H
31#include <config.h>
32#endif
33
34
35#include "icalparameter.h"
36#include "icalproperty.h"
37#include "icalerror.h"
38#include "icalmemory.h"
39#include "icalparameterimpl.h"
40
41#include <stdlib.h> /* for malloc() */
42#include <errno.h>
43#include <string.h> /* for memset() */
44
45/* In icalderivedparameter */
46icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val);
47
48
49struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind)
50{
51 struct icalparameter_impl* v;
52
53 if ( ( v = (struct icalparameter_impl*)
54 malloc(sizeof(struct icalparameter_impl))) == 0) {
55 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
56 return 0;
57 }
58
59 strcpy(v->id,"para");
60
61 v->kind = kind;
62 v->size = 0;
63 v->string = 0;
64 v->x_name = 0;
65 v->parent = 0;
66 v->data = 0;
67
68 return v;
69}
70
71icalparameter*
72icalparameter_new (icalparameter_kind kind)
73{
74 struct icalparameter_impl* v = icalparameter_new_impl(kind);
75
76 return (icalparameter*) v;
77
78}
79
80void
81icalparameter_free (icalparameter* parameter)
82{
83 struct icalparameter_impl * impl;
84
85 impl = (struct icalparameter_impl*)parameter;
86
87/* HACK. This always triggers, even when parameter is non-zero
88 icalerror_check_arg_rv((parameter==0),"parameter");*/
89
90
91#ifdef ICAL_FREE_ON_LIST_IS_ERROR
92 icalerror_assert( (impl->parent ==0),"Tried to free a parameter that is still attached to a component. ");
93
94#else
95 if(impl->parent !=0){
96 return;
97 }
98#endif
99
100
101 if (impl->string != 0){
102 free ((void*)impl->string);
103 }
104
105 if (impl->x_name != 0){
106 free ((void*)impl->x_name);
107 }
108
109 memset(impl,0,sizeof(impl));
110
111 impl->parent = 0;
112 impl->id[0] = 'X';
113 free(impl);
114}
115
116
117
118icalparameter*
119icalparameter_new_clone(icalparameter* param)
120{
121 struct icalparameter_impl *old;
122 struct icalparameter_impl *new;
123
124 old = (struct icalparameter_impl *)param;
125 new = icalparameter_new_impl(old->kind);
126
127 icalerror_check_arg_rz((param!=0),"param");
128
129 if (new == 0){
130 return 0;
131 }
132
133 memcpy(new,old,sizeof(struct icalparameter_impl));
134
135 if (old->string != 0){
136 new->string = icalmemory_strdup(old->string);
137 if (new->string == 0){
138 icalparameter_free(new);
139 return 0;
140 }
141 }
142
143 if (old->x_name != 0){
144 new->x_name = icalmemory_strdup(old->x_name);
145 if (new->x_name == 0){
146 icalparameter_free(new);
147 return 0;
148 }
149 }
150
151 return new;
152}
153
154icalparameter* icalparameter_new_from_string(const char *str)
155{
156 char* eq;
157 char* cpy;
158 icalparameter_kind kind;
159 icalparameter *param;
160
161 icalerror_check_arg_rz(str != 0,"str");
162
163 cpy = icalmemory_strdup(str);
164
165 if (cpy == 0){
166 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
167 return 0;
168 }
169
170 eq = strchr(cpy,'=');
171
172 if(eq == 0){
173 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
174 return 0;
175 }
176
177 *eq = '\0';
178
179 eq++;
180
181 kind = icalparameter_string_to_kind(cpy);
182
183 if(kind == ICAL_NO_PARAMETER){
184 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
185 return 0;
186 }
187
188 param = icalparameter_new_from_value_string(kind,eq);
189
190 if(kind == ICAL_X_PARAMETER){
191 icalparameter_set_xname(param,cpy);
192 }
193
194 free(cpy);
195
196 return param;
197
198}
199
200char*
201icalparameter_as_ical_string (icalparameter* parameter)
202{
203 struct icalparameter_impl* impl;
204 size_t buf_size = 1024;
205 char* buf;
206 char* buf_ptr;
207 char *out_buf;
208 const char *kind_string;
209
210 icalerror_check_arg_rz( (parameter!=0), "parameter");
211
212 /* Create new buffer that we can append names, parameters and a
213 value to, and reallocate as needed. Later, this buffer will be
214 copied to a icalmemory_tmp_buffer, which is managed internally
215 by libical, so it can be given to the caller without fear of
216 the caller forgetting to free it */
217
218 buf = icalmemory_new_buffer(buf_size);
219 buf_ptr = buf;
220 impl = (struct icalparameter_impl*)parameter;
221
222 if(impl->kind == ICAL_X_PARAMETER) {
223
224 icalmemory_append_string(&buf, &buf_ptr, &buf_size,
225 icalparameter_get_xname(impl));
226
227 } else {
228
229 kind_string = icalparameter_kind_to_string(impl->kind);
230
231 if (impl->kind == ICAL_NO_PARAMETER ||
232 impl->kind == ICAL_ANY_PARAMETER ||
233 kind_string == 0)
234 {
235 icalerror_set_errno(ICAL_BADARG_ERROR);
236 return 0;
237 }
238
239
240 /* Put the parameter name into the string */
241 icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
242
243 }
244
245 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "=");
246
247 if(impl->string !=0){
248 icalmemory_append_string(&buf, &buf_ptr, &buf_size, impl->string);
249 } else if (impl->data != 0){
250 const char* str = icalparameter_enum_to_string(impl->data);
251 icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
252 } else {
253 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
254 return 0;
255 }
256
257 /* Now, copy the buffer to a tmp_buffer, which is safe to give to
258 the caller without worring about de-allocating it. */
259
260 out_buf = icalmemory_tmp_buffer(strlen(buf));
261 strcpy(out_buf, buf);
262
263 icalmemory_free_buffer(buf);
264
265 return out_buf;
266
267}
268
269
270int
271icalparameter_is_valid (icalparameter* parameter);
272
273
274icalparameter_kind
275icalparameter_isa (icalparameter* parameter)
276{
277 if(parameter == 0){
278 return ICAL_NO_PARAMETER;
279 }
280
281 return ((struct icalparameter_impl *)parameter)->kind;
282}
283
284
285int
286icalparameter_isa_parameter (void* parameter)
287{
288 struct icalparameter_impl *impl = (struct icalparameter_impl *)parameter;
289
290 if (parameter == 0){
291 return 0;
292 }
293
294 if (strcmp(impl->id,"para") == 0) {
295 return 1;
296 } else {
297 return 0;
298 }
299}
300
301
302void
303icalparameter_set_xname (icalparameter* param, const char* v)
304{
305 struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
306 icalerror_check_arg_rv( (param!=0),"param");
307 icalerror_check_arg_rv( (v!=0),"v");
308
309 if (impl->x_name != 0){
310 free((void*)impl->x_name);
311 }
312
313 impl->x_name = icalmemory_strdup(v);
314
315 if (impl->x_name == 0){
316 errno = ENOMEM;
317 }
318
319}
320
321const char*
322icalparameter_get_xname (icalparameter* param)
323{
324 struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
325 icalerror_check_arg_rz( (param!=0),"param");
326
327 return impl->x_name;
328}
329
330void
331icalparameter_set_xvalue (icalparameter* param, const char* v)
332{
333 struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
334
335 icalerror_check_arg_rv( (param!=0),"param");
336 icalerror_check_arg_rv( (v!=0),"v");
337
338 if (impl->string != 0){
339 free((void*)impl->string);
340 }
341
342 impl->string = icalmemory_strdup(v);
343
344 if (impl->string == 0){
345 errno = ENOMEM;
346 }
347
348}
349
350const char*
351icalparameter_get_xvalue (icalparameter* param)
352{
353 struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
354
355 icalerror_check_arg_rz( (param!=0),"param");
356
357 return impl->string;
358
359}
360
361void icalparameter_set_parent(icalparameter* param,
362 icalproperty* property)
363{
364 struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
365
366 icalerror_check_arg_rv( (param!=0),"param");
367
368 impl->parent = property;
369}
370
371icalproperty* icalparameter_get_parent(icalparameter* param)
372{
373 struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
374
375 icalerror_check_arg_rz( (param!=0),"param");
376
377 return impl->parent;
378}
379
380
381/* Everything below this line is machine generated. Do not edit. */
382/* ALTREP */
diff --git a/libical/src/libical/icalparameter.h b/libical/src/libical/icalparameter.h
new file mode 100644
index 0000000..3f3b59f
--- a/dev/null
+++ b/libical/src/libical/icalparameter.h
@@ -0,0 +1,69 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalparam.h
4 CREATOR: eric 20 March 1999
5
6
7 $Id$
8 $Locker$
9
10
11
12 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of either:
16
17 The LGPL as published by the Free Software Foundation, version
18 2.1, available at: http://www.fsf.org/copyleft/lesser.html
19
20 Or:
21
22 The Mozilla Public License Version 1.0. You may obtain a copy of
23 the License at http://www.mozilla.org/MPL/
24
25 The original code is icalparam.h
26
27 ======================================================================*/
28
29#ifndef ICALPARAM_H
30#define ICALPARAM_H
31
32#include "icalderivedparameter.h"
33
34/* Declared in icalderivedparameter.h */
35/*typedef void icalparameter;*/
36
37icalparameter* icalparameter_new(icalparameter_kind kind);
38icalparameter* icalparameter_new_clone(icalparameter* p);
39
40/* Create from string of form "PARAMNAME=VALUE" */
41icalparameter* icalparameter_new_from_string(const char* value);
42
43/* Create from just the value, the part after the "=" */
44icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value);
45
46void icalparameter_free(icalparameter* parameter);
47
48char* icalparameter_as_ical_string(icalparameter* parameter);
49
50int icalparameter_is_valid(icalparameter* parameter);
51
52icalparameter_kind icalparameter_isa(icalparameter* parameter);
53
54int icalparameter_isa_parameter(void* param);
55
56/* Acess the name of an X parameer */
57void icalparameter_set_xname (icalparameter* param, const char* v);
58const char* icalparameter_get_xname(icalparameter* param);
59void icalparameter_set_xvalue (icalparameter* param, const char* v);
60const char* icalparameter_get_xvalue(icalparameter* param);
61
62/* Convert enumerations */
63
64const char* icalparameter_kind_to_string(icalparameter_kind kind);
65icalparameter_kind icalparameter_string_to_kind(const char* string);
66
67
68
69#endif
diff --git a/libical/src/libical/icalparameterimpl.h b/libical/src/libical/icalparameterimpl.h
new file mode 100644
index 0000000..2d0fdd6
--- a/dev/null
+++ b/libical/src/libical/icalparameterimpl.h
@@ -0,0 +1,52 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalparameterimpl.h
4 CREATOR: eric 09 May 1999
5
6 $Id$
7 $Locker$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icalderivedparameters.{c,h}
24
25 Contributions from:
26 Graham Davison (g.m.davison@computer.org)
27
28 ======================================================================*/
29#ifdef HAVE_CONFIG_H
30#include <config.h>
31#endif
32
33#ifndef ICALPARAMETER_IMPL
34#define ICALPARAMETER_IMPL
35
36#include "icalparameter.h"
37#include "icalproperty.h"
38
39struct icalparameter_impl
40{
41 icalparameter_kind kind;
42 char id[5];
43 int size;
44 const char* string;
45 const char* x_name;
46 icalproperty* parent;
47
48 int data;
49};
50
51
52#endif /*ICALPARAMETER_IMPL*/
diff --git a/libical/src/libical/icalparser.c b/libical/src/libical/icalparser.c
new file mode 100644
index 0000000..b5824d5
--- a/dev/null
+++ b/libical/src/libical/icalparser.c
@@ -0,0 +1,1111 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalparser.c
4 CREATOR: eric 04 August 1999
5
6 $Id$
7 $Locker$
8
9 The contents of this file are subject to the Mozilla Public License
10 Version 1.0 (the "License"); you may not use this file except in
11 compliance with the License. You may obtain a copy of the License at
12 http://www.mozilla.org/MPL/
13
14 Software distributed under the License is distributed on an "AS IS"
15 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16 the License for the specific language governing rights and
17 limitations under the License.
18
19
20 This program is free software; you can redistribute it and/or modify
21 it under the terms of either:
22
23 The LGPL as published by the Free Software Foundation, version
24 2.1, available at: http://www.fsf.org/copyleft/lesser.html
25
26 Or:
27
28 The Mozilla Public License Version 1.0. You may obtain a copy of
29 the License at http://www.mozilla.org/MPL/
30
31 The Initial Developer of the Original Code is Eric Busboom
32
33 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
34 ======================================================================*/
35
36#ifdef HAVE_CONFIG_H
37#include "config.h"
38#endif
39
40
41#include "icalparser.h"
42#include "pvl.h"
43#include "icalmemory.h"
44#include "icalerror.h"
45#include "icalvalue.h"
46#include "icalderivedparameter.h"
47#include "icalparameter.h"
48#include "icalproperty.h"
49#include "icalcomponent.h"
50
51#include <string.h> /* For strncpy & size_t */
52#include <stdio.h> /* For FILE and fgets and sprintf */
53#include <stdlib.h> /* for free */
54
55int snprintf(char *str, size_t n, char const *fmt, ...);
56
57extern icalvalue* icalparser_yy_value;
58void set_parser_value_state(icalvalue_kind kind);
59int ical_yyparse(void);
60
61char* icalparser_get_next_char(char c, char *str);
62char* icalparser_get_next_parameter(char* line,char** end);
63char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind);
64char* icalparser_get_prop_name(char* line, char** end);
65char* icalparser_get_param_name(char* line, char **end);
66
67#define TMP_BUF_SIZE 80
68
69struct icalparser_impl
70{
71 int buffer_full; /* flag indicates that temp is smaller that
72 data being read into it*/
73 int continuation_line; /* last line read was a continuation line */
74 size_t tmp_buf_size;
75 char temp[TMP_BUF_SIZE];
76 icalcomponent *root_component;
77 int version;
78 int level;
79 int lineno;
80 icalparser_state state;
81 pvl_list components;
82
83 void *line_gen_data;
84
85};
86
87
88icalparser* icalparser_new(void)
89{
90 struct icalparser_impl* impl = 0;
91 if ( ( impl = (struct icalparser_impl*)
92 malloc(sizeof(struct icalparser_impl))) == 0) {
93 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
94 return 0;
95 }
96
97 impl->root_component = 0;
98 impl->components = pvl_newlist();
99 impl->level = 0;
100 impl->state = ICALPARSER_SUCCESS;
101 impl->tmp_buf_size = TMP_BUF_SIZE;
102 impl->buffer_full = 0;
103 impl->lineno = 0;
104 impl->continuation_line = 0;
105 memset(impl->temp,0, TMP_BUF_SIZE);
106
107 return (icalparser*)impl;
108}
109
110
111void icalparser_free(icalparser* parser)
112{
113 struct icalparser_impl* impl = (struct icalparser_impl*)parser;
114 icalcomponent *c;
115
116 if (impl->root_component != 0){
117 icalcomponent_free(impl->root_component);
118 }
119
120 while( (c=pvl_pop(impl->components)) != 0){
121 icalcomponent_free(c);
122 }
123
124 pvl_free(impl->components);
125
126 free(impl);
127}
128
129void icalparser_set_gen_data(icalparser* parser, void* data)
130{
131 struct icalparser_impl* impl = (struct icalparser_impl*)parser;
132
133 impl->line_gen_data = data;
134}
135
136
137icalvalue* icalvalue_new_From_string_with_error(icalvalue_kind kind,
138 char* str,
139 icalproperty **error);
140
141
142
143char* icalparser_get_next_char(char c, char *str)
144{
145 int quote_mode = 0;
146 char* p;
147
148
149 for(p=str; *p!=0; p++){
150
151 if ( quote_mode == 0 && *p=='"' && *(p-1) != '\\' ){
152 quote_mode =1;
153 continue;
154 }
155
156 if ( quote_mode == 1 && *p=='"' && *(p-1) != '\\' ){
157 quote_mode =0;
158 continue;
159 }
160
161 if (quote_mode == 0 && *p== c && *(p-1) != '\\' ){
162 return p;
163 }
164
165 }
166
167 return 0;
168}
169
170/* make a new tmp buffer out of a substring */
171char* make_segment(char* start, char* end)
172{
173 char *buf;
174 size_t size = (size_t)end - (size_t)start;
175
176 buf = icalmemory_tmp_buffer(size+1);
177
178
179 strncpy(buf,start,size);
180 *(buf+size) = 0;
181
182 return buf;
183
184}
185
186const char* input_buffer;
187const char* input_buffer_p;
188//#define min(a,b) ((a) < (b) ? (a) : (b))
189
190int icalparser_flex_input(char* buf, int max_size)
191{
192 int n = max_size; // = min(max_size,strlen(input_buffer_p));
193 if ( n < ((int )strlen(input_buffer_p)) )
194 n = strlen(input_buffer_p);
195 if (n > 0){
196 memcpy(buf, input_buffer_p, n);
197 input_buffer_p += n;
198 return n;
199 } else {
200 return 0;
201 }
202}
203
204void icalparser_clear_flex_input(void)
205{
206 input_buffer_p = input_buffer+strlen(input_buffer);
207}
208
209/* Call the flex/bison parser to parse a complex value */
210
211icalvalue* icalparser_parse_value(icalvalue_kind kind,
212 const char* str, icalproperty** error)
213{
214 int r;
215 input_buffer_p = input_buffer = str;
216
217 set_parser_value_state(kind);
218 icalparser_yy_value = 0;
219
220 r = ical_yyparse();
221
222 /* Error. Parse failed */
223 if( icalparser_yy_value == 0 || r != 0){
224
225 if(icalparser_yy_value !=0){
226 icalvalue_free(icalparser_yy_value);
227 icalparser_yy_value = 0;
228 }
229
230 return 0;
231 }
232
233 if (error != 0){
234 *error = 0;
235 }
236
237 return icalparser_yy_value;
238}
239
240char* icalparser_get_prop_name(char* line, char** end)
241{
242 char* p;
243 char* v;
244 char *str;
245
246 p = icalparser_get_next_char(';',line);
247 v = icalparser_get_next_char(':',line);
248 if (p== 0 && v == 0) {
249 return 0;
250 }
251
252 /* There is no ';' or, it is after the ';' that marks the beginning of
253 the value */
254 if (v!=0 && ( p == 0 || p > v)){
255 str = make_segment(line,v);
256 *end = v+1;
257 } else {
258 str = make_segment(line,p);
259 *end = p+1;
260 }
261
262 return str;
263}
264
265char* icalparser_get_param_name(char* line, char **end)
266{
267
268 char* next;
269 char *str;
270
271 next = icalparser_get_next_char('=',line);
272
273 if (next == 0) {
274 return 0;
275 }
276
277 str = make_segment(line,next);
278 *end = next+1;
279 return str;
280
281}
282
283char* icalparser_get_next_paramvalue(char* line, char **end)
284{
285
286 char* next;
287 char *str;
288
289 next = icalparser_get_next_char(',',line);
290
291 if (next == 0){
292 next = (char*)(size_t)line+(size_t)strlen(line);\
293 }
294
295 if (next == line){
296 return 0;
297 } else {
298 str = make_segment(line,next);
299 *end = next+1;
300 return str;
301 }
302
303}
304
305/* A property may have multiple values, if the values are seperated by
306 commas in the content line. This routine will look for the next
307 comma after line and will set the next place to start searching in
308 end. */
309
310char* icalparser_get_next_value(char* line, char **end, icalvalue_kind kind)
311{
312
313 char* next;
314 char *p;
315 char *str;
316 size_t length = strlen(line);
317
318 p = line;
319 while(1){
320
321 next = icalparser_get_next_char(',',p);
322
323 /* Unforunately, RFC2445 says that for the RECUR value, COMMA
324 can both seperate digits in a list, and it can seperate
325 multiple recurrence specifications. This is not a friendly
326 part of the spec. This weirdness tries to
327 distinguish the two uses. it is probably a HACK*/
328
329 if( kind == ICAL_RECUR_VALUE ) {
330 if ( next != 0 &&
331 (*end+length) > next+5 &&
332 strncmp(next,"FREQ",4) == 0
333 ) {
334 /* The COMMA was followed by 'FREQ', is it a real seperator*/
335 /* Fall through */
336 } else if (next != 0){
337 /* Not real, get the next COMMA */
338 p = next+1;
339 next = 0;
340 continue;
341 }
342 }
343
344 /* If the comma is preceeded by a '\', then it is a literal and
345 not a value seperator*/
346
347 if ( (next!=0 && *(next-1) == '\\') ||
348 (next!=0 && *(next-3) == '\\')
349 )
350 /*second clause for '/' is on prev line. HACK may be out of bounds */
351 {
352 p = next+1;
353 } else {
354 break;
355 }
356
357 }
358
359 if (next == 0){
360 next = (char*)(size_t)line+length;
361 *end = next;
362 } else {
363 *end = next+1;
364 }
365
366 if (next == line){
367 return 0;
368 }
369
370
371 str = make_segment(line,next);
372 return str;
373
374}
375
376char* icalparser_get_next_parameter(char* line,char** end)
377{
378 char *next;
379 char *v;
380 char *str;
381
382 v = icalparser_get_next_char(':',line);
383 next = icalparser_get_next_char(';', line);
384
385 /* There is no ';' or, it is after the ':' that marks the beginning of
386 the value */
387
388 if (next == 0 || next > v) {
389 next = icalparser_get_next_char(':', line);
390 }
391
392 if (next != 0) {
393 str = make_segment(line,next);
394 *end = next+1;
395 return str;
396 } else {
397 *end = line;
398 return 0;
399 }
400}
401
402/* Get a single property line, from the property name through the
403 final new line, and include any continuation lines */
404
405char* icalparser_get_line(icalparser *parser,
406 char* (*line_gen_func)(char *s, size_t size, void *d))
407{
408 char *line;
409 char *line_p;
410 struct icalparser_impl* impl = (struct icalparser_impl*)parser;
411 size_t buf_size = impl->tmp_buf_size;
412
413
414 line_p = line = icalmemory_new_buffer(buf_size);
415 line[0] = '\0';
416
417 /* Read lines by calling line_gen_func and putting the data into
418 impl->temp. If the line is a continuation line ( begins with a
419 space after a newline ) then append the data onto line and read
420 again. Otherwise, exit the loop. */
421
422 while(1) {
423
424 /* The first part of the loop deals with the temp buffer,
425 which was read on he last pass through the loop. The
426 routine is split like this because it has to read lone line
427 ahead to determine if a line is a continuation line. */
428
429
430 /* The tmp buffer is not clear, so transfer the data in it to the
431 output. This may be left over from a previous call */
432 if (impl->temp[0] != '\0' ) {
433
434 /* If the last position in the temp buffer is occupied,
435 mark the buffer as full. The means we will do another
436 read later, because the line is not finished */
437 if (impl->temp[impl->tmp_buf_size-1] == 0 &&
438 impl->temp[impl->tmp_buf_size-2] != '\n'&&
439 impl->temp[impl->tmp_buf_size-2] != 0 ){
440 impl->buffer_full = 1;
441 } else {
442 impl->buffer_full = 0;
443 }
444
445 /* Copy the temp to the output and clear the temp buffer. */
446 if(impl->continuation_line==1){
447 /* back up the pointer to erase the continuation characters */
448 impl->continuation_line = 0;
449 line_p--;
450
451 if ( *(line_p-1) == '\r'){
452 line_p--;
453 }
454
455 /* copy one space up to eliminate the leading space*/
456 icalmemory_append_string(&line,&line_p,&buf_size,
457 impl->temp+1);
458
459 } else {
460 icalmemory_append_string(&line,&line_p,&buf_size,impl->temp);
461 }
462
463 impl->temp[0] = '\0' ;
464 }
465
466 impl->temp[impl->tmp_buf_size-1] = 1; /* Mark end of buffer */
467
468 /****** Here is where the routine gets string data ******************/
469 if ((*line_gen_func)(impl->temp,impl->tmp_buf_size,impl->line_gen_data)
470 ==0){/* Get more data */
471
472 /* If the first position is clear, it means we didn't get
473 any more data from the last call to line_ge_func*/
474 if (impl->temp[0] == '\0'){
475
476 if(line[0] != '\0'){
477 /* There is data in the output, so fall trhough and process it*/
478 break;
479 } else {
480 /* No data in output; return and signal that there
481 is no more input*/
482 free(line);
483 return 0;
484 }
485 }
486 }
487
488
489 /* If the output line ends in a '\n' and the temp buffer
490 begins with a ' ', then the buffer holds a continuation
491 line, so keep reading. */
492
493 if ( line_p > line+1 && *(line_p-1) == '\n'
494 && (impl->temp[0] == ' ' || impl->temp[0] == '\t') ) {
495
496 impl->continuation_line = 1;
497
498 } else if ( impl->buffer_full == 1 ) {
499
500 /* The buffer was filled on the last read, so read again */
501
502 } else {
503
504 /* Looks like the end of this content line, so break */
505 break;
506 }
507
508
509 }
510
511 /* Erase the final newline and/or carriage return*/
512 if ( line_p > line+1 && *(line_p-1) == '\n') {
513 *(line_p-1) = '\0';
514 if ( *(line_p-2) == '\r'){
515 *(line_p-2) = '\0';
516 }
517
518 } else {
519 *(line_p) = '\0';
520 }
521
522 return line;
523
524}
525
526void insert_error(icalcomponent* comp, char* text,
527 char* message, icalparameter_xlicerrortype type)
528{
529 char temp[1024];
530
531 if (text == 0){
532 snprintf(temp,1024,"%s:",message);
533 } else {
534 snprintf(temp,1024,"%s: %s",message,text);
535 }
536
537 icalcomponent_add_property
538 (comp,
539 icalproperty_vanew_xlicerror(
540 temp,
541 icalparameter_new_xlicerrortype(type),
542 0));
543}
544
545int line_is_blank(char* line){
546 int i=0;
547
548 for(i=0; *(line+i)!=0; i++){
549 char c = *(line+i);
550
551 if(c != ' ' && c != '\n' && c != '\t'){
552 return 0;
553 }
554 }
555
556 return 1;
557}
558
559icalcomponent* icalparser_parse(icalparser *parser,
560 char* (*line_gen_func)(char *s, size_t size,
561 void* d))
562{
563
564 char* line;
565 icalcomponent *c=0;
566 icalcomponent *root=0;
567 struct icalparser_impl *impl = (struct icalparser_impl*)parser;
568 icalerrorstate es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
569
570 icalerror_check_arg_rz((parser !=0),"parser");
571
572 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);
573
574 do{
575 line = icalparser_get_line(parser, line_gen_func);
576
577 if ((c = icalparser_add_line(parser,line)) != 0){
578
579 if(icalcomponent_get_parent(c) !=0){
580 /* This is bad news... assert? */
581 }
582
583 assert(impl->root_component == 0);
584 assert(pvl_count(impl->components) ==0);
585
586 if (root == 0){
587 /* Just one component */
588 root = c;
589 } else if(icalcomponent_isa(root) != ICAL_XROOT_COMPONENT) {
590 /*Got a second component, so move the two components under
591 an XROOT container */
592 icalcomponent *tempc = icalcomponent_new(ICAL_XROOT_COMPONENT);
593 icalcomponent_add_component(tempc, root);
594 icalcomponent_add_component(tempc, c);
595 root = tempc;
596 } else if(icalcomponent_isa(root) == ICAL_XROOT_COMPONENT) {
597 /* Already have an XROOT container, so add the component
598 to it*/
599 icalcomponent_add_component(root, c);
600
601 } else {
602 /* Badness */
603 assert(0);
604 }
605
606 c = 0;
607
608 }
609 if(line != 0){
610 free(line);
611 }
612 } while ( line != 0);
613
614 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
615
616 return root;
617
618}
619
620
621icalcomponent* icalparser_add_line(icalparser* parser,
622 char* line)
623{
624 char *p;
625 char *str;
626 char *end;
627 int vcount = 0;
628 icalproperty *prop;
629 icalproperty_kind prop_kind;
630 icalvalue *value;
631 icalvalue_kind value_kind = ICAL_NO_VALUE;
632
633
634 struct icalparser_impl *impl = (struct icalparser_impl*)parser;
635 icalerror_check_arg_rz((parser != 0),"parser");
636
637
638 if (line == 0)
639 {
640 impl->state = ICALPARSER_ERROR;
641 return 0;
642 }
643
644 if(line_is_blank(line) == 1){
645 return 0;
646 }
647
648 /* Begin by getting the property name at the start of the line. The
649 property name may end up being "BEGIN" or "END" in which case it
650 is not really a property, but the marker for the start or end of
651 a component */
652
653 end = 0;
654 str = icalparser_get_prop_name(line, &end);
655
656 if (str == 0 || strlen(str) == 0 ){
657 /* Could not get a property name */
658 icalcomponent *tail = pvl_data(pvl_tail(impl->components));
659
660 if (tail){
661 insert_error(tail,line,
662 "Got a data line, but could not find a property name or component begin tag",
663 ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
664 }
665 tail = 0;
666 impl->state = ICALPARSER_ERROR;
667 return 0;
668 }
669
670 /**********************************************************************
671 * Handle begin and end of components
672 **********************************************************************/
673 /* If the property name is BEGIN or END, we are actually
674 starting or ending a new component */
675
676 if(strcmp(str,"BEGIN") == 0){
677 icalcomponent *c;
678 icalcomponent_kind comp_kind;
679
680 impl->level++;
681 str = icalparser_get_next_value(end,&end, value_kind);
682
683
684 comp_kind = icalenum_string_to_component_kind(str);
685
686 if (comp_kind == ICAL_NO_COMPONENT){
687 c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT);
688 insert_error(c,str,"Parse error in component name",
689 ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
690 }
691
692 c = icalcomponent_new(comp_kind);
693
694 if (c == 0){
695 c = icalcomponent_new(ICAL_XLICINVALID_COMPONENT);
696 insert_error(c,str,"Parse error in component name",
697 ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
698 }
699
700 pvl_push(impl->components,c);
701
702 impl->state = ICALPARSER_BEGIN_COMP;
703 return 0;
704
705 } else if (strcmp(str,"END") == 0 ) {
706 icalcomponent* tail;
707
708 impl->level--;
709 str = icalparser_get_next_value(end,&end, value_kind);
710
711 /* Pop last component off of list and add it to the second-to-last*/
712 impl->root_component = pvl_pop(impl->components);
713
714 tail = pvl_data(pvl_tail(impl->components));
715
716 if(tail != 0){
717 icalcomponent_add_component(tail,impl->root_component);
718 }
719
720 tail = 0;
721
722 /* Return the component if we are back to the 0th level */
723 if (impl->level == 0){
724 icalcomponent *rtrn;
725
726 if(pvl_count(impl->components) != 0){
727 /* There are still components on the stack -- this means
728 that one of them did not have a proper "END" */
729 pvl_push(impl->components,impl->root_component);
730 icalparser_clean(parser); /* may reset impl->root_component*/
731 }
732
733 assert(pvl_count(impl->components) == 0);
734
735 impl->state = ICALPARSER_SUCCESS;
736 rtrn = impl->root_component;
737 impl->root_component = 0;
738 return rtrn;
739
740 } else {
741 impl->state = ICALPARSER_END_COMP;
742 return 0;
743 }
744 }
745
746
747 /* There is no point in continuing if we have not seen a
748 component yet */
749
750 if(pvl_data(pvl_tail(impl->components)) == 0){
751 impl->state = ICALPARSER_ERROR;
752 return 0;
753 }
754
755
756 /**********************************************************************
757 * Handle property names
758 **********************************************************************/
759
760 /* At this point, the property name really is a property name,
761 (Not a component name) so make a new property and add it to
762 the component */
763
764
765 prop_kind = icalproperty_string_to_kind(str);
766
767 prop = icalproperty_new(prop_kind);
768
769 if (prop != 0){
770 icalcomponent *tail = pvl_data(pvl_tail(impl->components));
771
772 if(prop_kind==ICAL_X_PROPERTY){
773 icalproperty_set_x_name(prop,str);
774 }
775
776 icalcomponent_add_property(tail, prop);
777
778 /* Set the value kind for the default for this type of
779 property. This may be re-set by a VALUE parameter */
780 value_kind = icalproperty_kind_to_value_kind(icalproperty_isa(prop));
781
782 } else {
783 icalcomponent* tail = pvl_data(pvl_tail(impl->components));
784
785 insert_error(tail,str,"Parse error in property name",
786 ICAL_XLICERRORTYPE_PROPERTYPARSEERROR);
787
788 tail = 0;
789 impl->state = ICALPARSER_ERROR;
790 return 0;
791 }
792
793 /**********************************************************************
794 * Handle parameter values
795 **********************************************************************/
796
797 /* Now, add any parameters to the last property */
798
799 p = 0;
800 while(1) {
801
802 if (*(end-1) == ':'){
803 /* if the last seperator was a ":" and the value is a
804 URL, icalparser_get_next_parameter will find the
805 ':' in the URL, so better break now. */
806 break;
807 }
808
809 str = icalparser_get_next_parameter(end,&end);
810
811 if (str != 0){
812 char* name;
813 char* pvalue;
814
815 icalparameter *param = 0;
816 icalparameter_kind kind;
817 icalcomponent *tail = pvl_data(pvl_tail(impl->components));
818
819 name = icalparser_get_param_name(str,&pvalue);
820
821 if (name == 0){
822 /* 'tail' defined above */
823 insert_error(tail, str, "Cant parse parameter name",
824 ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR);
825 tail = 0;
826 break;
827 }
828
829 kind = icalparameter_string_to_kind(name);
830
831 if(kind == ICAL_X_PARAMETER){
832 param = icalparameter_new(ICAL_X_PARAMETER);
833
834 if(param != 0){
835 icalparameter_set_xname(param,name);
836 icalparameter_set_xvalue(param,pvalue);
837 }
838
839
840 } else if (kind != ICAL_NO_PARAMETER){
841 param = icalparameter_new_from_value_string(kind,pvalue);
842 } else {
843 /* Error. Failed to parse the parameter*/
844 /* 'tail' defined above */
845 insert_error(tail, str, "Cant parse parameter name",
846 ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR);
847 tail = 0;
848 impl->state = ICALPARSER_ERROR;
849 return 0;
850 }
851
852 if (param == 0){
853 /* 'tail' defined above */
854 insert_error(tail,str,"Cant parse parameter value",
855 ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR);
856
857 tail = 0;
858 impl->state = ICALPARSER_ERROR;
859 continue;
860 }
861
862 /* If it is a VALUE parameter, set the kind of value*/
863 if (icalparameter_isa(param)==ICAL_VALUE_PARAMETER){
864
865 value_kind = (icalvalue_kind)
866 icalparameter_value_to_value_kind(
867 icalparameter_get_value(param)
868 );
869
870 if (value_kind == ICAL_NO_VALUE){
871
872 /* Ooops, could not parse the value of the
873 parameter ( it was not one of the defined
874 values ), so reset the value_kind */
875
876 insert_error(
877 tail, str,
878 "Got a VALUE parameter with an unknown type",
879 ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR);
880 icalparameter_free(param);
881
882 value_kind =
883 icalproperty_kind_to_value_kind(
884 icalproperty_isa(prop));
885
886 icalparameter_free(param);
887 tail = 0;
888 impl->state = ICALPARSER_ERROR;
889 return 0;
890 }
891 }
892
893 /* Everything is OK, so add the parameter */
894 icalproperty_add_parameter(prop,param);
895 tail = 0;
896
897 } else { /* if ( str != 0) */
898 /* If we did not get a param string, go on to looking
899 for a value */
900 break;
901 } /* if ( str != 0) */
902
903 } /* while(1) */
904
905 /**********************************************************************
906 * Handle values
907 **********************************************************************/
908
909 /* Look for values. If there are ',' characters in the values,
910 then there are multiple values, so clone the current
911 parameter and add one part of the value to each clone */
912
913 vcount=0;
914 while(1) {
915 str = icalparser_get_next_value(end,&end, value_kind);
916
917 if (str != 0){
918
919 if (vcount > 0){
920 /* Actually, only clone after the second value */
921 icalproperty* clone = icalproperty_new_clone(prop);
922 icalcomponent* tail = pvl_data(pvl_tail(impl->components));
923
924 icalcomponent_add_property(tail, clone);
925 prop = clone;
926 tail = 0;
927 }
928
929 value = icalvalue_new_from_string(value_kind, str);
930
931 /* Don't add properties without value */
932 if (value == 0){
933 char temp[200]; /* HACK */
934
935 icalproperty_kind prop_kind = icalproperty_isa(prop);
936 icalcomponent* tail = pvl_data(pvl_tail(impl->components));
937
938 sprintf(temp,"Cant parse as %s value in %s property. Removing entire property",
939 icalvalue_kind_to_string(value_kind),
940 icalproperty_kind_to_string(prop_kind));
941
942 insert_error(tail, str, temp,
943 ICAL_XLICERRORTYPE_VALUEPARSEERROR);
944
945 /* Remove the troublesome property */
946 icalcomponent_remove_property(tail,prop);
947 icalproperty_free(prop);
948 prop = 0;
949 tail = 0;
950 impl->state = ICALPARSER_ERROR;
951 return 0;
952
953 } else {
954 vcount++;
955 icalproperty_set_value(prop, value);
956 }
957
958
959 } else {
960 if (vcount == 0){
961 char temp[200]; /* HACK */
962
963 icalproperty_kind prop_kind = icalproperty_isa(prop);
964 icalcomponent *tail = pvl_data(pvl_tail(impl->components));
965
966 sprintf(temp,"No value for %s property. Removing entire property",
967 icalproperty_kind_to_string(prop_kind));
968
969 insert_error(tail, str, temp,
970 ICAL_XLICERRORTYPE_VALUEPARSEERROR);
971
972 /* Remove the troublesome property */
973 icalcomponent_remove_property(tail,prop);
974 icalproperty_free(prop);
975 prop = 0;
976 tail = 0;
977 impl->state = ICALPARSER_ERROR;
978 return 0;
979 } else {
980
981 break;
982 }
983 }
984 }
985
986 /****************************************************************
987 * End of component parsing.
988 *****************************************************************/
989
990 if (pvl_data(pvl_tail(impl->components)) == 0 &&
991 impl->level == 0){
992 /* HACK. Does this clause ever get executed? */
993 impl->state = ICALPARSER_SUCCESS;
994 assert(0);
995 return impl->root_component;
996 } else {
997 impl->state = ICALPARSER_IN_PROGRESS;
998 return 0;
999 }
1000
1001}
1002
1003icalparser_state icalparser_get_state(icalparser* parser)
1004{
1005 struct icalparser_impl* impl = (struct icalparser_impl*) parser;
1006 return impl->state;
1007
1008}
1009
1010icalcomponent* icalparser_clean(icalparser* parser)
1011{
1012 struct icalparser_impl* impl = (struct icalparser_impl*) parser;
1013 icalcomponent *tail;
1014
1015 icalerror_check_arg_rz((parser != 0 ),"parser");
1016
1017 /* We won't get a clean exit if some components did not have an
1018 "END" tag. Clear off any component that may be left in the list */
1019
1020 while((tail=pvl_data(pvl_tail(impl->components))) != 0){
1021
1022 insert_error(tail," ",
1023 "Missing END tag for this component. Closing component at end of input.",
1024 ICAL_XLICERRORTYPE_COMPONENTPARSEERROR);
1025
1026
1027 impl->root_component = pvl_pop(impl->components);
1028 tail=pvl_data(pvl_tail(impl->components));
1029
1030 if(tail != 0){
1031 if(icalcomponent_get_parent(impl->root_component)!=0){
1032 icalerror_warn("icalparser_clean is trying to attach a component for the second time");
1033 } else {
1034 icalcomponent_add_component(tail,impl->root_component);
1035 }
1036 }
1037
1038 }
1039
1040 return impl->root_component;
1041
1042}
1043
1044struct slg_data {
1045 const char* pos;
1046 const char* str;
1047};
1048
1049char* string_line_generator(char *out, size_t buf_size, void *d)
1050{
1051 char *n;
1052 size_t size;
1053 struct slg_data* data = (struct slg_data*)d;
1054
1055 if(data->pos==0){
1056 data->pos=data->str;
1057 }
1058
1059 /* If the pointer is at the end of the string, we are done */
1060 if (*(data->pos)==0){
1061 return 0;
1062 }
1063
1064 n = strchr(data->pos,'\n');
1065
1066 if (n == 0){
1067 size = strlen(data->pos);
1068 } else {
1069 n++; /* include newline in output */
1070 size = (n-data->pos);
1071 }
1072
1073 if (size > buf_size-1){
1074 size = buf_size-1;
1075 }
1076
1077
1078 strncpy(out,data->pos,size);
1079
1080 *(out+size) = '\0';
1081
1082 data->pos += size;
1083
1084 return out;
1085}
1086
1087icalcomponent* icalparser_parse_string(const char* str)
1088{
1089 icalcomponent *c;
1090 struct slg_data d;
1091 icalparser *p;
1092
1093 icalerrorstate es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
1094
1095 d.pos = 0;
1096 d.str = str;
1097
1098 p = icalparser_new();
1099 icalparser_set_gen_data(p,&d);
1100
1101 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);
1102
1103 c = icalparser_parse(p,string_line_generator);
1104
1105 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
1106
1107 icalparser_free(p);
1108
1109 return c;
1110
1111}
diff --git a/libical/src/libical/icalparser.h b/libical/src/libical/icalparser.h
new file mode 100644
index 0000000..5e1c88f
--- a/dev/null
+++ b/libical/src/libical/icalparser.h
@@ -0,0 +1,93 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalparser.h
4 CREATOR: eric 20 April 1999
5
6 $Id$
7
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The original code is icalparser.h
23
24======================================================================*/
25
26
27#ifndef ICALPARSER_H
28#define ICALPARSER_H
29
30#include "icalenums.h"
31#include "icaltypes.h"
32#include"icalcomponent.h"
33
34#include <stdio.h> /* For FILE* */
35
36typedef void* icalparser;
37
38
39/***********************************************************************
40 * Line-oriented parsing.
41 *
42 * Create a new parser via icalparse_new_parser, then add ines one at
43 * a time with icalparse_add_line(). icalparser_add_line() will return
44 * non-zero when it has finished with a component.
45 ***********************************************************************/
46
47typedef enum icalparser_state {
48 ICALPARSER_ERROR,
49 ICALPARSER_SUCCESS,
50 ICALPARSER_BEGIN_COMP,
51 ICALPARSER_END_COMP,
52 ICALPARSER_IN_PROGRESS
53} icalparser_state;
54
55icalparser* icalparser_new(void);
56icalcomponent* icalparser_add_line(icalparser* parser, char* str );
57icalcomponent* icalparser_clean(icalparser* parser);
58icalparser_state icalparser_get_state(icalparser* parser);
59void icalparser_free(icalparser* parser);
60
61
62/***********************************************************************
63 * Message oriented parsing. icalparser_parse takes a string that
64 * holds the text ( in RFC 2445 format ) and returns a pointer to an
65 * icalcomponent. The caller owns the memory. line_gen_func is a
66 * pointer to a function that returns one content line per invocation
67 **********************************************************************/
68
69icalcomponent* icalparser_parse(icalparser *parser,
70 char* (*line_gen_func)(char *s, size_t size, void *d));
71
72/* Set the data that icalparser_parse will give to the line_gen_func
73 as the parameter 'd'*/
74void icalparser_set_gen_data(icalparser* parser, void* data);
75
76
77icalcomponent* icalparser_parse_string(const char* str);
78
79
80/***********************************************************************
81 * Parser support functions
82 ***********************************************************************/
83
84/* Use the flex/bison parser to turn a string into a value type */
85icalvalue* icalparser_parse_value(icalvalue_kind kind,
86 const char* str, icalcomponent** errors);
87
88/* Given a line generator function, return a single iCal content line.*/
89char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d));
90
91char* string_line_generator(char *out, size_t buf_size, void *d);
92
93#endif /* !ICALPARSE_H */
diff --git a/libical/src/libical/icalperiod.c b/libical/src/libical/icalperiod.c
new file mode 100644
index 0000000..c74c157
--- a/dev/null
+++ b/libical/src/libical/icalperiod.c
@@ -0,0 +1,170 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalperiod.c
4 CREATOR: eric 02 June 2000
5
6 $Id$
7 $Locker$
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The Original Code is eric. The Initial Developer of the Original
23 Code is Eric Busboom
24
25
26 ======================================================================*/
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32#include "icalperiod.h"
33
34#include <assert.h>
35#include <string.h>
36#include <stdlib.h>
37#include <stdio.h>
38
39#ifdef ICAL_NO_LIBICAL
40#define icalerror_set_errno(x)
41#define icalerror_check_arg_rv(x,y)
42#define icalerror_check_arg_re(x,y,z)
43#else
44#include "icalerror.h"
45#include "icalmemory.h"
46#endif
47
48
49
50
51struct icalperiodtype icalperiodtype_from_string (const char* str)
52{
53
54 struct icalperiodtype p, null_p;
55 char *s = icalmemory_strdup(str);
56 char *start, *end = s;
57 icalerrorstate es;
58
59 /* Errors are normally generated in the following code, so save
60 the error state for resoration later */
61
62 icalerrorenum e = icalerrno;
63
64 p.start = p.end = icaltime_null_time();
65 p.duration = icaldurationtype_from_int(0);
66
67 null_p = p;
68
69 if(s == 0) goto error;
70
71 start = s;
72 end = strchr(s, '/');
73
74 if(end == 0) goto error;
75
76 *end = 0;
77 end++;
78
79 p.start = icaltime_from_string(start);
80
81 if (icaltime_is_null_time(p.start)) goto error;
82
83 es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
84 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);
85
86 p.end = icaltime_from_string(end);
87
88 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
89
90
91 if (icaltime_is_null_time(p.end)){
92
93 p.duration = icaldurationtype_from_string(end);
94
95 if(icaldurationtype_as_int(p.duration) == 0) goto error;
96 }
97
98 icalerrno = e;
99
100 return p;
101
102 error:
103 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
104 return null_p;
105}
106
107
108const char* icalperiodtype_as_ical_string(struct icalperiodtype p)
109{
110
111 const char* start;
112 const char* end;
113
114 char *buf;
115 size_t buf_size = 40;
116 char* buf_ptr = 0;
117
118 buf = (char*)icalmemory_new_buffer(buf_size);
119 buf_ptr = buf;
120
121
122 start = icaltime_as_ical_string(p.start);
123
124 icalmemory_append_string(&buf, &buf_ptr, &buf_size, start);
125
126 if(!icaltime_is_null_time(p.end)){
127 end = icaltime_as_ical_string(p.end);
128 } else {
129 end = icaldurationtype_as_ical_string(p.duration);
130 }
131
132 icalmemory_append_char(&buf, &buf_ptr, &buf_size, '/');
133
134 icalmemory_append_string(&buf, &buf_ptr, &buf_size, end);
135
136
137 return buf;
138}
139
140
141
142struct icalperiodtype icalperiodtype_null_period() {
143 struct icalperiodtype p;
144 p.start = icaltime_null_time();
145 p.end = icaltime_null_time();
146 p.duration = icaldurationtype_null_duration();
147
148 return p;
149}
150int icalperiodtype_is_null_period(struct icalperiodtype p){
151
152 if(icaltime_is_null_time(p.start) &&
153 icaltime_is_null_time(p.end) &&
154 icaldurationtype_is_null_duration(p.duration)){
155 return 1;
156 } else {
157 return 0;
158 }
159}
160
161int icalperiodtype_is_valid_period(struct icalperiodtype p){
162 if(icaltime_is_valid_time(p.start) &&
163 (icaltime_is_valid_time(p.end) || icaltime_is_null_time(p.end)) )
164 {
165 return 1;
166 }
167
168 return 0;
169}
170
diff --git a/libical/src/libical/icalperiod.h b/libical/src/libical/icalperiod.h
new file mode 100644
index 0000000..64d5323
--- a/dev/null
+++ b/libical/src/libical/icalperiod.h
@@ -0,0 +1,55 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalperiod.h
4 CREATOR: eric 26 Jan 2001
5
6
7 $Id$
8 $Locker$
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The Original Code is eric. The Initial Developer of the Original
24 Code is Eric Busboom
25
26
27======================================================================*/
28
29#ifndef ICALPERIOD_H
30#define ICALPERIOD_H
31
32#include "icaltime.h"
33#include "icalduration.h"
34
35struct icalperiodtype
36{
37 struct icaltimetype start;
38 struct icaltimetype end;
39 struct icaldurationtype duration;
40};
41
42struct icalperiodtype icalperiodtype_from_string (const char* str);
43
44const char* icalperiodtype_as_ical_string(struct icalperiodtype p);
45struct icalperiodtype icalperiodtype_null_period();
46int icalperiodtype_is_null_period(struct icalperiodtype p);
47int icalperiodtype_is_valid_period(struct icalperiodtype p);
48
49
50
51
52#endif /* !ICALTIME_H */
53
54
55
diff --git a/libical/src/libical/icalproperty.c b/libical/src/libical/icalproperty.c
new file mode 100644
index 0000000..7f2cfa5
--- a/dev/null
+++ b/libical/src/libical/icalproperty.c
@@ -0,0 +1,810 @@
1/* -*- Mode: C -*- */
2
3/*======================================================================
4 FILE: icalproperty.c
5 CREATOR: eric 28 April 1999
6
7 $Id$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icalproperty.c
24
25======================================================================*/
26/*#line 27 "icalproperty.c.in"*/
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32#include "icalproperty.h"
33#include "icalparameter.h"
34#include "icalcomponent.h"
35#include "pvl.h"
36#include "icalenums.h"
37#include "icalerror.h"
38#include "icalmemory.h"
39#include "icalparser.h"
40
41#include <string.h> /* For icalmemory_strdup, rindex */
42#include <assert.h>
43#include <stdlib.h>
44#include <errno.h>
45#include <stdio.h> /* for printf */
46#include <stdarg.h> /* for va_list, va_start, etc. */
47
48int snprintf(char *str, size_t n, char const *fmt, ...);
49
50#define TMP_BUF_SIZE 1024
51
52/* Private routines for icalproperty */
53void icalvalue_set_parent(icalvalue* value,
54 icalproperty* property);
55icalproperty* icalvalue_get_parent(icalvalue* value);
56
57void icalparameter_set_parent(icalparameter* param,
58 icalproperty* property);
59icalproperty* icalparameter_get_parent(icalparameter* value);
60
61
62void icalproperty_set_x_name(icalproperty* prop, const char* name);
63
64struct icalproperty_impl
65{
66 char id[5];
67 icalproperty_kind kind;
68 char* x_name;
69 pvl_list parameters;
70 pvl_elem parameter_iterator;
71 icalvalue* value;
72 icalcomponent *parent;
73};
74
75void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args)
76{
77
78 void* vp;
79
80 struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
81
82 while((vp = va_arg(args, void*)) != 0) {
83
84 if (icalvalue_isa_value(vp) != 0 ){
85 } else if (icalparameter_isa_parameter(vp) != 0 ){
86
87 icalproperty_add_parameter((icalproperty*)impl,
88 (icalparameter*)vp);
89 } else {
90 assert(0);
91 }
92
93 }
94
95
96}
97
98
99struct icalproperty_impl*
100icalproperty_new_impl (icalproperty_kind kind)
101{
102 struct icalproperty_impl* prop;
103
104 if ( ( prop = (struct icalproperty_impl*)
105 malloc(sizeof(struct icalproperty_impl))) == 0) {
106 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
107 return 0;
108 }
109
110 strcpy(prop->id,"prop");
111
112 prop->kind = kind;
113 prop->parameters = pvl_newlist();
114 prop->parameter_iterator = 0;
115 prop->value = 0;
116 prop->x_name = 0;
117 prop->parent = 0;
118
119 return prop;
120}
121
122
123icalproperty*
124icalproperty_new (icalproperty_kind kind)
125{
126 if(kind == ICAL_NO_PROPERTY){
127 return 0;
128 }
129
130 return (icalproperty*)icalproperty_new_impl(kind);
131}
132
133
134icalproperty*
135icalproperty_new_clone(icalproperty* prop)
136{
137 struct icalproperty_impl *old = (struct icalproperty_impl*)prop;
138 struct icalproperty_impl *new = icalproperty_new_impl(old->kind);
139 pvl_elem p;
140
141 icalerror_check_arg_rz((prop!=0),"Prop");
142 icalerror_check_arg_rz((old!=0),"old");
143 icalerror_check_arg_rz((new!=0),"new");
144
145 if (old->value !=0) {
146 new->value = icalvalue_new_clone(old->value);
147 }
148
149 if (old->x_name != 0) {
150
151 new->x_name = icalmemory_strdup(old->x_name);
152
153 if (new->x_name == 0) {
154 icalproperty_free(new);
155 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
156 return 0;
157 }
158 }
159
160 for(p=pvl_head(old->parameters);p != 0; p = pvl_next(p)){
161 icalparameter *param = icalparameter_new_clone(pvl_data(p));
162
163 if (param == 0){
164 icalproperty_free(new);
165 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
166 return 0;
167 }
168
169 pvl_push(new->parameters,param);
170
171 }
172
173 return new;
174
175}
176
177icalproperty* icalproperty_new_from_string(const char* str)
178{
179
180 size_t buf_size = 1024;
181 char* buf = icalmemory_new_buffer(buf_size);
182 char* buf_ptr = buf;
183 icalproperty *prop;
184 icalcomponent *comp;
185 int errors = 0;
186
187 icalerror_check_arg_rz( (str!=0),"str");
188
189 /* Is this a HACK or a crafty reuse of code? */
190
191 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:VCALENDAR\n");
192 icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
193 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n");
194 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:VCALENDAR\n");
195
196 comp = icalparser_parse_string(buf);
197
198 if(comp == 0){
199 icalerror_set_errno(ICAL_PARSE_ERROR);
200 return 0;
201 }
202
203 errors = icalcomponent_count_errors(comp);
204
205 prop = icalcomponent_get_first_property(comp,ICAL_ANY_PROPERTY);
206
207 icalcomponent_remove_property(comp,prop);
208
209 icalcomponent_free(comp);
210 free(buf);
211
212 if(errors > 0){
213 icalproperty_free(prop);
214 return 0;
215 } else {
216 return prop;
217 }
218
219}
220
221void
222icalproperty_free (icalproperty* prop)
223{
224 struct icalproperty_impl *p;
225
226 icalparameter* param;
227
228 icalerror_check_arg_rv((prop!=0),"prop");
229
230 p = (struct icalproperty_impl*)prop;
231
232#ifdef ICAL_FREE_ON_LIST_IS_ERROR
233 icalerror_assert( (p->parent ==0),"Tried to free a property that is still attached to a component. ");
234
235#else
236 if(p->parent !=0){
237 return;
238 }
239#endif
240
241 if (p->value != 0){
242 icalvalue_set_parent(p->value,0);
243 icalvalue_free(p->value);
244 }
245
246 while( (param = pvl_pop(p->parameters)) != 0){
247 icalparameter_free(param);
248 }
249
250 pvl_free(p->parameters);
251
252 if (p->x_name != 0) {
253 free(p->x_name);
254 }
255
256 p->kind = ICAL_NO_PROPERTY;
257 p->parameters = 0;
258 p->parameter_iterator = 0;
259 p->value = 0;
260 p->x_name = 0;
261 p->id[0] = 'X';
262
263 free(p);
264
265}
266
267
268const char*
269icalproperty_as_ical_string (icalproperty* prop)
270{
271 icalparameter *param;
272
273 /* Create new buffer that we can append names, parameters and a
274 value to, and reallocate as needed. Later, this buffer will be
275 copied to a icalmemory_tmp_buffer, which is managed internally
276 by libical, so it can be given to the caller without fear of
277 the caller forgetting to free it */
278
279 const char* property_name = 0;
280 size_t buf_size = 1024;
281 char* buf = icalmemory_new_buffer(buf_size);
282 char* buf_ptr = buf;
283 icalvalue* value;
284 char *out_buf;
285
286 char newline[] = "\n";
287
288 struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
289
290 icalerror_check_arg_rz( (prop!=0),"prop");
291
292
293 /* Append property name */
294
295 if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
296 property_name = impl->x_name;
297 } else {
298 property_name = icalproperty_kind_to_string(impl->kind);
299 }
300
301 if (property_name == 0 ) {
302 icalerror_warn("Got a property of an unknown kind.");
303 icalmemory_free_buffer(buf);
304 return 0;
305
306 }
307
308
309 icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
310 icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
311
312
313
314 /* Determine what VALUE parameter to include. The VALUE parameters
315 are ignored in the normal parameter printing ( the block after
316 this one, so we need to do it here */
317 {
318 const char* kind_string = 0;
319
320 icalparameter *orig_val_param
321 = icalproperty_get_first_parameter(prop,ICAL_VALUE_PARAMETER);
322
323 icalvalue *value = icalproperty_get_value(impl);
324
325 icalvalue_kind orig_kind = ICAL_NO_VALUE;
326
327 icalvalue_kind this_kind = ICAL_NO_VALUE;
328
329 icalvalue_kind default_kind
330 = icalproperty_kind_to_value_kind(impl->kind);
331
332 if(orig_val_param){
333 orig_kind = (icalvalue_kind)icalparameter_get_value(orig_val_param);
334 }
335
336 if(value != 0){
337 this_kind = icalvalue_isa(value);
338 }
339
340
341 if(this_kind == default_kind &&
342 orig_kind != ICAL_NO_VALUE){
343 /* The kind is the default, so it does not need to be
344 included, but do it anyway, since it was explicit in
345 the property. But, use the default, not the one
346 specified in the property */
347
348 kind_string = icalvalue_kind_to_string(default_kind);
349
350 } else if (this_kind != default_kind && this_kind != ICAL_NO_VALUE){
351 /* Not the default, so it must be specified */
352 kind_string = icalvalue_kind_to_string(this_kind);
353 } else {
354 /* Don'tinclude the VALUE parameter at all */
355 }
356
357 if(kind_string!=0){
358 icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
359 icalmemory_append_string(&buf, &buf_ptr, &buf_size, "VALUE=");
360 icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
361 icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
362 }
363
364
365 }
366
367 /* Append parameters */
368 for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER);
369 param != 0;
370 param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) {
371
372 char* kind_string = icalparameter_as_ical_string(param);
373 icalparameter_kind kind = icalparameter_isa(param);
374
375 if(kind==ICAL_VALUE_PARAMETER){
376 continue;
377 }
378
379 if (kind_string == 0 ) {
380 char temp[TMP_BUF_SIZE];
381 snprintf(temp, TMP_BUF_SIZE,"Got a parameter of unknown kind in %s property",property_name);
382 icalerror_warn(temp);
383 continue;
384 }
385
386 icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
387 icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
388 icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
389
390 }
391
392 /* Append value */
393
394 icalmemory_append_string(&buf, &buf_ptr, &buf_size, " :");
395
396 value = icalproperty_get_value(prop);
397
398 if (value != 0){
399 const char *str = icalvalue_as_ical_string(value);
400 icalerror_assert((str !=0),"Could not get string representation of a value");
401 icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
402 } else {
403 icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value");
404
405 }
406
407 icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
408
409 /* Now, copy the buffer to a tmp_buffer, which is safe to give to
410 the caller without worring about de-allocating it. */
411
412
413 out_buf = icalmemory_tmp_buffer(strlen(buf)+1);
414 strcpy(out_buf, buf);
415
416 icalmemory_free_buffer(buf);
417
418 return out_buf;
419}
420
421
422
423icalproperty_kind
424icalproperty_isa (icalproperty* property)
425{
426 struct icalproperty_impl *p = (struct icalproperty_impl*)property;
427
428 if(property != 0){
429 return p->kind;
430 }
431
432 return ICAL_NO_PROPERTY;
433}
434
435int
436icalproperty_isa_property (void* property)
437{
438 struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
439
440 icalerror_check_arg_rz( (property!=0), "property");
441
442 if (strcmp(impl->id,"prop") == 0) {
443 return 1;
444 } else {
445 return 0;
446 }
447}
448
449
450void
451icalproperty_add_parameter (icalproperty* prop,icalparameter* parameter)
452{
453 struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
454
455 icalerror_check_arg_rv( (prop!=0),"prop");
456 icalerror_check_arg_rv( (parameter!=0),"parameter");
457
458 pvl_push(p->parameters, parameter);
459
460}
461
462void
463icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter)
464{
465 icalparameter_kind kind;
466
467 icalerror_check_arg_rv( (prop!=0),"prop");
468 icalerror_check_arg_rv( (parameter!=0),"parameter");
469
470 kind = icalparameter_isa(parameter);
471
472 icalproperty_remove_parameter(prop,kind);
473
474 icalproperty_add_parameter(prop,parameter);
475}
476
477void icalproperty_set_parameter_from_string(icalproperty* prop,
478 const char* name, const char* value)
479{
480
481 icalparameter_kind kind;
482 icalparameter *param;
483
484 icalerror_check_arg_rv( (prop!=0),"prop");
485 icalerror_check_arg_rv( (name!=0),"name");
486 icalerror_check_arg_rv( (value!=0),"value");
487
488 kind = icalparameter_string_to_kind(name);
489
490 if(kind == ICAL_NO_PARAMETER){
491 icalerror_set_errno(ICAL_BADARG_ERROR);
492 return;
493 }
494
495 param = icalparameter_new_from_value_string(kind,value);
496
497 if (param == 0){
498 icalerror_set_errno(ICAL_BADARG_ERROR);
499 return;
500 }
501
502 icalproperty_set_parameter(prop,param);
503
504}
505
506const char* icalproperty_get_parameter_as_string(icalproperty* prop,
507 const char* name)
508{
509 icalparameter_kind kind;
510 icalparameter *param;
511 char* str;
512 char* pv;
513
514 icalerror_check_arg_rz( (prop!=0),"prop");
515 icalerror_check_arg_rz( (name!=0),"name");
516
517 kind = icalparameter_string_to_kind(name);
518
519 if(kind == ICAL_NO_PROPERTY){
520 /* icalenum_string_to_parameter_kind will set icalerrno */
521 return 0;
522 }
523
524 param = icalproperty_get_first_parameter(prop,kind);
525
526 if (param == 0){
527 return 0;
528 }
529
530 str = icalparameter_as_ical_string(param);
531
532 pv = strchr(str,'=');
533
534 if(pv == 0){
535 icalerror_set_errno(ICAL_INTERNAL_ERROR);
536 return 0;
537 }
538
539 return pv+1;
540
541}
542
543void
544icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind)
545{
546 pvl_elem p;
547 struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
548
549 icalerror_check_arg_rv((prop!=0),"prop");
550
551 for(p=pvl_head(impl->parameters);p != 0; p = pvl_next(p)){
552 icalparameter* param = (icalparameter *)pvl_data (p);
553 if (icalparameter_isa(param) == kind) {
554 pvl_remove (impl->parameters, p);
555 icalparameter_free (param);
556 break;
557 }
558 }
559}
560
561
562int
563icalproperty_count_parameters (icalproperty* prop)
564{
565 struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
566
567 if(prop != 0){
568 return pvl_count(p->parameters);
569 }
570
571 icalerror_set_errno(ICAL_USAGE_ERROR);
572 return -1;
573}
574
575
576icalparameter*
577icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind)
578{
579 struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
580
581 icalerror_check_arg_rz( (prop!=0),"prop");
582
583 p->parameter_iterator = pvl_head(p->parameters);
584
585 if (p->parameter_iterator == 0) {
586 return 0;
587 }
588
589 for( p->parameter_iterator = pvl_head(p->parameters);
590 p->parameter_iterator !=0;
591 p->parameter_iterator = pvl_next(p->parameter_iterator)){
592
593 icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
594
595 if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
596 return param;
597 }
598 }
599
600 return 0;
601}
602
603
604icalparameter*
605icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind)
606{
607 struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
608
609 icalerror_check_arg_rz( (prop!=0),"prop");
610
611 if (p->parameter_iterator == 0) {
612 return 0;
613 }
614
615 for( p->parameter_iterator = pvl_next(p->parameter_iterator);
616 p->parameter_iterator !=0;
617 p->parameter_iterator = pvl_next(p->parameter_iterator)){
618
619 icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
620
621 if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
622 return param;
623 }
624 }
625
626 return 0;
627
628}
629
630void
631icalproperty_set_value (icalproperty* prop, icalvalue* value)
632{
633 struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
634
635 icalerror_check_arg_rv((prop !=0),"prop");
636 icalerror_check_arg_rv((value !=0),"value");
637
638 if (p->value != 0){
639 icalvalue_set_parent(p->value,0);
640 icalvalue_free(p->value);
641 p->value = 0;
642 }
643
644 p->value = value;
645
646 icalvalue_set_parent(value,prop);
647}
648
649
650void icalproperty_set_value_from_string(icalproperty* prop,const char* str,
651 const char* type)
652{
653 icalvalue *oval,*nval;
654 icalvalue_kind kind = ICAL_NO_VALUE;
655
656 icalerror_check_arg_rv( (prop!=0),"prop");
657 icalerror_check_arg_rv( (str!=0),"str");
658 icalerror_check_arg_rv( (type!=0),"type");
659
660 if(strcmp(type,"NO")==0){
661 /* Get the type from the value the property already has, if it exists */
662 oval = icalproperty_get_value(prop);
663 if(oval != 0){
664 /* Use the existing value kind */
665 kind = icalvalue_isa(oval);
666 } else {
667 /* Use the default kind for the property */
668 kind = icalproperty_kind_to_value_kind(icalproperty_isa(prop));
669 }
670 } else {
671 /* Use the given kind string */
672 kind = icalvalue_string_to_kind(type);
673 }
674
675 if(kind == ICAL_NO_VALUE){
676 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
677 return;
678 }
679
680 nval = icalvalue_new_from_string(kind, str);
681
682 if(nval == 0){
683 /* icalvalue_new_from_string sets errno */
684 assert(icalerrno != ICAL_NO_ERROR);
685 return;
686 }
687
688 icalproperty_set_value(prop,nval);
689
690
691}
692
693icalvalue*
694icalproperty_get_value (icalproperty* prop)
695{
696 struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
697
698 icalerror_check_arg_rz( (prop!=0),"prop");
699
700 return p->value;
701}
702
703const char* icalproperty_get_value_as_string(icalproperty* prop)
704{
705 icalvalue *value;
706
707 struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
708
709 icalerror_check_arg_rz( (prop!=0),"prop");
710
711 value = impl->value;
712
713 return icalvalue_as_ical_string(value);
714}
715
716
717void icalproperty_set_x_name(icalproperty* prop, const char* name)
718{
719 struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
720
721 icalerror_check_arg_rv( (name!=0),"name");
722 icalerror_check_arg_rv( (prop!=0),"prop");
723
724 if (impl->x_name != 0) {
725 free(impl->x_name);
726 }
727
728 impl->x_name = icalmemory_strdup(name);
729
730 if(impl->x_name == 0){
731 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
732 }
733
734}
735
736const char* icalproperty_get_x_name(icalproperty* prop){
737
738 struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
739
740 icalerror_check_arg_rz( (prop!=0),"prop");
741
742 return impl->x_name;
743}
744
745
746/* From Jonathan Yue <jonathan.yue@cp.net> */
747const char* icalproperty_get_name (icalproperty* prop)
748{
749
750 const char* property_name = 0;
751 size_t buf_size = 256;
752 char* buf = icalmemory_new_buffer(buf_size);
753 char* buf_ptr = buf;
754
755 struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
756
757 icalerror_check_arg_rz( (prop!=0),"prop");
758
759 if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
760 property_name = impl->x_name;
761 } else {
762 property_name = icalproperty_kind_to_string(impl->kind);
763 }
764
765 if (property_name == 0 ) {
766 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
767 return 0;
768
769 } else {
770 /* _append_string will automatically grow the buffer if
771 property_name is longer than the initial buffer size */
772 icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
773 }
774
775 /* Add the buffer to the temporary buffer ring -- the caller will
776 not have to free the memory. */
777 icalmemory_add_tmp_buffer(buf);
778
779 return buf;
780}
781
782
783
784
785void icalproperty_set_parent(icalproperty* property,
786 icalcomponent* component)
787{
788 struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
789
790 icalerror_check_arg_rv( (property!=0),"property");
791
792 impl->parent = component;
793}
794
795icalcomponent* icalproperty_get_parent(icalproperty* property)
796{
797 struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
798
799 icalerror_check_arg_rz( (property!=0),"property");
800
801 return impl->parent;
802}
803
804
805
806
807
808
809
810/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalproperty.h b/libical/src/libical/icalproperty.h
new file mode 100644
index 0000000..e39c6b5
--- a/dev/null
+++ b/libical/src/libical/icalproperty.h
@@ -0,0 +1,122 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalproperty.h
4 CREATOR: eric 20 March 1999
5
6
7 $Id$
8 $Locker$
9
10
11
12 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of either:
16
17 The LGPL as published by the Free Software Foundation, version
18 2.1, available at: http://www.fsf.org/copyleft/lesser.html
19
20 Or:
21
22 The Mozilla Public License Version 1.0. You may obtain a copy of
23 the License at http://www.mozilla.org/MPL/
24
25 The original code is icalparam.h
26
27 ======================================================================*/
28
29
30#ifndef ICALPROPERTY_H
31#define ICALPROPERTY_H
32
33#include <time.h>
34
35#ifdef _WIN32
36#include <stdio.h> /* for printf */
37#include <stdarg.h> /* for va_list, va_start, etc. */
38#endif
39
40#include "icalderivedparameter.h"
41
42#include "icalvalue.h"
43#include "icalrecur.h"
44
45/* Actually in icalderivedproperty.h:
46 typedef void icalproperty; */
47
48#include "icalderivedproperty.h" /* To get icalproperty_kind enumerations */
49
50// void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
51
52icalproperty* icalproperty_new(icalproperty_kind kind);
53
54icalproperty* icalproperty_new_clone(icalproperty * prop);
55
56icalproperty* icalproperty_new_from_string(const char* str);
57
58const char* icalproperty_as_ical_string(icalproperty* prop);
59
60void icalproperty_free(icalproperty* prop);
61
62icalproperty_kind icalproperty_isa(icalproperty* property);
63int icalproperty_isa_property(void* property);
64
65void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
66void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter);
67void icalproperty_set_parameter_from_string(icalproperty* prop,
68 const char* name, const char* value);
69const char* icalproperty_get_parameter_as_string(icalproperty* prop,
70 const char* name);
71
72void icalproperty_remove_parameter(icalproperty* prop,
73 icalparameter_kind kind);
74
75int icalproperty_count_parameters(icalproperty* prop);
76
77/* Iterate through the parameters */
78icalparameter* icalproperty_get_first_parameter(icalproperty* prop,
79 icalparameter_kind kind);
80icalparameter* icalproperty_get_next_parameter(icalproperty* prop,
81 icalparameter_kind kind);
82/* Access the value of the property */
83void icalproperty_set_value(icalproperty* prop, icalvalue* value);
84void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind);
85
86icalvalue* icalproperty_get_value(icalproperty* prop);
87const char* icalproperty_get_value_as_string(icalproperty* prop);
88
89/* Deal with X properties */
90
91void icalproperty_set_x_name(icalproperty* prop, const char* name);
92const char* icalproperty_get_x_name(icalproperty* prop);
93
94/* Return the name of the property -- the type name converted to a
95 string, or the value of _get_x_name if the type is and X property */
96const char* icalproperty_get_name (icalproperty* prop);
97
98icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
99
100/* Convert kinds to string and get default value type */
101
102icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);
103icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
104const char* icalproperty_kind_to_string(icalproperty_kind kind);
105icalproperty_kind icalproperty_string_to_kind(const char* string);
106
107icalproperty_method icalproperty_string_to_method(const char* str);
108const char* icalproperty_method_to_string(icalproperty_method method);
109
110
111const char* icalproperty_enum_to_string(int e);
112int icalproperty_string_to_enum(const char* str);
113
114const char* icalproperty_status_to_string(icalproperty_status);
115icalproperty_status icalproperty_string_to_status(const char* string);
116
117int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e);
118
119
120
121
122#endif /*ICALPROPERTY_H*/
diff --git a/libical/src/libical/icalrecur.c b/libical/src/libical/icalrecur.c
new file mode 100644
index 0000000..203ce70
--- a/dev/null
+++ b/libical/src/libical/icalrecur.c
@@ -0,0 +1,2315 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icalrecur.c
4 CREATOR: eric 16 May 2000
5
6 $Id$
7 $Locker$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23
24 How this code works:
25
26 Processing starts when the caller generates a new recurrence
27 iterator via icalrecur_iterator_new(). This routine copies the
28 recurrence rule into the iterator and extracts things like start and
29 end dates. Then, it checks if the rule is legal, using some logic
30 from RFC2445 and some logic that probably should be in RFC2445.
31
32 Then, icalrecur_iterator_new() re-writes some of the BY*
33 arrays. This involves ( via a call to setup_defaults() ) :
34
35 1) For BY rule parts with no data ( ie BYSECOND was not specified )
36 copy the corresponding time part from DTSTART into the BY array. (
37 So impl->by_ptrs[BY_SECOND] will then have one element if is
38 originally had none ) This only happens if the BY* rule part data
39 would expand the number of occurrences in the occurrence set. This
40 lets the code ignore DTSTART later on and still use it to get the
41 time parts that were not specified in any other way.
42
43 2) For the by rule part that are not the same interval as the
44 frequency -- for HOURLY anything but BYHOUR, for instance -- copy the
45 first data element from the rule part into the first occurrence. For
46 example, for "INTERVAL=MONTHLY and BYHOUR=10,30", initialize the
47 first time to be returned to have an hour of 10.
48
49 Finally, for INTERVAL=YEARLY, the routine expands the rule to get
50 all of the days specified in the rule. The code will do this for
51 each new year, and this is the first expansion. This is a special
52 case for the yearly interval; no other frequency gets expanded this
53 way. The yearly interval is the most complex, so some special
54 processing is required.
55
56 After creating a new iterator, the caller will make successive calls
57 to icalrecur_iterator_next() to get the next time specified by the
58 rule. The main part of this routine is a switch on the frequency of
59 the rule. Each different frequency is handled by a different
60 routine.
61
62 For example, next_hour handles the case of INTERVAL=HOURLY, and it
63 is called by other routines to get the next hour. First, the routine
64 tries to get the next minute part of a time with a call to
65 next_minute(). If next_minute() returns 1, it has reached the end of
66 its data, usually the last element of the BYMINUTE array. Then, if
67 there is data in the BYHOUR array, the routine changes the hour to
68 the next one in the array. If INTERVAL=HOURLY, the routine advances
69 the hour by the interval.
70
71 If the routine used the last hour in the BYHOUR array, and the
72 INTERVAL=HOURLY, then the routine calls increment_monthday() to set
73 the next month day. The increment_* routines may call higher routine
74 to increment the month or year also.
75
76 The code for INTERVAL=DAILY is handled by next_day(). First, the
77 routine tries to get the next hour part of a time with a call to
78 next_hour. If next_hour() returns 1, it has reached the end of its
79 data, usually the last element of the BYHOUR array. This means that
80 next_day() should increment the time to the next day. If FREQUENCY==DAILY,
81 the routine increments the day by the interval; otherwise, it
82 increments the day by 1.
83
84 Next_day() differs from next_hour because it does not use the BYDAY
85 array to select an appropriate day. Instead, it returns every day (
86 incrementing by 1 if the frequency is not DAILY with INTERVAL!=1)
87 Any days that are not specified in an non-empty BYDAY array are
88 filtered out later.
89
90 Generally, the flow of these routine is for a next_* call a next_*
91 routine of a lower interval ( next_day calls next_hour) and then to
92 possibly call an increment_* routine of an equal or higher
93 interval. ( next_day calls increment_monthday() )
94
95 When the call to the original next_* routine returns,
96 icalrecur_iterator_next() will check the returned data against other
97 BYrule parts to determine if is should be excluded by calling
98 check_contracting_rules. Generally, a contracting rule is any with a
99 larger time span than the interval. For instance, if
100 INTERVAL=DAILY, BYMONTH is a contracting rule part.
101
102 Check_contracting_rules() uses icalrecur_check_rulepart() to do its
103 work. icalrecur_check_rulepart() uses expand_map[] to determine if a rule
104 is contracting, and if it is, and if the BY rule part has some data,
105 then the routine checks if the value of a component of the time is
106 part of the byrule part. For instance, for "INTERVAL=DAILY;
107 BYMONTH=6,10", icalrecur_check_rulepart() would check that the time value
108 given to it has a month of either 6 or 10.
109
110 Finally, icalrecur_iterator_next() does a few other checks on the
111 time value, and if it passes, it returns the time.
112
113 A note about the end_of_data flag. The flag indicates that the
114 routine is at the end of its data -- the last BY rule if the routine
115 is using by rules, or the last day of the week/month/year/etc if
116 not.
117
118 This flag is usually set early in a next_* routine and returned in
119 the end. The way it is used allows the next_* routine to set the
120 last time back to the first element in a BYxx rule, and then signal
121 to the higer level routine to increment the next higher level. For
122 instance. WITH FREQ=MONTHLY;BYDAY=TU,FR, After next_weekday_by_month
123 runs though both TU and FR, it sets the week day back to TU and sets
124 end_of_data to 1x. This signals next_month to increment the month.
125
126
127 ======================================================================*/
128
129#ifdef HAVE_CONFIG_H
130#include "config.h"
131#endif
132
133#include "icalrecur.h"
134
135#ifdef ICAL_NO_LIBICAL
136#define icalerror_set_errno(x)
137#define icalerror_check_arg_rv(x,y)
138#else
139#include "icalerror.h"
140#include "icalmemory.h"
141#endif
142
143#include <stdlib.h> /* for malloc */
144#include <errno.h> /* for errno */
145#include <string.h> /* for strdup and strchr*/
146#include <assert.h>
147#include <stddef.h> /* For offsetof() macro */
148
149#include "pvl.h"
150
151#define TEMP_MAX 1024
152
153
154#define BYDAYIDX impl->by_indices[BY_DAY]
155#define BYDAYPTR impl->by_ptrs[BY_DAY]
156
157#define BYMONIDX impl->by_indices[BY_MONTH]
158#define BYMONPTR impl->by_ptrs[BY_MONTH]
159
160#define BYMDIDX impl->by_indices[BY_MONTH_DAY]
161#define BYMDPTR impl->by_ptrs[BY_MONTH_DAY]
162
163#define BYWEEKIDX impl->by_indices[BY_WEEK_NO]
164#define BYWEEKPTR impl->by_ptrs[BY_WEEK_NO]
165
166const char* icalrecur_freq_to_string(icalrecurrencetype_frequency kind);
167icalrecurrencetype_frequency icalrecur_string_to_freq(const char* str);
168
169const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind);
170icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str);
171
172
173
174/*********************** Rule parsing routines ************************/
175
176struct icalrecur_parser {
177 const char* rule;
178 char* copy;
179 char* this_clause;
180 char* next_clause;
181
182 struct icalrecurrencetype rt;
183};
184
185const char* icalrecur_first_clause(struct icalrecur_parser *parser)
186{
187 char *idx;
188 parser->this_clause = parser->copy;
189
190 idx = strchr(parser->this_clause,';');
191
192 if (idx == 0){
193 parser->next_clause = 0;
194 return 0;
195 }
196
197 *idx = 0;
198 idx++;
199 parser->next_clause = idx;
200
201 return parser->this_clause;
202
203}
204
205const char* icalrecur_next_clause(struct icalrecur_parser *parser)
206{
207 char* idx;
208
209 parser->this_clause = parser->next_clause;
210
211 if(parser->this_clause == 0){
212 return 0;
213 }
214
215 idx = strchr(parser->this_clause,';');
216
217 if (idx == 0){
218 parser->next_clause = 0;
219 } else {
220
221 *idx = 0;
222 idx++;
223 parser->next_clause = idx;
224 }
225
226 return parser->this_clause;
227
228}
229
230void icalrecur_clause_name_and_value(struct icalrecur_parser *parser,
231 char** name, char** value)
232{
233 char *idx;
234
235 *name = parser->this_clause;
236
237 idx = strchr(parser->this_clause,'=');
238
239 if (idx == 0){
240 *name = 0;
241 *value = 0;
242 return;
243 }
244
245 *idx = 0;
246 idx++;
247 *value = idx;
248}
249
250void icalrecur_add_byrules(struct icalrecur_parser *parser, short *array,
251 int size, char* vals)
252{
253 char *t, *n;
254 int i=0;
255 int sign = 1;
256 short v;
257
258 n = vals;
259
260 while(n != 0){
261
262 if(i == size){
263 return;
264 }
265
266 t = n;
267
268 n = strchr(t,',');
269
270 if(n != 0){
271 *n = 0;
272 n++;
273 }
274
275 /* Get optional sign. HACK. sign is not allowed for all BYxxx
276 rule parts */
277 if( *t == '-'){
278 sign = -1;
279 t++;
280 } else if (*t == '+'){
281 sign = 1;
282 t++;
283 }
284
285 v = atoi(t) * sign ;
286
287
288 array[i++] = v;
289 array[i] = ICAL_RECURRENCE_ARRAY_MAX;
290
291 }
292
293}
294
295void icalrecur_add_bydayrules(struct icalrecur_parser *parser, const char* vals)
296{
297
298 char *t, *n;
299 int i=0;
300 int sign = 1;
301 int weekno = 0;
302 icalrecurrencetype_weekday wd;
303 short *array = parser->rt.by_day;
304 char* end;
305 char* vals_copy;
306
307 vals_copy = icalmemory_strdup(vals);
308
309 end = (char*)vals_copy+strlen(vals_copy);
310 n = vals_copy;
311
312 while(n != 0){
313
314
315 t = n;
316
317 n = strchr(t,',');
318
319 if(n != 0){
320 *n = 0;
321 n++;
322 }
323
324 /* Get optional sign. */
325 if( *t == '-'){
326 sign = -1;
327 t++;
328 } else if (*t == '+'){
329 sign = 1;
330 t++;
331 } else {
332 sign = 1;
333 }
334
335 weekno = 0;
336 /* Get Optional weekno */
337 if( sscanf(t,"%d",&weekno) != 0){
338 if (n != 0){
339 int weeknolen = (n-t)-3; /* 3 -> one for \0, 2 for day name */
340 /* could use abs(log10(weekno))+1, but that needs libm */
341 t += weeknolen;
342 } else {
343 t = end -2;
344 }
345 }
346
347 wd = icalrecur_string_to_weekday(t);
348
349 array[i++] = sign* ((int)wd + 8*weekno);
350 array[i] = ICAL_RECURRENCE_ARRAY_MAX;
351
352 }
353
354 free(vals_copy);
355
356}
357
358
359struct icalrecurrencetype icalrecurrencetype_from_string(const char* str)
360{
361 struct icalrecur_parser parser;
362
363 memset(&parser,0,sizeof(parser));
364 icalrecurrencetype_clear(&parser.rt);
365
366 icalerror_check_arg_re(str!=0,"str",parser.rt);
367
368
369 /* Set up the parser struct */
370 parser.rule = str;
371 parser.copy = icalmemory_strdup(parser.rule);
372 parser.this_clause = parser.copy;
373
374 if(parser.copy == 0){
375 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
376 return parser.rt;
377 }
378
379 /* Loop through all of the clauses */
380 for(icalrecur_first_clause(&parser);
381 parser.this_clause != 0;
382 icalrecur_next_clause(&parser))
383 {
384 char *name, *value;
385 icalrecur_clause_name_and_value(&parser,&name,&value);
386
387 if(name == 0){
388 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
389 icalrecurrencetype_clear(&parser.rt);
390 return parser.rt;
391 }
392
393 if (strcmp(name,"FREQ") == 0){
394 parser.rt.freq = icalrecur_string_to_freq(value);
395 } else if (strcmp(name,"COUNT") == 0){
396 parser.rt.count = atoi(value);
397 } else if (strcmp(name,"UNTIL") == 0){
398 parser.rt.until = icaltime_from_string(value);
399 } else if (strcmp(name,"INTERVAL") == 0){
400 parser.rt.interval = atoi(value);
401 } else if (strcmp(name,"WKST") == 0){
402 parser.rt.week_start = icalrecur_string_to_weekday(value);
403 } else if (strcmp(name,"BYSECOND") == 0){
404 icalrecur_add_byrules(&parser,parser.rt.by_second,
405 ICAL_BY_SECOND_SIZE,value);
406 } else if (strcmp(name,"BYMINUTE") == 0){
407 icalrecur_add_byrules(&parser,parser.rt.by_minute,
408 ICAL_BY_MINUTE_SIZE,value);
409 } else if (strcmp(name,"BYHOUR") == 0){
410 icalrecur_add_byrules(&parser,parser.rt.by_hour,
411 ICAL_BY_HOUR_SIZE,value);
412 } else if (strcmp(name,"BYDAY") == 0){
413 icalrecur_add_bydayrules(&parser,value);
414 } else if (strcmp(name,"BYMONTHDAY") == 0){
415 icalrecur_add_byrules(&parser,parser.rt.by_month_day,
416 ICAL_BY_MONTHDAY_SIZE,value);
417 } else if (strcmp(name,"BYYEARDAY") == 0){
418 icalrecur_add_byrules(&parser,parser.rt.by_year_day,
419 ICAL_BY_YEARDAY_SIZE,value);
420 } else if (strcmp(name,"BYWEEKNO") == 0){
421 icalrecur_add_byrules(&parser,parser.rt.by_week_no,
422 ICAL_BY_WEEKNO_SIZE,value);
423 } else if (strcmp(name,"BYMONTH") == 0){
424 icalrecur_add_byrules(&parser,parser.rt.by_month,
425 ICAL_BY_MONTH_SIZE,value);
426 } else if (strcmp(name,"BYSETPOS") == 0){
427 icalrecur_add_byrules(&parser,parser.rt.by_set_pos,
428 ICAL_BY_SETPOS_SIZE,value);
429 } else {
430 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
431 icalrecurrencetype_clear(&parser.rt);
432 return parser.rt;
433 }
434
435 }
436
437 free(parser.copy);
438
439 return parser.rt;
440
441}
442
443#ifndef ICAL_NO_LIBICAL
444
445struct { char* str;size_t offset; short limit; } recurmap[] =
446{
447 {";BYSECOND=",offsetof(struct icalrecurrencetype,by_second),60},
448 {";BYMINUTE=",offsetof(struct icalrecurrencetype,by_minute),60},
449 {";BYHOUR=",offsetof(struct icalrecurrencetype,by_hour),24},
450 {";BYDAY=",offsetof(struct icalrecurrencetype,by_day),7},
451 {";BYMONTHDAY=",offsetof(struct icalrecurrencetype,by_month_day),31},
452 {";BYYEARDAY=",offsetof(struct icalrecurrencetype,by_year_day),366},
453 {";BYWEEKNO=",offsetof(struct icalrecurrencetype,by_week_no),52},
454 {";BYMONTH=",offsetof(struct icalrecurrencetype,by_month),12},
455 {";BYSETPOS=",offsetof(struct icalrecurrencetype,by_set_pos),366},
456 {0,0,0},
457};
458
459/* A private routine in icalvalue.c */
460void print_datetime_to_string(char* str, struct icaltimetype *data);
461
462char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur)
463{
464 char* str;
465 char *str_p;
466 size_t buf_sz = 200;
467 char temp[20];
468 int i,j;
469
470 if(recur->freq == ICAL_NO_RECURRENCE){
471 return 0;
472 }
473
474 str = (char*)icalmemory_tmp_buffer(buf_sz);
475 str_p = str;
476
477 icalmemory_append_string(&str,&str_p,&buf_sz,"FREQ=");
478 icalmemory_append_string(&str,&str_p,&buf_sz,
479 icalrecur_freq_to_string(recur->freq));
480
481 if(recur->until.year != 0){
482
483 temp[0] = 0;
484 print_datetime_to_string(temp,&(recur->until));
485
486 icalmemory_append_string(&str,&str_p,&buf_sz,";UNTIL=");
487 icalmemory_append_string(&str,&str_p,&buf_sz, temp);
488 }
489
490 if(recur->count != 0){
491 sprintf(temp,"%d",recur->count);
492 icalmemory_append_string(&str,&str_p,&buf_sz,";COUNT=");
493 icalmemory_append_string(&str,&str_p,&buf_sz, temp);
494 }
495
496 if(recur->interval != 0){
497 sprintf(temp,"%d",recur->interval);
498 icalmemory_append_string(&str,&str_p,&buf_sz,";INTERVAL=");
499 icalmemory_append_string(&str,&str_p,&buf_sz, temp);
500 }
501
502 for(j =0; recurmap[j].str != 0; j++){
503 short* array = (short*)(recurmap[j].offset+ (size_t)recur);
504 short limit = recurmap[j].limit;
505
506 /* Skip unused arrays */
507 if( array[0] != ICAL_RECURRENCE_ARRAY_MAX ) {
508
509 icalmemory_append_string(&str,&str_p,&buf_sz,recurmap[j].str);
510
511 for(i=0;
512 i< limit && array[i] != ICAL_RECURRENCE_ARRAY_MAX;
513 i++){
514 if (j == 3) { /* BYDAY */
515 short dow = icalrecurrencetype_day_day_of_week(array[i]);
516 const char *daystr = icalrecur_weekday_to_string(dow);
517 short pos;
518
519 pos = icalrecurrencetype_day_position(array[i]);
520
521 if (pos == 0)
522 icalmemory_append_string(&str,&str_p,&buf_sz,daystr);
523 else {
524 sprintf(temp,"%d%s",pos,daystr);
525 icalmemory_append_string(&str,&str_p,&buf_sz,temp);
526 }
527
528 } else {
529 sprintf(temp,"%d",array[i]);
530 icalmemory_append_string(&str,&str_p,&buf_sz, temp);
531 }
532
533 if( (i+1)<limit &&array[i+1]
534 != ICAL_RECURRENCE_ARRAY_MAX){
535 icalmemory_append_char(&str,&str_p,&buf_sz,',');
536 }
537 }
538 }
539 }
540
541 return str;
542}
543#endif
544
545
546
547/************************* occurrence iteration routiens ******************/
548
549enum byrule {
550 NO_CONTRACTION = -1,
551 BY_SECOND = 0,
552 BY_MINUTE = 1,
553 BY_HOUR = 2,
554 BY_DAY = 3,
555 BY_MONTH_DAY = 4,
556 BY_YEAR_DAY = 5,
557 BY_WEEK_NO = 6,
558 BY_MONTH = 7,
559 BY_SET_POS
560};
561
562
563
564struct icalrecur_iterator_impl {
565
566 struct icaltimetype dtstart; /* Hack. Make into time_t */
567 struct icaltimetype last; /* last time return from _iterator_next*/
568 int occurrence_no; /* number of step made on t iterator */
569 struct icalrecurrencetype rule;
570
571 short days[366];
572 short days_index;
573
574 enum byrule byrule;
575 short by_indices[9];
576 short orig_data[9]; /* 1 if there was data in the byrule */
577
578
579 short *by_ptrs[9]; /* Pointers into the by_* array elements of the rule */
580
581};
582
583int icalrecur_iterator_sizeof_byarray(short* byarray)
584{
585 int array_itr;
586
587 for(array_itr = 0;
588 byarray[array_itr] != ICAL_RECURRENCE_ARRAY_MAX;
589 array_itr++){
590 }
591
592 return array_itr;
593}
594
595enum expand_table {
596 UNKNOWN = 0,
597 CONTRACT = 1,
598 EXPAND =2,
599 ILLEGAL=3
600};
601
602/* The split map indicates, for a particular interval, wether a BY_*
603 rule part expands the number of instances in the occcurrence set or
604 contracts it. 1=> contract, 2=>expand, and 3 means the pairing is
605 not allowed. */
606struct expand_split_map_struct
607{
608 icalrecurrencetype_frequency frequency;
609
610 /* Elements of the 'map' array correspond to the BYxxx rules:
611 Second,Minute,Hour,Day,Month Day,Year Day,Week No,Month*/
612
613 short map[8];
614};
615
616struct expand_split_map_struct expand_map[] =
617{
618 {ICAL_SECONDLY_RECURRENCE,{1,1,1,1,1,1,1,1}},
619 {ICAL_MINUTELY_RECURRENCE,{2,1,1,1,1,1,1,1}},
620 {ICAL_HOURLY_RECURRENCE, {2,2,1,1,1,1,1,1}},
621 {ICAL_DAILY_RECURRENCE, {2,2,2,1,1,1,1,1}},
622 {ICAL_WEEKLY_RECURRENCE, {2,2,2,2,3,3,1,1}},
623 {ICAL_MONTHLY_RECURRENCE, {2,2,2,2,2,3,3,1}},
624 {ICAL_YEARLY_RECURRENCE, {2,2,2,2,2,2,2,2}},
625 {ICAL_NO_RECURRENCE, {0,0,0,0,0,0,0,0}}
626
627};
628
629
630
631/* Check that the rule has only the two given interday byrule parts. */
632int icalrecur_two_byrule(struct icalrecur_iterator_impl* impl,
633 enum byrule one,enum byrule two)
634{
635 short test_array[9];
636 enum byrule itr;
637 int passes = 0;
638
639 memset(test_array,0,9);
640
641 test_array[one] = 1;
642 test_array[two] = 1;
643
644 for(itr = BY_DAY; itr != BY_SET_POS; itr++){
645
646 if( (test_array[itr] == 0 &&
647 impl->by_ptrs[itr][0] != ICAL_RECURRENCE_ARRAY_MAX
648 ) ||
649 (test_array[itr] == 1 &&
650 impl->by_ptrs[itr][0] == ICAL_RECURRENCE_ARRAY_MAX
651 )
652 ) {
653 /* test failed */
654 passes = 0;
655 }
656 }
657
658 return passes;
659
660}
661
662/* Check that the rule has only the one given interdat byrule parts. */
663int icalrecur_one_byrule(struct icalrecur_iterator_impl* impl,enum byrule one)
664{
665 int passes = 1;
666 enum byrule itr;
667
668 for(itr = BY_DAY; itr != BY_SET_POS; itr++){
669
670 if ((itr==one && impl->by_ptrs[itr][0] == ICAL_RECURRENCE_ARRAY_MAX) ||
671 (itr!=one && impl->by_ptrs[itr][0] != ICAL_RECURRENCE_ARRAY_MAX)) {
672 passes = 0;
673 }
674 }
675
676 return passes;
677}
678
679int count_byrules(struct icalrecur_iterator_impl* impl)
680{
681 int count = 0;
682 enum byrule itr;
683
684 for(itr = BY_DAY; itr <= BY_SET_POS; itr++){
685 if(impl->by_ptrs[itr][0] != ICAL_RECURRENCE_ARRAY_MAX){
686 count++;
687 }
688 }
689
690 return count;
691}
692
693
694void setup_defaults(struct icalrecur_iterator_impl* impl,
695 enum byrule byrule, icalrecurrencetype_frequency req,
696 short deftime, int *timepart)
697{
698
699 icalrecurrencetype_frequency freq;
700 freq = impl->rule.freq;
701
702 /* Re-write the BY rule arrays with data from the DTSTART time so
703 we don't have to explicitly deal with DTSTART */
704
705 if(impl->by_ptrs[byrule][0] == ICAL_RECURRENCE_ARRAY_MAX &&
706 expand_map[freq].map[byrule] != CONTRACT){
707 impl->by_ptrs[byrule][0] = deftime;
708 }
709
710 /* Initialize the first occurence */
711 if( freq != req && expand_map[freq].map[byrule] != CONTRACT){
712 *timepart = impl->by_ptrs[byrule][0];
713 }
714
715
716}
717
718int has_by_data(struct icalrecur_iterator_impl* impl, enum byrule byrule){
719
720 return (impl->orig_data[byrule] == 1);
721}
722
723
724int expand_year_days(struct icalrecur_iterator_impl* impl,short year);
725
726
727icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
728 struct icaltimetype dtstart)
729{
730 struct icalrecur_iterator_impl* impl;
731 icalrecurrencetype_frequency freq;
732
733 short days_in_month;
734
735 if ( ( impl = (struct icalrecur_iterator_impl *)
736 malloc(sizeof(struct icalrecur_iterator_impl))) == 0) {
737 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
738 return 0;
739 }
740
741 memset(impl,0,sizeof(struct icalrecur_iterator_impl));
742
743 impl->rule = rule;
744 impl->last = dtstart;
745 impl->dtstart = dtstart;
746 impl->days_index =0;
747 impl->occurrence_no = 0;
748 freq = impl->rule.freq;
749
750 /* Set up convienience pointers to make the code simpler. Allows
751 us to iterate through all of the BY* arrays in the rule. */
752
753 impl->by_ptrs[BY_MONTH]=impl->rule.by_month;
754 impl->by_ptrs[BY_WEEK_NO]=impl->rule.by_week_no;
755 impl->by_ptrs[BY_YEAR_DAY]=impl->rule.by_year_day;
756 impl->by_ptrs[BY_MONTH_DAY]=impl->rule.by_month_day;
757 impl->by_ptrs[BY_DAY]=impl->rule.by_day;
758 impl->by_ptrs[BY_HOUR]=impl->rule.by_hour;
759 impl->by_ptrs[BY_MINUTE]=impl->rule.by_minute;
760 impl->by_ptrs[BY_SECOND]=impl->rule.by_second;
761 impl->by_ptrs[BY_SET_POS]=impl->rule.by_set_pos;
762
763 memset(impl->orig_data,0,9);
764
765 /* Note which by rules had data in them when the iterator was
766 created. We can't use the actuall by_x arrays, because the
767 empty ones will be given default values later in this
768 routine. The orig_data array will be used later in has_by_data */
769
770 impl->orig_data[BY_MONTH]
771 = (impl->rule.by_month[0]!=ICAL_RECURRENCE_ARRAY_MAX);
772 impl->orig_data[BY_WEEK_NO]
773 =(impl->rule.by_week_no[0]!=ICAL_RECURRENCE_ARRAY_MAX);
774 impl->orig_data[BY_YEAR_DAY]
775 =(impl->rule.by_year_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
776 impl->orig_data[BY_MONTH_DAY]
777 =(impl->rule.by_month_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
778 impl->orig_data[BY_DAY]
779 = (impl->rule.by_day[0]!=ICAL_RECURRENCE_ARRAY_MAX);
780 impl->orig_data[BY_HOUR]
781 = (impl->rule.by_hour[0]!=ICAL_RECURRENCE_ARRAY_MAX);
782 impl->orig_data[BY_MINUTE]
783 = (impl->rule.by_minute[0]!=ICAL_RECURRENCE_ARRAY_MAX);
784 impl->orig_data[BY_SECOND]
785 = (impl->rule.by_second[0]!=ICAL_RECURRENCE_ARRAY_MAX);
786 impl->orig_data[BY_SET_POS]
787 = (impl->rule.by_set_pos[0]!=ICAL_RECURRENCE_ARRAY_MAX);
788
789
790 /* Check if the recurrence rule is legal */
791
792 /* If the BYYEARDAY appears, no other date rule part may appear. */
793
794 if(icalrecur_two_byrule(impl,BY_YEAR_DAY,BY_MONTH) ||
795 icalrecur_two_byrule(impl,BY_YEAR_DAY,BY_WEEK_NO) ||
796 icalrecur_two_byrule(impl,BY_YEAR_DAY,BY_MONTH_DAY) ||
797 icalrecur_two_byrule(impl,BY_YEAR_DAY,BY_DAY) ){
798
799 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
800
801 return 0;
802 }
803
804 /* BYWEEKNO and BYMONTH rule parts may not both appear.*/
805
806 if(icalrecur_two_byrule(impl,BY_WEEK_NO,BY_MONTH)){
807 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
808
809 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
810 return 0;
811 }
812
813 /* BYWEEKNO and BYMONTHDAY rule parts may not both appear.*/
814
815 if(icalrecur_two_byrule(impl,BY_WEEK_NO,BY_MONTH_DAY)){
816 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
817
818 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
819 return 0;
820 }
821
822
823 /*For MONTHLY recurrences (FREQ=MONTHLY) neither BYYEARDAY nor
824 BYWEEKNO may appear. */
825
826 if(freq == ICAL_MONTHLY_RECURRENCE &&
827 icalrecur_one_byrule(impl,BY_WEEK_NO)){
828 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
829 return 0;
830 }
831
832
833 /*For WEEKLY recurrences (FREQ=WEEKLY) neither BYMONTHDAY nor
834 BYYEARDAY may appear. */
835
836 if(freq == ICAL_WEEKLY_RECURRENCE &&
837 icalrecur_one_byrule(impl,BY_MONTH_DAY )) {
838 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
839 return 0;
840 }
841
842 /* BYYEARDAY may only appear in YEARLY rules */
843 if(freq != ICAL_YEARLY_RECURRENCE &&
844 icalrecur_one_byrule(impl,BY_YEAR_DAY )) {
845 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
846 return 0;
847 }
848
849 /* Rewrite some of the rules and set up defaults to make later
850 processing easier. Primarily, t involves copying an element
851 from the start time into the coresponding BY_* array when the
852 BY_* array is empty */
853
854
855 setup_defaults(impl,BY_SECOND,ICAL_SECONDLY_RECURRENCE,impl->dtstart.second,
856 &(impl->last.second));
857
858 setup_defaults(impl,BY_MINUTE,ICAL_MINUTELY_RECURRENCE,impl->dtstart.minute,
859 &(impl->last.minute));
860
861 setup_defaults(impl,BY_HOUR,ICAL_HOURLY_RECURRENCE,impl->dtstart.hour,
862 &(impl->last.hour));
863
864 setup_defaults(impl,BY_MONTH_DAY,ICAL_DAILY_RECURRENCE,impl->dtstart.day,
865 &(impl->last.day));
866
867 setup_defaults(impl,BY_MONTH,ICAL_MONTHLY_RECURRENCE,impl->dtstart.month,
868 &(impl->last.month));
869
870
871 if(impl->rule.freq == ICAL_WEEKLY_RECURRENCE ){
872
873 if(impl->by_ptrs[BY_DAY][0] == ICAL_RECURRENCE_ARRAY_MAX){
874
875 /* Weekly recurrences with no BY_DAY data should occur on the
876 same day of the week as the start time . */
877 impl->by_ptrs[BY_DAY][0] = icaltime_day_of_week(impl->dtstart);
878
879 } else {
880 /* If there is BY_DAY data, then we need to move the initial
881 time to the start of the BY_DAY data. That is if the
882 start time is on a Wednesday, and the rule has
883 BYDAY=MO,WE,FR, move the initial time back to
884 monday. Otherwise, jumping to the next week ( jumping 7
885 days ahead ) will skip over some occurrences in the
886 second week. */
887
888 /* This is probably a HACK. There should be some more
889 general way to solve this problem */
890
891 short dow = impl->by_ptrs[BY_DAY][0]-icaltime_day_of_week(impl->last);
892
893 if(dow < 0) {
894 /* initial time is after first day of BY_DAY data */
895
896 impl->last.day += dow;
897 impl->last = icaltime_normalize(impl->last);
898 }
899 }
900
901
902 }
903
904 /* For YEARLY rule, begin by setting up the year days array */
905
906 if(impl->rule.freq == ICAL_YEARLY_RECURRENCE){
907 expand_year_days(impl,impl->last.year);
908 }
909
910
911 /* If this is a monthly interval with by day data, then we need to
912 set the last value to the appropriate day of the month */
913
914 if(impl->rule.freq == ICAL_MONTHLY_RECURRENCE &&
915 has_by_data(impl,BY_DAY)) {
916
917 short dow = icalrecurrencetype_day_day_of_week(
918 impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]);
919 short pos = icalrecurrencetype_day_position(
920 impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]);
921
922 short poscount = 0;
923 days_in_month =
924 icaltime_days_in_month(impl->last.month, impl->last.year);
925
926 if(pos >= 0){
927 /* Count up from the first day pf the month to find the
928 pos'th weekday of dow ( like the second monday. ) */
929
930 for(impl->last.day = 1;
931 impl->last.day <= days_in_month;
932 impl->last.day++){
933
934 if(icaltime_day_of_week(impl->last) == dow){
935 if(++poscount == pos || pos == 0){
936 break;
937 }
938 }
939 }
940 } else {
941 /* Count down from the last day pf the month to find the
942 pos'th weekday of dow ( like the second to last monday. ) */
943 pos = -pos;
944 for(impl->last.day = days_in_month;
945 impl->last.day != 0;
946 impl->last.day--){
947
948 if(icaltime_day_of_week(impl->last) == dow){
949 if(++poscount == pos ){
950 break;
951 }
952 }
953 }
954 }
955
956
957 if(impl->last.day > days_in_month || impl->last.day == 0){
958 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
959 return 0;
960 }
961
962 }
963
964
965
966 return impl;
967}
968
969
970void icalrecur_iterator_free(icalrecur_iterator* i)
971{
972
973 struct icalrecur_iterator_impl* impl =
974 (struct icalrecur_iterator_impl*)i;
975
976 icalerror_check_arg_rv((impl!=0),"impl");
977
978 free(impl);
979
980}
981
982
983void increment_year(struct icalrecur_iterator_impl* impl, int inc)
984{
985 impl->last.year+=inc;
986}
987
988/* Increment month is different that the other incement_* routines --
989 it figures out the interval for itself, and uses BYMONTH data if
990 available. */
991void increment_month(struct icalrecur_iterator_impl* impl)
992{
993 int years;
994
995 if(has_by_data(impl,BY_MONTH) ){
996 /* Ignore the frequency and use the byrule data */
997
998 impl->by_indices[BY_MONTH]++;
999
1000 if (impl->by_ptrs[BY_MONTH][impl->by_indices[BY_MONTH]]
1001 ==ICAL_RECURRENCE_ARRAY_MAX){
1002 impl->by_indices[BY_MONTH] = 0;
1003
1004 increment_year(impl,1);
1005
1006 }
1007
1008 impl->last.month =
1009 impl->by_ptrs[BY_MONTH][impl->by_indices[BY_MONTH]];
1010
1011 } else {
1012
1013 int inc;
1014
1015 if(impl->rule.freq == ICAL_MONTHLY_RECURRENCE){
1016 inc = impl->rule.interval;
1017 } else {
1018 inc = 1;
1019 }
1020
1021 impl->last.month+=inc;
1022
1023 /* Months are offset by one */
1024 impl->last.month--;
1025
1026 years = impl->last.month / 12;
1027
1028 impl->last.month = impl->last.month % 12;
1029
1030 impl->last.month++;
1031
1032 if (years != 0){
1033 increment_year(impl,years);
1034 }
1035 }
1036}
1037
1038void increment_monthday(struct icalrecur_iterator_impl* impl, int inc)
1039{
1040 int i;
1041
1042 for(i=0; i<inc; i++){
1043
1044 short days_in_month =
1045 icaltime_days_in_month(impl->last.month,impl->last.year);
1046
1047 impl->last.day++;
1048
1049 if (impl->last.day > days_in_month){
1050 impl->last.day = impl->last.day-days_in_month;
1051 increment_month(impl);
1052 }
1053 }
1054}
1055
1056
1057void increment_hour(struct icalrecur_iterator_impl* impl, int inc)
1058{
1059 short days;
1060
1061 impl->last.hour+=inc;
1062
1063 days = impl->last.hour / 24;
1064 impl->last.hour = impl->last.hour % 24;
1065
1066 if (impl->days != 0){
1067 increment_monthday(impl,days);
1068 }
1069}
1070
1071void increment_minute(struct icalrecur_iterator_impl* impl, int inc)
1072{
1073 short hours;
1074
1075 impl->last.minute+=inc;
1076
1077 hours = impl->last.minute / 60;
1078 impl->last.minute = impl->last.minute % 60;
1079
1080 if (hours != 0){
1081 increment_hour(impl,hours);
1082 }
1083
1084}
1085
1086void increment_second(struct icalrecur_iterator_impl* impl, int inc)
1087{
1088 short minutes;
1089
1090 impl->last.second+=inc;
1091
1092 minutes = impl->last.second / 60;
1093 impl->last.second = impl->last.second % 60;
1094
1095 if (minutes != 0)
1096 {
1097 increment_minute(impl, minutes);
1098 }
1099}
1100
1101#if 0
1102#include "ical.h"
1103void test_increment()
1104{
1105 struct icalrecur_iterator_impl impl;
1106
1107 impl.last = icaltime_from_string("20000101T000000Z");
1108
1109 printf("Orig: %s\n",icaltime_as_ctime(impl.last));
1110
1111 increment_second(&impl,5);
1112 printf("+ 5 sec : %s\n",icaltime_as_ctime(impl.last));
1113
1114 increment_second(&impl,355);
1115 printf("+ 355 sec : %s\n",icaltime_as_ctime(impl.last));
1116
1117 increment_minute(&impl,5);
1118 printf("+ 5 min : %s\n",icaltime_as_ctime(impl.last));
1119
1120 increment_minute(&impl,360);
1121 printf("+ 360 min : %s\n",icaltime_as_ctime(impl.last));
1122 increment_hour(&impl,5);
1123 printf("+ 5 hours : %s\n",icaltime_as_ctime(impl.last));
1124 increment_hour(&impl,43);
1125 printf("+ 43 hours : %s\n",icaltime_as_ctime(impl.last));
1126 increment_monthday(&impl,3);
1127 printf("+ 3 days : %s\n",icaltime_as_ctime(impl.last));
1128 increment_monthday(&impl,600);
1129 printf("+ 600 days : %s\n",icaltime_as_ctime(impl.last));
1130
1131}
1132
1133#endif
1134
1135short next_second(struct icalrecur_iterator_impl* impl)
1136{
1137
1138 short has_by_data = (impl->by_ptrs[BY_SECOND][0]!=ICAL_RECURRENCE_ARRAY_MAX);
1139 short this_frequency = (impl->rule.freq == ICAL_SECONDLY_RECURRENCE);
1140
1141 short end_of_data = 0;
1142
1143 assert(has_by_data || this_frequency);
1144
1145 if( has_by_data ){
1146 /* Ignore the frequency and use the byrule data */
1147
1148 impl->by_indices[BY_SECOND]++;
1149
1150 if (impl->by_ptrs[BY_SECOND][impl->by_indices[BY_SECOND]]
1151 ==ICAL_RECURRENCE_ARRAY_MAX){
1152 impl->by_indices[BY_SECOND] = 0;
1153
1154 end_of_data = 1;
1155 }
1156
1157
1158 impl->last.second =
1159 impl->by_ptrs[BY_SECOND][impl->by_indices[BY_SECOND]];
1160
1161
1162 } else if( !has_by_data && this_frequency ){
1163 /* Compute the next value from the last time and the frequency interval*/
1164 increment_second(impl, impl->rule.interval);
1165
1166 }
1167
1168 /* If we have gone through all of the seconds on the BY list, then we
1169 need to move to the next minute */
1170
1171 if(has_by_data && end_of_data && this_frequency ){
1172 increment_minute(impl,1);
1173 }
1174
1175 return end_of_data;
1176
1177}
1178
1179int next_minute(struct icalrecur_iterator_impl* impl)
1180{
1181
1182 short has_by_data = (impl->by_ptrs[BY_MINUTE][0]!=ICAL_RECURRENCE_ARRAY_MAX);
1183 short this_frequency = (impl->rule.freq == ICAL_MINUTELY_RECURRENCE);
1184
1185 short end_of_data = 0;
1186
1187 assert(has_by_data || this_frequency);
1188
1189
1190 if (next_second(impl) == 0){
1191 return 0;
1192 }
1193
1194 if( has_by_data ){
1195 /* Ignore the frequency and use the byrule data */
1196
1197 impl->by_indices[BY_MINUTE]++;
1198
1199 if (impl->by_ptrs[BY_MINUTE][impl->by_indices[BY_MINUTE]]
1200 ==ICAL_RECURRENCE_ARRAY_MAX){
1201
1202 impl->by_indices[BY_MINUTE] = 0;
1203
1204 end_of_data = 1;
1205 }
1206
1207 impl->last.minute =
1208 impl->by_ptrs[BY_MINUTE][impl->by_indices[BY_MINUTE]];
1209
1210 } else if( !has_by_data && this_frequency ){
1211 /* Compute the next value from the last time and the frequency interval*/
1212 increment_minute(impl,impl->rule.interval);
1213 }
1214
1215/* If we have gone through all of the minutes on the BY list, then we
1216 need to move to the next hour */
1217
1218 if(has_by_data && end_of_data && this_frequency ){
1219 increment_hour(impl,1);
1220 }
1221
1222 return end_of_data;
1223}
1224
1225int next_hour(struct icalrecur_iterator_impl* impl)
1226{
1227
1228 short has_by_data = (impl->by_ptrs[BY_HOUR][0]!=ICAL_RECURRENCE_ARRAY_MAX);
1229 short this_frequency = (impl->rule.freq == ICAL_HOURLY_RECURRENCE);
1230
1231 short end_of_data = 0;
1232
1233 assert(has_by_data || this_frequency);
1234
1235 if (next_minute(impl) == 0){
1236 return 0;
1237 }
1238
1239 if( has_by_data ){
1240 /* Ignore the frequency and use the byrule data */
1241
1242 impl->by_indices[BY_HOUR]++;
1243
1244 if (impl->by_ptrs[BY_HOUR][impl->by_indices[BY_HOUR]]
1245 ==ICAL_RECURRENCE_ARRAY_MAX){
1246 impl->by_indices[BY_HOUR] = 0;
1247
1248 end_of_data = 1;
1249 }
1250
1251 impl->last.hour =
1252 impl->by_ptrs[BY_HOUR][impl->by_indices[BY_HOUR]];
1253
1254 } else if( !has_by_data && this_frequency ){
1255 /* Compute the next value from the last time and the frequency interval*/
1256 increment_hour(impl,impl->rule.interval);
1257
1258 }
1259
1260 /* If we have gone through all of the hours on the BY list, then we
1261 need to move to the next day */
1262
1263 if(has_by_data && end_of_data && this_frequency ){
1264 increment_monthday(impl,1);
1265 }
1266
1267 return end_of_data;
1268
1269}
1270
1271int next_day(struct icalrecur_iterator_impl* impl)
1272{
1273
1274 short has_by_data = (impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
1275 short this_frequency = (impl->rule.freq == ICAL_DAILY_RECURRENCE);
1276
1277 assert(has_by_data || this_frequency);
1278
1279 if (next_hour(impl) == 0){
1280 return 0;
1281 }
1282
1283 /* Always increment through the interval, since this routine is not
1284 called by any other next_* routine, and the days that are
1285 excluded will be taken care of by restriction filtering */
1286
1287 if(this_frequency){
1288 increment_monthday(impl,impl->rule.interval);
1289 } else {
1290 increment_monthday(impl,1);
1291 }
1292
1293
1294 return 0;
1295
1296}
1297
1298
1299int next_yearday(struct icalrecur_iterator_impl* impl)
1300{
1301
1302 short has_by_data = (impl->by_ptrs[BY_YEAR_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
1303
1304 short end_of_data = 0;
1305
1306 assert(has_by_data );
1307
1308 if (next_hour(impl) == 0){
1309 return 0;
1310 }
1311
1312 impl->by_indices[BY_YEAR_DAY]++;
1313
1314 if (impl->by_ptrs[BY_YEAR_DAY][impl->by_indices[BY_YEAR_DAY]]
1315 ==ICAL_RECURRENCE_ARRAY_MAX){
1316 impl->by_indices[BY_YEAR_DAY] = 0;
1317
1318 end_of_data = 1;
1319 }
1320
1321 impl->last.day =
1322 impl->by_ptrs[BY_YEAR_DAY][impl->by_indices[BY_YEAR_DAY]];
1323
1324 if(has_by_data && end_of_data){
1325 increment_year(impl,1);
1326 }
1327
1328 return end_of_data;
1329
1330}
1331
1332/* This routine is only called by next_week. It is certain that BY_DAY
1333has data */
1334
1335int next_weekday_by_week(struct icalrecur_iterator_impl* impl)
1336{
1337
1338 short end_of_data = 0;
1339 short start_of_week, dow;
1340 struct icaltimetype next;
1341
1342 if (next_hour(impl) == 0){
1343 return 0;
1344 }
1345
1346 assert( impl->by_ptrs[BY_DAY][0]!=ICAL_RECURRENCE_ARRAY_MAX);
1347
1348 while(1) {
1349
1350 impl->by_indices[BY_DAY]++; /* Look at next elem in BYDAY array */
1351
1352 /* Are we at the end of the BYDAY array? */
1353 if (impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]]
1354 ==ICAL_RECURRENCE_ARRAY_MAX){
1355
1356 impl->by_indices[BY_DAY] = 0; /* Reset to 0 */
1357 end_of_data = 1; /* Signal that we're at the end */
1358 }
1359
1360 /* Add the day of week offset to to the start of this week, and use
1361 that to get the next day */
1362 dow = impl->by_ptrs[BY_DAY][impl->by_indices[BY_DAY]];
1363 start_of_week = icaltime_start_doy_of_week(impl->last);
1364
1365 dow--; /*Sun is 1, not 0 */
1366
1367 if(dow+start_of_week <1 && !end_of_data){
1368 /* The selected date is in the previous year. */
1369 continue;
1370 }
1371
1372 next = icaltime_from_day_of_year(start_of_week + dow,impl->last.year);
1373
1374 impl->last.day = next.day;
1375 impl->last.month = next.month;
1376 impl->last.year = next.year;
1377
1378 return end_of_data;
1379 }
1380
1381}
1382
1383int nth_weekday(short dow, short pos, struct icaltimetype t){
1384
1385 short days_in_month = icaltime_days_in_month(t.month,t.year);
1386 short end_dow, start_dow;
1387 short wd;
1388
1389 if(pos >= 0){
1390 t.day = 1;
1391 start_dow = icaltime_day_of_week(t);
1392
1393 if (pos != 0) {
1394 pos--;
1395 }
1396
1397 /* find month day of first occurrence of dow -- such as the
1398 month day of the first monday */
1399
1400 wd = dow-start_dow+1;
1401
1402 if (wd <= 0){
1403 wd = wd + 7;
1404 }
1405
1406 wd = wd + pos * 7;
1407
1408 } else {
1409 t.day = days_in_month;
1410 end_dow = icaltime_day_of_week(t);
1411
1412 pos++;
1413
1414 /* find month day of last occurrence of dow -- such as the
1415 month day of the last monday */
1416
1417 wd = (end_dow - dow);
1418
1419 if (wd < 0){
1420 wd = wd+ 7;
1421 }
1422
1423 wd = days_in_month - wd;
1424
1425 wd = wd + pos * 7;
1426 }
1427
1428 return wd;
1429}
1430
1431
1432int next_month(struct icalrecur_iterator_impl* impl)
1433{
1434 int data_valid = 1;
1435
1436 short this_frequency = (impl->rule.freq == ICAL_MONTHLY_RECURRENCE);
1437
1438 assert( has_by_data(impl,BY_MONTH) || this_frequency);
1439
1440 /* Iterate through the occurrences within a day. If we don't get to
1441 the end of the intra-day data, don't bother going to the next
1442 month */
1443
1444 if (next_hour(impl) == 0){
1445 return data_valid; /* Signal that the data is valid */
1446 }
1447
1448
1449 /* Now iterate through the occurrences within a month -- by days,
1450 weeks or weekdays. */
1451
1452 if(has_by_data(impl,BY_DAY) && has_by_data(impl,BY_MONTH_DAY)){
1453 /* Cases like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR;BYMONTHDAY=13 */
1454 short day, idx,j;
1455 short days_in_month = icaltime_days_in_month(impl->last.month,
1456 impl->last.year);
1457 /* Iterate through the remaining days in the month and check if
1458 each day is listed in the BY_DAY array and in the BY_MONTHDAY
1459 array. This seems very inneficient, but I think it is the
1460 simplest way to account for both BYDAY=1FR (First friday in
1461 month) and BYDAY=FR ( every friday in month ) */
1462
1463 for(day = impl->last.day+1; day <= days_in_month; day++){
1464 for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){
1465 for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){
1466 short dow =
1467 icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]);
1468 short pos = icalrecurrencetype_day_position(BYDAYPTR[idx]);
1469 short mday = BYMDPTR[j];
1470 short this_dow;
1471
1472 impl->last.day = day;
1473 this_dow = icaltime_day_of_week(impl->last);
1474
1475 if( (pos == 0 && dow == this_dow && mday == day) ||
1476 (nth_weekday(dow,pos,impl->last) == day && mday==day)){
1477 goto MDEND;
1478 }
1479 }
1480 }
1481 }
1482
1483 MDEND:
1484
1485 if ( day > days_in_month){
1486 impl->last.day = 1;
1487 increment_month(impl);
1488 data_valid = 0; /* signal that impl->last is invalid */
1489 }
1490
1491
1492 } else if(has_by_data(impl,BY_DAY)){
1493 /* Cases like: FREQ=MONTHLY;INTERVAL=1;BYDAY=FR */
1494 /* For this case, the weekdays are relative to the
1495 month. BYDAY=FR -> First Friday in month, etc. */
1496
1497 short day, idx;
1498 short days_in_month = icaltime_days_in_month(impl->last.month,
1499 impl->last.year);
1500
1501 assert( BYDAYPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX);
1502
1503 /* Iterate through the remaining days in the month and check if
1504 each day is listed in the BY_DAY array. This seems very
1505 inneficient, but I think it is the simplest way to account
1506 for both BYDAY=1FR (First friday in month) and BYDAY=FR (
1507 every friday in month ) */
1508
1509 for(day = impl->last.day+1; day <= days_in_month; day++){
1510 for(idx = 0; BYDAYPTR[idx] != ICAL_RECURRENCE_ARRAY_MAX; idx++){
1511 short dow = icalrecurrencetype_day_day_of_week(BYDAYPTR[idx]);
1512 short pos = icalrecurrencetype_day_position(BYDAYPTR[idx]);
1513 short this_dow;
1514
1515 impl->last.day = day;
1516 this_dow = icaltime_day_of_week(impl->last);
1517
1518 if( (pos == 0 && dow == this_dow ) ||
1519 (nth_weekday(dow,pos,impl->last) == day)){
1520 goto DEND;
1521 }
1522 }
1523 }
1524
1525 DEND:
1526
1527 if ( day > days_in_month){
1528 impl->last.day = 1;
1529 increment_month(impl);
1530 data_valid = 0; /* signal that impl->last is invalid */
1531 }
1532
1533 } else if (has_by_data(impl,BY_MONTH_DAY)) {
1534 /* Cases like: FREQ=MONTHLY;COUNT=10;BYMONTHDAY=-3 */
1535 short day;
1536
1537 assert( BYMDPTR[0]!=ICAL_RECURRENCE_ARRAY_MAX);
1538
1539 BYMDIDX++;
1540
1541 /* Are we at the end of the BYDAY array? */
1542 if (BYMDPTR[BYMDIDX] ==ICAL_RECURRENCE_ARRAY_MAX){
1543
1544 BYMDIDX = 0; /* Reset to 0 */
1545 increment_month(impl);
1546 }
1547
1548 day = BYMDPTR[BYMDIDX];
1549
1550 if (day < 0) {
1551 day = icaltime_days_in_month(impl->last.month,impl->last.year)+
1552 day + 1;
1553 }
1554
1555 impl->last.day = day;
1556
1557 } else {
1558 increment_month(impl);
1559 }
1560
1561 return data_valid; /* Signal that the data is valid */
1562
1563}
1564
1565
1566int next_week(struct icalrecur_iterator_impl* impl)
1567{
1568 short has_by_data = (impl->by_ptrs[BY_WEEK_NO][0]!=ICAL_RECURRENCE_ARRAY_MAX);
1569 short this_frequency = (impl->rule.freq == ICAL_WEEKLY_RECURRENCE);
1570 short end_of_data = 0;
1571
1572 /* Increment to the next week day */
1573 if (next_weekday_by_week(impl) == 0){
1574 return 0; /* Have not reached end of week yet */
1575 }
1576
1577 /* If we get here, we have incremented through the entire week, and
1578 can increment to the next week */
1579
1580
1581 if( has_by_data){
1582 /* Use the Week Number byrule data */
1583 int week_no;
1584 struct icaltimetype t;
1585
1586 impl->by_indices[BY_WEEK_NO]++;
1587
1588 if (impl->by_ptrs[BY_WEEK_NO][impl->by_indices[BY_WEEK_NO]]
1589 ==ICAL_RECURRENCE_ARRAY_MAX){
1590 impl->by_indices[BY_WEEK_NO] = 0;
1591
1592 end_of_data = 1;
1593 }
1594
1595 t = impl->last;
1596 t.month=1; /* HACK, should be setting to the date of the first week of year*/
1597 t.day=1;
1598
1599 week_no = impl->by_ptrs[BY_WEEK_NO][impl->by_indices[BY_WEEK_NO]];
1600
1601 impl->last.day += week_no*7;
1602
1603 impl->last = icaltime_normalize(impl->last);
1604
1605 } else if( !has_by_data && this_frequency ){
1606 /* If there is no BY_WEEK_NO data, just jump forward 7 days. */
1607 increment_monthday(impl,7*impl->rule.interval);
1608 }
1609
1610
1611 if(has_by_data && end_of_data && this_frequency ){
1612 increment_year(impl,1);
1613 }
1614
1615 return end_of_data;
1616
1617}
1618
1619/* Expand the BYDAY rule part and return a pointer to a newly allocated list of days. */
1620pvl_list expand_by_day(struct icalrecur_iterator_impl* impl,short year)
1621{
1622 /* Try to calculate each of the occurrences. */
1623 int i;
1624 pvl_list days_list = pvl_newlist();
1625
1626 short start_dow, end_dow, end_year_day, start_doy;
1627 struct icaltimetype tmp = impl->last;
1628
1629 tmp.year= year;
1630 tmp.month = 1;
1631 tmp.day = 1;
1632 tmp.is_date = 1;
1633
1634 start_dow = icaltime_day_of_week(tmp);
1635 start_doy = icaltime_start_doy_of_week(tmp);
1636
1637 /* Get the last day of the year*/
1638 tmp.year++;
1639 tmp = icaltime_normalize(tmp);
1640 tmp.day--;
1641 tmp = icaltime_normalize(tmp);
1642
1643 end_dow = icaltime_day_of_week(tmp);
1644 end_year_day = icaltime_day_of_year(tmp);
1645
1646 for(i = 0; BYDAYPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){
1647 short dow =
1648 icalrecurrencetype_day_day_of_week(BYDAYPTR[i]);
1649 short pos = icalrecurrencetype_day_position(BYDAYPTR[i]);
1650
1651 if(pos == 0){
1652 /* The day was specified without a position -- it is just
1653 a bare day of the week ( BYDAY=SU) so add all of the
1654 days of the year with this day-of-week*/
1655 int week;
1656 for(week = 0; week < 52 ; week ++){
1657 short doy = start_doy + (week * 7) + dow-1;
1658
1659 if(doy > end_year_day){
1660 break;
1661 } else {
1662 pvl_push(days_list,(void*)(int)doy);
1663 }
1664 }
1665 } else if ( pos > 0) {
1666 int first;
1667 /* First occurrence of dow in year */
1668 if( dow >= start_dow) {
1669 first = dow - start_dow + 1;
1670 } else {
1671 first = dow - start_dow + 8;
1672 }
1673
1674 /* THen just multiple the position times 7 to get the pos'th day in the year */
1675 pvl_push(days_list,(void*)(first+ (pos-1) * 7));
1676
1677 } else { /* pos < 0 */
1678 int last;
1679 pos = -pos;
1680
1681 /* last occurrence of dow in year */
1682 if( dow <= end_dow) {
1683 last = end_year_day - end_dow + dow;
1684 } else {
1685 last = end_year_day - end_dow + dow - 7;
1686 }
1687
1688 pvl_push(days_list,(void*)(last - (pos-1) * 7));
1689 }
1690 }
1691 return days_list;
1692}
1693
1694
1695/* For INTERVAL=YEARLY, set up the days[] array in the iterator to
1696 list all of the days of the current year that are specified in this
1697 rule. */
1698
1699int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
1700{
1701 int j,k;
1702 int days_index=0;
1703 struct icaltimetype t;
1704 int flags;
1705
1706 t = icaltime_null_time();
1707
1708#define HBD(x) has_by_data(impl,x)
1709
1710 t.is_date = 1; /* Needed to make day_of_year routines work property */
1711
1712 memset(&t,0,sizeof(t));
1713 memset(impl->days,ICAL_RECURRENCE_ARRAY_MAX_BYTE,sizeof(impl->days));
1714
1715 flags = (HBD(BY_DAY) ? 1<<BY_DAY : 0) +
1716 (HBD(BY_WEEK_NO) ? 1<<BY_WEEK_NO : 0) +
1717 (HBD(BY_MONTH_DAY) ? 1<<BY_MONTH_DAY : 0) +
1718 (HBD(BY_MONTH) ? 1<<BY_MONTH : 0) +
1719 (HBD(BY_YEAR_DAY) ? 1<<BY_YEAR_DAY : 0);
1720
1721
1722 switch(flags) {
1723
1724 case 0: {
1725 /* FREQ=YEARLY; */
1726
1727 break;
1728 }
1729 case 1<<BY_MONTH: {
1730 /* FREQ=YEARLY; BYMONTH=3,11*/
1731
1732 for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){
1733 struct icaltimetype t;
1734 short month = impl->by_ptrs[BY_MONTH][j];
1735 short doy;
1736
1737 t = impl->dtstart;
1738 t.year = year;
1739 t.month = month;
1740 t.is_date = 1;
1741
1742 doy = icaltime_day_of_year(t);
1743
1744 impl->days[days_index++] = doy;
1745
1746 }
1747 break;
1748 }
1749
1750 case 1<<BY_MONTH_DAY: {
1751 /* FREQ=YEARLY; BYMONTHDAY=1,15*/
1752 for(k=0;impl->by_ptrs[BY_MONTH_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++)
1753 {
1754 short month_day = impl->by_ptrs[BY_MONTH_DAY][k];
1755 short doy;
1756
1757 t = impl->dtstart;
1758 t.day = month_day;
1759 t.year = year;
1760 t.is_date = 1;
1761
1762 doy = icaltime_day_of_year(t);
1763
1764 impl->days[days_index++] = doy;
1765
1766 }
1767 break;
1768 }
1769
1770 case (1<<BY_MONTH_DAY) + (1<<BY_MONTH): {
1771 /* FREQ=YEARLY; BYMONTHDAY=1,15; BYMONTH=10 */
1772
1773 for(j=0;impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){
1774 for(k=0;impl->by_ptrs[BY_MONTH_DAY][k]!=ICAL_RECURRENCE_ARRAY_MAX;k++)
1775 {
1776 short month = impl->by_ptrs[BY_MONTH][j];
1777 short month_day = impl->by_ptrs[BY_MONTH_DAY][k];
1778 short doy;
1779
1780 t.day = month_day;
1781 t.month = month;
1782 t.year = year;
1783 t.is_date = 1;
1784
1785 doy = icaltime_day_of_year(t);
1786
1787 impl->days[days_index++] = doy;
1788
1789 }
1790 }
1791
1792 break;
1793 }
1794
1795 case 1<<BY_WEEK_NO: {
1796 /* FREQ=YEARLY; BYWEEKNO=20,50 */
1797
1798 struct icaltimetype t;
1799 short dow;
1800
1801 t.day = impl->dtstart.day;
1802 t.month = impl->dtstart.month;
1803 t.year = year;
1804 t.is_date = 1;
1805
1806 dow = icaltime_day_of_week(t);
1807 /* HACK Not finished */
1808
1809 icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
1810
1811 break;
1812 }
1813
1814 case (1<<BY_WEEK_NO) + (1<<BY_MONTH_DAY): {
1815 /*FREQ=YEARLY; WEEKNO=20,50; BYMONTH= 6,11 */
1816 icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
1817 break;
1818 }
1819
1820 case 1<<BY_DAY: {
1821 /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR*/
1822 int days_index = 0;
1823 pvl_elem i;
1824 pvl_list days = expand_by_day(impl,year);
1825
1826
1827 for(i=pvl_head(days);i!=0;i=pvl_next(i)){
1828 short day = (short)(int)pvl_data(i);
1829 impl->days[days_index++] = day;
1830 }
1831
1832 pvl_free(days);
1833
1834 break;
1835 }
1836
1837 case (1<<BY_DAY)+(1<<BY_MONTH): {
1838 /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTH = 12*/
1839
1840 int days_index = 0;
1841 pvl_elem itr;
1842 pvl_list days = expand_by_day(impl,year);
1843
1844 for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
1845 short doy = (short)(int)pvl_data(itr);
1846 struct icaltimetype tt;
1847 short j;
1848
1849 tt = icaltime_from_day_of_year(doy,year);
1850
1851 for(j=0;
1852 impl->by_ptrs[BY_MONTH][j]!=ICAL_RECURRENCE_ARRAY_MAX;
1853 j++){
1854 short month = impl->by_ptrs[BY_MONTH][j];
1855
1856 if(tt.month == month){
1857 impl->days[days_index++] = doy;
1858 }
1859 }
1860
1861 }
1862
1863 pvl_free(days);
1864
1865 break;
1866 }
1867
1868 case (1<<BY_DAY) + (1<<BY_MONTH_DAY) : {
1869 /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTHDAY=1,15*/
1870
1871 int days_index = 0;
1872 pvl_elem itr;
1873 pvl_list days = expand_by_day(impl,year);
1874
1875 for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
1876 short day = (short)(int)pvl_data(itr);
1877 struct icaltimetype tt;
1878 short j;
1879
1880 tt = icaltime_from_day_of_year(day,year);
1881
1882 for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){
1883 short mday = BYMDPTR[j];
1884
1885 if(tt.day == mday){
1886 impl->days[days_index++] = day;
1887 }
1888 }
1889
1890 }
1891
1892 pvl_free(days);
1893
1894 break;
1895 }
1896
1897 case (1<<BY_DAY) + (1<<BY_MONTH_DAY) + (1<<BY_MONTH): {
1898 /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; BYMONTHDAY=10; MYMONTH=6,11*/
1899
1900 int days_index = 0;
1901 pvl_elem itr;
1902 pvl_list days = expand_by_day(impl,year);
1903
1904 for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
1905 short day = (short)(int)pvl_data(itr);
1906 struct icaltimetype tt;
1907 short i,j;
1908
1909 tt = icaltime_from_day_of_year(day,year);
1910
1911 for(i = 0; BYMONPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){
1912 for(j = 0; BYMDPTR[j]!=ICAL_RECURRENCE_ARRAY_MAX; j++){
1913 short mday = BYMDPTR[j];
1914 short month = BYMONPTR[i];
1915
1916 if(tt.month == month && tt.day == mday){
1917 impl->days[days_index++] = day;
1918 }
1919 }
1920 }
1921
1922 }
1923
1924 pvl_free(days);
1925
1926 break;
1927
1928 }
1929
1930 case (1<<BY_DAY) + (1<<BY_WEEK_NO) : {
1931 /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; WEEKNO=20,50*/
1932
1933 int days_index = 0;
1934 pvl_elem itr;
1935 pvl_list days = expand_by_day(impl,year);
1936
1937 for(itr=pvl_head(days);itr!=0;itr=pvl_next(itr)){
1938 short day = (short)(int)pvl_data(itr);
1939 struct icaltimetype tt;
1940 short i;
1941
1942 tt = icaltime_from_day_of_year(day,year);
1943
1944 for(i = 0; BYWEEKPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){
1945 short weekno = BYWEEKPTR[i];
1946
1947 if(weekno== icaltime_week_number(tt)){
1948 impl->days[days_index++] = day;
1949 }
1950 }
1951
1952 }
1953
1954 pvl_free(days);
1955 break;
1956 }
1957
1958 case (1<<BY_DAY) + (1<<BY_WEEK_NO) + (1<<BY_MONTH_DAY): {
1959 /*FREQ=YEARLY; BYDAY=TH,20MO,-10FR; WEEKNO=20,50; BYMONTHDAY=1,15*/
1960 icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
1961 break;
1962 }
1963
1964 case 1<<BY_YEAR_DAY: {
1965 for(j=0;impl->by_ptrs[BY_YEAR_DAY][j]!=ICAL_RECURRENCE_ARRAY_MAX;j++){
1966 short doy = impl->by_ptrs[BY_YEAR_DAY][j];
1967 impl->days[days_index++] = doy;
1968 }
1969 break;
1970 }
1971
1972 default: {
1973 icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
1974 break;
1975 }
1976
1977 }
1978
1979 return 0;
1980}
1981
1982
1983int next_year(struct icalrecur_iterator_impl* impl)
1984{
1985 struct icaltimetype next;
1986
1987 /* Next_year does it's own interatio in days, so the next level down is hours */
1988 if (next_hour(impl) == 0){
1989 return 1;
1990 }
1991
1992 if (impl->days[++impl->days_index] == ICAL_RECURRENCE_ARRAY_MAX){
1993 impl->days_index = 0;
1994 increment_year(impl,impl->rule.interval);
1995 expand_year_days(impl,impl->last.year);
1996 }
1997
1998 if(impl->days[0] == ICAL_RECURRENCE_ARRAY_MAX) {
1999 return 0;
2000 }
2001
2002 next = icaltime_from_day_of_year(impl->days[impl->days_index],impl->last.year);
2003
2004 impl->last.day = next.day;
2005 impl->last.month = next.month;
2006
2007 return 1;
2008}
2009
2010int icalrecur_check_rulepart(struct icalrecur_iterator_impl* impl,
2011 short v, enum byrule byrule)
2012{
2013 int itr;
2014
2015 if(impl->by_ptrs[byrule][0]!=ICAL_RECURRENCE_ARRAY_MAX){
2016 for(itr=0; impl->by_ptrs[byrule][itr]!=ICAL_RECURRENCE_ARRAY_MAX;itr++){
2017 if(impl->by_ptrs[byrule][itr] == v){
2018 return 1;
2019 }
2020 }
2021 }
2022
2023 return 0;
2024}
2025
2026int check_contract_restriction(struct icalrecur_iterator_impl* impl,
2027 enum byrule byrule, short v)
2028{
2029 int pass = 0;
2030 int itr;
2031 icalrecurrencetype_frequency freq = impl->rule.freq;
2032
2033 if(impl->by_ptrs[byrule][0]!=ICAL_RECURRENCE_ARRAY_MAX &&
2034 expand_map[freq].map[byrule] == CONTRACT){
2035 for(itr=0; impl->by_ptrs[byrule][itr]!=ICAL_RECURRENCE_ARRAY_MAX;itr++){
2036 if(impl->by_ptrs[byrule][itr] == v){
2037 pass=1;
2038 break;
2039 }
2040 }
2041
2042 return pass;
2043 } else {
2044 /* This is not a contracting byrule, or it has no data, so the
2045 test passes*/
2046 return 1;
2047 }
2048}
2049
2050
2051int check_contracting_rules(struct icalrecur_iterator_impl* impl)
2052{
2053
2054 int day_of_week=0;
2055 int week_no=0;
2056 int year_day=0;
2057
2058 if (
2059 check_contract_restriction(impl,BY_SECOND,impl->last.second) &&
2060 check_contract_restriction(impl,BY_MINUTE,impl->last.minute) &&
2061 check_contract_restriction(impl,BY_HOUR,impl->last.hour) &&
2062 check_contract_restriction(impl,BY_DAY,day_of_week) &&
2063 check_contract_restriction(impl,BY_WEEK_NO,week_no) &&
2064 check_contract_restriction(impl,BY_MONTH_DAY,impl->last.day) &&
2065 check_contract_restriction(impl,BY_MONTH,impl->last.month) &&
2066 check_contract_restriction(impl,BY_YEAR_DAY,year_day) )
2067 {
2068
2069 return 1;
2070 } else {
2071 return 0;
2072 }
2073}
2074
2075struct icaltimetype icalrecur_iterator_next(icalrecur_iterator *itr)
2076{
2077 int valid = 1;
2078 struct icalrecur_iterator_impl* impl =
2079 (struct icalrecur_iterator_impl*)itr;
2080
2081 if( (impl->rule.count!=0 &&impl->occurrence_no >= impl->rule.count) ||
2082 (!icaltime_is_null_time(impl->rule.until) &&
2083 icaltime_compare(impl->last,impl->rule.until) > 0)) {
2084 return icaltime_null_time();
2085 }
2086
2087 if(impl->occurrence_no == 0
2088 && icaltime_compare(impl->last,impl->dtstart) >= 0){
2089
2090 impl->occurrence_no++;
2091 return impl->last;
2092 }
2093
2094 do {
2095 valid = 1;
2096 switch(impl->rule.freq){
2097
2098 case ICAL_SECONDLY_RECURRENCE: {
2099 next_second(impl);
2100 break;
2101 }
2102 case ICAL_MINUTELY_RECURRENCE: {
2103 next_minute(impl);
2104 break;
2105 }
2106 case ICAL_HOURLY_RECURRENCE: {
2107 next_hour(impl);
2108 break;
2109 }
2110 case ICAL_DAILY_RECURRENCE: {
2111 next_day(impl);
2112 break;
2113 }
2114 case ICAL_WEEKLY_RECURRENCE: {
2115 next_week(impl);
2116 break;
2117 }
2118 case ICAL_MONTHLY_RECURRENCE: {
2119 valid = next_month(impl);
2120 break;
2121 }
2122 case ICAL_YEARLY_RECURRENCE:{
2123 valid = next_year(impl);
2124 break;
2125 }
2126 default:{
2127 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
2128 return icaltime_null_time();
2129 }
2130 }
2131
2132 if(impl->last.year >= 2038 ){
2133 /* HACK */
2134 return icaltime_null_time();
2135 }
2136
2137 } while(!check_contracting_rules(impl)
2138 || icaltime_compare(impl->last,impl->dtstart) <= 0
2139 || valid == 0);
2140
2141
2142/* Ignore null times and times that are after the until time */
2143 if( !icaltime_is_null_time(impl->rule.until) &&
2144 icaltime_compare(impl->last,impl->rule.until) > 0 ) {
2145 return icaltime_null_time();
2146 }
2147
2148 impl->occurrence_no++;
2149
2150 return impl->last;
2151}
2152
2153
2154/************************** Type Routines **********************/
2155
2156
2157void icalrecurrencetype_clear(struct icalrecurrencetype *recur)
2158{
2159 memset(recur,ICAL_RECURRENCE_ARRAY_MAX_BYTE,
2160 sizeof(struct icalrecurrencetype));
2161
2162 recur->week_start = ICAL_MONDAY_WEEKDAY;
2163 recur->freq = ICAL_NO_RECURRENCE;
2164 recur->interval = 1;
2165 memset(&(recur->until),0,sizeof(struct icaltimetype));
2166 recur->count = 0;
2167}
2168
2169/* The 'day' element of icalrecurrencetype_weekday is encoded to allow
2170reporesentation of both the day of the week ( Monday, Tueday), but
2171also the Nth day of the week ( First tuesday of the month, last
2172thursday of the year) These routines decode the day values.
2173
2174The day's position in the period ( Nth-ness) and the numerical value
2175of the day are encoded together as: pos*7 + dow
2176
2177A position of 0 means 'any' or 'every'
2178
2179 */
2180
2181enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day)
2182{
2183 return abs(day)%8;
2184}
2185
2186short icalrecurrencetype_day_position(short day)
2187{
2188 short wd, pos;
2189
2190 wd = icalrecurrencetype_day_day_of_week(day);
2191
2192 pos = (abs(day)-wd)/8 * ((day<0)?-1:1);
2193
2194
2195 return pos;
2196}
2197
2198
2199/****************** Enumeration Routines ******************/
2200
2201struct {icalrecurrencetype_weekday wd; const char * str; }
2202wd_map[] = {
2203 {ICAL_SUNDAY_WEEKDAY,"SU"},
2204 {ICAL_MONDAY_WEEKDAY,"MO"},
2205 {ICAL_TUESDAY_WEEKDAY,"TU"},
2206 {ICAL_WEDNESDAY_WEEKDAY,"WE"},
2207 {ICAL_THURSDAY_WEEKDAY,"TH"},
2208 {ICAL_FRIDAY_WEEKDAY,"FR"},
2209 {ICAL_SATURDAY_WEEKDAY,"SA"},
2210 {ICAL_NO_WEEKDAY,0}
2211};
2212
2213const char* icalrecur_weekday_to_string(icalrecurrencetype_weekday kind)
2214{
2215 int i;
2216
2217 for (i=0; wd_map[i].wd != ICAL_NO_WEEKDAY; i++) {
2218 if ( wd_map[i].wd == kind) {
2219 return wd_map[i].str;
2220 }
2221 }
2222
2223 return 0;
2224}
2225
2226icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str)
2227{
2228 int i;
2229
2230 for (i=0; wd_map[i].wd != ICAL_NO_WEEKDAY; i++) {
2231 if ( strcmp(str,wd_map[i].str) == 0){
2232 return wd_map[i].wd;
2233 }
2234 }
2235
2236 return ICAL_NO_WEEKDAY;
2237}
2238
2239
2240
2241struct {
2242 icalrecurrencetype_frequency kind;
2243 const char* str;
2244} freq_map[] = {
2245 {ICAL_SECONDLY_RECURRENCE,"SECONDLY"},
2246 {ICAL_MINUTELY_RECURRENCE,"MINUTELY"},
2247 {ICAL_HOURLY_RECURRENCE,"HOURLY"},
2248 {ICAL_DAILY_RECURRENCE,"DAILY"},
2249 {ICAL_WEEKLY_RECURRENCE,"WEEKLY"},
2250 {ICAL_MONTHLY_RECURRENCE,"MONTHLY"},
2251 {ICAL_YEARLY_RECURRENCE,"YEARLY"},
2252 {ICAL_NO_RECURRENCE,0}
2253};
2254
2255const char* icalrecur_freq_to_string(icalrecurrencetype_frequency kind)
2256{
2257 int i;
2258
2259 for (i=0; freq_map[i].kind != ICAL_NO_RECURRENCE ; i++) {
2260 if ( freq_map[i].kind == kind ) {
2261 return freq_map[i].str;
2262 }
2263 }
2264 return 0;
2265}
2266
2267icalrecurrencetype_frequency icalrecur_string_to_freq(const char* str)
2268{
2269 int i;
2270
2271 for (i=0; freq_map[i].kind != ICAL_NO_RECURRENCE ; i++) {
2272 if ( strcmp(str,freq_map[i].str) == 0){
2273 return freq_map[i].kind;
2274 }
2275 }
2276 return ICAL_NO_RECURRENCE;
2277}
2278
2279/* Fill an array with the 'count' number of occurrences generated by
2280 the rrule. Note that the times are returned in UTC, but the times
2281 are calculated in local time. YOu will have to convert the results
2282 back into local time before using them. */
2283
2284int icalrecur_expand_recurrence(char* rule, time_t start,
2285 int count, time_t* array)
2286{
2287 struct icalrecurrencetype recur;
2288 icalrecur_iterator* ritr;
2289 time_t tt;
2290 struct icaltimetype icstart, next;
2291 int i = 0;
2292
2293 memset(array, 0, count*sizeof(time_t));
2294
2295 icstart = icaltime_from_timet(start,0);
2296
2297 recur = icalrecurrencetype_from_string(rule);
2298
2299 for(ritr = icalrecur_iterator_new(recur,icstart),
2300 next = icalrecur_iterator_next(ritr);
2301 !icaltime_is_null_time(next) && i < count;
2302 next = icalrecur_iterator_next(ritr)){
2303
2304 tt = icaltime_as_timet(next);
2305
2306 if (tt >= start ){
2307 array[i++] = tt;
2308 }
2309
2310 }
2311
2312 icalrecur_iterator_free(ritr);
2313
2314 return 1;
2315}
diff --git a/libical/src/libical/icalrecur.h b/libical/src/libical/icalrecur.h
new file mode 100644
index 0000000..5fcdc15
--- a/dev/null
+++ b/libical/src/libical/icalrecur.h
@@ -0,0 +1,189 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalrecur.h
4 CREATOR: eric 20 March 2000
5
6
7 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of either:
11
12 The LGPL as published by the Free Software Foundation, version
13 2.1, available at: http://www.fsf.org/copyleft/lesser.html
14
15 Or:
16
17 The Mozilla Public License Version 1.0. You may obtain a copy of
18 the License at http://www.mozilla.org/MPL/
19
20How to use:
21
221) Get a rule and a start time from a component
23 icalproperty rrule;
24 struct icalrecurrencetype recur;
25 struct icaltimetype dtstart;
26
27 rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY);
28 recur = icalproperty_get_rrule(rrule);
29 start = icalproperty_get_dtstart(dtstart);
30
31Or, just make them up:
32 recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE");
33 dtstart = icaltime_from_string("19970101T123000")
34
352) Create an iterator
36 icalrecur_iterator* ritr;
37 ritr = icalrecur_iterator_new(recur,start);
38
393) Iterator over the occurrences
40 struct icaltimetype next;
41 while (next = icalrecur_iterator_next(ritr)
42 && !icaltime_is_null_time(next){
43 Do something with next
44 }
45
46Note that that the time returned by icalrecur_iterator_next is in
47whatever timezone that dtstart is in.
48
49======================================================================*/
50
51#ifndef ICALRECUR_H
52#define ICALRECUR_H
53
54#include <time.h>
55#include "icaltime.h"
56
57/***********************************************************************
58 * Recurrance enumerations
59**********************************************************************/
60
61typedef enum icalrecurrencetype_frequency
62{
63 /* These enums are used to index an array, so don't change the
64 order or the integers */
65
66 ICAL_SECONDLY_RECURRENCE=0,
67 ICAL_MINUTELY_RECURRENCE=1,
68 ICAL_HOURLY_RECURRENCE=2,
69 ICAL_DAILY_RECURRENCE=3,
70 ICAL_WEEKLY_RECURRENCE=4,
71 ICAL_MONTHLY_RECURRENCE=5,
72 ICAL_YEARLY_RECURRENCE=6,
73 ICAL_NO_RECURRENCE=7
74
75} icalrecurrencetype_frequency;
76
77typedef enum icalrecurrencetype_weekday
78{
79 ICAL_NO_WEEKDAY,
80 ICAL_SUNDAY_WEEKDAY,
81 ICAL_MONDAY_WEEKDAY,
82 ICAL_TUESDAY_WEEKDAY,
83 ICAL_WEDNESDAY_WEEKDAY,
84 ICAL_THURSDAY_WEEKDAY,
85 ICAL_FRIDAY_WEEKDAY,
86 ICAL_SATURDAY_WEEKDAY
87} icalrecurrencetype_weekday;
88
89enum {
90 ICAL_RECURRENCE_ARRAY_MAX = 0x7f7f,
91 ICAL_RECURRENCE_ARRAY_MAX_BYTE = 0x7f
92};
93
94
95
96/********************** Recurrence type routines **************/
97
98/* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of
99 the values and fields in struct icalrecurrencetype */
100
101#define ICAL_BY_SECOND_SIZE 61
102#define ICAL_BY_MINUTE_SIZE 61
103#define ICAL_BY_HOUR_SIZE 25
104#define ICAL_BY_DAY_SIZE 364 /* 7 days * 52 weeks */
105#define ICAL_BY_MONTHDAY_SIZE 32
106#define ICAL_BY_YEARDAY_SIZE 367
107#define ICAL_BY_WEEKNO_SIZE 54
108#define ICAL_BY_MONTH_SIZE 13
109#define ICAL_BY_SETPOS_SIZE 367
110
111/* Main struct for holding digested recurrence rules */
112struct icalrecurrencetype
113{
114 icalrecurrencetype_frequency freq;
115
116
117 /* until and count are mutually exclusive. */
118 struct icaltimetype until;
119 int count;
120
121 short interval;
122
123 icalrecurrencetype_weekday week_start;
124
125 /* The BY* parameters can each take a list of values. Here I
126 * assume that the list of values will not be larger than the
127 * range of the value -- that is, the client will not name a
128 * value more than once.
129
130 * Each of the lists is terminated with the value
131 * ICAL_RECURRENCE_ARRAY_MAX unless the the list is full.
132 */
133
134 short by_second[ICAL_BY_SECOND_SIZE];
135 short by_minute[ICAL_BY_MINUTE_SIZE];
136 short by_hour[ICAL_BY_HOUR_SIZE];
137 short by_day[ICAL_BY_DAY_SIZE]; /* Encoded value, see below */
138 short by_month_day[ICAL_BY_MONTHDAY_SIZE];
139 short by_year_day[ ICAL_BY_YEARDAY_SIZE];
140 short by_week_no[ICAL_BY_WEEKNO_SIZE];
141 short by_month[ICAL_BY_MONTH_SIZE];
142 short by_set_pos[ICAL_BY_SETPOS_SIZE];
143};
144
145
146void icalrecurrencetype_clear(struct icalrecurrencetype *r);
147
148/* The 'day' element of the by_day array is encoded to allow
149representation of both the day of the week ( Monday, Tueday), but also
150the Nth day of the week ( First tuesday of the month, last thursday of
151the year) These routines decode the day values */
152
153/* 1 == Monday, etc. */
154enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day);
155
156/* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
157short icalrecurrencetype_day_position(short day);
158
159
160/***********************************************************************
161 * Recurrance rule parser
162**********************************************************************/
163
164/* Convert between strings ans recurrencetype structures. */
165struct icalrecurrencetype icalrecurrencetype_from_string(const char* str);
166char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur);
167
168
169/********** recurrence iteration routines ********************/
170
171typedef void icalrecur_iterator;
172
173/* Create a new recurrence rule iterator */
174icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
175 struct icaltimetype dtstart);
176
177/* Get the next occurrence from an iterator */
178struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*);
179
180/* Free the iterator */
181void icalrecur_iterator_free(icalrecur_iterator*);
182
183/* Fills array up with at most 'count' time_t values, each
184 representing an occurrence time in seconds past the POSIX epoch */
185int icalrecur_expand_recurrence(char* rule, time_t start,
186 int count, time_t* array);
187
188
189#endif
diff --git a/libical/src/libical/icalrestriction.c b/libical/src/libical/icalrestriction.c
new file mode 100644
index 0000000..0f863c4
--- a/dev/null
+++ b/libical/src/libical/icalrestriction.c
@@ -0,0 +1,1781 @@
1/* -*- Mode: C -*- */
2/* ======================================================================
3 File: icalrestriction.c
4
5 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
6 ======================================================================*/
7/*#line 7 "icalrestriction.c.in"*/
8
9#ifdef HAVE_CONFIG_H
10#include <config.h>
11#endif
12
13#include "icalrestriction.h"
14#include "icalenums.h"
15#include "icalerror.h"
16
17#include <assert.h>
18#include <stdio.h> /* For snprintf */
19
20int snprintf(char *str, size_t n, char const *fmt, ...);
21
22#define TMP_BUF_SIZE 1024
23
24
25/* Define the structs for the restrictions. these data are filled out
26in machine generated code below */
27
28struct icalrestriction_property_record;
29
30typedef char* (*restriction_func)(struct icalrestriction_property_record* rec,icalcomponent* comp,icalproperty* prop);
31
32
33typedef struct icalrestriction_property_record {
34 icalproperty_method method;
35 icalcomponent_kind component;
36 icalproperty_kind property;
37 icalrestriction_kind restriction;
38 restriction_func function;
39} icalrestriction_property_record;
40
41
42typedef struct icalrestriction_component_record {
43 icalproperty_method method;
44 icalcomponent_kind component;
45 icalcomponent_kind subcomponent;
46 icalrestriction_kind restriction;
47 restriction_func function;
48} icalrestriction_component_record;
49
50icalrestriction_property_record*
51icalrestriction_get_property_restriction(icalproperty_method method,
52 icalcomponent_kind component,
53 icalproperty_kind property);
54icalrestriction_component_record*
55icalrestriction_get_component_restriction(icalproperty_method method,
56 icalcomponent_kind component,
57 icalcomponent_kind subcomponent);
58
59icalrestriction_component_record icalrestriction_component_records[];
60icalrestriction_property_record icalrestriction_property_records[];
61
62icalrestriction_property_record null_prop_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_UNKNOWN,0};
63icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_UNKNOWN,0};
64
65
66/* The each row gives the result of comparing a restriction against a
67 count. The columns in each row represent 0,1,2+. '-1' indicates
68 'invalid, 'don't care' or 'needs more analysis' So, for
69 ICAL_RESTRICTION_ONE, if there is 1 of a property with that
70 restriction, it passes, but if there are 0 or 2+, it fails. */
71
72char compare_map[ICAL_RESTRICTION_UNKNOWN+1][3] = {
73 { 1, 1, 1},/*ICAL_RESTRICTION_NONE*/
74 { 1, 0, 0},/*ICAL_RESTRICTION_ZERO*/
75 { 0, 1, 0},/*ICAL_RESTRICTION_ONE*/
76 { 1, 1, 1},/*ICAL_RESTRICTION_ZEROPLUS*/
77 { 0, 1, 1},/*ICAL_RESTRICTION_ONEPLUS*/
78 { 1, 1, 0},/*ICAL_RESTRICTION_ZEROORONE*/
79 { 1, 1, 0},/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
80 { 1, 1, 0},/*ICAL_RESTRICTION_ONEMUTUAL*/
81 { 1, 1, 1} /*ICAL_RESTRICTION_UNKNOWN*/
82};
83
84char restr_string_map[ICAL_RESTRICTION_UNKNOWN+1][60] = {
85 "unknown number",/*ICAL_RESTRICTION_NONE*/
86 "0",/*ICAL_RESTRICTION_ZERO*/
87 "1",/*ICAL_RESTRICTION_ONE*/
88 "zero or more",/*ICAL_RESTRICTION_ZEROPLUS*/
89 "one or more" ,/*ICAL_RESTRICTION_ONEPLUS*/
90 "zero or one",/*ICAL_RESTRICTION_ZEROORONE*/
91 "zero or one, exclusive with another property",/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
92 "zero or one, mutual with another property",/*ICAL_RESTRICTION_ONEMUTUAL*/
93 "unknown number" /*ICAL_RESTRICTION_UNKNOWN*/
94};
95
96
97int
98icalrestriction_compare(icalrestriction_kind restr, int count){
99
100 if ( restr < ICAL_RESTRICTION_NONE || restr > ICAL_RESTRICTION_UNKNOWN
101 || count < 0){
102 return -1;
103 }
104
105 if (count > 2) {
106 count = 2;
107 }
108
109 return compare_map[restr][count];
110
111}
112
113/* Special case routines */
114
115char* icalrestriction_may_be_draft_final_canceled(
116 icalrestriction_property_record *rec,
117 icalcomponent* comp,
118 icalproperty* prop)
119{
120
121 icalproperty_status stat = icalproperty_get_status(prop);
122
123 if( !( stat == ICAL_STATUS_DRAFT ||
124 stat == ICAL_STATUS_FINAL ||
125 stat == ICAL_STATUS_CANCELLED )){
126
127 return "Failed iTIP restrictions for STATUS property. Value must be one of DRAFT, FINAL, or CANCELED";
128
129 }
130
131 return 0;
132}
133
134char* icalrestriction_may_be_comp_need_process(
135 icalrestriction_property_record *rec,
136 icalcomponent* comp,
137 icalproperty* prop)
138{
139 icalproperty_status stat = icalproperty_get_status(prop);
140
141 if( !( stat == ICAL_STATUS_COMPLETED ||
142 stat == ICAL_STATUS_NEEDSACTION ||
143 stat == ICAL_STATUS_INPROCESS )){
144
145 return "Failed iTIP restrictions for STATUS property. Value must be one of COMPLETED, NEEDS-ACTION or IN-PROCESS";
146
147 }
148
149 return 0;
150}
151char* icalrestriction_may_be_tent_conf(icalrestriction_property_record *rec,
152 icalcomponent* comp,
153 icalproperty* prop){
154 icalproperty_status stat = icalproperty_get_status(prop);
155
156 if( !( stat == ICAL_STATUS_TENTATIVE ||
157 stat == ICAL_STATUS_CONFIRMED )){
158
159 return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE or CONFIRMED";
160
161 }
162
163 return 0;
164}
165char* icalrestriction_may_be_tent_conf_cancel(
166 icalrestriction_property_record *rec,
167 icalcomponent* comp,
168 icalproperty* prop)
169{
170 icalproperty_status stat = icalproperty_get_status(prop);
171
172 if( !( stat == ICAL_STATUS_TENTATIVE ||
173 stat == ICAL_STATUS_CONFIRMED ||
174 stat == ICAL_STATUS_CANCELLED )){
175
176 return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE, CONFIRMED or CANCELED";
177
178 }
179
180 return 0;
181}
182
183char* icalrestriction_must_be_cancel_if_present(
184 icalrestriction_property_record *rec,
185 icalcomponent* comp,
186 icalproperty* prop)
187{
188 /* This routine will not be called if prop == 0 */
189 icalproperty_status stat = icalproperty_get_status(prop);
190
191 if( stat != ICAL_STATUS_CANCELLED)
192 {
193 return "Failed iTIP restrictions for STATUS property. Value must be CANCELLED";
194
195 }
196
197
198 return 0;
199}
200
201char* icalrestriction_must_be_canceled_no_attendee(
202 icalrestriction_property_record *rec,
203 icalcomponent* comp,
204 icalproperty* prop)
205{
206
207 /* Hack. see rfc2446, 3.2.5 CANCEL for porperty STATUS. I don't
208 understand the note */
209
210 return 0;
211}
212char* icalrestriction_must_be_recurring(icalrestriction_property_record *rec,
213 icalcomponent* comp,
214 icalproperty* prop){
215 /* Hack */
216 return 0;
217}
218char* icalrestriction_must_have_duration(icalrestriction_property_record *rec,
219 icalcomponent* comp,
220 icalproperty* prop){
221
222 if( !icalcomponent_get_first_property(comp,ICAL_DURATION_PROPERTY)){
223
224 return "Failed iTIP restrictions for STATUS property. This component must have a DURATION property";
225
226 }
227
228 return 0;
229}
230char* icalrestriction_must_have_repeat(icalrestriction_property_record *rec,
231 icalcomponent* comp,
232 icalproperty* prop){
233 if( !icalcomponent_get_first_property(comp,ICAL_REPEAT_PROPERTY)){
234
235 return "Failed iTIP restrictions for STATUS property. This component must have a REPEAT property";
236
237 }
238
239 return 0;
240}
241char* icalrestriction_must_if_tz_ref(icalrestriction_property_record *rec,
242 icalcomponent* comp,
243 icalproperty* prop){
244
245 /* Hack */
246 return 0;
247}
248char* icalrestriction_no_dtend(icalrestriction_property_record *rec,
249 icalcomponent* comp,
250 icalproperty* prop){
251
252 if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
253
254 return "Failed iTIP restrictions for STATUS property. The component must not have both DURATION and DTEND";
255
256 }
257
258 return 0;
259}
260char* icalrestriction_no_duration(icalrestriction_property_record *rec,
261 icalcomponent* comp,
262 icalproperty* prop){
263
264 /* _no_dtend takes care of this one */
265 return 0;
266}
267
268
269int icalrestriction_check_component(icalproperty_method method,
270 icalcomponent* comp)
271{
272 icalproperty_kind kind;
273 icalcomponent_kind comp_kind;
274 icalrestriction_kind restr;
275 icalrestriction_property_record *prop_record = 0L;
276 icalrestriction_component_record *comp_record = 0L;
277 char* funcr = 0;
278 icalproperty *prop;
279
280 int count;
281 int compare;
282 int valid = 1;
283
284 comp_kind = icalcomponent_isa(comp);
285
286 /* Check all of the properties in this component */
287
288 for(kind = ICAL_ANY_PROPERTY+1; kind != ICAL_NO_PROPERTY; kind++){
289 count = icalcomponent_count_properties(comp, kind);
290
291 prop_record = icalrestriction_get_property_restriction(method,
292 comp_kind,
293 kind);
294
295 restr = prop_record->restriction;
296
297 if(restr == ICAL_RESTRICTION_ONEEXCLUSIVE ||
298 restr == ICAL_RESTRICTION_ONEMUTUAL) {
299
300 /* First treat is as a 0/1 restriction */
301 restr = ICAL_RESTRICTION_ZEROORONE;
302 compare = icalrestriction_compare(restr,count);
303
304 } else {
305
306 compare = icalrestriction_compare(restr,count);
307 }
308
309 assert(compare != -1);
310
311 if (compare == 0){
312 char temp[TMP_BUF_SIZE];
313
314 snprintf(temp, TMP_BUF_SIZE,"Failed iTIP restrictions for %s property. Expected %s instances of the property and got %d",
315 icalenum_property_kind_to_string(kind),
316 restr_string_map[restr], count);
317
318 icalcomponent_add_property
319 (comp,
320 icalproperty_vanew_xlicerror(
321 temp,
322 icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP),
323 0));
324 }
325
326
327 prop = icalcomponent_get_first_property(comp, kind);
328
329 if (prop != 0 && prop_record->function !=0 ){
330 funcr = prop_record->function(prop_record,comp,prop);
331 }
332
333 if(funcr !=0){
334 icalcomponent_add_property
335 (comp,
336 icalproperty_vanew_xlicerror(
337 funcr,
338 icalparameter_new_xlicerrortype(
339 ICAL_XLICERRORTYPE_INVALIDITIP),
340 0));
341
342 compare = 0;
343 }
344
345 valid = valid && compare;
346 }
347
348
349
350 return valid;
351
352
353}
354
355int icalrestriction_check(icalcomponent* outer_comp)
356{
357 icalcomponent_kind comp_kind;
358 icalproperty_method method;
359 icalcomponent* inner_comp;
360 icalproperty *method_prop;
361 int valid;
362
363 icalerror_check_arg_rz( (outer_comp!=0), "outer comp");
364
365
366 /* Get the Method value from the outer component */
367
368 comp_kind = icalcomponent_isa(outer_comp);
369
370 if (comp_kind != ICAL_VCALENDAR_COMPONENT){
371 icalerror_set_errno(ICAL_BADARG_ERROR);
372 return 0;
373 }
374
375 method_prop = icalcomponent_get_first_property(outer_comp,
376 ICAL_METHOD_PROPERTY);
377
378 if (method_prop == 0){
379 method = ICAL_METHOD_NONE;
380 } else {
381 method = icalproperty_get_method(method_prop);
382 }
383
384
385 /* Check the VCALENDAR wrapper */
386 valid = icalrestriction_check_component(ICAL_METHOD_NONE,outer_comp);
387
388
389 /* Now check the inner components */
390
391 for(inner_comp= icalcomponent_get_first_component(outer_comp,
392 ICAL_ANY_COMPONENT);
393 inner_comp != 0;
394 inner_comp= icalcomponent_get_next_component(outer_comp,
395 ICAL_ANY_COMPONENT)){
396
397 valid = valid && icalrestriction_check_component(method,inner_comp);
398
399 }
400
401
402 return valid;
403
404}
405
406icalrestriction_property_record*
407icalrestriction_get_property_restriction(icalproperty_method method,
408 icalcomponent_kind component,
409 icalproperty_kind property)
410{
411 int i;
412
413 for(i = 0;
414 icalrestriction_property_records[i].restriction != ICAL_RESTRICTION_NONE;
415 i++){
416
417 if (method == icalrestriction_property_records[i].method &&
418 component == icalrestriction_property_records[i].component &&
419 property == icalrestriction_property_records[i].property ){
420 return &icalrestriction_property_records[i];
421 }
422 }
423
424 return &null_prop_record;
425}
426
427
428icalrestriction_component_record*
429icalrestriction_get_component_restriction(icalproperty_method method,
430 icalcomponent_kind component,
431 icalcomponent_kind subcomponent)
432{
433
434 int i;
435
436 for(i = 0;
437 icalrestriction_component_records[i].restriction != ICAL_RESTRICTION_NONE;
438 i++){
439
440 if (method == icalrestriction_component_records[i].method &&
441 component == icalrestriction_component_records[i].component &&
442 subcomponent == icalrestriction_component_records[i].subcomponent ){
443 return &icalrestriction_component_records[i];
444 }
445 }
446
447 return &null_comp_record;
448}
449
450/* Everything below this line is machine generated. Do not edit. */
451icalrestriction_property_record icalrestriction_property_records[] = {
452 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
453 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
454 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
455 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
456 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
457 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
458 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
459 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
460 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
461 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
462 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
463 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
464 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
465 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
466 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
467 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
468 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
469 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
470 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
471 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
472 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
473 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
474 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
475 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
476 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
477 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
478 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_tent_conf_cancel},
479 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
480 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
481 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
482 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
483 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
484 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
485 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
486 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
487 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
488 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
489 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
490 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
491 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
492 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
493 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
494 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
495 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
496 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
497 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
498 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
499 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend},
500 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
501 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
502 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
503 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
504 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
505 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
506 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
507 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
508 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
509 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
510 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
511 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
512 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_tent_conf},
513 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
514 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
515 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
516 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0},
517 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
518 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
519 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
520 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
521 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
522 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
523 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
524 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
525 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
526 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
527 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
528 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
529 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
530 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
531 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_dtend},
532 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
533 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
534 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
535 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
536 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
537 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
538 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
539 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
540 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
541 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
542 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
543 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
544 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
545 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
546 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
547 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
548 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
549 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
550 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
551 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
552 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
553 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
554 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
555 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
556 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
557 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
558 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
559 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
560 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
561 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
562 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
563 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
564 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
565 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
566 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
567 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
568 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
569 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
570 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
571 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
572 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
573 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
574 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_tent_conf},
575 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
576 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
577 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
578 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,icalrestriction_must_be_recurring},
579 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
580 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
581 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
582 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
583 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
584 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
585 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
586 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
587 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
588 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
589 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
590 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
591 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
592 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE ,icalrestriction_no_duration},
593 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
594 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
595 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
596 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
597 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
598 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
599 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
600 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
601 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
602 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
603 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
604 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
605 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
606 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_canceled_no_attendee},
607 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
608 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
609 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
610 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
611 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
612 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0},
613 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
614 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
615 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
616 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
617 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
618 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
619 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
620 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
621 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
622 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
623 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
624 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
625 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
626 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
627 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
628 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
629 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
630 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
631 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
632 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
633 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
634 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
635 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
636 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
637 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
638 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
639 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
640 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
641 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
642 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
643 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
644 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
645 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
646 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
647 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
648 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
649 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
650 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
651 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
652 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
653 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
654 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
655 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
656 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
657 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
658 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
659 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
660 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
661 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
662 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
663 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
664 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
665 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
666 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
667 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
668 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
669 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
670 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
671 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
672 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_tent_conf_cancel},
673 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
674 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
675 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
676 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
677 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
678 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
679 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
680 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
681 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
682 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
683 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
684 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
685 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
686 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
687 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
688 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
689 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
690 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
691 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
692 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
693 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
694 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
695 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
696 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
697 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
698 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
699 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
700 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
701 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
702 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
703 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
704 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
705 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
706 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
707 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
708 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
709 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
710 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0},
711 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
712 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
713 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
714 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
715 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
716 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
717 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
718 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
719 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
720 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
721 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
722 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0},
723 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
724 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
725 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
726 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
727 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
728 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
729 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
730 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
731 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
732 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
733 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
734 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0},
735 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
736 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONE,0},
737 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
738 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
739 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
740 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
741 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
742 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
743 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
744 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
745 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
746 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
747 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
748 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
749 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
750 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
751 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0},
752 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
753 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
754 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
755 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
756 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
757 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
758 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
759 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
760 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
761 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
762 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
763 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
764 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
765 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
766 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
767 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
768 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
769 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
770 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
771 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
772 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
773 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
774 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
775 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
776 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
777 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
778 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
779 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
780 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
781 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
782 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
783 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
784 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0},
785 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
786 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
787 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
788 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
789 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
790 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
791 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
792 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
793 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
794 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
795 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
796 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
797 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
798 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
799 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
800 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
801 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
802 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
803 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
804 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
805 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
806 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
807 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
808 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_comp_need_process},
809 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
810 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
811 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
812 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
813 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
814 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
815 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
816 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
817 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
818 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
819 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
820 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
821 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
822 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
823 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
824 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
825 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
826 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
827 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
828 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
829 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
830 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
831 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
832 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
833 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
834 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
835 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
836 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
837 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
838 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
839 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
840 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
841 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
842 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
843 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
844 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
845 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
846 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0},
847 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
848 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
849 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
850 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
851 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
852 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
853 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
854 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
855 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
856 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
857 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
858 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
859 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
860 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
861 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
862 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
863 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
864 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
865 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
866 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
867 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
868 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
869 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
870 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
871 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_comp_need_process},
872 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
873 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
874 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,icalrestriction_must_be_recurring},
875 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
876 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
877 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
878 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
879 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
880 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
881 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
882 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
883 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
884 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
885 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
886 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
887 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
888 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
889 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
890 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
891 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
892 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
893 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
894 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
895 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
896 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
897 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
898 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
899 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
900 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
901 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
902 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
903 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_canceled_no_attendee},
904 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
905 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
906 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
907 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONE,0},
908 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
909 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
910 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
911 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
912 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
913 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
914 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
915 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
916 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
917 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
918 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
919 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
920 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
921 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
922 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
923 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
924 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
925 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
926 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
927 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
928 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
929 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
930 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
931 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
932 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
933 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
934 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
935 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
936 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
937 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
938 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
939 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
940 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
941 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ONE,0},
942 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
943 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
944 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
945 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
946 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
947 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
948 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
949 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
950 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
951 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
952 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
953 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
954 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
955 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
956 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
957 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
958 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
959 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
960 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
961 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
962 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
963 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
964 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
965 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
966 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
967 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_comp_need_process},
968 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
969 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
970 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
971 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
972 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
973 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
974 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
975 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
976 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
977 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
978 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
979 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
980 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
981 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
982 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
983 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
984 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
985 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
986 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
987 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
988 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
989 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
990 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
991 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
992 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
993 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
994 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
995 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
996 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
997 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
998 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
999 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1000 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1001 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1002 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
1003 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
1004 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
1005 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
1006 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1007 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
1008 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1009 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1010 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1011 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1012 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1013 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1014 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1015 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1016 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
1017 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1018 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1019 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1020 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_may_be_draft_final_canceled},
1021 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1022 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1023 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1024 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1025 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1026 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
1027 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
1028 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
1029 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
1030 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
1031 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1032 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
1033 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1034 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1035 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1036 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1037 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1038 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1039 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1040 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1041 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1042 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1043 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1044 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1045 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1046 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1047 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1048 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1049 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ONE,0},
1050 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ONE,0},
1051 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ONE,0},
1052 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ONE,0},
1053 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1054 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1055 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS ,0},
1056 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1057 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1058 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1059 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1060 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1061 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1062 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1063 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1064 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1065 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1066 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
1067 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1068 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1069 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_cancel_if_present},
1070 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1071 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1072 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1073 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1074 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1075 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1076 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1077 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1078 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1079 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1080 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1081 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1082 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1083 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1084 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1085 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1086 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1087 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1088 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1089 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1090 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1091 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1092 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1093 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1094 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1095 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1096 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1097 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1098 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1099 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1100 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ONE,0},
1101 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1102 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1103 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1104 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1105 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1106 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1107 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1108 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1109 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1110 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1111 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1112 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1113 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1114 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1115 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1116 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1117 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1118 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1119 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1120 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1121 {ICAL_METHOD_NONE,ICAL_VCALENDAR_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1122 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1123 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1124 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1125 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1126 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1127 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1128 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1129 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1130 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1131 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1132 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1133 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
1134 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1135 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1136 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1137 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,icalrestriction_no_duration},
1138 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1139 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1140 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1141 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1142 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1143 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1144 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1145 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1146 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1147 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1148 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1149 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1150 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
1151 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1152 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1153 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1154 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1155 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1156 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1157 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1158 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1159 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1160 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1161 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1162 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1163 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1164 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1165 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1166 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1167 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1168 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1169 {ICAL_METHOD_NONE,ICAL_VEVENT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1170 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1171 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1172 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1173 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1174 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1175 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1176 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1177 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1178 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1179 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1180 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1181 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1182 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1183 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1184 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0},
1185 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0},
1186 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1187 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1188 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1189 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1190 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1191 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1192 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1193 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1194 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1195 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1196 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1197 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1198 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
1199 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1200 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1201 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1202 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1203 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1204 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1205 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1206 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1207 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1208 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1209 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1210 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1211 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1212 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1213 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1214 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1215 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1216 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1217 {ICAL_METHOD_NONE,ICAL_VTODO_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1218 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1219 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1220 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1221 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1222 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1223 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1224 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1225 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1226 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1227 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1228 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1229 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1230 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1231 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1232 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0},
1233 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEEXCLUSIVE,0},
1234 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1235 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1236 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1237 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1238 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1239 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1240 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1241 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1242 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1243 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1244 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1245 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1246 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_be_recurring},
1247 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1248 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1249 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1250 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1251 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1252 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1253 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1254 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1255 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1256 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1257 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1258 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1259 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1260 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1261 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1262 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1263 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1264 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1265 {ICAL_METHOD_NONE,ICAL_VJOURNAL_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1266 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1267 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1268 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1269 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1270 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1271 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1272 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1273 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1274 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1275 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1276 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1277 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1278 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1279 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1280 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1281 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1282 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1283 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1284 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1285 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1286 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1287 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1288 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1289 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1290 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1291 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1292 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1293 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1294 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1295 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1296 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1297 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1298 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1299 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1300 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1301 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1302 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1303 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1304 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1305 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1306 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1307 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1308 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1309 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1310 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1311 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1312 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1313 {ICAL_METHOD_NONE,ICAL_VFREEBUSY_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1314 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1315 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1316 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1317 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1318 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1319 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1320 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1321 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1322 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1323 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1324 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1325 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1326 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1327 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1328 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1329 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1330 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1331 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1332 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1333 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1334 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1335 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1336 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1337 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1338 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1339 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1340 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1341 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1342 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1343 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1344 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1345 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1346 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1347 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1348 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1349 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1350 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1351 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1352 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1353 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ONE,0},
1354 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1355 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1356 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1357 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1358 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1359 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1360 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1361 {ICAL_METHOD_NONE,ICAL_VTIMEZONE_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1362 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1363 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1364 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1365 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1366 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1367 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1368 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1369 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1370 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1371 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1372 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1373 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1374 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1375 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
1376 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1377 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1378 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1379 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1380 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1381 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1382 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1383 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1384 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1385 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1386 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1387 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1388 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1389 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1390 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1391 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1392 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1393 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1394 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1395 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1396 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1397 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1398 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1399 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1400 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1401 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1402 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1403 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ONE,0},
1404 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ONE,0},
1405 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1406 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1407 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1408 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1409 {ICAL_METHOD_NONE,ICAL_XSTANDARD_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1410 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1411 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1412 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1413 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1414 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1415 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1416 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1417 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1418 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1419 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1420 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1421 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1422 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1423 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ONE,0},
1424 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1425 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1426 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1427 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1428 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1429 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1430 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1431 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1432 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1433 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1434 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1435 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1436 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1437 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1438 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1439 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1440 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1441 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1442 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1443 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1444 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1445 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1446 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1447 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1448 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1449 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1450 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1451 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ONE,0},
1452 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ONE,0},
1453 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1454 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1455 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1456 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1457 {ICAL_METHOD_NONE,ICAL_XDAYLIGHT_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1458 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1459 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1460 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1461 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1462 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1463 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1464 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1465 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1466 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1467 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1468 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1469 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1470 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1471 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1472 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1473 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_repeat},
1474 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_duration},
1475 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1476 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1477 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1478 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1479 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1480 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1481 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1482 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1483 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1484 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1485 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1486 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1487 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1488 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1489 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1490 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1491 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1492 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1493 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1494 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1495 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1496 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0},
1497 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1498 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1499 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1500 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1501 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1502 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1503 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1504 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1505 {ICAL_METHOD_NONE,ICAL_XAUDIOALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1506 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1507 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1508 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1509 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1510 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1511 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1512 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1513 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1514 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1515 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1516 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1517 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1518 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1519 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1520 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1521 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_repeat},
1522 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_duration},
1523 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1524 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1525 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1526 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1527 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1528 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1529 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1530 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1531 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1532 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1533 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1534 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1535 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1536 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1537 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1538 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1539 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1540 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1541 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1542 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1543 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1544 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0},
1545 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1546 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1547 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1548 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1549 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1550 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1551 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1552 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1553 {ICAL_METHOD_NONE,ICAL_XDISPLAYALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1554 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1555 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1556 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ONEPLUS,0},
1557 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1558 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1559 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1560 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1561 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1562 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1563 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1564 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1565 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1566 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1567 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1568 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1569 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_repeat},
1570 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_duration},
1571 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1572 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1573 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1574 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1575 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1576 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1577 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1578 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1579 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1580 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1581 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1582 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1583 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1584 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1585 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1586 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1587 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1588 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1589 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1590 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ONE,0},
1591 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1592 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0},
1593 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1594 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1595 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1596 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1597 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1598 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1599 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1600 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1601 {ICAL_METHOD_NONE,ICAL_XEMAILALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1602 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ACTION_PROPERTY,ICAL_RESTRICTION_ONE,0},
1603 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ATTACH_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1604 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ATTENDEE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1605 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CALSCALE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1606 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CATEGORIES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1607 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CLASS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1608 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_COMMENT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1609 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_COMPLETED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1610 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CONTACT_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1611 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_CREATED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1612 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DESCRIPTION_PROPERTY,ICAL_RESTRICTION_ZEROORONE,0},
1613 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTEND_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1614 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTSTAMP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1615 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DTSTART_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1616 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DUE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1617 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_DURATION_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_repeat},
1618 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_REPEAT_PROPERTY,ICAL_RESTRICTION_ONEMUTUAL,icalrestriction_must_have_duration},
1619 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_EXDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1620 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_EXRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1621 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_FREEBUSY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1622 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_GEO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1623 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_LASTMODIFIED_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1624 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_LOCATION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1625 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_METHOD_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1626 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_ORGANIZER_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1627 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PERCENTCOMPLETE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1628 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PRIORITY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1629 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_PRODID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1630 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RDATE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1631 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RECURRENCEID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1632 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RELATEDTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1633 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_REQUESTSTATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1634 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RESOURCES_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1635 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_RRULE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1636 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_SEQUENCE_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1637 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_STATUS_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1638 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_SUMMARY_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1639 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TRANSP_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1640 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TRIGGER_PROPERTY,ICAL_RESTRICTION_ONE,0},
1641 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1642 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZNAME_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1643 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZOFFSETFROM_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1644 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZOFFSETTO_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1645 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_TZURL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1646 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_UID_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1647 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_URL_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1648 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_VERSION_PROPERTY,ICAL_RESTRICTION_ZERO,0},
1649 {ICAL_METHOD_NONE,ICAL_XPROCEDUREALARM_COMPONENT,ICAL_X_PROPERTY,ICAL_RESTRICTION_ZEROPLUS,0},
1650 {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE}
1651};
1652icalrestriction_component_record icalrestriction_component_records[] = {
1653 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1654 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1655 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1656 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1657 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,icalrestriction_must_if_tz_ref},
1658 {ICAL_METHOD_PUBLISH,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1659 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1660 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,icalrestriction_must_if_tz_ref},
1661 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1662 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1663 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1664 {ICAL_METHOD_REQUEST,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1665 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE,icalrestriction_must_if_tz_ref},
1666 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1667 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1668 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1669 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1670 {ICAL_METHOD_REPLY,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1671 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1672 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,icalrestriction_must_if_tz_ref},
1673 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1674 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1675 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1676 {ICAL_METHOD_ADD,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1677 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,icalrestriction_must_if_tz_ref},
1678 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1679 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1680 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1681 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1682 {ICAL_METHOD_CANCEL,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1683 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1684 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1685 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1686 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1687 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO,icalrestriction_must_if_tz_ref},
1688 {ICAL_METHOD_REFRESH,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1689 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1690 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,icalrestriction_must_if_tz_ref},
1691 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1692 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1693 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1694 {ICAL_METHOD_COUNTER,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1695 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1696 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1697 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1698 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1699 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO,icalrestriction_must_if_tz_ref},
1700 {ICAL_METHOD_DECLINECOUNTER,ICAL_VEVENT_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1701 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1702 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1703 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1704 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1705 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO,icalrestriction_must_if_tz_ref},
1706 {ICAL_METHOD_PUBLISH,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1707 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1708 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1709 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1710 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1711 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1712 {ICAL_METHOD_REQUEST,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1713 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1714 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1715 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1716 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1717 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1718 {ICAL_METHOD_REPLY,ICAL_VFREEBUSY_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1719 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1720 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1721 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1722 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1723 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1724 {ICAL_METHOD_PUBLISH,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1725 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1726 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1727 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1728 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1729 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1730 {ICAL_METHOD_REQUEST,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1731 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE,0},
1732 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1733 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1734 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1735 {ICAL_METHOD_REPLY,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1736 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1737 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1738 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1739 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1740 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VJOURNAL_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1741 {ICAL_METHOD_ADD,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1742 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE,0},
1743 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1744 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1745 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1746 {ICAL_METHOD_CANCEL,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1747 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1748 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1749 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1750 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1751 {ICAL_METHOD_REFRESH,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1752 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1753 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE,0},
1754 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1755 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1756 {ICAL_METHOD_COUNTER,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1757 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1758 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1759 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1760 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1761 {ICAL_METHOD_DECLINECOUNTER,ICAL_VTODO_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1762 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1763 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1764 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1765 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1766 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1767 {ICAL_METHOD_PUBLISH,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1768 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1769 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROORONE,0},
1770 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1771 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1772 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1773 {ICAL_METHOD_ADD,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1774 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTIMEZONE_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1775 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_X_COMPONENT,ICAL_RESTRICTION_ZEROPLUS,0},
1776 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VALARM_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1777 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VEVENT_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1778 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VFREEBUSY_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1779 {ICAL_METHOD_CANCEL,ICAL_VJOURNAL_COMPONENT,ICAL_VTODO_COMPONENT,ICAL_RESTRICTION_ZERO,0},
1780 {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE}
1781};
diff --git a/libical/src/libical/icalrestriction.c.in b/libical/src/libical/icalrestriction.c.in
new file mode 100644
index 0000000..4544425
--- a/dev/null
+++ b/libical/src/libical/icalrestriction.c.in
@@ -0,0 +1,447 @@
1/* -*- Mode: C -*- */
2/* ======================================================================
3 File: icalrestriction.c
4
5 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
6 ======================================================================*/
7/*#line 7 "icalrestriction.c.in"*/
8
9#ifdef HAVE_CONFIG_H
10#include <config.h>
11#endif
12
13#include "icalrestriction.h"
14#include "icalenums.h"
15#include "icalerror.h"
16
17#include <assert.h>
18#include <stdio.h> /* For snprintf */
19
20#define TMP_BUF_SIZE 1024
21
22
23/* Define the structs for the restrictions. these data are filled out
24in machine generated code below */
25
26struct icalrestriction_property_record;
27
28typedef char* (*restriction_func)(struct icalrestriction_property_record* rec,icalcomponent* comp,icalproperty* prop);
29
30
31typedef struct icalrestriction_property_record {
32 icalproperty_method method;
33 icalcomponent_kind component;
34 icalproperty_kind property;
35 icalrestriction_kind restriction;
36 restriction_func function;
37} icalrestriction_property_record;
38
39
40typedef struct icalrestriction_component_record {
41 icalproperty_method method;
42 icalcomponent_kind component;
43 icalcomponent_kind subcomponent;
44 icalrestriction_kind restriction;
45 restriction_func function;
46} icalrestriction_component_record;
47
48icalrestriction_property_record*
49icalrestriction_get_property_restriction(icalproperty_method method,
50 icalcomponent_kind component,
51 icalproperty_kind property);
52icalrestriction_component_record*
53icalrestriction_get_component_restriction(icalproperty_method method,
54 icalcomponent_kind component,
55 icalcomponent_kind subcomponent);
56
57icalrestriction_component_record icalrestriction_component_records[];
58icalrestriction_property_record icalrestriction_property_records[];
59
60icalrestriction_property_record null_prop_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_UNKNOWN,0};
61icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_UNKNOWN,0};
62
63
64/* The each row gives the result of comparing a restriction against a
65 count. The columns in each row represent 0,1,2+. '-1' indicates
66 'invalid, 'don't care' or 'needs more analysis' So, for
67 ICAL_RESTRICTION_ONE, if there is 1 of a property with that
68 restriction, it passes, but if there are 0 or 2+, it fails. */
69
70char compare_map[ICAL_RESTRICTION_UNKNOWN+1][3] = {
71 { 1, 1, 1},/*ICAL_RESTRICTION_NONE*/
72 { 1, 0, 0},/*ICAL_RESTRICTION_ZERO*/
73 { 0, 1, 0},/*ICAL_RESTRICTION_ONE*/
74 { 1, 1, 1},/*ICAL_RESTRICTION_ZEROPLUS*/
75 { 0, 1, 1},/*ICAL_RESTRICTION_ONEPLUS*/
76 { 1, 1, 0},/*ICAL_RESTRICTION_ZEROORONE*/
77 { 1, 1, 0},/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
78 { 1, 1, 0},/*ICAL_RESTRICTION_ONEMUTUAL*/
79 { 1, 1, 1} /*ICAL_RESTRICTION_UNKNOWN*/
80};
81
82char restr_string_map[ICAL_RESTRICTION_UNKNOWN+1][60] = {
83 "unknown number",/*ICAL_RESTRICTION_NONE*/
84 "0",/*ICAL_RESTRICTION_ZERO*/
85 "1",/*ICAL_RESTRICTION_ONE*/
86 "zero or more",/*ICAL_RESTRICTION_ZEROPLUS*/
87 "one or more" ,/*ICAL_RESTRICTION_ONEPLUS*/
88 "zero or one",/*ICAL_RESTRICTION_ZEROORONE*/
89 "zero or one, exclusive with another property",/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
90 "zero or one, mutual with another property",/*ICAL_RESTRICTION_ONEMUTUAL*/
91 "unknown number" /*ICAL_RESTRICTION_UNKNOWN*/
92};
93
94
95int
96icalrestriction_compare(icalrestriction_kind restr, int count){
97
98 if ( restr < ICAL_RESTRICTION_NONE || restr > ICAL_RESTRICTION_UNKNOWN
99 || count < 0){
100 return -1;
101 }
102
103 if (count > 2) {
104 count = 2;
105 }
106
107 return compare_map[restr][count];
108
109}
110
111/* Special case routines */
112
113char* icalrestriction_may_be_draft_final_canceled(
114 icalrestriction_property_record *rec,
115 icalcomponent* comp,
116 icalproperty* prop)
117{
118
119 icalproperty_status stat = icalproperty_get_status(prop);
120
121 if( !( stat == ICAL_STATUS_DRAFT ||
122 stat == ICAL_STATUS_FINAL ||
123 stat == ICAL_STATUS_CANCELLED )){
124
125 return "Failed iTIP restrictions for STATUS property. Value must be one of DRAFT, FINAL, or CANCELED";
126
127 }
128
129 return 0;
130}
131
132char* icalrestriction_may_be_comp_need_process(
133 icalrestriction_property_record *rec,
134 icalcomponent* comp,
135 icalproperty* prop)
136{
137 icalproperty_status stat = icalproperty_get_status(prop);
138
139 if( !( stat == ICAL_STATUS_COMPLETED ||
140 stat == ICAL_STATUS_NEEDSACTION ||
141 stat == ICAL_STATUS_INPROCESS )){
142
143 return "Failed iTIP restrictions for STATUS property. Value must be one of COMPLETED, NEEDS-ACTION or IN-PROCESS";
144
145 }
146
147 return 0;
148}
149char* icalrestriction_may_be_tent_conf(icalrestriction_property_record *rec,
150 icalcomponent* comp,
151 icalproperty* prop){
152 icalproperty_status stat = icalproperty_get_status(prop);
153
154 if( !( stat == ICAL_STATUS_TENTATIVE ||
155 stat == ICAL_STATUS_CONFIRMED )){
156
157 return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE or CONFIRMED";
158
159 }
160
161 return 0;
162}
163char* icalrestriction_may_be_tent_conf_cancel(
164 icalrestriction_property_record *rec,
165 icalcomponent* comp,
166 icalproperty* prop)
167{
168 icalproperty_status stat = icalproperty_get_status(prop);
169
170 if( !( stat == ICAL_STATUS_TENTATIVE ||
171 stat == ICAL_STATUS_CONFIRMED ||
172 stat == ICAL_STATUS_CANCELLED )){
173
174 return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE, CONFIRMED or CANCELED";
175
176 }
177
178 return 0;
179}
180
181char* icalrestriction_must_be_cancel_if_present(
182 icalrestriction_property_record *rec,
183 icalcomponent* comp,
184 icalproperty* prop)
185{
186 /* This routine will not be called if prop == 0 */
187 icalproperty_status stat = icalproperty_get_status(prop);
188
189 if( stat != ICAL_STATUS_CANCELLED)
190 {
191 return "Failed iTIP restrictions for STATUS property. Value must be CANCELLED";
192
193 }
194
195
196 return 0;
197}
198
199char* icalrestriction_must_be_canceled_no_attendee(
200 icalrestriction_property_record *rec,
201 icalcomponent* comp,
202 icalproperty* prop)
203{
204
205 /* Hack. see rfc2446, 3.2.5 CANCEL for porperty STATUS. I don't
206 understand the note */
207
208 return 0;
209}
210char* icalrestriction_must_be_recurring(icalrestriction_property_record *rec,
211 icalcomponent* comp,
212 icalproperty* prop){
213 /* Hack */
214 return 0;
215}
216char* icalrestriction_must_have_duration(icalrestriction_property_record *rec,
217 icalcomponent* comp,
218 icalproperty* prop){
219
220 if( !icalcomponent_get_first_property(comp,ICAL_DURATION_PROPERTY)){
221
222 return "Failed iTIP restrictions for STATUS property. This component must have a DURATION property";
223
224 }
225
226 return 0;
227}
228char* icalrestriction_must_have_repeat(icalrestriction_property_record *rec,
229 icalcomponent* comp,
230 icalproperty* prop){
231 if( !icalcomponent_get_first_property(comp,ICAL_REPEAT_PROPERTY)){
232
233 return "Failed iTIP restrictions for STATUS property. This component must have a REPEAT property";
234
235 }
236
237 return 0;
238}
239char* icalrestriction_must_if_tz_ref(icalrestriction_property_record *rec,
240 icalcomponent* comp,
241 icalproperty* prop){
242
243 /* Hack */
244 return 0;
245}
246char* icalrestriction_no_dtend(icalrestriction_property_record *rec,
247 icalcomponent* comp,
248 icalproperty* prop){
249
250 if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
251
252 return "Failed iTIP restrictions for STATUS property. The component must not have both DURATION and DTEND";
253
254 }
255
256 return 0;
257}
258char* icalrestriction_no_duration(icalrestriction_property_record *rec,
259 icalcomponent* comp,
260 icalproperty* prop){
261
262 /* _no_dtend takes care of this one */
263 return 0;
264}
265
266
267int icalrestriction_check_component(icalproperty_method method,
268 icalcomponent* comp)
269{
270 icalproperty_kind kind;
271 icalcomponent_kind comp_kind;
272 icalrestriction_kind restr;
273 icalrestriction_property_record *prop_record;
274 icalrestriction_component_record *comp_record;
275 char* funcr = 0;
276 icalproperty *prop;
277
278 int count;
279 int compare;
280 int valid = 1;
281
282 comp_kind = icalcomponent_isa(comp);
283
284 /* Check all of the properties in this component */
285
286 for(kind = ICAL_ANY_PROPERTY+1; kind != ICAL_NO_PROPERTY; kind++){
287 count = icalcomponent_count_properties(comp, kind);
288
289 prop_record = icalrestriction_get_property_restriction(method,
290 comp_kind,
291 kind);
292
293 restr = prop_record->restriction;
294
295 if(restr == ICAL_RESTRICTION_ONEEXCLUSIVE ||
296 restr == ICAL_RESTRICTION_ONEMUTUAL) {
297
298 /* First treat is as a 0/1 restriction */
299 restr = ICAL_RESTRICTION_ZEROORONE;
300 compare = icalrestriction_compare(restr,count);
301
302 } else {
303
304 compare = icalrestriction_compare(restr,count);
305 }
306
307 assert(compare != -1);
308
309 if (compare == 0){
310 char temp[TMP_BUF_SIZE];
311
312 snprintf(temp, TMP_BUF_SIZE,"Failed iTIP restrictions for %s property. Expected %s instances of the property and got %d",
313 icalenum_property_kind_to_string(kind),
314 restr_string_map[restr], count);
315
316 icalcomponent_add_property
317 (comp,
318 icalproperty_vanew_xlicerror(
319 temp,
320 icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP),
321 0));
322 }
323
324
325 prop = icalcomponent_get_first_property(comp, kind);
326
327 if (prop != 0 && prop_record->function !=0 ){
328 funcr = prop_record->function(prop_record,comp,prop);
329 }
330
331 if(funcr !=0){
332 icalcomponent_add_property
333 (comp,
334 icalproperty_vanew_xlicerror(
335 funcr,
336 icalparameter_new_xlicerrortype(
337 ICAL_XLICERRORTYPE_INVALIDITIP),
338 0));
339
340 compare = 0;
341 }
342
343 valid = valid && compare;
344 }
345
346
347
348 return valid;
349
350
351}
352
353int icalrestriction_check(icalcomponent* outer_comp)
354{
355 icalcomponent_kind comp_kind;
356 icalproperty_method method;
357 icalcomponent* inner_comp;
358 icalproperty *method_prop;
359 int valid;
360
361 icalerror_check_arg_rz( (outer_comp!=0), "outer comp");
362
363
364 /* Get the Method value from the outer component */
365
366 comp_kind = icalcomponent_isa(outer_comp);
367
368 if (comp_kind != ICAL_VCALENDAR_COMPONENT){
369 icalerror_set_errno(ICAL_BADARG_ERROR);
370 return 0;
371 }
372
373 method_prop = icalcomponent_get_first_property(outer_comp,
374 ICAL_METHOD_PROPERTY);
375
376 if (method_prop == 0){
377 method = ICAL_METHOD_NONE;
378 } else {
379 method = icalproperty_get_method(method_prop);
380 }
381
382
383 /* Check the VCALENDAR wrapper */
384 valid = icalrestriction_check_component(ICAL_METHOD_NONE,outer_comp);
385
386
387 /* Now check the inner components */
388
389 for(inner_comp= icalcomponent_get_first_component(outer_comp,
390 ICAL_ANY_COMPONENT);
391 inner_comp != 0;
392 inner_comp= icalcomponent_get_next_component(outer_comp,
393 ICAL_ANY_COMPONENT)){
394
395 valid = valid && icalrestriction_check_component(method,inner_comp);
396
397 }
398
399
400 return valid;
401
402}
403
404icalrestriction_property_record*
405icalrestriction_get_property_restriction(icalproperty_method method,
406 icalcomponent_kind component,
407 icalproperty_kind property)
408{
409 int i;
410
411 for(i = 0;
412 icalrestriction_property_records[i].restriction != ICAL_RESTRICTION_NONE;
413 i++){
414
415 if (method == icalrestriction_property_records[i].method &&
416 component == icalrestriction_property_records[i].component &&
417 property == icalrestriction_property_records[i].property ){
418 return &icalrestriction_property_records[i];
419 }
420 }
421
422 return &null_prop_record;
423}
424
425
426icalrestriction_component_record*
427icalrestriction_get_component_restriction(icalproperty_method method,
428 icalcomponent_kind component,
429 icalcomponent_kind subcomponent)
430{
431
432 int i;
433
434 for(i = 0;
435 icalrestriction_component_records[i].restriction != ICAL_RESTRICTION_NONE;
436 i++){
437
438 if (method == icalrestriction_component_records[i].method &&
439 component == icalrestriction_component_records[i].component &&
440 subcomponent == icalrestriction_component_records[i].subcomponent ){
441 return &icalrestriction_component_records[i];
442 }
443 }
444
445 return &null_comp_record;
446}
447
diff --git a/libical/src/libical/icalrestriction.h b/libical/src/libical/icalrestriction.h
new file mode 100644
index 0000000..409334c
--- a/dev/null
+++ b/libical/src/libical/icalrestriction.h
@@ -0,0 +1,63 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalrestriction.h
4 CREATOR: eric 24 April 1999
5
6 $Id$
7
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The original code is icalrestriction.h
23
24 Contributions from:
25 Graham Davison (g.m.davison@computer.org)
26
27
28======================================================================*/
29
30#include "icalproperty.h"
31#include "icalcomponent.h"
32
33#ifndef ICALRESTRICTION_H
34#define ICALRESTRICTION_H
35
36/* These must stay in this order for icalrestriction_compare to work */
37typedef enum icalrestriction_kind {
38 ICAL_RESTRICTION_NONE=0, /* 0 */
39 ICAL_RESTRICTION_ZERO, /* 1 */
40 ICAL_RESTRICTION_ONE, /* 2 */
41 ICAL_RESTRICTION_ZEROPLUS, /* 3 */
42 ICAL_RESTRICTION_ONEPLUS, /* 4 */
43 ICAL_RESTRICTION_ZEROORONE, /* 5 */
44 ICAL_RESTRICTION_ONEEXCLUSIVE,/* 6 */
45 ICAL_RESTRICTION_ONEMUTUAL, /* 7 */
46 ICAL_RESTRICTION_UNKNOWN /* 8 */
47} icalrestriction_kind;
48
49int
50icalrestriction_compare(icalrestriction_kind restr, int count);
51
52
53int
54icalrestriction_is_parameter_allowed(icalproperty_kind property,
55 icalparameter_kind parameter);
56
57int icalrestriction_check(icalcomponent* comp);
58
59
60#endif /* !ICALRESTRICTION_H */
61
62
63
diff --git a/libical/src/libical/icaltime.c b/libical/src/libical/icaltime.c
new file mode 100644
index 0000000..a04ca04
--- a/dev/null
+++ b/libical/src/libical/icaltime.c
@@ -0,0 +1,577 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icaltime.c
4 CREATOR: eric 02 June 2000
5
6 $Id$
7 $Locker$
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The Original Code is eric. The Initial Developer of the Original
23 Code is Eric Busboom
24
25
26 ======================================================================*/
27
28#ifdef HAVE_CONFIG_H
29#include <config.h>
30#endif
31
32#include "icaltime.h"
33#include <assert.h>
34#include <string.h>
35#include <stdlib.h>
36#include <stdio.h>
37
38int snprintf(char *str, size_t n, char const *fmt, ...);
39
40#ifdef ICAL_NO_LIBICAL
41#define icalerror_set_errno(x)
42#define icalerror_check_arg_rv(x,y)
43#define icalerror_check_arg_re(x,y,z)
44#else
45#include "icalerror.h"
46#include "icalmemory.h"
47#endif
48
49
50
51
52struct icaltimetype
53icaltime_from_timet(time_t tm, int is_date)
54{
55 struct icaltimetype tt = icaltime_null_time();
56 struct tm t;
57
58 t = *(gmtime(&tm));
59
60 if(is_date == 0){
61 tt.second = t.tm_sec;
62 tt.minute = t.tm_min;
63 tt.hour = t.tm_hour;
64 } else {
65 tt.second = tt.minute =tt.hour = 0 ;
66 }
67
68 tt.day = t.tm_mday;
69 tt.month = t.tm_mon + 1;
70 tt.year = t.tm_year+ 1900;
71
72 tt.is_utc = 1;
73 tt.is_date = is_date;
74
75 return tt;
76}
77
78/* Structure used by set_tz to hold an old value of TZ, and the new
79 value, which is in memory we will have to free in unset_tz */
80struct set_tz_save {char* orig_tzid; char* new_env_str;};
81
82/* Temporarily change the TZ environmental variable. */
83struct set_tz_save set_tz(const char* tzid)
84{
85
86 char *orig_tzid = 0;
87 char *new_env_str;
88 struct set_tz_save savetz;
89 size_t tmp_sz;
90
91 savetz.orig_tzid = 0;
92 savetz.new_env_str = 0;
93
94 if(getenv("TZ") != 0){
95 orig_tzid = (char*)icalmemory_strdup(getenv("TZ"));
96
97 if(orig_tzid == 0){
98 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
99 return savetz;
100 }
101 }
102
103 tmp_sz =strlen(tzid)+4;
104 new_env_str = (char*)malloc(tmp_sz);
105
106 if(new_env_str == 0){
107 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
108 return savetz;
109 }
110
111 /* Copy the TZid into a string with the form that putenv expects. */
112 strcpy(new_env_str,"TZ=");
113 strcpy(new_env_str+3,tzid);
114
115 putenv(new_env_str);
116
117 /* Old value of TZ and the string we will have to free later */
118 savetz.orig_tzid = orig_tzid;
119 savetz.new_env_str = new_env_str;
120 return savetz;
121}
122
123void unset_tz(struct set_tz_save savetz)
124{
125 /* restore the original TZ environment */
126
127 char* orig_tzid = savetz.orig_tzid;
128
129 if(orig_tzid!=0){
130 size_t tmp_sz =strlen(orig_tzid)+4;
131 char* orig_env_str = (char*)icalmemory_tmp_buffer(tmp_sz);
132
133 if(orig_env_str == 0){
134 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
135 return;
136 }
137
138 strcpy(orig_env_str,"TZ=");
139 strcpy(orig_env_str+3,orig_tzid);
140#ifndef _WIN32
141 setenv("TZ", savetz.orig_tzid,1 );
142#else
143 putenv("TZ=MEZ");//, savetz.orig_tzid );
144#endif
145 free(orig_tzid);
146 } else {
147#ifdef __FreeBSD__
148 unsetenv("TZ");
149#else
150 putenv("TZ"); /* Delete from environment */
151#endif
152 }
153
154 if(savetz.new_env_str != 0){
155 free(savetz.new_env_str);
156 }
157}
158
159
160time_t icaltime_as_timet(struct icaltimetype tt)
161{
162 struct tm stm;
163 time_t t;
164
165 memset(&stm,0,sizeof( struct tm));
166
167 if(icaltime_is_null_time(tt)) {
168 return 0;
169 }
170
171 stm.tm_sec = tt.second;
172 stm.tm_min = tt.minute;
173 stm.tm_hour = tt.hour;
174 stm.tm_mday = tt.day;
175 stm.tm_mon = tt.month-1;
176 stm.tm_year = tt.year-1900;
177 stm.tm_isdst = -1;
178
179 if(tt.is_utc == 1 || tt.is_date == 1){
180 struct set_tz_save old_tz = set_tz("UTC");
181 t = mktime(&stm);
182 unset_tz(old_tz);
183 } else {
184 t = mktime(&stm);
185 }
186
187 return t;
188
189}
190
191char* icaltime_as_ical_string(struct icaltimetype tt)
192{
193 size_t size = 17;
194 char* buf = icalmemory_new_buffer(size);
195
196 if(tt.is_date){
197 snprintf(buf, size,"%04d%02d%02d",tt.year,tt.month,tt.day);
198 } else {
199 char* fmt;
200 if(tt.is_utc){
201 fmt = "%04d%02d%02dT%02d%02d%02dZ";
202 } else {
203 fmt = "%04d%02d%02dT%02d%02d%02d";
204 }
205 snprintf(buf, size,fmt,tt.year,tt.month,tt.day,
206 tt.hour,tt.minute,tt.second);
207 }
208
209 icalmemory_add_tmp_buffer(buf);
210
211 return buf;
212
213}
214
215
216/* convert tt, of timezone tzid, into a utc time */
217struct icaltimetype icaltime_as_utc(struct icaltimetype tt,const char* tzid)
218{
219 int tzid_offset;
220
221 if(tt.is_utc == 1 || tt.is_date == 1){
222 return tt;
223 }
224
225 tzid_offset = icaltime_utc_offset(tt,tzid);
226
227 tt.second -= tzid_offset;
228
229 tt.is_utc = 1;
230
231 return icaltime_normalize(tt);
232}
233
234/* convert tt, a time in UTC, into a time in timezone tzid */
235struct icaltimetype icaltime_as_zone(struct icaltimetype tt,const char* tzid)
236{
237 int tzid_offset;
238
239 tzid_offset = icaltime_utc_offset(tt,tzid);
240
241 tt.second += tzid_offset;
242
243 tt.is_utc = 0;
244
245 return icaltime_normalize(tt);
246
247}
248
249
250/* Return the offset of the named zone as seconds. tt is a time
251 indicating the date for which you want the offset */
252int icaltime_utc_offset(struct icaltimetype ictt, const char* tzid)
253{
254
255 time_t tt = icaltime_as_timet(ictt);
256 time_t offset_tt;
257 struct tm gtm;
258 struct set_tz_save old_tz;
259
260 if(tzid != 0){
261 old_tz = set_tz(tzid);
262 }
263
264 /* Mis-interpret a UTC broken out time as local time */
265 gtm = *(gmtime(&tt));
266 gtm.tm_isdst = localtime(&tt)->tm_isdst;
267 offset_tt = mktime(&gtm);
268
269 if(tzid != 0){
270 unset_tz(old_tz);
271 }
272
273 return tt-offset_tt;
274}
275
276
277
278/* Normalize by converting from localtime to utc and back to local
279 time. This uses localtime because localtime and mktime are inverses
280 of each other */
281
282struct icaltimetype icaltime_normalize(struct icaltimetype tt)
283{
284 struct tm stm;
285 time_t tut;
286
287 memset(&stm,0,sizeof( struct tm));
288
289 stm.tm_sec = tt.second;
290 stm.tm_min = tt.minute;
291 stm.tm_hour = tt.hour;
292 stm.tm_mday = tt.day;
293 stm.tm_mon = tt.month-1;
294 stm.tm_year = tt.year-1900;
295 stm.tm_isdst = -1; /* prevents mktime from changing hour based on
296 daylight savings */
297
298 tut = mktime(&stm);
299
300 stm = *(localtime(&tut));
301
302 tt.second = stm.tm_sec;
303 tt.minute = stm.tm_min;
304 tt.hour = stm.tm_hour;
305 tt.day = stm.tm_mday;
306 tt.month = stm.tm_mon +1;
307 tt.year = stm.tm_year+1900;
308
309 return tt;
310}
311
312
313#ifndef ICAL_NO_LIBICAL
314#include "icalvalue.h"
315
316struct icaltimetype icaltime_from_string(const char* str)
317{
318 struct icaltimetype tt = icaltime_null_time();
319 int size;
320
321 icalerror_check_arg_re(str!=0,"str",icaltime_null_time());
322
323 size = strlen(str);
324
325 if(size == 15) { /* floating time */
326 tt.is_utc = 0;
327 tt.is_date = 0;
328 } else if (size == 16) { /* UTC time, ends in 'Z'*/
329 tt.is_utc = 1;
330 tt.is_date = 0;
331
332 if(str[15] != 'Z'){
333 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
334 return icaltime_null_time();
335 }
336
337 } else if (size == 8) { /* A DATE */
338 tt.is_utc = 1;
339 tt.is_date = 1;
340 } else { /* error */
341 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
342 return icaltime_null_time();
343 }
344
345 if(tt.is_date == 1){
346 sscanf(str,"%04d%02d%02d",&tt.year,&tt.month,&tt.day);
347 } else {
348 char tsep;
349 sscanf(str,"%04d%02d%02d%c%02d%02d%02d",&tt.year,&tt.month,&tt.day,
350 &tsep,&tt.hour,&tt.minute,&tt.second);
351
352 if(tsep != 'T'){
353 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
354 return icaltime_null_time();
355 }
356
357 }
358
359 return tt;
360}
361#endif
362
363char ctime_str[20];
364char* icaltime_as_ctime(struct icaltimetype t)
365{
366 time_t tt;
367
368 tt = icaltime_as_timet(t);
369 sprintf(ctime_str,"%s",ctime(&tt));
370
371 ctime_str[strlen(ctime_str)-1] = 0;
372
373 return ctime_str;
374}
375
376
377short days_in_month[] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
378
379short icaltime_days_in_month(short month,short year)
380{
381
382 int is_leap =0;
383 int days = days_in_month[month];
384
385 assert(month > 0);
386 assert(month <= 12);
387
388 if( (year % 4 == 0 && year % 100 != 0) ||
389 year % 400 == 0){
390 is_leap =1;
391 }
392
393 if( month == 2){
394 days += is_leap;
395 }
396
397 return days;
398}
399
400/* 1-> Sunday, 7->Saturday */
401short icaltime_day_of_week(struct icaltimetype t){
402
403 time_t tt = icaltime_as_timet(t);
404 struct tm *tm;
405
406 if(t.is_utc == 1 || t.is_date == 1){
407 tm = gmtime(&tt);
408 } else {
409 tm = localtime(&tt);
410 }
411
412 return tm->tm_wday+1;
413}
414
415/* Day of the year that the first day of the week (Sunday) is on */
416short icaltime_start_doy_of_week(struct icaltimetype t){
417 time_t tt = icaltime_as_timet(t);
418 time_t start_tt;
419 struct tm *stm;
420 int syear;
421
422 stm = gmtime(&tt);
423 syear = stm->tm_year;
424
425 start_tt = tt - stm->tm_wday*(60*60*24);
426
427 stm = gmtime(&start_tt);
428
429 if(syear == stm->tm_year){
430 return stm->tm_yday+1;
431 } else {
432 /* return negative to indicate that start of week is in
433 previous year. */
434 int is_leap = 0;
435 int year = stm->tm_year;
436
437 if( (year % 4 == 0 && year % 100 != 0) ||
438 year % 400 == 0){
439 is_leap =1;
440 }
441
442 return (stm->tm_yday+1)-(365+is_leap);
443 }
444
445}
446
447short icaltime_week_number(struct icaltimetype ictt)
448{
449 char str[5];
450 time_t t = icaltime_as_timet(ictt);
451 int week_no;
452
453 strftime(str,5,"%V", gmtime(&t));
454
455 week_no = atoi(str);
456
457 return week_no;
458
459}
460
461
462short icaltime_day_of_year(struct icaltimetype t){
463 time_t tt;
464 struct tm *stm;
465 struct set_tz_save old_tz;
466
467 tt = icaltime_as_timet(t);
468
469 old_tz = set_tz("UTC");
470 stm = localtime(&tt);
471 unset_tz(old_tz);
472
473 return stm->tm_yday+1;
474
475}
476
477/* Jan 1 is day #1, not 0 */
478struct icaltimetype icaltime_from_day_of_year(short doy, short year)
479{
480 struct tm stm;
481 time_t tt;
482 struct set_tz_save old_tz;
483
484 /* Get the time of january 1 of this year*/
485 memset(&stm,0,sizeof(struct tm));
486 stm.tm_year = year-1900;
487 stm.tm_mday = 1;
488
489 old_tz = set_tz("UTC");
490 tt = mktime(&stm);
491 unset_tz(old_tz);
492
493
494 /* Now add in the days */
495
496 doy--;
497 tt += doy *60*60*24;
498
499 return icaltime_from_timet(tt, 1);
500}
501
502struct icaltimetype icaltime_null_time()
503{
504 struct icaltimetype t;
505 memset(&t,0,sizeof(struct icaltimetype));
506
507 return t;
508}
509
510
511int icaltime_is_valid_time(struct icaltimetype t){
512 if(t.is_utc > 1 || t.is_utc < 0 ||
513 t.year < 0 || t.year > 3000 ||
514 t.is_date > 1 || t.is_date < 0){
515 return 0;
516 } else {
517 return 1;
518 }
519
520}
521
522int icaltime_is_null_time(struct icaltimetype t)
523{
524 if (t.second +t.minute+t.hour+t.day+t.month+t.year == 0){
525 return 1;
526 }
527
528 return 0;
529
530}
531
532int icaltime_compare(struct icaltimetype a,struct icaltimetype b)
533{
534 time_t t1 = icaltime_as_timet(a);
535 time_t t2 = icaltime_as_timet(b);
536
537 if (t1 > t2) {
538 return 1;
539 } else if (t1 < t2) {
540 return -1;
541 } else {
542 return 0;
543 }
544
545}
546
547int
548icaltime_compare_date_only (struct icaltimetype a, struct icaltimetype b)
549{
550 time_t t1;
551 time_t t2;
552
553 if (a.year == b.year && a.month == b.month && a.day == b.day)
554 return 0;
555
556 t1 = icaltime_as_timet (a);
557 t2 = icaltime_as_timet (b);
558
559 if (t1 > t2)
560 return 1;
561 else if (t1 < t2)
562 return -1;
563 else {
564 /* not reached */
565 assert (0);
566 return 0;
567 }
568}
569
570
571/* These are defined in icalduration.c:
572struct icaltimetype icaltime_add(struct icaltimetype t,
573 struct icaldurationtype d)
574struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
575 struct icaltimetype t2)
576*/
577
diff --git a/libical/src/libical/icaltime.h b/libical/src/libical/icaltime.h
new file mode 100644
index 0000000..0f0379b
--- a/dev/null
+++ b/libical/src/libical/icaltime.h
@@ -0,0 +1,145 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icaltime.h
4 CREATOR: eric 02 June 2000
5
6
7 $Id$
8 $Locker$
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The Original Code is eric. The Initial Developer of the Original
24 Code is Eric Busboom
25
26
27======================================================================*/
28
29#ifndef ICALTIME_H
30#define ICALTIME_H
31
32#include <time.h>
33
34/* icaltime_span is returned by icalcomponent_get_span() */
35struct icaltime_span {
36 time_t start; /* in UTC */
37 time_t end; /* in UTC */
38 int is_busy; /* 1->busy time, 0-> free time */
39};
40
41
42struct icaltimetype
43{
44 int year;
45 int month;
46 int day;
47 int hour;
48 int minute;
49 int second;
50
51 int is_utc; /* 1-> time is in UTC timezone */
52
53 int is_date; /* 1 -> interpret this as date. */
54
55 const char* zone; /*Ptr to Olsen placename. Libical does not own mem*/
56 };
57
58/* Convert seconds past UNIX epoch to a timetype*/
59struct icaltimetype icaltime_from_timet(time_t v, int is_date);
60
61/* Return the time as seconds past the UNIX epoch */
62time_t icaltime_as_timet(struct icaltimetype);
63
64/* Return a string represention of the time, in RFC2445 format. The
65 string is owned by libical */
66char* icaltime_as_ical_string(struct icaltimetype tt);
67
68/* Like icaltime_from_timet(), except that the input may be in seconds
69 past the epoch in floating time. This routine is deprecated */
70struct icaltimetype icaltime_from_int(int v, int is_date, int is_utc);
71
72/* Like icaltime_as_timet, but in a floating epoch. This routine is deprecated */
73int icaltime_as_int(struct icaltimetype);
74
75/* create a time from an ISO format string */
76struct icaltimetype icaltime_from_string(const char* str);
77
78/* Routines for handling timezones */
79/* Return the offset of the named zone as seconds. tt is a time
80 indicating the date for which you want the offset */
81int icaltime_utc_offset(struct icaltimetype tt, const char* tzid);
82
83/* convert tt, of timezone tzid, into a utc time. Does nothing if the
84 time is already UTC. */
85struct icaltimetype icaltime_as_utc(struct icaltimetype tt,
86 const char* tzid);
87
88/* convert tt, a time in UTC, into a time in timezone tzid */
89struct icaltimetype icaltime_as_zone(struct icaltimetype tt,
90 const char* tzid);
91
92/* Return a null time, which indicates no time has been set. This time represent the beginning of the epoch */
93struct icaltimetype icaltime_null_time(void);
94
95/* Return true of the time is null. */
96int icaltime_is_null_time(struct icaltimetype t);
97
98/* Returns false if the time is clearly invalid, but is not null. This
99 is usually the result of creating a new time type buy not clearing
100 it, or setting one of the flags to an illegal value. */
101int icaltime_is_valid_time(struct icaltimetype t);
102
103/* Reset all of the time components to be in their normal ranges. For
104 instance, given a time with minutes=70, the minutes will be reduces
105 to 10, and the hour incremented. This allows the caller to do
106 arithmetic on times without worrying about overflow or
107 underflow. */
108struct icaltimetype icaltime_normalize(struct icaltimetype t);
109
110/* Return the day of the year of the given time */
111short icaltime_day_of_year(struct icaltimetype t);
112
113/* Create a new time, given a day of year and a year. */
114struct icaltimetype icaltime_from_day_of_year(short doy, short year);
115
116/* Return the day of the week of the given time. Sunday is 1 */
117short icaltime_day_of_week(struct icaltimetype t);
118
119/* Return the day of the year for the Sunday of the week that the
120 given time is within. */
121short icaltime_start_doy_of_week(struct icaltimetype t);
122
123/* Return a string with the time represented in the same format as ctime(). THe string is owned by libical */
124char* icaltime_as_ctime(struct icaltimetype);
125
126/* Return the week number for the week the given time is within */
127short icaltime_week_number(struct icaltimetype t);
128
129/* Create a new time from a weeknumber and a year. */
130struct icaltimetype icaltime_from_week_number(short week_number, short year);
131
132/* Return -1, 0, or 1 to indicate that a<b, a==b or a>b */
133int icaltime_compare(struct icaltimetype a,struct icaltimetype b);
134
135/* like icaltime_compare, but only use the date parts. */
136int icaltime_compare_date_only(struct icaltimetype a, struct icaltimetype b);
137
138/* Return the number of days in the given month */
139short icaltime_days_in_month(short month,short year);
140
141
142#endif /* !ICALTIME_H */
143
144
145
diff --git a/libical/src/libical/icaltypes.c b/libical/src/libical/icaltypes.c
new file mode 100644
index 0000000..8c67deb
--- a/dev/null
+++ b/libical/src/libical/icaltypes.c
@@ -0,0 +1,285 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: icaltypes.c
4 CREATOR: eric 16 May 1999
5
6 $Id$
7 $Locker$
8
9
10 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
11
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of either:
14
15 The LGPL as published by the Free Software Foundation, version
16 2.1, available at: http://www.fsf.org/copyleft/lesser.html
17
18 Or:
19
20 The Mozilla Public License Version 1.0. You may obtain a copy of
21 the License at http://www.mozilla.org/MPL/
22
23 The original code is icaltypes.c
24
25 ======================================================================*/
26#ifdef HAVE_CONFIG_H
27#include "config.h"
28#endif
29
30#include "icaltypes.h"
31#include "icalerror.h"
32#include "icalmemory.h"
33#include <stdlib.h> /* for malloc and abs() */
34#include <errno.h> /* for errno */
35#include <string.h> /* for icalmemory_strdup */
36#include <assert.h>
37
38int snprintf(char *str, size_t n, char const *fmt, ...);
39
40#define TEMP_MAX 1024
41
42void*
43icalattachtype_get_data (struct icalattachtype* type);
44
45struct icalattachtype*
46icalattachtype_new()
47{
48 struct icalattachtype* v;
49
50 if ( ( v = (struct icalattachtype*)
51 malloc(sizeof(struct icalattachtype))) == 0) {
52 errno = ENOMEM;
53 return 0;
54 }
55
56 v->refcount = 1;
57
58 v->binary = 0;
59 v->owns_binary = 0;
60 v->base64 = 0;
61 //fprintf(stderr,"setting base 64 to 0 \n");
62
63 v->owns_base64 = 0;
64
65 v->url = 0;
66
67 return v;
68}
69
70
71void
72icalattachtype_free(struct icalattachtype* v)
73{
74 icalerror_check_arg( (v!=0),"v");
75
76 v->refcount--;
77
78 if (v->refcount <= 0){
79
80 if (v->base64 != 0 && v->owns_base64 != 0){
81 int val = v->base64 ;
82 if ( val < 255 ) {
83 fprintf(stderr,"Possible error in attachment processing (%d)\nPocssible solution: Remove attachment from file.\n",val );
84 }
85 free(v->base64);
86 }
87
88 if (v->binary != 0 && v->owns_binary != 0){
89 free(v->binary);
90 }
91
92 if (v->url != 0){
93 free(v->url);
94 }
95
96 free(v);
97 }
98}
99
100void icalattachtype_add_reference(struct icalattachtype* v)
101{
102 icalerror_check_arg( (v!=0),"v");
103 v->refcount++;
104}
105
106void icalattachtype_set_url(struct icalattachtype* v, char* url)
107{
108 icalerror_check_arg( (v!=0),"v");
109
110 if (v->url != 0){
111 free (v->url);
112 }
113
114 v->url = icalmemory_strdup(url);
115
116 /* HACK This routine should do something if icalmemory_strdup returns NULL */
117
118}
119
120char* icalattachtype_get_url(struct icalattachtype* v)
121{
122 icalerror_check_arg( (v!=0),"v");
123 return v->url;
124}
125
126void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
127 int owns)
128{
129 //fprintf(stderr,"1setbase64 %d \n", base64 );
130 icalerror_check_arg( (v!=0),"v");
131 //fprintf(stderr,"setbase64 %d \n", base64 );
132 v->base64 = base64;
133 v->owns_base64 = !(owns != 0 );
134
135}
136
137char* icalattachtype_get_base64(struct icalattachtype* v)
138{
139 icalerror_check_arg( (v!=0),"v");
140 return v->base64;
141}
142
143void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
144 int owns)
145{
146 icalerror_check_arg( (v!=0),"v");
147
148 v->binary = binary;
149 v->owns_binary = !(owns != 0 );
150
151}
152
153void* icalattachtype_get_binary(struct icalattachtype* v)
154{
155 icalerror_check_arg( (v!=0),"v");
156 return v->binary;
157}
158
159int icaltriggertype_is_null_trigger(struct icaltriggertype tr)
160{
161 if(icaltime_is_null_time(tr.time) &&
162 icaldurationtype_is_null_duration(tr.duration)){
163 return 1;
164 }
165
166 return 0;
167}
168
169struct icaltriggertype icaltriggertype_from_string(const char* str)
170{
171
172
173 struct icaltriggertype tr, null_tr;
174 icalerrorstate es;
175 icalerrorenum e;
176
177 tr.time= icaltime_null_time();
178 tr.duration = icaldurationtype_from_int(0);
179
180 null_tr = tr;
181
182 if(str == 0) goto error;
183
184 /* Surpress errors so a failure in icaltime_from_string() does not cause an abort */
185 es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
186 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);
187 e = icalerrno;
188 icalerror_set_errno(ICAL_NO_ERROR);
189
190 tr.time = icaltime_from_string(str);
191
192 if (icaltime_is_null_time(tr.time)){
193
194 tr.duration = icaldurationtype_from_string(str);
195
196 if(icaldurationtype_as_int(tr.duration) == 0) goto error;
197 }
198
199 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
200 icalerror_set_errno(e);
201 return tr;
202
203 error:
204 icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
205 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
206 return null_tr;
207
208}
209
210
211struct icalreqstattype icalreqstattype_from_string(const char* str)
212{
213 const char *p1,*p2;
214 struct icalreqstattype stat;
215 int major, minor;
216
217 icalerror_check_arg((str != 0),"str");
218
219 stat.code = ICAL_UNKNOWN_STATUS;
220 stat.debug = 0;
221 stat.desc = 0;
222
223 /* Get the status numbers */
224
225 sscanf(str, "%d.%d",&major, &minor);
226
227 if (major <= 0 || minor < 0){
228 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
229 return stat;
230 }
231
232 stat.code = icalenum_num_to_reqstat(major, minor);
233
234 if (stat.code == ICAL_UNKNOWN_STATUS){
235 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
236 return stat;
237 }
238
239
240 p1 = strchr(str,';');
241
242 if (p1 == 0){
243/* icalerror_set_errno(ICAL_BADARG_ERROR);*/
244 return stat;
245 }
246
247 /* Just ignore the second clause; it will be taken from inside the library
248 */
249
250
251
252 p2 = strchr(p1+1,';');
253 if (p2 != 0 && *p2 != 0){
254 stat.debug = p2+1;
255 }
256
257 return stat;
258
259}
260
261const char* icalreqstattype_as_string(struct icalreqstattype stat)
262{
263 char *temp;
264
265 temp = (char*)icalmemory_tmp_buffer(TEMP_MAX);
266
267 icalerror_check_arg_rz((stat.code != ICAL_UNKNOWN_STATUS),"Status");
268
269 if (stat.desc == 0){
270 stat.desc = icalenum_reqstat_desc(stat.code);
271 }
272
273 if(stat.debug != 0){
274 snprintf(temp,TEMP_MAX,"%d.%d;%s;%s", icalenum_reqstat_major(stat.code),
275 icalenum_reqstat_minor(stat.code),
276 stat.desc, stat.debug);
277
278 } else {
279 snprintf(temp,TEMP_MAX,"%d.%d;%s", icalenum_reqstat_major(stat.code),
280 icalenum_reqstat_minor(stat.code),
281 stat.desc);
282 }
283
284 return temp;
285}
diff --git a/libical/src/libical/icaltypes.h b/libical/src/libical/icaltypes.h
new file mode 100644
index 0000000..d61b9f3
--- a/dev/null
+++ b/libical/src/libical/icaltypes.h
@@ -0,0 +1,138 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icaltypes.h
4 CREATOR: eric 20 March 1999
5
6
7 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of either:
11
12 The LGPL as published by the Free Software Foundation, version
13 2.1, available at: http://www.fsf.org/copyleft/lesser.html
14
15 Or:
16
17 The Mozilla Public License Version 1.0. You may obtain a copy of
18 the License at http://www.mozilla.org/MPL/
19
20 The original code is icaltypes.h
21
22======================================================================*/
23
24#ifndef ICALTYPES_H
25#define ICALTYPES_H
26
27#include <time.h>
28#include "icalenums.h"
29#include "icaltime.h"
30#include "icalduration.h"
31#include "icalperiod.h"
32
33
34/* This type type should probably be an opaque type... */
35struct icalattachtype
36{
37 void* binary;
38 int owns_binary;
39
40 char* base64;
41 int owns_base64;
42
43 char* url;
44
45 int refcount;
46
47};
48
49/* converts base64 to binary, fetches url and stores as binary, or
50 just returns data */
51
52struct icalattachtype* icalattachtype_new(void);
53void icalattachtype_add_reference(struct icalattachtype* v);
54void icalattachtype_free(struct icalattachtype* v);
55
56void icalattachtype_set_url(struct icalattachtype* v, char* url);
57char* icalattachtype_get_url(struct icalattachtype* v);
58
59void icalattachtype_set_base64(struct icalattachtype* v, char* base64,
60 int owns);
61char* icalattachtype_get_base64(struct icalattachtype* v);
62
63void icalattachtype_set_binary(struct icalattachtype* v, char* binary,
64 int owns);
65void* icalattachtype_get_binary(struct icalattachtype* v);
66
67struct icalgeotype
68{
69 float lat;
70 float lon;
71};
72
73
74struct icaldatetimeperiodtype
75{
76 struct icaltimetype time;
77 struct icalperiodtype period;
78};
79
80
81struct icaltriggertype
82{
83 struct icaltimetype time;
84 struct icaldurationtype duration;
85};
86
87struct icaltriggertype icaltriggertype_from_string(const char* str);
88
89int icaltriggertype_is_null_trigger(struct icaltriggertype tr);
90
91/* struct icalreqstattype. This struct contains two string pointers,
92but don't try to free either of them. The "desc" string is a pointer
93to a static table inside the library. Don't try to free it. The
94"debug" string is a pointer into the string that the called passed
95into to icalreqstattype_from_string. Don't try to free it either, and
96don't use it after the original string has been freed.
97
98BTW, you would get that original string from
99*icalproperty_get_requeststatus() or icalvalue_get_text(), when
100operating on a the value of a request_status property. */
101
102struct icalreqstattype {
103
104 icalrequeststatus code;
105 const char* desc;
106 const char* debug;
107};
108
109struct icalreqstattype icalreqstattype_from_string(const char* str);
110const char* icalreqstattype_as_string(struct icalreqstattype);
111
112
113
114struct icaltimezonephase {
115 const char* tzname;
116 int is_stdandard; /* 1 = standard tme, 0 = daylight savings time */
117 struct icaltimetype dtstart;
118 int offsetto;
119 int tzoffsetfrom;
120 const char* comment;
121 struct icaldatetimeperiodtype rdate;
122 const char* rrule;
123};
124
125
126struct icaltimezonetype {
127 const char* tzid;
128 struct icaltimetype last_mod;
129 const char* tzurl;
130
131 /* Array of phases. The end of the array is a phase with tzname == 0 */
132 struct icaltimezonephase *phases;
133};
134
135void icaltimezonetype_free(struct icaltimezonetype tzt);
136
137
138#endif /* !ICALTYPES_H */
diff --git a/libical/src/libical/icalvalue.c b/libical/src/libical/icalvalue.c
new file mode 100644
index 0000000..eb5476e
--- a/dev/null
+++ b/libical/src/libical/icalvalue.c
@@ -0,0 +1,1215 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalvalue.c
4 CREATOR: eric 02 May 1999
5
6 $Id$
7
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The original code is icalvalue.c
23
24 Contributions from:
25 Graham Davison (g.m.davison@computer.org)
26
27
28======================================================================*/
29
30#ifdef HAVE_CONFIG_H
31#include <config.h>
32#endif
33
34#include "icalerror.h"
35#include "icalmemory.h"
36#include "icalparser.h"
37#include "icalenums.h"
38#include "icalvalueimpl.h"
39
40#include <stdlib.h> /* for malloc */
41#include <stdio.h> /* for sprintf */
42#include <string.h> /* For memset, others */
43#include <stddef.h> /* For offsetof() macro */
44#include <errno.h>
45#include <time.h> /* for mktime */
46#include <stdlib.h> /* for atoi and atof */
47#include <limits.h> /* for SHRT_MAX */
48
49int snprintf(char *str, size_t n, char const *fmt, ...);
50
51#if _MAC_OS_
52#include "icalmemory_strdup.h"
53#endif
54
55#define TMP_BUF_SIZE 1024
56
57void print_datetime_to_string(char* str, struct icaltimetype *data);
58void print_date_to_string(char* str, struct icaltimetype *data);
59void print_time_to_string(char* str, struct icaltimetype *data);
60void print_recur_to_string(char* str, struct icaltimetype *data);
61
62
63struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind){
64
65 struct icalvalue_impl* v;
66
67 if ( ( v = (struct icalvalue_impl*)
68 malloc(sizeof(struct icalvalue_impl))) == 0) {
69 icalerror_set_errno(ICAL_NEWFAILED_ERROR);
70 return 0;
71 }
72
73 strcpy(v->id,"val");
74
75 v->kind = kind;
76 v->size = 0;
77 v->parent = 0;
78 v->x_value = 0;
79 memset(&(v->data),0,sizeof(v->data));
80
81 return v;
82
83}
84
85
86
87icalvalue*
88icalvalue_new (icalvalue_kind kind)
89{
90 return (icalvalue*)icalvalue_new_impl(kind);
91}
92
93icalvalue* icalvalue_new_clone(icalvalue* value){
94
95 struct icalvalue_impl* new;
96 struct icalvalue_impl* old = (struct icalvalue_impl*)value;
97
98 new = icalvalue_new_impl(old->kind);
99
100 if (new == 0){
101 return 0;
102 }
103
104
105 strcpy(new->id, old->id);
106 new->kind = old->kind;
107 new->size = old->size;
108
109 switch (new->kind){
110
111 /* The contents of the attach value may or may not be owned by the
112 * library. */
113 case ICAL_ATTACH_VALUE:
114 case ICAL_BINARY_VALUE:
115 {
116 /* HACK ugh. I don't feel like impleenting this */
117 }
118
119 case ICAL_STRING_VALUE:
120 case ICAL_TEXT_VALUE:
121 case ICAL_CALADDRESS_VALUE:
122 case ICAL_URI_VALUE:
123 {
124 if (old->data.v_string != 0) {
125 new->data.v_string=icalmemory_strdup(old->data.v_string);
126
127 if ( new->data.v_string == 0 ) {
128 return 0;
129 }
130
131 }
132 break;
133 }
134 case ICAL_RECUR_VALUE:
135 {
136 if(old->data.v_recur != 0){
137 new->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
138
139 if(new->data.v_recur == 0){
140 return 0;
141 }
142
143 memcpy(new->data.v_recur, old->data.v_recur,
144 sizeof(struct icalrecurrencetype));
145 }
146 break;
147 }
148
149 default:
150 {
151 /* all of the other types are stored as values, not
152 pointers, so we can just copy the whole structure. */
153
154 new->data = old->data;
155 }
156 }
157
158 return new;
159}
160
161char* icalmemory_strdup_and_dequote(const char* str)
162{
163 const char* p;
164 char* out = (char*)malloc(sizeof(char) * strlen(str) +1);
165 char* pout;
166
167 if (out == 0){
168 return 0;
169 }
170
171 pout = out;
172
173 for (p = str; *p!=0; p++){
174
175 if( *p == '\\')
176 {
177 p++;
178 switch(*p){
179 case 0:
180 {
181 *pout = '\0';
182 break;
183
184 }
185 case 'n':
186 {
187 *pout = '\n';
188 break;
189 }
190 case 'N':
191 {
192 *pout = '\n';
193 break;
194 }
195 case '\\':
196 case ',':
197 case ';':
198 {
199 *pout = *p;
200 break;
201 }
202 default:
203 {
204 *pout = ' ';
205 }
206 }
207 } else {
208 *pout = *p;
209 }
210
211 pout++;
212
213 }
214
215 *pout = '\0';
216
217 return out;
218}
219
220icalvalue* icalvalue_new_enum(icalvalue_kind kind, int x_type, const char* str)
221{
222 int e = icalproperty_string_to_enum(str);
223 struct icalvalue_impl *value;
224
225 if(e != 0 && icalproperty_enum_belongs_to_property(
226 icalproperty_value_kind_to_kind(kind),e)) {
227
228 value = icalvalue_new_impl(kind);
229 value->data.v_enum = e;
230 } else {
231 /* Make it an X value */
232 value = icalvalue_new_impl(kind);
233 value->data.v_enum = x_type;
234 icalvalue_set_x(value,str);
235 }
236
237 return value;
238}
239
240
241icalvalue* icalvalue_new_from_string_with_error(icalvalue_kind kind,const char* str,icalproperty** error)
242{
243
244 struct icalvalue_impl *value = 0;
245 struct icalattachtype *attach = 0;
246
247 icalerror_check_arg_rz(str!=0,"str");
248
249 if (error != 0){
250 *error = 0;
251 }
252
253 switch (kind){
254
255 case ICAL_ATTACH_VALUE:
256 attach = icalattachtype_new();
257 value = icalvalue_new_attach( attach );
258 icalattachtype_free( attach );
259 icalattachtype_set_url( value->data.v_attach, str );
260 break;
261 case ICAL_BINARY_VALUE:
262 case ICAL_BOOLEAN_VALUE:
263 {
264 /* HACK */
265 value = 0;
266
267 if (error != 0){
268 char temp[TMP_BUF_SIZE];
269 sprintf(temp,"%s Values are not implemented",
270 icalparameter_kind_to_string(kind));
271 *error = icalproperty_vanew_xlicerror(
272 temp,
273 icalparameter_new_xlicerrortype(
274 ICAL_XLICERRORTYPE_VALUEPARSEERROR),
275 0);
276 }
277 break;
278 }
279
280
281 case ICAL_TRANSP_VALUE:
282 value = icalvalue_new_enum(kind, ICAL_TRANSP_X,str);
283 break;
284 case ICAL_METHOD_VALUE:
285 value = icalvalue_new_enum(kind, ICAL_METHOD_X,str);
286 break;
287 case ICAL_STATUS_VALUE:
288 value = icalvalue_new_enum(kind, ICAL_STATUS_X,str);
289 break;
290 case ICAL_ACTION_VALUE:
291 value = icalvalue_new_enum(kind, ICAL_ACTION_X,str);
292 break;
293 case ICAL_CLASS_VALUE:
294 value = icalvalue_new_enum(kind, ICAL_CLASS_X,str);
295 break;
296
297
298 case ICAL_INTEGER_VALUE:
299 {
300 value = icalvalue_new_integer(atoi(str));
301 break;
302 }
303
304 case ICAL_FLOAT_VALUE:
305 {
306 value = icalvalue_new_float((float )atof(str));
307 break;
308 }
309
310 case ICAL_UTCOFFSET_VALUE:
311 {
312 value = icalparser_parse_value(kind,str,(icalcomponent*)0);
313 break;
314 }
315
316 case ICAL_TEXT_VALUE:
317 {
318 char* dequoted_str = icalmemory_strdup_and_dequote(str);
319 value = icalvalue_new_text(dequoted_str);
320 free(dequoted_str);
321 break;
322 }
323
324
325 case ICAL_STRING_VALUE:
326 {
327 value = icalvalue_new_string(str);
328 break;
329 }
330
331 case ICAL_CALADDRESS_VALUE:
332 {
333 value = icalvalue_new_caladdress(str);
334 break;
335 }
336
337 case ICAL_URI_VALUE:
338 {
339 value = icalvalue_new_uri(str);
340 break;
341 }
342
343
344 case ICAL_GEO_VALUE:
345 {
346 value = 0;
347 /* HACK */
348
349 if (error != 0){
350 char temp[TMP_BUF_SIZE];
351 sprintf(temp,"GEO Values are not implemented");
352 *error = icalproperty_vanew_xlicerror(
353 temp,
354 icalparameter_new_xlicerrortype(
355 ICAL_XLICERRORTYPE_VALUEPARSEERROR),
356 0);
357 }
358
359 /*icalerror_warn("Parsing GEO properties is unimplmeneted");*/
360
361 break;
362 }
363
364 case ICAL_RECUR_VALUE:
365 {
366 struct icalrecurrencetype rt;
367 rt = icalrecurrencetype_from_string(str);
368 if(rt.freq != ICAL_NO_RECURRENCE){
369 value = icalvalue_new_recur(rt);
370 }
371 break;
372 }
373
374 case ICAL_DATE_VALUE:
375 case ICAL_DATETIME_VALUE:
376 {
377 struct icaltimetype tt;
378
379 tt = icaltime_from_string(str);
380 if(!icaltime_is_null_time(tt)){
381 value = icalvalue_new_impl(kind);
382 value->data.v_time = tt;
383
384 icalvalue_reset_kind(value);
385 }
386 break;
387 }
388
389 case ICAL_DATETIMEPERIOD_VALUE:
390 {
391 struct icaltimetype tt;
392 struct icalperiodtype p;
393 tt = icaltime_from_string(str);
394 p = icalperiodtype_from_string(str);
395
396 if(!icaltime_is_null_time(tt)){
397 value = icalvalue_new_datetime(tt);
398 } else if (!icalperiodtype_is_null_period(p)){
399 value = icalvalue_new_period(p);
400 }
401
402 break;
403 }
404
405 case ICAL_DURATION_VALUE:
406 {
407 struct icaldurationtype dur = icaldurationtype_from_string(str);
408
409 if(icaldurationtype_is_null_duration(dur)){
410 value = 0;
411 } else {
412 value = icalvalue_new_duration(dur);
413 }
414
415 break;
416 }
417
418 case ICAL_PERIOD_VALUE:
419 {
420 struct icalperiodtype p;
421 p = icalperiodtype_from_string(str);
422
423 if(!icalperiodtype_is_null_period(p)){
424 value = icalvalue_new_period(p);
425 }
426 break;
427 }
428
429 case ICAL_TRIGGER_VALUE:
430 {
431 struct icaltriggertype tr = icaltriggertype_from_string(str);
432 if (!icaltriggertype_is_null_trigger(tr)){
433 value = icalvalue_new_trigger(tr);
434 }
435 break;
436 }
437
438 case ICAL_REQUESTSTATUS_VALUE:
439 {
440 struct icalreqstattype rst = icalreqstattype_from_string(str);
441 if(rst.code != ICAL_UNKNOWN_STATUS){
442 value = icalvalue_new_requeststatus(rst);
443 }
444 break;
445
446 }
447 default:
448 {
449
450 if (error != 0 ){
451 char temp[TMP_BUF_SIZE];
452
453 snprintf(temp,TMP_BUF_SIZE,"Unknown type for \'%s\'",str);
454
455 *error = icalproperty_vanew_xlicerror(
456 temp,
457 icalparameter_new_xlicerrortype(
458 ICAL_XLICERRORTYPE_VALUEPARSEERROR),
459 0);
460 }
461
462 icalerror_warn("icalvalue_new_from_string got an unknown value type");
463 value=0;
464 }
465 }
466
467
468 if (error != 0 && *error == 0 && value == 0){
469 char temp[TMP_BUF_SIZE];
470
471 snprintf(temp,TMP_BUF_SIZE,"Failed to parse value: \'%s\'",str);
472
473 *error = icalproperty_vanew_xlicerror(
474 temp,
475 icalparameter_new_xlicerrortype(
476 ICAL_XLICERRORTYPE_VALUEPARSEERROR),
477 0);
478 }
479
480
481 return value;
482
483}
484
485icalvalue* icalvalue_new_from_string(icalvalue_kind kind,const char* str)
486{
487 return icalvalue_new_from_string_with_error(kind,str,(icalproperty*)0);
488}
489
490
491
492void
493icalvalue_free (icalvalue* value)
494{
495 struct icalvalue_impl* v = (struct icalvalue_impl*)value;
496
497 icalerror_check_arg_rv((value != 0),"value");
498
499#ifdef ICAL_FREE_ON_LIST_IS_ERROR
500 icalerror_assert( (v->parent ==0),"This value is still attached to a property");
501
502#else
503 if(v->parent !=0){
504 return;
505 }
506#endif
507
508 if(v->x_value != 0){
509 free(v->x_value);
510 }
511
512 switch (v->kind){
513 case ICAL_ATTACH_VALUE:
514 icalattachtype_free( v->data.v_attach );
515 break;
516 case ICAL_BINARY_VALUE: {
517 /* HACK ugh. This will be tough to implement */
518 }
519 case ICAL_TEXT_VALUE:
520 case ICAL_CALADDRESS_VALUE:
521 case ICAL_URI_VALUE:
522 {
523 if (v->data.v_string != 0) {
524 free((void*)v->data.v_string);
525 v->data.v_string = 0;
526 }
527 break;
528 }
529 case ICAL_RECUR_VALUE:
530 {
531 if(v->data.v_recur != 0){
532 free((void*)v->data.v_recur);
533 v->data.v_recur = 0;
534 }
535 break;
536 }
537
538 default:
539 {
540 /* Nothing to do */
541 }
542 }
543
544 v->kind = ICAL_NO_VALUE;
545 v->size = 0;
546 v->parent = 0;
547 memset(&(v->data),0,sizeof(v->data));
548 v->id[0] = 'X';
549 free(v);
550}
551
552int
553icalvalue_is_valid (icalvalue* value)
554{
555 /*struct icalvalue_impl* v = (struct icalvalue_impl*)value;*/
556
557 if(value == 0){
558 return 0;
559 }
560
561 return 1;
562}
563
564char* icalvalue_binary_as_ical_string(icalvalue* value) {
565
566 const char* data;
567 char* str;
568 icalerror_check_arg_rz( (value!=0),"value");
569
570 data = icalvalue_get_binary(value);
571
572 str = (char*)icalmemory_tmp_buffer(60);
573 sprintf(str,"icalvalue_binary_as_ical_string is not implemented yet");
574
575 return str;
576}
577
578#ifndef _WIN32
579#define MAX_INT_DIGITS 12 /* Enough for 2^32 + sign*/
580char* icalvalue_int_as_ical_string(icalvalue* value) {
581
582 int data;
583 char* str = (char*)icalmemory_tmp_buffer(MAX_INT_DIGITS);
584
585 icalerror_check_arg_rz( (value!=0),"value");
586
587 data = icalvalue_get_integer(value);
588
589 snprintf(str,MAX_INT_DIGITS,"%d",data);
590
591 return str;
592}
593#else
594// snprintf not working on wintendo
595
596#define MAX_INT_DIGITS 32 /* Enough for 2^32 + sign*/
597char* icalvalue_int_as_ical_string(icalvalue* value) {
598
599 int data;
600 char* str = (char*)icalmemory_tmp_buffer(MAX_INT_DIGITS);
601
602 icalerror_check_arg_rz( (value!=0),"value");
603
604 data = icalvalue_get_integer(value);
605
606 sprintf(str,"%d",data);
607
608 return str;
609}
610
611#endif
612char* icalvalue_utcoffset_as_ical_string(icalvalue* value)
613{
614 int data,h,m,s;
615 char sign;
616 char* str = (char*)icalmemory_tmp_buffer(9);
617
618 icalerror_check_arg_rz( (value!=0),"value");
619
620 data = icalvalue_get_utcoffset(value);
621
622 if (abs(data) == data){
623 sign = '+';
624 } else {
625 sign = '-';
626 }
627
628 h = data/3600;
629 m = (data - (h*3600))/ 60;
630 s = (data - (h*3600) - (m*60));
631
632 sprintf(str,"%c%02d%02d%02d",sign,abs(h),abs(m),abs(s));
633
634 return str;
635}
636
637char* icalvalue_string_as_ical_string(icalvalue* value) {
638
639 const char* data;
640 char* str = 0;
641 icalerror_check_arg_rz( (value!=0),"value");
642
643 data = ((struct icalvalue_impl*)value)->data.v_string;
644
645 str = (char*)icalmemory_tmp_buffer(strlen(data)+1);
646
647 strcpy(str,data);
648
649 return str;
650}
651
652
653char* icalvalue_recur_as_ical_string(icalvalue* value)
654{
655 struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
656 struct icalrecurrencetype *recur = impl->data.v_recur;
657
658 return icalrecurrencetype_as_string(recur);
659}
660
661char* icalvalue_text_as_ical_string(icalvalue* value) {
662
663 char *str;
664 char *str_p;
665 char *rtrn;
666 const char *p;
667 size_t buf_sz;
668 int line_length;
669
670 line_length = 0;
671
672 buf_sz = strlen(((struct icalvalue_impl*)value)->data.v_string)+1;
673
674 str_p = str = (char*)icalmemory_new_buffer(buf_sz);
675
676 if (str_p == 0){
677 return 0;
678 }
679
680 for(p=((struct icalvalue_impl*)value)->data.v_string; *p!=0; p++){
681
682 switch(*p){
683 case '\n': {
684 icalmemory_append_string(&str,&str_p,&buf_sz,"\\n");
685 line_length+=3;
686 break;
687 }
688
689 case '\t': {
690 icalmemory_append_string(&str,&str_p,&buf_sz,"\\t");
691 line_length+=3;
692 break;
693 }
694 case '\r': {
695 icalmemory_append_string(&str,&str_p,&buf_sz,"\\r");
696 line_length+=3;
697 break;
698 }
699 case '\b': {
700 icalmemory_append_string(&str,&str_p,&buf_sz,"\\b");
701 line_length+=3;
702 break;
703 }
704 case '\f': {
705 icalmemory_append_string(&str,&str_p,&buf_sz,"\\f");
706 line_length+=3;
707 break;
708 }
709
710 case ';':
711 case ',':{
712 icalmemory_append_char(&str,&str_p,&buf_sz,'\\');
713 icalmemory_append_char(&str,&str_p,&buf_sz,*p);
714 line_length+=3;
715 break;
716 }
717
718 default: {
719 icalmemory_append_char(&str,&str_p,&buf_sz,*p);
720 line_length++;
721 }
722 }
723
724 if (line_length > 65 && *p == ' '){
725 icalmemory_append_string(&str,&str_p,&buf_sz,"\n ");
726 line_length=0;
727 }
728
729
730 if (line_length > 75){
731 icalmemory_append_string(&str,&str_p,&buf_sz,"\n ");
732 line_length=0;
733 }
734
735 }
736
737 /* Assume the last character is not a '\0' and add one. We could
738 check *str_p != 0, but that would be an uninitialized memory
739 read. */
740
741
742 icalmemory_append_char(&str,&str_p,&buf_sz,'\0');
743
744 rtrn = icalmemory_tmp_copy(str);
745
746 icalmemory_free_buffer(str);
747
748 return rtrn;
749}
750
751
752char* icalvalue_attach_as_ical_string(icalvalue* value) {
753
754 struct icalattachtype *a;
755 char * str;
756
757 icalerror_check_arg_rz( (value!=0),"value");
758
759 a = icalvalue_get_attach(value);
760
761 if (a->binary != 0) {
762 return icalvalue_binary_as_ical_string(value);
763 } else if (a->base64 != 0) {
764 str = (char*)icalmemory_tmp_buffer(strlen(a->base64)+1);
765 strcpy(str,a->base64);
766 return str;
767 } else if (a->url != 0){
768 icalvalue *v = icalvalue_new_text( a->url );
769 char *icalstring = icalvalue_string_as_ical_string(v);
770 icalvalue_free( v );
771 return icalstring;
772 } else {
773 icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
774 return 0;
775 }
776}
777
778
779char* icalvalue_duration_as_ical_string(icalvalue* value) {
780
781 struct icaldurationtype data;
782
783 icalerror_check_arg_rz( (value!=0),"value");
784 data = icalvalue_get_duration(value);
785
786 return icaldurationtype_as_ical_string(data);
787}
788
789void print_time_to_string(char* str, struct icaltimetype *data)
790{
791 char temp[20];
792
793 if (data->is_utc == 1){
794 sprintf(temp,"%02d%02d%02dZ",data->hour,data->minute,data->second);
795 } else {
796 sprintf(temp,"%02d%02d%02d",data->hour,data->minute,data->second);
797 }
798
799 strcat(str,temp);
800}
801
802
803void print_date_to_string(char* str, struct icaltimetype *data)
804{
805 char temp[20];
806
807 sprintf(temp,"%04d%02d%02d",data->year,data->month,data->day);
808
809 strcat(str,temp);
810}
811
812char* icalvalue_date_as_ical_string(icalvalue* value) {
813
814 struct icaltimetype data;
815 char* str;
816 icalerror_check_arg_rz( (value!=0),"value");
817 data = icalvalue_get_date(value);
818
819 str = (char*)icalmemory_tmp_buffer(9);
820
821 str[0] = 0;
822 print_date_to_string(str,&data);
823
824 return str;
825}
826
827void print_datetime_to_string(char* str, struct icaltimetype *data)
828{
829 print_date_to_string(str,data);
830 strcat(str,"T");
831 print_time_to_string(str,data);
832
833}
834
835const char* icalvalue_datetime_as_ical_string(icalvalue* value) {
836
837 struct icaltimetype data;
838 char* str;
839 icalvalue_kind kind = icalvalue_isa(value);
840
841 icalerror_check_arg_rz( (value!=0),"value");
842
843
844 if( !(kind == ICAL_DATE_VALUE || kind == ICAL_DATETIME_VALUE ))
845 {
846 icalerror_set_errno(ICAL_BADARG_ERROR);
847 return 0;
848 }
849
850 data = icalvalue_get_datetime(value);
851
852 str = (char*)icalmemory_tmp_buffer(20);
853
854 str[0] = 0;
855
856 print_datetime_to_string(str,&data);
857
858 return str;
859
860}
861
862char* icalvalue_float_as_ical_string(icalvalue* value) {
863
864 float data;
865 char* str;
866 icalerror_check_arg_rz( (value!=0),"value");
867 data = icalvalue_get_float(value);
868
869 str = (char*)icalmemory_tmp_buffer(15);
870
871 sprintf(str,"%f",data);
872
873 return str;
874}
875
876char* icalvalue_geo_as_ical_string(icalvalue* value) {
877
878 struct icalgeotype data;
879 char* str;
880 icalerror_check_arg_rz( (value!=0),"value");
881
882 data = icalvalue_get_geo(value);
883
884 str = (char*)icalmemory_tmp_buffer(25);
885
886 sprintf(str,"%f;%f",data.lat,data.lon);
887
888 return str;
889}
890
891const char* icalvalue_datetimeperiod_as_ical_string(icalvalue* value) {
892 struct icaldatetimeperiodtype dtp = icalvalue_get_datetimeperiod(value);
893
894 icalerror_check_arg_rz( (value!=0),"value");
895
896 if(!icaltime_is_null_time(dtp.time)){
897 return icaltime_as_ical_string(dtp.time);
898 } else {
899 return icalperiodtype_as_ical_string(dtp.period);
900 }
901}
902
903const char* icalvalue_period_as_ical_string(icalvalue* value) {
904 struct icalperiodtype data;
905 icalerror_check_arg_rz( (value!=0),"value");
906 data = icalvalue_get_period(value);
907
908 return icalperiodtype_as_ical_string(data);
909
910}
911
912char* icalvalue_trigger_as_ical_string(icalvalue* value) {
913
914 struct icaltriggertype data;
915
916 icalerror_check_arg_rz( (value!=0),"value");
917 data = icalvalue_get_trigger(value);
918
919 if(!icaltime_is_null_time(data.time)){
920 return icaltime_as_ical_string(data.time);
921 } else {
922 return icaldurationtype_as_ical_string(data.duration);
923 }
924
925}
926
927const char*
928icalvalue_as_ical_string (icalvalue* value)
929{
930 struct icalvalue_impl* v = (struct icalvalue_impl*)value;
931
932 v=v;
933
934 if(value == 0){
935 return 0;
936 }
937
938 switch (v->kind){
939
940 case ICAL_ATTACH_VALUE:
941 return icalvalue_attach_as_ical_string(value);
942
943 case ICAL_BINARY_VALUE:
944 return icalvalue_binary_as_ical_string(value);
945
946 case ICAL_BOOLEAN_VALUE:
947 case ICAL_INTEGER_VALUE:
948 return icalvalue_int_as_ical_string(value);
949
950 case ICAL_UTCOFFSET_VALUE:
951 return icalvalue_utcoffset_as_ical_string(value);
952
953 case ICAL_TEXT_VALUE:
954 return icalvalue_text_as_ical_string(value);
955
956 case ICAL_STRING_VALUE:
957 case ICAL_URI_VALUE:
958 case ICAL_CALADDRESS_VALUE:
959 return icalvalue_string_as_ical_string(value);
960
961 case ICAL_DATE_VALUE:
962 return icalvalue_date_as_ical_string(value);
963 case ICAL_DATETIME_VALUE:
964 return icalvalue_datetime_as_ical_string(value);
965 case ICAL_DURATION_VALUE:
966 return icalvalue_duration_as_ical_string(value);
967
968 case ICAL_PERIOD_VALUE:
969 return icalvalue_period_as_ical_string(value);
970 case ICAL_DATETIMEPERIOD_VALUE:
971 return icalvalue_datetimeperiod_as_ical_string(value);
972
973 case ICAL_FLOAT_VALUE:
974 return icalvalue_float_as_ical_string(value);
975
976 case ICAL_GEO_VALUE:
977 return icalvalue_geo_as_ical_string(value);
978
979 case ICAL_RECUR_VALUE:
980 return icalvalue_recur_as_ical_string(value);
981
982 case ICAL_TRIGGER_VALUE:
983 return icalvalue_trigger_as_ical_string(value);
984
985 case ICAL_REQUESTSTATUS_VALUE:
986 return icalreqstattype_as_string(v->data.v_requeststatus);
987
988 case ICAL_ACTION_VALUE:
989 case ICAL_METHOD_VALUE:
990 case ICAL_STATUS_VALUE:
991 case ICAL_TRANSP_VALUE:
992 case ICAL_CLASS_VALUE:
993 if(v->x_value !=0){
994 return icalmemory_tmp_copy(v->x_value);
995 }
996
997 return icalproperty_enum_to_string(v->data.v_enum);
998
999 case ICAL_X_VALUE:
1000 return icalmemory_tmp_copy(v->x_value);
1001
1002 case ICAL_NO_VALUE:
1003 default:
1004 {
1005 return 0;
1006 }
1007 }
1008}
1009
1010
1011icalvalue_kind
1012icalvalue_isa (icalvalue* value)
1013{
1014 struct icalvalue_impl* v = (struct icalvalue_impl*)value;
1015
1016 if(value == 0){
1017 return ICAL_NO_VALUE;
1018 }
1019
1020 return v->kind;
1021}
1022
1023
1024int
1025icalvalue_isa_value (void* value)
1026{
1027 struct icalvalue_impl *impl = (struct icalvalue_impl *)value;
1028
1029 icalerror_check_arg_rz( (value!=0), "value");
1030
1031 if (strcmp(impl->id,"val") == 0) {
1032 return 1;
1033 } else {
1034 return 0;
1035 }
1036}
1037
1038
1039int icalvalue_is_time(icalvalue* a) {
1040 icalvalue_kind kind = icalvalue_isa(a);
1041
1042 if(kind == ICAL_DATETIME_VALUE ||
1043 kind == ICAL_DATE_VALUE ){
1044 return 1;
1045 }
1046
1047 return 0;
1048
1049}
1050
1051icalparameter_xliccomparetype
1052icalvalue_compare(icalvalue* a, icalvalue *b)
1053{
1054 struct icalvalue_impl *impla = (struct icalvalue_impl *)a;
1055 struct icalvalue_impl *implb = (struct icalvalue_impl *)b;
1056
1057 icalerror_check_arg_rz( (a!=0), "a");
1058 icalerror_check_arg_rz( (b!=0), "b");
1059
1060 /* Not the same type; they can only be unequal */
1061 if( ! (icalvalue_is_time(a) && icalvalue_is_time(b)) &&
1062 icalvalue_isa(a) != icalvalue_isa(b)){
1063 return ICAL_XLICCOMPARETYPE_NOTEQUAL;
1064 }
1065
1066 switch (icalvalue_isa(a)){
1067
1068 case ICAL_ATTACH_VALUE:
1069 case ICAL_BINARY_VALUE:
1070
1071 case ICAL_BOOLEAN_VALUE:
1072 {
1073 if (icalvalue_get_boolean(a) == icalvalue_get_boolean(b)){
1074 return ICAL_XLICCOMPARETYPE_EQUAL;
1075 } else {
1076 return ICAL_XLICCOMPARETYPE_NOTEQUAL;
1077 }
1078 }
1079
1080 case ICAL_FLOAT_VALUE:
1081 {
1082 if (impla->data.v_float > implb->data.v_float){
1083 return ICAL_XLICCOMPARETYPE_GREATER;
1084 } else if (impla->data.v_float < implb->data.v_float){
1085 return ICAL_XLICCOMPARETYPE_LESS;
1086 } else {
1087 return ICAL_XLICCOMPARETYPE_EQUAL;
1088 }
1089 }
1090
1091 case ICAL_INTEGER_VALUE:
1092 case ICAL_UTCOFFSET_VALUE:
1093 {
1094 if (impla->data.v_int > implb->data.v_int){
1095 return ICAL_XLICCOMPARETYPE_GREATER;
1096 } else if (impla->data.v_int < implb->data.v_int){
1097 return ICAL_XLICCOMPARETYPE_LESS;
1098 } else {
1099 return ICAL_XLICCOMPARETYPE_EQUAL;
1100 }
1101 }
1102
1103 case ICAL_DURATION_VALUE:
1104 {
1105 int a = icaldurationtype_as_int(impla->data.v_duration);
1106 int b = icaldurationtype_as_int(implb->data.v_duration);
1107
1108 if (a > b){
1109 return ICAL_XLICCOMPARETYPE_GREATER;
1110 } else if (a < b){
1111 return ICAL_XLICCOMPARETYPE_LESS;
1112 } else {
1113 return ICAL_XLICCOMPARETYPE_EQUAL;
1114 }
1115 }
1116
1117
1118 case ICAL_TEXT_VALUE:
1119 case ICAL_URI_VALUE:
1120 case ICAL_CALADDRESS_VALUE:
1121 case ICAL_TRIGGER_VALUE:
1122 case ICAL_DATE_VALUE:
1123 case ICAL_DATETIME_VALUE:
1124 case ICAL_DATETIMEPERIOD_VALUE:
1125 {
1126 int r;
1127
1128 r = strcmp(icalvalue_as_ical_string(a),
1129 icalvalue_as_ical_string(b));
1130
1131 if (r > 0) {
1132 return ICAL_XLICCOMPARETYPE_GREATER;
1133 } else if (r < 0){
1134 return ICAL_XLICCOMPARETYPE_LESS;
1135 } else {
1136 return ICAL_XLICCOMPARETYPE_EQUAL;
1137 }
1138
1139
1140 }
1141
1142 case ICAL_METHOD_VALUE:
1143 {
1144 if (icalvalue_get_method(a) == icalvalue_get_method(b)){
1145 return ICAL_XLICCOMPARETYPE_EQUAL;
1146 } else {
1147 return ICAL_XLICCOMPARETYPE_NOTEQUAL;
1148 }
1149
1150 }
1151
1152 case ICAL_STATUS_VALUE:
1153 {
1154 if (icalvalue_get_status(a) == icalvalue_get_status(b)){
1155 return ICAL_XLICCOMPARETYPE_EQUAL;
1156 } else {
1157 return ICAL_XLICCOMPARETYPE_NOTEQUAL;
1158 }
1159
1160 }
1161
1162 case ICAL_PERIOD_VALUE:
1163 case ICAL_GEO_VALUE:
1164 case ICAL_RECUR_VALUE:
1165 case ICAL_NO_VALUE:
1166 default:
1167 {
1168 icalerror_warn("Comparison not implemented for value type");
1169 return ICAL_XLICCOMPARETYPE_REGEX+1; /* HACK */
1170 }
1171 }
1172
1173}
1174
1175/* Examine the value and possiby chage the kind to agree with the value */
1176void icalvalue_reset_kind(icalvalue* value)
1177{
1178 struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
1179
1180 if( (impl->kind==ICAL_DATETIME_VALUE || impl->kind==ICAL_DATE_VALUE )&&
1181 !icaltime_is_null_time(impl->data.v_time) ) {
1182
1183 if( impl->data.v_time.is_date == 1){
1184 impl->kind = ICAL_DATE_VALUE;
1185 } else {
1186 impl->kind = ICAL_DATETIME_VALUE;
1187 }
1188 }
1189
1190}
1191
1192void icalvalue_set_parent(icalvalue* value,
1193 icalproperty* property)
1194{
1195 struct icalvalue_impl* v = (struct icalvalue_impl*)value;
1196
1197 v->parent = property;
1198
1199}
1200
1201icalproperty* icalvalue_get_parent(icalvalue* value)
1202{
1203 struct icalvalue_impl* v = (struct icalvalue_impl*)value;
1204
1205
1206 return v->parent;
1207}
1208
1209
1210
1211/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
1212 types */
1213
1214
1215/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalvalue.h b/libical/src/libical/icalvalue.h
new file mode 100644
index 0000000..6983c23
--- a/dev/null
+++ b/libical/src/libical/icalvalue.h
@@ -0,0 +1,85 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalvalue.h
4 CREATOR: eric 20 March 1999
5
6
7 $Id$
8 $Locker$
9
10
11
12 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of either:
16
17 The LGPL as published by the Free Software Foundation, version
18 2.1, available at: http://www.fsf.org/copyleft/lesser.html
19
20 Or:
21
22 The Mozilla Public License Version 1.0. You may obtain a copy of
23 the License at http://www.mozilla.org/MPL/
24
25 The original code is icalvalue.h
26
27 ======================================================================*/
28
29#ifndef ICALVALUE_H
30#define ICALVALUE_H
31
32#include <time.h>
33#include "icalenums.h"
34#include "icaltypes.h"
35#include "icalrecur.h"
36#include "icalduration.h"
37#include "icalperiod.h"
38#include "icalderivedproperty.h" /* For icalproperty_method, etc. */
39#include "icalderivedparameter.h"
40#include "icalderivedvalue.h"
41
42/* Defined in icalderivedvalue.h */
43/*typedef void icalvalue;*/
44
45icalvalue* icalvalue_new(icalvalue_kind kind);
46
47icalvalue* icalvalue_new_clone(icalvalue* value);
48
49icalvalue* icalvalue_new_from_string(icalvalue_kind kind, const char* str);
50
51void icalvalue_free(icalvalue* value);
52
53int icalvalue_is_valid(icalvalue* value);
54
55const char* icalvalue_as_ical_string(icalvalue* value);
56
57icalvalue_kind icalvalue_isa(icalvalue* value);
58
59int icalvalue_isa_value(void*);
60
61icalparameter_xliccomparetype icalvalue_compare(icalvalue* a, icalvalue *b);
62
63
64/* Special, non autogenerated value accessors */
65
66icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
67void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
68struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
69
70icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
71void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
72struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
73
74icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
75void icalvalue_set_datetimeperiod(icalvalue* value,
76 struct icaldatetimeperiodtype v);
77struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
78
79/* Convert enumerations */
80
81icalvalue_kind icalvalue_string_to_kind(const char* str);
82const char* icalvalue_kind_to_string(icalvalue_kind kind);
83
84
85#endif /*ICALVALUE_H*/
diff --git a/libical/src/libical/icalvalueimpl.h b/libical/src/libical/icalvalueimpl.h
new file mode 100644
index 0000000..116535d
--- a/dev/null
+++ b/libical/src/libical/icalvalueimpl.h
@@ -0,0 +1,93 @@
1/* -*- Mode: C -*- */
2/*======================================================================
3 FILE: icalvalue.c
4 CREATOR: eric 02 May 1999
5
6 $Id$
7
8
9 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
10
11 This program is free software; you can redistribute it and/or modify
12 it under the terms of either:
13
14 The LGPL as published by the Free Software Foundation, version
15 2.1, available at: http://www.fsf.org/copyleft/lesser.html
16
17 Or:
18
19 The Mozilla Public License Version 1.0. You may obtain a copy of
20 the License at http://www.mozilla.org/MPL/
21
22 The original code is icalvalue.c
23
24 Contributions from:
25 Graham Davison (g.m.davison@computer.org)
26
27
28======================================================================*/
29
30#ifdef HAVE_CONFIG_H
31#include <config.h>
32#endif
33
34#ifndef ICALVALUEIMPL_H
35#define ICALVALUEIMPL_H
36
37#include "icalenums.h"
38
39
40struct icalvalue_impl {
41 icalvalue_kind kind; /*this is the kind that is visible from the outside*/
42
43 char id[5];
44 int size;
45 icalproperty* parent;
46 const char* x_value;
47
48 union data {
49 struct icalattachtype *v_attach;
50 /* void *v_binary; */ /* use v_attach */
51 const char *v_string;
52 /*char *v_text;*/
53 /*char *v_caladdress;*/
54 /*char *v_uri;*/
55 float v_float;
56 int v_int;
57 /*int v_boolean;*/
58 /*int v_integer;*/
59 struct icaldurationtype v_duration;
60 /*int v_utcoffset;*/
61
62 struct icalperiodtype v_period;
63 /*struct icalperiodtype v_datetimeperiod;*/
64 struct icalgeotype v_geo;
65 /*time_t v_time;*/
66 struct icaltimetype v_time;
67 /*struct icaltimetype v_date;*/
68 /*struct icaltimetype v_datetime;*/
69 /*struct icaltimetype v_datetimedate;*/
70
71 struct icalreqstattype v_requeststatus;
72
73 /* struct icalrecurrencetype was once included
74 directly ( not referenced ) in this union, but it
75 contributes 2000 bytes to every value, so now it is
76 a reference*/
77
78 struct icalrecurrencetype *v_recur;
79 struct icaltriggertype v_trigger;
80
81 int v_enum;
82 /* v_enum takes care of several enumerated types including:
83 icalproperty_method v_method;
84 icalproperty_status v_status;
85 icalproperty_action v_action;
86 icalproperty_class v_class;
87 icalproperty_transp v_transp;
88 */
89
90 } data;
91};
92
93#endif
diff --git a/libical/src/libical/icalversion.h b/libical/src/libical/icalversion.h
new file mode 100644
index 0000000..beae8e0
--- a/dev/null
+++ b/libical/src/libical/icalversion.h
@@ -0,0 +1,7 @@
1#ifndef ICAL_VERSION_H
2#define ICAL_VERSION_H
3
4#define ICAL_PACKAGE "libical"
5#define ICAL_VERSION "0.23"
6
7#endif
diff --git a/libical/src/libical/icalversion.h.in b/libical/src/libical/icalversion.h.in
new file mode 100644
index 0000000..5d21369
--- a/dev/null
+++ b/libical/src/libical/icalversion.h.in
@@ -0,0 +1,7 @@
1#ifndef ICAL_VERSION_H
2#define ICAL_VERSION_H
3
4#define ICAL_PACKAGE "@PACKAGE@"
5#define ICAL_VERSION "@VERSION@"
6
7#endif
diff --git a/libical/src/libical/icalyacc.c b/libical/src/libical/icalyacc.c
new file mode 100644
index 0000000..d0b9a10
--- a/dev/null
+++ b/libical/src/libical/icalyacc.c
@@ -0,0 +1,1447 @@
1
2/* A Bison parser, made from ../../../../libical/src/libical/icalyacc.y
3 by GNU Bison version 1.28 */
4
5#define YYBISON 1 /* Identify Bison output. */
6
7#define yyparse ical_yyparse
8#define yylex ical_yylex
9#define yyerror ical_yyerror
10#define yylval ical_yylval
11#define yychar ical_yychar
12#define yydebug ical_yydebug
13#define yynerrs ical_yynerrs
14 #define DIGITS257
15 #define INTNUMBER258
16 #define FLOATNUMBER259
17 #define STRING260
18 #define EOL261
19 #define EQUALS262
20 #define CHARACTER263
21 #define COLON264
22 #define COMMA265
23 #define SEMICOLON266
24 #define MINUS267
25 #define TIMESEPERATOR268
26 #define TRUE269
27 #define FALSE270
28 #define FREQ271
29 #define BYDAY272
30 #define BYHOUR273
31 #define BYMINUTE274
32 #define BYMONTH275
33 #define BYMONTHDAY276
34 #define BYSECOND277
35 #define BYSETPOS278
36 #define BYWEEKNO279
37 #define BYYEARDAY280
38 #define DAILY281
39 #define MINUTELY282
40 #define MONTHLY283
41 #define SECONDLY284
42 #define WEEKLY285
43 #define HOURLY286
44 #define YEARLY287
45 #define INTERVAL288
46 #define COUNT289
47 #define UNTIL290
48 #define WKST291
49 #define MO292
50 #define SA293
51 #define SU294
52 #define TU295
53 #define WE296
54 #define TH297
55 #define FR298
56 #define BIT8299
57 #define ACCEPTED300
58 #define ADD301
59 #define AUDIO302
60 #define BASE64303
61 #define BINARY304
62 #define BOOLEAN305
63 #define BUSY306
64 #define BUSYTENTATIVE307
65 #define BUSYUNAVAILABLE308
66 #define CALADDRESS309
67 #define CANCEL310
68 #define CANCELLED311
69 #define CHAIR312
70 #define CHILD313
71 #define COMPLETED314
72 #define CONFIDENTIAL315
73 #define CONFIRMED316
74 #define COUNTER317
75 #define DATE318
76 #define DATETIME319
77 #define DECLINECOUNTER320
78 #define DECLINED321
79 #define DELEGATED322
80 #define DISPLAY323
81 #define DRAFT324
82 #define DURATION325
83 #define EMAIL326
84 #define END327
85 #define FINAL328
86 #define FLOAT329
87 #define FREE330
88 #define GREGORIAN331
89 #define GROUP332
90 #define INDIVIDUAL333
91 #define INPROCESS334
92 #define INTEGER335
93 #define NEEDSACTION336
94 #define NONPARTICIPANT337
95 #define OPAQUE338
96 #define OPTPARTICIPANT339
97 #define PARENT340
98 #define PERIOD341
99 #define PRIVATE342
100 #define PROCEDURE343
101 #define PUBLIC344
102 #define PUBLISH345
103 #define RECUR346
104 #define REFRESH347
105 #define REPLY348
106 #define REQPARTICIPANT349
107 #define REQUEST350
108 #define RESOURCE351
109 #define ROOM352
110 #define SIBLING353
111 #define START354
112 #define TENTATIVE355
113 #define TEXT356
114 #define THISANDFUTURE357
115 #define THISANDPRIOR358
116 #define TIME359
117 #define TRANSPAENT360
118 #define UNKNOWN361
119 #define UTCOFFSET362
120 #define XNAME363
121 #define ALTREP364
122 #define CN365
123 #define CUTYPE366
124 #define DAYLIGHT367
125 #define DIR368
126 #define ENCODING369
127 #define EVENT370
128 #define FBTYPE371
129 #define FMTTYPE372
130 #define LANGUAGE373
131 #define MEMBER374
132 #define PARTSTAT375
133 #define RANGE376
134 #define RELATED377
135 #define RELTYPE378
136 #define ROLE379
137 #define RSVP380
138 #define SENTBY381
139 #define STANDARD382
140 #define URI383
141 #define TIME_CHAR384
142 #define UTC_CHAR385
143
144#line 1 "../../../../libical/src/libical/icalyacc.y"
145
146/* -*- Mode: C -*-
147 ======================================================================
148 FILE: icalitip.y
149 CREATOR: eric 10 June 1999
150
151 DESCRIPTION:
152
153 $Id$
154 $Locker$
155
156 (C) COPYRIGHT 1999 Eric Busboom
157 http://www.softwarestudio.org
158
159 The contents of this file are subject to the Mozilla Public License
160 Version 1.0 (the "License"); you may not use this file except in
161 compliance with the License. You may obtain a copy of the License at
162 http://www.mozilla.org/MPL/
163
164 Software distributed under the License is distributed on an "AS IS"
165 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
166 the License for the specific language governing rights and
167 limitations under the License.
168
169 The original author is Eric Busboom
170 The original code is icalitip.y
171
172
173
174 =======================================================================*/
175
176#include <stdlib.h>
177#include <string.h> /* for strdup() */
178#include "icalparser.h"
179#include "pvl.h"
180
181icalvalue *icalparser_yy_value; /* Current Value */
182
183void ical_yyerror(char* s);
184void icalparser_clear_flex_input();
185int ical_yy_lex(void);
186
187/* Globals for UTCOFFSET values */
188int utc;
189int utc_b;
190int utcsign;
191
192/* Globals for DURATION values */
193struct icaldurationtype duration;
194
195/* Globals for TRIGGER values */
196struct icaltriggertype trigger;
197
198void copy_list(short* array, size_t size);
199void add_prop(icalproperty_kind);
200void icalparser_fill_date(struct tm* t, char* dstr);
201void icalparser_fill_time(struct tm* t, char* tstr);
202void set_value_type(icalvalue_kind kind);
203void set_parser_value_state();
204struct icaltimetype fill_datetime(char* d, char* t);
205void ical_yy_error(char *s); /* Don't know why I need this.... */
206int yylex(void); /* Or this. */
207
208
209
210/* Set the state of the lexer so it will interpret values ( iCAL
211 VALUEs, that is, ) correctly. */
212
213
214#line 71 "../../../../libical/src/libical/icalyacc.y"
215typedef union {
216 float v_float;
217 int v_int;
218 char* v_string;
219} YYSTYPE;
220#ifndef YYDEBUG
221#define YYDEBUG 1
222#endif
223
224#include <stdio.h>
225
226#ifndef __cplusplus
227#ifndef __STDC__
228#define const
229#endif
230#endif
231
232
233
234 #define YYFINAL 51
235 #define YYFLAG -32768
236 #define YYNTBASE141
237
238#define YYTRANSLATE(x) ((unsigned)(x) <= 385 ? yytranslate[x] : 158)
239
240static const short yytranslate[] = { 0,
241 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
242 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
243 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
244 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
245 2, 2, 137, 2, 138, 2, 140, 2, 2, 2,
246 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
247 2, 2, 2, 2, 2, 2, 2, 136, 2, 2,
248 2, 133, 2, 2, 2, 2, 134, 2, 2, 139,
249 2, 2, 135, 2, 2, 2, 132, 2, 2, 2,
250 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
251 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
252 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
253 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
254 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
255 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
256 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
257 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
258 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
259 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
260 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
261 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
262 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
263 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
264 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
265 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
266 2, 2, 2, 2, 2, 1, 3, 4, 5, 6,
267 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
268 17, 18, 19, 20, 21, 22, 23, 24, 25, 26,
269 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
270 37, 38, 39, 40, 41, 42, 43, 44, 45, 46,
271 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
272 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
273 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
274 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
275 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
276 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
277 107, 108, 109, 110, 111, 112, 113, 114, 115, 116,
278 117, 118, 119, 120, 121, 122, 123, 124, 125, 126,
279 127, 128, 129, 130, 131
280};
281
282#if YYDEBUG != 0
283static const short yyprhs[] = { 0,
284 0, 2, 4, 6, 8, 10, 12, 14, 15, 17,
285 18, 20, 25, 27, 30, 33, 36, 39, 42, 45,
286 49, 52, 56, 59, 62, 63, 65, 67, 71, 75,
287 79, 89, 96, 97, 99, 101, 105
288};
289
290static const short yyrhs[] = { 142,
291 0, 145, 0, 154, 0, 155, 0, 157, 0, 1,
292 0, 3, 0, 0, 131, 0, 0, 131, 0, 3,
293 130, 3, 143, 0, 152, 0, 152, 148, 0, 3,
294 132, 0, 130, 149, 0, 130, 150, 0, 130, 151,
295 0, 3, 133, 0, 3, 133, 150, 0, 3, 134,
296 0, 3, 134, 151, 0, 3, 135, 0, 3, 136,
297 0, 0, 137, 0, 138, 0, 153, 139, 146, 0,
298 153, 139, 148, 0, 153, 139, 147, 0, 3, 130,
299 3, 143, 140, 3, 130, 3, 144, 0, 3, 130,
300 3, 143, 140, 154, 0, 0, 137, 0, 138, 0,
301 156, 4, 4, 0, 156, 4, 4, 4, 0
302};
303
304#endif
305
306#if YYDEBUG != 0
307static const short yyrline[] = { 0,
308 177, 179, 180, 181, 182, 183, 190, 205, 207, 210,
309 212, 214, 230, 231, 233, 238, 241, 244, 248, 252,
310 257, 261, 266, 271, 276, 280, 284, 289, 294, 299,
311 308, 329, 358, 364, 365, 367, 373
312};
313#endif
314
315
316#if YYDEBUG != 0 || defined (YYERROR_VERBOSE)
317
318static const char * const yytname[] = { "$","error","$undefined.","DIGITS",
319"INTNUMBER","FLOATNUMBER","STRING","EOL","EQUALS","CHARACTER","COLON","COMMA",
320"SEMICOLON","MINUS","TIMESEPERATOR","TRUE","FALSE","FREQ","BYDAY","BYHOUR","BYMINUTE",
321"BYMONTH","BYMONTHDAY","BYSECOND","BYSETPOS","BYWEEKNO","BYYEARDAY","DAILY",
322"MINUTELY","MONTHLY","SECONDLY","WEEKLY","HOURLY","YEARLY","INTERVAL","COUNT",
323"UNTIL","WKST","MO","SA","SU","TU","WE","TH","FR","BIT8","ACCEPTED","ADD","AUDIO",
324"BASE64","BINARY","BOOLEAN","BUSY","BUSYTENTATIVE","BUSYUNAVAILABLE","CALADDRESS",
325"CANCEL","CANCELLED","CHAIR","CHILD","COMPLETED","CONFIDENTIAL","CONFIRMED",
326"COUNTER","DATE","DATETIME","DECLINECOUNTER","DECLINED","DELEGATED","DISPLAY",
327"DRAFT","DURATION","EMAIL","END","FINAL","FLOAT","FREE","GREGORIAN","GROUP",
328"INDIVIDUAL","INPROCESS","INTEGER","NEEDSACTION","NONPARTICIPANT","OPAQUE","OPTPARTICIPANT",
329"PARENT","PERIOD","PRIVATE","PROCEDURE","PUBLIC","PUBLISH","RECUR","REFRESH",
330"REPLY","REQPARTICIPANT","REQUEST","RESOURCE","ROOM","SIBLING","START","TENTATIVE",
331"TEXT","THISANDFUTURE","THISANDPRIOR","TIME","TRANSPAENT","UNKNOWN","UTCOFFSET",
332"XNAME","ALTREP","CN","CUTYPE","DAYLIGHT","DIR","ENCODING","EVENT","FBTYPE",
333"FMTTYPE","LANGUAGE","MEMBER","PARTSTAT","RANGE","RELATED","RELTYPE","ROLE",
334"RSVP","SENTBY","STANDARD","URI","TIME_CHAR","UTC_CHAR","'W'","'H'","'M'","'S'",
335"'D'","'+'","'-'","'P'","'/'","value","date_value","utc_char","utc_char_b","datetime_value",
336"dur_date","dur_week","dur_time","dur_hour","dur_minute","dur_second","dur_day",
337"dur_prefix","duration_value","period_value","plusminus","utcoffset_value", NULL
338};
339#endif
340
341static const short yyr1[] = { 0,
342 141, 141, 141, 141, 141, 141, 142, 143, 143, 144,
343 144, 145, 146, 146, 147, 148, 148, 148, 149, 149,
344 150, 150, 151, 152, 153, 153, 153, 154, 154, 154,
345 155, 155, -1, 156, 156, 157, 157
346};
347
348static const short yyr2[] = { 0,
349 1, 1, 1, 1, 1, 1, 1, 0, 1, 0,
350 1, 4, 1, 2, 2, 2, 2, 2, 2, 3,
351 2, 3, 2, 2, 0, 1, 1, 3, 3, 3,
352 9, 6, 0, 1, 1, 3, 4
353};
354
355static const short yydefact[] = { 0,
356 6, 7, 26, 27, 1, 2, 0, 3, 4, 0,
357 5, 0, 0, 0, 8, 0, 0, 28, 30, 29,
358 13, 36, 9, 12, 15, 24, 0, 16, 17, 18,
359 14, 37, 25, 19, 21, 23, 0, 26, 27, 32,
360 0, 20, 0, 22, 0, 10, 11, 31, 0, 0,
361 0
362};
363
364static const short yydefgoto[] = { 49,
365 5, 24, 48, 6, 18, 19, 20, 28, 29, 30,
366 21, 7, 8, 9, 10, 11
367};
368
369static const short yypact[] = { -1,
370-32768, -126, 7, 8,-32768,-32768, -133,-32768,-32768, 9,
371-32768, 11, -2, 12, -116, -129, 14,-32768,-32768,-32768,
372 -112, 15,-32768, -120,-32768,-32768, -125,-32768,-32768,-32768,
373-32768,-32768, 2, 18, 19,-32768, -107,-32768,-32768,-32768,
374 -110,-32768, -109,-32768, 22, -104,-32768,-32768, 28, 29,
375-32768
376};
377
378static const short yypgoto[] = {-32768,
379-32768,-32768,-32768,-32768,-32768,-32768, 10,-32768, -4, -3,
380-32768,-32768, 0,-32768,-32768,-32768
381};
382
383
384 #define YYLAST 140
385
386
387static const short yytable[] = { 1,
388 16, 2, 25, 12, 37, 13, 26, 34, 35, 36,
389 -34, -35, 14, 15, 23, 22, 27, 17, 32, 33,
390 41, 43, 45, 35, 46, 36, 47, 50, 51, 42,
391 31, 44, 40, 0, 0, 0, 0, 0, 0, 0,
392 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
393 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
394 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
395 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
396 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
397 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
398 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
399 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
400 0, 0, 0, 0, 0, 0, 0, 17, 0, 0,
401 0, 0, 0, 0, 0, 3, 4, -25, 38, 39
402};
403
404static const short yycheck[] = { 1,
405 3, 3, 132, 130, 3, 139, 136, 133, 134, 135,
406 4, 4, 4, 3, 131, 4, 3, 130, 4, 140,
407 3, 3, 130, 134, 3, 135, 131, 0, 0, 34,
408 21, 35, 33, -1, -1, -1, -1, -1, -1, -1,
409 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
410 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
411 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
412 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
413 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
414 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
415 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
416 -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
417 -1, -1, -1, -1, -1, -1, -1, 130, -1, -1,
418 -1, -1, -1, -1, -1, 137, 138, 139, 137, 138
419};
420/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
421#line 3 "/usr/share/bison.simple"
422/* This file comes from bison-1.28. */
423
424/* Skeleton output parser for bison,
425 Copyright (C) 1984, 1989, 1990 Free Software Foundation, Inc.
426
427 This program is free software; you can redistribute it and/or modify
428 it under the terms of the GNU General Public License as published by
429 the Free Software Foundation; either version 2, or (at your option)
430 any later version.
431
432 This program is distributed in the hope that it will be useful,
433 but WITHOUT ANY WARRANTY; without even the implied warranty of
434 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
435 GNU General Public License for more details.
436
437 You should have received a copy of the GNU General Public License
438 along with this program; if not, write to the Free Software
439 Foundation, Inc., 59 Temple Place - Suite 330,
440 Boston, MA 02111-1307, USA. */
441
442/* As a special exception, when this file is copied by Bison into a
443 Bison output file, you may use that output file without restriction.
444 This special exception was added by the Free Software Foundation
445 in version 1.24 of Bison. */
446
447/* This is the parser code that is written into each bison parser
448 when the %semantic_parser declaration is not specified in the grammar.
449 It was written by Richard Stallman by simplifying the hairy parser
450 used when %semantic_parser is specified. */
451
452#ifndef YYPARSE_RETURN_TYPE
453#define YYPARSE_RETURN_TYPE int
454#endif
455
456
457#ifndef YYSTACK_USE_ALLOCA
458#ifdef alloca
459#define YYSTACK_USE_ALLOCA
460#else /* alloca not defined */
461#ifdef __GNUC__
462#define YYSTACK_USE_ALLOCA
463#define alloca __builtin_alloca
464#else /* not GNU C. */
465#if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi) || (defined (__sun) && defined (__i386))
466#define YYSTACK_USE_ALLOCA
467#include <alloca.h>
468#else /* not sparc */
469/* We think this test detects Watcom and Microsoft C. */
470/* This used to test MSDOS, but that is a bad idea
471 since that symbol is in the user namespace. */
472#if (defined (_MSDOS) || defined (_MSDOS_)) && !defined (__TURBOC__)
473#if 0 /* No need for malloc.h, which pollutes the namespace;
474 instead, just don't use alloca. */
475#include <malloc.h>
476#endif
477#else /* not MSDOS, or __TURBOC__ */
478#if defined(_AIX)
479/* I don't know what this was needed for, but it pollutes the namespace.
480 So I turned it off. rms, 2 May 1997. */
481/* #include <malloc.h> */
482 #pragma alloca
483#define YYSTACK_USE_ALLOCA
484#else /* not MSDOS, or __TURBOC__, or _AIX */
485#if 0
486#ifdef __hpux /* haible@ilog.fr says this works for HPUX 9.05 and up,
487 and on HPUX 10. Eventually we can turn this on. */
488#define YYSTACK_USE_ALLOCA
489#define alloca __builtin_alloca
490#endif /* __hpux */
491#endif
492#endif /* not _AIX */
493#endif /* not MSDOS, or __TURBOC__ */
494#endif /* not sparc */
495#endif /* not GNU C */
496#endif /* alloca not defined */
497#endif /* YYSTACK_USE_ALLOCA not defined */
498
499#ifdef YYSTACK_USE_ALLOCA
500#define YYSTACK_ALLOC alloca
501#else
502#define YYSTACK_ALLOC malloc
503#endif
504
505/* Note: there must be only one dollar sign in this file.
506 It is replaced by the list of actions, each action
507 as one case of the switch. */
508
509 #define yyerrok (yyerrstatus = 0)
510 #define yyclearin(yychar = YYEMPTY)
511 #define YYEMPTY -2
512 #define YYEOF 0
513 #define YYACCEPTgoto yyacceptlab
514 #define YYABORT goto yyabortlab
515 #define YYERROR goto yyerrlab1
516/* Like YYERROR except do call yyerror.
517 This remains here temporarily to ease the
518 transition to the new meaning of YYERROR, for GCC.
519 Once GCC version 2 has supplanted version 1, this can go. */
520 #define YYFAIL goto yyerrlab
521#define YYRECOVERING() (!!yyerrstatus)
522#define YYBACKUP(token, value) \
523 do \
524 if (yychar == YYEMPTY && yylen == 1) \
525 { yychar = (token), yylval = (value); \
526 yychar1 = YYTRANSLATE (yychar); \
527 YYPOPSTACK; \
528 goto yybackup; \
529 } \
530 else \
531 { yyerror ("syntax error: cannot back up"); YYERROR; }\
532while (0)
533
534 #define YYTERROR1
535 #define YYERRCODE256
536
537#ifndef YYPURE
538 #define YYLEX yylex()
539#endif
540
541#ifdef YYPURE
542#ifdef YYLSP_NEEDED
543#ifdef YYLEX_PARAM
544 #define YYLEX yylex(&yylval, &yylloc, YYLEX_PARAM)
545#else
546 #define YYLEX yylex(&yylval, &yylloc)
547#endif
548#else /* not YYLSP_NEEDED */
549#ifdef YYLEX_PARAM
550 #define YYLEX yylex(&yylval, YYLEX_PARAM)
551#else
552 #define YYLEX yylex(&yylval)
553#endif
554#endif /* not YYLSP_NEEDED */
555#endif
556
557/* If nonreentrant, generate the variables here */
558
559#ifndef YYPURE
560
561 int yychar; /* the lookahead symbol */
562 YYSTYPE yylval; /* the semantic value of the */
563 /* lookahead symbol */
564
565#ifdef YYLSP_NEEDED
566 YYLTYPE yylloc; /* location data for the lookahead*/
567 /* symbol */
568#endif
569
570 int yynerrs; /* number of parse errors so far */
571#endif /* not YYPURE */
572
573#if YYDEBUG != 0
574 int yydebug; /* nonzero means print parse trace*/
575/* Since this is uninitialized, it does not stop multiple parsers
576 from coexisting. */
577#endif
578
579 /* YYINITDEPTH indicates the initial size of the parser's stacks*/
580
581 #ifndefYYINITDEPTH
582#define YYINITDEPTH 200
583#endif
584
585/* YYMAXDEPTH is the maximum size the stacks can grow to
586 (effective only if the built-in stack extension method is used). */
587
588#if YYMAXDEPTH == 0
589#undef YYMAXDEPTH
590#endif
591
592#ifndef YYMAXDEPTH
593#define YYMAXDEPTH 10000
594#endif
595
596/* Define __yy_memcpy. Note that the size argument
597 should be passed with type unsigned int, because that is what the non-GCC
598 definitions require. With GCC, __builtin_memcpy takes an arg
599 of type size_t, but it can handle unsigned int. */
600
601 #if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
602 #define __yy_memcpy(TO,FROM,COUNT)__builtin_memcpy(TO,FROM,COUNT)
603 #else /* not GNU C or C++ */
604#ifndef __cplusplus
605
606/* This is the most reliable way to avoid incompatibilities
607 in available built-in functions on various systems. */
608static void
609__yy_memcpy (to, from, count)
610 char *to;
611 char *from;
612 unsigned int count;
613{
614 register char *f = from;
615 register char *t = to;
616 register int i = count;
617
618 while (i-- > 0)
619 *t++ = *f++;
620}
621
622#else /* __cplusplus */
623
624/* This is the most reliable way to avoid incompatibilities
625 in available built-in functions on various systems. */
626static void
627__yy_memcpy (char *to, char *from, unsigned int count)
628{
629 register char *t = to;
630 register char *f = from;
631 register int i = count;
632
633 while (i-- > 0)
634 *t++ = *f++;
635}
636
637#endif
638#endif
639
640#line 222 "/usr/share/bison.simple"
641
642/* The user can define YYPARSE_PARAM as the name of an argument to be passed
643 into yyparse. The argument should have type void *.
644 It should actually point to an object.
645 Grammar actions can access the variable by casting it
646 to the proper pointer type. */
647
648#ifdef YYPARSE_PARAM
649#ifdef __cplusplus
650#define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
651#define YYPARSE_PARAM_DECL
652#else /* not __cplusplus */
653#define YYPARSE_PARAM_ARG YYPARSE_PARAM
654#define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
655#endif /* not __cplusplus */
656#else /* not YYPARSE_PARAM */
657#define YYPARSE_PARAM_ARG
658#define YYPARSE_PARAM_DECL
659#endif /* not YYPARSE_PARAM */
660
661/* Prevent warning if -Wstrict-prototypes. */
662#ifdef __GNUC__
663#ifdef YYPARSE_PARAM
664YYPARSE_RETURN_TYPE
665yyparse (void *);
666#else
667YYPARSE_RETURN_TYPE
668yyparse (void);
669#endif
670#endif
671
672YYPARSE_RETURN_TYPE
673yyparse(YYPARSE_PARAM_ARG)
674 YYPARSE_PARAM_DECL
675{
676 register int yystate;
677 register int yyn;
678 register short *yyssp;
679 register YYSTYPE *yyvsp;
680 int yyerrstatus;/* number of tokens to shift before error messages enabled */
681 int yychar1 = 0; /* lookahead token as an internal (translated) token number */
682
683 short yyssa[YYINITDEPTH]; /* the state stack */
684 YYSTYPE yyvsa[YYINITDEPTH]; /* the semantic value stack */
685
686 short *yyss = yyssa; /* refer to the stacks thru separate pointers */
687 YYSTYPE *yyvs = yyvsa;/* to allow yyoverflow to reallocate them elsewhere */
688
689#ifdef YYLSP_NEEDED
690 YYLTYPE yylsa[YYINITDEPTH]; /* the location stack */
691 YYLTYPE *yyls = yylsa;
692 YYLTYPE *yylsp;
693
694#define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
695#else
696#define YYPOPSTACK (yyvsp--, yyssp--)
697#endif
698
699 int yystacksize = YYINITDEPTH;
700#ifndef YYSTACK_USE_ALLOCA
701 int yyfree_stacks = 0;
702#endif
703
704#ifdef YYPURE
705 int yychar;
706 YYSTYPE yylval;
707 int yynerrs;
708#ifdef YYLSP_NEEDED
709 YYLTYPE yylloc;
710#endif
711#endif
712
713 YYSTYPE yyval; /* the variable used to return */
714 /* semantic values from the action*/
715 /* routines */
716
717 int yylen;
718
719#if YYDEBUG != 0
720 if (yydebug)
721 fprintf(stderr, "Starting parse\n");
722#endif
723
724 yystate = 0;
725 yyerrstatus = 0;
726 yynerrs = 0;
727 yychar = YYEMPTY; /* Cause a token to be read. */
728
729 /* Initialize stack pointers.
730 Waste one element of value and location stack
731 so that they stay on the same level as the state stack.
732 The wasted elements are never initialized. */
733
734 yyssp = yyss - 1;
735 yyvsp = yyvs;
736#ifdef YYLSP_NEEDED
737 yylsp = yyls;
738#endif
739
740/* Push a new state, which is found in yystate . */
741/* In all cases, when you get here, the value and location stacks
742 have just been pushed. so pushing a state here evens the stacks. */
743yynewstate:
744
745 *++yyssp = yystate;
746
747 if (yyssp >= yyss + yystacksize - 1)
748 {
749 /* Give user a chance to reallocate the stack */
750 /* Use copies of these so that the &'s don't force the real ones into memory. */
751 YYSTYPE *yyvs1 = yyvs;
752 short *yyss1 = yyss;
753#ifdef YYLSP_NEEDED
754 YYLTYPE *yyls1 = yyls;
755#endif
756
757 /* Get the current used size of the three stacks, in elements. */
758 int size = yyssp - yyss + 1;
759
760#ifdef yyoverflow
761 /* Each stack pointer address is followed by the size of
762 the data in use in that stack, in bytes. */
763#ifdef YYLSP_NEEDED
764 /* This used to be a conditional around just the two extra args,
765 but that might be undefined if yyoverflow is a macro. */
766 yyoverflow("parser stack overflow",
767 &yyss1, size * sizeof (*yyssp),
768 &yyvs1, size * sizeof (*yyvsp),
769 &yyls1, size * sizeof (*yylsp),
770 &yystacksize);
771#else
772 yyoverflow("parser stack overflow",
773 &yyss1, size * sizeof (*yyssp),
774 &yyvs1, size * sizeof (*yyvsp),
775 &yystacksize);
776#endif
777
778 yyss = yyss1; yyvs = yyvs1;
779#ifdef YYLSP_NEEDED
780 yyls = yyls1;
781#endif
782#else /* no yyoverflow */
783 /* Extend the stack our own way. */
784 if (yystacksize >= YYMAXDEPTH)
785 {
786 yyerror("parser stack overflow");
787#ifndef YYSTACK_USE_ALLOCA
788 if (yyfree_stacks)
789 {
790 free (yyss);
791 free (yyvs);
792#ifdef YYLSP_NEEDED
793 free (yyls);
794#endif
795 }
796 #endif
797 return 2;
798 }
799 yystacksize *= 2;
800 if (yystacksize > YYMAXDEPTH)
801 yystacksize = YYMAXDEPTH;
802#ifndef YYSTACK_USE_ALLOCA
803 yyfree_stacks = 1;
804#endif
805 yyss = (short *) YYSTACK_ALLOC (yystacksize * sizeof (*yyssp));
806 __yy_memcpy ((char *)yyss, (char *)yyss1,
807 size * (unsigned int) sizeof (*yyssp));
808 yyvs = (YYSTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yyvsp));
809 __yy_memcpy ((char *)yyvs, (char *)yyvs1,
810 size * (unsigned int) sizeof (*yyvsp));
811#ifdef YYLSP_NEEDED
812 yyls = (YYLTYPE *) YYSTACK_ALLOC (yystacksize * sizeof (*yylsp));
813 __yy_memcpy ((char *)yyls, (char *)yyls1,
814 size * (unsigned int) sizeof (*yylsp));
815#endif
816#endif /* no yyoverflow */
817
818 yyssp = yyss + size - 1;
819 yyvsp = yyvs + size - 1;
820#ifdef YYLSP_NEEDED
821 yylsp = yyls + size - 1;
822#endif
823
824#if YYDEBUG != 0
825 if (yydebug)
826 fprintf(stderr, "Stack size increased to %d\n", yystacksize);
827#endif
828
829 if (yyssp >= yyss + yystacksize - 1)
830 YYABORT;
831 }
832
833#if YYDEBUG != 0
834 if (yydebug)
835 fprintf(stderr, "Entering state %d\n", yystate);
836#endif
837
838 goto yybackup;
839 yybackup:
840
841/* Do appropriate processing given the current state. */
842/* Read a lookahead token if we need one and don't already have one. */
843/* yyresume: */
844
845 /* First try to decide what to do without reference to lookahead token. */
846
847 yyn = yypact[yystate];
848 if (yyn == YYFLAG)
849 goto yydefault;
850
851 /* Not known => get a lookahead token if don't already have one. */
852
853 /* yychar is either YYEMPTY or YYEOF
854 or a valid token in external form. */
855
856 if (yychar == YYEMPTY)
857 {
858#if YYDEBUG != 0
859 if (yydebug)
860 fprintf(stderr, "Reading a token: ");
861#endif
862 yychar = YYLEX;
863 }
864
865 /* Convert token to internal form (in yychar1) for indexing tables with */
866
867 if (yychar <= 0) /* This means end of input. */
868 {
869 yychar1 = 0;
870 yychar = YYEOF; /* Don't call YYLEX any more */
871
872#if YYDEBUG != 0
873 if (yydebug)
874 fprintf(stderr, "Now at end of input.\n");
875#endif
876 }
877 else
878 {
879 yychar1 = YYTRANSLATE(yychar);
880
881#if YYDEBUG != 0
882 if (yydebug)
883 {
884 fprintf (stderr, "Next token is %d (%s", yychar, yytname[yychar1]);
885 /* Give the individual parser a way to print the precise meaning
886 of a token, for further debugging info. */
887#ifdef YYPRINT
888 YYPRINT (stderr, yychar, yylval);
889#endif
890 fprintf (stderr, ")\n");
891 }
892#endif
893 }
894
895 yyn += yychar1;
896 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
897 goto yydefault;
898
899 yyn = yytable[yyn];
900
901 /* yyn is what to do for this token type in this state.
902 Negative => reduce, -yyn is rule number.
903 Positive => shift, yyn is new state.
904 New state is final state => don't bother to shift,
905 just return success.
906 0, or most negative number => error. */
907
908 if (yyn < 0)
909 {
910 if (yyn == YYFLAG)
911 goto yyerrlab;
912 yyn = -yyn;
913 goto yyreduce;
914 }
915 else if (yyn == 0)
916 goto yyerrlab;
917
918 if (yyn == YYFINAL)
919 YYACCEPT;
920
921 /* Shift the lookahead token. */
922
923#if YYDEBUG != 0
924 if (yydebug)
925 fprintf(stderr, "Shifting token %d (%s), ", yychar, yytname[yychar1]);
926#endif
927
928 /* Discard the token being shifted unless it is eof. */
929 if (yychar != YYEOF)
930 yychar = YYEMPTY;
931
932 *++yyvsp = yylval;
933#ifdef YYLSP_NEEDED
934 *++yylsp = yylloc;
935#endif
936
937 /* count tokens shifted since error; after three, turn off error status. */
938 if (yyerrstatus) yyerrstatus--;
939
940 yystate = yyn;
941 goto yynewstate;
942
943/* Do the default action for the current state. */
944yydefault:
945
946 yyn = yydefact[yystate];
947 if (yyn == 0)
948 goto yyerrlab;
949
950/* Do a reduction. yyn is the number of a rule to reduce with. */
951yyreduce:
952 yylen = yyr2[yyn];
953 if (yylen > 0)
954 yyval = yyvsp[1-yylen]; /* implement default value of the action */
955
956#if YYDEBUG != 0
957 if (yydebug)
958 {
959 int i;
960
961 fprintf (stderr, "Reducing via rule %d (line %d), ",
962 yyn, yyrline[yyn]);
963
964 /* Print the symbols being reduced, and their result. */
965 for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
966 fprintf (stderr, "%s ", yytname[yyrhs[i]]);
967 fprintf (stderr, " -> %s\n", yytname[yyr1[yyn]]);
968 }
969#endif
970
971
972 switch (yyn) {
973
974case 6:
975#line 183 "../../../../libical/src/libical/icalyacc.y"
976{
977 icalparser_yy_value = 0;
978 icalparser_clear_flex_input();
979 yyclearin;
980 ;
981 break;}
982case 7:
983#line 191 "../../../../libical/src/libical/icalyacc.y"
984{
985 struct icaltimetype stm;
986
987 stm = fill_datetime(yyvsp[0].v_string,0);
988
989 stm.hour = -1;
990 stm.minute = -1;
991 stm.second = -1;
992 stm.is_utc = 0;
993 stm.is_date = 1;
994
995 icalparser_yy_value = icalvalue_new_date(stm);
996 ;
997 break;}
998case 8:
999#line 206 "../../../../libical/src/libical/icalyacc.y"
1000{utc = 0;;
1001 break;}
1002case 9:
1003#line 207 "../../../../libical/src/libical/icalyacc.y"
1004{utc = 1;;
1005 break;}
1006case 10:
1007#line 211 "../../../../libical/src/libical/icalyacc.y"
1008{utc_b = 0;;
1009 break;}
1010case 11:
1011#line 212 "../../../../libical/src/libical/icalyacc.y"
1012{utc_b = 1;;
1013 break;}
1014case 12:
1015#line 216 "../../../../libical/src/libical/icalyacc.y"
1016{
1017 struct icaltimetype stm;
1018 stm = fill_datetime(yyvsp[-3].v_string, yyvsp[-1].v_string);
1019 stm.is_utc = utc;
1020 stm.is_date = 0;
1021
1022 icalparser_yy_value =
1023 icalvalue_new_datetime(stm);
1024 ;
1025 break;}
1026case 15:
1027#line 234 "../../../../libical/src/libical/icalyacc.y"
1028{
1029 duration.weeks = atoi(yyvsp[-1].v_string);
1030 ;
1031 break;}
1032case 16:
1033#line 239 "../../../../libical/src/libical/icalyacc.y"
1034{
1035 ;
1036 break;}
1037case 17:
1038#line 242 "../../../../libical/src/libical/icalyacc.y"
1039{
1040 ;
1041 break;}
1042case 18:
1043#line 245 "../../../../libical/src/libical/icalyacc.y"
1044{
1045 ;
1046 break;}
1047case 19:
1048#line 249 "../../../../libical/src/libical/icalyacc.y"
1049{
1050 duration.hours = atoi(yyvsp[-1].v_string);
1051 ;
1052 break;}
1053case 20:
1054#line 253 "../../../../libical/src/libical/icalyacc.y"
1055{
1056 duration.hours = atoi(yyvsp[-2].v_string);
1057 ;
1058 break;}
1059case 21:
1060#line 258 "../../../../libical/src/libical/icalyacc.y"
1061{
1062 duration.minutes = atoi(yyvsp[-1].v_string);
1063 ;
1064 break;}
1065case 22:
1066#line 262 "../../../../libical/src/libical/icalyacc.y"
1067{
1068 duration.minutes = atoi(yyvsp[-2].v_string);
1069 ;
1070 break;}
1071case 23:
1072#line 267 "../../../../libical/src/libical/icalyacc.y"
1073{
1074 duration.seconds = atoi(yyvsp[-1].v_string);
1075 ;
1076 break;}
1077case 24:
1078#line 272 "../../../../libical/src/libical/icalyacc.y"
1079{
1080 duration.days = atoi(yyvsp[-1].v_string);
1081 ;
1082 break;}
1083case 25:
1084#line 277 "../../../../libical/src/libical/icalyacc.y"
1085{
1086 duration.is_neg = 0;
1087 ;
1088 break;}
1089case 26:
1090#line 281 "../../../../libical/src/libical/icalyacc.y"
1091{
1092 duration.is_neg = 0;
1093 ;
1094 break;}
1095case 27:
1096#line 285 "../../../../libical/src/libical/icalyacc.y"
1097{
1098 duration.is_neg = 1;
1099 ;
1100 break;}
1101case 28:
1102#line 290 "../../../../libical/src/libical/icalyacc.y"
1103{
1104 icalparser_yy_value = icalvalue_new_duration(duration);
1105 memset(&duration,0, sizeof(duration));
1106 ;
1107 break;}
1108case 29:
1109#line 295 "../../../../libical/src/libical/icalyacc.y"
1110{
1111 icalparser_yy_value = icalvalue_new_duration(duration);
1112 memset(&duration,0, sizeof(duration));
1113 ;
1114 break;}
1115case 30:
1116#line 300 "../../../../libical/src/libical/icalyacc.y"
1117{
1118 icalparser_yy_value = icalvalue_new_duration(duration);
1119 memset(&duration,0, sizeof(duration));
1120 ;
1121 break;}
1122case 31:
1123#line 309 "../../../../libical/src/libical/icalyacc.y"
1124{
1125 struct icalperiodtype p;
1126
1127 p.start = fill_datetime(yyvsp[-8].v_string,yyvsp[-6].v_string);
1128 p.start.is_utc = utc;
1129 p.start.is_date = 0;
1130
1131
1132 p.end = fill_datetime(yyvsp[-3].v_string,yyvsp[-1].v_string);
1133 p.end.is_utc = utc_b;
1134 p.end.is_date = 0;
1135
1136 p.duration.days = -1;
1137 p.duration.weeks = -1;
1138 p.duration.hours = -1;
1139 p.duration.minutes = -1;
1140 p.duration.seconds = -1;
1141
1142 icalparser_yy_value = icalvalue_new_period(p);
1143 ;
1144 break;}
1145case 32:
1146#line 330 "../../../../libical/src/libical/icalyacc.y"
1147{
1148 struct icalperiodtype p;
1149
1150 p.start = fill_datetime(yyvsp[-5].v_string,yyvsp[-3].v_string);
1151 p.start.is_utc = utc;
1152 p.start.is_date = 0;
1153
1154 p.end.year = -1;
1155 p.end.month = -1;
1156 p.end.day = -1;
1157 p.end.hour = -1;
1158 p.end.minute = -1;
1159 p.end.second = -1;
1160
1161 /* The duration_value rule setes the global 'duration'
1162 variable, but it also creates a new value in
1163 icalparser_yy_value. So, free that, then copy
1164 'duration' into the icalperiodtype struct. */
1165
1166 p.duration = icalvalue_get_duration(icalparser_yy_value);
1167 icalvalue_free(icalparser_yy_value);
1168 icalparser_yy_value = 0;
1169
1170 icalparser_yy_value = icalvalue_new_period(p);
1171
1172 ;
1173 break;}
1174case 34:
1175#line 364 "../../../../libical/src/libical/icalyacc.y"
1176{ utcsign = 1; ;
1177 break;}
1178case 35:
1179#line 365 "../../../../libical/src/libical/icalyacc.y"
1180{ utcsign = -1; ;
1181 break;}
1182case 36:
1183#line 369 "../../../../libical/src/libical/icalyacc.y"
1184{
1185 icalparser_yy_value = icalvalue_new_utcoffset( utcsign * (yyvsp[-1].v_int*3600) + (yyvsp[0].v_int*60) );
1186 ;
1187 break;}
1188case 37:
1189#line 374 "../../../../libical/src/libical/icalyacc.y"
1190{
1191 icalparser_yy_value = icalvalue_new_utcoffset(utcsign * (yyvsp[-2].v_int*3600) + (yyvsp[-1].v_int*60) +(yyvsp[0].v_int));
1192 ;
1193 break;}
1194}
1195 /* the action file gets copied in in place of this dollarsign */
1196#line 554 "/usr/share/bison.simple"
1197
1198 yyvsp -= yylen;
1199 yyssp -= yylen;
1200#ifdef YYLSP_NEEDED
1201 yylsp -= yylen;
1202#endif
1203
1204#if YYDEBUG != 0
1205 if (yydebug)
1206 {
1207 short *ssp1 = yyss - 1;
1208 fprintf (stderr, "state stack now");
1209 while (ssp1 != yyssp)
1210 fprintf (stderr, " %d", *++ssp1);
1211 fprintf (stderr, "\n");
1212 }
1213#endif
1214
1215 *++yyvsp = yyval;
1216
1217#ifdef YYLSP_NEEDED
1218 yylsp++;
1219 if (yylen == 0)
1220 {
1221 yylsp->first_line = yylloc.first_line;
1222 yylsp->first_column = yylloc.first_column;
1223 yylsp->last_line = (yylsp-1)->last_line;
1224 yylsp->last_column = (yylsp-1)->last_column;
1225 yylsp->text = 0;
1226 }
1227 else
1228 {
1229 yylsp->last_line = (yylsp+yylen-1)->last_line;
1230 yylsp->last_column = (yylsp+yylen-1)->last_column;
1231 }
1232#endif
1233
1234 /* Now "shift" the result of the reduction.
1235 Determine what state that goes to,
1236 based on the state we popped back to
1237 and the rule number reduced by. */
1238
1239 yyn = yyr1[yyn];
1240
1241 yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
1242 if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
1243 yystate = yytable[yystate];
1244 else
1245 yystate = yydefgoto[yyn - YYNTBASE];
1246
1247 goto yynewstate;
1248
1249yyerrlab: /* here on detecting error */
1250
1251 if (! yyerrstatus)
1252 /* If not already recovering from an error, report this error. */
1253 {
1254 ++yynerrs;
1255
1256#ifdef YYERROR_VERBOSE
1257 yyn = yypact[yystate];
1258
1259 if (yyn > YYFLAG && yyn < YYLAST)
1260 {
1261 int size = 0;
1262 char *msg;
1263 int x, count;
1264
1265 count = 0;
1266 /* Start X at -yyn if nec to avoid negative indexes in yycheck. */
1267 for (x = (yyn < 0 ? -yyn : 0);
1268 x < (sizeof(yytname) / sizeof(char *)); x++)
1269 if (yycheck[x + yyn] == x)
1270 size += strlen(yytname[x]) + 15, count++;
1271 msg = (char *) malloc(size + 15);
1272 if (msg != 0)
1273 {
1274 strcpy(msg, "parse error");
1275
1276 if (count < 5)
1277 {
1278 count = 0;
1279 for (x = (yyn < 0 ? -yyn : 0);
1280 x < (sizeof(yytname) / sizeof(char *)); x++)
1281 if (yycheck[x + yyn] == x)
1282 {
1283 strcat(msg, count == 0 ? ", expecting `" : " or `");
1284 strcat(msg, yytname[x]);
1285 strcat(msg, "'");
1286 count++;
1287 }
1288 }
1289 yyerror(msg);
1290 free(msg);
1291 }
1292 else
1293 yyerror ("parse error; also virtual memory exceeded");
1294 }
1295 else
1296#endif /* YYERROR_VERBOSE */
1297 yyerror("parse error");
1298 }
1299
1300 goto yyerrlab1;
1301yyerrlab1: /* here on error raised explicitly by an action */
1302
1303 if (yyerrstatus == 3)
1304 {
1305 /* if just tried and failed to reuse lookahead token after an error, discard it. */
1306
1307 /* return failure if at end of input */
1308 if (yychar == YYEOF)
1309 YYABORT;
1310
1311#if YYDEBUG != 0
1312 if (yydebug)
1313 fprintf(stderr, "Discarding token %d (%s).\n", yychar, yytname[yychar1]);
1314#endif
1315
1316 yychar = YYEMPTY;
1317 }
1318
1319 /* Else will try to reuse lookahead token
1320 after shifting the error token. */
1321
1322 yyerrstatus = 3; /* Each real token shifted decrements this */
1323
1324 goto yyerrhandle;
1325
1326yyerrdefault: /* current state does not do anything special for the error token. */
1327
1328#if 0
1329 /* This is wrong; only states that explicitly want error tokens
1330 should shift them. */
1331 yyn = yydefact[yystate]; /* If its default is to accept any token, ok. Otherwise pop it.*/
1332 if (yyn) goto yydefault;
1333#endif
1334
1335yyerrpop: /* pop the current state because it cannot handle the error token */
1336
1337 if (yyssp == yyss) YYABORT;
1338 yyvsp--;
1339 yystate = *--yyssp;
1340#ifdef YYLSP_NEEDED
1341 yylsp--;
1342#endif
1343
1344#if YYDEBUG != 0
1345 if (yydebug)
1346 {
1347 short *ssp1 = yyss - 1;
1348 fprintf (stderr, "Error: state stack now");
1349 while (ssp1 != yyssp)
1350 fprintf (stderr, " %d", *++ssp1);
1351 fprintf (stderr, "\n");
1352 }
1353#endif
1354
1355yyerrhandle:
1356
1357 yyn = yypact[yystate];
1358 if (yyn == YYFLAG)
1359 goto yyerrdefault;
1360
1361 yyn += YYTERROR;
1362 if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
1363 goto yyerrdefault;
1364
1365 yyn = yytable[yyn];
1366 if (yyn < 0)
1367 {
1368 if (yyn == YYFLAG)
1369 goto yyerrpop;
1370 yyn = -yyn;
1371 goto yyreduce;
1372 }
1373 else if (yyn == 0)
1374 goto yyerrpop;
1375
1376 if (yyn == YYFINAL)
1377 YYACCEPT;
1378
1379#if YYDEBUG != 0
1380 if (yydebug)
1381 fprintf(stderr, "Shifting error token, ");
1382#endif
1383
1384 *++yyvsp = yylval;
1385#ifdef YYLSP_NEEDED
1386 *++yylsp = yylloc;
1387#endif
1388
1389 yystate = yyn;
1390 goto yynewstate;
1391
1392 yyacceptlab:
1393 /* YYACCEPT comes here. */
1394#ifndef YYSTACK_USE_ALLOCA
1395 if (yyfree_stacks)
1396 {
1397 free (yyss);
1398 free (yyvs);
1399#ifdef YYLSP_NEEDED
1400 free (yyls);
1401#endif
1402 }
1403#endif
1404 return 0;
1405
1406 yyabortlab:
1407 /* YYABORT comes here. */
1408#ifndef YYSTACK_USE_ALLOCA
1409 if (yyfree_stacks)
1410 {
1411 free (yyss);
1412 free (yyvs);
1413#ifdef YYLSP_NEEDED
1414 free (yyls);
1415#endif
1416 }
1417#endif
1418 return 1;
1419}
1420#line 378 "../../../../libical/src/libical/icalyacc.y"
1421
1422
1423struct icaltimetype fill_datetime(char* datestr, char* timestr)
1424{
1425 struct icaltimetype stm;
1426
1427 memset(&stm,0,sizeof(stm));
1428
1429 if (datestr != 0){
1430 sscanf(datestr,"%4d%2d%2d",&(stm.year), &(stm.month),
1431 &(stm.day));
1432 }
1433
1434 if (timestr != 0){
1435 sscanf(timestr,"%2d%2d%2d", &(stm.hour), &(stm.minute),
1436 &(stm.second));
1437 }
1438
1439 return stm;
1440
1441}
1442
1443void ical_yyerror(char* s)
1444{
1445 /*fprintf(stderr,"Parse error \'%s\'\n", s);*/
1446}
1447
diff --git a/libical/src/libical/icalyacc.h b/libical/src/libical/icalyacc.h
new file mode 100644
index 0000000..f6d66bc
--- a/dev/null
+++ b/libical/src/libical/icalyacc.h
@@ -0,0 +1,137 @@
1typedef union {
2 float v_float;
3 int v_int;
4 char* v_string;
5} YYSTYPE;
6 #define DIGITS257
7 #define INTNUMBER258
8 #define FLOATNUMBER259
9 #define STRING260
10 #define EOL261
11 #define EQUALS262
12 #define CHARACTER263
13 #define COLON264
14 #define COMMA265
15 #define SEMICOLON266
16 #define MINUS267
17 #define TIMESEPERATOR268
18 #define TRUE269
19 #define FALSE270
20 #define FREQ271
21 #define BYDAY272
22 #define BYHOUR273
23 #define BYMINUTE274
24 #define BYMONTH275
25 #define BYMONTHDAY276
26 #define BYSECOND277
27 #define BYSETPOS278
28 #define BYWEEKNO279
29 #define BYYEARDAY280
30 #define DAILY281
31 #define MINUTELY282
32 #define MONTHLY283
33 #define SECONDLY284
34 #define WEEKLY285
35 #define HOURLY286
36 #define YEARLY287
37 #define INTERVAL288
38 #define COUNT289
39 #define UNTIL290
40 #define WKST291
41 #define MO292
42 #define SA293
43 #define SU294
44 #define TU295
45 #define WE296
46 #define TH297
47 #define FR298
48 #define BIT8299
49 #define ACCEPTED300
50 #define ADD301
51 #define AUDIO302
52 #define BASE64303
53 #define BINARY304
54 #define BOOLEAN305
55 #define BUSY306
56 #define BUSYTENTATIVE307
57 #define BUSYUNAVAILABLE308
58 #define CALADDRESS309
59 #define CANCEL310
60 #define CANCELLED311
61 #define CHAIR312
62 #define CHILD313
63 #define COMPLETED314
64 #define CONFIDENTIAL315
65 #define CONFIRMED316
66 #define COUNTER317
67 #define DATE318
68 #define DATETIME319
69 #define DECLINECOUNTER320
70 #define DECLINED321
71 #define DELEGATED322
72 #define DISPLAY323
73 #define DRAFT324
74 #define DURATION325
75 #define EMAIL326
76 #define END327
77 #define FINAL328
78 #define FLOAT329
79 #define FREE330
80 #define GREGORIAN331
81 #define GROUP332
82 #define INDIVIDUAL333
83 #define INPROCESS334
84 #define INTEGER335
85 #define NEEDSACTION336
86 #define NONPARTICIPANT337
87 #define OPAQUE338
88 #define OPTPARTICIPANT339
89 #define PARENT340
90 #define PERIOD341
91 #define PRIVATE342
92 #define PROCEDURE343
93 #define PUBLIC344
94 #define PUBLISH345
95 #define RECUR346
96 #define REFRESH347
97 #define REPLY348
98 #define REQPARTICIPANT349
99 #define REQUEST350
100 #define RESOURCE351
101 #define ROOM352
102 #define SIBLING353
103 #define START354
104 #define TENTATIVE355
105 #define TEXT356
106 #define THISANDFUTURE357
107 #define THISANDPRIOR358
108 #define TIME359
109 #define TRANSPAENT360
110 #define UNKNOWN361
111 #define UTCOFFSET362
112 #define XNAME363
113 #define ALTREP364
114 #define CN365
115 #define CUTYPE366
116 #define DAYLIGHT367
117 #define DIR368
118 #define ENCODING369
119 #define EVENT370
120 #define FBTYPE371
121 #define FMTTYPE372
122 #define LANGUAGE373
123 #define MEMBER374
124 #define PARTSTAT375
125 #define RANGE376
126 #define RELATED377
127 #define RELTYPE378
128 #define ROLE379
129 #define RSVP380
130 #define SENTBY381
131 #define STANDARD382
132 #define URI383
133 #define TIME_CHAR384
134 #define UTC_CHAR385
135
136
137extern YYSTYPE ical_yylval;
diff --git a/libical/src/libical/icalyacc.y b/libical/src/libical/icalyacc.y
new file mode 100644
index 0000000..4f53d84
--- a/dev/null
+++ b/libical/src/libical/icalyacc.y
@@ -0,0 +1,404 @@
1%{
2/* -*- Mode: C -*-
3 ======================================================================
4 FILE: icalitip.y
5 CREATOR: eric 10 June 1999
6
7 DESCRIPTION:
8
9 $Id$
10 $Locker$
11
12 (C) COPYRIGHT 1999 Eric Busboom
13 http://www.softwarestudio.org
14
15 The contents of this file are subject to the Mozilla Public License
16 Version 1.0 (the "License"); you may not use this file except in
17 compliance with the License. You may obtain a copy of the License at
18 http://www.mozilla.org/MPL/
19
20 Software distributed under the License is distributed on an "AS IS"
21 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
22 the License for the specific language governing rights and
23 limitations under the License.
24
25 The original author is Eric Busboom
26 The original code is icalitip.y
27
28
29
30 =======================================================================*/
31
32#include <stdlib.h>
33#include <string.h> /* for strdup() */
34#include "icalparser.h"
35#include "pvl.h"
36
37icalvalue *icalparser_yy_value; /* Current Value */
38
39void ical_yyerror(char* s);
40void icalparser_clear_flex_input();
41int ical_yy_lex(void);
42
43/* Globals for UTCOFFSET values */
44int utc;
45int utc_b;
46int utcsign;
47
48/* Globals for DURATION values */
49struct icaldurationtype duration;
50
51/* Globals for TRIGGER values */
52struct icaltriggertype trigger;
53
54void copy_list(short* array, size_t size);
55void add_prop(icalproperty_kind);
56void icalparser_fill_date(struct tm* t, char* dstr);
57void icalparser_fill_time(struct tm* t, char* tstr);
58void set_value_type(icalvalue_kind kind);
59void set_parser_value_state();
60struct icaltimetype fill_datetime(char* d, char* t);
61void ical_yy_error(char *s); /* Don't know why I need this.... */
62int yylex(void); /* Or this. */
63
64
65
66/* Set the state of the lexer so it will interpret values ( iCAL
67 VALUEs, that is, ) correctly. */
68
69%}
70
71%union {
72 float v_float;
73 int v_int;
74 char* v_string;
75}
76
77
78 /* Renaming hack */
79
80/*
81#define yymaxdepth ical_yy_maxdepth
82#define yyparse ical_yy_parse
83#define yyerror ical_yy_error
84#define yylval ical_yy_lval
85#define yychar ical_yy_char
86#define yydebug ical_yy_debug
87#define yypact ical_yy_pact
88#define yyr1 ical_yy_r1
89#define yyr2 ical_yy_r2
90#define yydef ical_yy_def
91#define yychk ical_yy_chk
92#define yypgo ical_yy_pgo
93#define yyact ical_yy_act
94#define yyexca ical_yy_exca
95#define yyerrflag ical_yy_errflag
96#define yynerrs ical_yy_nerrs
97#define yyps ical_yy_ps
98#define yypv ical_yy_pv
99#define yys ical_yy_s
100#define yy_yys ical_yy_yys
101#define yystate ical_yy_state
102#define yytmp ical_yy_tmp
103#define yyv ical_yy_v
104#define yy_yyv ical_yy_yyv
105#define yyval ical_yy_val
106#define yylloc ical_yy_lloc
107#define yyreds ical_yy_reds
108#define yytoks ical_yy_toks
109#define yylhs ical_yy_yylhs
110#define yylen ical_yy_yylen
111#define yydefred ical_yy_yydefred
112#define yydgoto ical_yy_yydgoto
113#define yydefred ical_yy_yydefred
114#define yydgoto ical_yy_yydgoto
115#define yysindex ical_yy_yysindex
116#define yyrindex ical_yy_yyrindex
117#define yygindex ical_yy_yygindex
118#define yytable ical_yy_yytable
119#define yycheck ical_yy_yycheck
120#define yyname ical_yy_yyname
121#define yyrule ical_yy_yyrule
122#define yy_scan_bytes ical_yy_scan_bytes
123#define yy_scan_string ical_yy_scan_string
124#define yy_scan_buffer ical_yy_scan_buffer
125*/
126
127/* These are redefined with the -P option to flex */
128/*
129#define yy_create_buffer ical_yy_create_buffer
130#define yy_delete_buffer ical_yy_delete_buffer
131#define yy_flex_debug ical_yy_flex_debug
132#define yy_init_buffer ical_yy_init_buffer
133#define yy_flush_buffer ical_yy_flush_buffer
134#define yy_load_buffer_state ical_yy_load_buffer_state
135#define yy_switch_to_buffer ical_yy_switch_to_buffer
136#define yyin ical_yyin
137#define yyleng ical_yyleng
138#define yylex ical_yylex
139#define yylineno ical_yylineno
140#define yyout ical_yyout
141#define yyrestart ical_yyrestart
142#define yytext ical_yytext
143#define yywrap ical_yywrap
144*/
145
146
147%token <v_string> DIGITS
148%token <v_int> INTNUMBER
149%token <v_float> FLOATNUMBER
150%token <v_string> STRING
151%token EOL EQUALS CHARACTER COLON COMMA SEMICOLON MINUS TIMESEPERATOR
152
153%token TRUE FALSE
154
155%token FREQ BYDAY BYHOUR BYMINUTE BYMONTH BYMONTHDAY BYSECOND BYSETPOS BYWEEKNO
156%token BYYEARDAY DAILY MINUTELY MONTHLY SECONDLY WEEKLY HOURLY YEARLY
157%token INTERVAL COUNT UNTIL WKST MO SA SU TU WE TH FR
158
159%token BIT8 ACCEPTED ADD AUDIO BASE64 BINARY BOOLEAN BUSY BUSYTENTATIVE
160%token BUSYUNAVAILABLE CALADDRESS CANCEL CANCELLED CHAIR CHILD COMPLETED
161%token CONFIDENTIAL CONFIRMED COUNTER DATE DATETIME DECLINECOUNTER DECLINED
162%token DELEGATED DISPLAY DRAFT DURATION EMAIL END FINAL FLOAT FREE GREGORIAN
163%token GROUP INDIVIDUAL INPROCESS INTEGER NEEDSACTION NONPARTICIPANT
164%token OPAQUE OPTPARTICIPANT PARENT PERIOD PRIVATE PROCEDURE PUBLIC PUBLISH
165%token RECUR REFRESH REPLY REQPARTICIPANT REQUEST RESOURCE ROOM SIBLING
166%token START TENTATIVE TEXT THISANDFUTURE THISANDPRIOR TIME TRANSPAENT
167%token UNKNOWN UTCOFFSET XNAME
168
169%token ALTREP CN CUTYPE DAYLIGHT DIR ENCODING EVENT FBTYPE FMTTYPE LANGUAGE
170%token MEMBER PARTSTAT RANGE RELATED RELTYPE ROLE RSVP SENTBY STANDARD URI
171
172%token TIME_CHAR UTC_CHAR
173
174
175%%
176
177value:
178 date_value
179 | datetime_value
180 | duration_value
181 | period_value
182 | utcoffset_value
183 | error {
184 icalparser_yy_value = 0;
185 icalparser_clear_flex_input();
186 yyclearin;
187 }
188
189
190date_value: DIGITS
191 {
192 struct icaltimetype stm;
193
194 stm = fill_datetime($1,0);
195
196 stm.hour = -1;
197 stm.minute = -1;
198 stm.second = -1;
199 stm.is_utc = 0;
200 stm.is_date = 1;
201
202 icalparser_yy_value = icalvalue_new_date(stm);
203 }
204
205utc_char:
206 /*empty*/ {utc = 0;}
207 | UTC_CHAR {utc = 1;}
208
209/* This is used in the period_value, where there may be two utc characters per rule. */
210utc_char_b:
211 /*empty*/ {utc_b = 0;}
212 | UTC_CHAR {utc_b = 1;}
213
214datetime_value:
215 DIGITS TIME_CHAR DIGITS utc_char
216 {
217 struct icaltimetype stm;
218 stm = fill_datetime($1, $3);
219 stm.is_utc = utc;
220 stm.is_date = 0;
221
222 icalparser_yy_value =
223 icalvalue_new_datetime(stm);
224 }
225
226
227/* Duration */
228
229
230dur_date: dur_day
231 | dur_day dur_time
232
233dur_week: DIGITS 'W'
234 {
235 duration.weeks = atoi($1);
236 }
237
238dur_time: TIME_CHAR dur_hour
239 {
240 }
241 | TIME_CHAR dur_minute
242 {
243 }
244 | TIME_CHAR dur_second
245 {
246 }
247
248dur_hour: DIGITS 'H'
249 {
250 duration.hours = atoi($1);
251 }
252 | DIGITS 'H' dur_minute
253 {
254 duration.hours = atoi($1);
255 }
256
257dur_minute: DIGITS 'M'
258 {
259 duration.minutes = atoi($1);
260 }
261 | DIGITS 'M' dur_second
262 {
263 duration.minutes = atoi($1);
264 }
265
266dur_second: DIGITS 'S'
267 {
268 duration.seconds = atoi($1);
269 }
270
271dur_day: DIGITS 'D'
272 {
273 duration.days = atoi($1);
274 }
275
276dur_prefix: /* empty */
277 {
278 duration.is_neg = 0;
279 }
280 | '+'
281 {
282 duration.is_neg = 0;
283 }
284 | '-'
285 {
286 duration.is_neg = 1;
287 }
288
289duration_value: dur_prefix 'P' dur_date
290 {
291 icalparser_yy_value = icalvalue_new_duration(duration);
292 memset(&duration,0, sizeof(duration));
293 }
294 | dur_prefix 'P' dur_time
295 {
296 icalparser_yy_value = icalvalue_new_duration(duration);
297 memset(&duration,0, sizeof(duration));
298 }
299 | dur_prefix 'P' dur_week
300 {
301 icalparser_yy_value = icalvalue_new_duration(duration);
302 memset(&duration,0, sizeof(duration));
303 }
304
305
306/* Period */
307
308period_value: DIGITS TIME_CHAR DIGITS utc_char '/' DIGITS TIME_CHAR DIGITS utc_char_b
309 {
310 struct icalperiodtype p;
311
312 p.start = fill_datetime($1,$3);
313 p.start.is_utc = utc;
314 p.start.is_date = 0;
315
316
317 p.end = fill_datetime($6,$8);
318 p.end.is_utc = utc_b;
319 p.end.is_date = 0;
320
321 p.duration.days = -1;
322 p.duration.weeks = -1;
323 p.duration.hours = -1;
324 p.duration.minutes = -1;
325 p.duration.seconds = -1;
326
327 icalparser_yy_value = icalvalue_new_period(p);
328 }
329 | DIGITS TIME_CHAR DIGITS utc_char '/' duration_value
330 {
331 struct icalperiodtype p;
332
333 p.start = fill_datetime($1,$3);
334 p.start.is_utc = utc;
335 p.start.is_date = 0;
336
337 p.end.year = -1;
338 p.end.month = -1;
339 p.end.day = -1;
340 p.end.hour = -1;
341 p.end.minute = -1;
342 p.end.second = -1;
343
344 /* The duration_value rule setes the global 'duration'
345 variable, but it also creates a new value in
346 icalparser_yy_value. So, free that, then copy
347 'duration' into the icalperiodtype struct. */
348
349 p.duration = icalvalue_get_duration(icalparser_yy_value);
350 icalvalue_free(icalparser_yy_value);
351 icalparser_yy_value = 0;
352
353 icalparser_yy_value = icalvalue_new_period(p);
354
355 }
356
357
358trigger:
359
360
361
362/* UTC Offset */
363
364plusminus: '+' { utcsign = 1; }
365 | '-' { utcsign = -1; }
366
367utcoffset_value:
368 plusminus INTNUMBER INTNUMBER
369 {
370 icalparser_yy_value = icalvalue_new_utcoffset( utcsign * ($2*3600) + ($3*60) );
371 }
372
373 | plusminus INTNUMBER INTNUMBER INTNUMBER
374 {
375 icalparser_yy_value = icalvalue_new_utcoffset(utcsign * ($2*3600) + ($3*60) +($4));
376 }
377
378%%
379
380struct icaltimetype fill_datetime(char* datestr, char* timestr)
381{
382 struct icaltimetype stm;
383
384 memset(&stm,0,sizeof(stm));
385
386 if (datestr != 0){
387 sscanf(datestr,"%4d%2d%2d",&(stm.year), &(stm.month),
388 &(stm.day));
389 }
390
391 if (timestr != 0){
392 sscanf(timestr,"%2d%2d%2d", &(stm.hour), &(stm.minute),
393 &(stm.second));
394 }
395
396 return stm;
397
398}
399
400void ical_yyerror(char* s)
401{
402 /*fprintf(stderr,"Parse error \'%s\'\n", s);*/
403}
404
diff --git a/libical/src/libical/libical.pro b/libical/src/libical/libical.pro
new file mode 100644
index 0000000..9cc3983
--- a/dev/null
+++ b/libical/src/libical/libical.pro
@@ -0,0 +1,68 @@
1include(../../../variables.pri)
2
3 TEMPLATE= lib
4
5TARGET = ical
6DESTDIR = ../../lib
7
8win32: DEFINES += _WIN32
9
10 CONFIG += staticlib
11
12 HEADERS = \
13 icalattendee.h \
14 icalcomponent.h \
15 icalderivedparameter.h \
16 icalderivedproperty.h \
17 icalderivedvalue.h \
18 icalduration.h \
19 icalenums.h \
20 icalerror.h \
21 icallangbind.h \
22 icalmemory.h \
23 icalmime.h \
24 icalparameter.h \
25 icalparameterimpl.h \
26 icalparser.h \
27 icalperiod.h \
28 icalproperty.h \
29 icalrecur.h \
30 icalrestriction.h \
31 icaltime.h \
32 icaltypes.h \
33 icalvalue.h \
34 icalvalueimpl.h \
35 icalversion.h \
36 icalyacc.h \
37 pvl.h \
38 sspm.h
39
40 SOURCES = icalattendee.c \
41 icalcomponent.c \
42 icalderivedparameter.c \
43 icalderivedproperty.c \
44 icalderivedvalue.c \
45 icalduration.c \
46 icalenums.c \
47 icalerror.c \
48 icallangbind.c \
49 icallexer.c \
50 icalmemory.c \
51 icalmime.c \
52 icalparameter.c \
53 icalparser.c \
54 icalperiod.c \
55 icalproperty.c \
56 icalrecur.c \
57 icalrestriction.c \
58 icaltime.c \
59 icaltypes.c \
60 icalvalue.c \
61 icalyacc.c \
62 pvl.c \
63 sspm.c \
64 vsnprintf.c
65
66 INTERFACES=
67
68INCLUDEPATH += .
diff --git a/libical/src/libical/libicalE.pro b/libical/src/libical/libicalE.pro
new file mode 100644
index 0000000..2b9b720
--- a/dev/null
+++ b/libical/src/libical/libicalE.pro
@@ -0,0 +1,66 @@
1 TEMPLATE= lib
2 CONFIG = warn_on staticlib
3
4INCLUDEPATH += .
5OBJECTS_DIR = obj/$(PLATFORM)
6MOC_DIR = moc/$(PLATFORM)
7DESTDIR=../../lib/$(PLATFORM)
8TARGET = ical
9INTERFACES = \
10
11HEADERS = \
12 ical.h \
13 icalattendee.h \
14 icalcomponent.h \
15 icalderivedparameter.h \
16 icalderivedproperty.h \
17 icalderivedvalue.h \
18 icalduration.h \
19 icalenums.h \
20 icalerror.h \
21 icallangbind.h \
22 icalmemory.h \
23 icalmime.h \
24 icalparameter.h \
25 icalparameterimpl.h \
26 icalparser.h \
27 icalperiod.h \
28 icalproperty.h \
29 icalrecur.h \
30 icalrestriction.h \
31 icaltime.h \
32 icaltypes.h \
33 icalvalue.h \
34 icalvalueimpl.h \
35 icalversion.h \
36 icalyacc.h \
37 pvl.h \
38 sspm.h \
39
40SOURCES = \
41 icalattendee.c \
42 icalcomponent.c \
43 icalderivedparameter.c \
44 icalderivedproperty.c \
45 icalderivedvalue.c \
46 icalduration.c \
47 icalenums.c \
48 icalerror.c \
49 icallangbind.c \
50 icallexer.c \
51 icalmemory.c \
52 icalmime.c \
53 icalparameter.c \
54 icalparser.c \
55 icalperiod.c \
56 icalproperty.c \
57 icalrecur.c \
58 icalrestriction.c \
59 icaltime.c \
60 icaltypes.c \
61 icalvalue.c \
62 icalyacc.c \
63 pvl.c \
64 sspm.c \
65 vsnprintf.c \
66
diff --git a/libical/src/libical/pvl.c b/libical/src/libical/pvl.c
new file mode 100644
index 0000000..2a733e8
--- a/dev/null
+++ b/libical/src/libical/pvl.c
@@ -0,0 +1,761 @@
1/*======================================================================
2 FILE: pvl.c
3 CREATOR: eric November, 1995
4
5
6 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
7======================================================================*/
8
9#ifdef HAVE_CONFIG_H
10#include "config.h"
11#endif
12
13#include "pvl.h"
14#include <errno.h>
15#include <assert.h>
16#include <stdlib.h>
17
18
19
20/*
21 struct pvl_list_t
22
23 The list structure. This is the hanlde for the entire list
24
25 This type is also private. Use pvl_list instead
26
27 */
28
29typedef struct pvl_list_t
30{
31 int MAGIC; /* Magic Identifier */
32 struct pvl_elem_t *head;/* Head of list */
33 struct pvl_elem_t *tail;/* Tail of list */
34 int count; /* Number of items in the list */
35 struct pvl_elem_t *p; /* Pointer used for iterators */
36} pvl_list_t;
37
38
39
40
41/* This global is incremented for each call to pvl_new_element(); it gives each
42 * list a unique identifer */
43
44int pvl_elem_count = 0;
45int pvl_list_count = 0;
46
47
48/*----------------------------------------------------------------------
49 Function: pvl_list pvl_newlist()
50
51 Purpose:
52
53 Creates a new list, clears the pointers and assigns a magic number
54
55 Returns:
56
57 Pointer to the new list
58 0 if there is no available memory.
59 *----------------------------------------------------------------------*/
60
61pvl_list
62pvl_newlist()
63{
64 struct pvl_list_t *L;
65
66 if ( ( L = (struct pvl_list_t*)malloc(sizeof(struct pvl_list_t))) == 0)
67 {
68 errno = ENOMEM;
69 return 0;
70 }
71
72 L->MAGIC = pvl_list_count;
73 pvl_list_count++;
74 L->head = 0;
75 L->tail = 0;
76 L->count = 0;
77 L->p = 0;
78
79 return L;
80}
81
82void
83pvl_free(pvl_list l)
84{
85 struct pvl_list_t *L = (struct pvl_list_t *)l;
86
87 pvl_clear(l);
88
89 free(L);
90}
91
92/*----------------------------------------------------------------------
93 Function: pvl_new_element(void *d, struct pvl_elem_t *next,struct pvl_elem_t *prior)
94
95 Purpose:
96 Creates a new list element, assigns a magic number, and assigns
97 the next and previous pointers.
98
99 Passing in the next and previous points may seem odd, but it allos the user
100 to set them while keeping the internal data hidden. In nearly all cases,
101 the user is the pvl library itself.
102
103 Parameters:
104
105 dThe data item to be stored in the list
106 next Pointer value to assign to the member "next"
107 prior Pointer value to assign to the member "prior"
108
109 Returns:
110
111 A pointer to the new element.
112 0 if there is no memory available.
113
114 *----------------------------------------------------------------------*/
115
116pvl_elem
117pvl_new_element(void *d, pvl_elem next,pvl_elem prior)
118{
119 struct pvl_elem_t *E;
120
121 if ( ( E = (struct pvl_elem_t*)malloc(sizeof(struct pvl_elem_t))) == 0)
122 {
123 errno = ENOMEM;
124 return 0;
125 }
126
127 E->MAGIC = pvl_elem_count++;
128 E->d = d;
129 E->next = next;
130 E->prior = prior;
131
132 return (pvl_elem)E;
133}
134
135/*----------------------------------------------------------------------
136 Function: pvl_unshift(pvl_list l,void *d)
137
138 Purpose:
139
140 Add a new element to the from of the list
141
142 Parameters:
143
144 lThe list to add the item to
145 dPointer to the item to add
146
147 Returns:
148 *----------------------------------------------------------------------*/
149
150void
151pvl_unshift(pvl_list l,void *d)
152{
153 struct pvl_list_t *L = (struct pvl_list_t *)l;
154 struct pvl_elem_t *E = pvl_new_element(d,L->head,0);
155
156 if (E->next != 0)
157 {
158 /* Link the head node to it */
159 E->next->prior = E;
160 }
161
162 /* move the head */
163 L->head = E;
164
165 /* maybe move the tail */
166
167 if (L->tail == 0)
168 {
169 L->tail = E;
170 }
171
172 L->count++;
173}
174
175/*----------------------------------------------------------------------
176 Function: pvl_shift(pvl_list l)
177
178 Purpose:
179
180 Remove an element from the front of the list
181
182 Parameters:
183
184 lThe list to operate on
185
186 Returns:
187 *----------------------------------------------------------------------*/
188
189void*
190pvl_shift(pvl_list l)
191{
192 struct pvl_list_t *L = (struct pvl_list_t *)l;
193
194 if (L->head == 0)
195 {
196 return 0;
197 }
198
199 return pvl_remove(l,(void*)L->head);
200
201}
202
203/*----------------------------------------------------------------------
204 Function: void pvl_push(pvl_list l,void *d)
205
206 Purpose:
207
208 Add a new item to the tail of the list
209
210 Paramters:
211
212 lThe list to operate on
213 dPointer to the item to add
214
215 Returns:
216 *----------------------------------------------------------------------*/
217
218void
219pvl_push(pvl_list l,void *d)
220{
221 struct pvl_list_t *L = (struct pvl_list_t *)l;
222 struct pvl_elem_t *E = pvl_new_element(d,0,L->tail);
223
224 /* These are done in pvl_new_element
225 E->next = 0;
226 E->prior = L->tail;
227 */
228
229 if (L->tail != 0)
230 {
231 L->tail->next = E;
232 }
233
234 if (L->head == 0)
235 {
236 L->head = E;
237 }
238
239 L->tail = E;
240
241 L->count++;
242
243}
244
245/*----------------------------------------------------------------------
246 Function: void* pvl_pop(pvl_list l)
247
248 Purpose:
249
250 Remove an element from the tail of the list
251
252 Paramters:
253
254 lThe list to operate on
255
256 Returns:
257 *----------------------------------------------------------------------*/
258
259void*
260pvl_pop(pvl_list l)
261{
262
263 struct pvl_list_t *L = (struct pvl_list_t *)l;
264
265 if ( L->tail == 0)
266 {
267 return 0;
268 }
269
270 return pvl_remove(l,(void*) L->tail);;
271
272}
273
274
275/*----------------------------------------------------------------------
276 Function: void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
277
278 Purpose:
279
280 Add a new item to a list that is ordered by a comparison function.
281 This routine assumes that the list is properly ordered.
282
283 lThe list to operate on
284 fPointer to a comparison function
285 d Pointer to data to pass to the comparison function
286
287 Returns:
288
289 void
290
291 *----------------------------------------------------------------------*/
292
293void
294pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d)
295{
296 struct pvl_list_t *L = (struct pvl_list_t *)l;
297
298 struct pvl_elem_t *P;
299
300 L->count++;
301
302 /* Empty list, add to head */
303
304 if(L->head == 0)
305 {
306 pvl_unshift(l,d);
307 return;
308 }
309
310 /* smaller than head, add to head */
311
312 if ( ((*f)(d,L->head->d)) <= 0)
313 {
314 pvl_unshift(l,d);
315 return;
316 }
317
318 /* larger than tail, add to tail */
319 if ( (*f)(d,L->tail->d) >= 0)
320 {
321 pvl_push(l,d);
322 return;
323 }
324
325
326 /* Search for the first element that is smaller, and add before it */
327
328 for (P=L->head; P != 0; P = P->next)
329 {
330 if ( (*f)(P->d,d) >= 0)
331 {
332 pvl_insert_before(l,P,d);
333 return;
334 }
335 }
336
337 /* badness, choke */
338
339 assert(0);
340
341}
342
343/*----------------------------------------------------------------------
344 Function: void pvl_insert_after(pvl_list l,pvl_elem p,void *d)
345
346 Purpose:
347
348 Add a new item after the referenced element.
349
350 Parameters:
351
352 lThe list to operate on
353 pThe list element to add the item after
354 dPointer to the item to add.
355
356 Returns:
357
358 void
359
360 *----------------------------------------------------------------------*/
361
362void
363pvl_insert_after(pvl_list l,pvl_elem p,void *d)
364{
365 struct pvl_list_t *L = (struct pvl_list_t *)l;
366 struct pvl_elem_t *P = (struct pvl_elem_t *)p;
367 struct pvl_elem_t *E = 0;
368
369 L->count++;
370
371 if (P == 0)
372 {
373 pvl_unshift(l,d);
374 return;
375 }
376
377 if ( P == L->tail)
378 {
379 E = pvl_new_element(d,0,P);
380 L->tail = E;
381 E->prior->next = E;
382 }
383 else
384 {
385 E = pvl_new_element(d,P->next,P);
386 E->next->prior = E;
387 E->prior->next = E;
388 }
389}
390
391/*----------------------------------------------------------------------
392 Function: void pvl_insert_before(pvl_list l,pvl_elem p,void *d)
393
394 Purpose:
395
396 Add an item after a referenced item
397
398 Parameters:
399
400 lThe list to operate on
401 pThe list element to add the item before
402 dPointer to the data to be added.
403
404 Returns:
405 *----------------------------------------------------------------------*/
406
407void
408pvl_insert_before(pvl_list l,pvl_elem p,void *d)
409{
410 struct pvl_list_t *L = (struct pvl_list_t *)l;
411 struct pvl_elem_t *P = (struct pvl_elem_t *)p;
412 struct pvl_elem_t *E = 0;
413
414 L->count++;
415
416 if (P == 0)
417 {
418 pvl_unshift(l,d);
419 return;
420 }
421
422 if ( P == L->head)
423 {
424 E = pvl_new_element(d,P,0);
425 E->next->prior = E;
426 L->head = E;
427 }
428 else
429 {
430 E = pvl_new_element(d,P,P->prior);
431 E->prior->next = E;
432 E->next->prior = E;
433 }
434}
435
436/*----------------------------------------------------------------------
437 Function: void pvl_remove(pvl_list l,pvl_elem e)
438
439 Purpose:
440
441 Remove the referenced item from the list
442
443 This routine will free the element, but not the data item that the
444 element contains.
445
446 Parameters:
447
448 lThe list to operate on
449 eThe element to remove.
450
451 Returns:
452 *----------------------------------------------------------------------*/
453
454void*
455pvl_remove(pvl_list l,pvl_elem e)
456{
457 struct pvl_list_t *L = (struct pvl_list_t *)l;
458 struct pvl_elem_t *E = (struct pvl_elem_t *)e;
459 void* data;
460
461 if (E == L->head)
462 {
463 if (E->next != 0)
464 {
465 E->next->prior = 0;
466 L->head = E->next;
467 } else {
468 /* E Also points to tail -> only one element in list */
469 L->tail = 0;
470 L->head = 0;
471 }
472 }
473 else if (E == L->tail)
474 {
475 if (E->prior != 0)
476 {
477 E->prior->next = 0;
478 L->tail = E->prior;
479 } else {
480 /* E points to the head, so it was the last element */
481 /* This case should be taken care of in the previous clause */
482 L->head = 0;
483 L->tail = 0;
484 }
485 }
486 else
487 {
488 E->prior->next = E->next;
489 E->next->prior = E->prior;
490 }
491
492
493 L->count--;
494
495 data = E->d;
496
497 E->prior = 0;
498 E->next = 0;
499 E->d = 0;
500
501 free(E);
502
503 return data;
504
505}
506
507/*----------------------------------------------------------------------
508 Function: pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v)
509
510 Purpose:
511
512 Return a pointer to data that satisfies a function
513
514 This routine will interate through the entire list and call the
515 find function for each item. It will break and return a pointer to the
516 data that causes the find function to return 1.
517
518 Parameters:
519
520 lThe list to operate on
521 fPointer to the find function
522 vPointer to constant data to pass into the function
523
524 Returns:
525
526 Pointer to the element that the find function found.
527
528 *----------------------------------------------------------------------*/
529
530pvl_elem
531pvl_find(pvl_list l,pvl_findf f,void* v)
532{
533 pvl_elem e;
534
535 for (e=pvl_head(l); e!= 0; e = pvl_next(e))
536 {
537 if ( (*f)(((struct pvl_elem_t *)e)->d,v) == 1)
538 {
539 /* Save this elem for a call to find_next */
540 ((struct pvl_list_t *)l)->p = e;
541 return e;
542 }
543 }
544
545 return 0;
546
547}
548/*----------------------------------------------------------------------
549 Function: void* pvl_find_next(pvl_list l,pvl_findf f,void* v)
550
551 Purpose:
552
553 Like pvl_find(), but continues the search where the last find() or
554 find_next() left off
555
556 Parameters:
557
558 lThe list to operate on
559 fPointer to the find function
560 vPointer to constant data to pass into the function
561
562 Returns:
563
564 Pointer to the element that the find function found.
565
566 *----------------------------------------------------------------------*/
567
568pvl_elem
569pvl_find_next(pvl_list l,pvl_findf f,void* v)
570{
571
572 pvl_elem e;
573
574 for (e=pvl_head(l); e!= 0; e = pvl_next(e))
575 {
576 if ( (*f)(((struct pvl_elem_t *)e)->d,v) == 1)
577 {
578 /* Save this elem for a call to find_next */
579 ((struct pvl_list_t *)l)->p = e;
580 return e;
581 }
582 }
583
584 return 0;
585
586}
587
588/*----------------------------------------------------------------------
589 Function: void pvl_clear(pvl_list l)
590
591 Purpose:
592
593 Remove the all the elements in the list. The does not free the data items
594 the elements hold.
595
596
597 Returns:
598 *----------------------------------------------------------------------*/
599
600void
601pvl_clear(pvl_list l)
602{
603 pvl_elem e = pvl_head(l);
604 pvl_elem next;
605
606 if (e == 0) {
607 return;
608 }
609
610 while(e != 0)
611 {
612 next = pvl_next(e);
613 pvl_remove(l,e);
614 e = next;
615 }
616}
617
618/*----------------------------------------------------------------------
619 Function: int pvl_count(pvl_list l)
620
621 Purpose:
622
623 Returns the number of items in the list.
624
625 Returns:
626 *----------------------------------------------------------------------*/
627
628int
629pvl_count(pvl_list l)
630{
631 struct pvl_list_t *L = (struct pvl_list_t *)l;
632
633 return L->count;
634}
635
636
637/*----------------------------------------------------------------------
638 Function: pvl_elem pvl_next(pvl_elem e)
639
640 Purpose:
641 Returns a pointer to the given element
642
643 Returns:
644 *----------------------------------------------------------------------*/
645
646pvl_elem
647pvl_next(pvl_elem e)
648{
649 struct pvl_elem_t *E = (struct pvl_elem_t *)e;
650
651 if (E == 0){
652 return 0;
653 }
654
655 return (pvl_elem)E->next;
656}
657
658/*----------------------------------------------------------------------
659 Function: pvl_elem pvl_prior(pvl_elem e)
660
661 Purpose:
662
663 Returns a pointer to the element previous to the element given.
664
665 Returns:
666 *----------------------------------------------------------------------*/
667
668pvl_elem
669pvl_prior(pvl_elem e)
670{
671 struct pvl_elem_t *E = (struct pvl_elem_t *)e;
672
673 return (pvl_elem)E->prior;
674}
675
676/*----------------------------------------------------------------------
677 Function: pvl_elem pvl_head(pvl_list l )
678
679 Purpose:
680
681 Returns a pointer to the first item in the list.
682
683 Returns:
684 *----------------------------------------------------------------------*/
685pvl_elem
686pvl_head(pvl_list l )
687{
688 struct pvl_list_t *L = (struct pvl_list_t *)l;
689
690 return (pvl_elem)L->head;
691}
692
693/*----------------------------------------------------------------------
694 Function: pvl_elem pvl_tail(pvl_list l)
695
696 Purpose:
697
698 Returns a pointer to the last item in the list.
699
700 Returns:
701 *----------------------------------------------------------------------*/
702pvl_elem
703pvl_tail(pvl_list l)
704{
705 struct pvl_list_t *L = (struct pvl_list_t *)l;
706 return (pvl_elem)L->tail;
707}
708
709/*----------------------------------------------------------------------
710 Function:
711
712
713 Purpose:
714
715
716 Returns:
717 *----------------------------------------------------------------------*/
718
719#ifndef PVL_USE_MACROS
720void*
721pvl_data(pvl_elem e)
722{
723 struct pvl_elem_t *E = (struct pvl_elem_t *)e;
724
725 if ( e == 0){
726 return 0;
727 }
728
729 return E->d;
730}
731#endif
732
733/*----------------------------------------------------------------------
734 Function: void pvl_apply(pvl_list l,pvl_applyf f, void *v)
735
736 Purpose:
737
738 Call a function for every item in the list.
739
740 Paramters:
741
742 lThe list to operate on
743 fPointer to the function to call
744 vData to pass to the function on every iteration
745
746 Returns:
747
748 void
749 *----------------------------------------------------------------------*/
750
751void
752pvl_apply(pvl_list l,pvl_applyf f, void *v)
753{
754 pvl_elem e;
755
756 for (e=pvl_head(l); e!= 0; e = pvl_next(e))
757 {
758 (*f)(((struct pvl_elem_t *)e)->d,v);
759 }
760
761}
diff --git a/libical/src/libical/pvl.h b/libical/src/libical/pvl.h
new file mode 100644
index 0000000..14a15a1
--- a/dev/null
+++ b/libical/src/libical/pvl.h
@@ -0,0 +1,94 @@
1/*======================================================================
2 FILE: pvl.h
3 CREATOR: eric November, 1995
4
5
6 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
7======================================================================*/
8
9
10#ifndef __PVL_H__
11#define __PVL_H__
12
13typedef void* pvl_list;
14typedef void* pvl_elem;
15
16/*
17 struct pvl_elem_t
18
19 This type is private. Always use pvl_elem instead. The struct would
20 not even appear in this header except to make code in the USE_MACROS
21 blocks work
22
23 */
24typedef struct pvl_elem_t
25{
26 int MAGIC; /* Magic Identifier */
27 void *d; /* Pointer to data user is storing */
28 struct pvl_elem_t *next;/* Next element */
29 struct pvl_elem_t *prior;/* prior element */
30} pvl_elem_t;
31
32
33
34/* This global is incremented for each call to pvl_new_element(); it gives each
35 * list a unique identifer */
36
37extern int pvl_elem_count;
38extern int pvl_list_count;
39
40/* Create new lists or elements */
41pvl_elem pvl_new_element(void* d, pvl_elem next,pvl_elem prior);
42pvl_list pvl_newlist(void);
43void pvl_free(pvl_list);
44
45/* Add, remove, or get the head of the list */
46void pvl_unshift(pvl_list l,void *d);
47void* pvl_shift(pvl_list l);
48pvl_elem pvl_head(pvl_list);
49
50/* Add, remove or get the tail of the list */
51void pvl_push(pvl_list l,void *d);
52void* pvl_pop(pvl_list l);
53pvl_elem pvl_tail(pvl_list);
54
55/* Insert elements in random places */
56typedef int (*pvl_comparef)(void* a, void* b); /* a, b are of the data type*/
57void pvl_insert_ordered(pvl_list l,pvl_comparef f,void *d);
58void pvl_insert_after(pvl_list l,pvl_elem e,void *d);
59void pvl_insert_before(pvl_list l,pvl_elem e,void *d);
60
61/* Remove an element, or clear the entire list */
62void* pvl_remove(pvl_list,pvl_elem); /* Remove element, return data */
63void pvl_clear(pvl_list); /* Remove all elements, de-allocate all data */
64
65int pvl_count(pvl_list);
66
67/* Navagate the list */
68pvl_elem pvl_next(pvl_elem e);
69pvl_elem pvl_prior(pvl_elem e);
70
71/* get the data in the list */
72#ifndef PVL_USE_MACROS
73void* pvl_data(pvl_elem);
74#else
75#define pvl_data(x) x==0 ? 0 : ((struct pvl_elem_t *)x)->d;
76#endif
77
78
79/* Find an element for which a function returns true */
80typedef int (*pvl_findf)(void* a, void* b); /*a is list elem, b is other data*/
81pvl_elem pvl_find(pvl_list l,pvl_findf f,void* v);
82pvl_elem pvl_find_next(pvl_list l,pvl_findf f,void* v);
83
84/* Pass each element in the list to a function */
85typedef void (*pvl_applyf)(void* a, void* b); /*a is list elem, b is other data*/
86void pvl_apply(pvl_list l,pvl_applyf f, void *v);
87
88
89#endif /* __PVL_H__ */
90
91
92
93
94
diff --git a/libical/src/libical/sspm.c b/libical/src/libical/sspm.c
new file mode 100644
index 0000000..2df581b
--- a/dev/null
+++ b/libical/src/libical/sspm.c
@@ -0,0 +1,1621 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: sspm.c Parse Mime
4 CREATOR: eric 25 June 2000
5
6 $Id$
7 $Locker$
8
9 The contents of this file are subject to the Mozilla Public License
10 Version 1.0 (the "License"); you may not use this file except in
11 compliance with the License. You may obtain a copy of the License at
12 http://www.mozilla.org/MPL/
13
14 Software distributed under the License is distributed on an "AS IS"
15 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16 the License for the specific language governing rights and
17 limitations under the License.
18
19
20 This program is free software; you can redistribute it and/or modify
21 it under the terms of either:
22
23 The LGPL as published by the Free Software Foundation, version
24 2.1, available at: http://www.fsf.org/copyleft/lesser.html
25
26 Or:
27
28 The Mozilla Public License Version 1.0. You may obtain a copy of
29 the License at http://www.mozilla.org/MPL/
30
31 The Initial Developer of the Original Code is Eric Busboom
32
33 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
34 ======================================================================*/
35
36#include <stdio.h>
37#include <string.h>
38#include "sspm.h"
39#include <assert.h>
40#include <ctype.h> /* for tolower */
41#include <stdlib.h> /* for malloc, free */
42#include <string.h> /* for strcasecmp */
43
44// Eugen C. <eug@thekompany.com>
45#ifdef _WIN32
46#define strcasecmp _stricmp
47#endif
48// Eugen C. <eug@thekompany.com>
49
50int snprintf(char *str, size_t n, char const *fmt, ...);
51
52#ifdef DMALLOC
53#include "dmalloc.h"
54#endif
55
56#define TMP_BUF_SIZE 1024
57
58
59enum mime_state {
60 UNKNOWN_STATE,
61 IN_HEADER,
62 END_OF_HEADER,
63 IN_BODY,
64 OPENING_PART,
65 END_OF_PART,
66 TERMINAL_END_OF_PART,
67 END_OF_INPUT
68};
69
70struct mime_impl{
71 struct sspm_part *parts;
72 size_t max_parts;
73 int part_no;
74 int level;
75 struct sspm_action_map *actions;
76 char* (*get_string)(char *s, size_t size, void* data);
77 void* get_string_data;
78 char temp[TMP_BUF_SIZE];
79 enum mime_state state;
80};
81
82void sspm_free_header(struct sspm_header *header);
83void* sspm_make_multipart_part(struct mime_impl *impl,struct sspm_header *header);
84void sspm_read_header(struct mime_impl *impl,struct sspm_header *header);
85
86char* sspm_strdup(char* str){
87
88 char* s;
89
90 s = strdup(str);
91
92 return s;
93}
94
95
96struct major_content_type_map
97{
98 enum sspm_major_type type;
99 char* str;
100
101} major_content_type_map[] =
102{
103 {SSPM_MULTIPART_MAJOR_TYPE,"multipart" },
104 {SSPM_TEXT_MAJOR_TYPE,"text" },
105 {SSPM_TEXT_MAJOR_TYPE,"text" },
106 {SSPM_IMAGE_MAJOR_TYPE,"image" },
107 {SSPM_AUDIO_MAJOR_TYPE,"audio" },
108 {SSPM_VIDEO_MAJOR_TYPE,"video" },
109 {SSPM_APPLICATION_MAJOR_TYPE,"application" },
110 {SSPM_MULTIPART_MAJOR_TYPE,"multipart" },
111 {SSPM_MESSAGE_MAJOR_TYPE,"message" },
112 {SSPM_UNKNOWN_MAJOR_TYPE,"" },
113};
114
115struct minor_content_type_map
116{
117 enum sspm_minor_type type;
118 char* str;
119
120} minor_content_type_map[] =
121{
122 {SSPM_ANY_MINOR_TYPE,"*" },
123 {SSPM_PLAIN_MINOR_TYPE,"plain" },
124 {SSPM_RFC822_MINOR_TYPE,"rfc822" },
125 {SSPM_DIGEST_MINOR_TYPE,"digest" },
126 {SSPM_CALENDAR_MINOR_TYPE,"calendar" },
127 {SSPM_MIXED_MINOR_TYPE,"mixed" },
128 {SSPM_RELATED_MINOR_TYPE,"related" },
129 {SSPM_ALTERNATIVE_MINOR_TYPE,"alternative" },
130 {SSPM_PARALLEL_MINOR_TYPE, "parallel" },
131 {SSPM_UNKNOWN_MINOR_TYPE,"" }
132};
133
134
135
136struct encoding_map {
137 enum sspm_encoding encoding;
138 char* str;
139} sspm_encoding_map[] =
140{
141 {SSPM_NO_ENCODING,""},
142 {SSPM_QUOTED_PRINTABLE_ENCODING,"quoted-printable"},
143 {SSPM_8BIT_ENCODING,"8bit"},
144 {SSPM_7BIT_ENCODING,"7bit"},
145 {SSPM_BINARY_ENCODING,"binary"},
146 {SSPM_BASE64_ENCODING,"base64"},
147 {SSPM_UNKNOWN_ENCODING,""}
148
149};
150
151
152char* sspm_get_parameter(char* line, char* parameter)
153{
154 char *p,*s,*q;
155 static char name[1024];
156
157 /* Find where the parameter name is in the line */
158 p = strstr(line,parameter);
159
160 if( p == 0){
161 return 0;
162 }
163
164 /* skip over the parameter name, the '=' and any blank spaces */
165
166 p+=strlen(parameter);
167
168 while(*p==' ' || *p == '='){
169 p++;
170 }
171
172 /*now find the next semicolon*/
173
174 s = strchr(p,';');
175
176 /* Strip of leading quote */
177 q = strchr(p,'\"');
178
179 if(q !=0){
180 p = q+1;
181 }
182
183 if(s != 0){
184 strncpy(name,p,(size_t)s-(size_t)p);
185 } else {
186 strcpy(name,p);
187 }
188
189 /* Strip off trailing quote, if it exists */
190
191 q = strrchr(name,'\"');
192
193 if (q != 0){
194 *q='\0';
195 }
196
197 return name;
198}
199
200char* sspm_property_name(char* line)
201{
202 static char name[1024];
203 char *c = strchr(line,':');
204
205 if(c != 0){
206 strncpy(name,line,(size_t)c-(size_t)line);
207 name[(size_t)c-(size_t)line] = '\0';
208 return name;
209 } else {
210 return 0;
211 }
212}
213
214char* sspm_value(char* line)
215{
216 static char value[1024];
217
218 char *c,*s, *p;
219
220 /* Find the first colon and the next semicolon */
221
222 c = strchr(line,':');
223 s = strchr(c,';');
224
225 /* Skip the colon */
226 c++;
227
228 if (s == 0){
229 s = c+strlen(line);
230 }
231
232 for(p=value; c != s; c++){
233 if(*c!=' ' && *c!='\n'){
234 *(p++) = *c;
235 }
236 }
237
238 *p='\0';
239
240 return value;
241
242}
243
244char *mime_headers[] = {
245 "Content-Type",
246 "Content-Transfer-Encoding",
247 "Content-Disposition",
248 "Content-Id",
249 "Mime-Version",
250 0
251};
252
253
254void* sspm_default_new_part()
255{
256 return 0;
257}
258void sspm_default_add_line(void *part, struct sspm_header *header,
259 char* line, size_t size)
260{
261}
262
263void* sspm_default_end_part(void* part)
264{
265 return 0;
266}
267
268void sspm_default_free_part(void *part)
269{
270}
271
272
273
274struct sspm_action_map sspm_action_map[] =
275{
276 {SSPM_UNKNOWN_MAJOR_TYPE,SSPM_UNKNOWN_MINOR_TYPE,sspm_default_new_part,sspm_default_add_line,sspm_default_end_part,sspm_default_free_part},
277};
278
279int sspm_is_mime_header(char *line)
280{
281 char *name = sspm_property_name(line);
282 int i;
283
284 if(name == 0){
285 return 0;
286 }
287
288 for(i = 0; mime_headers[i] != 0; i++){
289 if(strcasecmp(name, mime_headers[i]) == 0)
290 return 1;
291 }
292
293 return 0;
294}
295
296int sspm_is_mail_header(char* line)
297{
298 char *name = sspm_property_name(line);
299
300 if (name != 0){
301 return 1;
302 }
303
304 return 0;
305
306}
307
308int sspm_is_blank(char* line)
309{
310 char *p;
311 char c =0;
312
313 for(p=line; *p!=0; p++){
314 if( ! (*p == ' '|| *p == '\t' || *p=='\n') ){
315 c++;
316 }
317 }
318
319 if (c==0){
320 return 1;
321 }
322
323 return 0;
324
325}
326
327int sspm_is_continuation_line(char* line)
328{
329 if (line[0] == ' '|| line[0] == '\t' ) {
330 return 1;
331 }
332
333 return 0;
334}
335
336int sspm_is_mime_boundary(char *line)
337{
338 if( line[0] == '-' && line[1] == '-') {
339 return 1;
340 }
341
342 return 0;
343}
344
345int sspm_is_mime_terminating_boundary(char *line)
346{
347
348
349 if (sspm_is_mime_boundary(line) &&
350 strstr(line,"--\n")){
351 return 1;
352 }
353
354 return 0;
355}
356
357enum line_type {
358 EMPTY,
359 BLANK,
360 MIME_HEADER,
361 MAIL_HEADER,
362 HEADER_CONTINUATION,
363 BOUNDARY,
364 TERMINATING_BOUNDARY,
365 UNKNOWN_TYPE
366};
367
368
369enum line_type get_line_type(char* line){
370
371 if (line == 0){
372 return EMPTY;
373 } else if(sspm_is_blank(line)){
374 return BLANK;
375 } else if (sspm_is_mime_header(line)){
376 return MIME_HEADER;
377 } else if (sspm_is_mail_header(line)){
378 return MAIL_HEADER;
379 } else if (sspm_is_continuation_line(line)){
380 return HEADER_CONTINUATION;
381 } else if (sspm_is_mime_terminating_boundary(line)){
382 return TERMINATING_BOUNDARY;
383 } else if (sspm_is_mime_boundary(line)) {
384 return BOUNDARY;
385 } else {
386 return UNKNOWN_TYPE;
387 }
388
389
390}
391
392
393struct sspm_action_map get_action(struct mime_impl *impl,
394 enum sspm_major_type major,
395 enum sspm_minor_type minor)
396{
397 int i;
398
399 /* Read caller suppled action map */
400
401 if (impl->actions != 0){
402 for(i=0; impl->actions[i].major != SSPM_UNKNOWN_MAJOR_TYPE; i++){
403 if((major == impl->actions[i].major &&
404 minor == impl->actions[i].minor) ||
405 (major == impl->actions[i].major &&
406 minor == SSPM_ANY_MINOR_TYPE)){
407 return impl->actions[i];
408 }
409 }
410 }
411
412 /* Else, read default action map */
413
414 for(i=0; sspm_action_map[i].major != SSPM_UNKNOWN_MAJOR_TYPE; i++){
415 if((major == sspm_action_map[i].major &&
416 minor == sspm_action_map[i].minor) ||
417 (major == sspm_action_map[i].major &&
418 minor == SSPM_ANY_MINOR_TYPE)){
419 break;
420 }
421 }
422
423 return sspm_action_map[i];
424}
425
426
427char* sspm_lowercase(char* str)
428{
429 char* p = 0;
430 char* new = sspm_strdup(str);
431
432 if(str ==0){
433 return 0;
434 }
435
436 for(p = new; *p!=0; p++){
437 *p = tolower(*p);
438 }
439
440 return new;
441}
442
443enum sspm_major_type sspm_find_major_content_type(char* type)
444{
445 int i;
446
447 char* ltype = sspm_lowercase(type);
448
449 for (i=0; major_content_type_map[i].type != SSPM_UNKNOWN_MINOR_TYPE; i++){
450 if(strncmp(ltype, major_content_type_map[i].str,
451 strlen(major_content_type_map[i].str))==0){
452 free(ltype);
453 return major_content_type_map[i].type;
454 }
455 }
456 free(ltype);
457 return major_content_type_map[i].type; /* Should return SSPM_UNKNOWN_MINOR_TYPE */
458}
459
460enum sspm_minor_type sspm_find_minor_content_type(char* type)
461{
462 int i;
463 char* ltype = sspm_lowercase(type);
464
465 char *p = strchr(ltype,'/');
466
467 if (p==0){
468 return SSPM_UNKNOWN_MINOR_TYPE;
469 }
470
471 p++; /* Skip the '/' */
472
473 for (i=0; minor_content_type_map[i].type != SSPM_UNKNOWN_MINOR_TYPE; i++){
474 if(strncmp(p, minor_content_type_map[i].str,
475 strlen(minor_content_type_map[i].str))==0){
476 free(ltype);
477 return minor_content_type_map[i].type;
478 }
479 }
480
481 free(ltype);
482 return minor_content_type_map[i].type; /* Should return SSPM_UNKNOWN_MINOR_TYPE */
483}
484
485char* sspm_major_type_string(enum sspm_major_type type)
486{
487 int i;
488
489 for (i=0; major_content_type_map[i].type != SSPM_UNKNOWN_MINOR_TYPE;
490 i++){
491
492 if(type == major_content_type_map[i].type){
493 return major_content_type_map[i].str;
494 }
495 }
496
497 return major_content_type_map[i].str; /* Should return SSPM_UNKNOWN_MINOR_TYPE */
498}
499
500char* sspm_minor_type_string(enum sspm_minor_type type)
501{
502 int i;
503 for (i=0; minor_content_type_map[i].type != SSPM_UNKNOWN_MINOR_TYPE;
504 i++){
505 if(type == minor_content_type_map[i].type){
506 return minor_content_type_map[i].str;
507 }
508 }
509
510 return minor_content_type_map[i].str; /* Should return SSPM_UNKNOWN_MINOR_TYPE */
511}
512
513
514char* sspm_encoding_string(enum sspm_encoding type)
515{
516 int i;
517 for (i=0; sspm_encoding_map[i].encoding != SSPM_UNKNOWN_ENCODING;
518 i++){
519 if(type == sspm_encoding_map[i].encoding){
520 return sspm_encoding_map[i].str;
521 }
522 }
523
524 return sspm_encoding_map[i].str; /* Should return SSPM_UNKNOWN_MINOR_TYPE */
525}
526
527/* Interpret a header line and add its data to the header
528 structure. */
529void sspm_build_header(struct sspm_header *header, char* line)
530{
531 char *prop;
532 char *val;
533
534 val = sspm_strdup(sspm_value(line));
535 prop = sspm_strdup(sspm_property_name(line));
536
537 if(strcmp(prop,"Content-Type") == 0){
538
539 /* Create a new mime_header, fill in content-type
540 and possibly boundary */
541
542 char* boundary= sspm_get_parameter(line,"boundary");
543
544 header->def = 0;
545 header->major = sspm_find_major_content_type(val);
546 header->minor = sspm_find_minor_content_type(val);
547
548 if(header->minor == SSPM_UNKNOWN_MINOR_TYPE){
549 char *p = strchr(val,'/');
550
551 if (p != 0){
552 p++; /* Skip the '/' */
553
554 header->minor_text = sspm_strdup(p);
555 } else {
556 /* Error, malformed content type */
557 header->minor_text = sspm_strdup("unknown");
558 }
559 }
560 if (boundary != 0){
561 header->boundary = sspm_strdup(boundary);
562 }
563
564 } else if(strcmp(prop,"Content-Transfer-Encoding")==0){
565 char* encoding = sspm_value(line);
566 char* lencoding = sspm_lowercase(encoding);
567
568 if(strcmp(lencoding,"base64")==0){
569 header->encoding = SSPM_BASE64_ENCODING;
570 } else if(strcmp(lencoding,"quoted-printable")==0){
571 header->encoding = SSPM_QUOTED_PRINTABLE_ENCODING;
572 } else if(strcmp(lencoding,"binary")==0){
573 header->encoding = SSPM_BINARY_ENCODING;
574 } else if(strcmp(lencoding,"7bit")==0){
575 header->encoding = SSPM_7BIT_ENCODING;
576 } else if(strcmp(lencoding,"8bit")==0){
577 header->encoding = SSPM_8BIT_ENCODING;
578 } else {
579 header->encoding = SSPM_UNKNOWN_ENCODING;
580 }
581
582
583 free(lencoding);
584
585 header->def = 0;
586
587 } else if(strcmp(prop,"Content-Id")==0){
588 char* cid = sspm_value(line);
589 header->content_id = sspm_strdup(cid);
590 header->def = 0;
591
592 }
593 free(val);
594 free(prop);
595}
596
597char* sspm_get_next_line(struct mime_impl *impl)
598{
599 char* s;
600 s = impl->get_string(impl->temp,TMP_BUF_SIZE,impl->get_string_data);
601
602 if(s == 0){
603 impl->state = END_OF_INPUT;
604 }
605 return s;
606}
607
608
609void sspm_store_part(struct mime_impl *impl, struct sspm_header header,
610 int level, void *part, size_t size)
611{
612
613 impl->parts[impl->part_no].header = header;
614 impl->parts[impl->part_no].level = level;
615 impl->parts[impl->part_no].data = part;
616 impl->parts[impl->part_no].data_size = size;
617 impl->part_no++;
618}
619
620void sspm_set_error(struct sspm_header* header, enum sspm_error error,
621 char* message)
622{
623 header->error = error;
624
625 if(header->error_text!=0){
626 free(header->error_text);
627 }
628
629 header->def = 0;
630
631 if(message != 0){
632 header->error_text = sspm_strdup(message);
633 } else {
634 header->error_text = 0;
635 }
636
637}
638
639void* sspm_make_part(struct mime_impl *impl,
640 struct sspm_header *header,
641 struct sspm_header *parent_header,
642 void **end_part,
643 size_t *size)
644{
645
646 /* For a single part type, read to the boundary, if there is a
647 boundary. Otherwise, read until the end of input. This routine
648 assumes that the caller has read the header and has left the input
649 at the first blank line */
650
651 char *line;
652 void *part;
653 int end = 0;
654
655 struct sspm_action_map action = get_action(
656 impl,
657 header->major,
658 header->minor);
659
660 *size = 0;
661 part =action.new_part();
662
663 impl->state = IN_BODY;
664
665 while(end == 0 && (line = sspm_get_next_line(impl)) != 0){
666
667 if(sspm_is_mime_boundary(line)){
668
669 /* If there is a boundary, then this must be a multipart
670 part, so there must be a parent_header. */
671 if(parent_header == 0){
672 char* boundary;
673 end = 1;
674 *end_part = 0;
675
676 sspm_set_error(header,SSPM_UNEXPECTED_BOUNDARY_ERROR,line);
677
678 /* Read until the paired terminating boundary */
679 if((boundary = (char*)malloc(strlen(line)+5)) == 0){
680 fprintf(stderr,"Out of memory");
681 abort();
682 }
683 strcpy(boundary,line);
684 strcat(boundary,"--");
685 while((line = sspm_get_next_line(impl)) != 0){
686 /*printf("Error: %s\n",line);*/
687 if(strcmp(boundary,line)==0){
688 break;
689 }
690 }
691 free(boundary);
692
693 break;
694 }
695
696 if(strncmp((line+2),parent_header->boundary,
697 sizeof(parent_header->boundary)) == 0){
698 *end_part = action.end_part(part);
699
700 if(sspm_is_mime_boundary(line)){
701 impl->state = END_OF_PART;
702 } else if ( sspm_is_mime_terminating_boundary(line)){
703 impl->state = TERMINAL_END_OF_PART;
704 }
705 end = 1;
706 } else {
707 /* Error, this is not the correct terminating boundary*/
708
709 /* read and discard until we get the right boundary. */
710 char* boundary;
711 char msg[256];
712
713 snprintf(msg,256,
714 "Expected: %s--. Got: %s",
715 parent_header->boundary,line);
716
717 sspm_set_error(parent_header,
718 SSPM_WRONG_BOUNDARY_ERROR,msg);
719
720 /* Read until the paired terminating boundary */
721 if((boundary = (char*)malloc(strlen(line)+5)) == 0){
722 fprintf(stderr,"Out of memory");
723 abort();
724 }
725 strcpy(boundary,line);
726 strcat(boundary,"--");
727 while((line = sspm_get_next_line(impl)) != 0){
728 if(strcmp(boundary,line)==0){
729 break;
730 }
731 }
732 free(boundary);
733
734 }
735 } else {
736 char* data=0;
737 char* rtrn=0;
738 *size = strlen(line);
739
740 data = (char*)malloc(*size+2);
741 assert(data != 0);
742 if (header->encoding == SSPM_BASE64_ENCODING){
743 rtrn = decode_base64(data,line,size);
744 } else if(header->encoding == SSPM_QUOTED_PRINTABLE_ENCODING){
745 rtrn = decode_quoted_printable(data,line,size);
746 }
747
748 if(rtrn == 0){
749 strcpy(data,line);
750 }
751
752 /* add a end-of-string after the data, just in case binary
753 data from decode64 gets passed to a tring handling
754 routine in add_line */
755 data[*size+1]='\0';
756
757 action.add_line(part,header,data,*size);
758
759 free(data);
760 }
761 }
762
763 if (end == 0){
764 /* End the part if the input is exhausted */
765 *end_part = action.end_part(part);
766 }
767
768 return end_part;
769}
770
771
772void* sspm_make_multipart_subpart(struct mime_impl *impl,
773 struct sspm_header *parent_header)
774{
775 struct sspm_header header;
776 char *line;
777 void* part;
778 size_t size;
779
780 if(parent_header->boundary == 0){
781 /* Error. Multipart headers must have a boundary*/
782
783 sspm_set_error(parent_header,SSPM_NO_BOUNDARY_ERROR,0);
784 /* read all of the reamining lines */
785 while((line = sspm_get_next_line(impl)) != 0){
786 }
787
788 return 0;
789 }
790
791
792 /* Step 1: Read the opening boundary */
793
794 if(get_line_type(impl->temp) != BOUNDARY){
795 while((line=sspm_get_next_line(impl)) != 0 ){
796 if(sspm_is_mime_boundary(line)){
797
798 assert(parent_header != 0);
799
800 /* Check if it is the right boundary */
801 if(!sspm_is_mime_terminating_boundary(line) &&
802 strncmp((line+2),parent_header->boundary,
803 sizeof(parent_header->boundary))
804 == 0){
805 /* The +2 in strncmp skips over the leading "--" */
806
807 break;
808 } else {
809 /* Got the wrong boundary, so read and discard
810 until we get the right boundary. */
811 char* boundary;
812 char msg[256];
813
814 snprintf(msg,256,
815 "Expected: %s. Got: %s",
816 parent_header->boundary,line);
817
818 sspm_set_error(parent_header,
819 SSPM_WRONG_BOUNDARY_ERROR,msg);
820
821 /* Read until the paired terminating boundary */
822 if((boundary = (char*)malloc(strlen(line)+5)) == 0){
823 fprintf(stderr,"Out of memory");
824 abort();
825 }
826 strcpy(boundary,line);
827 strcat(boundary,"--");
828 while((line = sspm_get_next_line(impl)) != 0){
829 if(strcmp(boundary,line)==0){
830 break;
831 }
832 }
833 free(boundary);
834
835 return 0;
836 }
837 }
838 }
839 }
840
841 /* Step 2: Get the part header */
842 sspm_read_header(impl,&header);
843
844 /* If the header is still listed as default, there was probably an
845 error */
846 if(header.def == 1 && header.error != SSPM_NO_ERROR){
847 sspm_set_error(&header,SSPM_NO_HEADER_ERROR,0);
848 return 0;
849 }
850
851 if(header.error!= SSPM_NO_ERROR){
852 sspm_store_part(impl,header,impl->level,0,0);
853 return 0;
854 }
855
856 /* Step 3: read the body */
857
858 if(header.major == SSPM_MULTIPART_MAJOR_TYPE){
859 struct sspm_header *child_header;
860 child_header = &(impl->parts[impl->part_no].header);
861
862 /* Store the multipart part */
863 sspm_store_part(impl,header,impl->level,0,0);
864
865 /* now get all of the sub-parts */
866 part = sspm_make_multipart_part(impl,child_header);
867
868 if(get_line_type(impl->temp) != TERMINATING_BOUNDARY){
869
870 sspm_set_error(child_header,SSPM_NO_BOUNDARY_ERROR,impl->temp);
871 return 0;
872 }
873
874 sspm_get_next_line(impl); /* Step past the terminating boundary */
875
876 } else {
877 sspm_make_part(impl, &header,parent_header,&part,&size);
878
879 memset(&(impl->parts[impl->part_no]), 0, sizeof(struct sspm_part));
880
881 sspm_store_part(impl,header,impl->level,part,size);
882
883 }
884
885 return part;
886}
887
888void* sspm_make_multipart_part(struct mime_impl *impl,struct sspm_header *header)
889{
890 void *part=0;
891
892 /* Now descend a level into each of the children of this part */
893 impl->level++;
894
895 /* Now we are working on the CHILD */
896 memset(&(impl->parts[impl->part_no]), 0, sizeof(struct sspm_part));
897
898 do{
899 part = sspm_make_multipart_subpart(impl,header);
900
901 if (part==0){
902 /* Clean up the part in progress */
903 impl->parts[impl->part_no].header.major
904 = SSPM_NO_MAJOR_TYPE;
905 impl->parts[impl->part_no].header.minor
906 = SSPM_NO_MINOR_TYPE;
907
908 }
909
910
911 } while (get_line_type(impl->temp) != TERMINATING_BOUNDARY &&
912 impl->state != END_OF_INPUT);
913
914 impl->level--;
915
916 return 0;
917}
918
919
920void sspm_read_header(struct mime_impl *impl,struct sspm_header *header)
921{
922#define BUF_SIZE 1024
923#define MAX_HEADER_LINES 25
924
925 char *buf;
926 char header_lines[MAX_HEADER_LINES][BUF_SIZE]; /* HACK, hard limits */
927 int current_line = -1;
928 int end = 0;
929
930 memset(header_lines,0,sizeof(header_lines));
931 memset(header,0,sizeof(struct sspm_header));
932
933 /* Set up default header */
934 header->def = 1;
935 header->major = SSPM_TEXT_MAJOR_TYPE;
936 header->minor = SSPM_PLAIN_MINOR_TYPE;
937 header->error = SSPM_NO_ERROR;
938 header->error_text = 0;
939
940 /* Read all of the lines into memory */
941 while(end==0&& (buf=sspm_get_next_line(impl)) != 0){
942
943 enum line_type line_type = get_line_type(buf);
944
945 switch(line_type){
946 case BLANK: {
947 end = 1;
948 impl->state = END_OF_HEADER;
949 break;
950 }
951
952 case MAIL_HEADER:
953 case MIME_HEADER: {
954 impl->state = IN_HEADER;
955 current_line++;
956
957 assert(strlen(buf) < BUF_SIZE);
958
959 strcpy(header_lines[current_line],buf);
960
961 break;
962 }
963
964 case HEADER_CONTINUATION: {
965 char* last_line, *end;
966 char *buf_start;
967
968 if(current_line < 0){
969 /* This is not really a continuation line, since
970 we have not see any header line yet */
971 sspm_set_error(header,SSPM_MALFORMED_HEADER_ERROR,buf);
972 return;
973 }
974
975 last_line = header_lines[current_line];
976 end = (char*) ( (size_t)strlen(last_line)+
977 (size_t)last_line);
978
979 impl->state = IN_HEADER;
980
981
982 /* skip over the spaces in buf start, and remove the new
983 line at the end of the lat line */
984 if (last_line[strlen(last_line)-1] == '\n'){
985 last_line[strlen(last_line)-1] = '\0';
986 }
987 buf_start = buf;
988 while(*buf_start == ' ' ||*buf_start == '\t' ){
989 buf_start++;
990 }
991
992 assert( strlen(buf_start) + strlen(last_line) < BUF_SIZE);
993
994 strcat(last_line,buf_start);
995
996 break;
997 }
998
999 default: {
1000 sspm_set_error(header,SSPM_MALFORMED_HEADER_ERROR,buf);
1001 return;
1002 }
1003 }
1004 }
1005
1006
1007 for(current_line = 0;
1008 current_line < MAX_HEADER_LINES && header_lines[current_line][0] != 0;
1009 current_line++){
1010
1011 sspm_build_header(header,header_lines[current_line]);
1012 }
1013
1014
1015}
1016
1017/* Root routine for parsing mime entries*/
1018int sspm_parse_mime(struct sspm_part *parts,
1019 size_t max_parts,
1020 struct sspm_action_map *actions,
1021 char* (*get_string)(char *s, size_t size, void* data),
1022 void *get_string_data,
1023 struct sspm_header *first_header
1024 )
1025{
1026 struct mime_impl impl;
1027 struct sspm_header header;
1028 void *part;
1029 int i;
1030
1031 /* Initialize all of the data */
1032 memset(&impl,0,sizeof(struct mime_impl));
1033 memset(&header,0,sizeof(struct sspm_header));
1034
1035 for(i = 0; i<(int)max_parts; i++){
1036 parts[i].header.major = SSPM_NO_MAJOR_TYPE;
1037 parts[i].header.minor = SSPM_NO_MINOR_TYPE;
1038 }
1039
1040 impl.parts = parts;
1041 impl.max_parts = max_parts;
1042 impl.part_no = 0;
1043 impl.actions = actions;
1044 impl.get_string = get_string;
1045 impl.get_string_data = get_string_data;
1046
1047 /* Read the header of the message. This will be the email header,
1048 unless first_header is specified. But ( HACK) that var is not
1049 currently being used */
1050 sspm_read_header(&impl,&header);
1051
1052 if(header.major == SSPM_MULTIPART_MAJOR_TYPE){
1053 struct sspm_header *child_header;
1054 child_header = &(impl.parts[impl.part_no].header);
1055
1056 sspm_store_part(&impl,header,impl.level,0,0);
1057
1058 part = sspm_make_multipart_part(&impl,child_header);
1059
1060 } else {
1061 void *part;
1062 size_t size;
1063 sspm_make_part(&impl, &header, 0,&part,&size);
1064
1065 memset(&(impl.parts[impl.part_no]), 0, sizeof(struct sspm_part));
1066
1067 sspm_store_part(&impl,header,impl.level,part,size);
1068 }
1069
1070 return 0;
1071}
1072
1073void sspm_free_parts(struct sspm_part *parts, size_t max_parts)
1074{
1075 int i;
1076
1077 for(i = 0; i<(int)max_parts && parts[i].header.major != SSPM_NO_MAJOR_TYPE;
1078 i++){
1079 sspm_free_header(&(parts[i].header));
1080 }
1081}
1082
1083void sspm_free_header(struct sspm_header *header)
1084{
1085 if(header->boundary!=0){
1086 free(header->boundary);
1087 }
1088 if(header->minor_text!=0){
1089 free(header->minor_text);
1090 }
1091 if(header->charset!=0){
1092 free(header->charset);
1093 }
1094 if(header->filename!=0){
1095 free(header->filename);
1096 }
1097 if(header->content_id!=0){
1098 free(header->content_id);
1099 }
1100 if(header->error_text!=0){
1101 free(header->error_text);
1102 }
1103}
1104
1105/***********************************************************************
1106The remaining code is beased on code from the mimelite distribution,
1107which has the following notice:
1108
1109| Authorship:
1110| Copyright (c) 1994 Gisle Hannemyr.
1111| Permission is granted to hack, make and distribute copies of this
1112| program as long as this copyright notice is not removed.
1113| Flames, bug reports, comments and improvements to:
1114| snail: Gisle Hannemyr, Brageveien 3A, 0452 Oslo, Norway
1115| email: Inet: gisle@oslonett.no
1116
1117The code is heavily modified by Eric Busboom.
1118
1119***********************************************************************/
1120
1121char *decode_quoted_printable(char *dest,
1122 char *src,
1123 size_t *size)
1124{
1125 int cc;
1126 size_t i=0;
1127
1128 while (*src != 0 && i < *size) {
1129 if (*src == '=') {
1130
1131 src++;
1132 if (!*src) {
1133 break;
1134 }
1135
1136 /* remove soft line breaks*/
1137 if ((*src == '\n') || (*src == '\r')){
1138 src++;
1139 if ((*src == '\n') || (*src == '\r')){
1140 src++;
1141 }
1142 continue;
1143 }
1144
1145 cc = isdigit(*src) ? (*src - '0') : (*src - 55);
1146 cc *= 0x10;
1147 src++;
1148 if (!*src) {
1149 break;
1150 }
1151 cc += isdigit(*src) ? (*src - '0') : (*src - 55);
1152
1153 *dest = cc;
1154
1155 } else {
1156 *dest = *src;
1157 }
1158
1159 dest++;
1160 src++;
1161 i++;
1162 }
1163
1164 *dest = '\0';
1165
1166 *size = i;
1167 return(dest);
1168}
1169
1170char *decode_base64(char *dest,
1171 char *src,
1172 size_t *size)
1173{
1174 int cc;
1175 char buf[4] = {0,0,0,0};
1176 int p = 0;
1177 int valid_data = 0;
1178 size_t size_out=0;
1179
1180 while (*src && p<(int)*size && (cc!= -1)) {
1181
1182 /* convert a character into the Base64 alphabet */
1183 cc = *src++;
1184
1185 if((cc >= 'A') && (cc <= 'Z')) cc = cc - 'A';
1186 else if ((cc >= 'a') && (cc <= 'z')) cc = cc - 'a' + 26;
1187 else if ((cc >= '0') && (cc <= '9')) cc = cc - '0' + 52;
1188 else if (cc == '/') cc = 63;
1189 else if (cc == '+') cc = 62;
1190 else cc = -1;
1191
1192 assert(cc<64);
1193
1194 /* If we've reached the end, fill the remaining slots in
1195 the bucket and do a final conversion */
1196 if(cc== -1){
1197 if(valid_data == 0){
1198 return 0;
1199 }
1200
1201 while(p%4!=3){
1202 p++;
1203 buf[p%4] = 0;
1204 }
1205 } else {
1206 buf[p%4] = cc;
1207 size_out++;
1208 valid_data = 1;
1209 }
1210
1211
1212 /* When we have 4 base64 letters, convert them into three
1213 bytes */
1214 if (p%4 == 3) {
1215 *dest++ =(buf[0]<< 2)|((buf[1] & 0x30) >> 4);
1216 *dest++ =((buf[1] & 0x0F) << 4)|((buf[2] & 0x3C) >> 2);
1217 *dest++ =((buf[2] & 0x03) << 6)|(buf[3] & 0x3F);
1218
1219 memset(buf,0,4);
1220 }
1221
1222 p++;
1223
1224 }
1225 /* Calculate the size of the converted data*/
1226 *size = ((int)(size_out/4))*3;
1227 if(size_out%4 == 2) *size+=1;
1228 if(size_out%4 == 3) *size+=2;
1229
1230 return(dest);
1231}
1232
1233
1234/***********************************************************************
1235
1236 Routines to output MIME
1237
1238**********************************************************************/
1239
1240
1241struct sspm_buffer {
1242 char* buffer;
1243 char* pos;
1244 size_t buf_size;
1245 int line_pos;
1246};
1247
1248void sspm_append_string(struct sspm_buffer* buf, char* string);
1249void sspm_write_part(struct sspm_buffer *buf,struct sspm_part *part, int *part_num);
1250
1251void sspm_append_hex(struct sspm_buffer* buf, char ch)
1252{
1253 char tmp[3];
1254
1255 sprintf(tmp,"=%02X",ch);
1256
1257 sspm_append_string(buf,tmp);
1258}
1259
1260/* a copy of icalmemory_append_char */
1261void sspm_append_char(struct sspm_buffer* buf, char ch)
1262{
1263 char *new_buf;
1264 char *new_pos;
1265
1266 size_t data_length, final_length;
1267
1268 data_length = (size_t)buf->pos - (size_t)buf->buffer;
1269
1270 final_length = data_length + 2;
1271
1272 if ( final_length > (size_t) buf->buf_size ) {
1273
1274 buf->buf_size = (buf->buf_size) * 2 + final_length +1;
1275
1276 new_buf = realloc(buf->buffer,buf->buf_size);
1277
1278 new_pos = (void*)((size_t)new_buf + data_length);
1279
1280 buf->pos = new_pos;
1281 buf->buffer = new_buf;
1282 }
1283
1284 *(buf->pos) = ch;
1285 buf->pos += 1;
1286 *(buf->pos) = 0;
1287}
1288/* A copy of icalmemory_append_string */
1289void sspm_append_string(struct sspm_buffer* buf, char* string)
1290{
1291 char *new_buf;
1292 char *new_pos;
1293
1294 size_t data_length, final_length, string_length;
1295
1296 string_length = strlen(string);
1297 data_length = (size_t)buf->pos - (size_t)buf->buffer;
1298 final_length = data_length + string_length;
1299
1300 if ( final_length >= (size_t) buf->buf_size) {
1301
1302
1303 buf->buf_size = (buf->buf_size) * 2 + final_length;
1304
1305 new_buf = realloc(buf->buffer,buf->buf_size);
1306
1307 new_pos = (void*)((size_t)new_buf + data_length);
1308
1309 buf->pos = new_pos;
1310 buf->buffer = new_buf;
1311 }
1312
1313 strcpy(buf->pos, string);
1314
1315 buf->pos += string_length;
1316}
1317
1318
1319
1320static int sspm_is_printable(char c)
1321{
1322 return (c >= 33) && (c <= 126) && (c != '=');
1323
1324}
1325
1326
1327void sspm_encode_quoted_printable(struct sspm_buffer *buf, char* data)
1328{
1329 char *p;
1330 int lpos = 0;
1331
1332 for(p = data; *p != 0; p++){
1333
1334 if(sspm_is_printable(*p)){
1335 /* plain characters can represent themselves */
1336 /* RFC2045 Rule #2 */
1337 sspm_append_char(buf,*p);
1338 lpos++;
1339 } else if ( *p == '\t' || *p == ' ' ) {
1340
1341 /* For tabs and spaces, only encode if they appear at the
1342 end of the line */
1343 /* RFC2045 Rule #3 */
1344
1345 char n = *(p+1);
1346
1347 if( n == '\n' || n == '\r'){
1348 sspm_append_hex(buf,*p);
1349 lpos += 3;
1350 } else {
1351 sspm_append_char(buf,*p);
1352 lpos++;
1353 }
1354
1355 } else if( *p == '\n' || *p == '\r'){
1356 sspm_append_char(buf,*p);
1357
1358 lpos=0;
1359
1360 } else {
1361 /* All others need to be encoded */
1362 sspm_append_hex(buf,*p);
1363 lpos+=3;
1364 }
1365
1366
1367 /* Add line breaks */
1368 if (lpos > 72){
1369 lpos = 0;
1370 sspm_append_string(buf,"=\n");
1371 }
1372 }
1373}
1374
1375static char BaseTable[64] = {
1376 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
1377 'Q','R','S','T','U','V','W','X','Y','Z','a','b','c','d','e','f',
1378 'g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v',
1379 'w','x','y','z','0','1','2','3','4','5','6','7','8','9','+','/'
1380};
1381
1382void sspm_write_base64(struct sspm_buffer *buf, char* inbuf,int size )
1383{
1384
1385 char outbuf[4];
1386 int i;
1387
1388 outbuf[0] = outbuf[1] = outbuf[2] = outbuf[3] = 65;
1389
1390 switch(size){
1391
1392 case 4:
1393 outbuf[3] = inbuf[2] & 0x3F;
1394
1395 case 3:
1396 outbuf[2] = ((inbuf[1] & 0x0F) << 2) | ((inbuf[2] & 0xC0) >> 6);
1397
1398 case 2:
1399 outbuf[0] = (inbuf[0] & 0xFC) >> 2;
1400 outbuf[1] = ((inbuf[0] & 0x03) << 4) | ((inbuf[1] & 0xF0) >> 4);
1401 break;
1402
1403 default:
1404 assert(0);
1405 }
1406
1407 for(i = 0; i < 4; i++){
1408
1409 if(outbuf[i] == 65){
1410 sspm_append_char(buf,'=');
1411 } else {
1412 sspm_append_char(buf,BaseTable[(int)outbuf[i]]);
1413 }
1414 }
1415}
1416
1417void sspm_encode_base64(struct sspm_buffer *buf, char* data, size_t size)
1418{
1419
1420 char *p;
1421 char inbuf[3];
1422 int i = 0;
1423 int first = 1;
1424 int lpos = 0;
1425
1426 inbuf[0] = inbuf[1] = inbuf[2] = 0;
1427
1428 for (p = data; *p !=0; p++){
1429
1430 if (i%3 == 0 && first == 0){
1431
1432 sspm_write_base64(buf, inbuf, 4);
1433 lpos+=4;
1434
1435 inbuf[0] = inbuf[1] = inbuf[2] = 0;
1436 }
1437
1438 assert(lpos%4 == 0);
1439
1440 if (lpos == 72){
1441 sspm_append_string(buf,"\n");
1442 lpos = 0;
1443 }
1444
1445 inbuf[i%3] = *p;
1446
1447 i++;
1448 first = 0;
1449
1450 }
1451
1452
1453 /* If the inbuf was not exactly filled on the last byte, we need
1454 to spit out the odd bytes that did get in -- either one or
1455 two. This will result in an output of two bytes and '==' or
1456 three bytes and '=', respectively */
1457
1458 if (i%3 == 1 && first == 0){
1459 sspm_write_base64(buf, inbuf, 2);
1460 } else if (i%3 == 2 && first == 0){
1461 sspm_write_base64(buf, inbuf, 3);
1462 }
1463
1464}
1465
1466void sspm_write_header(struct sspm_buffer *buf,struct sspm_header *header)
1467{
1468
1469 int i;
1470 char temp[TMP_BUF_SIZE];
1471 char* major;
1472 char* minor;
1473
1474 /* Content-type */
1475
1476 major = sspm_major_type_string(header->major);
1477 minor = sspm_minor_type_string(header->minor);
1478
1479 if(header->minor == SSPM_UNKNOWN_MINOR_TYPE ){
1480 assert(header->minor_text !=0);
1481 minor = header->minor_text;
1482 }
1483
1484 sprintf(temp,"Content-Type: %s/%s",major,minor);
1485
1486 sspm_append_string(buf,temp);
1487
1488 if(header->boundary != 0){
1489 sprintf(temp,";boundary=\"%s\"",header->boundary);
1490 sspm_append_string(buf,temp);
1491 }
1492
1493 /* Append any content type parameters */
1494 if(header->content_type_params != 0){
1495 for(i=0; *(header->content_type_params[i])!= 0;i++){
1496 sprintf(temp,header->content_type_params[i]);
1497 sspm_append_char(buf,';');
1498 sspm_append_string(buf,temp);
1499 }
1500 }
1501
1502 sspm_append_char(buf,'\n');
1503
1504 /*Content-Transfer-Encoding */
1505
1506 if(header->encoding != SSPM_UNKNOWN_ENCODING &&
1507 header->encoding != SSPM_NO_ENCODING){
1508 sprintf(temp,"Content-Transfer-Encoding: %s\n",
1509 sspm_encoding_string(header->encoding));
1510 }
1511
1512 sspm_append_char(buf,'\n');
1513
1514}
1515
1516void sspm_write_multipart_part(struct sspm_buffer *buf,
1517 struct sspm_part *parts,
1518 int* part_num)
1519{
1520
1521 int parent_level, level;
1522 struct sspm_header *header = &(parts[*part_num].header);
1523 /* Write the header for the multipart part */
1524 sspm_write_header(buf,header);
1525
1526 parent_level = parts[*part_num].level;
1527
1528 (*part_num)++;
1529
1530 level = parts[*part_num].level;
1531
1532 while(parts[*part_num].header.major != SSPM_NO_MAJOR_TYPE &&
1533 level == parent_level+1){
1534
1535 assert(header->boundary);
1536 sspm_append_string(buf,header->boundary);
1537 sspm_append_char(buf,'\n');
1538
1539 if (parts[*part_num].header.major == SSPM_MULTIPART_MAJOR_TYPE){
1540 sspm_write_multipart_part(buf,parts,part_num);
1541 } else {
1542 sspm_write_part(buf, &(parts[*part_num]), part_num);
1543 }
1544
1545 (*part_num)++;
1546 level = parts[*part_num].level;
1547 }
1548
1549 sspm_append_string(buf,"\n\n--");
1550 sspm_append_string(buf,header->boundary);
1551 sspm_append_string(buf,"\n");
1552
1553 (*part_num)--; /* undo last, spurious, increment */
1554}
1555
1556void sspm_write_part(struct sspm_buffer *buf,struct sspm_part *part,int *part_num)
1557{
1558
1559 /* Write header */
1560 sspm_write_header(buf,&(part->header));
1561
1562 /* Write part data */
1563
1564 if(part->data == 0){
1565 return;
1566 }
1567
1568 if(part->header.encoding == SSPM_BASE64_ENCODING) {
1569 assert(part->data_size != 0);
1570 sspm_encode_base64(buf,part->data,part->data_size);
1571 } else if(part->header.encoding == SSPM_QUOTED_PRINTABLE_ENCODING) {
1572 sspm_encode_quoted_printable(buf,part->data);
1573 } else {
1574 sspm_append_string(buf,part->data);
1575 }
1576
1577 sspm_append_string(buf,"\n\n");
1578}
1579
1580int sspm_write_mime(struct sspm_part *parts,size_t num_parts,
1581 char **output_string, char* header)
1582{
1583 struct sspm_buffer buf;
1584 int part_num =0;
1585
1586 buf.buffer = malloc(4096);
1587 buf.pos = buf.buffer;
1588 buf.buf_size = 10;
1589 buf.line_pos = 0;
1590
1591 /* write caller's header */
1592 if(header != 0){
1593 sspm_append_string(&buf,header);
1594 }
1595
1596 if(buf.buffer[strlen(buf.buffer)-1] != '\n'){
1597 sspm_append_char(&buf,'\n');
1598 }
1599
1600 /* write mime-version header */
1601 sspm_append_string(&buf,"Mime-Version: 1.0\n");
1602
1603 /* End of header */
1604
1605 /* Write body parts */
1606 while(parts[part_num].header.major != SSPM_NO_MAJOR_TYPE){
1607 if (parts[part_num].header.major == SSPM_MULTIPART_MAJOR_TYPE){
1608 sspm_write_multipart_part(&buf,parts,&part_num);
1609 } else {
1610 sspm_write_part(&buf, &(parts[part_num]), &part_num);
1611 }
1612
1613 part_num++;
1614 }
1615
1616
1617 *output_string = buf.buffer;
1618
1619 return 0;
1620}
1621
diff --git a/libical/src/libical/sspm.h b/libical/src/libical/sspm.h
new file mode 100644
index 0000000..864a23a
--- a/dev/null
+++ b/libical/src/libical/sspm.h
@@ -0,0 +1,143 @@
1/* -*- Mode: C -*-
2 ======================================================================
3 FILE: sspm.h Mime Parser
4 CREATOR: eric 25 June 2000
5
6 $Id$
7 $Locker$
8
9 The contents of this file are subject to the Mozilla Public License
10 Version 1.0 (the "License"); you may not use this file except in
11 compliance with the License. You may obtain a copy of the License at
12 http://www.mozilla.org/MPL/
13
14 Software distributed under the License is distributed on an "AS IS"
15 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
16 the License for the specific language governing rights and
17 limitations under the License.
18
19
20 This program is free software; you can redistribute it and/or modify
21 it under the terms of either:
22
23 The LGPL as published by the Free Software Foundation, version
24 2.1, available at: http://www.fsf.org/copyleft/lesser.html
25
26 Or:
27
28 The Mozilla Public License Version 1.0. You may obtain a copy of
29 the License at http://www.mozilla.org/MPL/
30
31 The Initial Developer of the Original Code is Eric Busboom
32
33 (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
34 ======================================================================*/
35
36#ifndef SSPM_H
37#define SSPM_H
38
39enum sspm_major_type {
40 SSPM_NO_MAJOR_TYPE,
41 SSPM_TEXT_MAJOR_TYPE,
42 SSPM_IMAGE_MAJOR_TYPE,
43 SSPM_AUDIO_MAJOR_TYPE,
44 SSPM_VIDEO_MAJOR_TYPE,
45 SSPM_APPLICATION_MAJOR_TYPE,
46 SSPM_MULTIPART_MAJOR_TYPE,
47 SSPM_MESSAGE_MAJOR_TYPE,
48 SSPM_UNKNOWN_MAJOR_TYPE
49};
50
51enum sspm_minor_type {
52 SSPM_NO_MINOR_TYPE,
53 SSPM_ANY_MINOR_TYPE,
54 SSPM_PLAIN_MINOR_TYPE,
55 SSPM_RFC822_MINOR_TYPE,
56 SSPM_DIGEST_MINOR_TYPE,
57 SSPM_CALENDAR_MINOR_TYPE,
58 SSPM_MIXED_MINOR_TYPE,
59 SSPM_RELATED_MINOR_TYPE,
60 SSPM_ALTERNATIVE_MINOR_TYPE,
61 SSPM_PARALLEL_MINOR_TYPE,
62 SSPM_UNKNOWN_MINOR_TYPE
63};
64
65enum sspm_encoding {
66 SSPM_NO_ENCODING,
67 SSPM_QUOTED_PRINTABLE_ENCODING,
68 SSPM_8BIT_ENCODING,
69 SSPM_7BIT_ENCODING,
70 SSPM_BINARY_ENCODING,
71 SSPM_BASE64_ENCODING,
72 SSPM_UNKNOWN_ENCODING
73};
74
75enum sspm_error{
76 SSPM_NO_ERROR,
77 SSPM_UNEXPECTED_BOUNDARY_ERROR,
78 SSPM_WRONG_BOUNDARY_ERROR,
79 SSPM_NO_BOUNDARY_ERROR,
80 SSPM_NO_HEADER_ERROR,
81 SSPM_MALFORMED_HEADER_ERROR
82};
83
84
85struct sspm_header
86{
87 int def;
88 char* boundary;
89 enum sspm_major_type major;
90 enum sspm_minor_type minor;
91 char *minor_text;
92 char ** content_type_params;
93 char* charset;
94 enum sspm_encoding encoding;
95 char* filename;
96 char* content_id;
97 enum sspm_error error;
98 char* error_text;
99};
100
101struct sspm_part {
102 struct sspm_header header;
103 int level;
104 size_t data_size;
105 void *data;
106};
107
108struct sspm_action_map {
109 enum sspm_major_type major;
110 enum sspm_minor_type minor;
111 void* (*new_part)();
112 void (*add_line)(void *part, struct sspm_header *header,
113 char* line, size_t size);
114 void* (*end_part)(void* part);
115 void (*free_part)(void *part);
116};
117
118char* sspm_major_type_string(enum sspm_major_type type);
119char* sspm_minor_type_string(enum sspm_minor_type type);
120char* sspm_encoding_string(enum sspm_encoding type);
121
122int sspm_parse_mime(struct sspm_part *parts,
123 size_t max_parts,
124 struct sspm_action_map *actions,
125 char* (*get_string)(char *s, size_t size, void* data),
126 void *get_string_data,
127 struct sspm_header *first_header
128 );
129
130void sspm_free_parts(struct sspm_part *parts, size_t max_parts);
131
132char *decode_quoted_printable(char *dest,
133 char *src,
134 size_t *size);
135char *decode_base64(char *dest,
136 char *src,
137 size_t *size);
138
139
140int sspm_write_mime(struct sspm_part *parts,size_t num_parts,
141 char **output_string, char* header);
142
143#endif /*SSPM_H*/
diff --git a/libical/src/libical/vsnprintf.c b/libical/src/libical/vsnprintf.c
new file mode 100644
index 0000000..88a8c63
--- a/dev/null
+++ b/libical/src/libical/vsnprintf.c
@@ -0,0 +1,180 @@
1#ifdef __osf__
2/*
3 * Revision 12: http://theos.com/~deraadt/snprintf.c
4 *
5 * Copyright (c) 1997 Theo de Raadt
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#include <sys/types.h>
29#include <stdio.h>
30
31#include <unistd.h>
32#include <sys/param.h>
33#include <sys/mman.h>
34#include <signal.h>
35
36#include <string.h>
37#if __STDC__
38#include <stdarg.h>
39#include <stdlib.h>
40#else
41#include <varargs.h>
42#endif
43#include <setjmp.h>
44
45#ifndef roundup
46#define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
47#endif
48
49static int pgsize;
50static char *curobj;
51static sigjmp_buf bail;
52
53 #define EXTRABYTES 2/* XXX: why 2? you don't want to know */
54
55static char *
56msetup(str, n)
57 char *str;
58 size_t n;
59{
60 char *e;
61
62 if (n == 0)
63 return NULL;
64 if (pgsize == 0)
65 pgsize = getpagesize();
66 curobj = (char *)malloc(n + EXTRABYTES + pgsize * 2);
67 if (curobj == NULL)
68 return NULL;
69 e = curobj + n + EXTRABYTES;
70 e = (char *)roundup((unsigned long)e, pgsize);
71 if (mprotect(e, pgsize, PROT_NONE) == -1) {
72 free(curobj);
73 curobj = NULL;
74 return NULL;
75 }
76 e = e - n - EXTRABYTES;
77 *e = '\0';
78 return (e);
79}
80
81static void
82mcatch(int i)
83{
84 siglongjmp(bail, 1);
85}
86
87static void
88mcleanup(str, n, p)
89 char *str;
90 size_t n;
91 char *p;
92{
93 strncpy(str, p, n-1);
94 str[n-1] = '\0';
95 if (mprotect((caddr_t)(p + n + EXTRABYTES), pgsize,
96 PROT_READ|PROT_WRITE|PROT_EXEC) == -1)
97 mprotect((caddr_t)(p + n + EXTRABYTES), pgsize,
98 PROT_READ|PROT_WRITE);
99 free(curobj);
100}
101
102int
103#if __STDC__
104vsnprintf(char *str, size_t n, char const *fmt, va_list ap)
105#else
106vsnprintf(str, n, fmt, ap)
107 char *str;
108 size_t n;
109 char *fmt;
110 char *ap;
111#endif
112{
113 struct sigaction osa, nsa;
114 char *p;
115 int ret = n + 1;/* if we bail, indicated we overflowed */
116
117 memset(&nsa, 0, sizeof nsa);
118 nsa.sa_handler = mcatch;
119 sigemptyset(&nsa.sa_mask);
120
121 p = msetup(str, n);
122 if (p == NULL) {
123 *str = '\0';
124 return 0;
125 }
126 if (sigsetjmp(bail, 1) == 0) {
127 if (sigaction(SIGSEGV, &nsa, &osa) == -1) {
128 mcleanup(str, n, p);
129 return (0);
130 }
131 ret = vsprintf(p, fmt, ap);
132 }
133 mcleanup(str, n, p);
134 (void) sigaction(SIGSEGV, &osa, NULL);
135 return (ret);
136}
137
138int
139#if __STDC__
140snprintf(char *str, size_t n, char const *fmt, ...)
141#else
142snprintf(str, n, fmt, va_alist)
143 char *str;
144 size_t n;
145 char *fmt;
146 va_dcl
147#endif
148{
149 va_list ap;
150#if __STDC__
151 va_start(ap, fmt);
152#else
153 va_start(ap);
154#endif
155
156 return (vsnprintf(str, n, fmt, ap));
157 va_end(ap);
158}
159
160#elif defined ( _WIN32 )
161
162#include <stdio.h>
163#include <stdarg.h>
164
165int snprintf(char *str, size_t n, char const *fmt, ...)
166{
167 va_list ap;
168 va_start(ap, fmt);
169
170 return _snprintf(str, n, fmt, ap);
171}
172
173#else
174/* ANSI C forbids an empty source file... */
175
176static void vsnprintf_dummy_func() {
177 vsnprintf_dummy_func();
178}
179
180#endif