summaryrefslogtreecommitdiffabout
path: root/libical/src/libicalss
authorzautrix <zautrix>2004-06-29 11:59:46 (UTC)
committer zautrix <zautrix>2004-06-29 11:59:46 (UTC)
commitda43dbdc6c82453228f34766fc74585615cba938 (patch) (side-by-side diff)
tree16576932cea08bf117b2d0320b0d5f66ee8ad093 /libical/src/libicalss
parent627489ea2669d3997676bc3cee0f5d0d0c16c4d4 (diff)
downloadkdepimpi-da43dbdc6c82453228f34766fc74585615cba938.zip
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.gz
kdepimpi-da43dbdc6c82453228f34766fc74585615cba938.tar.bz2
New lib ical.Some minor changes as well.
Diffstat (limited to 'libical/src/libicalss') (more/less context) (ignore whitespace changes)
-rw-r--r--libical/src/libicalss/icalcalendar.c263
-rw-r--r--libical/src/libicalss/icalcalendar.h2
-rw-r--r--libical/src/libicalss/icalclassify.c132
-rw-r--r--libical/src/libicalss/icalclassify.h36
-rw-r--r--libical/src/libicalss/icalcluster.c245
-rw-r--r--libical/src/libicalss/icalcluster.h61
-rw-r--r--libical/src/libicalss/icalclusterimpl.h45
-rw-r--r--libical/src/libicalss/icaldirset.c542
-rw-r--r--libical/src/libicalss/icaldirset.h54
-rw-r--r--libical/src/libicalss/icaldirsetimpl.h19
-rw-r--r--libical/src/libicalss/icalfileset.c725
-rw-r--r--libical/src/libicalss/icalfileset.h105
-rw-r--r--libical/src/libicalss/icalfilesetimpl.h18
-rw-r--r--libical/src/libicalss/icalgauge.c172
-rw-r--r--libical/src/libicalss/icalgauge.h26
-rw-r--r--libical/src/libicalss/icalgaugeimpl.h12
-rw-r--r--libical/src/libicalss/icalmessage.c11
-rw-r--r--libical/src/libicalss/icalset.c528
-rw-r--r--libical/src/libicalss/icalset.h121
-rw-r--r--libical/src/libicalss/icalspanlist.c386
-rw-r--r--libical/src/libicalss/icalspanlist.h29
-rw-r--r--libical/src/libicalss/icalss.h719
-rw-r--r--libical/src/libicalss/icalsslexer.c1624
-rw-r--r--libical/src/libicalss/icalssyacc.c270
-rw-r--r--libical/src/libicalss/icalssyacc.h12
-rw-r--r--libical/src/libicalss/libicalss.pro70
-rw-r--r--libical/src/libicalss/libicalssE.pro78
27 files changed, 4224 insertions, 2081 deletions
diff --git a/libical/src/libicalss/icalcalendar.c b/libical/src/libicalss/icalcalendar.c
new file mode 100644
index 0000000..1f24f88
--- a/dev/null
+++ b/libical/src/libicalss/icalcalendar.c
@@ -0,0 +1,263 @@
+/*======================================================================
+ FILE: icalcalendar.c
+ CREATOR: eric 23 December 1999
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ ======================================================================*/
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+
+#include "icalcalendar.h"
+#include "icalset.h"
+#include "icalfileset.h"
+#include "icaldirset.h"
+#include <limits.h>
+#include <sys/stat.h> /* For mkdir, stat */
+#include <sys/types.h> /* For mkdir */
+#include <fcntl.h> /* For mkdir */
+
+#ifndef WIN32
+#include <unistd.h> /* For mkdir, stat */
+#endif
+
+#ifndef PATH_MAX
+#define PATH_MAX 512
+#endif
+
+
+#include <stdlib.h> /* for malloc */
+#include <string.h> /* for strcat */
+#include <errno.h>
+
+#define BOOKED_DIR "booked"
+#define INCOMING_FILE "incoming.ics"
+#define PROP_FILE "properties.ics"
+#define FBLIST_FILE "freebusy.ics"
+
+struct icalcalendar_impl
+{
+ char* dir;
+ icalset* freebusy;
+ icalset* properties;
+ icalset* booked;
+ icalset* incoming;
+};
+
+struct icalcalendar_impl* icalcalendar_new_impl(void)
+{
+ struct icalcalendar_impl* impl;
+
+ if ( ( impl = (struct icalcalendar_impl*)
+ malloc(sizeof(struct icalcalendar_impl))) == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ return impl;
+}
+
+
+icalerrorenum icalcalendar_create(struct icalcalendar_impl* impl)
+{
+ char path[PATH_MAX];
+ struct stat sbuf;
+ int r;
+
+ icalerror_check_arg_re((impl != 0),"impl",ICAL_BADARG_ERROR);
+
+ path[0] = '\0';
+ strcpy(path,impl->dir);
+ strcat(path,"/");
+ strcat(path,BOOKED_DIR);
+
+ r = stat(path,&sbuf);
+
+ if( r != 0 && errno == ENOENT){
+
+ if(mkdir(path,0777)!=0){
+ icalerror_set_errno(ICAL_FILE_ERROR);
+ return ICAL_FILE_ERROR;
+ }
+ }
+
+ return ICAL_NO_ERROR;
+}
+
+icalcalendar* icalcalendar_new(char* dir)
+{
+ struct icalcalendar_impl* impl;
+
+ icalerror_check_arg_rz((dir != 0),"dir");
+
+ impl = icalcalendar_new_impl();
+
+ if (impl == 0){
+ return 0;
+ }
+
+ impl->dir = (char*)strdup(dir);
+ impl->freebusy = 0;
+ impl->properties = 0;
+ impl->booked = 0;
+ impl->incoming = 0;
+
+ if (icalcalendar_create(impl) != ICAL_NO_ERROR){
+ free(impl);
+ return 0;
+ }
+
+ return impl;
+}
+
+void icalcalendar_free(icalcalendar* impl)
+{
+ if (impl->dir !=0){
+ free(impl->dir);
+ }
+
+ if (impl->freebusy !=0){
+ icalset_free(impl->booked);
+ }
+
+ if (impl->properties !=0){
+ icalset_free(impl->properties);
+ }
+
+ if (impl->booked !=0){
+ icalset_free(impl->booked);
+ }
+
+ if (impl->incoming !=0){
+ icalset_free(impl->incoming);
+ }
+
+ impl->dir = 0;
+ impl->freebusy = 0;
+ impl->properties = 0;
+ impl->booked = 0;
+ impl->incoming = 0;
+
+
+ free(impl);
+}
+
+
+int icalcalendar_lock(icalcalendar* impl)
+{
+ icalerror_check_arg_rz((impl != 0),"impl");
+ return 0;
+}
+
+int icalcalendar_unlock(icalcalendar* impl)
+{
+ icalerror_check_arg_rz((impl != 0),"impl");
+ return 0;
+}
+
+int icalcalendar_islocked(icalcalendar* impl)
+{
+ icalerror_check_arg_rz((impl != 0),"impl");
+ return 0;
+}
+
+int icalcalendar_ownlock(icalcalendar* impl)
+{
+ icalerror_check_arg_rz((impl != 0),"impl");
+ return 0;
+}
+
+icalset* icalcalendar_get_booked(icalcalendar* impl)
+{
+ char dir[PATH_MAX];
+
+ icalerror_check_arg_rz((impl != 0),"impl");
+
+ dir[0] = '\0';
+ strcpy(dir,impl->dir);
+ strcat(dir,"/");
+ strcat(dir,BOOKED_DIR);
+
+ if (impl->booked == 0){
+ icalerror_clear_errno();
+ impl->booked = icaldirset_new(dir);
+ assert(icalerrno == ICAL_NO_ERROR);
+ }
+
+ return impl->booked;
+
+}
+
+icalset* icalcalendar_get_incoming(icalcalendar* impl)
+{
+ char path[PATH_MAX];
+ icalerror_check_arg_rz((impl != 0),"impl");
+
+ path[0] = '\0';
+ strcpy(path,impl->dir);
+ strcat(path,"/");
+ strcat(path,INCOMING_FILE);
+
+ if (impl->properties == 0){
+ impl->properties = icalfileset_new(path);
+ }
+
+ return impl->properties;
+}
+
+icalset* icalcalendar_get_properties(icalcalendar* impl)
+{
+ char path[PATH_MAX];
+ icalerror_check_arg_rz((impl != 0),"impl");
+
+ path[0] = '\0';
+ strcpy(path,impl->dir);
+ strcat(path,"/");
+ strcat(path,PROP_FILE);
+
+ if (impl->properties == 0){
+ impl->properties = icalfileset_new(path);
+ }
+
+ return impl->properties;
+}
+
+icalset* icalcalendar_get_freebusy(icalcalendar* impl)
+{
+ char path[PATH_MAX];
+ icalerror_check_arg_rz((impl != 0),"impl");
+
+ path[0] = '\0';
+ strcpy(path,impl->dir);
+ strcat(path,"/");
+ strcat(path,FBLIST_FILE);
+
+
+ if (impl->freebusy == 0){
+ impl->freebusy = icalfileset_new(path);
+ }
+
+ return impl->freebusy;
+}
+
+
+
+
diff --git a/libical/src/libicalss/icalcalendar.h b/libical/src/libicalss/icalcalendar.h
index f07457c..2a0c151 100644
--- a/libical/src/libicalss/icalcalendar.h
+++ b/libical/src/libicalss/icalcalendar.h
@@ -40,3 +40,3 @@
-typedef void icalcalendar;
+typedef struct icalcalendar_impl icalcalendar;
diff --git a/libical/src/libicalss/icalclassify.c b/libical/src/libicalss/icalclassify.c
index c029309..61ddbd3 100644
--- a/libical/src/libicalss/icalclassify.c
+++ b/libical/src/libicalss/icalclassify.c
@@ -28,3 +28,2 @@
-#include "icalerror.h"
#include "ical.h"
@@ -32,2 +31,3 @@
#include "icalmemory.h"
+
#include <ctype.h> /* For tolower() */
@@ -148,3 +148,3 @@ icalproperty* icalclassify_find_attendee(icalcomponent *c,
{
- const char* this_attendee
+ char* this_attendee
= icalclassify_lowercase(icalproperty_get_attendee(p));
@@ -159,2 +159,4 @@ icalproperty* icalclassify_find_attendee(icalcomponent *c,
if(strcmp(this_upn,upn)==0){
+ free(lattendee);
+ free(this_attendee);
return p;
@@ -162,3 +164,5 @@ icalproperty* icalclassify_find_attendee(icalcomponent *c,
+ free(this_attendee);
}
+ free(lattendee);
@@ -286,3 +290,3 @@ int icalssutil_is_rescheduled(icalcomponent* a,icalcomponent* b)
- if( (p1!=0)^(p1!=0) ){
+ if( (p1!=0)^(p2!=0) ){
/* Return true if the property exists in one component and not
@@ -548,3 +552,2 @@ int icalclassify_reply_crasher_decline(
{
- icalparameter_partstat partstat;
icalproperty* attendee;
@@ -644,33 +647,33 @@ struct icalclassify_map {
int (*fn)(struct icalclassify_parts *comp,struct icalclassify_parts *match, const char* user);
- ical_class class;
+ icalproperty_xlicclass class;
} icalclassify_map[] =
-{ {ICAL_METHOD_PUBLISH,icalclassify_publish_new,ICAL_PUBLISH_NEW_CLASS},
- {ICAL_METHOD_PUBLISH,icalclassify_publish_update,ICAL_PUBLISH_UPDATE_CLASS},
- {ICAL_METHOD_PUBLISH,icalclassify_publish_freebusy,ICAL_PUBLISH_FREEBUSY_CLASS},
- {ICAL_METHOD_REQUEST,icalclassify_request_delegate,ICAL_REQUEST_DELEGATE_CLASS},
- {ICAL_METHOD_REQUEST,icalclassify_request_new,ICAL_REQUEST_NEW_CLASS},
- {ICAL_METHOD_REQUEST,icalclassify_request_update,ICAL_REQUEST_UPDATE_CLASS},
- {ICAL_METHOD_REQUEST,icalclassify_request_reschedule,ICAL_REQUEST_RESCHEDULE_CLASS},
-
- {ICAL_METHOD_REQUEST,icalclassify_request_new_organizer,ICAL_REQUEST_NEW_ORGANIZER_CLASS},
- {ICAL_METHOD_REQUEST,icalclassify_request_forward,ICAL_REQUEST_FORWARD_CLASS},
- {ICAL_METHOD_REQUEST,icalclassify_request_status,ICAL_REQUEST_STATUS_CLASS},
- {ICAL_METHOD_REQUEST,icalclassify_request_freebusy,ICAL_REQUEST_FREEBUSY_CLASS},
-
- {ICAL_METHOD_REPLY,icalclassify_reply_accept,ICAL_REPLY_ACCEPT_CLASS},
- {ICAL_METHOD_REPLY,icalclassify_reply_decline,ICAL_REPLY_DECLINE_CLASS},
- {ICAL_METHOD_REPLY,icalclassify_reply_delegate,ICAL_REPLY_DELEGATE_CLASS},
- {ICAL_METHOD_REPLY,icalclassify_reply_crasher_accept,ICAL_REPLY_CRASHER_ACCEPT_CLASS},
- {ICAL_METHOD_REPLY,icalclassify_reply_crasher_decline,ICAL_REPLY_CRASHER_DECLINE_CLASS},
-
- {ICAL_METHOD_ADD,icalclassify_add_instance,ICAL_ADD_INSTANCE_CLASS},
-
- {ICAL_METHOD_CANCEL,icalclassify_cancel_event,ICAL_CANCEL_EVENT_CLASS},
- {ICAL_METHOD_CANCEL,icalclassify_cancel_instance,ICAL_CANCEL_INSTANCE_CLASS},
- {ICAL_METHOD_CANCEL,icalclassify_cancel_all,ICAL_CANCEL_ALL_CLASS},
-
- {ICAL_METHOD_REFRESH,icalclassify_refesh,ICAL_REFRESH_CLASS},
- {ICAL_METHOD_COUNTER,icalclassify_counter,ICAL_COUNTER_CLASS},
- {ICAL_METHOD_DECLINECOUNTER,icalclassify_delinecounter,ICAL_DECLINECOUNTER_CLASS},
- {ICAL_METHOD_NONE,0,ICAL_NO_CLASS}
+{ {ICAL_METHOD_PUBLISH,icalclassify_publish_new,ICAL_XLICCLASS_PUBLISHNEW},
+ {ICAL_METHOD_PUBLISH,icalclassify_publish_update,ICAL_XLICCLASS_PUBLISHUPDATE},
+ {ICAL_METHOD_PUBLISH,icalclassify_publish_freebusy,ICAL_XLICCLASS_PUBLISHFREEBUSY},
+ {ICAL_METHOD_REQUEST,icalclassify_request_delegate,ICAL_XLICCLASS_REQUESTDELEGATE},
+ {ICAL_METHOD_REQUEST,icalclassify_request_new,ICAL_XLICCLASS_REQUESTNEW},
+ {ICAL_METHOD_REQUEST,icalclassify_request_update,ICAL_XLICCLASS_REQUESTUPDATE},
+ {ICAL_METHOD_REQUEST,icalclassify_request_reschedule,ICAL_XLICCLASS_REQUESTRESCHEDULE},
+
+ {ICAL_METHOD_REQUEST,icalclassify_request_new_organizer,ICAL_XLICCLASS_REQUESTNEWORGANIZER},
+ {ICAL_METHOD_REQUEST,icalclassify_request_forward,ICAL_XLICCLASS_REQUESTFORWARD},
+ {ICAL_METHOD_REQUEST,icalclassify_request_status,ICAL_XLICCLASS_REQUESTSTATUS},
+ {ICAL_METHOD_REQUEST,icalclassify_request_freebusy,ICAL_XLICCLASS_REQUESTFREEBUSY},
+
+ {ICAL_METHOD_REPLY,icalclassify_reply_accept,ICAL_XLICCLASS_REPLYACCEPT},
+ {ICAL_METHOD_REPLY,icalclassify_reply_decline,ICAL_XLICCLASS_REPLYDECLINE},
+ {ICAL_METHOD_REPLY,icalclassify_reply_delegate,ICAL_XLICCLASS_REPLYDELEGATE},
+ {ICAL_METHOD_REPLY,icalclassify_reply_crasher_accept,ICAL_XLICCLASS_REPLYCRASHERACCEPT},
+ {ICAL_METHOD_REPLY,icalclassify_reply_crasher_decline,ICAL_XLICCLASS_REPLYCRASHERDECLINE},
+
+ {ICAL_METHOD_ADD,icalclassify_add_instance,ICAL_XLICCLASS_ADDINSTANCE},
+
+ {ICAL_METHOD_CANCEL,icalclassify_cancel_event,ICAL_XLICCLASS_CANCELEVENT},
+ {ICAL_METHOD_CANCEL,icalclassify_cancel_instance,ICAL_XLICCLASS_CANCELINSTANCE},
+ {ICAL_METHOD_CANCEL,icalclassify_cancel_all,ICAL_XLICCLASS_CANCELALL},
+
+ {ICAL_METHOD_REFRESH,icalclassify_refesh,ICAL_XLICCLASS_REFRESH},
+ {ICAL_METHOD_COUNTER,icalclassify_counter,ICAL_XLICCLASS_COUNTER},
+ {ICAL_METHOD_DECLINECOUNTER,icalclassify_delinecounter,ICAL_XLICCLASS_DECLINECOUNTER},
+ {ICAL_METHOD_NONE,0,ICAL_XLICCLASS_NONE}
};
@@ -678,3 +681,3 @@ struct icalclassify_map {
-ical_class icalclassify(icalcomponent* c,icalcomponent* match,
+icalproperty_xlicclass icalclassify(icalcomponent* c,icalcomponent* match,
const char* user)
@@ -684,3 +687,3 @@ ical_class icalclassify(icalcomponent* c,icalcomponent* match,
icalproperty_method method;
- ical_class class = ICAL_UNKNOWN_CLASS;
+ icalproperty_xlicclass class = ICAL_XLICCLASS_UNKNOWN;
@@ -694,3 +697,3 @@ ical_class icalclassify(icalcomponent* c,icalcomponent* match,
if (inner == 0) {
- return ICAL_NO_CLASS;
+ return ICAL_XLICCLASS_NONE;
}
@@ -711,3 +714,4 @@ ical_class icalclassify(icalcomponent* c,icalcomponent* match,
/* comp has a smaller sequence and a later DTSTAMP */
- return ICAL_MISSEQUENCED_CLASS;
+ class = ICAL_XLICCLASS_MISSEQUENCED;
+ goto CLEANUP;
}
@@ -720,3 +724,4 @@ ical_class icalclassify(icalcomponent* c,icalcomponent* match,
- return ICAL_OBSOLETE_CLASS;
+ class = ICAL_XLICCLASS_OBSOLETE;
+ goto CLEANUP;
}
@@ -727,3 +732,4 @@ ical_class icalclassify(icalcomponent* c,icalcomponent* match,
if (p == 0) {
- return ICAL_UNKNOWN_CLASS;
+ class = ICAL_XLICCLASS_UNKNOWN;
+ goto CLEANUP;
}
@@ -740,2 +746,3 @@ ical_class icalclassify(icalcomponent* c,icalcomponent* match,
+CLEANUP:
icalssutil_free_parts(&comp_parts);
@@ -747,46 +754 @@ ical_class icalclassify(icalcomponent* c,icalcomponent* match,
-struct class_map {
- ical_class class;
- char *str;
-} class_map[] = {
- {ICAL_NO_CLASS,"No class"},
- {ICAL_PUBLISH_NEW_CLASS,"New Publish"},
- {ICAL_PUBLISH_UPDATE_CLASS,"Publish Update"},
- {ICAL_PUBLISH_FREEBUSY_CLASS,"Publish freebusy"},
- {ICAL_REQUEST_NEW_CLASS,"New request"},
- {ICAL_REQUEST_UPDATE_CLASS,"Update"},
- {ICAL_REQUEST_RESCHEDULE_CLASS,"Reschedule"},
- {ICAL_REQUEST_DELEGATE_CLASS,"Delegate request"},
- {ICAL_REQUEST_NEW_ORGANIZER_CLASS,"New Organizer"},
- {ICAL_REQUEST_FORWARD_CLASS,"Forward"},
- {ICAL_REQUEST_STATUS_CLASS,"Status request"},
- {ICAL_REPLY_ACCEPT_CLASS,"Accept reply"},
- {ICAL_REPLY_DECLINE_CLASS,"Decline reply"},
- {ICAL_REPLY_DELEGATE_CLASS,"Delegation reply"},
- {ICAL_REPLY_CRASHER_ACCEPT_CLASS,"Crasher's accept reply"},
- {ICAL_REPLY_CRASHER_DECLINE_CLASS,"Crasher's decline reply"},
- {ICAL_ADD_INSTANCE_CLASS,"Add instance"},
- {ICAL_CANCEL_EVENT_CLASS,"Cancel event"},
- {ICAL_CANCEL_INSTANCE_CLASS,"Cancel instance"},
- {ICAL_CANCEL_ALL_CLASS,"Cancel all instances"},
- {ICAL_REFRESH_CLASS,"Refresh"},
- {ICAL_COUNTER_CLASS,"Counter"},
- {ICAL_DECLINECOUNTER_CLASS,"Decline counter"},
- {ICAL_MALFORMED_CLASS,"Malformed"},
- {ICAL_OBSOLETE_CLASS,"Obsolete"},
- {ICAL_MISSEQUENCED_CLASS,"Missequenced"},
- {ICAL_UNKNOWN_CLASS,"Unknown"}
-};
-
-char* icalclassify_class_to_string(ical_class class)
-{
- int i;
-
- for (i = 0;class_map[i].class != ICAL_UNKNOWN_CLASS;i++){
- if (class_map[i].class == class){
- return class_map[i].str;
- }
- }
-
- return "Unknown";
-}
diff --git a/libical/src/libicalss/icalclassify.h b/libical/src/libicalss/icalclassify.h
index 81188b3..aceabc0 100644
--- a/libical/src/libicalss/icalclassify.h
+++ b/libical/src/libicalss/icalclassify.h
@@ -31,35 +31,3 @@
-
-typedef enum icalclass {
- ICAL_NO_CLASS,
- ICAL_PUBLISH_NEW_CLASS,
- ICAL_PUBLISH_UPDATE_CLASS,
- ICAL_PUBLISH_FREEBUSY_CLASS,
- ICAL_REQUEST_NEW_CLASS,
- ICAL_REQUEST_UPDATE_CLASS,
- ICAL_REQUEST_RESCHEDULE_CLASS,
- ICAL_REQUEST_DELEGATE_CLASS,
- ICAL_REQUEST_NEW_ORGANIZER_CLASS,
- ICAL_REQUEST_FORWARD_CLASS,
- ICAL_REQUEST_STATUS_CLASS,
- ICAL_REQUEST_FREEBUSY_CLASS,
- ICAL_REPLY_ACCEPT_CLASS,
- ICAL_REPLY_DECLINE_CLASS,
- ICAL_REPLY_DELEGATE_CLASS,
- ICAL_REPLY_CRASHER_ACCEPT_CLASS,
- ICAL_REPLY_CRASHER_DECLINE_CLASS,
- ICAL_ADD_INSTANCE_CLASS,
- ICAL_CANCEL_EVENT_CLASS,
- ICAL_CANCEL_INSTANCE_CLASS,
- ICAL_CANCEL_ALL_CLASS,
- ICAL_REFRESH_CLASS,
- ICAL_COUNTER_CLASS,
- ICAL_DECLINECOUNTER_CLASS,
- ICAL_MALFORMED_CLASS,
- ICAL_OBSOLETE_CLASS, /* 21 */
- ICAL_MISSEQUENCED_CLASS, /* 22 */
- ICAL_UNKNOWN_CLASS /* 23 */
-} ical_class;
-
-ical_class icalclassify(icalcomponent* c,icalcomponent* match,
+icalproperty_xlicclass icalclassify(icalcomponent* c,icalcomponent* match,
const char* user);
@@ -68,3 +36,3 @@ icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp);
-char* icalclassify_class_to_string(ical_class iclass);
+char* icalclassify_class_to_string(icalproperty_xlicclass c);
diff --git a/libical/src/libicalss/icalcluster.c b/libical/src/libicalss/icalcluster.c
new file mode 100644
index 0000000..6d11078
--- a/dev/null
+++ b/libical/src/libicalss/icalcluster.c
@@ -0,0 +1,245 @@
+/* -*- Mode: C -*-
+ ======================================================================
+ FILE: icalcluster.c
+ CREATOR: acampi 13 March 2002
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2002, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The Original Code is eric. The Initial Developer of the Original
+ Code is Eric Busboom
+
+
+ ======================================================================*/
+
+
+/**
+ *
+ * icalcluster is an utility class design to manage clusters of
+ * icalcomponents on behalf of an implementation of icalset. This is
+ * done in order to split out common behavior different classes might
+ * need.
+ * The definition of what exactly a cluster will contain depends on the
+ * icalset subclass. At the basic level, an icluster is just a tuple,
+ * with anything as key and an icalcomponent as value.
+ */
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+
+#if 0
+#include <errno.h>
+#include <sys/stat.h> /* for stat */
+#ifndef WIN32
+#include <unistd.h> /* for stat, getpid */
+#else
+#include <io.h>
+#include <share.h>
+#endif
+#include <fcntl.h> /* for fcntl */
+#endif
+
+#include "icalcluster.h"
+#include "icalclusterimpl.h"
+#include "icalgauge.h"
+
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
+#endif
+
+
+icalcluster * icalcluster_new_impl(void) {
+
+ struct icalcluster_impl* impl;
+
+ if ((impl = (struct icalcluster_impl*)malloc(
+ sizeof(struct icalcluster_impl))) == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ memset(impl, 0, sizeof(struct icalcluster_impl));
+ strcpy(impl->id,ICALCLUSTER_ID);
+
+ return impl;
+}
+
+/**
+ * Create a cluster with a key/value pair.
+ *
+ * @todo Always do a deep copy.
+ */
+
+icalcluster * icalcluster_new(const char* key, icalcomponent *data) {
+ struct icalcluster_impl *impl = icalcluster_new_impl();
+ assert(impl->data == 0);
+
+ impl->key = strdup(key);
+ impl->changed = 0;
+ impl->data = 0;
+
+ if (data != NULL) {
+ if (icalcomponent_isa(data) != ICAL_XROOT_COMPONENT) {
+ impl->data = icalcomponent_new(ICAL_XROOT_COMPONENT);
+ icalcomponent_add_component(impl->data, data);
+ } else {
+ impl->data = icalcomponent_new_clone(data);
+ }
+ } else {
+ impl->data = icalcomponent_new(ICAL_XROOT_COMPONENT);
+ }
+
+ return impl;
+}
+
+/**
+ * Deep clone an icalcluster to a new one
+ */
+
+icalcluster *icalcluster_new_clone(const icalcluster *data) {
+ struct icalcluster_impl *old = (struct icalcluster_impl *)data;
+ struct icalcluster_impl *impl = icalcluster_new_impl();
+
+ impl->key = strdup(old->key);
+ impl->data = icalcomponent_new_clone(old->data);
+ impl->changed = 0;
+
+ return impl;
+}
+
+
+void icalcluster_free(icalcluster *impl) {
+ icalerror_check_arg_rv((impl!=0),"cluster");
+
+ if (impl->key != 0){
+ free(impl->key);
+ impl->key = 0;
+ }
+
+ if (impl->data != 0){
+ icalcomponent_free(impl->data);
+ impl->data = 0;
+ }
+
+ free(impl);
+}
+
+
+const char *icalcluster_key(icalcluster *impl) {
+ icalerror_check_arg_rz((impl!=0),"cluster");
+
+ return impl->key;
+}
+
+
+int icalcluster_is_changed(icalcluster *impl) {
+ icalerror_check_arg_rz((impl!=0),"cluster");
+
+ return impl->changed;
+}
+
+
+void icalcluster_mark(icalcluster *impl) {
+ icalerror_check_arg_rv((impl!=0),"cluster");
+
+ impl->changed = 1;
+}
+
+
+void icalcluster_commit(icalcluster *impl) {
+ icalerror_check_arg_rv((impl!=0),"cluster");
+
+ impl->changed = 0;
+}
+
+
+icalcomponent *icalcluster_get_component(icalcluster *impl) {
+
+ icalerror_check_arg_rz((impl!=0),"cluster");
+
+ if (icalcomponent_isa(impl->data) != ICAL_XROOT_COMPONENT) {
+ icalerror_warn("The top component is not an XROOT");
+ fprintf(stderr, "%s\n", icalcomponent_as_ical_string(impl->data));
+ abort();
+ }
+
+ return impl->data;
+}
+
+
+icalerrorenum icalcluster_add_component(icalcluster *impl, icalcomponent* child) {
+
+ icalerror_check_arg_re((impl!=0),"cluster", ICAL_BADARG_ERROR);
+ icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR);
+
+ icalcomponent_add_component(impl->data, child);
+ icalcluster_mark(impl);
+
+ return ICAL_NO_ERROR;
+}
+
+
+icalerrorenum icalcluster_remove_component(icalcluster *impl, icalcomponent* child) {
+
+ icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR);
+ icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR);
+
+ icalcomponent_remove_component(impl->data,child);
+ icalcluster_mark(impl);
+
+ return ICAL_NO_ERROR;
+}
+
+
+int icalcluster_count_components(icalcluster *impl, icalcomponent_kind kind) {
+
+ icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR);
+
+ return icalcomponent_count_components(impl->data, kind);
+}
+
+
+/** Iterate through components **/
+icalcomponent *icalcluster_get_current_component(icalcluster* impl) {
+
+ icalerror_check_arg_rz((impl!=0),"cluster");
+
+ return icalcomponent_get_current_component(impl->data);
+}
+
+
+icalcomponent *icalcluster_get_first_component(icalcluster* impl) {
+
+ icalerror_check_arg_rz((impl!=0),"cluster");
+
+ return icalcomponent_get_first_component(impl->data,
+ ICAL_ANY_COMPONENT);
+}
+
+
+icalcomponent *icalcluster_get_next_component(icalcluster* impl) {
+
+ icalerror_check_arg_rz((impl!=0),"cluster");
+
+ return icalcomponent_get_next_component(impl->data,
+ ICAL_ANY_COMPONENT);
+}
diff --git a/libical/src/libicalss/icalcluster.h b/libical/src/libicalss/icalcluster.h
new file mode 100644
index 0000000..f4eb041
--- a/dev/null
+++ b/libical/src/libicalss/icalcluster.h
@@ -0,0 +1,61 @@
+/* -*- Mode: C -*- */
+/*======================================================================
+ FILE: icalcluster.h
+ CREATOR: eric 23 December 1999
+
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The Original Code is eric. The Initial Developer of the Original
+ Code is Eric Busboom
+
+
+======================================================================*/
+
+#ifndef ICALCLUSTER_H
+#define ICALCLUSTER_H
+
+#include "ical.h"
+#include "icalset.h"
+
+typedef struct icalcluster_impl icalcluster;
+
+icalcluster* icalcluster_new(const char *key, icalcomponent *data);
+icalcluster* icalcluster_new_clone(const icalcluster *cluster);
+
+void icalcluster_free(icalcluster *cluster);
+
+const char* icalcluster_key(icalcluster *cluster);
+int icalcluster_is_changed(icalcluster *cluster);
+void icalcluster_mark(icalcluster *cluster);
+void icalcluster_commit(icalcluster *cluster);
+
+icalcomponent* icalcluster_get_component(icalcluster* cluster);
+int icalcluster_count_components(icalcluster *cluster, icalcomponent_kind kind);
+icalerrorenum icalcluster_add_component(icalcluster* cluster,
+ icalcomponent* child);
+icalerrorenum icalcluster_remove_component(icalcluster* cluster,
+ icalcomponent* child);
+
+icalcomponent* icalcluster_get_current_component(icalcluster* cluster);
+icalcomponent* icalcluster_get_first_component(icalcluster* cluster);
+icalcomponent* icalcluster_get_next_component(icalcluster* cluster);
+
+#endif /* !ICALCLUSTER_H */
+
+
+
diff --git a/libical/src/libicalss/icalclusterimpl.h b/libical/src/libicalss/icalclusterimpl.h
new file mode 100644
index 0000000..ef80e1a
--- a/dev/null
+++ b/libical/src/libicalss/icalclusterimpl.h
@@ -0,0 +1,45 @@
+/* -*- Mode: C -*-
+ ======================================================================
+ FILE: icalfilesetimpl.h
+ CREATOR: eric 23 December 1999
+
+ $Id$
+ $Locker$
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The Original Code is eric. The Initial Developer of the Original
+ Code is Eric Busboom
+
+
+ ======================================================================*/
+
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/* This definition is in its own file so it can be kept out of the
+ main header file, but used by "friend classes" like icaldirset*/
+
+#define ICALCLUSTER_ID "clus"
+
+struct icalcluster_impl {
+
+ char id[5]; /* clus */
+
+ char *key;
+ icalcomponent *data;
+ int changed;
+};
diff --git a/libical/src/libicalss/icaldirset.c b/libical/src/libicalss/icaldirset.c
index b6cb673..4a20fe1 100644
--- a/libical/src/libicalss/icaldirset.c
+++ b/libical/src/libicalss/icaldirset.c
@@ -28,5 +28,6 @@
-/*
+/**
+ @file icaldirset.c
- icaldirset manages a database of ical components and offers
+ @brief icaldirset manages a database of ical components and offers
interfaces for reading, writting and searching for components.
@@ -38,8 +39,9 @@
- The primary interfaces are icaldirset_first and icaldirset_next. These
- routine iterate through all of the components in the store, subject
- to the current gauge. A gauge is an icalcomponent that is tested
- against other componets for a match. If a gauge has been set with
- icaldirset_select, icaldirset_first and icaldirset_next will only
- return componentes that match the gauge.
+ The primary interfaces are icaldirset__get_first_component and
+ icaldirset_get_next_component. These routine iterate through all of
+ the components in the store, subject to the current gauge. A gauge
+ is an icalcomponent that is tested against other componets for a
+ match. If a gauge has been set with icaldirset_select,
+ icaldirset_first and icaldirset_next will only return componentes
+ that match the gauge.
@@ -57,7 +59,4 @@
-#include "icalerror.h"
#include "ical.h"
#include "icaldirset.h"
-#include "pvl.h"
-#include "icalparser.h"
#include "icaldirset.h"
@@ -65,2 +64,3 @@
#include "icalfilesetimpl.h"
+#include "icalcluster.h"
#include "icalgauge.h"
@@ -68,17 +68,13 @@
#include <limits.h> /* For PATH_MAX */
-#include <errno.h>
-#include <sys/types.h> /* for opendir() */
-#include <sys/stat.h> /* for stat */
-
-int snprintf(char *str, size_t n, char const *fmt, ...);
-
-// Eugen C. <eug@thekompany.com>
-#include <defines.h>
-#ifndef _QTWIN_
+#ifndef WIN32
#include <dirent.h> /* for opendir() */
-#include <unistd.h>
+#include <unistd.h> /* for stat, getpid */
#include <sys/utsname.h> /* for uname */
+#else
+#include <io.h>
+#include <process.h>
#endif
-// Eugen C. <eug@thekompany.com>
-
+#include <errno.h>
+#include <sys/types.h> /* for opendir() */
+#include <sys/stat.h> /* for stat */
#include <time.h> /* for clock() */
@@ -89,30 +85,29 @@ int snprintf(char *str, size_t n, char const *fmt, ...);
-struct icaldirset_impl* icaldirset_new_impl()
-{
- struct icaldirset_impl* impl;
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
- if ( ( impl = (struct icaldirset_impl*)
- malloc(sizeof(struct icaldirset_impl))) == 0) {
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return 0;
- }
+#define _S_ISTYPE(mode, mask) (((mode) & _S_IFMT) == (mask))
+
+#define S_ISDIR(mode) _S_ISTYPE((mode), _S_IFDIR)
+#define S_ISREG(mode) _S_ISTYPE((mode), _S_IFREG)
+#endif
- strcpy(impl->id,ICALDIRSET_ID);
+/** Default options used when NULL is passed to icalset_new() **/
+icaldirset_options icaldirset_options_default = {O_RDWR|O_CREAT};
- return impl;
-}
-const char* icaldirset_path(icaldirset* cluster)
+const char* icaldirset_path(icalset* set)
{
- struct icaldirset_impl *impl = icaldirset_new_impl();
-
- return impl->dir;
+ icaldirset *dset = (icaldirset*)set;
+ return dset->dir;
}
-void icaldirset_mark(icaldirset* store)
+
+void icaldirset_mark(icalset* set)
{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
+ icaldirset *dset = (icaldirset*)set;
- icalfileset_mark(impl->cluster);
+ icalcluster_mark(dset->cluster);
}
@@ -120,8 +115,16 @@ void icaldirset_mark(icaldirset* store)
-icalerrorenum icaldirset_commit(icaldirset* store)
+icalerrorenum icaldirset_commit(icalset* set)
{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
+ icaldirset *dset = (icaldirset*)set;
+ icalset *fileset;
+ icalfileset_options options = icalfileset_options_default;
- return icalfileset_commit(impl->cluster);
+ options.cluster = dset->cluster;
+ fileset = icalset_new(ICAL_FILE_SET, icalcluster_key(dset->cluster), &options);
+
+ fileset->commit(fileset);
+ fileset->free(fileset);
+
+ return ICAL_NO_ERROR;
}
@@ -138,12 +141,12 @@ void icaldirset_unlock(const char* dir)
/* Load the contents of the store directory into the store's internal directory list*/
-icalerrorenum icaldirset_read_directory(struct icaldirset_impl* impl)
+icalerrorenum icaldirset_read_directory(icaldirset *dset)
{
-#ifndef _QTWIN_
+ char *str;
+#ifndef WIN32
struct dirent *de;
DIR* dp;
- char *str;
- dp = opendir(impl->dir);
+ dp = opendir(dset->dir);
- if ( dp == 0) {
+ if (dp == 0) {
icalerror_set_errno(ICAL_FILE_ERROR);
@@ -153,3 +156,3 @@ icalerrorenum icaldirset_read_directory(struct icaldirset_impl* impl)
/* clear contents of directory list */
- while((str = pvl_pop(impl->directory))){
+ while((str = pvl_pop(dset->directory))){
free(str);
@@ -168,3 +171,3 @@ icalerrorenum icaldirset_read_directory(struct icaldirset_impl* impl)
- pvl_push(impl->directory, (void*)strdup(de->d_name));
+ pvl_push(dset->directory, (void*)strdup(de->d_name));
}
@@ -172,20 +175,44 @@ icalerrorenum icaldirset_read_directory(struct icaldirset_impl* impl)
closedir(dp);
-
- return ICAL_NO_ERROR;
#else
- icalerror_set_errno(ICAL_FILE_ERROR);
- return ICAL_FILE_ERROR;
+ struct _finddata_t c_file;
+ long hFile;
+
+ /* Find first .c file in current directory */
+ if( (hFile = _findfirst( "*", &c_file )) == -1L ) {
+ icalerror_set_errno(ICAL_FILE_ERROR);
+ return ICAL_FILE_ERROR;
+ } else {
+ while((str = pvl_pop(dset->directory))){
+ free(str);
+ }
+
+ /* load all of the cluster names in the directory list */
+ do {
+ /* Remove known directory names '.' and '..'*/
+ if (strcmp(c_file.name,".") == 0 ||
+ strcmp(c_file.name,"..") == 0 ){
+ continue;
+ }
+
+ pvl_push(dset->directory, (void*)strdup(c_file.name));
+ }
+ while ( _findnext( hFile, &c_file ) == 0 );
+
+ _findclose( hFile );
+ }
+
#endif
+
+ return ICAL_NO_ERROR;
}
-icaldirset* icaldirset_new(const char* dir)
+
+icalset* icaldirset_init(icalset* set, const char* dir, void* options_in)
{
- struct icaldirset_impl *impl = icaldirset_new_impl();
+ icaldirset *dset = (icaldirset*)set;
+ icaldirset_options *options = options_in;
struct stat sbuf;
- if (impl == 0){
- return 0;
- }
-
icalerror_check_arg_rz( (dir!=0), "dir");
+ icalerror_check_arg_rz( (set!=0), "set");
@@ -196,3 +223,2 @@ icaldirset* icaldirset_new(const char* dir)
-#ifndef _QTWIN_
/* dir is not the name of a direectory*/
@@ -202,3 +228,2 @@ icaldirset* icaldirset_new(const char* dir)
}
-#endif
@@ -206,41 +231,61 @@ icaldirset* icaldirset_new(const char* dir)
- impl = icaldirset_new_impl();
+ dset->dir = (char*)strdup(dir);
+ dset->options = *options;
+ dset->directory = pvl_newlist();
+ dset->directory_iterator = 0;
+ dset->gauge = 0;
+ dset->first_component = 0;
+ dset->cluster = 0;
+
+ return set;
+}
+
+icalset* icaldirset_new(const char* dir)
+{
+ return icalset_new(ICAL_DIR_SET, dir, &icaldirset_options_default);
+}
- if (impl ==0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return 0;
- }
- impl->directory = pvl_newlist();
- impl->directory_iterator = 0;
- impl->dir = (char*)strdup(dir);
- impl->gauge = 0;
- impl->first_component = 0;
- impl->cluster = 0;
+icalset* icaldirset_new_reader(const char* dir)
+{
+ icaldirset_options reader_options = icaldirset_options_default;
- icaldirset_read_directory(impl);
+ reader_options.flags = O_RDONLY;
- return (icaldirset*) impl;
+ return icalset_new(ICAL_DIR_SET, dir, &reader_options);
}
-void icaldirset_free(icaldirset* s)
+
+icalset* icaldirset_new_writer(const char* dir)
{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)s;
+ icaldirset_options writer_options = icaldirset_options_default;
+
+ writer_options.flags = O_RDWR|O_CREAT;
+
+ return icalset_new(ICAL_DIR_SET, dir, &writer_options);
+}
+
+
+void icaldirset_free(icalset* s)
+{
+ icaldirset *dset = (icaldirset*)s;
char* str;
- icaldirset_unlock(impl->dir);
+ icaldirset_unlock(dset->dir);
- if(impl->dir !=0){
- free(impl->dir);
+ if(dset->dir !=0){
+ free(dset->dir);
+ dset->dir = 0;
}
- if(impl->gauge !=0){
- icalcomponent_free(impl->gauge);
+ if(dset->gauge !=0){
+ icalgauge_free(dset->gauge);
+ dset->gauge = 0;
}
- if(impl->cluster !=0){
- icalfileset_free(impl->cluster);
+ if(dset->cluster !=0){
+ icalcluster_free(dset->cluster);
}
- while(impl->directory !=0 && (str=pvl_pop(impl->directory)) != 0){
+ while(dset->directory !=0 && (str=pvl_pop(dset->directory)) != 0){
free(str);
@@ -248,16 +293,12 @@ void icaldirset_free(icaldirset* s)
- if(impl->directory != 0){
- pvl_free(impl->directory);
+ if(dset->directory != 0){
+ pvl_free(dset->directory);
+ dset->directory = 0;
}
- impl->directory = 0;
- impl->directory_iterator = 0;
- impl->dir = 0;
- impl->gauge = 0;
- impl->first_component = 0;
-
- free(impl);
-
+ dset->directory_iterator = 0;
+ dset->first_component = 0;
}
+
/* icaldirset_next_uid_number updates a serial number in the Store
@@ -265,5 +306,4 @@ void icaldirset_free(icaldirset* s)
-int icaldirset_next_uid_number(icaldirset* store)
+int icaldirset_next_uid_number(icaldirset* dset)
{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
char sequence = 0;
@@ -275,12 +315,8 @@ int icaldirset_next_uid_number(icaldirset* store)
- icalerror_check_arg_rz( (store!=0), "store");
+ icalerror_check_arg_rz( (dset!=0), "dset");
- sprintf(filename,"%s/%s",impl->dir,"SEQUENCE");
+ sprintf(filename,"%s/%s",dset->dir,"SEQUENCE");
/* Create the file if it does not exist.*/
-#ifndef _QTWIN_
if (stat(filename,&sbuf) == -1 || !S_ISREG(sbuf.st_mode)){
-#else
- if (stat(filename,&sbuf) == -1){
-#endif
@@ -294,3 +330,2 @@ int icaldirset_next_uid_number(icaldirset* store)
}
-
}
@@ -320,11 +355,9 @@ int icaldirset_next_uid_number(icaldirset* store)
}
-
}
-icalerrorenum icaldirset_next_cluster(icaldirset* store)
+icalerrorenum icaldirset_next_cluster(icaldirset* dset)
{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
char path[ICAL_PATH_MAX];
- if (impl->directory_iterator == 0){
+ if (dset->directory_iterator == 0){
icalerror_set_errno(ICAL_INTERNAL_ERROR);
@@ -332,9 +365,9 @@ icalerrorenum icaldirset_next_cluster(icaldirset* store)
}
- impl->directory_iterator = pvl_next(impl->directory_iterator);
+ dset->directory_iterator = pvl_next(dset->directory_iterator);
- if (impl->directory_iterator == 0){
+ if (dset->directory_iterator == 0){
/* There are no more clusters */
- if(impl->cluster != 0){
- icalfileset_free(impl->cluster);
- impl->cluster = 0;
+ if(dset->cluster != 0){
+ icalcluster_free(dset->cluster);
+ dset->cluster = 0;
}
@@ -343,7 +376,6 @@ icalerrorenum icaldirset_next_cluster(icaldirset* store)
- sprintf(path,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator));
+ sprintf(path,"%s/%s", dset->dir,(char*)pvl_data(dset->directory_iterator));
- icalfileset_free(impl->cluster);
-
- impl->cluster = icalfileset_new(path);
+ icalcluster_free(dset->cluster);
+ dset->cluster = icalfileset_produce_icalcluster(path);
@@ -352,11 +384,10 @@ icalerrorenum icaldirset_next_cluster(icaldirset* store)
-void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
+static void icaldirset_add_uid(icalcomponent* comp)
{
-#ifndef _QTWIN_
-
char uidstring[ICAL_PATH_MAX];
icalproperty *uid;
+#ifndef WIN32
struct utsname unamebuf;
+#endif
- icalerror_check_arg_rv( (store!=0), "store");
icalerror_check_arg_rv( (comp!=0), "comp");
@@ -367,2 +398,3 @@ void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
+#ifndef WIN32
uname(&unamebuf);
@@ -370,2 +402,5 @@ void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
sprintf(uidstring,"%d-%s",(int)getpid(),unamebuf.nodename);
+#else
+ sprintf(uidstring,"%d-%s",(int)getpid(),"WINDOWS"); /* FIX: There must be an easy get the system name */
+#endif
@@ -374,7 +409,4 @@ void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
} else {
-
strcpy(uidstring,icalproperty_get_uid(uid));
}
-
-#endif
}
@@ -382,11 +414,12 @@ void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
-/* This assumes that the top level component is a VCALENDAR, and there
+/**
+ This assumes that the top level component is a VCALENDAR, and there
is an inner component of type VEVENT, VTODO or VJOURNAL. The inner
- component must have a DTAMP property */
+ component must have a DSTAMP property
+*/
-icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
+icalerrorenum icaldirset_add_component(icalset* set, icalcomponent* comp)
{
- struct icaldirset_impl *impl;
char clustername[ICAL_PATH_MAX];
- icalproperty *dt;
+ icalproperty *dt = 0;
icalvalue *v;
@@ -395,10 +428,8 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
icalcomponent *inner;
+ icaldirset *dset = (icaldirset*) set;
- impl = (struct icaldirset_impl*)store;
- icalerror_check_arg_rz( (store!=0), "store");
+ icalerror_check_arg_rz( (dset!=0), "dset");
icalerror_check_arg_rz( (comp!=0), "comp");
- errno = 0;
-
- icaldirset_add_uid(store,comp);
+ icaldirset_add_uid(comp);
@@ -412,9 +443,7 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
- if (dt != 0){
+ if (dt != 0)
break;
}
- }
-
- if (dt == 0){
+ if (dt == 0) {
for(inner = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT);
@@ -425,3 +454,3 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
- if (dt != 0){
+ if (dt != 0)
break;
@@ -430,7 +459,3 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
- }
-
if (dt == 0){
-
-
icalerror_warn("The component does not have a DTSTAMP or DTSTART property, so it cannot be added to the store");
@@ -441,19 +466,17 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
v = icalproperty_get_value(dt);
-
tm = icalvalue_get_datetime(v);
- snprintf(clustername,ICAL_PATH_MAX,"%s/%04d%02d",impl->dir,tm.year,tm.month);
+ snprintf(clustername,ICAL_PATH_MAX,"%s/%04d%02d",dset->dir, tm.year, tm.month);
/* Load the cluster and insert the object */
-
- if(impl->cluster != 0 &&
- strcmp(clustername,icalfileset_path(impl->cluster)) != 0 ){
- icalfileset_free(impl->cluster);
- impl->cluster = 0;
+ if(dset->cluster != 0 &&
+ strcmp(clustername,icalcluster_key(dset->cluster)) != 0 ){
+ icalcluster_free(dset->cluster);
+ dset->cluster = 0;
}
- if (impl->cluster == 0){
- impl->cluster = icalfileset_new(clustername);
+ if (dset->cluster == 0){
+ dset->cluster = icalfileset_produce_icalcluster(clustername);
- if (impl->cluster == 0){
+ if (dset->cluster == 0){
error = icalerrno;
@@ -468,6 +491,5 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
/* Add the component to the cluster */
-
- icalfileset_add_component(impl->cluster,comp);
+ icalcluster_add_component(dset->cluster,comp);
- icalfileset_mark(impl->cluster);
+ /* icalcluster_mark(impl->cluster); */
@@ -476,14 +498,13 @@ icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
-/* Remove a component in the current cluster. HACK. This routine is a
+/**
+ Remove a component in the current cluster. HACK. This routine is a
"friend" of icalfileset, and breaks its encapsulation. It was
either do it this way, or add several layers of interfaces that had
- no other use. */
-icalerrorenum icaldirset_remove_component(icaldirset* store, icaldirset* comp)
-{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
-
- struct icalfileset_impl *filesetimpl =
- (struct icalfileset_impl*)impl->cluster;
+ no other use.
+ */
- icalcomponent *filecomp = filesetimpl->cluster;
+icalerrorenum icaldirset_remove_component(icalset* set, icalcomponent* comp)
+{
+ icaldirset *dset = (icaldirset*)set;
+ icalcomponent *filecomp = icalcluster_get_component(dset->cluster);
@@ -492,5 +513,5 @@ icalerrorenum icaldirset_remove_component(icaldirset* store, icaldirset* comp)
- icalerror_check_arg_re((store!=0),"store",ICAL_BADARG_ERROR);
+ icalerror_check_arg_re((set!=0),"set",ICAL_BADARG_ERROR);
icalerror_check_arg_re((comp!=0),"comp",ICAL_BADARG_ERROR);
- icalerror_check_arg_re((impl->cluster!=0),"Cluster pointer",ICAL_USAGE_ERROR);
+ icalerror_check_arg_re((dset->cluster!=0),"Cluster pointer",ICAL_USAGE_ERROR);
@@ -513,13 +534,12 @@ icalerrorenum icaldirset_remove_component(icaldirset* store, icaldirset* comp)
- icalfileset_remove_component(impl->cluster,comp);
+ icalcluster_remove_component(dset->cluster,comp);
- icalfileset_mark(impl->cluster);
+ /* icalcluster_mark(impl->cluster); */
/* If the removal emptied the fileset, get the next fileset */
- if( icalfileset_count_components(impl->cluster,ICAL_ANY_COMPONENT)==0){
-
- icalerrorenum error = icaldirset_next_cluster(store);
+ if( icalcluster_count_components(dset->cluster,ICAL_ANY_COMPONENT)==0){
+ icalerrorenum error = icaldirset_next_cluster(dset);
- if(impl->cluster != 0 && error == ICAL_NO_ERROR){
- icalfileset_get_first_component(impl->cluster);
+ if(dset->cluster != 0 && error == ICAL_NO_ERROR){
+ icalcluster_get_first_component(dset->cluster);
} else {
@@ -537,3 +557,3 @@ icalerrorenum icaldirset_remove_component(icaldirset* store, icaldirset* comp)
-int icaldirset_count_components(icaldirset* store,
+int icaldirset_count_components(icalset* store,
icalcomponent_kind kind)
@@ -541,3 +561,2 @@ int icaldirset_count_components(icaldirset* store,
/* HACK, not implemented */
-
assert(0);
@@ -548,3 +567,3 @@ int icaldirset_count_components(icaldirset* store,
-icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c)
+icalcomponent* icaldirset_fetch_match(icalset* set, icalcomponent *c)
{
@@ -552,2 +571,3 @@ icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c)
assert(0);
+ return 0;
}
@@ -555,33 +575,25 @@ icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c)
-icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid)
+icalcomponent* icaldirset_fetch(icalset* set, const char* uid)
{
- icalcomponent *gauge;
- icalcomponent *old_gauge;
+ icaldirset *dset = (icaldirset*)set;
+ icalgauge *gauge;
+ icalgauge *old_gauge;
icalcomponent *c;
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
+ char sql[256];
- icalerror_check_arg_rz( (store!=0), "store");
+ icalerror_check_arg_rz( (set!=0), "set");
icalerror_check_arg_rz( (uid!=0), "uid");
- gauge =
- icalcomponent_vanew(
- ICAL_VCALENDAR_COMPONENT,
- icalcomponent_vanew(
- ICAL_VEVENT_COMPONENT,
- icalproperty_vanew_uid(
- uid,
- icalparameter_new_xliccomparetype(
- ICAL_XLICCOMPARETYPE_EQUAL),
- 0),
- 0),
- 0);
+ snprintf(sql, 256, "SELECT * FROM VEVENT WHERE UID = \"%s\"", uid);
+
+ gauge = icalgauge_new_from_sql(sql, 0);
- old_gauge = impl->gauge;
- impl->gauge = gauge;
+ old_gauge = dset->gauge;
+ dset->gauge = gauge;
- c= icaldirset_get_first_component(store);
+ c= icaldirset_get_first_component(set);
- impl->gauge = old_gauge;
+ dset->gauge = old_gauge;
- icalcomponent_free(gauge);
+ icalgauge_free(gauge);
@@ -591,3 +603,3 @@ icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid)
-int icaldirset_has_uid(icaldirset* store, const char* uid)
+int icaldirset_has_uid(icalset* set, const char* uid)
{
@@ -595,3 +607,3 @@ int icaldirset_has_uid(icaldirset* store, const char* uid)
- icalerror_check_arg_rz( (store!=0), "store");
+ icalerror_check_arg_rz( (set!=0), "set");
icalerror_check_arg_rz( (uid!=0), "uid");
@@ -601,3 +613,3 @@ int icaldirset_has_uid(icaldirset* store, const char* uid)
around */
- c = icaldirset_fetch(store,uid);
+ c = icaldirset_fetch(set,uid);
@@ -608,14 +620,10 @@ int icaldirset_has_uid(icaldirset* store, const char* uid)
-icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge)
- {
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
+icalerrorenum icaldirset_select(icalset* set, icalgauge* gauge)
+{
+ icaldirset *dset = (icaldirset*)set;
- icalerror_check_arg_re( (store!=0), "store",ICAL_BADARG_ERROR);
+ icalerror_check_arg_re( (set!=0), "set",ICAL_BADARG_ERROR);
icalerror_check_arg_re( (gauge!=0), "gauge",ICAL_BADARG_ERROR);
- if (!icalcomponent_is_valid(gauge)){
- return ICAL_BADARG_ERROR;
- }
-
- impl->gauge = gauge;
+ dset->gauge = gauge;
@@ -625,3 +633,4 @@ icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge)
-icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *old,
+icalerrorenum icaldirset_modify(icalset* set,
+ icalcomponent *old,
icalcomponent *new)
@@ -634,3 +643,3 @@ icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *old,
-void icaldirset_clear(icaldirset* store)
+void icaldirset_clear(icalset* set)
{
@@ -642,12 +651,14 @@ void icaldirset_clear(icaldirset* store)
-icalcomponent* icaldirset_get_current_component(icaldirset* store)
+icalcomponent* icaldirset_get_current_component(icalset* set)
{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
+ icaldirset *dset = (icaldirset*)set;
- if(impl->cluster == 0){
- icaldirset_get_first_component(store);
+ if (dset->cluster == 0){
+ icaldirset_get_first_component(set);
+ }
+ if(dset->cluster == 0){
+ return 0;
}
- return icalfileset_get_current_component(impl->cluster);
-
+ return icalcluster_get_current_component(dset->cluster);
}
@@ -655,5 +666,6 @@ icalcomponent* icaldirset_get_current_component(icaldirset* store)
-icalcomponent* icaldirset_get_first_component(icaldirset* store)
+icalcomponent* icaldirset_get_first_component(icalset* set)
{
- struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
+ icaldirset *dset = (icaldirset*)set;
+
icalerrorenum error;
@@ -661,3 +673,3 @@ icalcomponent* icaldirset_get_first_component(icaldirset* store)
- error = icaldirset_read_directory(impl);
+ error = icaldirset_read_directory(dset);
@@ -668,5 +680,5 @@ icalcomponent* icaldirset_get_first_component(icaldirset* store)
- impl->directory_iterator = pvl_head(impl->directory);
+ dset->directory_iterator = pvl_head(dset->directory);
- if (impl->directory_iterator == 0){
+ if (dset->directory_iterator == 0){
icalerror_set_errno(error);
@@ -675,3 +687,5 @@ icalcomponent* icaldirset_get_first_component(icaldirset* store)
- snprintf(path,ICAL_PATH_MAX,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator));
+ snprintf(path,ICAL_PATH_MAX,"%s/%s",
+ dset->dir,
+ (char*)pvl_data(dset->directory_iterator));
@@ -680,11 +694,11 @@ icalcomponent* icaldirset_get_first_component(icaldirset* store)
- if(impl->cluster != 0 && strcmp(path,icalfileset_path(impl->cluster)) != 0 ){
- icalfileset_free(impl->cluster);
- impl->cluster = 0;
+ if(dset->cluster != 0 && strcmp(path,icalcluster_key(dset->cluster)) != 0 ){
+ icalcluster_free(dset->cluster);
+ dset->cluster = 0;
}
- if (impl->cluster == 0){
- impl->cluster = icalfileset_new(path);
+ if (dset->cluster == 0){
+ dset->cluster = icalfileset_produce_icalcluster(path);
- if (impl->cluster == 0){
+ if (dset->cluster == 0){
error = icalerrno;
@@ -698,10 +712,11 @@ icalcomponent* icaldirset_get_first_component(icaldirset* store)
- impl->first_component = 1;
+ dset->first_component = 1;
- return icaldirset_get_next_component(store);
+ return icaldirset_get_next_component(set);
}
-icalcomponent* icaldirset_get_next_component(icaldirset* store)
+
+icalcomponent* icaldirset_get_next_component(icalset* set)
{
- struct icaldirset_impl *impl;
+ icaldirset *dset = (icaldirset*)set;
icalcomponent *c;
@@ -709,8 +724,6 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store)
- icalerror_check_arg_rz( (store!=0), "store");
-
- impl = (struct icaldirset_impl*)store;
+ icalerror_check_arg_rz( (set!=0), "set");
- if(impl->cluster == 0){
+ if(dset->cluster == 0){
icalerror_warn("icaldirset_get_next_component called with a NULL cluster (Caller must call icaldirset_get_first_component first");
@@ -722,15 +735,14 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store)
/* Set the component iterator for the following for loop */
- if (impl->first_component == 1){
- icalfileset_get_first_component(impl->cluster);
- impl->first_component = 0;
+ if (dset->first_component == 1){
+ icalcluster_get_first_component(dset->cluster);
+ dset->first_component = 0;
} else {
- icalfileset_get_next_component(impl->cluster);
+ icalcluster_get_next_component(dset->cluster);
}
-
while(1){
/* Iterate through all of the objects in the cluster*/
- for( c = icalfileset_get_current_component(impl->cluster);
+ for( c = icalcluster_get_current_component(dset->cluster);
c != 0;
- c = icalfileset_get_next_component(impl->cluster)){
+ c = icalcluster_get_next_component(dset->cluster)){
@@ -739,9 +751,6 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store)
-#if 0 /* HACK */
- if (impl->gauge != 0 && icalgauge_test(c,impl->gauge) == 0){
+ if (dset->gauge != 0 && icalgauge_compare(dset->gauge,c) == 0){
continue;
}
-#else
- assert(0); /* icalgauge_test needs to be fixed */
-#endif
+
/* Either there is no gauge, or the component passed the
@@ -755,5 +764,5 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store)
- error = icaldirset_next_cluster(store);
+ error = icaldirset_next_cluster(dset);
- if(impl->cluster == 0 || error != ICAL_NO_ERROR){
+ if(dset->cluster == 0 || error != ICAL_NO_ERROR){
/* No more clusters */
@@ -761,3 +770,3 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store)
} else {
- c = icalfileset_get_first_component(impl->cluster);
+ c = icalcluster_get_first_component(dset->cluster);
@@ -771,7 +780,26 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store)
-
+icalsetiter icaldirset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge)
+{
+ icalsetiter itr = icalsetiter_null;
+ icaldirset *fset = (icaldirset*) set;
+ icalerror_check_arg_re((fset!=0), "set", icalsetiter_null);
+ itr.iter.kind = kind;
+ itr.gauge = gauge;
+ /* TO BE IMPLEMENTED */
+ return icalsetiter_null;
+}
-
+icalcomponent* icaldirsetiter_to_next(icalset* set, icalsetiter* i)
+{
+ /* TO BE IMPLEMENTED */
+ return NULL;
+}
+
+icalcomponent* icaldirsetiter_to_prior(icalset* set, icalsetiter* i)
+{
+ /* TO BE IMPLEMENTED */
+ return NULL;
+}
diff --git a/libical/src/libicalss/icaldirset.h b/libical/src/libicalss/icaldirset.h
index 7d205ec..a2d577d 100644
--- a/libical/src/libicalss/icaldirset.h
+++ b/libical/src/libicalss/icaldirset.h
@@ -32,2 +32,5 @@
#include "ical.h"
+#include "icalset.h"
+#include "icalcluster.h"
+#include "icalgauge.h"
@@ -36,10 +39,14 @@
-typedef void icaldirset;
+typedef struct icaldirset_impl icaldirset;
+icalset* icaldirset_new(const char* path);
-icaldirset* icaldirset_new(const char* path);
+icalset* icaldirset_new_reader(const char* path);
+icalset* icaldirset_new_writer(const char* path);
-void icaldirset_free(icaldirset* store);
-const char* icaldirset_path(icaldirset* store);
+icalset* icaldirset_init(icalset* set, const char *dsn, void *options);
+void icaldirset_free(icalset* set);
+
+const char* icaldirset_path(icalset* set);
@@ -47,9 +54,9 @@ const char* icaldirset_path(icaldirset* store);
is freed. Commit writes to disk immediately*/
-void icaldirset_mark(icaldirset* store);
-icalerrorenum icaldirset_commit(icaldirset* store);
+void icaldirset_mark(icalset* set);
+icalerrorenum icaldirset_commit(icalset* set);
-icalerrorenum icaldirset_add_component(icaldirset* store, icalcomponent* comp);
-icalerrorenum icaldirset_remove_component(icaldirset* store, icalcomponent* comp);
+icalerrorenum icaldirset_add_component(icalset* store, icalcomponent* comp);
+icalerrorenum icaldirset_remove_component(icalset* store, icalcomponent* comp);
-int icaldirset_count_components(icaldirset* store,
+int icaldirset_count_components(icalset* store,
icalcomponent_kind kind);
@@ -58,9 +65,9 @@ int icaldirset_count_components(icaldirset* store,
that pass the gauge. _clear removes the gauge. */
-icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge);
-void icaldirset_clear(icaldirset* store);
+icalerrorenum icaldirset_select(icalset* store, icalgauge* gauge);
+void icaldirset_clear(icalset* store);
/* Get a component by uid */
-icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid);
-int icaldirset_has_uid(icaldirset* store, const char* uid);
-icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c);
+icalcomponent* icaldirset_fetch(icalset* store, const char* uid);
+int icaldirset_has_uid(icalset* store, const char* uid);
+icalcomponent* icaldirset_fetch_match(icalset* set, icalcomponent *c);
@@ -68,11 +75,20 @@ icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c);
the currently selected components. */
-icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *oldc,
+icalerrorenum icaldirset_modify(icalset* store, icalcomponent *oldc,
icalcomponent *newc);
-/* Iterate through the components. If a guage has been defined, these
+/* Iterate through the components. If a gauge has been defined, these
will skip over components that do not pass the gauge */
-icalcomponent* icaldirset_get_current_component(icaldirset* store);
-icalcomponent* icaldirset_get_first_component(icaldirset* store);
-icalcomponent* icaldirset_get_next_component(icaldirset* store);
+icalcomponent* icaldirset_get_current_component(icalset* store);
+icalcomponent* icaldirset_get_first_component(icalset* store);
+icalcomponent* icaldirset_get_next_component(icalset* store);
+
+/* External iterator for thread safety */
+icalsetiter icaldirset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
+icalcomponent* icaldirsetiter_to_next(icalset* set, icalsetiter* i);
+icalcomponent* icaldirsetiter_to_prior(icalset* set, icalsetiter* i);
+
+typedef struct icaldirset_options {
+ int flags; /**< flags corresponding to the open() system call O_RDWR, etc. */
+} icaldirset_options;
diff --git a/libical/src/libicalss/icaldirsetimpl.h b/libical/src/libicalss/icaldirsetimpl.h
index 0e69ba2..332a369 100644
--- a/libical/src/libicalss/icaldirsetimpl.h
+++ b/libical/src/libicalss/icaldirsetimpl.h
@@ -32,2 +32,4 @@
+#include "icalcluster.h"
+
/* This definition is in its own file so it can be kept out of the
@@ -35,13 +37,12 @@
-#define ICALDIRSET_ID "dset"
-
struct icaldirset_impl
{
- char id[5]; /* "dset" */
- char* dir;
- icalcomponent* gauge;
- icaldirset* cluster;
- int first_component;
- pvl_list directory;
- pvl_elem directory_iterator;
+ icalset super; /**< parent class */
+ char* dir; /**< directory containing ics files */
+ icaldirset_options options; /**< copy of options passed to icalset_new() */
+ icalcluster* cluster; /**< cluster containing data */
+ icalgauge* gauge; /**< gauge for filtering out data */
+ int first_component; /**< ??? */
+ pvl_list directory; /**< ??? */
+ pvl_elem directory_iterator; /**< ??? */
};
diff --git a/libical/src/libicalss/icalfileset.c b/libical/src/libicalss/icalfileset.c
index 943071d..3ae6c54 100644
--- a/libical/src/libicalss/icalfileset.c
+++ b/libical/src/libicalss/icalfileset.c
@@ -32,27 +32,37 @@
+#include "icalfileset.h"
+#include "icalgauge.h"
#include <errno.h>
-
+#include <sys/stat.h> /* for stat */
+#ifndef WIN32
+#include <unistd.h> /* for stat, getpid */
+#else
+#include <io.h>
+#include <share.h>
+#endif
#include <stdlib.h>
-#include <stdio.h>
#include <string.h>
+#include <fcntl.h> /* for fcntl */
+#include "icalfilesetimpl.h"
+#include "icalclusterimpl.h"
-#include <fcntl.h> /* For open() flags and mode */
-#include <sys/types.h> /* For open() flags and mode */
-#include <sys/stat.h> /* For open() flags and mode */
+#ifdef WIN32
+#define snprintf _snprintf
+#define strcasecmp stricmp
-#include "icalfileset.h"
-#include "icalfilesetimpl.h"
+#define _S_ISTYPE(mode, mask) (((mode) & _S_IFMT) == (mask))
-// Eugen C. <eug@thekompany.com>
-#include <defines.h>
-//
+#define S_ISDIR(mode) _S_ISTYPE((mode), _S_IFDIR)
+#define S_ISREG(mode) _S_ISTYPE((mode), _S_IFREG)
+#endif
-int snprintf(char *str, size_t n, char const *fmt, ...);
+extern int errno;
-//extern int errno;
+/** Default options used when NULL is passed to icalset_new() **/
+icalfileset_options icalfileset_options_default = {O_RDWR|O_CREAT, 0644, 0, 0};
-int icalfileset_lock(icalfileset *cluster);
-int icalfileset_unlock(icalfileset *cluster);
-icalerrorenum icalfileset_read_file(icalfileset* cluster, mode_t mode);
-int icalfileset_filesize(icalfileset* cluster);
+int icalfileset_lock(icalfileset *set);
+int icalfileset_unlock(icalfileset *set);
+icalerrorenum icalfileset_read_file(icalfileset* set, mode_t mode);
+int icalfileset_filesize(icalfileset* set);
@@ -60,59 +70,64 @@ icalerrorenum icalfileset_create_cluster(const char *path);
-icalfileset* icalfileset_new_impl()
+icalset* icalfileset_new(const char* path)
{
- struct icalfileset_impl* impl;
-
- if ( ( impl = (struct icalfileset_impl*)
- malloc(sizeof(struct icalfileset_impl))) == 0) {
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- errno = ENOMEM;
- return 0;
- }
-
- memset(impl,0,sizeof(struct icalfileset_impl));
-
- strcpy(impl->id,ICALFILESET_ID);
-
- return impl;
+ return icalset_new(ICAL_FILE_SET, path, &icalfileset_options_default);
}
-
-icalfileset* icalfileset_new(const char* path)
+icalset* icalfileset_new_reader(const char* path)
{
- return icalfileset_new_open(path, O_RDWR|O_CREAT, 0664);
+ icalfileset_options reader_options = icalfileset_options_default;
+ reader_options.flags = O_RDONLY;
+
+ return icalset_new(ICAL_FILE_SET, path, &reader_options);
}
-icalfileset* icalfileset_new_open(const char* path, int flags, mode_t mode)
+icalset* icalfileset_new_writer(const char* path)
{
- struct icalfileset_impl *impl = icalfileset_new_impl();
- struct icaltimetype tt;
- off_t cluster_file_size;
+ icalfileset_options writer_options = icalfileset_options_default;
+ writer_options.flags = O_RDONLY;
- memset(&tt,0,sizeof(struct icaltimetype));
+ return icalset_new(ICAL_FILE_SET, path, &writer_options);
+}
- icalerror_clear_errno();
- icalerror_check_arg_rz( (path!=0), "path");
+icalset* icalfileset_init(icalset *set, const char* path, void* options_in)
+{
+ icalfileset_options *options = (options_in) ? options_in : &icalfileset_options_default;
+ icalfileset *fset = (icalfileset*) set;
+ int flags;
+ mode_t mode;
+ off_t cluster_file_size;
- if (impl == 0){
- return 0;
- }
+ icalerror_clear_errno();
+ icalerror_check_arg_rz( (path!=0), "path");
+ icalerror_check_arg_rz( (fset!=0), "fset");
- impl->path = strdup(path);
+ fset->path = strdup(path);
+ fset->options = *options;
- cluster_file_size = icalfileset_filesize(impl);
-
- if(cluster_file_size < 0){
- icalfileset_free(impl);
- return 0;
- }
+ flags = options->flags;
+ mode = options->mode;
+
+ cluster_file_size = icalfileset_filesize(fset);
+
+ if(cluster_file_size < 0){
+ icalfileset_free(set);
+ return 0;
+ }
- impl->fd = open(impl->path,flags, mode);
+#ifndef WIN32
+ fset->fd = open(fset->path, flags, mode);
+#else
+ fset->fd = open(fset->path, flags, mode);
+ /* fset->fd = sopen(fset->path,flags, _SH_DENYWR, _S_IREAD | _S_IWRITE); */
+#endif
- if (impl->fd < 0){
- icalerror_set_errno(ICAL_FILE_ERROR);
- icalfileset_free(impl);
- return 0;
- }
+ if (fset->fd < 0){
+ icalerror_set_errno(ICAL_FILE_ERROR);
+ icalfileset_free(set);
+ return 0;
+ }
- icalfileset_lock(impl);
+#ifndef WIN32
+ icalfileset_lock(fset);
+#endif
@@ -120,5 +135,5 @@ icalfileset* icalfileset_new_open(const char* path, int flags, mode_t mode)
icalerrorenum error;
- if((error = icalfileset_read_file(impl,mode))!= ICAL_NO_ERROR){
- icalfileset_free(impl);
- return 0;
+ if((error = icalfileset_read_file(fset,mode))!= ICAL_NO_ERROR){
+ icalfileset_free(set);
+ return 0;
}
@@ -126,12 +141,42 @@ icalfileset* icalfileset_new_open(const char* path, int flags, mode_t mode)
- if(impl->cluster == 0){
- impl->cluster = icalcomponent_new(ICAL_XROOT_COMPONENT);
- }
+ if (options->cluster) {
+ fset->cluster = icalcomponent_new_clone(icalcluster_get_component(options->cluster));
+ fset->changed = 1;
+ }
+
+ if (fset->cluster == 0) {
+ fset->cluster = icalcomponent_new(ICAL_XROOT_COMPONENT);
+ }
+
+ return set;
+}
+
+
+icalcluster* icalfileset_produce_icalcluster(const char *path) {
+ icalset *fileset;
+ icalcluster *ret;
+
+ int errstate = icalerror_errors_are_fatal;
+ icalerror_errors_are_fatal = 0;
- return impl;
+ fileset = icalfileset_new_reader(path);
+
+
+ if (fileset == 0 && icalerrno == ICAL_FILE_ERROR) {
+ /* file does not exist */
+ ret = icalcluster_new(path, NULL);
+ } else {
+ ret = icalcluster_new(path, ((icalfileset*)fileset)->cluster);
+ icalfileset_free(fileset);
+ }
+
+ icalerror_errors_are_fatal = errstate;
+ icalerror_set_errno(ICAL_NO_ERROR);
+ return ret;
}
+
+
char* icalfileset_read_from_file(char *s, size_t size, void *d)
{
-
char* p = s;
@@ -160,25 +205,23 @@ char* icalfileset_read_from_file(char *s, size_t size, void *d)
-icalerrorenum icalfileset_read_file(icalfileset* cluster,mode_t mode)
+icalerrorenum icalfileset_read_file(icalfileset* set,mode_t mode)
{
-
icalparser *parser;
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
-
parser = icalparser_new();
- icalparser_set_gen_data(parser,(void*)impl->fd);
- impl->cluster = icalparser_parse(parser,icalfileset_read_from_file);
+
+ icalparser_set_gen_data(parser,(void*)set->fd);
+ set->cluster = icalparser_parse(parser,icalfileset_read_from_file);
icalparser_free(parser);
- if (impl->cluster == 0 || icalerrno != ICAL_NO_ERROR){
+ if (set->cluster == 0 || icalerrno != ICAL_NO_ERROR){
icalerror_set_errno(ICAL_PARSE_ERROR);
- return ICAL_PARSE_ERROR;
+ /*return ICAL_PARSE_ERROR;*/
}
- if (icalcomponent_isa(impl->cluster) != ICAL_XROOT_COMPONENT){
+ if (icalcomponent_isa(set->cluster) != ICAL_XROOT_COMPONENT){
/* The parser got a single component, so it did not put it in
an XROOT. */
- icalcomponent *cl = impl->cluster;
- impl->cluster = icalcomponent_new(ICAL_XROOT_COMPONENT);
- icalcomponent_add_component(impl->cluster,cl);
+ icalcomponent *cl = set->cluster;
+ set->cluster = icalcomponent_new(ICAL_XROOT_COMPONENT);
+ icalcomponent_add_component(set->cluster,cl);
}
@@ -186,12 +229,10 @@ icalerrorenum icalfileset_read_file(icalfileset* cluster,mode_t mode)
return ICAL_NO_ERROR;
-
}
-int icalfileset_filesize(icalfileset* cluster)
+int icalfileset_filesize(icalfileset* fset)
{
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
int cluster_file_size;
struct stat sbuf;
-
- if (stat(impl->path,&sbuf) != 0){
+
+ if (stat(fset->path,&sbuf) != 0){
@@ -211,3 +252,2 @@ int icalfileset_filesize(icalfileset* cluster)
-#ifndef _QTWIN_
if (!S_ISREG(sbuf.st_mode)){
@@ -219,7 +259,3 @@ int icalfileset_filesize(icalfileset* cluster)
return sbuf.st_size;
- }
-#else
- return sbuf.st_size;
-#endif
-
+ }
}
@@ -229,34 +265,35 @@ int icalfileset_filesize(icalfileset* cluster)
-void icalfileset_free(icalfileset* cluster)
+void icalfileset_free(icalset* set)
{
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
+ icalfileset *fset = (icalfileset*) set;
- icalerror_check_arg_rv((cluster!=0),"cluster");
+ icalerror_check_arg_rv((set!=0),"set");
- if (impl->cluster != 0){
- icalfileset_commit(cluster);
- icalcomponent_free(impl->cluster);
- impl->cluster=0;
+ if (fset->cluster != 0){
+ icalfileset_commit(set);
+ icalcomponent_free(fset->cluster);
+ fset->cluster=0;
}
- if(impl->fd > 0){
- icalfileset_unlock(impl);
- close(impl->fd);
- impl->fd = -1;
+ if (fset->gauge != 0){
+ icalgauge_free(fset->gauge);
+ fset->gauge=0;
}
- if(impl->path != 0){
- free(impl->path);
- impl->path = 0;
+ if(fset->fd > 0){
+ icalfileset_unlock(fset);
+ close(fset->fd);
+ fset->fd = -1;
}
- free(impl);
+ if(fset->path != 0){
+ free(fset->path);
+ fset->path = 0;
+ }
}
-const char* icalfileset_path(icalfileset* cluster)
-{
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
- icalerror_check_arg_rz((cluster!=0),"cluster");
+const char* icalfileset_path(icalset* set) {
+ icalerror_check_arg_rz((set!=0),"set");
- return impl->path;
+ return ((icalfileset*)set)->path;
}
@@ -264,6 +301,5 @@ const char* icalfileset_path(icalfileset* cluster)
-int icalfileset_lock(icalfileset *cluster)
+int icalfileset_lock(icalfileset *set)
{
-#ifndef _WIN32
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
+#ifndef WIN32
struct flock lock;
@@ -271,3 +307,3 @@ int icalfileset_lock(icalfileset *cluster)
- icalerror_check_arg_rz((impl->fd>0),"impl->fd");
+ icalerror_check_arg_rz((set->fd>0),"set->fd");
errno = 0;
@@ -278,3 +314,3 @@ int icalfileset_lock(icalfileset *cluster)
- rtrn = fcntl(impl->fd, F_SETLKW, &lock);
+ rtrn = fcntl(set->fd, F_SETLKW, &lock);
@@ -282,3 +318,3 @@ int icalfileset_lock(icalfileset *cluster)
#else
- return -1;
+ return 0;
#endif
@@ -286,8 +322,7 @@ int icalfileset_lock(icalfileset *cluster)
-int icalfileset_unlock(icalfileset *cluster)
+int icalfileset_unlock(icalfileset *set)
{
-#ifndef _WIN32
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
+#ifndef WIN32
struct flock lock;
- icalerror_check_arg_rz((impl->fd>0),"impl->fd");
+ icalerror_check_arg_rz((set->fd>0),"set->fd");
@@ -298,5 +333,5 @@ int icalfileset_unlock(icalfileset *cluster)
- return (fcntl(impl->fd, F_UNLCK, &lock));
+ return (fcntl(set->fd, F_UNLCK, &lock));
#else
- return -1;
+ return 0;
#endif
@@ -304,9 +339,3 @@ int icalfileset_unlock(icalfileset *cluster)
-#ifdef ICAL_SAFESAVES
-int icalfileset_safe_saves=1;
-#else
-int icalfileset_safe_saves=0;
-#endif
-
-icalerrorenum icalfileset_commit(icalfileset* cluster)
+icalerrorenum icalfileset_commit(icalset* set)
{
@@ -316,11 +345,10 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
off_t write_size=0;
+ icalfileset *fset = (icalfileset*) set;
+
+ icalerror_check_arg_re((fset!=0),"set",ICAL_BADARG_ERROR);
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
-
- icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR);
-
- icalerror_check_arg_re((impl->fd>0),"impl->fd is invalid",
+ icalerror_check_arg_re((fset->fd>0),"set->fd is invalid",
ICAL_INTERNAL_ERROR) ;
- if (impl->changed == 0 ){
+ if (fset->changed == 0 ){
return ICAL_NO_ERROR;
@@ -328,4 +356,8 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
- if(icalfileset_safe_saves == 1){
- snprintf(tmp,ICAL_PATH_MAX,"cp %s %s.bak",impl->path,impl->path);
+ if (fset->options.safe_saves == 1) {
+#ifndef WIN32
+ snprintf(tmp,ICAL_PATH_MAX,"cp '%s' '%s.bak'",fset->path, fset->path);
+#else
+ snprintf(tmp,ICAL_PATH_MAX,"copy %s %s.bak", fset->path, fset->path);
+#endif
@@ -337,3 +369,3 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
- if(lseek(impl->fd,SEEK_SET,0) < 0){
+ if(lseek(fset->fd, 0, SEEK_SET) < 0){
icalerror_set_errno(ICAL_FILE_ERROR);
@@ -342,5 +374,5 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
- for(c = icalcomponent_get_first_component(impl->cluster,ICAL_ANY_COMPONENT);
+ for(c = icalcomponent_get_first_component(fset->cluster,ICAL_ANY_COMPONENT);
c != 0;
- c = icalcomponent_get_next_component(impl->cluster,ICAL_ANY_COMPONENT)){
+ c = icalcomponent_get_next_component(fset->cluster,ICAL_ANY_COMPONENT)){
int sz;
@@ -349,3 +381,3 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
- sz=write(impl->fd,str,strlen(str));
+ sz=write(fset->fd,str,strlen(str));
@@ -360,8 +392,10 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
- impl->changed = 0;
+ fset->changed = 0;
-#ifndef _QTWIN_
- if(ftruncate(impl->fd,write_size) < 0){
+#ifndef WIN32
+ if(ftruncate(fset->fd,write_size) < 0){
return ICAL_FILE_ERROR;
}
+#else
+ chsize( fset->fd, tell( fset->fd ) );
#endif
@@ -369,21 +403,15 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
return ICAL_NO_ERROR;
-
}
-void icalfileset_mark(icalfileset* cluster){
-
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
-
- icalerror_check_arg_rv((impl!=0),"cluster");
-
- impl->changed = 1;
+void icalfileset_mark(icalset* set) {
+ icalerror_check_arg_rv((set!=0),"set");
+ ((icalfileset*)set)->changed = 1;
}
-icalcomponent* icalfileset_get_component(icalfileset* cluster){
- struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
+icalcomponent* icalfileset_get_component(icalset* set){
+ icalfileset *fset = (icalfileset*) set;
+ icalerror_check_arg_rz((set!=0),"set");
- icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR);
-
- return impl->cluster;
+ return fset->cluster;
}
@@ -391,31 +419,30 @@ icalcomponent* icalfileset_get_component(icalfileset* cluster){
-/* manipulate the components in the cluster */
+/* manipulate the components in the set */
-icalerrorenum icalfileset_add_component(icalfileset *cluster,
+icalerrorenum icalfileset_add_component(icalset *set,
icalcomponent* child)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster;
+ icalfileset *fset = (icalfileset*) set;
- icalerror_check_arg_re((cluster!=0),"cluster", ICAL_BADARG_ERROR);
+ icalerror_check_arg_re((set!=0),"set", ICAL_BADARG_ERROR);
icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR);
- icalcomponent_add_component(impl->cluster,child);
+ icalcomponent_add_component(fset->cluster,child);
- icalfileset_mark(cluster);
+ icalfileset_mark(set);
return ICAL_NO_ERROR;
-
}
-icalerrorenum icalfileset_remove_component(icalfileset *cluster,
+icalerrorenum icalfileset_remove_component(icalset *set,
icalcomponent* child)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster;
+ icalfileset *fset = (icalfileset*) set;
- icalerror_check_arg_re((cluster!=0),"cluster",ICAL_BADARG_ERROR);
+ icalerror_check_arg_re((set!=0),"set",ICAL_BADARG_ERROR);
icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR);
- icalcomponent_remove_component(impl->cluster,child);
+ icalcomponent_remove_component(fset->cluster,child);
- icalfileset_mark(cluster);
+ icalfileset_mark(set);
@@ -424,8 +451,8 @@ icalerrorenum icalfileset_remove_component(icalfileset *cluster,
-int icalfileset_count_components(icalfileset *cluster,
+int icalfileset_count_components(icalset *set,
icalcomponent_kind kind)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster;
+ icalfileset *fset = (icalfileset*) set;
- if(cluster == 0){
+ if (set == 0){
icalerror_set_errno(ICAL_BADARG_ERROR);
@@ -434,12 +461,12 @@ int icalfileset_count_components(icalfileset *cluster,
- return icalcomponent_count_components(impl->cluster,kind);
+ return icalcomponent_count_components(fset->cluster,kind);
}
-icalerrorenum icalfileset_select(icalfileset* set, icalgauge* gauge)
+icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)set;
+ icalfileset *fset = (icalfileset*) set;
- icalerror_check_arg_re(gauge!=0,"guage",ICAL_BADARG_ERROR);
+ icalerror_check_arg_re(gauge!=0,"gauge",ICAL_BADARG_ERROR);
- impl->gauge = gauge;
+ fset->gauge = gauge;
@@ -448,37 +475,46 @@ icalerrorenum icalfileset_select(icalfileset* set, icalgauge* gauge)
-void icalfileset_clear(icalfileset* gauge)
+void icalfileset_clear(icalset* set)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)gauge;
-
- impl->gauge = 0;
+ icalfileset *fset = (icalfileset*) set;
+
+ icalerror_check_arg_rv(set!=0,"set");
+ fset->gauge = 0;
}
-icalcomponent* icalfileset_fetch(icalfileset* store,const char* uid)
+icalcomponent* icalfileset_fetch(icalset* set,const char* uid)
{
+ icalfileset *fset = (icalfileset*) set;
icalcompiter i;
- struct icalfileset_impl* impl = (struct icalfileset_impl*)store;
+
+ icalerror_check_arg_rz(set!=0,"set");
- for(i = icalcomponent_begin_component(impl->cluster,ICAL_ANY_COMPONENT);
+ for(i = icalcomponent_begin_component(fset->cluster,ICAL_ANY_COMPONENT);
icalcompiter_deref(&i)!= 0; icalcompiter_next(&i)){
- icalcomponent *this = icalcompiter_deref(&i);
- icalcomponent *inner = icalcomponent_get_first_real_component(this);
- icalcomponent *p;
- const char *this_uid;
-
- if(inner != 0){
- p = icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
- this_uid = icalproperty_get_uid(p);
-
- if(this_uid==0){
- icalerror_warn("icalfileset_fetch found a component with no UID");
- continue;
- }
-
- if (strcmp(uid,this_uid)==0){
- return this;
- }
+ icalcomponent *this = icalcompiter_deref(&i);
+ icalcomponent *inner;
+ icalproperty *p;
+ const char *this_uid;
+
+ for(inner = icalcomponent_get_first_component(this,ICAL_ANY_COMPONENT);
+ inner != 0;
+ inner = icalcomponent_get_next_component(this,ICAL_ANY_COMPONENT)){
+
+ p = icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
+ if ( p )
+ {
+ this_uid = icalproperty_get_uid(p);
+
+ if(this_uid==0){
+ icalerror_warn("icalfileset_fetch found a component with no UID");
+ continue;
+ }
+
+ if (strcmp(uid,this_uid)==0){
+ return this;
+ }
+ }
+ }
}
- }
@@ -487,3 +523,3 @@ icalcomponent* icalfileset_fetch(icalfileset* store,const char* uid)
-int icalfileset_has_uid(icalfileset* store,const char* uid)
+int icalfileset_has_uid(icalset* set,const char* uid)
{
@@ -510,8 +546,7 @@ void icalfileset_id_free(struct icalfileset_id *id)
}
-
}
+
struct icalfileset_id icalfileset_get_id(icalcomponent* comp)
{
-
icalcomponent *inner;
@@ -551,2 +586,3 @@ struct icalfileset_id icalfileset_get_id(icalcomponent* comp)
+
/* Find the component that is related to the given
@@ -554,5 +590,5 @@ struct icalfileset_id icalfileset_get_id(icalcomponent* comp)
RECURRENCE-ID */
-icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *comp)
+icalcomponent* icalfileset_fetch_match(icalset* set, icalcomponent *comp)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)set;
+ icalfileset *fset = (icalfileset*) set;
icalcompiter i;
@@ -563,3 +599,3 @@ icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *comp)
- for(i = icalcomponent_begin_component(impl->cluster,ICAL_ANY_COMPONENT);
+ for(i = icalcomponent_begin_component(fset->cluster,ICAL_ANY_COMPONENT);
icalcompiter_deref(&i)!= 0; icalcompiter_next(&i)){
@@ -591,5 +627,7 @@ icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *comp)
-icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *old,
+icalerrorenum icalfileset_modify(icalset* set, icalcomponent *old,
icalcomponent *new)
{
+ icalfileset *fset = (icalfileset*) set;
+
assert(0); /* HACK, not implemented */
@@ -600,9 +638,9 @@ icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *old,
/* Iterate through components */
-icalcomponent* icalfileset_get_current_component (icalfileset* cluster)
+icalcomponent* icalfileset_get_current_component (icalset* set)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster;
+ icalfileset *fset = (icalfileset*) set;
- icalerror_check_arg_rz((cluster!=0),"cluster");
+ icalerror_check_arg_rz((set!=0),"set");
- return icalcomponent_get_current_component(impl->cluster);
+ return icalcomponent_get_current_component(fset->cluster);
}
@@ -610,8 +648,8 @@ icalcomponent* icalfileset_get_current_component (icalfileset* cluster)
-icalcomponent* icalfileset_get_first_component(icalfileset* cluster)
+icalcomponent* icalfileset_get_first_component(icalset* set)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster;
icalcomponent *c=0;
+ icalfileset *fset = (icalfileset*) set;
- icalerror_check_arg_rz((cluster!=0),"cluster");
+ icalerror_check_arg_rz((set!=0),"set");
@@ -619,6 +657,6 @@ icalcomponent* icalfileset_get_first_component(icalfileset* cluster)
if (c == 0){
- c = icalcomponent_get_first_component(impl->cluster,
+ c = icalcomponent_get_first_component(fset->cluster,
ICAL_ANY_COMPONENT);
} else {
- c = icalcomponent_get_next_component(impl->cluster,
+ c = icalcomponent_get_next_component(fset->cluster,
ICAL_ANY_COMPONENT);
@@ -626,4 +664,4 @@ icalcomponent* icalfileset_get_first_component(icalfileset* cluster)
- if(c != 0 && (impl->gauge == 0 ||
- icalgauge_compare(impl->gauge,c) == 1)){
+ if(c != 0 && (fset->gauge == 0 ||
+ icalgauge_compare(fset->gauge, c) == 1)){
return c;
@@ -637,15 +675,15 @@ icalcomponent* icalfileset_get_first_component(icalfileset* cluster)
-icalcomponent* icalfileset_get_next_component(icalfileset* cluster)
+icalcomponent* icalfileset_get_next_component(icalset* set)
{
- struct icalfileset_impl* impl = (struct icalfileset_impl*)cluster;
+ icalfileset *fset = (icalfileset*) set;
icalcomponent *c;
- icalerror_check_arg_rz((cluster!=0),"cluster");
+ icalerror_check_arg_rz((set!=0),"set");
do {
- c = icalcomponent_get_next_component(impl->cluster,
+ c = icalcomponent_get_next_component(fset->cluster,
ICAL_ANY_COMPONENT);
- if(c != 0 && (impl->gauge == 0 ||
- icalgauge_compare(impl->gauge,c) == 1)){
+ if(c != 0 && (fset->gauge == 0 ||
+ icalgauge_compare(fset->gauge,c) == 1)){
return c;
@@ -658,2 +696,239 @@ icalcomponent* icalfileset_get_next_component(icalfileset* cluster)
}
+/*
+icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge)
+{
+ icalsetiter itr = icalsetiter_null;
+ icalcomponent* comp = NULL;
+ icalcompiter citr;
+ icalfileset *fset = (icalfileset*) set;
+
+ icalerror_check_arg_re((set!=0), "set", icalsetiter_null);
+
+ itr.gauge = gauge;
+
+ citr = icalcomponent_begin_component(fset->cluster, kind);
+ comp = icalcompiter_deref(&citr);
+
+ while (comp != 0) {
+ comp = icalcompiter_deref(&citr);
+ if (gauge == 0 || icalgauge_compare(itr.gauge, comp) == 1) {
+ itr.iter = citr;
+ return itr;
+ }
+ comp = icalcompiter_next(&citr);
+ }
+
+ return icalsetiter_null;
+}
+*/
+
+icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge)
+{
+ icalsetiter itr = icalsetiter_null;
+ icalcomponent* comp = NULL;
+ icalcompiter citr;
+ icalfileset *fset = (icalfileset*) set;
+ struct icaltimetype start, next;
+ icalproperty *dtstart, *rrule, *prop, *due;
+ struct icalrecurrencetype recur;
+ int g = 0;
+
+ icalerror_check_arg_re((set!=0), "set", icalsetiter_null);
+
+ itr.gauge = gauge;
+
+ citr = icalcomponent_begin_component(fset->cluster, kind);
+ comp = icalcompiter_deref(&citr);
+
+ if (gauge == 0) {
+ itr.iter = citr;
+ return itr;
+ }
+
+ while (comp != 0) {
+
+ /* check if it is a recurring component and with guage expand, if so
+ we need to add recurrence-id property to the given component */
+ rrule = icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY);
+ g = icalgauge_get_expand(gauge);
+
+ if (rrule != 0
+ && g == 1) {
+
+ recur = icalproperty_get_rrule(rrule);
+ if (icalcomponent_isa(comp) == ICAL_VEVENT_COMPONENT) {
+ dtstart = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
+ if (dtstart)
+ start = icalproperty_get_dtstart(dtstart);
+ } else if (icalcomponent_isa(comp) == ICAL_VTODO_COMPONENT) {
+ due = icalcomponent_get_first_property(comp, ICAL_DUE_PROPERTY);
+ if (due)
+ start = icalproperty_get_due(due);
+ }
+
+ if (itr.last_component == NULL) {
+ itr.ritr = icalrecur_iterator_new(recur, start);
+ next = icalrecur_iterator_next(itr.ritr);
+ itr.last_component = comp;
+ }
+ else {
+ next = icalrecur_iterator_next(itr.ritr);
+ if (icaltime_is_null_time(next)){
+ itr.last_component = NULL;
+ icalrecur_iterator_free(itr.ritr);
+ itr.ritr = NULL;
+ return icalsetiter_null;
+ } else {
+ itr.last_component = comp;
+ }
+ }
+
+ /* add recurrence-id to the component
+ if there is a recurrence-id already, remove it, then add the new one */
+ if (prop = icalcomponent_get_first_property(comp, ICAL_RECURRENCEID_PROPERTY))
+ icalcomponent_remove_property(comp, prop);
+ icalcomponent_add_property(comp, icalproperty_new_recurrenceid(next));
+
+ }
+
+ if (gauge == 0 || icalgauge_compare(itr.gauge, comp) == 1) {
+ /* matches and returns */
+ itr.iter = citr;
+ return itr;
+ }
+
+ /* if there is no previous component pending, then get the next component */
+ if (itr.last_component == NULL)
+ comp = icalcompiter_next(&citr);
+ }
+
+ return icalsetiter_null;
+}
+icalcomponent* icalfileset_form_a_matched_recurrence_component(icalsetiter* itr)
+{
+ icalcomponent* comp = NULL;
+ struct icaltimetype start, next;
+ icalproperty *dtstart, *rrule, *prop, *due;
+ struct icalrecurrencetype recur;
+
+ comp = itr->last_component;
+
+ if (comp == NULL || itr->gauge == NULL) {
+ return NULL;
+ }
+
+ rrule = icalcomponent_get_first_property(comp, ICAL_RRULE_PROPERTY);
+
+ recur = icalproperty_get_rrule(rrule);
+
+ if (icalcomponent_isa(comp) == ICAL_VEVENT_COMPONENT) {
+ dtstart = icalcomponent_get_first_property(comp, ICAL_DTSTART_PROPERTY);
+ if (dtstart)
+ start = icalproperty_get_dtstart(dtstart);
+ } else if (icalcomponent_isa(comp) == ICAL_VTODO_COMPONENT) {
+ due = icalcomponent_get_first_property(comp, ICAL_DUE_PROPERTY);
+ if (due)
+ start = icalproperty_get_due(due);
+ }
+
+ if (itr->ritr == NULL) {
+ itr->ritr = icalrecur_iterator_new(recur, start);
+ next = icalrecur_iterator_next(itr->ritr);
+ itr->last_component = comp;
+ } else {
+ next = icalrecur_iterator_next(itr->ritr);
+ if (icaltime_is_null_time(next)){
+ /* no more recurrence, returns */
+ itr->last_component = NULL;
+ icalrecur_iterator_free(itr->ritr);
+ itr->ritr = NULL;
+ return NULL;
+ } else {
+ itr->last_component = comp;
+ }
+ }
+
+ /* add recurrence-id to the component
+ * if there is a recurrence-id already, remove it, then add the new one */
+ if (prop = icalcomponent_get_first_property(comp, ICAL_RECURRENCEID_PROPERTY))
+ icalcomponent_remove_property(comp, prop);
+ icalcomponent_add_property(comp, icalproperty_new_recurrenceid(next));
+
+ if (itr->gauge == 0 || icalgauge_compare(itr->gauge, comp) == 1) {
+ /* matches and returns */
+ return comp;
+ }
+ /* not matched */
+ return NULL;
+
+}
+icalcomponent* icalfilesetiter_to_next(icalset* set, icalsetiter* i)
+{
+
+ icalcomponent* c = NULL;
+ icalfileset *fset = (icalfileset*) set;
+ struct icaltimetype start, next;
+ icalproperty *dtstart, *rrule, *prop, *due;
+ struct icalrecurrencetype recur;
+ int g = 0;
+
+
+ do {
+ c = icalcompiter_next(&(i->iter));
+
+ if (c == 0) continue;
+ if (i->gauge == 0) return c;
+
+
+ rrule = icalcomponent_get_first_property(c, ICAL_RRULE_PROPERTY);
+ g = icalgauge_get_expand(i->gauge);
+
+ /* a recurring component with expand query */
+ if (rrule != 0
+ && g == 1) {
+
+ recur = icalproperty_get_rrule(rrule);
+
+ if (icalcomponent_isa(c) == ICAL_VEVENT_COMPONENT) {
+ dtstart = icalcomponent_get_first_property(c, ICAL_DTSTART_PROPERTY);
+ if (dtstart)
+ start = icalproperty_get_dtstart(dtstart);
+ } else if (icalcomponent_isa(c) == ICAL_VTODO_COMPONENT) {
+ due = icalcomponent_get_first_property(c, ICAL_DUE_PROPERTY);
+ if (due)
+ start = icalproperty_get_due(due);
+ }
+
+ if (i->ritr == NULL) {
+ i->ritr = icalrecur_iterator_new(recur, start);
+ next = icalrecur_iterator_next(i->ritr);
+ i->last_component = c;
+ } else {
+ next = icalrecur_iterator_next(i->ritr);
+ if (icaltime_is_null_time(next)) {
+ /* no more recurrence, returns */
+ i->last_component = NULL;
+ icalrecur_iterator_free(i->ritr);
+ i->ritr = NULL;
+ return NULL;
+ } else {
+ i->last_component = c;
+ }
+ }
+ }
+
+ /* add recurrence-id to the component
+ * if there is a recurrence-id already, remove it, then add the new one */
+ if (prop = icalcomponent_get_first_property(c, ICAL_RECURRENCEID_PROPERTY))
+ icalcomponent_remove_property(c, prop);
+ icalcomponent_add_property(c, icalproperty_new_recurrenceid(next));
+
+ if(c != 0 && (i->gauge == 0 ||
+ icalgauge_compare(i->gauge, c) == 1)){
+ return c;
+ }
+ } while (c != 0);
+
+ return 0;
+}
diff --git a/libical/src/libicalss/icalfileset.h b/libical/src/libicalss/icalfileset.h
index 51254d2..dc044ea 100644
--- a/libical/src/libicalss/icalfileset.h
+++ b/libical/src/libicalss/icalfileset.h
@@ -31,31 +31,31 @@
-#include "icalerror.h"
#include "ical.h"
#include "icalset.h"
+#include "icalcluster.h"
#include "icalgauge.h"
+#include <sys/types.h> /* For open() flags and mode */
+#include <sys/stat.h> /* For open() flags and mode */
+#include <fcntl.h> /* For open() flags and mode */
-extern int icalfileset_safe_saves;
-
-typedef void icalfileset;
+#ifdef WIN32
+#define mode_t int
+#endif
+extern int icalfileset_safe_saves;
-/* icalfileset
- icalfilesetfile
- icalfilesetdir
-*/
+typedef struct icalfileset_impl icalfileset;
+icalset* icalfileset_new(const char* path);
+icalset* icalfileset_new_reader(const char* path);
+icalset* icalfileset_new_writer(const char* path);
-icalfileset* icalfileset_new(const char* path);
+icalset* icalfileset_init(icalset *set, const char *dsn, void* options);
-#ifdef _WIN32
-#define mode_t int
-#endif
+icalfileset* icalfileset_new_from_cluster(const char* path, icalcluster *cluster);
-/* Like _new, but takes open() flags for opening the file */
-icalfileset* icalfileset_new_open(const char* path,
- int flags, mode_t mode);
+icalcluster* icalfileset_produce_icalcluster(const char *path);
-void icalfileset_free(icalfileset* cluster);
+void icalfileset_free(icalset* cluster);
-const char* icalfileset_path(icalfileset* cluster);
+const char* icalfileset_path(icalset* cluster);
@@ -63,41 +63,68 @@ const char* icalfileset_path(icalfileset* cluster);
is freed. Commit writes to disk immediately. */
-void icalfileset_mark(icalfileset* cluster);
-icalerrorenum icalfileset_commit(icalfileset* cluster);
+void icalfileset_mark(icalset* set);
+icalerrorenum icalfileset_commit(icalset* set);
-icalerrorenum icalfileset_add_component(icalfileset* cluster,
+icalerrorenum icalfileset_add_component(icalset* set,
icalcomponent* child);
-icalerrorenum icalfileset_remove_component(icalfileset* cluster,
+icalerrorenum icalfileset_remove_component(icalset* set,
icalcomponent* child);
-int icalfileset_count_components(icalfileset* cluster,
+int icalfileset_count_components(icalset* set,
icalcomponent_kind kind);
-/* Restrict the component returned by icalfileset_first, _next to those
- that pass the gauge. _clear removes the gauge */
-icalerrorenum icalfileset_select(icalfileset* store, icalgauge* gauge);
-void icalfileset_clear(icalfileset* store);
+/**
+ * Restrict the component returned by icalfileset_first, _next to those
+ * that pass the gauge. _clear removes the gauge
+ */
+icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge);
+
+/** clear the gauge **/
+void icalfileset_clear(icalset* set);
-/* Get and search for a component by uid */
-icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid);
-int icalfileset_has_uid(icalfileset* cluster, const char* uid);
-icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c);
+/** Get and search for a component by uid **/
+icalcomponent* icalfileset_fetch(icalset* set, const char* uid);
+int icalfileset_has_uid(icalset* set, const char* uid);
+icalcomponent* icalfileset_fetch_match(icalset* set, icalcomponent *c);
-/* Modify components according to the MODIFY method of CAP. Works on
- the currently selected components. */
-icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp,
+/**
+ * Modify components according to the MODIFY method of CAP. Works on the
+ * currently selected components.
+ */
+icalerrorenum icalfileset_modify(icalset* set,
+ icalcomponent *oldcomp,
icalcomponent *newcomp);
-/* Iterate through components. If a guage has been defined, these
+/* Iterate through components. If a gauge has been defined, these
will skip over components that do not pass the gauge */
-icalcomponent* icalfileset_get_current_component (icalfileset* cluster);
-icalcomponent* icalfileset_get_first_component(icalfileset* cluster);
-icalcomponent* icalfileset_get_next_component(icalfileset* cluster);
-/* Return a reference to the internal component. You probably should
+icalcomponent* icalfileset_get_current_component (icalset* cluster);
+icalcomponent* icalfileset_get_first_component(icalset* cluster);
+icalcomponent* icalfileset_get_next_component(icalset* cluster);
+
+/* External iterator for thread safety */
+icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
+icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter);
+icalcomponent* icalfileset_form_a_matched_recurrence_component(icalsetiter* itr);
+
+/** Return a reference to the internal component. You probably should
not be using this. */
-icalcomponent* icalfileset_get_component(icalfileset* cluster);
+icalcomponent* icalfileset_get_component(icalset* cluster);
+
+/**
+ * @brief options for opening an icalfileset.
+ *
+ * These options should be passed to the icalset_new() function
+ */
+
+typedef struct icalfileset_options {
+ int flags; /**< flags for open() O_RDONLY, etc */
+ mode_t mode; /**< file mode */
+ int safe_saves; /**< to lock or not */
+ icalcluster *cluster; /**< use this cluster to initialize data */
+} icalfileset_options;
+extern icalfileset_options icalfileset_options_default;
diff --git a/libical/src/libicalss/icalfilesetimpl.h b/libical/src/libicalss/icalfilesetimpl.h
index fcd3415..fe39604 100644
--- a/libical/src/libicalss/icalfilesetimpl.h
+++ b/libical/src/libicalss/icalfilesetimpl.h
@@ -27,2 +27,4 @@
+#ifndef ICALFILESETIMPL_H
+#define ICALFILESETIMPL_H
@@ -40,10 +42,12 @@
struct icalfileset_impl {
-
- char id[5]; /*fset*/
- char *path;
- icalcomponent* cluster;
- icalgauge* gauge;
- int changed;
- int fd; /* file descriptor */
+ icalset super; /**< parent class */
+ char *path; /**< pathname of file */
+ icalfileset_options options; /**< copy of options passed to icalset_new() */
+
+ icalcomponent* cluster; /**< cluster containing data */
+ icalgauge* gauge; /**< gauge for filtering out data */
+ int changed; /**< boolean flag, 1 if data has changed */
+ int fd; /**< file descriptor */
};
+#endif
diff --git a/libical/src/libicalss/icalgauge.c b/libical/src/libicalss/icalgauge.c
index b958ecf..f4854c7 100644
--- a/libical/src/libicalss/icalgauge.c
+++ b/libical/src/libicalss/icalgauge.c
@@ -33,11 +33,13 @@
-extern char* input_buffer;
-extern char* input_buffer_p;
-int ssparse(void);
+#include "icalssyacc.h"
-struct icalgauge_impl *icalss_yy_gauge;
+typedef void* yyscan_t;
-icalgauge* icalgauge_new_from_sql(char* sql)
+int ssparse(yyscan_t );
+
+
+icalgauge* icalgauge_new_from_sql(char* sql, int expand)
{
struct icalgauge_impl *impl;
+ yyscan_t yy_globals = NULL;
@@ -54,11 +56,27 @@ icalgauge* icalgauge_new_from_sql(char* sql)
impl->where = pvl_newlist();
+ impl->expand = expand;
+
+ sslex_init(&yy_globals);
+
+ ssset_extra(impl, yy_globals);
- icalss_yy_gauge = impl;
+ ss_scan_string(sql, yy_globals);
- input_buffer_p = input_buffer = sql;
- r = ssparse();
+ r = ssparse(yy_globals);
+ sslex_destroy(yy_globals);
- return impl;
+ if (r == 0) {
+ return impl;
+ }
+ else {
+ icalgauge_free(impl);
+ return NULL;
+ }
}
+int icalgauge_get_expand(icalgauge* gauge)
+{
+return (gauge->expand);
+
+}
@@ -66,11 +84,10 @@ void icalgauge_free(icalgauge* gauge)
{
- struct icalgauge_impl *impl = (struct icalgauge_impl*)gauge;
struct icalgauge_where *w;
- assert(impl->select != 0);
- assert(impl->where != 0);
- assert(impl->from != 0);
+ assert(gauge->select != 0);
+ assert(gauge->where != 0);
+ assert(gauge->from != 0);
- if(impl->select){
- while( (w=pvl_pop(impl->select)) != 0){
+ if(gauge->select){
+ while( (w=pvl_pop(gauge->select)) != 0){
if(w->value != 0){
@@ -80,7 +97,8 @@ void icalgauge_free(icalgauge* gauge)
}
- pvl_free(impl->select);
+ pvl_free(gauge->select);
+ gauge->select = 0;
}
- if(impl->where){
- while( (w=pvl_pop(impl->where)) != 0){
+ if(gauge->where){
+ while( (w=pvl_pop(gauge->where)) != 0){
@@ -91,8 +109,12 @@ void icalgauge_free(icalgauge* gauge)
}
- pvl_free(impl->where);
+ pvl_free(gauge->where);
+ gauge->where = 0;
}
- if(impl->from){
- pvl_free(impl->from);
+ if(gauge->from){
+ pvl_free(gauge->from);
+ gauge->from = 0;
}
+
+ free(gauge);
@@ -100,6 +122,8 @@ void icalgauge_free(icalgauge* gauge)
-/* Convert a VQUERY component into a gauge */
+
+/** Convert a VQUERY component into a gauge */
icalcomponent* icalgauge_make_gauge(icalcomponent* query);
-/* icaldirset_test compares a component against a gauge, and returns
+/**
+ icaldirset_test compares a component against a gauge, and returns
true if the component passes the test
@@ -107,3 +131,3 @@ icalcomponent* icalgauge_make_gauge(icalcomponent* query);
The gauge is a VCALENDAR component that specifies how to test the
- target components. The guage holds a collection of VEVENT, VTODO or
+ target components. The gauge holds a collection of VEVENT, VTODO or
VJOURNAL sub-components. Each of the sub-components has a
@@ -254,3 +278,2 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
- struct icalgauge_impl *impl = (struct icalgauge_impl*)gauge;
icalcomponent *inner;
@@ -259,2 +282,6 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
pvl_elem e;
+ icalcomponent_kind kind;
+ icalproperty *rrule;
+ int compare_recur = 0;
+
@@ -263,2 +290,4 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
+ if (gauge == 0 || comp == 0) return 0;
+
inner = icalcomponent_get_first_real_component(comp);
@@ -266,10 +295,24 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
+ /* Wally Yau: our component is not always wrapped with
+ * a <VCALENDAR>. It's not an error.
+ * icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ * return 0; */
+ kind = icalcomponent_isa(comp);
+ if(kind == ICAL_VEVENT_COMPONENT ||
+ kind == ICAL_VTODO_COMPONENT ||
+ kind == ICAL_VJOURNAL_COMPONENT ||
+ kind == ICAL_VQUERY_COMPONENT ||
+ kind == ICAL_VAGENDA_COMPONENT){
+ inner = comp;
+ }
+ else {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return 0;
+ }
+ inner = comp;
}
-
/* Check that this component is one of the FROM types */
local_pass = 0;
- for(e = pvl_head(impl->from);e!=0;e=pvl_next(e)){
+ for(e = pvl_head(gauge->from);e!=0;e=pvl_next(e)){
icalcomponent_kind k = (icalcomponent_kind)pvl_data(e);
@@ -286,4 +329,4 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
- /* Check each where clause against the component */
- for(e = pvl_head(impl->where);e!=0;e=pvl_next(e)){
+ /**** Check each where clause against the component ****/
+ for(e = pvl_head(gauge->where);e!=0;e=pvl_next(e)){
struct icalgauge_where *w = pvl_data(e);
@@ -303,3 +346,3 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
if(vk == ICAL_NO_VALUE){
- icalerror_set_errno(ICAL_INTERNAL_ERROR);
+ icalerror_set_errno(ICAL_INTERNAL_ERROR);
return 0;
@@ -307,3 +350,6 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
- v = icalvalue_new_from_string(vk,w->value);
+ if (w->compare == ICALGAUGECOMPARE_ISNULL || w->compare == ICALGAUGECOMPARE_ISNOTNULL)
+ v = icalvalue_new(vk);
+ else
+ v = icalvalue_new_from_string(vk,w->value);
@@ -326,4 +372,21 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
+ /* check if it is a recurring */
+ rrule = icalcomponent_get_first_property(sub_comp,ICAL_RRULE_PROPERTY);
+
+ if (gauge->expand
+ && rrule) {
+
+ if (w->prop == ICAL_DTSTART_PROPERTY ||
+ w->prop == ICAL_DTEND_PROPERTY ||
+ w->prop == ICAL_DUE_PROPERTY){
+ /** needs to use recurrence-id to do comparison */
+ compare_recur = 1;
+ }
+
+ }
+
+
this_clause = 0;
- local_pass = 0;
+ local_pass = (w->compare == ICALGAUGECOMPARE_ISNULL) ? 1 : 0;
+
for(prop = icalcomponent_get_first_property(sub_comp,w->prop);
@@ -334,2 +397,17 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
+ if (w->compare == ICALGAUGECOMPARE_ISNULL) {
+ local_pass = 0;
+ break;
+ }
+
+ if (w->compare == ICALGAUGECOMPARE_ISNOTNULL) {
+ local_pass = 1;
+ break;
+ }
+
+ if (compare_recur) {
+ icalproperty *p = icalcomponent_get_first_property(sub_comp, ICAL_RECURRENCEID_PROPERTY);
+ prop_value = icalproperty_get_value(p);
+ }
+ else /* prop value from this component */
prop_value = icalproperty_get_value(prop);
@@ -357,4 +435,6 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
+
this_clause = local_pass > 0 ? 1 : 0;
+
/* Now look at the logic operator for this clause to see how
@@ -364,3 +444,3 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
last_clause = this_clause && last_clause;
- } else if(w->logic == ICALGAUGELOGIC_AND) {
+ } else if(w->logic == ICALGAUGELOGIC_OR) {
last_clause = this_clause || last_clause;
@@ -369,3 +449,6 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
}
- }
+
+ icalvalue_free(v);
+
+ }/**** check next one in where clause ****/
@@ -375,12 +458,13 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
+/** @brief Debug
+ * Print gauge information to stdout.
+ */
-void icalgauge_dump(icalcomponent* gauge)
+void icalgauge_dump(icalgauge* gauge)
{
- pvl_elem *p;
- struct icalgauge_impl *impl = (struct icalgauge_impl*)gauge;
-
+ pvl_elem p;
printf("--- Select ---\n");
- for(p = pvl_head(impl->select);p!=0;p=pvl_next(p)){
+ for(p = pvl_head(gauge->select);p!=0;p=pvl_next(p)){
struct icalgauge_where *w = pvl_data(p);
@@ -409,3 +493,3 @@ void icalgauge_dump(icalcomponent* gauge)
printf("--- From ---\n");
- for(p = pvl_head(impl->from);p!=0;p=pvl_next(p)){
+ for(p = pvl_head(gauge->from);p!=0;p=pvl_next(p)){
icalcomponent_kind k = (icalcomponent_kind)pvl_data(p);
@@ -416,3 +500,3 @@ void icalgauge_dump(icalcomponent* gauge)
printf("--- Where ---\n");
- for(p = pvl_head(impl->where);p!=0;p=pvl_next(p)){
+ for(p = pvl_head(gauge->where);p!=0;p=pvl_next(p)){
struct icalgauge_where *w = pvl_data(p);
@@ -443,4 +527,2 @@ void icalgauge_dump(icalcomponent* gauge)
}
-
-
}
diff --git a/libical/src/libicalss/icalgauge.h b/libical/src/libicalss/icalgauge.h
index 1caf0ac..c35b4f7 100644
--- a/libical/src/libicalss/icalgauge.h
+++ b/libical/src/libicalss/icalgauge.h
@@ -31,5 +31,11 @@
-typedef void icalgauge;
+/** @file icalgauge.h
+ * @brief Routines implementing a filter for ical components
+ */
-icalgauge* icalgauge_new_from_sql(char* sql);
+typedef struct icalgauge_impl icalgauge;
+
+icalgauge* icalgauge_new_from_sql(char* sql, int expand);
+
+int icalgauge_get_expand(icalgauge* gauge);
@@ -39,11 +45,15 @@ char* icalgauge_as_sql(icalcomponent* gauge);
-void icalgauge_dump(icalcomponent* gauge);
+void icalgauge_dump(icalgauge* gauge);
+
-/* Return true is comp matches the gauge. The component must be in
- cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL
- sub component */
+/** @brief Return true if comp matches the gauge.
+ *
+ * The component must be in
+ * cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL
+ * sub component
+ */
int icalgauge_compare(icalgauge* g, icalcomponent* comp);
-/* Clone the component, but only return the properties specified in
- the gauge */
+/** Clone the component, but only return the properties
+ * specified in the gauge */
icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp);
diff --git a/libical/src/libicalss/icalgaugeimpl.h b/libical/src/libicalss/icalgaugeimpl.h
index 73a2813..e56b1c0 100644
--- a/libical/src/libicalss/icalgaugeimpl.h
+++ b/libical/src/libicalss/icalgaugeimpl.h
@@ -26,4 +26,2 @@
-#include "pvl.h"
-
typedef enum icalgaugecompare {
@@ -36,2 +34,4 @@ typedef enum icalgaugecompare {
ICALGAUGECOMPARE_REGEX=ICAL_XLICCOMPARETYPE_REGEX,
+ ICALGAUGECOMPARE_ISNULL=ICAL_XLICCOMPARETYPE_ISNULL,
+ ICALGAUGECOMPARE_ISNOTNULL=ICAL_XLICCOMPARETYPE_ISNOTNULL,
ICALGAUGECOMPARE_NONE=0
@@ -56,6 +56,6 @@ struct icalgauge_impl
{
-
- pvl_list select; /*Of icalgaugecompare, using only prop and comp fields*/
- pvl_list from; /* List of component_kinds, as integers */
- pvl_list where; /* List of icalgaugecompare */
+ pvl_list select; /**< Of icalgaugecompare, using only prop and comp fields*/
+ pvl_list from; /**< List of component_kinds, as integers */
+ pvl_list where; /**< List of icalgaugecompare */
+ int expand;
};
diff --git a/libical/src/libicalss/icalmessage.c b/libical/src/libicalss/icalmessage.c
index d5c57c1..731a2c7 100644
--- a/libical/src/libicalss/icalmessage.c
+++ b/libical/src/libicalss/icalmessage.c
@@ -42,3 +42,3 @@ icalcomponent* icalmessage_get_inner(icalcomponent* comp)
-char* lowercase(const char* str)
+static char* lowercase(const char* str)
{
@@ -160,4 +160,9 @@ icalcomponent *icalmessage_new_reply_base(icalcomponent* c,
+#ifndef WIN32
sprintf(tmp,
"-//SoftwareStudio//NONSGML %s %s //EN",PACKAGE,VERSION);
+#else
+ sprintf(tmp,
+ "-//SoftwareStudio//NONSGML %s %s //EN",ICAL_PACKAGE,ICAL_VERSION);
+#endif
icalcomponent_add_property(reply,icalproperty_new_prodid(tmp));
@@ -232,3 +237,3 @@ icalcomponent* icalmessage_new_counterpropose_reply(icalcomponent* oldc,
- reply = icalcomponent_new_clone(newc);
+ reply = icalmessage_new_reply_base(newc,user,msg);
@@ -236,3 +241,3 @@ icalcomponent* icalmessage_new_counterpropose_reply(icalcomponent* oldc,
- return newc;
+ return reply;
diff --git a/libical/src/libicalss/icalset.c b/libical/src/libicalss/icalset.c
index 2120609..0ad2269 100644
--- a/libical/src/libicalss/icalset.c
+++ b/libical/src/libicalss/icalset.c
@@ -43,29 +43,22 @@
#include <stdlib.h>
-/*#include "icalheapset.h"*/
-/*#include "icalmysqlset.h"*/
-
-#define ICALSET_ID "set "
-
-struct icalset_fp {
- void (*free)(icalset* set);
- const char* (*path)(icalset* set);
- void (*mark)(icalset* set);
- icalerrorenum (*commit)(icalset* set);
- icalerrorenum (*add_component)(icalset* set, icalcomponent* comp);
- icalerrorenum (*remove_component)(icalset* set, icalcomponent* comp);
- int (*count_components)(icalset* set,
- icalcomponent_kind kind);
- icalerrorenum (*select)(icalset* set, icalcomponent* gauge);
- void (*clear)(icalset* set);
- icalcomponent* (*fetch)(icalset* set, const char* uid);
- icalcomponent* (*fetch_match)(icalset* set, icalcomponent *comp);
- int (*has_uid)(icalset* set, const char* uid);
- icalerrorenum (*modify)(icalset* set, icalcomponent *old,
- icalcomponent *new);
- icalcomponent* (*get_current_component)(icalset* set);
- icalcomponent* (*get_first_component)(icalset* set);
- icalcomponent* (*get_next_component)(icalset* set);
-};
-
-struct icalset_fp icalset_dirset_fp = {
+#include <string.h>
+#include <errno.h>
+
+#ifdef WITH_BDB4
+#include "icalbdbset.h"
+#include "icalbdbsetimpl.h"
+#endif
+
+/* #define _DLOPEN_TEST */
+#ifdef _DLOPEN_TEST
+#include <sys/types.h>
+#include <dlfcn.h>
+#include <dirent.h>
+#endif
+
+static icalset icalset_dirset_init = {
+ ICAL_DIR_SET,
+ sizeof(icaldirset),
+ NULL,
+ icaldirset_init,
icaldirset_free,
@@ -85,3 +78,6 @@ struct icalset_fp icalset_dirset_fp = {
icaldirset_get_first_component,
- icaldirset_get_next_component
+ icaldirset_get_next_component,
+ icaldirset_begin_component,
+ icaldirsetiter_to_next,
+ icaldirsetiter_to_prior
};
@@ -89,3 +85,7 @@ struct icalset_fp icalset_dirset_fp = {
-struct icalset_fp icalset_fileset_fp = {
+static icalset icalset_fileset_init = {
+ ICAL_FILE_SET,
+ sizeof(icalfileset),
+ NULL,
+ icalfileset_init,
icalfileset_free,
@@ -105,158 +105,262 @@ struct icalset_fp icalset_fileset_fp = {
icalfileset_get_first_component,
- icalfileset_get_next_component
+ icalfileset_get_next_component,
+ icalfileset_begin_component,
+ icalfilesetiter_to_next,
+ NULL
};
-struct icalset_impl {
+#ifdef WITH_BDB4
+static icalset icalset_bdbset_init = {
+ ICAL_BDB_SET,
+ sizeof(icalbdbset),
+ NULL,
+ icalbdbset_init,
+ icalbdbset_free,
+ icalbdbset_path,
+ icalbdbset_mark,
+ icalbdbset_commit,
+ icalbdbset_add_component,
+ icalbdbset_remove_component,
+ icalbdbset_count_components,
+ icalbdbset_select,
+ icalbdbset_clear,
+ icalbdbset_fetch,
+ icalbdbset_fetch_match,
+ icalbdbset_has_uid,
+ icalbdbset_modify,
+ icalbdbset_get_current_component,
+ icalbdbset_get_first_component,
+ icalbdbset_get_next_component,
+ icalbdbset_begin_component,
+ icalbdbsetiter_to_next,
+ NULL
+};
+#endif
- char id[5]; /* "set " */
+#ifdef _DLOPEN_TEST
+static int icalset_init_done = 0;
+static pvl_list icalset_kinds = 0;
- void *derived_impl;
- struct icalset_fp *fp;
-};
+typedef icalset *(*fptr)(void);
-/* Figure out what was actually passed in as the set. This could be a
- set or and of the derived types such as dirset or fileset. Note
- this routine returns a value, not a reference, to avoid memory
- leaks in the methods */
-struct icalset_impl icalset_get_impl(icalset* set)
-{
- struct icalset_impl impl;
-
- memset(&impl,0,sizeof(impl));
- icalerror_check_arg_re( (set!=0),"set",impl);
-
- if(strcmp((char*)set,ICALSET_ID)==0) {
- /* It is actually a set, so just sent the reference back out. */
- return *(struct icalset_impl*)set;
- } else if(strcmp((char*)set,ICALFILESET_ID)==0) {
- /* Make a new set from the fileset */
- impl.fp = &icalset_fileset_fp;
- impl.derived_impl = set;
- strcpy(impl.id,ICALFILESET_ID);/* HACK. Is this necessary? */
- return impl;
- } else if(strcmp((char*)set,ICALDIRSET_ID)==0) {
- /* Make a new set from the dirset */
- impl.fp = &icalset_dirset_fp;
- impl.derived_impl = set;
- strcpy(impl.id,ICALDIRSET_ID);/* HACK. Is this necessary? */
- return impl;
- } else {
- /* The type of set is unknown, so throw an error */
- icalerror_assert((0),"Unknown set type");
- return impl;
- }
+/**
+ * Try to load the file and register any icalset found within.
+ */
+static int load(const char *file) {
+
+ void *modh;
+ fptr inith;
+ icalset *icalset_init_ptr;
+
+ if ((modh = dlopen(file, RTLD_NOW)) == 0) {
+ perror("dlopen");
+ return 0;
+ }
+
+ if ((inith = (fptr)dlsym(modh, "InitModule")) == 0) {
+ perror("dlsym");
+ return 0;
+ }
+
+ while ((icalset_init_ptr = ((inith)())) != 0) {
+ pvl_push(icalset_kinds, &icalset_init_ptr);
+ }
+
+ return 1;
}
+/**
+ * Look in the given directory for files called mod_*.o and try to
+ * load them.
+ */
+int icalset_loaddir(const char *path) {
+ DIR *d;
+ struct dirent *dp;
+ char buf[PATH_MAX],
+ *bufptr;
+ int tot = 0;
-struct icalset_impl* icalset_new_impl()
-{
-
- struct icalset_impl* impl;
+ strcpy(buf, path);
+ bufptr = buf + strlen(buf);
- if ( ( impl = (struct icalset_impl*)
- malloc(sizeof(struct icalset_impl))) == 0) {
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return 0;
- }
+ if (*(bufptr-1) != '/')
+ *bufptr++ = '/';
- strcpy(impl->id,ICALSET_ID);
+ if ((d = opendir(path)) == 0) {
+ perror("opendir");
+ return 0;
+ }
- impl->derived_impl = 0;
- impl->fp = 0;
+ while ((dp = readdir(d)) != 0) {
+ if (strncmp(dp->d_name, "mod_", 4)) continue;
- return impl;
-}
+ strcpy(bufptr, dp->d_name);
-struct icalset_impl* icalset_new_file_from_ref(icalfileset *fset)
-{
- struct icalset_impl *impl = icalset_new_impl();
+ load(buf);
+ tot++;
+ }
+ (void)closedir(d);
- icalerror_check_arg_rz( (fset!=0),"fset");
+ return 1;
+}
- if(impl == 0){
- free(impl);
- return 0;
- }
+int icalset_register_class(icalset *set);
- impl->derived_impl = fset;
+static void icalset_init(void) {
+ assert(icalset_kinds == 0);
+ icalset_kinds = pvl_newlist();
- if (impl->derived_impl == 0){
- free(impl);
- return 0;
- }
+ pvl_push(icalset_kinds, &icalset_fileset_init);
+ pvl_push(icalset_kinds, &icalset_dirset_init);
+#ifdef WITH_BDB4
+ pvl_push(icalset_kinds, &icalset_bdb4set_init);
+#endif
- impl->fp = &icalset_fileset_fp;
+#ifdef EXT_PATH
+ icalset_loaddir(EXT_PATH);
+#endif
- return (struct icalset_impl*)impl;
+ icalset_init_done++;
}
-icalset* icalset_new_file(const char* path)
-{
- icalfileset *fset = icalfileset_new(path);
+int icalset_register_class(icalset *set) {
- if(fset == 0){
- return 0;
- }
+ if (!icalset_init_done)
+ icalset_init();
- return (icalset*)icalset_new_file_from_ref(fset);
+ pvl_push(icalset_kinds, set);
+ return 1;
}
-icalset* icalset_new_dir_from_ref(icaldirset *dset)
-{
+#endif
- struct icalset_impl *impl = icalset_new_impl();
+icalset* icalset_new(icalset_kind kind, const char* dsn, void* options) {
+ icalset *data = NULL;
+ icalset *ret = NULL;
- icalerror_check_arg_rz( (dset!=0),"dset");
+#ifdef _DLOPEN_TEST
+ pvl_elem e;
+ icalset *impl;
- if(impl == 0){
- return 0;
+ if (!icalset_init_done)
+ icalset_init();
+
+ for(e = pvl_head(icalset_kinds); e!=0; e = pvl_next(e)) {
+ impl = (icalset*)pvl_data(e);
+ if (impl->kind == kind)
+ break;
+ }
+ if (e == 0) {
+ icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
+ return(NULL);
}
- impl->derived_impl = dset;
+ data = (icalset*)malloc(impl->size);
+ if (data == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ errno = ENOMEM;
+ return 0;
+ }
- if (impl->derived_impl == 0){
- free(impl);
+ /* The first member of the derived class must be an icalset. */
+ memset(data,0,impl->size);
+ /* *data = *impl; */
+ memcpy(data, impl, sizeof(icalset));
+
+ data->dsn = strdup(dsn);
+#else
+ switch(kind) {
+ case ICAL_FILE_SET:
+ data = (icalset*) malloc(sizeof(icalfileset));
+ if (data == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ errno = ENOMEM;
+ return 0;
+ }
+ memset(data,0,sizeof(icalfileset));
+ *data = icalset_fileset_init;
+ break;
+ case ICAL_DIR_SET:
+ data = (icalset*) malloc(sizeof(icaldirset));
+ if (data == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ errno = ENOMEM;
+ return 0;
+ }
+ memset(data,0,sizeof(icaldirset));
+ *data = icalset_dirset_init;
+ break;
+#ifdef WITH_BDB4
+ case ICAL_BDB_SET:
+ data = (icalset*) malloc(sizeof(icalbdbset));
+ if (data == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ errno = ENOMEM;
return 0;
}
+ memset(data,0,sizeof(icalbdbset));
+ *data = icalset_bdbset_init;
+ break;
+#endif
+
+ default:
+ icalerror_set_errno(ICAL_UNIMPLEMENTED_ERROR);
+ /** unimplemented **/
+ return(NULL);
+ }
+
+ if ( data == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+ data->kind = kind;
+ data->dsn = strdup(dsn);
+#endif
- impl->fp = &icalset_dirset_fp;
+ /** call the implementation specific initializer **/
+ if ((ret = data->init(data, dsn, options)) == NULL)
+ icalset_free(data);
- return impl;
+ return ret;
}
-icalset* icalset_new_dir(const char* path)
+icalset* icalset_new_file(const char* path)
{
- icaldirset *dset = icaldirset_new(path);
-
- if(dset == 0){
- return 0;
- }
+ return icalset_new(ICAL_FILE_SET, path, NULL);
+}
- return icalset_new_dir_from_ref(dset);
+icalset* icalset_new_file_writer(const char* path)
+{
+ return icalfileset_new_writer(path);
}
-icalset* icalset_new_heap(void)
+icalset* icalset_new_file_reader(const char* path)
{
- struct icalset_impl *impl = icalset_new_impl();
+ return icalfileset_new_reader(path);
+}
- if(impl == 0){
- free(impl);
- return 0;
- }
+icalset* icalset_new_dir(const char* path)
+{
+ return icalset_new(ICAL_DIR_SET, path, NULL);
+}
- return 0;
+icalset* icalset_new_dir_writer(const char* path)
+{
+ return icaldirset_new_writer(path);
}
-icalset* icalset_new_mysql(const char* path)
+icalset* icalset_new_dir_reader(const char* path)
{
- struct icalset_impl *impl = icalset_new_impl();
+ return icaldirset_new_reader(path);
+}
- if(impl == 0){
- free(impl);
- return 0;
- }
- return 0;
-}
+
+/* Functions for built-in methods */
+
+/**
+ * free memory associated with this icalset
+ * automatically calls the implementation specific free routine
+ */
@@ -264,75 +368,54 @@ void icalset_free(icalset* set)
{
- struct icalset_impl impl = icalset_get_impl(set);
- (*(impl.fp->free))(impl.derived_impl);
+ if (set->free)
+ set->free(set);
- if(strcmp((char*)set,ICALSET_ID)) {
- free(set);
- }
-}
+ if (set->dsn)
+ free(set->dsn);
-const char* icalset_path(icalset* set)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->path))(impl.derived_impl);
+ free(set);
}
-void icalset_mark(icalset* set)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- (*(impl.fp->mark))(impl.derived_impl);
+
+const char* icalset_path(icalset* set) {
+ return set->path(set);
}
-icalerrorenum icalset_commit(icalset* set)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->commit))(impl.derived_impl);
+void icalset_mark(icalset* set) {
+ set->mark(set);
}
-icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->add_component))(impl.derived_impl,comp);
+icalerrorenum icalset_commit(icalset* set) {
+ return set->commit(set);
}
-icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->remove_component))(impl.derived_impl,comp);
+icalerrorenum icalset_add_component(icalset* set, icalcomponent* comp) {
+ return set->add_component(set,comp);
}
-int icalset_count_components(icalset* set,icalcomponent_kind kind)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->count_components))(impl.derived_impl,kind);
+icalerrorenum icalset_remove_component(icalset* set, icalcomponent* comp) {
+ return set->remove_component(set,comp);
}
-icalerrorenum icalset_select(icalset* set, icalcomponent* gauge)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->select))(impl.derived_impl,gauge);
+int icalset_count_components(icalset* set,icalcomponent_kind kind) {
+ return set->count_components(set,kind);
}
-void icalset_clear(icalset* set)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- (*(impl.fp->clear))(impl.derived_impl);
+icalerrorenum icalset_select(icalset* set, icalgauge* gauge) {
+ return set->select(set, gauge);
}
-icalcomponent* icalset_fetch(icalset* set, const char* uid)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->fetch))(impl.derived_impl,uid);
+void icalset_clear(icalset* set) {
+ set->clear(set);
}
-icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *comp)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->fetch_match))(impl.derived_impl,comp);
+icalcomponent* icalset_fetch(icalset* set, const char* uid) {
+ return set->fetch(set, uid);
}
+icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *comp) {
+ return set->fetch_match(set, comp);
+}
-int icalset_has_uid(icalset* set, const char* uid)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->has_uid))(impl.derived_impl,uid);
+int icalset_has_uid(icalset* set, const char* uid) {
+ return set->has_uid(set, uid);
}
@@ -340,28 +423,71 @@ int icalset_has_uid(icalset* set, const char* uid)
icalerrorenum icalset_modify(icalset* set, icalcomponent *old,
- icalcomponent *new)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->modify))(impl.derived_impl,old,new);
+ icalcomponent *new) {
+ return set->modify(set, old, new);
}
-icalcomponent* icalset_get_current_component(icalset* set)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->get_current_component))(impl.derived_impl);
+icalcomponent* icalset_get_current_component(icalset* set) {
+ return set->get_current_component(set);
}
-icalcomponent* icalset_get_first_component(icalset* set)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->get_first_component))(impl.derived_impl);
+icalcomponent* icalset_get_first_component(icalset* set) {
+ return set->get_first_component(set);
}
-icalcomponent* icalset_get_next_component(icalset* set)
-{
- struct icalset_impl impl = icalset_get_impl(set);
- return (*(impl.fp->get_next_component))(impl.derived_impl);
+icalcomponent* icalset_get_next_component(icalset* set) {
+ return set->get_next_component(set);
+}
+
+icalsetiter icalsetiter_null = {{ICAL_NO_COMPONENT, 0}, 0};
+
+icalsetiter icalset_begin_component(icalset* set,
+ icalcomponent_kind kind, icalgauge* gauge) {
+ return set->icalset_begin_component(set, kind, gauge);
+}
+
+icalcomponent* icalsetiter_next(icalsetiter* itr) {
+
+ icalcomponent* c = 0;
+ icalerror_check_arg_rz( (itr != NULL), "i");
+
+ do {
+ c = icalcompiter_next(&(itr->iter));
+ if(c != 0 && (itr->gauge == 0 ||
+ icalgauge_compare(itr->gauge, c) == 1)){
+ return c;
+ }
+ } while (c != 0);
+
+ return 0;
}
+icalcomponent* icalsetiter_prior(icalsetiter* i) {
+
+ icalcomponent* c = 0;
+ icalerror_check_arg_rz( (i != NULL), "i" );
+
+ do {
+ c = icalcompiter_prior(&(i->iter));
+ if(c != 0 && (i->gauge == 0 ||
+ icalgauge_compare(i->gauge, c) == 1)){
+ return c;
+ }
+ } while (c != 0);
+
+ return 0;
+}
+icalcomponent* icalsetiter_deref(icalsetiter* i) {
+ icalerror_check_arg_rz( (i != NULL), "i" );
+ return (icalcompiter_deref(&(i->iter)));
+}
+/* for subclasses that use multiple clusters that require specialized cluster traversal */
+icalcomponent* icalsetiter_to_next(icalset* set, icalsetiter* i)
+{
+ return set->icalsetiter_to_next(set, i);
+}
+icalcomponent* icalsetiter_to_prior(icalset* set, icalsetiter* i)
+{
+ return set->icalsetiter_to_prior(set, i);
+}
diff --git a/libical/src/libicalss/icalset.h b/libical/src/libicalss/icalset.h
index 7b083da..4008c62 100644
--- a/libical/src/libicalss/icalset.h
+++ b/libical/src/libicalss/icalset.h
@@ -1,6 +1,5 @@
/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalset.h
- CREATOR: eric 28 November 1999
-
+/**
+ @file icalset.h
+ @author eric 28 November 1999
@@ -9,7 +8,10 @@
- icalfileset Store componetns in a single file
+ icalfileset Store components in a single file
icaldirset Store components in multiple files in a directory
+ icalbdbset Store components in a Berkeley DB File
icalheapset Store components on the heap
icalmysqlset Store components in a mysql database.
+**/
+/*
$Id$
@@ -41,3 +43,3 @@
#include "ical.h"
-#include "icalerror.h"
+#include "icalgauge.h"
@@ -50,5 +52,3 @@
-
-
-typedef void icalset;
+typedef struct icalset_impl icalset;
@@ -57,14 +57,67 @@ typedef enum icalset_kind {
ICAL_DIR_SET,
- ICAL_HEAP_SET,
- ICAL_MYSQL_SET,
- ICAL_CAP_SET
+ ICAL_BDB_SET
} icalset_kind;
+typedef struct icalsetiter
+{
+ icalcompiter iter; /* icalcomponent_kind, pvl_elem iter */
+ icalgauge* gauge;
+ icalrecur_iterator* ritr; /*the last iterator*/
+ icalcomponent* last_component; /*the pending recurring component to be processed */
+ const char* tzid; /* the calendar's timezone id */
+} icalsetiter;
+
+struct icalset_impl {
+ icalset_kind kind;
+ int size;
+ char *dsn;
+ icalset* (*init)(icalset* set, const char *dsn, void *options);
+ void (*free)(icalset* set);
+ const char* (*path)(icalset* set);
+ void (*mark)(icalset* set);
+ icalerrorenum (*commit)(icalset* set);
+ icalerrorenum (*add_component)(icalset* set, icalcomponent* comp);
+ icalerrorenum (*remove_component)(icalset* set, icalcomponent* comp);
+ int (*count_components)(icalset* set,
+ icalcomponent_kind kind);
+ icalerrorenum (*select)(icalset* set, icalgauge* gauge);
+ void (*clear)(icalset* set);
+ icalcomponent* (*fetch)(icalset* set, const char* uid);
+ icalcomponent* (*fetch_match)(icalset* set, icalcomponent *comp);
+ int (*has_uid)(icalset* set, const char* uid);
+ icalerrorenum (*modify)(icalset* set, icalcomponent *old,
+ icalcomponent *newc);
+ icalcomponent* (*get_current_component)(icalset* set);
+ icalcomponent* (*get_first_component)(icalset* set);
+ icalcomponent* (*get_next_component)(icalset* set);
+ icalsetiter (*icalset_begin_component)(icalset* set,
+ icalcomponent_kind kind, icalgauge* gauge);
+ icalcomponent* (*icalsetiter_to_next)(icalset* set, icalsetiter* i);
+ icalcomponent* (*icalsetiter_to_prior)(icalset* set, icalsetiter* i);
+};
+
+/** @brief Register a new derived class */
+int icalset_register_class(icalset *set);
+
+
+/** @brief Generic icalset constructor
+ *
+ * @param kind The type of icalset to create
+ * @param dsn Data Source Name - usually a pathname or DB handle
+ * @param options Any implementation specific options
+ *
+ * @return A valid icalset reference or NULL if error.
+ *
+ * This creates any of the icalset types available.
+ */
+
+icalset* icalset_new(icalset_kind kind, const char* dsn, void* options);
-/* Create a specific derived type of set */
icalset* icalset_new_file(const char* path);
+icalset* icalset_new_file_reader(const char* path);
+icalset* icalset_new_file_writer(const char* path);
+
icalset* icalset_new_dir(const char* path);
-icalset* icalset_new_heap(void);
-icalset* icalset_new_mysql(const char* path);
-/*icalset* icalset_new_cap(icalcstp* cstp);*/
+icalset* icalset_new_file_reader(const char* path);
+icalset* icalset_new_file_writer(const char* path);
@@ -74,5 +127,7 @@ const char* icalset_path(icalset* set);
-/* Mark the cluster as changed, so it will be written to disk when it
- is freed. Commit writes to disk immediately*/
+/** Mark the cluster as changed, so it will be written to disk when it
+ is freed. **/
void icalset_mark(icalset* set);
+
+/** Write changes to disk immediately */
icalerrorenum icalset_commit(icalset* set);
@@ -85,9 +140,12 @@ int icalset_count_components(icalset* set,
-/* Restrict the component returned by icalset_first, _next to those
- that pass the gauge. _clear removes the gauge. */
-icalerrorenum icalset_select(icalset* set, icalcomponent* gauge);
+/** Restrict the component returned by icalset_first, _next to those
+ that pass the gauge. */
+icalerrorenum icalset_select(icalset* set, icalgauge* gauge);
+
+/** Clears the gauge defined by icalset_select() */
void icalset_clear_select(icalset* set);
-/* Get a component by uid */
+/** Get a component by uid */
icalcomponent* icalset_fetch(icalset* set, const char* uid);
+
int icalset_has_uid(icalset* set, const char* uid);
@@ -95,3 +153,3 @@ icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c);
-/* Modify components according to the MODIFY method of CAP. Works on
+/** Modify components according to the MODIFY method of CAP. Works on
the currently selected components. */
@@ -100,3 +158,3 @@ icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc,
-/* Iterate through the components. If a guage has been defined, these
+/** Iterate through the components. If a guage has been defined, these
will skip over components that do not pass the gauge */
@@ -107,2 +165,17 @@ icalcomponent* icalset_get_next_component(icalset* set);
+/** External Iterator with gauge - for thread safety */
+extern icalsetiter icalsetiter_null;
+
+icalsetiter icalset_begin_component(icalset* set,
+ icalcomponent_kind kind, icalgauge* gauge);
+
+/** Default _next, _prior, _deref for subclasses that use single cluster */
+icalcomponent* icalsetiter_next(icalsetiter* i);
+icalcomponent* icalsetiter_prior(icalsetiter* i);
+icalcomponent* icalsetiter_deref(icalsetiter* i);
+
+/** for subclasses that use multiple clusters that require specialized cluster traversal */
+icalcomponent* icalsetiter_to_next(icalset* set, icalsetiter* i);
+icalcomponent* icalsetiter_to_prior(icalset* set, icalsetiter* i);
+
#endif /* !ICALSET_H */
diff --git a/libical/src/libicalss/icalspanlist.c b/libical/src/libicalss/icalspanlist.c
index cab6a81..f42ff41 100644
--- a/libical/src/libicalss/icalspanlist.c
+++ b/libical/src/libicalss/icalspanlist.c
@@ -30,10 +30,23 @@
#include "icalspanlist.h"
-#include "pvl.h"
+
#include <stdlib.h> /* for free and malloc */
+#include <string.h>
struct icalspanlist_impl {
- pvl_list spans;
+ pvl_list spans; /**< list of icaltime_span data **/
+ struct icaltimetype start; /**< start time of span **/
+ struct icaltimetype end; /**< end time of span **/
};
-int compare_span(void* a, void* b)
+/** @brief Internal comparison function for two spans
+ *
+ * @param a a spanlist.
+ * @param b another spanlist.
+ *
+ * @return -1, 0, 1 depending on the comparison of the start times.
+ *
+ * Used to insert spans into the tree in sorted order.
+ */
+
+static int compare_span(void* a, void* b)
{
@@ -51,16 +64,48 @@ int compare_span(void* a, void* b)
-icalcomponent* icalspanlist_get_inner(icalcomponent* comp)
+
+/** @brief callback function for collecting spanlists of a
+ * series of events.
+ *
+ * @param comp A valid icalcomponent.
+ * @param span The span to insert into data.
+ * @param data The actual spanlist to insert into
+ *
+ * This callback is used by icalcomponent_foreach_recurrence()
+ * to build up a spanlist.
+ */
+
+static void icalspanlist_new_callback(icalcomponent *comp,
+ struct icaltime_span *span,
+ void *data)
{
- if (icalcomponent_isa(comp) == ICAL_VCALENDAR_COMPONENT){
- return icalcomponent_get_first_real_component(comp);
- } else {
- return comp;
- }
+ icaltime_span *s;
+ icalspanlist *sl = (icalspanlist*) data;
+
+ if (span->is_busy == 0)
+ return;
+
+ if ((s=(icaltime_span *) malloc(sizeof(icaltime_span))) == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return;
+ }
+
+ /** copy span data into allocated memory.. **/
+ *s = *span;
+ pvl_insert_ordered(sl->spans, compare_span, (void*)s);
}
+
-void print_span(int c, struct icaltime_span span );
+/** @brief Make a free list from a set of VEVENT components.
+ *
+ * @param set A valid icalset containing VEVENTS
+ * @param start The free list starts at this date/time
+ * @param end The free list ends at this date/time
+ *
+ * @return A spanlist corresponding to the VEVENTS
+ *
+ * Given a set of components, a start time and an end time
+ * return a spanlist that contains the free/busy times.
+ */
-
-/* Make a free list from a set of component */
icalspanlist* icalspanlist_new(icalset *set,
@@ -73,3 +118,3 @@ icalspanlist* icalspanlist_new(icalset *set,
icalcomponent_kind kind, inner_kind;
- struct icalspanlist_impl *sl;
+ icalspanlist *sl;
struct icaltime_span *freetime;
@@ -83,2 +128,4 @@ icalspanlist* icalspanlist_new(icalset *set,
sl->spans = pvl_newlist();
+ sl->start = start;
+ sl->end = end;
@@ -87,6 +134,2 @@ icalspanlist* icalspanlist_new(icalset *set,
- printf("Range start: %s",ctime(&range.start));
- printf("Range end : %s",ctime(&range.end));
-
-
/* Get a list of spans of busy time from the events in the set
@@ -98,4 +141,2 @@ icalspanlist* icalspanlist_new(icalset *set,
- struct icaltime_span span;
-
kind = icalcomponent_isa(c);
@@ -115,27 +156,8 @@ icalspanlist* icalspanlist_new(icalset *set,
icalerror_clear_errno();
-
- span = icalcomponent_get_span(c);
- span.is_busy = 1;
-
- if(icalerrno != ICAL_NO_ERROR){
- continue;
- }
-
- if ((range.start < span.end && icaltime_is_null_time(end)) ||
- (range.start < span.end && range.end > span.start )){
-
- struct icaltime_span *s;
-
- if ((s=(struct icaltime_span *)
- malloc(sizeof(struct icaltime_span))) == 0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return 0;
- }
-
- memcpy(s,&span,sizeof(span));
-
- pvl_insert_ordered(sl->spans,compare_span,(void*)s);
-
- }
- }
+
+ icalcomponent_foreach_recurrence(c, start, end,
+ icalspanlist_new_callback,
+ (void*)sl);
+
+ }
@@ -150,3 +172,3 @@ icalspanlist* icalspanlist_new(icalset *set,
{
- struct icaltime_span *s = (icalproperty*)pvl_data(itr);
+ struct icaltime_span *s = (struct icaltime_span*)pvl_data(itr);
@@ -180,3 +202,3 @@ icalspanlist* icalspanlist_new(icalset *set,
- last_span = pvl_data(pvl_tail(sl->spans));
+ last_span = (struct icaltime_span*)pvl_data(pvl_tail(sl->spans));
@@ -199,5 +221,10 @@ icalspanlist* icalspanlist_new(icalset *set,
return sl;
-
}
+/** @brief Destructor.
+ * @param s A valid icalspanlist
+ *
+ * Free memory associated with the spanlist
+ */
+
void icalspanlist_free(icalspanlist* s)
@@ -205,5 +232,7 @@ void icalspanlist_free(icalspanlist* s)
struct icaltime_span *span;
- struct icalspanlist_impl* impl = (struct icalspanlist_impl*)s;
-
- while( (span=pvl_pop(impl->spans)) != 0){
+
+ if (s == NULL)
+ return;
+
+ while( (span=pvl_pop(s->spans)) != 0){
free(span);
@@ -211,5 +240,7 @@ void icalspanlist_free(icalspanlist* s)
- pvl_free(impl->spans);
+ pvl_free(s->spans);
- impl->spans = 0;
+ s->spans = 0;
+
+ free(s);
}
@@ -217,6 +248,8 @@ void icalspanlist_free(icalspanlist* s)
-void icalspanlist_dump(icalspanlist* s){
+/** @brief (Debug) print out spanlist to stdout.
+ * @param sl A valid icalspanlist.
+ */
+void icalspanlist_dump(icalspanlist* sl){
int i = 0;
- struct icalspanlist_impl* sl = (struct icalspanlist_impl*)s;
pvl_elem itr;
@@ -227,3 +260,3 @@ void icalspanlist_dump(icalspanlist* s){
{
- struct icaltime_span *s = (icalproperty*)pvl_data(itr);
+ struct icaltime_span *s = (struct icaltime_span*)pvl_data(itr);
@@ -238,2 +271,12 @@ icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl);
+
+/** @brief Find next free time span in a spanlist.
+ *
+ * @param sl The spanlist to search.
+ * @param t The time to start looking.
+ *
+ * Given a spanlist and a time, find the next period of time
+ * that is free
+ */
+
struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
@@ -241,3 +284,2 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
{
- struct icalspanlist_impl* impl = (struct icalspanlist_impl*)sl;
pvl_elem itr;
@@ -251,6 +293,4 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
- /* Is the reference time before the first span? If so, assume
- that the reference time is free */
- itr = pvl_head(impl->spans);
- s = (icalproperty*)pvl_data(itr);
+ itr = pvl_head(sl->spans);
+ s = (struct icaltime_span *)pvl_data(itr);
@@ -261,2 +301,4 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
+ /* Is the reference time before the first span? If so, assume
+ that the reference time is free */
if(rangett <s->start ){
@@ -266,3 +308,3 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
- if (s->is_busy == 0){
+ if (s->is_busy == 1){
period.end = icaltime_from_timet(s->start,0);
@@ -277,4 +319,3 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
reference time. */
-
- for( itr = pvl_head(impl->spans);
+ for( itr = pvl_head(sl->spans);
itr != 0;
@@ -282,3 +323,3 @@ struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
{
- s = (icalproperty*)pvl_data(itr);
+ s = (struct icaltime_span *)pvl_data(itr);
@@ -309 +350,218 @@ struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl,
+
+/** @brief Returns an hour-by-hour array of free/busy times over a
+ * given period.
+ *
+ * @param sl A valid icalspanlist
+ * @param delta_t The time slice to divide by, in seconds. Default 3600.
+ *
+ * @return A pointer to an array of integers containing the number of
+ * busy events in each delta_t time period. The final entry
+ * contains the value -1.
+ *
+ * This calculation is somewhat tricky. This is due to the fact that
+ * the time range contains the start time, but does not contain the
+ * end time. To perform a proper calculation we subtract one second
+ * off the end times to get a true containing time.
+ *
+ * Also note that if you supplying a spanlist that does not start or
+ * end on a time boundary divisible by delta_t you may get results
+ * that are not quite what you expect.
+ */
+
+int* icalspanlist_as_freebusy_matrix(icalspanlist* sl, int delta_t) {
+ pvl_elem itr;
+ int spanduration_secs;
+ int *matrix;
+ int matrix_slots;
+ time_t sl_start, sl_end;
+
+ icalerror_check_arg_rz( (sl!=0), "spanlist");
+
+ if (!delta_t)
+ delta_t = 3600;
+
+ /** calculate the start and end time as time_t **/
+ sl_start = icaltime_as_timet_with_zone(sl->start, icaltimezone_get_utc_timezone());
+ sl_end = icaltime_as_timet_with_zone(sl->end, icaltimezone_get_utc_timezone());
+
+
+ /** insure that the time period falls on a time boundary divisable
+ by delta_t */
+
+ sl_start /= delta_t;
+ sl_start *= delta_t;
+
+ sl_end /= delta_t;
+ sl_end *= delta_t;
+
+
+ /** find the duration of this spanlist **/
+ spanduration_secs = sl_end - sl_start;
+
+
+ /** malloc our matrix, add one extra slot for a final -1 **/
+ matrix_slots = spanduration_secs/delta_t + 1;
+
+ matrix = (int*) malloc(sizeof(int) * matrix_slots);
+ if (matrix == NULL) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return NULL;
+ }
+ memset(matrix, 0, sizeof(int) * matrix_slots);
+ matrix[matrix_slots-1] = -1;
+
+ /* loop through each span and mark the slots in the array */
+
+ for( itr = pvl_head(sl->spans); itr != 0; itr = pvl_next(itr)) {
+ struct icaltime_span *s = (struct icaltime_span*)pvl_data(itr);
+
+ if (s->is_busy == 1) {
+ int offset_start = s->start/delta_t - sl_start/delta_t;
+ int offset_end = (s->end - 1) /delta_t - sl_start/delta_t + 1;
+ int i;
+
+ if (offset_end >= matrix_slots)
+ offset_end = matrix_slots - 1;
+
+ i = offset_start;
+ for (i=offset_start; i < offset_end; i++) {
+ matrix[i]++;
+ }
+ }
+ }
+ return matrix;
+}
+
+
+/** @brief Return a VFREEBUSY component for the corresponding spanlist
+ *
+ * @param sl A valid icalspanlist, from icalspanlist_new()
+ * @param organizer The organizer specified as MAILTO:user@domain
+ * @param attendee The attendee specified as MAILTO:user@domain
+ *
+ * @return A valid icalcomponent or NULL.
+ *
+ * This function returns a VFREEBUSY component for the given spanlist.
+ * The start time is mapped to DTSTART, the end time to DTEND.
+ * Each busy span is represented as a separate FREEBUSY entry.
+ * An attendee parameter is required, and organizer parameter is
+ * optional.
+ */
+
+icalcomponent *icalspanlist_as_vfreebusy(icalspanlist* sl,
+ const char* organizer,
+ const char* attendee) {
+ icalcomponent *comp;
+ icalproperty *p;
+ struct icaltimetype atime = icaltime_from_timet( time(0),0);
+ pvl_elem itr;
+ icaltimezone *utc_zone;
+ icalparameter *param;
+
+ if (!attendee) {
+ icalerror_set_errno(ICAL_USAGE_ERROR);
+ return 0;
+ }
+
+ utc_zone = icaltimezone_get_utc_timezone ();
+
+ comp = icalcomponent_new_vfreebusy();
+
+ icalcomponent_add_property(comp, icalproperty_new_dtstart(sl->start));
+ icalcomponent_add_property(comp, icalproperty_new_dtend(sl->end));
+ icalcomponent_add_property(comp, icalproperty_new_dtstamp(atime));
+
+ if (organizer) {
+ icalcomponent_add_property(comp, icalproperty_new_organizer(organizer));
+ }
+ icalcomponent_add_property(comp, icalproperty_new_attendee(attendee));
+
+ /* now add the freebusy sections.. */
+
+ for( itr = pvl_head(sl->spans); itr != 0; itr = pvl_next(itr)) {
+ struct icalperiodtype period;
+ struct icaltime_span *s = (struct icaltime_span*)pvl_data(itr);
+
+ if (s->is_busy == 1) {
+
+ period.start = icaltime_from_timet_with_zone (s->start, 0, utc_zone);
+ period.end = icaltime_from_timet_with_zone (s->end, 0, utc_zone);
+ period.duration = icaldurationtype_null_duration();
+
+
+ p = icalproperty_new_freebusy(period);
+ param = icalparameter_new_fbtype(ICAL_FBTYPE_BUSY);
+ icalproperty_add_parameter(p, param);
+
+ icalcomponent_add_property(comp, p);
+ }
+
+ }
+
+ return comp;
+}
+
+
+/** @brief Return a spanlist corresponding to the VFREEBUSY portion of
+ * an icalcomponent.
+ *
+ * @param c A valid icalcomponent.
+ *
+ * @return A valid icalspanlist or NULL if no VFREEBUSY section.
+ *
+ */
+
+
+icalspanlist *icalspanlist_from_vfreebusy(icalcomponent* comp)
+{
+ icalcomponent *inner;
+ icalproperty *prop;
+ icalspanlist *sl;
+
+ icalerror_check_arg_rz((comp != NULL), "comp");
+
+ inner = icalcomponent_get_inner(comp);
+ if (!inner) return NULL;
+
+ if ( ( sl = (icalspanlist*) malloc(sizeof(icalspanlist))) == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+ sl->spans = pvl_newlist();
+
+ /* cycle through each FREEBUSY property, adding to the spanlist */
+ for (prop = icalcomponent_get_first_property(inner, ICAL_FREEBUSY_PROPERTY);
+ prop != NULL;
+ prop = icalcomponent_get_next_property(inner, ICAL_FREEBUSY_PROPERTY)) {
+ icaltime_span *s = (icaltime_span *) malloc(sizeof(icaltime_span));
+ icalparameter *param;
+ struct icalperiodtype period;
+ icalparameter_fbtype fbtype;
+
+ if (s == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
+
+ param = icalproperty_get_first_parameter(prop, ICAL_FBTYPE_PARAMETER);
+ fbtype = (param) ? icalparameter_get_fbtype(param) : ICAL_FBTYPE_BUSY;
+
+ switch (fbtype) {
+ case ICAL_FBTYPE_FREE:
+ case ICAL_FBTYPE_NONE:
+ case ICAL_FBTYPE_X:
+ s->is_busy = 1;
+ default:
+ s->is_busy = 0;
+ }
+
+ period = icalproperty_get_freebusy(prop);
+ s->start = icaltime_as_timet_with_zone(period.start, icaltimezone_get_utc_timezone());
+ s->end = icaltime_as_timet_with_zone(period.end, icaltimezone_get_utc_timezone());
+;
+ pvl_insert_ordered(sl->spans, compare_span, (void*)s);
+ }
+ /** @todo calculate start/end limits.. fill in holes? **/
+ return sl;
+}
diff --git a/libical/src/libicalss/icalspanlist.h b/libical/src/libicalss/icalspanlist.h
index 83cb1c8..91f0acb 100644
--- a/libical/src/libicalss/icalspanlist.h
+++ b/libical/src/libicalss/icalspanlist.h
@@ -30,5 +30,13 @@
-typedef void icalspanlist;
+/** @file icalspanlist.h
+ * @brief Code that supports collections of free/busy spans of time
+ */
+
+typedef struct icalspanlist_impl icalspanlist;
+
+
+/** @brief Constructor
+ * Make a free list from a set of component. Start and end should be in UTC
+ */
-/* Make a free list from a set of component. Start and end should be in UTC */
icalspanlist* icalspanlist_new(icalset *set,
@@ -37,4 +45,7 @@ icalspanlist* icalspanlist_new(icalset *set,
+/** @brief Destructor
+ */
void icalspanlist_free(icalspanlist* spl);
+/* Unimplemented functions */
icalcomponent* icalspanlist_make_free_list(icalspanlist* sl);
@@ -42,5 +53,6 @@ icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl);
-/* Get first free or busy time after time t. all times are in UTC */
+/** Get first next free time after time t. all times are in UTC. */
struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
struct icaltimetype t);
+/** Get first next busy time after time t. all times are in UTC. */
struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl,
@@ -50,2 +62,13 @@ void icalspanlist_dump(icalspanlist* s);
+/** @brief Return a valid VFREEBUSY component for this span */
+icalcomponent *icalspanlist_as_vfreebusy(icalspanlist* s_in,
+ const char* organizer,
+ const char* attendee);
+
+/** @brief Return an integer matrix of total events per delta_t timespan */
+int *icalspanlist_as_freebusy_matrix(icalspanlist* span, int delta_t);
+
+/** @brief Construct an icalspanlist from a VFREEBUSY component */
+icalspanlist *icalspanlist_from_vfreebusy(icalcomponent* c);
+
#endif
diff --git a/libical/src/libicalss/icalss.h b/libical/src/libicalss/icalss.h
index cd07919..8930e11 100644
--- a/libical/src/libicalss/icalss.h
+++ b/libical/src/libicalss/icalss.h
@@ -1 +1,7 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+/*
+ $Id$
+*/
/* -*- Mode: C -*- */
@@ -6,4 +12,2 @@
- $Id$
- $Locker$
@@ -31,5 +35,11 @@
-typedef void icalgauge;
+/** @file icalgauge.h
+ * @brief Routines implementing a filter for ical components
+ */
-icalgauge* icalgauge_new_from_sql(char* sql);
+typedef struct icalgauge_impl icalgauge;
+
+icalgauge* icalgauge_new_from_sql(char* sql, int expand);
+
+int icalgauge_get_expand(icalgauge* gauge);
@@ -39,11 +49,15 @@ char* icalgauge_as_sql(icalcomponent* gauge);
-void icalgauge_dump(icalcomponent* gauge);
+void icalgauge_dump(icalgauge* gauge);
+
-/* Return true is comp matches the gauge. The component must be in
- cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL
- sub component */
+/** @brief Return true if comp matches the gauge.
+ *
+ * The component must be in
+ * cannonical form -- a VCALENDAR with one VEVENT, VTODO or VJOURNAL
+ * sub component
+ */
int icalgauge_compare(icalgauge* g, icalcomponent* comp);
-/* Clone the component, but only return the properties specified in
- the gauge */
+/** Clone the component, but only return the properties
+ * specified in the gauge */
icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp);
@@ -52,6 +66,5 @@ icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp);
/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalset.h
- CREATOR: eric 28 November 1999
-
+/**
+ @file icalset.h
+ @author eric 28 November 1999
@@ -60,9 +73,10 @@ icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp);
- icalfileset Store componetns in a single file
+ icalfileset Store components in a single file
icaldirset Store components in multiple files in a directory
+ icalbdbset Store components in a Berkeley DB File
icalheapset Store components on the heap
icalmysqlset Store components in a mysql database.
+**/
- $Id$
- $Locker$
+/*
@@ -99,9 +113,3 @@ icalcomponent* icalgauge_new_clone(icalgauge* g, icalcomponent* comp);
-#ifdef _WIN32
-#define mode_t int
-#endif
-
-
-
-typedef void icalset;
+typedef struct icalset_impl icalset;
@@ -110,14 +118,67 @@ typedef enum icalset_kind {
ICAL_DIR_SET,
- ICAL_HEAP_SET,
- ICAL_MYSQL_SET,
- ICAL_CAP_SET
+ ICAL_BDB_SET
} icalset_kind;
+typedef struct icalsetiter
+{
+ icalcompiter iter; /* icalcomponent_kind, pvl_elem iter */
+ icalgauge* gauge;
+ icalrecur_iterator* ritr; /*the last iterator*/
+ icalcomponent* last_component; /*the pending recurring component to be processed */
+ const char* tzid; /* the calendar's timezone id */
+} icalsetiter;
+
+struct icalset_impl {
+ icalset_kind kind;
+ int size;
+ char *dsn;
+ icalset* (*init)(icalset* set, const char *dsn, void *options);
+ void (*free)(icalset* set);
+ const char* (*path)(icalset* set);
+ void (*mark)(icalset* set);
+ icalerrorenum (*commit)(icalset* set);
+ icalerrorenum (*add_component)(icalset* set, icalcomponent* comp);
+ icalerrorenum (*remove_component)(icalset* set, icalcomponent* comp);
+ int (*count_components)(icalset* set,
+ icalcomponent_kind kind);
+ icalerrorenum (*select)(icalset* set, icalgauge* gauge);
+ void (*clear)(icalset* set);
+ icalcomponent* (*fetch)(icalset* set, const char* uid);
+ icalcomponent* (*fetch_match)(icalset* set, icalcomponent *comp);
+ int (*has_uid)(icalset* set, const char* uid);
+ icalerrorenum (*modify)(icalset* set, icalcomponent *old,
+ icalcomponent *newc);
+ icalcomponent* (*get_current_component)(icalset* set);
+ icalcomponent* (*get_first_component)(icalset* set);
+ icalcomponent* (*get_next_component)(icalset* set);
+ icalsetiter (*icalset_begin_component)(icalset* set,
+ icalcomponent_kind kind, icalgauge* gauge);
+ icalcomponent* (*icalsetiter_to_next)(icalset* set, icalsetiter* i);
+ icalcomponent* (*icalsetiter_to_prior)(icalset* set, icalsetiter* i);
+};
+
+/** @brief Register a new derived class */
+int icalset_register_class(icalset *set);
+
+
+/** @brief Generic icalset constructor
+ *
+ * @param kind The type of icalset to create
+ * @param dsn Data Source Name - usually a pathname or DB handle
+ * @param options Any implementation specific options
+ *
+ * @return A valid icalset reference or NULL if error.
+ *
+ * This creates any of the icalset types available.
+ */
+
+icalset* icalset_new(icalset_kind kind, const char* dsn, void* options);
-/* Create a specific derived type of set */
icalset* icalset_new_file(const char* path);
+icalset* icalset_new_file_reader(const char* path);
+icalset* icalset_new_file_writer(const char* path);
+
icalset* icalset_new_dir(const char* path);
-icalset* icalset_new_heap(void);
-icalset* icalset_new_mysql(const char* path);
-/*icalset* icalset_new_cap(icalcstp* cstp);*/
+icalset* icalset_new_file_reader(const char* path);
+icalset* icalset_new_file_writer(const char* path);
@@ -127,5 +188,7 @@ const char* icalset_path(icalset* set);
-/* Mark the cluster as changed, so it will be written to disk when it
- is freed. Commit writes to disk immediately*/
+/** Mark the cluster as changed, so it will be written to disk when it
+ is freed. **/
void icalset_mark(icalset* set);
+
+/** Write changes to disk immediately */
icalerrorenum icalset_commit(icalset* set);
@@ -138,9 +201,12 @@ int icalset_count_components(icalset* set,
-/* Restrict the component returned by icalset_first, _next to those
- that pass the gauge. _clear removes the gauge. */
-icalerrorenum icalset_select(icalset* set, icalcomponent* gauge);
+/** Restrict the component returned by icalset_first, _next to those
+ that pass the gauge. */
+icalerrorenum icalset_select(icalset* set, icalgauge* gauge);
+
+/** Clears the gauge defined by icalset_select() */
void icalset_clear_select(icalset* set);
-/* Get a component by uid */
+/** Get a component by uid */
icalcomponent* icalset_fetch(icalset* set, const char* uid);
+
int icalset_has_uid(icalset* set, const char* uid);
@@ -148,3 +214,3 @@ icalcomponent* icalset_fetch_match(icalset* set, icalcomponent *c);
-/* Modify components according to the MODIFY method of CAP. Works on
+/** Modify components according to the MODIFY method of CAP. Works on
the currently selected components. */
@@ -153,3 +219,3 @@ icalerrorenum icalset_modify(icalset* set, icalcomponent *oldc,
-/* Iterate through the components. If a guage has been defined, these
+/** Iterate through the components. If a guage has been defined, these
will skip over components that do not pass the gauge */
@@ -160,2 +226,17 @@ icalcomponent* icalset_get_next_component(icalset* set);
+/** External Iterator with gauge - for thread safety */
+extern icalsetiter icalsetiter_null;
+
+icalsetiter icalset_begin_component(icalset* set,
+ icalcomponent_kind kind, icalgauge* gauge);
+
+/** Default _next, _prior, _deref for subclasses that use single cluster */
+icalcomponent* icalsetiter_next(icalsetiter* i);
+icalcomponent* icalsetiter_prior(icalsetiter* i);
+icalcomponent* icalsetiter_deref(icalsetiter* i);
+
+/** for subclasses that use multiple clusters that require specialized cluster traversal */
+icalcomponent* icalsetiter_to_next(icalset* set, icalsetiter* i);
+icalcomponent* icalsetiter_to_prior(icalset* set, icalsetiter* i);
+
#endif /* !ICALSET_H */
@@ -166,2 +247,59 @@ icalcomponent* icalset_get_next_component(icalset* set);
/*======================================================================
+ FILE: icalcluster.h
+ CREATOR: eric 23 December 1999
+
+
+
+ (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of either:
+
+ The LGPL as published by the Free Software Foundation, version
+ 2.1, available at: http://www.fsf.org/copyleft/lesser.html
+
+ Or:
+
+ The Mozilla Public License Version 1.0. You may obtain a copy of
+ the License at http://www.mozilla.org/MPL/
+
+ The Original Code is eric. The Initial Developer of the Original
+ Code is Eric Busboom
+
+
+======================================================================*/
+
+#ifndef ICALCLUSTER_H
+#define ICALCLUSTER_H
+
+
+typedef struct icalcluster_impl icalcluster;
+
+icalcluster* icalcluster_new(const char *key, icalcomponent *data);
+icalcluster* icalcluster_new_clone(const icalcluster *cluster);
+
+void icalcluster_free(icalcluster *cluster);
+
+const char* icalcluster_key(icalcluster *cluster);
+int icalcluster_is_changed(icalcluster *cluster);
+void icalcluster_mark(icalcluster *cluster);
+void icalcluster_commit(icalcluster *cluster);
+
+icalcomponent* icalcluster_get_component(icalcluster* cluster);
+int icalcluster_count_components(icalcluster *cluster, icalcomponent_kind kind);
+icalerrorenum icalcluster_add_component(icalcluster* cluster,
+ icalcomponent* child);
+icalerrorenum icalcluster_remove_component(icalcluster* cluster,
+ icalcomponent* child);
+
+icalcomponent* icalcluster_get_current_component(icalcluster* cluster);
+icalcomponent* icalcluster_get_first_component(icalcluster* cluster);
+icalcomponent* icalcluster_get_next_component(icalcluster* cluster);
+
+#endif /* !ICALCLUSTER_H */
+
+
+
+/* -*- Mode: C -*- */
+/*======================================================================
FILE: icalfileset.h
@@ -170,4 +308,2 @@ icalcomponent* icalset_get_next_component(icalset* set);
- $Id$
- $Locker$
@@ -199,22 +335,23 @@ icalcomponent* icalset_get_next_component(icalset* set);
-extern int icalfileset_safe_saves;
+#ifdef WIN32
+#define mode_t int
+#endif
-typedef void icalfileset;
+extern int icalfileset_safe_saves;
+typedef struct icalfileset_impl icalfileset;
-/* icalfileset
- icalfilesetfile
- icalfilesetdir
-*/
+icalset* icalfileset_new(const char* path);
+icalset* icalfileset_new_reader(const char* path);
+icalset* icalfileset_new_writer(const char* path);
+icalset* icalfileset_init(icalset *set, const char *dsn, void* options);
-icalfileset* icalfileset_new(const char* path);
+icalfileset* icalfileset_new_from_cluster(const char* path, icalcluster *cluster);
-/* Like _new, but takes open() flags for opening the file */
-icalfileset* icalfileset_new_open(const char* path,
- int flags, mode_t mode);
+icalcluster* icalfileset_produce_icalcluster(const char *path);
-void icalfileset_free(icalfileset* cluster);
+void icalfileset_free(icalset* cluster);
-const char* icalfileset_path(icalfileset* cluster);
+const char* icalfileset_path(icalset* cluster);
@@ -222,41 +359,68 @@ const char* icalfileset_path(icalfileset* cluster);
is freed. Commit writes to disk immediately. */
-void icalfileset_mark(icalfileset* cluster);
-icalerrorenum icalfileset_commit(icalfileset* cluster);
+void icalfileset_mark(icalset* set);
+icalerrorenum icalfileset_commit(icalset* set);
-icalerrorenum icalfileset_add_component(icalfileset* cluster,
+icalerrorenum icalfileset_add_component(icalset* set,
icalcomponent* child);
-icalerrorenum icalfileset_remove_component(icalfileset* cluster,
+icalerrorenum icalfileset_remove_component(icalset* set,
icalcomponent* child);
-int icalfileset_count_components(icalfileset* cluster,
+int icalfileset_count_components(icalset* set,
icalcomponent_kind kind);
-/* Restrict the component returned by icalfileset_first, _next to those
- that pass the gauge. _clear removes the gauge */
-icalerrorenum icalfileset_select(icalfileset* store, icalgauge* gauge);
-void icalfileset_clear(icalfileset* store);
+/**
+ * Restrict the component returned by icalfileset_first, _next to those
+ * that pass the gauge. _clear removes the gauge
+ */
+icalerrorenum icalfileset_select(icalset* set, icalgauge* gauge);
-/* Get and search for a component by uid */
-icalcomponent* icalfileset_fetch(icalfileset* cluster, const char* uid);
-int icalfileset_has_uid(icalfileset* cluster, const char* uid);
-icalcomponent* icalfileset_fetch_match(icalfileset* set, icalcomponent *c);
+/** clear the gauge **/
+void icalfileset_clear(icalset* set);
+/** Get and search for a component by uid **/
+icalcomponent* icalfileset_fetch(icalset* set, const char* uid);
+int icalfileset_has_uid(icalset* set, const char* uid);
+icalcomponent* icalfileset_fetch_match(icalset* set, icalcomponent *c);
-/* Modify components according to the MODIFY method of CAP. Works on
- the currently selected components. */
-icalerrorenum icalfileset_modify(icalfileset* store, icalcomponent *oldcomp,
+
+/**
+ * Modify components according to the MODIFY method of CAP. Works on the
+ * currently selected components.
+ */
+icalerrorenum icalfileset_modify(icalset* set,
+ icalcomponent *oldcomp,
icalcomponent *newcomp);
-/* Iterate through components. If a guage has been defined, these
+/* Iterate through components. If a gauge has been defined, these
will skip over components that do not pass the gauge */
-icalcomponent* icalfileset_get_current_component (icalfileset* cluster);
-icalcomponent* icalfileset_get_first_component(icalfileset* cluster);
-icalcomponent* icalfileset_get_next_component(icalfileset* cluster);
-/* Return a reference to the internal component. You probably should
+icalcomponent* icalfileset_get_current_component (icalset* cluster);
+icalcomponent* icalfileset_get_first_component(icalset* cluster);
+icalcomponent* icalfileset_get_next_component(icalset* cluster);
+
+/* External iterator for thread safety */
+icalsetiter icalfileset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
+icalcomponent * icalfilesetiter_to_next(icalset* set, icalsetiter *iter);
+icalcomponent* icalfileset_form_a_matched_recurrence_component(icalsetiter* itr);
+
+/** Return a reference to the internal component. You probably should
not be using this. */
-icalcomponent* icalfileset_get_component(icalfileset* cluster);
+icalcomponent* icalfileset_get_component(icalset* cluster);
+
+/**
+ * @brief options for opening an icalfileset.
+ *
+ * These options should be passed to the icalset_new() function
+ */
+typedef struct icalfileset_options {
+ int flags; /**< flags for open() O_RDONLY, etc */
+ mode_t mode; /**< file mode */
+ int safe_saves; /**< to lock or not */
+ icalcluster *cluster; /**< use this cluster to initialize data */
+} icalfileset_options;
+
+extern icalfileset_options icalfileset_options_default;
@@ -272,4 +436,2 @@ icalcomponent* icalfileset_get_component(icalfileset* cluster);
- $Id$
- $Locker$
@@ -301,10 +463,14 @@ icalcomponent* icalfileset_get_component(icalfileset* cluster);
-typedef void icaldirset;
+typedef struct icaldirset_impl icaldirset;
+icalset* icaldirset_new(const char* path);
-icaldirset* icaldirset_new(const char* path);
+icalset* icaldirset_new_reader(const char* path);
+icalset* icaldirset_new_writer(const char* path);
-void icaldirset_free(icaldirset* store);
-const char* icaldirset_path(icaldirset* store);
+icalset* icaldirset_init(icalset* set, const char *dsn, void *options);
+void icaldirset_free(icalset* set);
+
+const char* icaldirset_path(icalset* set);
@@ -312,9 +478,9 @@ const char* icaldirset_path(icaldirset* store);
is freed. Commit writes to disk immediately*/
-void icaldirset_mark(icaldirset* store);
-icalerrorenum icaldirset_commit(icaldirset* store);
+void icaldirset_mark(icalset* set);
+icalerrorenum icaldirset_commit(icalset* set);
-icalerrorenum icaldirset_add_component(icaldirset* store, icalcomponent* comp);
-icalerrorenum icaldirset_remove_component(icaldirset* store, icalcomponent* comp);
+icalerrorenum icaldirset_add_component(icalset* store, icalcomponent* comp);
+icalerrorenum icaldirset_remove_component(icalset* store, icalcomponent* comp);
-int icaldirset_count_components(icaldirset* store,
+int icaldirset_count_components(icalset* store,
icalcomponent_kind kind);
@@ -323,9 +489,9 @@ int icaldirset_count_components(icaldirset* store,
that pass the gauge. _clear removes the gauge. */
-icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge);
-void icaldirset_clear(icaldirset* store);
+icalerrorenum icaldirset_select(icalset* store, icalgauge* gauge);
+void icaldirset_clear(icalset* store);
/* Get a component by uid */
-icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid);
-int icaldirset_has_uid(icaldirset* store, const char* uid);
-icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c);
+icalcomponent* icaldirset_fetch(icalset* store, const char* uid);
+int icaldirset_has_uid(icalset* store, const char* uid);
+icalcomponent* icaldirset_fetch_match(icalset* set, icalcomponent *c);
@@ -333,11 +499,20 @@ icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c);
the currently selected components. */
-icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *oldc,
+icalerrorenum icaldirset_modify(icalset* store, icalcomponent *oldc,
icalcomponent *newc);
-/* Iterate through the components. If a guage has been defined, these
+/* Iterate through the components. If a gauge has been defined, these
will skip over components that do not pass the gauge */
-icalcomponent* icaldirset_get_current_component(icaldirset* store);
-icalcomponent* icaldirset_get_first_component(icaldirset* store);
-icalcomponent* icaldirset_get_next_component(icaldirset* store);
+icalcomponent* icaldirset_get_current_component(icalset* store);
+icalcomponent* icaldirset_get_first_component(icalset* store);
+icalcomponent* icaldirset_get_next_component(icalset* store);
+
+/* External iterator for thread safety */
+icalsetiter icaldirset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge);
+icalcomponent* icaldirsetiter_to_next(icalset* set, icalsetiter* i);
+icalcomponent* icaldirsetiter_to_prior(icalset* set, icalsetiter* i);
+
+typedef struct icaldirset_options {
+ int flags; /**< flags corresponding to the open() system call O_RDWR, etc. */
+} icaldirset_options;
@@ -353,4 +528,2 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store);
- $Id$
- $Locker$
@@ -385,3 +558,3 @@ icalcomponent* icaldirset_get_next_component(icaldirset* store);
-typedef void icalcalendar;
+typedef struct icalcalendar_impl icalcalendar;
@@ -418,4 +591,2 @@ icalset* icalcalendar_get_freebusy(icalcalendar* calendar);
- $Id$
- $Locker$
@@ -441,35 +612,3 @@ icalset* icalcalendar_get_freebusy(icalcalendar* calendar);
-
-typedef enum icalclass {
- ICAL_NO_CLASS,
- ICAL_PUBLISH_NEW_CLASS,
- ICAL_PUBLISH_UPDATE_CLASS,
- ICAL_PUBLISH_FREEBUSY_CLASS,
- ICAL_REQUEST_NEW_CLASS,
- ICAL_REQUEST_UPDATE_CLASS,
- ICAL_REQUEST_RESCHEDULE_CLASS,
- ICAL_REQUEST_DELEGATE_CLASS,
- ICAL_REQUEST_NEW_ORGANIZER_CLASS,
- ICAL_REQUEST_FORWARD_CLASS,
- ICAL_REQUEST_STATUS_CLASS,
- ICAL_REQUEST_FREEBUSY_CLASS,
- ICAL_REPLY_ACCEPT_CLASS,
- ICAL_REPLY_DECLINE_CLASS,
- ICAL_REPLY_DELEGATE_CLASS,
- ICAL_REPLY_CRASHER_ACCEPT_CLASS,
- ICAL_REPLY_CRASHER_DECLINE_CLASS,
- ICAL_ADD_INSTANCE_CLASS,
- ICAL_CANCEL_EVENT_CLASS,
- ICAL_CANCEL_INSTANCE_CLASS,
- ICAL_CANCEL_ALL_CLASS,
- ICAL_REFRESH_CLASS,
- ICAL_COUNTER_CLASS,
- ICAL_DECLINECOUNTER_CLASS,
- ICAL_MALFORMED_CLASS,
- ICAL_OBSOLETE_CLASS, /* 21 */
- ICAL_MISSEQUENCED_CLASS, /* 22 */
- ICAL_UNKNOWN_CLASS /* 23 */
-} ical_class;
-
-ical_class icalclassify(icalcomponent* c,icalcomponent* match,
+icalproperty_xlicclass icalclassify(icalcomponent* c,icalcomponent* match,
const char* user);
@@ -478,3 +617,3 @@ icalcomponent* icalclassify_find_overlaps(icalset* set, icalcomponent* comp);
-char* icalclassify_class_to_string(ical_class iclass);
+char* icalclassify_class_to_string(icalproperty_xlicclass c);
@@ -493,4 +632,2 @@ char* icalclassify_class_to_string(ical_class iclass);
- $Id$
- $Locker$
@@ -515,5 +652,13 @@ char* icalclassify_class_to_string(ical_class iclass);
-typedef void icalspanlist;
+/** @file icalspanlist.h
+ * @brief Code that supports collections of free/busy spans of time
+ */
+
+typedef struct icalspanlist_impl icalspanlist;
+
+
+/** @brief Constructor
+ * Make a free list from a set of component. Start and end should be in UTC
+ */
-/* Make a free list from a set of component. Start and end should be in UTC */
icalspanlist* icalspanlist_new(icalset *set,
@@ -522,4 +667,7 @@ icalspanlist* icalspanlist_new(icalset *set,
+/** @brief Destructor
+ */
void icalspanlist_free(icalspanlist* spl);
+/* Unimplemented functions */
icalcomponent* icalspanlist_make_free_list(icalspanlist* sl);
@@ -527,5 +675,6 @@ icalcomponent* icalspanlist_make_busy_list(icalspanlist* sl);
-/* Get first free or busy time after time t. all times are in UTC */
+/** Get first next free time after time t. all times are in UTC. */
struct icalperiodtype icalspanlist_next_free_time(icalspanlist* sl,
struct icaltimetype t);
+/** Get first next busy time after time t. all times are in UTC. */
struct icalperiodtype icalspanlist_next_busy_time(icalspanlist* sl,
@@ -535,2 +684,13 @@ void icalspanlist_dump(icalspanlist* s);
+/** @brief Return a valid VFREEBUSY component for this span */
+icalcomponent *icalspanlist_as_vfreebusy(icalspanlist* s_in,
+ const char* organizer,
+ const char* attendee);
+
+/** @brief Return an integer matrix of total events per delta_t timespan */
+int *icalspanlist_as_freebusy_matrix(icalspanlist* span, int delta_t);
+
+/** @brief Construct an icalspanlist from a VFREEBUSY component */
+icalspanlist *icalspanlist_from_vfreebusy(icalcomponent* c);
+
#endif
@@ -545,4 +705,2 @@ void icalspanlist_dump(icalspanlist* s);
- $Id$
- $Locker$
@@ -609,277 +767,4 @@ icalcomponent* icalmessage_new_error_reply(icalcomponent* c,
#endif /* ICALMESSAGE_H*/
-/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalcstp.h
- CREATOR: eric 20 April 1999
-
- $Id$
-
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The original code is icalcstp.h
-
-======================================================================*/
-
-
-#ifndef ICALCSTP_H
-#define ICALCSTP_H
-
-
-
-/* Connection state, from the state machine in RFC2445 */
-enum cstps_state {
- NO_STATE,
- CONNECTED,
- AUTHENTICATED,
- IDENTIFIED,
- DISCONNECTED,
- RECEIVE
-};
-
-/* CSTP Commands that a client can issue to a server */
-typedef enum icalcstp_command {
- ICAL_ABORT_COMMAND,
- ICAL_AUTHENTICATE_COMMAND,
- ICAL_CAPABILITY_COMMAND,
- ICAL_CONTINUE_COMMAND,
- ICAL_CALIDEXPAND_COMMAND,
- ICAL_IDENTIFY_COMMAND,
- ICAL_DISCONNECT_COMMAND,
- ICAL_SENDDATA_COMMAND,
- ICAL_STARTTLS_COMMAND,
- ICAL_UPNEXPAND_COMMAND,
- ICAL_COMPLETE_COMMAND,
- ICAL_UNKNOWN_COMMAND
-} icalcstp_command;
-
-
-
-/* A statement is a combination of command or response code and a
- component that the server and client exchage with each other. */
-struct icalcstp_statement {
- icalcstp_command command;
- char* str_data; /* If non-NUll use as arguments to command */
- int int_data; /* If non-NULL use as arguments to command */
-
- icalrequeststatus code;
-
- icalcomponent* data;
+#ifdef __cplusplus
};
-
-const char* icalcstp_command_to_string(icalcstp_command command);
-icalcstp_command icalcstp_string_to_command(const char* str);
-
-#endif /* !ICALCSTP_H */
-
-
-
-/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalcstpclient.h
- CREATOR: eric 4 Feb 01
-
- $Id$
-
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The original code is icalcstp.h
-
-======================================================================*/
-
-
-#ifndef ICALCSTPC_H
-#define ICALCSTPC_H
-
-
-/********************** Client (Sender) Interfaces **************************/
-
-/* How to use:
-
- 1) Construct a new icalcstpc
- 2) Issue a command by calling one of the command routines.
- 3) Repeat until both call icalcstpc_next_output and
- icalcstpc_next_input return 0:
- 3a) Call icalcstpc_next_output. Send string to server.
- 3b) Get string from server, & give to icalcstp_next_input()
- 4) Iterate with icalcstpc_first_response & icalcstp_next_response to
- get the servers responses
- 5) Repeat at #2
-*/
-
-
-typedef void icalcstpc;
-
-/* Response code sent by the server. */
-typedef struct icalcstpc_response {
- icalrequeststatus code;
- char *arg; /* These strings are owned by libical */
- char *debug_text;
- char *more_text;
- void* result;
-} icalcstpc_response;
-
-
-icalcstpc* icalcstpc_new();
-
-void icalcstpc_free(icalcstpc* cstpc);
-
-int icalcstpc_set_timeout(icalcstpc* cstp, int sec);
-
-
-/* Get the next string to send to the server */
-char* icalcstpc_next_output(icalcstpc* cstp, char* line);
-
-/* process the next string from the server */
-int icalcstpc_next_input(icalcstpc* cstp, char * line);
-
-/* After icalcstpc_next_input returns a 0, there are responses
- ready. use these to get them */
-icalcstpc_response icalcstpc_first_response(icalcstpc* cstp);
-icalcstpc_response icalcstpc_next_response(icalcstpc* cstp);
-
-/* Issue a command */
-icalerrorenum icalcstpc_abort(icalcstpc* cstp);
-icalerrorenum icalcstpc_authenticate(icalcstpc* cstp, char* mechanism,
- char* init_data, char* f(char*) );
-icalerrorenum icalcstpc_capability(icalcstpc* cstp);
-icalerrorenum icalcstpc_calidexpand(icalcstpc* cstp,char* calid);
-icalerrorenum icalcstpc_continue(icalcstpc* cstp, unsigned int time);
-icalerrorenum icalcstpc_disconnect(icalcstpc* cstp);
-icalerrorenum icalcstpc_identify(icalcstpc* cstp, char* id);
-icalerrorenum icalcstpc_starttls(icalcstpc* cstp, char* command,
- char* init_data, char* f(char*));
-icalerrorenum icalcstpc_senddata(icalcstpc* cstp, unsigned int time,
- icalcomponent *comp);
-icalerrorenum icalcstpc_upnexpand(icalcstpc* cstp,char* calid);
-icalerrorenum icalcstpc_sendata(icalcstpc* cstp, unsigned int time,
- icalcomponent *comp);
-
-
-#endif /* !ICALCSTPC_H */
-
-
-
-/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalcstpserver.h
- CREATOR: eric 13 Feb 01
-
- $Id$
-
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The original code is icalcstp.h
-
-======================================================================*/
-
-
-#ifndef ICALCSTPS_H
-#define ICALCSTPS_H
-
-
-
-/********************** Server (Reciever) Interfaces *************************/
-
-/* On the server side, the caller will recieve data from the incoming
- socket and pass it to icalcstps_next_input. The caller then takes
- the return from icalcstps_next_outpu and sends it out through the
- socket. This gives the caller a point of control. If the cstp code
- connected to the socket itself, it would be hard for the caller to
- do anything else after the cstp code was started.
-
- All of the server and client command routines will generate
- response codes. On the server side, these responses will be turned
- into text and sent to the client. On the client side, the reponse
- is the one sent from the server.
-
- Since each command can return multiple responses, the responses are
- stored in the icalcstps object and are accesses by
- icalcstps_first_response() and icalcstps_next_response()
-
- How to use:
-
- 1) Construct a new icalcstps, bound to your code via stubs
- 2) Repeat forever:
- 2a) Get string from client & give to icalcstps_next_input()
- 2b) Repeat until icalcstp_next_output returns 0:
- 2b1) Call icalcstps_next_output.
- 2b2) Send string to client.
-*/
-
-
-
-typedef void icalcstps;
-
-/* Pointers to the rountines that
- icalcstps_process_incoming will call when it recognizes a CSTP
- command in the data. BTW, the CONTINUE command is named 'cont'
- because 'continue' is a C keyword */
-
-struct icalcstps_commandfp {
- icalerrorenum (*abort)(icalcstps* cstp);
- icalerrorenum (*authenticate)(icalcstps* cstp, char* mechanism,
- char* data);
- icalerrorenum (*calidexpand)(icalcstps* cstp, char* calid);
- icalerrorenum (*capability)(icalcstps* cstp);
- icalerrorenum (*cont)(icalcstps* cstp, unsigned int time);
- icalerrorenum (*identify)(icalcstps* cstp, char* id);
- icalerrorenum (*disconnect)(icalcstps* cstp);
- icalerrorenum (*sendata)(icalcstps* cstp, unsigned int time,
- icalcomponent *comp);
- icalerrorenum (*starttls)(icalcstps* cstp, char* command,
- char* data);
- icalerrorenum (*upnexpand)(icalcstps* cstp, char* upn);
- icalerrorenum (*unknown)(icalcstps* cstp, char* command, char* data);
-};
-
-
-
-icalcstps* icalcstps_new(struct icalcstps_commandfp stubs);
-
-void icalcstps_free(icalcstps* cstp);
-
-int icalcstps_set_timeout(icalcstps* cstp, int sec);
-
-/* Get the next string to send to the client */
-char* icalcstps_next_output(icalcstps* cstp);
-
-/* process the next string from the client */
-int icalcstps_next_input(icalcstps* cstp);
-
-#endif /* ICALCSTPS */
+#endif
diff --git a/libical/src/libicalss/icalsslexer.c b/libical/src/libicalss/icalsslexer.c
index e10bcd3..28d1b66 100644
--- a/libical/src/libicalss/icalsslexer.c
+++ b/libical/src/libicalss/icalsslexer.c
@@ -1 +1,10 @@
+#define YY_REENTRANT 1
+#define YY_TEXT_IS_ARRAY
+#define YY_REENTRANT_BISON_PURE 1
+#ifndef YY_REENTRANT
+#define yytext sstext
+#define yyleng ssleng
+#define yyin ssin
+#define yyout ssout
+#endif
#define yy_create_buffer ss_create_buffer
@@ -10,16 +19,29 @@
#define yy_switch_to_buffer ss_switch_to_buffer
-#define yyin ssin
-#define yyleng ssleng
#define yylex sslex
-#define yyout ssout
#define yyrestart ssrestart
-#define yytext sstext
+#define yylex_init sslex_init
+#define yylex_destroy sslex_destroy
+#define yyget_extra ssget_extra
+#define yyset_extra ssset_extra
+#define yyget_in ssget_in
+#define yyset_in ssset_in
+#define yyget_out ssget_out
+#define yyset_out ssset_out
+#define yyget_leng ssget_leng
+#define yyget_text ssget_text
+#define yyget_lineno ssget_lineno
+#define yyset_lineno ssset_lineno
+#ifdef YY_REENTRANT_BISON_PURE
+#define yyget_lval ssget_lval
+#define yyset_lval ssset_lval
+#ifdef YYLTYPE
+#define yyget_lloc ssget_lloc
+#define yyset_lloc ssset_lloc
+#endif
+#endif
#define yywrap sswrap
+/* -*-C-*- */
/* A lexical scanner generated by flex */
-/* Scanner skeleton version:
- * $Header$
- */
-
#define FLEX_SCANNER
@@ -28,20 +50,10 @@
+/* %- */
+/* begin standard C headers. */
#include <stdio.h>
-// Eugen C. <eug@thekompany.com>
-#include <defines.h>
-#ifndef _QTWIN_
-#include <unistd.h>
-#else
-#include <io.h>
-#endif
-// Eugen C. <eug@thekompany.com>
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
+#include <errno.h>
+#include <stdlib.h>
+/* end standard C headers. */
+/* %+ */
+/* %* */
@@ -49,3 +61,4 @@
-#include <stdlib.h>
+/* %+ */
+/* %* */
@@ -67,11 +80,2 @@
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
#ifdef YY_USE_CONST
@@ -99,2 +103,51 @@
+
+#ifdef YY_REENTRANT
+
+/* An opaque pointer. */
+#ifndef YY_TYPEDEF_YY_SCANNER_T
+#define YY_TYPEDEF_YY_SCANNER_T
+typedef void* yyscan_t;
+#endif
+
+/* For use wherever a Global is accessed or assigned. */
+#define YY_G(var) (((struct yy_globals_t*)yy_globals)->var)
+
+/* For use in function prototypes to append the additional argument. */
+#ifdef YY_USE_PROTOS
+#define YY_LAST_ARG , yyscan_t yy_globals
+#define YY_ONLY_ARG yyscan_t yy_globals
+#else
+#define YY_LAST_ARG , yy_globals
+#define YY_ONLY_ARG yy_globals
+#define YY_DECL_LAST_ARG yyscan_t yy_globals;
+#endif
+
+/* For use in function calls to pass the additional argument. */
+#define YY_CALL_LAST_ARG , yy_globals
+#define YY_CALL_ONLY_ARG yy_globals
+
+/* For convenience, these vars (plus the bison vars far below)
+ are macros in the reentrant scanner. */
+#define yyin YY_G(yyin_r)
+#define yyout YY_G(yyout_r)
+#define yyextra YY_G(yyextra_r)
+#define yyleng YY_G(yyleng_r)
+#define yytext YY_G(yytext_r)
+#define yylineno YY_G(yylineno_r)
+
+int yylex_init YY_PROTO((yyscan_t* scanner));
+int yylex_destroy YY_PROTO((yyscan_t scanner));
+
+#else /* not YY_REENTRANT */
+
+ /* Define these macros to be no-ops. */
+#define YY_G(var) (var)
+#define YY_LAST_ARG
+#define YY_ONLY_ARG void
+#define YY_CALL_LAST_ARG
+#define YY_CALL_ONLY_ARG
+#define YY_DECL_LAST_ARG
+#endif
+
/* Enter a start condition. This macro really ought to take a parameter,
@@ -103,3 +156,3 @@
*/
-#define BEGIN yy_start = 1 + 2 *
+#define BEGIN YY_G(yy_start) = 1 + 2 *
@@ -109,3 +162,3 @@
*/
-#define YY_START ((yy_start - 1) / 2)
+#define YY_START ((YY_G(yy_start) - 1) / 2)
#define YYSTATE YY_START
@@ -116,3 +169,3 @@
/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
+#define YY_NEW_FILE yyrestart( yyin YY_CALL_LAST_ARG )
@@ -123,6 +176,17 @@
+
+#ifndef YY_TYPEDEF_YY_BUFFER_STATE
+#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
+#endif
+
+#ifndef YY_REENTRANT
+extern size_t yyleng;
+#endif
-extern int yyleng;
+/* %- */
+#ifndef YY_REENTRANT
extern FILE *yyin, *yyout;
+#endif
+/* %* */
@@ -152,5 +216,5 @@ extern FILE *yyin, *yyout;
/* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
+ *yy_cp = YY_G(yy_hold_char); \
YY_RESTORE_YY_MORE_OFFSET \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
+ YY_G(yy_c_buf_p) = yy_cp = yy_bp + n - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
@@ -159,3 +223,3 @@ extern FILE *yyin, *yyout;
-#define unput(c) yyunput( c, yytext_ptr )
+#define unput(c) yyunput( c, YY_G(yytext_ptr) YY_CALL_LAST_ARG )
@@ -165,8 +229,16 @@ extern FILE *yyin, *yyout;
*/
-typedef unsigned int yy_size_t;
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef unsigned int yy_size_t;
+#endif
+#ifndef YY_STRUCT_YY_BUFFER_STATE
+#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
+/* %- */
FILE *yy_input_file;
+/* %+ */
+/* %* */
@@ -224,4 +296,13 @@ struct yy_buffer_state
};
+#endif /* !YY_STRUCT_YY_BUFFER_STATE */
+/* %- Standard (non-C++) definition */
+/* %c */
+#ifndef ssIN_HEADER
+#ifndef YY_REENTRANT
static YY_BUFFER_STATE yy_current_buffer = 0;
+#endif
+/* %e */
+#endif /* !ssIN_HEADER */
+/* %* */
@@ -234,2 +315,7 @@ static YY_BUFFER_STATE yy_current_buffer = 0;
+/* %- Standard (non-C++) definition */
+
+#ifndef YY_REENTRANT
+/* %c */
+#ifndef ssIN_HEADER
/* yy_hold_char holds the character lost when yytext is formed. */
@@ -240,3 +326,3 @@ static int yy_n_chars; /* number of characters read into yy_ch_buf */
-int yyleng;
+size_t yyleng;
@@ -251,20 +337,31 @@ static int yy_start = 0; /* start state number */
static int yy_did_buffer_switch_on_eof;
+/* %e */
+#endif /* !ssIN_HEADER */
+#endif /* end !YY_REENTRANT */
+
+void yyrestart YY_PROTO(( FILE *input_file YY_LAST_ARG ));
+
+
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer YY_LAST_ARG ));
+void yy_load_buffer_state YY_PROTO(( YY_ONLY_ARG ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size YY_LAST_ARG ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b YY_LAST_ARG ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file YY_LAST_ARG ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b YY_LAST_ARG ));
-void yyrestart YY_PROTO(( FILE *input_file ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG)
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size YY_LAST_ARG ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str YY_LAST_ARG ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len YY_LAST_ARG ));
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
+/* %* */
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
+/* %c */
+#ifndef ssIN_HEADER
+static void *yy_flex_alloc YY_PROTO(( yy_size_t YY_LAST_ARG ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t YY_LAST_ARG ));
+static void yy_flex_free YY_PROTO(( void * YY_LAST_ARG ));
+/* %e */
+#endif /* !ssIN_HEADER */
@@ -274,5 +371,6 @@ static void yy_flex_free YY_PROTO(( void * ));
{ \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
+ if ( ! YY_G(yy_current_buffer) ) \
+ YY_G(yy_current_buffer) = \
+ yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \
+ YY_G(yy_current_buffer)->yy_is_interactive = is_interactive; \
}
@@ -281,19 +379,34 @@ static void yy_flex_free YY_PROTO(( void * ));
{ \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_at_bol = at_bol; \
+ if ( ! YY_G(yy_current_buffer) ) \
+ YY_G(yy_current_buffer) = \
+ yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG); \
+ YY_G(yy_current_buffer)->yy_at_bol = at_bol; \
}
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
+#define YY_AT_BOL() (YY_G(yy_current_buffer)->yy_at_bol)
+/* %% [1.0] yytext/yyin/yyout/yy_state_type/yylineno etc. def's & init go here */
+/* Begin user sect3 */
+#ifndef ssIN_HEADER
typedef unsigned char YY_CHAR;
+#endif /* !ssIN_HEADER */
+#ifndef ssIN_HEADER
+#ifndef YY_REENTRANT
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
+#endif
+#endif /* !ssIN_HEADER */
+#ifndef ssIN_HEADER
typedef int yy_state_type;
-extern char yytext[];
-
-
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
+#endif /* !ssIN_HEADER */
+
+/* %- Standard (non-C++) definition */
+/* %c */
+#ifndef ssIN_HEADER
+static yy_state_type yy_get_previous_state YY_PROTO(( YY_ONLY_ARG ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state YY_LAST_ARG));
+static int yy_get_next_buffer YY_PROTO(( YY_ONLY_ARG ));
static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
+/* %e */
+#endif /* !ssIN_HEADER */
+/* %* */
@@ -303,20 +416,28 @@ static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yy_hold_char = *yy_cp; \
+ YY_G(yytext_ptr) = yy_bp; \
+/* %% [2.0] code to fiddle yytext and yyleng for yymore() goes here \ */\
+ yyleng = (size_t) (yy_cp - yy_bp); \
+ YY_G(yy_hold_char) = *yy_cp; \
*yy_cp = '\0'; \
+/* %% [3.0] code to copy yytext_ptr to yytext[] goes here, if %array \ */\
if ( yyleng >= YYLMAX ) \
YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
- yy_flex_strncpy( yytext, yytext_ptr, yyleng + 1 ); \
- yy_c_buf_p = yy_cp;
+ yy_flex_strncpy( yytext, YY_G(yytext_ptr), yyleng + 1 YY_CALL_LAST_ARG); \
+ YY_G(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 19
-#define YY_END_OF_BUFFER 20
-static yyconst short int yy_accept[47] =
+/* %* */
+
+/* %c */
+#ifndef ssIN_HEADER
+/* %% [4.0] data tables for the DFA and the user's section 1 definitions go here */
+#define YY_NUM_RULES 23
+#define YY_END_OF_BUFFER 24
+static yyconst short int yy_accept[56] =
{ 0,
- 0, 0, 0, 0, 0, 0, 20, 18, 14, 14,
- 18, 13, 17, 4, 15, 7, 5, 8, 17, 17,
- 17, 17, 17, 14, 6, 0, 17, 9, 10, 17,
- 17, 12, 17, 17, 16, 11, 17, 17, 17, 2,
- 17, 17, 17, 3, 1, 0
+ 0, 0, 0, 0, 0, 0, 24, 22, 18, 18,
+ 22, 17, 21, 4, 19, 8, 5, 9, 21, 21,
+ 21, 21, 21, 21, 21, 18, 7, 0, 21, 10,
+ 6, 11, 21, 21, 14, 21, 21, 13, 21, 21,
+ 20, 12, 21, 15, 21, 21, 21, 2, 16, 21,
+ 21, 21, 3, 1, 0
} ;
@@ -328,13 +449,13 @@ static yyconst int yy_ec[256] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 4, 1, 1, 1, 1, 1, 5, 1,
- 1, 6, 1, 7, 6, 6, 1, 6, 6, 6,
- 6, 6, 6, 6, 6, 6, 6, 1, 8, 9,
- 10, 11, 1, 1, 12, 6, 13, 14, 15, 16,
- 6, 17, 6, 6, 6, 18, 19, 20, 21, 6,
- 6, 22, 23, 24, 6, 6, 25, 6, 6, 6,
- 1, 1, 1, 1, 1, 1, 12, 6, 13, 14,
-
- 15, 16, 6, 17, 6, 6, 6, 18, 19, 20,
- 21, 6, 6, 22, 23, 24, 6, 6, 25, 6,
- 6, 6, 1, 1, 1, 1, 1, 1, 1, 1,
+ 1, 4, 5, 1, 1, 1, 1, 1, 6, 1,
+ 1, 7, 1, 8, 7, 7, 1, 7, 7, 7,
+ 7, 7, 7, 7, 7, 7, 7, 9, 10, 11,
+ 12, 13, 1, 7, 14, 7, 15, 16, 17, 18,
+ 7, 19, 20, 7, 7, 21, 22, 23, 24, 7,
+ 7, 25, 26, 27, 28, 7, 29, 7, 7, 7,
+ 1, 1, 1, 1, 1, 1, 14, 7, 15, 16,
+
+ 17, 18, 7, 19, 20, 7, 7, 21, 22, 23,
+ 24, 7, 7, 25, 26, 27, 28, 7, 29, 7,
+ 7, 7, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -355,40 +476,45 @@ static yyconst int yy_ec[256] =
-static yyconst int yy_meta[26] =
+static yyconst int yy_meta[30] =
{ 0,
- 1, 1, 1, 1, 1, 2, 1, 1, 1, 1,
- 1, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2
+ 1, 1, 1, 2, 1, 1, 3, 1, 2, 1,
+ 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3
} ;
-static yyconst short int yy_base[49] =
+static yyconst short int yy_base[58] =
{ 0,
- 0, 0, 0, 0, 0, 0, 53, 54, 24, 26,
- 42, 0, 0, 54, 54, 41, 54, 40, 29, 26,
- 25, 31, 28, 28, 54, 39, 0, 54, 54, 29,
- 21, 0, 23, 25, 54, 0, 20, 23, 15, 0,
- 23, 20, 10, 0, 0, 54, 31, 30
+ 0, 0, 0, 0, 0, 0, 68, 69, 28, 31,
+ 55, 0, 0, 69, 69, 54, 53, 52, 40, 37,
+ 35, 12, 35, 42, 39, 35, 69, 51, 0, 69,
+ 69, 69, 40, 31, 0, 27, 32, 0, 31, 34,
+ 69, 0, 28, 0, 28, 31, 22, 0, 0, 31,
+ 28, 17, 0, 0, 69, 39, 40
} ;
-static yyconst short int yy_def[49] =
+static yyconst short int yy_def[58] =
{ 0,
- 46, 1, 1, 1, 1, 1, 46, 46, 46, 46,
- 46, 47, 48, 46, 46, 46, 46, 46, 48, 48,
- 48, 48, 48, 46, 46, 47, 48, 46, 46, 48,
- 48, 48, 48, 48, 46, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 0, 46, 46
+ 55, 1, 1, 1, 1, 1, 55, 55, 55, 55,
+ 55, 56, 57, 55, 55, 55, 55, 55, 57, 57,
+ 57, 57, 57, 57, 57, 55, 55, 56, 57, 55,
+ 55, 55, 57, 57, 57, 57, 57, 57, 57, 57,
+ 55, 57, 57, 57, 57, 57, 57, 57, 57, 57,
+ 57, 57, 57, 57, 0, 55, 55
} ;
-static yyconst short int yy_nxt[80] =
+static yyconst short int yy_nxt[99] =
{ 0,
- 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 13, 13, 13, 20, 13, 13, 13, 13,
- 21, 13, 22, 13, 23, 24, 24, 24, 24, 24,
- 24, 27, 26, 45, 44, 43, 42, 41, 40, 39,
- 38, 37, 36, 35, 34, 33, 32, 31, 30, 29,
- 28, 25, 46, 7, 46, 46, 46, 46, 46, 46,
- 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
- 46, 46, 46, 46, 46, 46, 46, 46, 46
+ 8, 9, 10, 9, 11, 12, 13, 14, 8, 15,
+ 16, 17, 18, 19, 13, 13, 13, 20, 13, 21,
+ 13, 13, 22, 23, 13, 24, 13, 13, 25, 26,
+ 26, 26, 26, 26, 26, 36, 26, 26, 26, 37,
+ 28, 28, 29, 54, 53, 52, 51, 50, 49, 48,
+ 47, 46, 45, 44, 43, 42, 41, 40, 39, 38,
+ 35, 34, 33, 32, 31, 30, 27, 55, 7, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55
+
} ;
-static yyconst short int yy_chk[80] =
+static yyconst short int yy_chk[99] =
{ 0,
@@ -396,12 +522,12 @@ static yyconst short int yy_chk[80] =
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 9, 9, 10, 10, 24,
- 24, 48, 47, 43, 42, 41, 39, 38, 37, 34,
- 33, 31, 30, 26, 23, 22, 21, 20, 19, 18,
- 16, 11, 7, 46, 46, 46, 46, 46, 46, 46,
- 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
- 46, 46, 46, 46, 46, 46, 46, 46, 46
- } ;
+ 1, 1, 1, 1, 1, 1, 1, 1, 1, 9,
+ 9, 9, 10, 10, 10, 22, 26, 26, 26, 22,
+ 56, 56, 57, 52, 51, 50, 47, 46, 45, 43,
+ 40, 39, 37, 36, 34, 33, 28, 25, 24, 23,
+ 21, 20, 19, 18, 17, 16, 11, 7, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
+ 55, 55, 55, 55, 55, 55, 55, 55
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
+ } ;
@@ -418,4 +544,6 @@ static char *yy_last_accepting_cpos;
+#ifndef YY_REENTRANT
char yytext[YYLMAX];
char *yytext_ptr;
+#endif
#line 1 "icalsslexer.l"
@@ -457,7 +585,4 @@ char *yytext_ptr;
-int icalparser_flex_input(char* buf, int max_size);
-void icalparser_clear_flex_input();
-
-#undef YY_INPUT
-#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
+#undef YYPURE
+#define YYPURE
@@ -466,3 +591,2 @@ void icalparser_clear_flex_input();
-
#define sql 1
@@ -470,3 +594,146 @@ void icalparser_clear_flex_input();
-#line 465 "icalsslexer.c"
+#line 596 "lex.ss.c"
+/* %e */
+#endif /* !ssIN_HEADER */
+
+/* Special case for "unistd.h", since it is non-ANSI. We include it way
+ * down here because we want the user's section 1 to have been scanned first.
+ * The user has a chance to override it with an option.
+ */
+#ifndef YY_NO_UNISTD_H
+/* %- */
+#include <unistd.h>
+/* %+ */
+/* %* */
+#endif /* !YY_NO_UNISTD_H */
+
+
+#ifndef YY_EXTRA_TYPE
+#define YY_EXTRA_TYPE void *
+#endif
+
+/* %- Reentrant structure and macros (non-C++). */
+#ifdef YY_REENTRANT
+
+/* %c */
+#ifndef ssIN_HEADER
+struct yy_globals_t
+ {
+
+ /* User-defined. Not touched by flex. */
+ YY_EXTRA_TYPE yyextra_r;
+
+ /* The rest are the same as the globals declared in the non-reentrant scanner. */
+ FILE *yyin_r, *yyout_r;
+ YY_BUFFER_STATE yy_current_buffer;
+ char yy_hold_char;
+ int yy_n_chars;
+ int yyleng_r;
+ char *yy_c_buf_p;
+ int yy_init;
+ int yy_start;
+ int yy_did_buffer_switch_on_eof;
+ int yy_start_stack_ptr;
+ int yy_start_stack_depth;
+ int *yy_start_stack;
+ yy_state_type yy_last_accepting_state;
+ char* yy_last_accepting_cpos;
+
+ int yylineno_r;
+
+#ifdef YY_TEXT_IS_ARRAY
+ char yytext_r[YYLMAX];
+ char *yytext_ptr;
+ int yy_more_offset;
+ int yy_prev_more_offset;
+#else
+ char *yytext_r;
+ int yy_more_flag;
+ int yy_more_len;
+#endif
+
+#ifdef YY_REENTRANT_BISON_PURE
+ YYSTYPE * yylval_r;
+#ifdef YYLTYPE
+ YYLTYPE * yylloc_r;
+#endif
+#endif
+
+ };
+/* %e */
+#endif /* !ssIN_HEADER */
+
+/* %c */
+#ifndef ssIN_HEADER
+static int yy_init_globals YY_PROTO(( yyscan_t ));
+/* %e */
+#endif /* !ssIN_HEADER */
+
+/* This must go here because YYSTYPE and YYLSTYPE are included
+ * from bison output in section 1.*/
+#ifdef YY_REENTRANT_BISON_PURE
+# define yylval YY_G(yylval_r)
+# ifdef YYLTYPE
+# define yylloc YY_G(yylloc_r)
+# endif
+#endif /* YY_REENTRANT_BISON_PURE */
+
+#endif /* end if YY_REENTRANT */
+
+/* Accessor methods to globals.
+ These are made visible to non-reentrant scanners for convenience. */
+#ifndef YY_NO_GET_EXTRA
+YY_EXTRA_TYPE yyget_extra YY_PROTO(( YY_ONLY_ARG ));
+#endif
+
+#ifndef YY_NO_SET_EXTRA
+void yyset_extra YY_PROTO(( YY_EXTRA_TYPE user_defined YY_LAST_ARG ));
+#endif
+
+#ifndef YY_NO_GET_IN
+FILE *yyget_in YY_PROTO(( YY_ONLY_ARG ));
+#endif
+
+#ifndef YY_NO_SET_IN
+void yyset_in YY_PROTO(( FILE * in_str YY_LAST_ARG ));
+#endif
+
+#ifndef YY_NO_GET_OUT
+FILE *yyget_out YY_PROTO(( YY_ONLY_ARG ));
+#endif
+
+#ifndef YY_NO_SET_OUT
+void yyset_out YY_PROTO(( FILE * out_str YY_LAST_ARG ));
+#endif
+
+#ifndef YY_NO_GET_LENG
+int yyget_leng YY_PROTO(( YY_ONLY_ARG ));
+#endif
+
+#ifndef YY_NO_GET_TEXT
+char *yyget_text YY_PROTO(( YY_ONLY_ARG ));
+#endif
+
+#ifndef YY_NO_GET_LINENO
+int yyget_lineno YY_PROTO(( YY_ONLY_ARG ));
+#endif
+
+#ifndef YY_NO_SET_LINENO
+void yyset_lineno YY_PROTO(( int line_number YY_LAST_ARG ));
+#endif
+
+#ifdef YY_REENTRANT_BISON_PURE
+#ifndef YY_NO_GET_LVAL
+YYSTYPE * yyget_lval YY_PROTO(( YY_ONLY_ARG ));
+#endif
+void yyset_lval YY_PROTO(( YYSTYPE * yylvalp YY_LAST_ARG ));
+#ifdef YYLTYPE
+#ifndef YY_NO_GET_LLOC
+ YYLTYPE *yyget_lloc YY_PROTO(( YY_ONLY_ARG ));
+#endif
+#ifndef YY_NO_SET_LLOC
+ void yyset_lloc YY_PROTO(( YYLTYPE * yyllocp YY_LAST_ARG ));
+#endif
+#endif /* YYLTYPE */
+#endif /* YY_REENTRANT_BISON_PURE */
@@ -478,5 +745,5 @@ void icalparser_clear_flex_input();
#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
+extern "C" int yywrap YY_PROTO(( YY_ONLY_ARG ));
#else
-extern int yywrap YY_PROTO(( void ));
+extern int yywrap YY_PROTO(( YY_ONLY_ARG ));
#endif
@@ -484,8 +751,14 @@ extern int yywrap YY_PROTO(( void ));
+/* %- */
+/* %c */
+#ifndef ssIN_HEADER
#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+static void yyunput YY_PROTO(( int c, char *buf_ptr YY_LAST_ARG));
#endif
+/* %e */
+#endif /* !ssIN_HEADER */
+/* %* */
#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int YY_LAST_ARG));
#endif
@@ -493,3 +766,3 @@ static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
+static int yy_flex_strlen YY_PROTO(( yyconst char * YY_LAST_ARG));
#endif
@@ -497,7 +770,13 @@ static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#ifndef YY_NO_INPUT
+/* %- Standard (non-C++) definition */
+/* %c */
+#ifndef ssIN_HEADER
#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
+static int yyinput YY_PROTO(( YY_ONLY_ARG ));
#else
-static int input YY_PROTO(( void ));
+static int input YY_PROTO(( YY_ONLY_ARG ));
#endif
+/* %e */
+#endif /* !ssIN_HEADER */
+/* %* */
#endif
@@ -505,2 +784,5 @@ static int input YY_PROTO(( void ));
#if YY_STACK_USED
+#ifndef YY_REENTRANT
+/* %c */
+#ifndef ssIN_HEADER
static int yy_start_stack_ptr = 0;
@@ -508,10 +790,13 @@ static int yy_start_stack_depth = 0;
static int *yy_start_stack = 0;
+/* %e */
+#endif /* !ssIN_HEADER */
+#endif
#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state ));
+static void yy_push_state YY_PROTO(( int new_state YY_LAST_ARG));
#endif
#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( void ));
+static void yy_pop_state YY_PROTO(( YY_ONLY_ARG ));
#endif
#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( void ));
+static int yy_top_state YY_PROTO(( YY_ONLY_ARG ));
#endif
@@ -524,17 +809,2 @@ static int yy_top_state YY_PROTO(( void ));
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
/* Amount of stuff to slurp up with each read. */
@@ -547,2 +817,3 @@ YY_MALLOC_DECL
#ifndef ECHO
+/* %- Standard (non-C++) definition */
/* This used to be an fputs(), but since the string might contain NUL's,
@@ -551,2 +822,4 @@ YY_MALLOC_DECL
#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
+/* %+ C++ definition */
+/* %* */
#endif
@@ -558,5 +831,7 @@ YY_MALLOC_DECL
#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) \
+/* %% [5.0] fread()/read() definition of YY_INPUT goes here unless we're doing C++ \ */\
+ if ( YY_G(yy_current_buffer)->yy_is_interactive ) \
{ \
- int c = '*', n; \
+ int c = '*'; \
+ size_t n; \
for ( n = 0; n < max_size && \
@@ -570,5 +845,18 @@ YY_MALLOC_DECL
} \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
- && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
+ else \
+ { \
+ errno=0; \
+ while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
+ { \
+ if( errno != EINTR) \
+ { \
+ YY_FATAL_ERROR( "input in flex scanner failed" ); \
+ break; \
+ } \
+ errno=0; \
+ clearerr(yyin); \
+ } \
+ }
+/* %+ C++ definition \ */\
+/* %* */
#endif
@@ -590,3 +878,6 @@ YY_MALLOC_DECL
#ifndef YY_FATAL_ERROR
+/* %- */
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
+/* %+ */
+/* %* */
#endif
@@ -597,3 +888,37 @@ YY_MALLOC_DECL
#ifndef YY_DECL
-#define YY_DECL int yylex YY_PROTO(( void ))
+/* %- Standard (non-C++) definition */
+
+/* If the bison pure parser is used, then bison will provide
+ one or two additional arguments. */
+
+#ifdef YY_REENTRANT_BISON_PURE
+# ifdef YYLTYPE
+# ifdef YY_USE_PROTOS
+# define YY_LEX_ARGS (YYSTYPE * yylvalp, YYLTYPE * yyllocp YY_LAST_ARG)
+# else
+# define YY_LEX_ARGS (yylvalp, yyllocp YY_LAST_ARG) \
+ YYSTYPE * yylvalp; YYLTYPE * yyllocp; YY_DECL_LAST_ARG
+# endif
+# else
+# ifdef YY_USE_PROTOS
+# define YY_LEX_ARGS (YYSTYPE * yylvalp YY_LAST_ARG)
+# else
+# define YY_LEX_ARGS (yylvalp YY_LAST_ARG) \
+ YYSTYPE * yylvalp; YY_DECL_LAST_ARG
+# endif
+# endif
+#else
+# ifdef YY_USE_PROTOS
+# define YY_LEX_ARGS (YY_ONLY_ARG)
+# else
+# define YY_LEX_ARGS (YY_ONLY_ARG) YY_DECL_LAST_ARG
+# endif
+#endif
+
+
+extern int yylex YY_PROTO( YY_LEX_ARGS );
+
+#define YY_DECL int yylex YY_LEX_ARGS
+/* %+ C++ definition */
+/* %* */
#endif
@@ -612,2 +937,3 @@ YY_MALLOC_DECL
+/* %% [6.0] YY_RULE_SETUP definition goes here */
#define YY_RULE_SETUP \
@@ -615,2 +941,4 @@ YY_MALLOC_DECL
+/* %c */
+#ifndef ssIN_HEADER
YY_DECL
@@ -618,6 +946,8 @@ YY_DECL
register yy_state_type yy_current_state;
- register char *yy_cp = NULL, *yy_bp = NULL;
+ register char *yy_cp, *yy_bp;
register int yy_act;
-#line 69 "icalsslexer.l"
+/* %% [7.0] user's declarations go here */
+#line 66 "icalsslexer.l"
+
@@ -627,8 +957,14 @@ YY_DECL
+#line 959 "lex.ss.c"
-#line 623 "icalsslexer.c"
+#ifdef YY_REENTRANT_BISON_PURE
+ yylval = yylvalp;
+#ifdef YYLTYPE
+ yylloc = yyllocp;
+#endif
+#endif
- if ( yy_init )
+ if ( YY_G(yy_init) )
{
- yy_init = 0;
+ YY_G(yy_init) = 0;
@@ -638,16 +974,22 @@ YY_DECL
- if ( ! yy_start )
- yy_start = 1; /* first start state */
+ if ( ! YY_G(yy_start) )
+ YY_G(yy_start) = 1; /* first start state */
if ( ! yyin )
+/* %- */
yyin = stdin;
+/* %+ */
+/* %* */
if ( ! yyout )
+/* %- */
yyout = stdout;
+/* %+ */
+/* %* */
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
+ if ( ! YY_G(yy_current_buffer) )
+ YY_G(yy_current_buffer) =
+ yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG);
- yy_load_buffer_state();
+ yy_load_buffer_state( YY_CALL_ONLY_ARG );
}
@@ -656,6 +998,7 @@ YY_DECL
{
- yy_cp = yy_c_buf_p;
+/* %% [8.0] yymore()-related code goes here */
+ yy_cp = YY_G(yy_c_buf_p);
/* Support of yytext. */
- *yy_cp = yy_hold_char;
+ *yy_cp = YY_G(yy_hold_char);
@@ -666,3 +1009,4 @@ YY_DECL
- yy_current_state = yy_start;
+/* %% [9.0] code to set up and find next match goes here */
+ yy_current_state = YY_G(yy_start);
yy_match:
@@ -673,4 +1017,4 @@ yy_match:
{
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
+ YY_G(yy_last_accepting_state) = yy_current_state;
+ YY_G(yy_last_accepting_cpos) = yy_cp;
}
@@ -679,3 +1023,3 @@ yy_match:
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 47 )
+ if ( yy_current_state >= 56 )
yy_c = yy_meta[(unsigned int) yy_c];
@@ -685,5 +1029,6 @@ yy_match:
}
- while ( yy_base[yy_current_state] != 54 );
+ while ( yy_base[yy_current_state] != 69 );
yy_find_action:
+/* %% [10.0] code to find the action number goes here */
yy_act = yy_accept[yy_current_state];
@@ -691,4 +1036,4 @@ yy_find_action:
{ /* have to back up */
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
+ yy_cp = YY_G(yy_last_accepting_cpos);
+ yy_current_state = YY_G(yy_last_accepting_state);
yy_act = yy_accept[yy_current_state];
@@ -698,2 +1043,3 @@ yy_find_action:
+/* %% [11.0] code for yylineno update goes here */
@@ -701,2 +1047,3 @@ do_action: /* This label is used only to access EOF actions. */
+/* %% [12.0] debug code goes here */
@@ -704,7 +1051,8 @@ do_action: /* This label is used only to access EOF actions. */
{ /* beginning of action switch */
+/* %% [13.0] actions go here */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yy_hold_char;
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
+ *yy_cp = YY_G(yy_hold_char);
+ yy_cp = YY_G(yy_last_accepting_cpos);
+ yy_current_state = YY_G(yy_last_accepting_state);
goto yy_find_action;
@@ -713,3 +1061,3 @@ case 1:
YY_RULE_SETUP
-#line 75 "icalsslexer.l"
+#line 72 "icalsslexer.l"
{ return SELECT; }
@@ -718,3 +1066,3 @@ case 2:
YY_RULE_SETUP
-#line 76 "icalsslexer.l"
+#line 73 "icalsslexer.l"
{ return FROM; }
@@ -723,3 +1071,3 @@ case 3:
YY_RULE_SETUP
-#line 77 "icalsslexer.l"
+#line 74 "icalsslexer.l"
{ return WHERE; }
@@ -728,3 +1076,3 @@ case 4:
YY_RULE_SETUP
-#line 78 "icalsslexer.l"
+#line 75 "icalsslexer.l"
{ return COMMA; }
@@ -733,3 +1081,3 @@ case 5:
YY_RULE_SETUP
-#line 79 "icalsslexer.l"
+#line 76 "icalsslexer.l"
{ return EQUALS; }
@@ -738,4 +1086,4 @@ case 6:
YY_RULE_SETUP
-#line 80 "icalsslexer.l"
-{ return NOTEQUALS; }
+#line 77 "icalsslexer.l"
+{ return EQUALS; }
YY_BREAK
@@ -743,4 +1091,4 @@ case 7:
YY_RULE_SETUP
-#line 81 "icalsslexer.l"
-{ return LESS; }
+#line 78 "icalsslexer.l"
+{ return NOTEQUALS; }
YY_BREAK
@@ -748,4 +1096,4 @@ case 8:
YY_RULE_SETUP
-#line 82 "icalsslexer.l"
-{ return GREATER; }
+#line 79 "icalsslexer.l"
+{ return LESS; }
YY_BREAK
@@ -753,4 +1101,4 @@ case 9:
YY_RULE_SETUP
-#line 83 "icalsslexer.l"
-{ return LESSEQUALS; }
+#line 80 "icalsslexer.l"
+{ return GREATER; }
YY_BREAK
@@ -758,4 +1106,4 @@ case 10:
YY_RULE_SETUP
-#line 84 "icalsslexer.l"
-{ return GREATEREQUALS; }
+#line 81 "icalsslexer.l"
+{ return LESSEQUALS; }
YY_BREAK
@@ -763,4 +1111,4 @@ case 11:
YY_RULE_SETUP
-#line 85 "icalsslexer.l"
-{ return AND; }
+#line 82 "icalsslexer.l"
+{ return GREATEREQUALS; }
YY_BREAK
@@ -768,4 +1116,4 @@ case 12:
YY_RULE_SETUP
-#line 86 "icalsslexer.l"
-{ return OR; }
+#line 83 "icalsslexer.l"
+{ return AND; }
YY_BREAK
@@ -773,4 +1121,4 @@ case 13:
YY_RULE_SETUP
-#line 87 "icalsslexer.l"
-{ return QUOTE; }
+#line 84 "icalsslexer.l"
+{ return OR; }
YY_BREAK
@@ -778,4 +1126,4 @@ case 14:
YY_RULE_SETUP
-#line 88 "icalsslexer.l"
-;
+#line 85 "icalsslexer.l"
+{ return IS; }
YY_BREAK
@@ -783,4 +1131,4 @@ case 15:
YY_RULE_SETUP
-#line 89 "icalsslexer.l"
-{ return EOL; }
+#line 86 "icalsslexer.l"
+{ return NOT; }
YY_BREAK
@@ -788,8 +1136,28 @@ case 16:
YY_RULE_SETUP
+#line 87 "icalsslexer.l"
+{ return SQLNULL; }
+ YY_BREAK
+case 17:
+YY_RULE_SETUP
+#line 88 "icalsslexer.l"
+{ return QUOTE; }
+ YY_BREAK
+case 18:
+YY_RULE_SETUP
+#line 89 "icalsslexer.l"
+;
+ YY_BREAK
+case 19:
+YY_RULE_SETUP
#line 90 "icalsslexer.l"
+{ return EOL; }
+ YY_BREAK
+case 20:
+YY_RULE_SETUP
+#line 92 "icalsslexer.l"
{
- int c = input();
+ int c = input(yy_globals);
unput(c);
if(c!='\''){
- sslval.v_string= icalmemory_tmp_copy(sstext);
+ yylvalp->v_string= icalmemory_tmp_copy(yytext);
return STRING;
@@ -800,19 +1168,21 @@ YY_RULE_SETUP
YY_BREAK
-case 17:
+case 21:
YY_RULE_SETUP
-#line 101 "icalsslexer.l"
-{ sslval.v_string= icalmemory_tmp_copy(sstext);
- return STRING; }
+#line 103 "icalsslexer.l"
+{
+ yylval->v_string= icalmemory_tmp_copy(yytext);
+ return STRING;
+}
YY_BREAK
-case 18:
+case 22:
YY_RULE_SETUP
-#line 105 "icalsslexer.l"
+#line 109 "icalsslexer.l"
{ return yytext[0]; }
YY_BREAK
-case 19:
+case 23:
YY_RULE_SETUP
-#line 107 "icalsslexer.l"
+#line 111 "icalsslexer.l"
ECHO;
YY_BREAK
-#line 811 "icalsslexer.c"
+#line 1188 "lex.ss.c"
case YY_STATE_EOF(INITIAL):
@@ -825,9 +1195,9 @@ case YY_STATE_EOF(string_value):
/* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
+ int yy_amount_of_matched_text = (int) (yy_cp - YY_G(yytext_ptr)) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
+ *yy_cp = YY_G(yy_hold_char);
YY_RESTORE_YY_MORE_OFFSET
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
+ if ( YY_G(yy_current_buffer)->yy_buffer_status == YY_BUFFER_NEW )
{
@@ -842,5 +1212,5 @@ case YY_STATE_EOF(string_value):
*/
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
+ YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_n_chars;
+ YY_G(yy_current_buffer)->yy_input_file = yyin;
+ YY_G(yy_current_buffer)->yy_buffer_status = YY_BUFFER_NORMAL;
}
@@ -854,3 +1224,3 @@ case YY_STATE_EOF(string_value):
*/
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ if ( YY_G(yy_c_buf_p) <= &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] )
{ /* This was really a NUL. */
@@ -858,5 +1228,5 @@ case YY_STATE_EOF(string_value):
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
+ YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state();
+ yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG );
@@ -871,5 +1241,5 @@ case YY_STATE_EOF(string_value):
- yy_next_state = yy_try_NUL_trans( yy_current_state );
+ yy_next_state = yy_try_NUL_trans( yy_current_state YY_CALL_LAST_ARG);
- yy_bp = yytext_ptr + YY_MORE_ADJ;
+ yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
@@ -878,3 +1248,3 @@ case YY_STATE_EOF(string_value):
/* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
+ yy_cp = ++YY_G(yy_c_buf_p);
yy_current_state = yy_next_state;
@@ -885,3 +1255,4 @@ case YY_STATE_EOF(string_value):
{
- yy_cp = yy_c_buf_p;
+/* %% [14.0] code to do back-up for compressed tables and set up yy_cp goes here */
+ yy_cp = YY_G(yy_c_buf_p);
goto yy_find_action;
@@ -890,3 +1261,3 @@ case YY_STATE_EOF(string_value):
- else switch ( yy_get_next_buffer() )
+ else switch ( yy_get_next_buffer( YY_CALL_ONLY_ARG ) )
{
@@ -894,5 +1265,5 @@ case YY_STATE_EOF(string_value):
{
- yy_did_buffer_switch_on_eof = 0;
+ YY_G(yy_did_buffer_switch_on_eof) = 0;
- if ( yywrap() )
+ if ( yywrap( YY_CALL_ONLY_ARG ) )
{
@@ -907,3 +1278,3 @@ case YY_STATE_EOF(string_value):
*/
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
+ YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + YY_MORE_ADJ;
@@ -915,3 +1286,3 @@ case YY_STATE_EOF(string_value):
{
- if ( ! yy_did_buffer_switch_on_eof )
+ if ( ! YY_G(yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
@@ -922,9 +1293,9 @@ case YY_STATE_EOF(string_value):
case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
+ YY_G(yy_c_buf_p) =
+ YY_G(yytext_ptr) + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state();
+ yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG );
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
+ yy_cp = YY_G(yy_c_buf_p);
+ yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
goto yy_match;
@@ -932,9 +1303,9 @@ case YY_STATE_EOF(string_value):
case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
+ YY_G(yy_c_buf_p) =
+ &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)];
- yy_current_state = yy_get_previous_state();
+ yy_current_state = yy_get_previous_state( YY_CALL_ONLY_ARG );
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
+ yy_cp = YY_G(yy_c_buf_p);
+ yy_bp = YY_G(yytext_ptr) + YY_MORE_ADJ;
goto yy_find_action;
@@ -950,3 +1321,10 @@ case YY_STATE_EOF(string_value):
} /* end of yylex */
-
+/* %e */
+#endif /* !ssIN_HEADER */
+/* %+ */
+/* %c */
+#ifndef ssIN_HEADER
+/* %e */
+#endif /* !ssIN_HEADER */
+/* %* */
@@ -960,6 +1338,16 @@ case YY_STATE_EOF(string_value):
-static int yy_get_next_buffer()
+/* %- */
+/* %c */
+#ifndef ssIN_HEADER
+#ifdef YY_USE_PROTOS
+static int yy_get_next_buffer(YY_ONLY_ARG)
+#else
+static int yy_get_next_buffer(YY_ONLY_ARG)
+YY_DECL_LAST_ARG
+#endif
+/* %+ */
+/* %* */
{
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
+ register char *dest = YY_G(yy_current_buffer)->yy_ch_buf;
+ register char *source = YY_G(yytext_ptr);
register int number_to_move, i;
@@ -967,3 +1355,3 @@ static int yy_get_next_buffer()
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
+ if ( YY_G(yy_c_buf_p) > &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars) + 1] )
YY_FATAL_ERROR(
@@ -971,5 +1359,5 @@ static int yy_get_next_buffer()
- if ( yy_current_buffer->yy_fill_buffer == 0 )
+ if ( YY_G(yy_current_buffer)->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
+ if ( YY_G(yy_c_buf_p) - YY_G(yytext_ptr) - YY_MORE_ADJ == 1 )
{
@@ -993,3 +1381,3 @@ static int yy_get_next_buffer()
/* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
+ number_to_move = (int) (YY_G(yy_c_buf_p) - YY_G(yytext_ptr)) - 1;
@@ -998,3 +1386,3 @@ static int yy_get_next_buffer()
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ if ( YY_G(yy_current_buffer)->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
@@ -1002,3 +1390,3 @@ static int yy_get_next_buffer()
*/
- yy_current_buffer->yy_n_chars = yy_n_chars = 0;
+ YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars) = 0;
@@ -1006,4 +1394,4 @@ static int yy_get_next_buffer()
{
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
+ size_t num_to_read =
+ YY_G(yy_current_buffer)->yy_buf_size - number_to_move - 1;
@@ -1017,6 +1405,6 @@ static int yy_get_next_buffer()
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
+ YY_BUFFER_STATE b = YY_G(yy_current_buffer);
int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
+ (int) (YY_G(yy_c_buf_p) - b->yy_ch_buf);
@@ -1034,3 +1422,3 @@ static int yy_get_next_buffer()
yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
+ b->yy_buf_size + 2 YY_CALL_LAST_ARG );
}
@@ -1044,5 +1432,5 @@ static int yy_get_next_buffer()
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
+ YY_G(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
- num_to_read = yy_current_buffer->yy_buf_size -
+ num_to_read = YY_G(yy_current_buffer)->yy_buf_size -
number_to_move - 1;
@@ -1055,9 +1443,9 @@ static int yy_get_next_buffer()
/* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
+ YY_INPUT( (&YY_G(yy_current_buffer)->yy_ch_buf[number_to_move]),
+ YY_G(yy_n_chars), num_to_read );
- yy_current_buffer->yy_n_chars = yy_n_chars;
+ YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars);
}
- if ( yy_n_chars == 0 )
+ if ( YY_G(yy_n_chars) == 0 )
{
@@ -1066,3 +1454,3 @@ static int yy_get_next_buffer()
ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
+ yyrestart( yyin YY_CALL_LAST_ARG);
}
@@ -1072,3 +1460,3 @@ static int yy_get_next_buffer()
ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
+ YY_G(yy_current_buffer)->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
@@ -1080,7 +1468,7 @@ static int yy_get_next_buffer()
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
+ YY_G(yy_n_chars) += number_to_move;
+ YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
+ YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
+ YY_G(yytext_ptr) = &YY_G(yy_current_buffer)->yy_ch_buf[0];
@@ -1088,3 +1476,4 @@ static int yy_get_next_buffer()
}
-
+/* %e */
+#endif /* !ssIN_HEADER */
@@ -1092,3 +1481,13 @@ static int yy_get_next_buffer()
-static yy_state_type yy_get_previous_state()
+/* %- */
+/* %c */
+#ifndef ssIN_HEADER
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_get_previous_state(YY_ONLY_ARG)
+#else
+static yy_state_type yy_get_previous_state(YY_ONLY_ARG)
+YY_DECL_LAST_ARG
+#endif
+/* %+ */
+/* %* */
{
@@ -1097,6 +1496,8 @@ static yy_state_type yy_get_previous_state()
- yy_current_state = yy_start;
+/* %% [15.0] code to get the start state into yy_current_state goes here */
+ yy_current_state = YY_G(yy_start);
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
+ for ( yy_cp = YY_G(yytext_ptr) + YY_MORE_ADJ; yy_cp < YY_G(yy_c_buf_p); ++yy_cp )
{
+/* %% [16.0] code to find the next state goes here */
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
@@ -1104,4 +1505,4 @@ static yy_state_type yy_get_previous_state()
{
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
+ YY_G(yy_last_accepting_state) = yy_current_state;
+ YY_G(yy_last_accepting_cpos) = yy_cp;
}
@@ -1110,3 +1511,3 @@ static yy_state_type yy_get_previous_state()
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 47 )
+ if ( yy_current_state >= 56 )
yy_c = yy_meta[(unsigned int) yy_c];
@@ -1126,11 +1527,16 @@ static yy_state_type yy_get_previous_state()
+/* %- */
#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state YY_LAST_ARG )
#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
+static yy_state_type yy_try_NUL_trans( yy_current_state YY_LAST_ARG )
yy_state_type yy_current_state;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
register int yy_is_jam;
- register char *yy_cp = yy_c_buf_p;
+/* %% [17.0] code to find the next state, and perhaps do backing up, goes here */
+ register char *yy_cp = YY_G(yy_c_buf_p);
@@ -1139,4 +1545,4 @@ yy_state_type yy_current_state;
{
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
+ YY_G(yy_last_accepting_state) = yy_current_state;
+ YY_G(yy_last_accepting_cpos) = yy_cp;
}
@@ -1145,3 +1551,3 @@ yy_state_type yy_current_state;
yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 47 )
+ if ( yy_current_state >= 56 )
yy_c = yy_meta[(unsigned int) yy_c];
@@ -1149,3 +1555,3 @@ yy_state_type yy_current_state;
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 46);
+ yy_is_jam = (yy_current_state == 55);
@@ -1155,26 +1561,30 @@ yy_state_type yy_current_state;
+/* %- */
#ifndef YY_NO_UNPUT
#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
+static void yyunput( int c, register char *yy_bp YY_LAST_ARG )
#else
-static void yyunput( c, yy_bp )
+static void yyunput( c, yy_bp YY_LAST_ARG)
int c;
register char *yy_bp;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
- register char *yy_cp = yy_c_buf_p;
+ register char *yy_cp = YY_G(yy_c_buf_p);
/* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
+ *yy_cp = YY_G(yy_hold_char);
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ if ( yy_cp < YY_G(yy_current_buffer)->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
+ register int number_to_move = YY_G(yy_n_chars) + 2;
+ register char *dest = &YY_G(yy_current_buffer)->yy_ch_buf[
+ YY_G(yy_current_buffer)->yy_buf_size + 2];
register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
+ &YY_G(yy_current_buffer)->yy_ch_buf[number_to_move];
- while ( source > yy_current_buffer->yy_ch_buf )
+ while ( source > YY_G(yy_current_buffer)->yy_ch_buf )
*--dest = *--source;
@@ -1183,6 +1593,6 @@ register char *yy_bp;
yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- yy_n_chars = yy_current_buffer->yy_buf_size;
+ YY_G(yy_current_buffer)->yy_n_chars =
+ YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_buf_size;
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
+ if ( yy_cp < YY_G(yy_current_buffer)->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
@@ -1192,15 +1602,27 @@ register char *yy_bp;
+/* %% [18.0] update yylineno here */
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
+ YY_G(yytext_ptr) = yy_bp;
+ YY_G(yy_hold_char) = *yy_cp;
+ YY_G(yy_c_buf_p) = yy_cp;
}
+/* %- */
#endif /* ifndef YY_NO_UNPUT */
+/* %* */
+/* %- */
+#ifndef YY_NO_INPUT
#ifdef __cplusplus
-static int yyinput()
+static int yyinput(YY_ONLY_ARG)
#else
-static int input()
+#ifdef YY_USE_PROTOS
+static int input(YY_ONLY_ARG)
+#else
+static int input(YY_ONLY_ARG)
+ YY_DECL_LAST_ARG
+#endif
#endif
+/* %+ */
+/* %* */
{
@@ -1208,5 +1630,5 @@ static int input()
- *yy_c_buf_p = yy_hold_char;
+ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
+ if ( *YY_G(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
{
@@ -1216,5 +1638,5 @@ static int input()
*/
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
+ if ( YY_G(yy_c_buf_p) < &YY_G(yy_current_buffer)->yy_ch_buf[YY_G(yy_n_chars)] )
/* This was really a NUL. */
- *yy_c_buf_p = '\0';
+ *YY_G(yy_c_buf_p) = '\0';
@@ -1222,6 +1644,6 @@ static int input()
{ /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
+ int offset = YY_G(yy_c_buf_p) - YY_G(yytext_ptr);
+ ++YY_G(yy_c_buf_p);
- switch ( yy_get_next_buffer() )
+ switch ( yy_get_next_buffer( YY_CALL_ONLY_ARG ) )
{
@@ -1239,3 +1661,3 @@ static int input()
/* Reset buffer status. */
- yyrestart( yyin );
+ yyrestart( yyin YY_CALL_LAST_ARG);
@@ -1245,11 +1667,11 @@ static int input()
{
- if ( yywrap() )
+ if ( yywrap( YY_CALL_ONLY_ARG ) )
return EOF;
- if ( ! yy_did_buffer_switch_on_eof )
+ if ( ! YY_G(yy_did_buffer_switch_on_eof) )
YY_NEW_FILE;
#ifdef __cplusplus
- return yyinput();
+ return yyinput(YY_CALL_ONLY_ARG);
#else
- return input();
+ return input(YY_CALL_ONLY_ARG);
#endif
@@ -1258,3 +1680,3 @@ static int input()
case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
+ YY_G(yy_c_buf_p) = YY_G(yytext_ptr) + offset;
break;
@@ -1264,6 +1686,7 @@ static int input()
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
+ c = *(unsigned char *) YY_G(yy_c_buf_p); /* cast for 8-bit char's */
+ *YY_G(yy_c_buf_p) = '\0'; /* preserve yytext */
+ YY_G(yy_hold_char) = *++YY_G(yy_c_buf_p);
+/* %% [19.0] update BOL and yylineno */
@@ -1271,16 +1694,23 @@ static int input()
}
+/* %- */
+#endif /* ifndef YY_NO_INPUT */
+/* %* */
-
+/* %- */
#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
+void yyrestart( FILE *input_file YY_LAST_ARG)
#else
-void yyrestart( input_file )
+void yyrestart( input_file YY_LAST_ARG)
FILE *input_file;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+ if ( ! YY_G(yy_current_buffer) )
+ YY_G(yy_current_buffer) =
+ yy_create_buffer( yyin, YY_BUF_SIZE YY_CALL_LAST_ARG);
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
+ yy_init_buffer( YY_G(yy_current_buffer), input_file YY_CALL_LAST_ARG);
+ yy_load_buffer_state( YY_CALL_ONLY_ARG );
}
@@ -1288,22 +1718,26 @@ FILE *input_file;
+/* %- */
#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer YY_LAST_ARG )
#else
-void yy_switch_to_buffer( new_buffer )
+void yy_switch_to_buffer( new_buffer YY_LAST_ARG )
YY_BUFFER_STATE new_buffer;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
- if ( yy_current_buffer == new_buffer )
+ if ( YY_G(yy_current_buffer) == new_buffer )
return;
- if ( yy_current_buffer )
+ if ( YY_G(yy_current_buffer) )
{
/* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
+ *YY_G(yy_c_buf_p) = YY_G(yy_hold_char);
+ YY_G(yy_current_buffer)->yy_buf_pos = YY_G(yy_c_buf_p);
+ YY_G(yy_current_buffer)->yy_n_chars = YY_G(yy_n_chars);
}
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
+ YY_G(yy_current_buffer) = new_buffer;
+ yy_load_buffer_state( YY_CALL_ONLY_ARG );
@@ -1314,3 +1748,3 @@ YY_BUFFER_STATE new_buffer;
*/
- yy_did_buffer_switch_on_eof = 1;
+ YY_G(yy_did_buffer_switch_on_eof) = 1;
}
@@ -1318,12 +1752,16 @@ YY_BUFFER_STATE new_buffer;
+/* %- */
#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
+void yy_load_buffer_state( YY_ONLY_ARG )
#else
-void yy_load_buffer_state()
+void yy_load_buffer_state(YY_ONLY_ARG )
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
+ YY_G(yy_n_chars) = YY_G(yy_current_buffer)->yy_n_chars;
+ YY_G(yytext_ptr) = YY_G(yy_c_buf_p) = YY_G(yy_current_buffer)->yy_buf_pos;
+ yyin = YY_G(yy_current_buffer)->yy_input_file;
+ YY_G(yy_hold_char) = *YY_G(yy_c_buf_p);
}
@@ -1331,9 +1769,13 @@ void yy_load_buffer_state()
+/* %- */
#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size YY_LAST_ARG)
#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
+YY_BUFFER_STATE yy_create_buffer( file, size YY_LAST_ARG)
FILE *file;
int size;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
@@ -1341,3 +1783,3 @@ int size;
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) YY_CALL_LAST_ARG );
if ( ! b )
@@ -1350,3 +1792,3 @@ int size;
*/
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 YY_CALL_LAST_ARG );
if ( ! b->yy_ch_buf )
@@ -1356,3 +1798,3 @@ int size;
- yy_init_buffer( b, file );
+ yy_init_buffer( b, file YY_CALL_LAST_ARG);
@@ -1362,8 +1804,12 @@ int size;
+/* %- */
#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
+void yy_delete_buffer( YY_BUFFER_STATE b YY_LAST_ARG)
#else
-void yy_delete_buffer( b )
+void yy_delete_buffer( b YY_LAST_ARG)
YY_BUFFER_STATE b;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
@@ -1372,9 +1818,9 @@ YY_BUFFER_STATE b;
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
+ if ( b == YY_G(yy_current_buffer) )
+ YY_G(yy_current_buffer) = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
+ yy_flex_free( (void *) b->yy_ch_buf YY_CALL_LAST_ARG );
- yy_flex_free( (void *) b );
+ yy_flex_free( (void *) b YY_CALL_LAST_ARG );
}
@@ -1382,14 +1828,29 @@ YY_BUFFER_STATE b;
+/* %- */
+#ifndef YY_ALWAYS_INTERACTIVE
+#ifndef YY_NEVER_INTERACTIVE
+#ifdef __cplusplus
+extern "C" int isatty YY_PROTO(( int ));
+#else
+extern int isatty YY_PROTO(( int ));
+#endif /* __cplusplus */
+#endif /* !YY_NEVER_INTERACTIVE */
+#endif /* !YY_ALWAYS_INTERACTIVE */
#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file YY_LAST_ARG)
#else
-void yy_init_buffer( b, file )
+void yy_init_buffer( b, file YY_LAST_ARG)
YY_BUFFER_STATE b;
FILE *file;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
- yy_flush_buffer( b );
+ int oerrno = errno;
+
+ yy_flush_buffer( b YY_CALL_LAST_ARG);
@@ -1398,2 +1859,3 @@ FILE *file;
+/* %- */
#if YY_ALWAYS_INTERACTIVE
@@ -1404,11 +1866,8 @@ FILE *file;
#else
-
-#ifdef _QTWIN_
- b->yy_is_interactive = file ? (_isatty( fileno(file) ) > 0) : 0;
-#else
b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
#endif
-
-#endif
#endif
+/* %+ */
+/* %* */
+ errno = oerrno;
}
@@ -1416,9 +1875,13 @@ FILE *file;
+/* %- */
#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b )
+void yy_flush_buffer( YY_BUFFER_STATE b YY_LAST_ARG )
#else
-void yy_flush_buffer( b )
+void yy_flush_buffer( b YY_LAST_ARG )
YY_BUFFER_STATE b;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
@@ -1441,5 +1904,6 @@ YY_BUFFER_STATE b;
- if ( b == yy_current_buffer )
- yy_load_buffer_state();
+ if ( b == YY_G(yy_current_buffer) )
+ yy_load_buffer_state( YY_CALL_ONLY_ARG );
}
+/* %* */
@@ -1447,8 +1911,10 @@ YY_BUFFER_STATE b;
#ifndef YY_NO_SCAN_BUFFER
+/* %- */
#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size YY_LAST_ARG )
#else
-YY_BUFFER_STATE yy_scan_buffer( base, size )
+YY_BUFFER_STATE yy_scan_buffer( base, size YY_LAST_ARG )
char *base;
yy_size_t size;
+YY_DECL_LAST_ARG
#endif
@@ -1463,3 +1929,3 @@ yy_size_t size;
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) YY_CALL_LAST_ARG );
if ( ! b )
@@ -1477,3 +1943,3 @@ yy_size_t size;
- yy_switch_to_buffer( b );
+ yy_switch_to_buffer( b YY_CALL_LAST_ARG );
@@ -1481,2 +1947,3 @@ yy_size_t size;
}
+/* %* */
#endif
@@ -1485,7 +1952,9 @@ yy_size_t size;
#ifndef YY_NO_SCAN_STRING
+/* %- */
#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str YY_LAST_ARG )
#else
-YY_BUFFER_STATE yy_scan_string( yy_str )
+YY_BUFFER_STATE yy_scan_string( yy_str YY_LAST_ARG)
yyconst char *yy_str;
+YY_DECL_LAST_ARG
#endif
@@ -1496,4 +1965,5 @@ yyconst char *yy_str;
- return yy_scan_bytes( yy_str, len );
+ return yy_scan_bytes( yy_str, len YY_CALL_LAST_ARG);
}
+/* %* */
#endif
@@ -1502,7 +1972,9 @@ yyconst char *yy_str;
#ifndef YY_NO_SCAN_BYTES
+/* %- */
#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len YY_LAST_ARG)
#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+YY_BUFFER_STATE yy_scan_bytes( bytes, len YY_LAST_ARG)
yyconst char *bytes;
+YY_DECL_LAST_ARG
int len;
@@ -1517,3 +1989,3 @@ int len;
n = len + 2;
- buf = (char *) yy_flex_alloc( n );
+ buf = (char *) yy_flex_alloc( n YY_CALL_LAST_ARG );
if ( ! buf )
@@ -1526,3 +1998,3 @@ int len;
- b = yy_scan_buffer( buf, n );
+ b = yy_scan_buffer( buf, n YY_CALL_LAST_ARG);
if ( ! b )
@@ -1537,2 +2009,3 @@ int len;
}
+/* %* */
#endif
@@ -1541,10 +2014,14 @@ int len;
#ifndef YY_NO_PUSH_STATE
+/* %- */
#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
+static void yy_push_state( int new_state YY_LAST_ARG)
#else
-static void yy_push_state( new_state )
+static void yy_push_state( new_state YY_LAST_ARG)
int new_state;
+YY_DECL_LAST_ARG
#endif
+/* %+ */
+/* %* */
{
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ if ( YY_G(yy_start_stack_ptr) >= YY_G(yy_start_stack_depth) )
{
@@ -1552,13 +2029,13 @@ int new_state;
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
+ YY_G(yy_start_stack_depth) += YY_START_STACK_INCR;
+ new_size = YY_G(yy_start_stack_depth) * sizeof( int );
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
+ if ( ! YY_G(yy_start_stack) )
+ YY_G(yy_start_stack) = (int *) yy_flex_alloc( new_size YY_CALL_LAST_ARG );
else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
+ YY_G(yy_start_stack) = (int *) yy_flex_realloc(
+ (void *) YY_G(yy_start_stack), new_size YY_CALL_LAST_ARG );
- if ( ! yy_start_stack )
+ if ( ! YY_G(yy_start_stack) )
YY_FATAL_ERROR(
@@ -1567,3 +2044,3 @@ int new_state;
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
+ YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;
@@ -1575,8 +2052,16 @@ int new_state;
#ifndef YY_NO_POP_STATE
-static void yy_pop_state()
+/* %- */
+#ifdef YY_USE_PROTOS
+static void yy_pop_state( YY_ONLY_ARG )
+#else
+static void yy_pop_state( YY_ONLY_ARG )
+YY_DECL_LAST_ARG
+#endif
+/* %+ */
+/* %* */
{
- if ( --yy_start_stack_ptr < 0 )
+ if ( --YY_G(yy_start_stack_ptr) < 0 )
YY_FATAL_ERROR( "start-condition stack underflow" );
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ BEGIN(YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)]);
}
@@ -1586,5 +2071,13 @@ static void yy_pop_state()
#ifndef YY_NO_TOP_STATE
-static int yy_top_state()
+/* %- */
+#ifdef YY_USE_PROTOS
+static int yy_top_state( YY_ONLY_ARG )
+#else
+static int yy_top_state( YY_ONLY_ARG )
+YY_DECL_LAST_ARG
+#endif
+/* %+ */
+/* %* */
{
- return yy_start_stack[yy_start_stack_ptr - 1];
+ return YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr) - 1];
}
@@ -1596,8 +2089,4 @@ static int yy_top_state()
-#ifdef YY_USE_PROTOS
+/* %- */
static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
{
@@ -1607,2 +2096,4 @@ char msg[];
+/* %+ */
+/* %* */
@@ -1616,6 +2107,6 @@ char msg[];
/* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
+ yytext[yyleng] = YY_G(yy_hold_char); \
+ YY_G(yy_c_buf_p) = yytext + n; \
+ YY_G(yy_hold_char) = *YY_G(yy_c_buf_p); \
+ *YY_G(yy_c_buf_p) = '\0'; \
yyleng = n; \
@@ -1625,2 +2116,264 @@ char msg[];
+
+#ifdef YY_REENTRANT
+
+/* Accessor methods (get/set functions) to struct members. */
+
+#ifndef YY_NO_GET_EXTRA
+#ifdef YY_USE_PROTOS
+YY_EXTRA_TYPE yyget_extra( YY_ONLY_ARG )
+#else
+YY_EXTRA_TYPE yyget_extra( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+#endif
+{
+ return yyextra;
+}
+#endif /* !YY_NO_GET_EXTRA */
+
+#ifndef YY_NO_GET_LINENO
+# ifdef YY_USE_PROTOS
+int yyget_lineno( YY_ONLY_ARG )
+# else
+int yyget_lineno( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+# endif
+{
+ return yylineno;
+}
+#endif /* !YY_NO_GET_LINENO */
+
+#ifndef YY_NO_GET_IN
+#ifdef YY_USE_PROTOS
+FILE *yyget_in( YY_ONLY_ARG )
+#else
+FILE *yyget_in( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+#endif
+{
+ return yyin;
+}
+#endif /* !YY_NO_GET_IN */
+
+#ifndef YY_NO_GET_OUT
+#ifdef YY_USE_PROTOS
+FILE *yyget_out( YY_ONLY_ARG )
+#else
+FILE *yyget_out( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+#endif
+{
+ return yyout;
+}
+#endif /* !YY_NO_GET_OUT */
+
+#ifndef YY_NO_GET_LENG
+#ifdef YY_USE_PROTOS
+int yyget_leng( YY_ONLY_ARG )
+#else
+int yyget_leng( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+#endif
+{
+ return yyleng;
+}
+#endif /* !YY_NO_GET_LENG */
+
+#ifndef YY_NO_GET_TEXT
+#ifdef YY_USE_PROTOS
+char *yyget_text( YY_ONLY_ARG )
+#else
+char *yyget_text( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+#endif
+{
+ return yytext;
+}
+#endif /* !YY_NO_GET_TEXT */
+
+#ifndef YY_NO_SET_EXTRA
+#ifdef YY_USE_PROTOS
+void yyset_extra( YY_EXTRA_TYPE user_defined YY_LAST_ARG )
+#else
+void yyset_extra( user_defined YY_LAST_ARG )
+ YY_EXTRA_TYPE user_defined;
+ YY_DECL_LAST_ARG
+#endif
+{
+ yyextra = user_defined ;
+}
+#endif /* !YY_NO_SET_EXTRA */
+
+#ifndef YY_NO_SET_LINENO
+# ifdef YY_USE_PROTOS
+void yyset_lineno( int line_number YY_LAST_ARG )
+# else
+void yyset_lineno( line_number YY_LAST_ARG )
+ int line_number;
+ YY_DECL_LAST_ARG
+# endif
+{
+ yylineno = line_number;
+}
+#endif /* !YY_NO_SET_LINENO */
+
+
+#ifndef YY_NO_SET_IN
+#ifdef YY_USE_PROTOS
+void yyset_in( FILE * in_str YY_LAST_ARG )
+#else
+void yyset_in( in_str YY_LAST_ARG )
+ FILE * in_str;
+ YY_DECL_LAST_ARG
+#endif
+{
+ yyin = in_str ;
+}
+#endif /* !YY_NO_SET_IN */
+
+#ifndef YY_NO_SET_OUT
+#ifdef YY_USE_PROTOS
+void yyset_out( FILE * out_str YY_LAST_ARG )
+#else
+void yyset_out( out_str YY_LAST_ARG )
+ FILE * out_str;
+ YY_DECL_LAST_ARG
+#endif
+{
+ yyout = out_str ;
+}
+#endif /* !YY_NO_SET_OUT */
+
+/* Accessor methods for yylval and yylloc */
+
+#ifdef YY_REENTRANT_BISON_PURE
+#ifndef YY_NO_GET_LVAL
+#ifdef YY_USE_PROTOS
+YYSTYPE * yyget_lval( YY_ONLY_ARG )
+#else
+YYSTYPE * yyget_lval( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+#endif
+{
+ return yylval;
+}
+#endif /* !YY_NO_GET_LVAL */
+
+#ifndef YY_NO_SET_LVAL
+#ifdef YY_USE_PROTOS
+void yyset_lval( YYSTYPE * yylvalp YY_LAST_ARG )
+#else
+void yyset_lval( yylvalp YY_LAST_ARG )
+ YYSTYPE * yylvalp;
+ YY_DECL_LAST_ARG
+#endif
+{
+ yylval = yylvalp;
+}
+#endif /* !YY_NO_SET_LVAL */
+
+#ifdef YYLTYPE
+#ifndef YY_NO_GET_LLOC
+#ifdef YY_USE_PROTOS
+YYLTYPE *yyget_lloc( YY_ONLY_ARG )
+#else
+YYLTYPE *yyget_lloc( YY_ONLY_ARG )
+ YY_DECL_LAST_ARG
+#endif
+{
+ return yylloc;
+}
+#endif /* !YY_NO_GET_LLOC */
+
+#ifndef YY_NO_SET_LLOC
+#ifdef YY_USE_PROTOS
+void yyset_lloc( YYLTYPE * yyllocp YY_LAST_ARG )
+#else
+void yyset_lloc( yyllocp YY_LAST_ARG )
+ YYLTYPE * yyllocp;
+ YY_DECL_LAST_ARG
+#endif
+{
+ yylloc = yyllocp;
+}
+#endif /* !YY_NO_SET_LLOC */
+
+#endif /* YYLTYPE */
+#endif /* YY_REENTRANT_BISON_PURE */
+
+
+#ifdef YY_USE_PROTOS
+static int yy_init_globals( yyscan_t yy_globals)
+#else
+static int yy_init_globals( yy_globals )
+ yyscan_t yy_globals;
+#endif
+ {
+ /* Initialization is the same as for the non-reentrant scanner.
+ This function is called once per scanner lifetime. */
+
+ /* We do not touch yylineno unless the option is enabled. */
+#ifdef YY_USE_LINENO
+ yylineno = 1;
+#endif
+ YY_G(yy_current_buffer) = 0;
+ YY_G(yy_c_buf_p) = (char *) 0;
+ YY_G(yy_init) = 1;
+ YY_G(yy_start) = 0;
+ YY_G(yy_start_stack_ptr) = 0;
+ YY_G(yy_start_stack_depth) = 0;
+ YY_G(yy_start_stack) = (int *) 0;
+
+/* Defined in main.c */
+#ifdef YY_STDINIT
+ yyin = stdin;
+ yyout = stdout;
+#else
+ yyin = (FILE *) 0;
+ yyout = (FILE *) 0;
+#endif
+ return 0;
+ }
+
+/* User-visible API */
+#ifdef YY_USE_PROTOS
+int yylex_init( yyscan_t* ptr_yy_globals)
+#else
+int yylex_init( ptr_yy_globals )
+ yyscan_t* ptr_yy_globals;
+#endif
+ {
+ *ptr_yy_globals = (yyscan_t) yy_flex_alloc ( sizeof( struct yy_globals_t ), NULL );
+ yy_init_globals ( *ptr_yy_globals );
+ return 0;
+ }
+
+#ifdef YY_USE_PROTOS
+int yylex_destroy( yyscan_t yy_globals )
+#else
+int yylex_destroy( yy_globals )
+ yyscan_t yy_globals;
+#endif
+ {
+ if( yy_globals )
+ {
+
+ /* Destroy the current (main) buffer. */
+ yy_delete_buffer( YY_G(yy_current_buffer) YY_CALL_LAST_ARG );
+ YY_G(yy_current_buffer) = NULL;
+
+ /* Destroy the start condition stack. */
+ if( YY_G(yy_start_stack) ) {
+ yy_flex_free( YY_G(yy_start_stack) YY_CALL_LAST_ARG );
+ YY_G(yy_start_stack) = NULL;
+ }
+
+ /* Destroy the main struct. */
+ yy_flex_free ( yy_globals YY_CALL_LAST_ARG );
+ }
+ return 0;
+ }
+
+#endif /* End YY_REENTRANT */
+
/* Internal utility routines. */
@@ -1629,5 +2382,5 @@ char msg[];
#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n YY_LAST_ARG)
#else
-static void yy_flex_strncpy( s1, s2, n )
+static void yy_flex_strncpy( s1, s2, n YY_LAST_ARG)
char *s1;
@@ -1635,2 +2388,3 @@ yyconst char *s2;
int n;
+YY_DECL_LAST_ARG
#endif
@@ -1645,6 +2399,7 @@ int n;
#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
+static int yy_flex_strlen( yyconst char *s YY_LAST_ARG)
#else
-static int yy_flex_strlen( s )
+static int yy_flex_strlen( s YY_LAST_ARG)
yyconst char *s;
+YY_DECL_LAST_ARG
#endif
@@ -1661,6 +2416,7 @@ yyconst char *s;
#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
+static void *yy_flex_alloc( yy_size_t size YY_LAST_ARG )
#else
-static void *yy_flex_alloc( size )
+static void *yy_flex_alloc( size YY_LAST_ARG )
yy_size_t size;
+YY_DECL_LAST_ARG
#endif
@@ -1671,7 +2427,8 @@ yy_size_t size;
#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
+static void *yy_flex_realloc( void *ptr, yy_size_t size YY_LAST_ARG )
#else
-static void *yy_flex_realloc( ptr, size )
+static void *yy_flex_realloc( ptr, size YY_LAST_ARG )
void *ptr;
yy_size_t size;
+YY_DECL_LAST_ARG
#endif
@@ -1689,9 +2446,10 @@ yy_size_t size;
#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
+static void yy_flex_free( void *ptr YY_LAST_ARG )
#else
-static void yy_flex_free( ptr )
+static void yy_flex_free( ptr YY_LAST_ARG )
void *ptr;
+YY_DECL_LAST_ARG
#endif
{
- free( ptr );
+ free( (char *) ptr ); /* see yy_flex_realloc() for (char *) cast */
}
@@ -1701,3 +2459,13 @@ int main()
{
+
+#ifdef YY_REENTRANT
+ yyscan_t lexer;
+ yylex_init(&lexer);
+ yylex( lexer );
+ yylex_destroy( lexer);
+
+#else
yylex();
+#endif
+
return 0;
@@ -1705,6 +2473,9 @@ int main()
#endif
-#line 107 "icalsslexer.l"
+/* %e */
+#endif /* !ssIN_HEADER */
+#line 111 "icalsslexer.l"
+#ifndef ssIN_HEADER
-int sswrap()
+int yywrap(yyscan_t yy_globals)
{
@@ -1713 +2484,2 @@ int sswrap()
+#endif /* !ssIN_HEADER */
diff --git a/libical/src/libicalss/icalssyacc.c b/libical/src/libicalss/icalssyacc.c
index 943123e..3d8cdc1 100644
--- a/libical/src/libicalss/icalssyacc.c
+++ b/libical/src/libicalss/icalssyacc.c
@@ -1,3 +1,3 @@
/* A Bison parser, made from icalssyacc.y
- by GNU bison 1.35. */
+ by GNU bison 1.34. */
@@ -28,4 +28,7 @@
# define END 272
+# define IS 273
+# define NOT 274
+# define SQLNULL 275
-#line 1 "icalssyacc.y"
+#line 3 "icalssyacc.y"
@@ -58,3 +61,3 @@
======================================================================*/
-
+/*#define YYDEBUG 1*/
#include <stdlib.h>
@@ -63,3 +66,2 @@
#include "ical.h"
-#include "pvl.h"
#include "icalgauge.h"
@@ -68,15 +70,18 @@
-extern struct icalgauge_impl *icalss_yy_gauge;
-
-void ssyacc_add_where(struct icalgauge_impl* impl, char* prop,
- icalgaugecompare compare , char* value);
-void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
-void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
-void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
-void sserror(char *s); /* Don't know why I need this.... */
+#define YYPARSE_PARAM yy_globals
+#define YYLEX_PARAM yy_globals
+#define YY_EXTRA_TYPE icalgauge_impl*
+ /* ick...*/
+#define yyextra ((struct icalgauge_impl*)ssget_extra(yy_globals))
+static void ssyacc_add_where(struct icalgauge_impl* impl, char* prop,
+ icalgaugecompare compare , char* value);
+static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
+static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
+static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
+void sserror(char *s); /* Don't know why I need this.... */
-#line 52 "icalssyacc.y"
+#line 56 "icalssyacc.y"
#ifndef YYSTYPE
@@ -86,3 +91,2 @@ typedef union {
# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
#endif
@@ -94,8 +98,8 @@ typedef union {
-#define YYFINAL 34
+#define YYFINAL 38
#define YYFLAG -32768
-#define YYNTBASE 19
+#define YYNTBASE 22
/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
-#define YYTRANSLATE(x) ((unsigned)(x) <= 272 ? yytranslate[x] : 24)
+#define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 27)
@@ -131,3 +135,3 @@ static const char yytranslate[] =
6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18
+ 16, 17, 18, 19, 20, 21
};
@@ -137,4 +141,4 @@ static const short yyprhs[] =
{
- 0, 0, 7, 9, 11, 15, 17, 21, 22, 26,
- 30, 34, 38, 42, 46, 48, 52
+ 0, 0, 7, 12, 14, 16, 20, 22, 26, 27,
+ 31, 35, 40, 44, 48, 52, 56, 60, 62, 66
};
@@ -142,8 +146,9 @@ static const short yyrhs[] =
{
- 4, 20, 5, 21, 6, 23, 0, 1, 0, 3,
- 0, 20, 7, 3, 0, 3, 0, 21, 7, 3,
- 0, 0, 3, 9, 3, 0, 3, 10, 3, 0,
- 3, 11, 3, 0, 3, 12, 3, 0, 3, 13,
- 3, 0, 3, 14, 3, 0, 22, 0, 23, 15,
- 22, 0, 23, 16, 22, 0
+ 4, 23, 5, 24, 6, 26, 0, 4, 23, 5,
+ 24, 0, 1, 0, 3, 0, 23, 7, 3, 0,
+ 3, 0, 24, 7, 3, 0, 0, 3, 9, 3,
+ 0, 3, 19, 21, 0, 3, 19, 20, 21, 0,
+ 3, 10, 3, 0, 3, 11, 3, 0, 3, 12,
+ 3, 0, 3, 13, 3, 0, 3, 14, 3, 0,
+ 25, 0, 26, 15, 25, 0, 26, 16, 25, 0
};
@@ -156,4 +161,4 @@ static const short yyrline[] =
{
- 0, 63, 64, 70, 72, 76, 78, 81, 83, 85,
- 86, 87, 88, 89, 92, 94, 95
+ 0, 67, 68, 69, 75, 77, 81, 83, 86, 88,
+ 89, 90, 91, 92, 93, 94, 95, 98, 100, 101
};
@@ -169,4 +174,4 @@ static const char *const yytname[] =
"QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS",
- "GREATEREQUALS", "AND", "OR", "EOL", "END", "query_min", "select_list",
- "from_list", "where_clause", "where_list", 0
+ "GREATEREQUALS", "AND", "OR", "EOL", "END", "IS", "NOT", "SQLNULL",
+ "query_min", "select_list", "from_list", "where_clause", "where_list", 0
};
@@ -177,4 +182,4 @@ static const short yyr1[] =
{
- 0, 19, 19, 20, 20, 21, 21, 22, 22, 22,
- 22, 22, 22, 22, 23, 23, 23
+ 0, 22, 22, 22, 23, 23, 24, 24, 25, 25,
+ 25, 25, 25, 25, 25, 25, 25, 26, 26, 26
};
@@ -184,4 +189,4 @@ static const short yyr2[] =
{
- 0, 6, 1, 1, 3, 1, 3, 0, 3, 3,
- 3, 3, 3, 3, 1, 3, 3
+ 0, 6, 4, 1, 1, 3, 1, 3, 0, 3,
+ 3, 4, 3, 3, 3, 3, 3, 1, 3, 3
};
@@ -193,6 +198,6 @@ static const short yydefact[] =
{
- 0, 2, 0, 3, 0, 0, 0, 5, 0, 4,
- 7, 0, 0, 14, 1, 6, 0, 0, 0, 0,
- 0, 0, 7, 7, 8, 9, 10, 11, 12, 13,
- 15, 16, 0, 0, 0
+ 0, 3, 0, 4, 0, 0, 0, 6, 2, 5,
+ 8, 0, 0, 17, 1, 7, 0, 0, 0, 0,
+ 0, 0, 0, 8, 8, 9, 12, 13, 14, 15,
+ 16, 0, 10, 18, 19, 11, 0, 0, 0
};
@@ -201,3 +206,3 @@ static const short yydefgoto[] =
{
- 32, 4, 8, 13, 14
+ 36, 4, 8, 13, 14
};
@@ -206,6 +211,6 @@ static const short yypact[] =
{
- 5,-32768, 4,-32768, 3, 8, 15,-32768, 6,-32768,
- 16, 17, -9,-32768, -1,-32768, 18, 19, 20, 21,
- 22, 23, 16, 16,-32768,-32768,-32768,-32768,-32768,-32768,
- -32768,-32768, 27, 28,-32768
+ 5,-32768, 9,-32768, 6, 17, 18,-32768, 1,-32768,
+ 19, 20, -9,-32768, -1,-32768, 21, 22, 23, 24,
+ 25, 26, -4, 19, 19,-32768,-32768,-32768,-32768,-32768,
+ -32768, 10,-32768,-32768,-32768,-32768, 30, 32,-32768
};
@@ -214,3 +219,3 @@ static const short yypgoto[] =
{
- -32768,-32768,-32768, -6,-32768
+ -32768,-32768,-32768, -5,-32768
};
@@ -218,3 +223,3 @@ static const short yypgoto[] =
-#define YYLAST 28
+#define YYLAST 32
@@ -223,5 +228,6 @@ static const short yytable[] =
{
- 16, 17, 18, 19, 20, 21, 1, 3, 5, 2,
- 6, 7, 10, 11, 22, 23, 30, 31, 9, 12,
- 15, 24, 25, 26, 27, 28, 29, 33, 34
+ 16, 17, 18, 19, 20, 21, 1, 10, 11, 2,
+ 22, 5, 3, 6, 23, 24, 31, 32, 33, 34,
+ 7, 9, 12, 15, 25, 26, 27, 28, 29, 30,
+ 37, 35, 38
};
@@ -230,8 +236,11 @@ static const short yycheck[] =
{
- 9, 10, 11, 12, 13, 14, 1, 3, 5, 4,
- 7, 3, 6, 7, 15, 16, 22, 23, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 0, 0
+ 9, 10, 11, 12, 13, 14, 1, 6, 7, 4,
+ 19, 5, 3, 7, 15, 16, 20, 21, 23, 24,
+ 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 0, 21, 0
};
+#define YYPURE 1
+
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/share/bison/bison.simple"
+#line 3 "/usr/local/share/bison/bison.simple"
@@ -303,8 +312,2 @@ static const short yycheck[] =
# endif
-#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
@@ -335,21 +338,3 @@ union yyalloc
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
+/* Relocate the TYPE STACK from its old location to the new one. The
local variables YYSIZE and YYSTACKSIZE give the old and new number of
@@ -358,3 +343,3 @@ union yyalloc
stack. */
-# define YYSTACK_RELOCATE(Stack) \
+# define YYSTACK_RELOCATE(Type, Stack) \
do \
@@ -362,5 +347,6 @@ union yyalloc
YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
+ yymemcpy ((char *) yyptr, (char *) (Stack), \
+ yysize * (YYSIZE_T) sizeof (Type)); \
Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
+ yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
yyptr += yynewbytes / sizeof (*yyptr); \
@@ -369,3 +355,3 @@ union yyalloc
-#endif
+#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
@@ -496,2 +482,29 @@ int yydebug;
+#if ! defined (yyoverflow) && ! defined (yymemcpy)
+# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+# define yymemcpy __builtin_memcpy
+# else /* not GNU C or C++ */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+# if defined (__STDC__) || defined (__cplusplus)
+yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
+# else
+yymemcpy (yyto, yyfrom, yycount)
+ char *yyto;
+ const char *yyfrom;
+ YYSIZE_T yycount;
+# endif
+{
+ register const char *yyf = yyfrom;
+ register char *yyt = yyto;
+ register YYSIZE_T yyi = yycount;
+
+ while (yyi-- != 0)
+ *yyt++ = *yyf++;
+}
+# endif
+#endif
+
#ifdef YYERROR_VERBOSE
@@ -548,3 +561,3 @@ yystpcpy (yydest, yysrc)
-#line 315 "/usr/share/bison/bison.simple"
+#line 319 "/usr/local/share/bison/bison.simple"
@@ -738,5 +751,2 @@ yyparse (YYPARSE_PARAM_ARG)
#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
/* Extend the stack our own way. */
@@ -754,6 +764,6 @@ yyparse (YYPARSE_PARAM_ARG)
goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
+ YYSTACK_RELOCATE (short, yyss);
+ YYSTACK_RELOCATE (YYSTYPE, yyvs);
# if YYLSP_NEEDED
- YYSTACK_RELOCATE (yyls);
+ YYSTACK_RELOCATE (YYLTYPE, yyls);
# endif
@@ -763,3 +773,2 @@ yyparse (YYPARSE_PARAM_ARG)
}
-# endif
#endif /* no yyoverflow */
@@ -941,16 +950,12 @@ yyreduce:
-case 2:
-#line 64 "icalssyacc.y"
+case 3:
+#line 69 "icalssyacc.y"
{
- icalparser_clear_flex_input();
yyclearin;
+ YYABORT;
}
break;
-case 3:
-#line 71 "icalssyacc.y"
-{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
- break;
case 4:
-#line 72 "icalssyacc.y"
-{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
+#line 76 "icalssyacc.y"
+{ssyacc_add_select(yyextra,yyvsp[0].v_string);}
break;
@@ -958,31 +963,31 @@ case 5:
#line 77 "icalssyacc.y"
-{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
+{ssyacc_add_select(yyextra,yyvsp[0].v_string);}
break;
case 6:
-#line 78 "icalssyacc.y"
-{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
+#line 82 "icalssyacc.y"
+{ssyacc_add_from(yyextra,yyvsp[0].v_string);}
break;
-case 8:
+case 7:
#line 83 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
+{ssyacc_add_from(yyextra,yyvsp[0].v_string);}
break;
case 9:
-#line 85 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
+#line 88 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
break;
case 10:
-#line 86 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
+#line 89 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_ISNULL,""); }
break;
case 11:
-#line 87 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
+#line 90 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-3].v_string,ICALGAUGECOMPARE_ISNOTNULL,""); }
break;
case 12:
-#line 88 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
+#line 91 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
break;
case 13:
-#line 89 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
+#line 92 "icalssyacc.y"
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
break;
@@ -990,3 +995,3 @@ case 14:
#line 93 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_NONE);}
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
break;
@@ -994,3 +999,3 @@ case 15:
#line 94 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_AND);}
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
break;
@@ -998,3 +1003,15 @@ case 16:
#line 95 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_OR);}
+{ssyacc_add_where(yyextra,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
+ break;
+case 17:
+#line 99 "icalssyacc.y"
+{set_logic(yyextra,ICALGAUGELOGIC_NONE);}
+ break;
+case 18:
+#line 100 "icalssyacc.y"
+{set_logic(yyextra,ICALGAUGELOGIC_AND);}
+ break;
+case 19:
+#line 101 "icalssyacc.y"
+{set_logic(yyextra,ICALGAUGELOGIC_OR);}
break;
@@ -1002,3 +1019,3 @@ case 16:
-#line 705 "/usr/share/bison/bison.simple"
+#line 705 "/usr/local/share/bison/bison.simple"
@@ -1233,6 +1250,6 @@ yyreturn:
}
-#line 99 "icalssyacc.y"
+#line 105 "icalssyacc.y"
-void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
+static void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
icalgaugecompare compare , char* value_str)
@@ -1298,3 +1315,3 @@ void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
-void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
+static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
{
@@ -1309,3 +1326,3 @@ void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
-void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
+static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
{
@@ -1355,5 +1372,5 @@ void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
if(where->prop == ICAL_NO_PROPERTY){
- icalgauge_free(where);
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return;
+ free(where);
+ icalerror_set_errno(ICAL_BADARG_ERROR);
+ return;
}
@@ -1363,3 +1380,3 @@ void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
-void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
+static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
{
@@ -1379,3 +1396,4 @@ void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
void sserror(char *s){
- fprintf(stderr,"Parse error \'%s\'\n", s);
+ fprintf(stderr,"Parse error \'%s\'\n", s);
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
}
diff --git a/libical/src/libicalss/icalssyacc.h b/libical/src/libicalss/icalssyacc.h
index 7d42f3c..6d03a0f 100644
--- a/libical/src/libicalss/icalssyacc.h
+++ b/libical/src/libicalss/icalssyacc.h
@@ -1,3 +1,3 @@
-#ifndef BISON_ICALSSYACC_H
-# define BISON_ICALSSYACC_H
+#ifndef BISON_Y_TAB_H
+# define BISON_Y_TAB_H
@@ -8,3 +8,2 @@ typedef union {
# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
#endif
@@ -26,6 +25,7 @@ typedef union {
# define END 272
+# define IS 273
+# define NOT 274
+# define SQLNULL 275
-extern YYSTYPE sslval;
-
-#endif /* not BISON_ICALSSYACC_H */
+#endif /* not BISON_Y_TAB_H */
diff --git a/libical/src/libicalss/libicalss.pro b/libical/src/libicalss/libicalss.pro
index a5cc80c..64b7094 100644
--- a/libical/src/libicalss/libicalss.pro
+++ b/libical/src/libicalss/libicalss.pro
@@ -1,2 +1,5 @@
-include(../../../variables.pri)
+######################################################################
+# Automatically generated by qmake (1.07a) Sun Jun 27 23:03:36 2004
+######################################################################
+
@@ -7,37 +10,34 @@ DESTDIR = ../../lib
CONFIG += staticlib
-win32: DEFINES += _WIN32 _QTWIN_
-HEADERS = icalcalendar.h \
- icalclassify.h \
- icalcstp.h \
- icalcstpclient.h \
- icalcstpserver.h \
- icaldirset.h \
- icaldirsetimpl.h \
- icalfileset.h \
- icalfilesetimpl.h \
- icalgauge.h \
- icalgaugeimpl.h \
- icalmessage.h \
- icalset.h \
- icalspanlist.h \
- icalssyacc.h \
- config.h
-
-SOURCES = icalclassify.c \
- icalcstp.c \
- icalcstpclient.c \
- icalcstpserver.c \
- icaldirset.c \
- icalfileset.c \
- icalgauge.c \
- icalmessage.c \
- icalset.c \
- icalspanlist.c \
- icalsslexer.c \
- icalssyacc.c
-
-INTERFACES =
-INCLUDEPATH += ../libical
+INCLUDEPATH += . ../libical
+# Input
+win32 {
+DEFINES += YY_NO_UNISTD_H
-DEFINES += HAVE_CONFIG_H
+}
+HEADERS += icalcalendar.h \
+ icalclassify.h \
+ icalcluster.h \
+ icalclusterimpl.h \
+ icaldirset.h \
+ icaldirsetimpl.h \
+ icalfileset.h \
+ icalfilesetimpl.h \
+ icalgauge.h \
+ icalgaugeimpl.h \
+ icalmessage.h \
+ icalset.h \
+ icalspanlist.h \
+ icalss.h \
+ icalssyacc.h
+SOURCES += icalcalendar.c \
+ icalclassify.c \
+ icalcluster.c \
+ icaldirset.c \
+ icalfileset.c \
+ icalgauge.c \
+ icalmessage.c \
+ icalset.c \
+ icalspanlist.c \
+ icalsslexer.c \
+ icalssyacc.c
diff --git a/libical/src/libicalss/libicalssE.pro b/libical/src/libicalss/libicalssE.pro
index 57d60bd..84ccf47 100644
--- a/libical/src/libicalss/libicalssE.pro
+++ b/libical/src/libicalss/libicalssE.pro
@@ -1,45 +1,41 @@
-TEMPLATE = lib
-CONFIG += warn_on staticlib
-INCLUDEPATH += ../libical
-INCLUDEPATH += .
-DEFINES += HAVE_CONFIG_H
-OBJECTS_DIR = obj/$(PLATFORM)
-MOC_DIR = moc/$(PLATFORM)
-DESTDIR=../../lib/$(PLATFORM)
-TARGET = icalss
+######################################################################
+# Automatically generated by qmake (1.07a) Sun Jun 27 23:03:36 2004
+######################################################################
-INTERFACES = \
-HEADERS = \
- config.h \
- icalcalendar.h \
- icalclassify.h \
- icalcstp.h \
- icalcstpclient.h \
- icalcstpserver.h \
- icaldirset.h \
- icaldirsetimpl.h \
- icalfileset.h \
- icalfilesetimpl.h \
- icalgauge.h \
- icalgaugeimpl.h \
- icalmessage.h \
- icalset.h \
- icalspanlist.h \
- icalss.h \
- icalssyacc.h \
+TEMPLATE = lib
-SOURCES = \
- icalclassify.c \
- icalcstp.c \
- icalcstpclient.c \
- icalcstpserver.c \
- icaldirset.c \
- icalfileset.c \
- icalgauge.c \
- icalmessage.c \
- icalset.c \
- icalspanlist.c \
- icalsslexer.c \
- icalssyacc.c \
+TARGET = icalss
+CONFIG += staticlib
+OBJECTS_DIR = obj/$(PLATFORM)
+MOC_DIR = moc/$(PLATFORM)
+DESTDIR=../../lib/$(PLATFORM)
+INCLUDEPATH += . ../libical
+# Input
+HEADERS += icalcalendar.h \
+ icalclassify.h \
+ icalcluster.h \
+ icalclusterimpl.h \
+ icaldirset.h \
+ icaldirsetimpl.h \
+ icalfileset.h \
+ icalfilesetimpl.h \
+ icalgauge.h \
+ icalgaugeimpl.h \
+ icalmessage.h \
+ icalset.h \
+ icalspanlist.h \
+ icalss.h \
+ icalssyacc.h
+SOURCES += icalcalendar.c \
+ icalclassify.c \
+ icalcluster.c \
+ icaldirset.c \
+ icalfileset.c \
+ icalgauge.c \
+ icalmessage.c \
+ icalset.c \
+ icalspanlist.c \
+ icalsslexer.c \
+ icalssyacc.c