Upgrade to libical CVS code snapshot on March 1st, 2002
git-svn-id: svn://10.0.0.236/trunk@116556 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
bbf9418488
commit
c97f9eefc3
@ -2,7 +2,7 @@
|
||||
# FILE: Makefile.am
|
||||
# CREATOR: eric
|
||||
#
|
||||
# $Id: Makefile.am,v 1.2 2001-12-21 18:56:11 mikep%oeone.com Exp $
|
||||
# $Id: Makefile.am,v 1.3 2002-03-14 15:17:50 mikep%oeone.com Exp $
|
||||
#
|
||||
#
|
||||
# (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -98,7 +98,9 @@ libical_la_SOURCES = \
|
||||
sspm.h \
|
||||
vsnprintf.c \
|
||||
icallangbind.h \
|
||||
icallangbind.c
|
||||
icallangbind.c \
|
||||
caldate.c \
|
||||
astime.h
|
||||
|
||||
libicalincludedir = $(includedir)
|
||||
|
||||
|
||||
@ -18,11 +18,11 @@
|
||||
#include <stdio.h> /* For snprintf */
|
||||
|
||||
#define TMP_BUF_SIZE 1024
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
|
||||
/* Define the structs for the restrictions. these data are filled out
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
FILE: icalcomponent.c
|
||||
CREATOR: eric 28 April 1999
|
||||
|
||||
$Id: icalcomponent.c,v 1.3 2001-12-21 18:56:13 mikep%oeone.com Exp $
|
||||
$Id: icalcomponent.c,v 1.4 2002-03-14 15:17:50 mikep%oeone.com Exp $
|
||||
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -229,15 +229,15 @@ icalcomponent_free (icalcomponent* component)
|
||||
#endif
|
||||
|
||||
if(component != 0 ){
|
||||
|
||||
if ( c->properties != 0 )
|
||||
|
||||
if ( c->properties != 0 )
|
||||
{
|
||||
while( (prop=pvl_pop(c->properties)) != 0){
|
||||
assert(prop != 0);
|
||||
icalproperty_set_parent(prop,0);
|
||||
icalproperty_free(prop);
|
||||
}
|
||||
pvl_free(c->properties);
|
||||
}
|
||||
pvl_free(c->properties);
|
||||
}
|
||||
|
||||
|
||||
@ -745,10 +745,10 @@ icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#define BEN
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef BEN
|
||||
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icallangbind.c,v 1.3 2001-12-21 18:56:21 mikep%oeone.com Exp $
|
||||
$Id: icallangbind.c,v 1.4 2002-03-14 15:17:50 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 1999 Eric Busboom
|
||||
@ -24,11 +24,11 @@
|
||||
#include "icalmemory.h"
|
||||
#include <malloc.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
int* icallangbind_new_array(int size){
|
||||
int* p = (int*)malloc(size*sizeof(int));
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
/* Scanner skeleton version:
|
||||
* $Header: /home/befator/cvs/jail/cvsroot/mozilla/other-licenses/libical/src/libical/Attic/icallexer.c,v 1.3 2001-12-28 04:15:13 jake%acutex.net Exp $
|
||||
* $Header: /home/befator/cvs/jail/cvsroot/mozilla/other-licenses/libical/src/libical/Attic/icallexer.c,v 1.4 2002-03-14 15:17:50 mikep%oeone.com Exp $
|
||||
*/
|
||||
|
||||
#define FLEX_SCANNER
|
||||
@ -27,7 +27,9 @@
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
|
||||
#ifdef c_plusplus
|
||||
@ -40,7 +42,6 @@
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/* Use prototypes in function declarations. */
|
||||
#define YY_USE_PROTOS
|
||||
@ -419,7 +420,7 @@ char *yytext_ptr;
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icallexer.c,v 1.3 2001-12-28 04:15:13 jake%acutex.net Exp $
|
||||
$Id: icallexer.c,v 1.4 2002-03-14 15:17:50 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 1999 Eric Busboom
|
||||
@ -1396,11 +1397,6 @@ YY_BUFFER_STATE b;
|
||||
}
|
||||
|
||||
|
||||
#ifndef YY_ALWAYS_INTERACTIVE
|
||||
#ifndef YY_NEVER_INTERACTIVE
|
||||
extern int isatty YY_PROTO(( int ));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef YY_USE_PROTOS
|
||||
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalparser.c
|
||||
CREATOR: eric 04 August 1999
|
||||
|
||||
$Id: icalparser.c,v 1.3 2001-12-21 18:56:23 mikep%oeone.com Exp $
|
||||
$Id: icalparser.c,v 1.4 2002-03-14 15:17:51 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License
|
||||
@ -50,13 +50,13 @@
|
||||
|
||||
#include <string.h> /* For strncpy & size_t */
|
||||
#include <stdio.h> /* For FILE and fgets and sprintf */
|
||||
#include <stdlib.h> /* for free */
|
||||
#include <stdlib.h> /* for free */
|
||||
#include <wctype.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
|
||||
extern icalvalue* icalparser_yy_value;
|
||||
@ -183,13 +183,13 @@ char* make_segment(char* start, char* end)
|
||||
|
||||
|
||||
strncpy(buf,start,size);
|
||||
*(buf+size) = 0;
|
||||
|
||||
tmp = (buf+size);
|
||||
while ( *tmp == '\0' || iswspace(*tmp) )
|
||||
{
|
||||
*tmp = 0;
|
||||
tmp--;
|
||||
*(buf+size) = 0;
|
||||
|
||||
tmp = (buf+size);
|
||||
while ( *tmp == '\0' || iswspace(*tmp) )
|
||||
{
|
||||
*tmp = 0;
|
||||
tmp--;
|
||||
}
|
||||
|
||||
return buf;
|
||||
@ -539,12 +539,12 @@ char* icalparser_get_line(icalparser *parser,
|
||||
|
||||
} else {
|
||||
*(line_p) = '\0';
|
||||
}
|
||||
|
||||
while ( *line_p == '\0' || iswspace(*line_p) )
|
||||
{
|
||||
*line_p = '\0';
|
||||
line_p--;
|
||||
}
|
||||
|
||||
while ( (*line_p == '\0' || iswspace(*line_p)) && line_p > line )
|
||||
{
|
||||
*line_p = '\0';
|
||||
line_p--;
|
||||
}
|
||||
|
||||
return line;
|
||||
@ -593,7 +593,7 @@ icalcomponent* icalparser_parse(icalparser *parser,
|
||||
icalcomponent *c=0;
|
||||
icalcomponent *root=0;
|
||||
struct icalparser_impl *impl = (struct icalparser_impl*)parser;
|
||||
icalerrorstate es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
|
||||
icalerrorstate es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
|
||||
int cont;
|
||||
|
||||
icalerror_check_arg_rz((parser !=0),"parser");
|
||||
@ -634,10 +634,10 @@ icalcomponent* icalparser_parse(icalparser *parser,
|
||||
|
||||
c = 0;
|
||||
|
||||
}
|
||||
}
|
||||
cont = 0;
|
||||
if(line != 0){
|
||||
free(line);
|
||||
free(line);
|
||||
cont = 1;
|
||||
}
|
||||
} while ( cont );
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalperiod.c
|
||||
CREATOR: eric 02 June 2000
|
||||
|
||||
$Id: icalperiod.c,v 1.2 2001-12-21 18:56:23 mikep%oeone.com Exp $
|
||||
$Id: icalperiod.c,v 1.3 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -95,13 +95,13 @@ struct icalperiodtype icalperiodtype_from_string (const char* str)
|
||||
if(icaldurationtype_as_int(p.duration) == 0) goto error;
|
||||
}
|
||||
|
||||
icalerrno = e;
|
||||
|
||||
icalerrno = e;
|
||||
|
||||
free(s);
|
||||
|
||||
return p;
|
||||
|
||||
error:
|
||||
error:
|
||||
free(s);
|
||||
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
|
||||
return null_p;
|
||||
@ -136,7 +136,7 @@ const char* icalperiodtype_as_ical_string(struct icalperiodtype p)
|
||||
|
||||
icalmemory_append_string(&buf, &buf_ptr, &buf_size, end);
|
||||
|
||||
icalmemory_add_tmp_buffer(buf);
|
||||
icalmemory_add_tmp_buffer(buf);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
FILE: icalproperty.c
|
||||
CREATOR: eric 28 April 1999
|
||||
|
||||
$Id: icalproperty.c,v 1.3 2001-12-21 18:56:23 mikep%oeone.com Exp $
|
||||
$Id: icalproperty.c,v 1.4 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -46,11 +46,11 @@
|
||||
#include <stdarg.h> /* for va_list, va_start, etc. */
|
||||
|
||||
#define TMP_BUF_SIZE 1024
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
/* Private routines for icalproperty */
|
||||
void icalvalue_set_parent(icalvalue* value,
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalrecur.c
|
||||
CREATOR: eric 16 May 2000
|
||||
|
||||
$Id: icalrecur.c,v 1.2 2001-12-21 18:56:23 mikep%oeone.com Exp $
|
||||
$Id: icalrecur.c,v 1.3 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
|
||||
@ -387,7 +387,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str)
|
||||
|
||||
if(name == 0){
|
||||
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
|
||||
icalrecurrencetype_clear(&parser.rt);
|
||||
icalrecurrencetype_clear(&parser.rt);
|
||||
free(parser.copy);
|
||||
return parser.rt;
|
||||
}
|
||||
@ -431,7 +431,7 @@ struct icalrecurrencetype icalrecurrencetype_from_string(const char* str)
|
||||
} else {
|
||||
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
|
||||
icalrecurrencetype_clear(&parser.rt);
|
||||
free(parser.copy);
|
||||
free(parser.copy);
|
||||
return parser.rt;
|
||||
}
|
||||
|
||||
@ -769,7 +769,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
|
||||
impl->by_ptrs[BY_SECOND]=impl->rule.by_second;
|
||||
impl->by_ptrs[BY_SET_POS]=impl->rule.by_set_pos;
|
||||
|
||||
memset(impl->orig_data,0,9);
|
||||
memset(impl->orig_data,0,9*sizeof(short));
|
||||
|
||||
/* Note which by rules had data in them when the iterator was
|
||||
created. We can't use the actuall by_x arrays, because the
|
||||
@ -910,7 +910,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
|
||||
|
||||
}
|
||||
|
||||
/* For YEARLY rule, begin by setting up the year days array . THey
|
||||
/* For YEARLY rule, begin by setting up the year days array . The
|
||||
YEARLY rules work by expanding one year at a time. */
|
||||
|
||||
if(impl->rule.freq == ICAL_YEARLY_RECURRENCE){
|
||||
@ -919,7 +919,7 @@ icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
|
||||
for (;;) {
|
||||
expand_year_days(impl,impl->last.year);
|
||||
if (impl->days[0] != ICAL_RECURRENCE_ARRAY_MAX)
|
||||
break;
|
||||
break; // break when no days are expanded
|
||||
increment_year(impl,impl->rule.interval);
|
||||
}
|
||||
|
||||
@ -1574,7 +1574,9 @@ int next_weekday_by_week(struct icalrecur_iterator_impl* impl)
|
||||
return 0;
|
||||
}
|
||||
|
||||
assert(has_by_data(impl,BY_DAY));
|
||||
if(!has_by_data(impl,BY_DAY)){
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* If we get here, we need to step to tne next day */
|
||||
|
||||
@ -2031,8 +2033,8 @@ int expand_year_days(struct icalrecur_iterator_impl* impl,short year)
|
||||
|
||||
for(i = 0; BYWEEKPTR[i] != ICAL_RECURRENCE_ARRAY_MAX; i++){
|
||||
short weekno = BYWEEKPTR[i];
|
||||
|
||||
if(weekno== icaltime_week_number(tt)){
|
||||
short this_weekno = icaltime_week_number(tt);
|
||||
if(weekno== this_weekno){
|
||||
impl->days[days_index++] = day;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icaltime.c
|
||||
CREATOR: eric 02 June 2000
|
||||
|
||||
$Id: icaltime.c,v 1.3 2001-12-21 18:56:27 mikep%oeone.com Exp $
|
||||
$Id: icaltime.c,v 1.4 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -35,6 +35,12 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define JDAY
|
||||
|
||||
#ifdef JDAY
|
||||
#include "astime.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifdef ICAL_NO_LIBICAL
|
||||
#define icalerror_set_errno(x)
|
||||
@ -156,7 +162,7 @@ void unset_tz(struct set_tz_save savetz)
|
||||
time_t icaltimegm(struct tm* stm)
|
||||
{
|
||||
|
||||
time_t t;
|
||||
time_t t;
|
||||
#ifndef WIN32
|
||||
struct set_tz_save old_tz = set_tz("UTC");
|
||||
t = mktime(stm);
|
||||
@ -183,12 +189,13 @@ time_t icaltimegm(struct tm* stm)
|
||||
/* Get the offset for a named timezone. */
|
||||
int icaltime_utc_offset(struct icaltimetype ictt, const char* tzid)
|
||||
{
|
||||
time_t offset_tt;
|
||||
#ifndef WIN32
|
||||
icaltimezone *utc_zone, *local_zone;
|
||||
struct tm gtm;
|
||||
struct set_tz_save old_tz;
|
||||
|
||||
time_t tt = icaltime_as_timet(ictt);
|
||||
time_t offset_tt;
|
||||
|
||||
local_zone = icaltimezone_get_builtin_timezone(tzid);
|
||||
utc_zone = icaltimezone_get_utc_timezone ();
|
||||
@ -223,6 +230,29 @@ int icaltime_utc_offset(struct icaltimetype ictt, const char* tzid)
|
||||
assert(offset == tt-offset_tt);
|
||||
#endif
|
||||
return tt-offset_tt;
|
||||
#else
|
||||
int is_daylight;
|
||||
|
||||
if ( tzid == 0 )
|
||||
{
|
||||
TIME_ZONE_INFORMATION tz;
|
||||
|
||||
GetTimeZoneInformation(&tz);
|
||||
|
||||
return -tz.Bias*60;
|
||||
}
|
||||
else
|
||||
{
|
||||
icaltimezone* zone = icaltimezone_get_builtin_timezone(tzid);
|
||||
|
||||
|
||||
offset_tt = icaltimezone_get_utc_offset_of_utc_time (zone,
|
||||
&ictt,
|
||||
&is_daylight);
|
||||
|
||||
return offset_tt;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/***********************************************************************/
|
||||
@ -356,11 +386,11 @@ time_t icaltime_as_timet(struct icaltimetype tt)
|
||||
{
|
||||
struct tm stm;
|
||||
time_t t;
|
||||
#ifdef WIN32
|
||||
TIME_ZONE_INFORMATION tz;
|
||||
char * szZone;
|
||||
icaltimezone* zone;
|
||||
int offset_tt;
|
||||
#ifdef WIN32
|
||||
TIME_ZONE_INFORMATION tz;
|
||||
char * szZone;
|
||||
icaltimezone* zone;
|
||||
int offset_tt;
|
||||
#endif
|
||||
memset(&stm,0,sizeof( struct tm));
|
||||
|
||||
@ -561,7 +591,8 @@ short icaltime_days_in_month(short month,short year)
|
||||
|
||||
/* 1-> Sunday, 7->Saturday */
|
||||
short icaltime_day_of_week(struct icaltimetype t){
|
||||
struct tm stm;
|
||||
#ifndef JDAY
|
||||
struct tm stm;
|
||||
|
||||
stm.tm_year = t.year - 1900;
|
||||
stm.tm_mon = t.month - 1;
|
||||
@ -574,11 +605,28 @@ short icaltime_day_of_week(struct icaltimetype t){
|
||||
mktime (&stm);
|
||||
|
||||
return stm.tm_wday + 1;
|
||||
#else /* JDAY implementation */
|
||||
UTinstant jt;
|
||||
|
||||
memset(&jt,0,sizeof(UTinstant));
|
||||
|
||||
jt.year = t.year;
|
||||
jt.month = t.month;
|
||||
jt.day = t.day;
|
||||
jt.i_hour = 0;
|
||||
jt.i_minute = 0;
|
||||
jt.i_second = 0;
|
||||
|
||||
juldat(&jt);
|
||||
|
||||
return jt.weekday + 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Day of the year that the first day of the week (Sunday) is on.
|
||||
FIXME: Doesn't take into account different week start days. */
|
||||
short icaltime_start_doy_of_week(struct icaltimetype t){
|
||||
#ifndef JDAY
|
||||
struct tm stm;
|
||||
int start;
|
||||
|
||||
@ -612,12 +660,30 @@ short icaltime_start_doy_of_week(struct icaltimetype t){
|
||||
}
|
||||
|
||||
return start;
|
||||
#else
|
||||
UTinstant jt;
|
||||
|
||||
memset(&jt,0,sizeof(UTinstant));
|
||||
|
||||
jt.year = t.year;
|
||||
jt.month = t.month;
|
||||
jt.day = t.day;
|
||||
jt.i_hour = 0;
|
||||
jt.i_minute = 0;
|
||||
jt.i_second = 0;
|
||||
|
||||
juldat(&jt);
|
||||
caldat(&jt);
|
||||
|
||||
return jt.day_of_year - jt.weekday;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* FIXME: Doesn't take into account the start day of the week. strftime assumes
|
||||
that weeks start on Monday. */
|
||||
short icaltime_week_number(struct icaltimetype ictt)
|
||||
{
|
||||
#ifndef JDAY
|
||||
struct tm stm;
|
||||
int week_no;
|
||||
char str[8];
|
||||
@ -637,6 +703,23 @@ short icaltime_week_number(struct icaltimetype ictt)
|
||||
week_no = atoi(str);
|
||||
|
||||
return week_no;
|
||||
#else
|
||||
UTinstant jt;
|
||||
|
||||
memset(&jt,0,sizeof(UTinstant));
|
||||
|
||||
jt.year = ictt.year;
|
||||
jt.month = ictt.month;
|
||||
jt.day = ictt.day;
|
||||
jt.i_hour = 0;
|
||||
jt.i_minute = 0;
|
||||
jt.i_second = 0;
|
||||
|
||||
juldat(&jt);
|
||||
caldat(&jt);
|
||||
|
||||
return (jt.day_of_year - jt.weekday) / 7;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* The first array is for non-leap years, the seoncd for leap years*/
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
CREATOR: Damon Chaplin 15 March 2001
|
||||
|
||||
|
||||
$Id: icaltimezone.c,v 1.1 2001-12-21 19:04:02 mikep%oeone.com Exp $
|
||||
$Id: icaltimezone.c,v 1.2 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2001, Damon Chaplin
|
||||
@ -34,15 +34,15 @@
|
||||
#include "icalarray.h"
|
||||
#include "icalerror.h"
|
||||
#include "icalparser.h"
|
||||
#include "icaltimezone.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define PACKAGE_DATA_DIR "/Projects/libical"
|
||||
#include "icaltimezone.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define PACKAGE_DATA_DIR "/Projects/libical"
|
||||
#endif
|
||||
|
||||
/* This is the toplevel directory where the timezone data is installed in. */
|
||||
#define ZONEINFO_DIRECTORY PACKAGE_DATA_DIR "/zoneinfo"
|
||||
/* This is the toplevel directory where the timezone data is installed in. */
|
||||
#define ZONEINFO_DIRECTORY PACKAGE_DATA_DIR "/zoneinfo"
|
||||
|
||||
/* The prefix we use to uniquely identify TZIDs. */
|
||||
#define TZID_PREFIX "/softwarestudio.org/"
|
||||
@ -135,7 +135,7 @@ icalarray *builtin_timezones = NULL;
|
||||
/* This is the special UTC timezone, which isn't in builtin_timezones. */
|
||||
icaltimezone utc_timezone = { 0 };
|
||||
|
||||
|
||||
static char* zone_files_directory = NULL;
|
||||
|
||||
static void icaltimezone_reset (icaltimezone *zone);
|
||||
static char* icaltimezone_get_location_from_vtimezone (icalcomponent *component);
|
||||
@ -183,6 +183,8 @@ static char* icaltimezone_load_get_line_fn (char *s,
|
||||
static void format_utc_offset (int utc_offset,
|
||||
char *buffer);
|
||||
|
||||
static char* get_zone_directory();
|
||||
|
||||
|
||||
/* Creates a new icaltimezone. */
|
||||
icaltimezone*
|
||||
@ -271,7 +273,7 @@ icaltimezone_get_vtimezone_properties (icaltimezone *zone,
|
||||
|
||||
zone->tzid = strdup (tzid);
|
||||
zone->component = component;
|
||||
if ( zone->location != 0 ) free ( zone->location );
|
||||
if ( zone->location != 0 ) free ( zone->location );
|
||||
zone->location = icaltimezone_get_location_from_vtimezone (component);
|
||||
zone->tznames = icaltimezone_get_tznames_from_vtimezone (component);
|
||||
|
||||
@ -1224,12 +1226,15 @@ icaltimezone_array_free (icalarray *timezones)
|
||||
icaltimezone *zone;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < timezones->num_elements; i++) {
|
||||
zone = icalarray_element_at (timezones, i);
|
||||
icaltimezone_free (zone, 0);
|
||||
}
|
||||
if ( timezones )
|
||||
{
|
||||
for (i = 0; i < timezones->num_elements; i++) {
|
||||
zone = icalarray_element_at (timezones, i);
|
||||
icaltimezone_free (zone, 0);
|
||||
}
|
||||
|
||||
icalarray_free (timezones);
|
||||
icalarray_free (timezones);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -1248,13 +1253,13 @@ icaltimezone_get_builtin_timezones (void)
|
||||
icaltimezone_init_builtin_timezones ();
|
||||
|
||||
return builtin_timezones;
|
||||
}
|
||||
|
||||
/* Release builtin timezone memory */
|
||||
void
|
||||
icaltimezone_free_builtin_timezones(void)
|
||||
{
|
||||
icaltimezone_array_free(builtin_timezones);
|
||||
}
|
||||
|
||||
/* Release builtin timezone memory */
|
||||
void
|
||||
icaltimezone_free_builtin_timezones(void)
|
||||
{
|
||||
icaltimezone_array_free(builtin_timezones);
|
||||
}
|
||||
|
||||
|
||||
@ -1380,7 +1385,7 @@ icaltimezone_parse_zone_tab (void)
|
||||
int filename_len;
|
||||
int latitude_degrees, latitude_minutes, latitude_seconds;
|
||||
int longitude_degrees, longitude_minutes, longitude_seconds;
|
||||
icaltimezone zone;
|
||||
icaltimezone zone;
|
||||
char *p;
|
||||
|
||||
icalerror_assert (builtin_timezones == NULL,
|
||||
@ -1388,7 +1393,7 @@ icaltimezone_parse_zone_tab (void)
|
||||
|
||||
builtin_timezones = icalarray_new (sizeof (icaltimezone), 32);
|
||||
|
||||
filename_len = strlen (ZONEINFO_DIRECTORY) + strlen (ZONES_TAB_FILENAME)
|
||||
filename_len = strlen (get_zone_directory()) + strlen (ZONES_TAB_FILENAME)
|
||||
+ 2;
|
||||
|
||||
filename = (char*) malloc (filename_len);
|
||||
@ -1396,10 +1401,10 @@ icaltimezone_parse_zone_tab (void)
|
||||
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf (filename, filename_len, "%s/%s", ZONEINFO_DIRECTORY,
|
||||
ZONES_TAB_FILENAME);
|
||||
|
||||
|
||||
snprintf (filename, filename_len, "%s/%s", get_zone_directory(),
|
||||
ZONES_TAB_FILENAME);
|
||||
|
||||
fp = fopen (filename, "r");
|
||||
free (filename);
|
||||
if (!fp) {
|
||||
@ -1468,15 +1473,15 @@ icaltimezone_load_builtin_timezone (icaltimezone *zone)
|
||||
if (!zone->location || !zone->location[0])
|
||||
return;
|
||||
|
||||
filename_len = strlen (ZONEINFO_DIRECTORY) + strlen (zone->location) + 6;
|
||||
filename_len = strlen (get_zone_directory()) + strlen (zone->location) + 6;
|
||||
|
||||
filename = (char*) malloc (filename_len);
|
||||
if (!filename) {
|
||||
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf (filename, filename_len, "%s/%s.ics", ZONEINFO_DIRECTORY,
|
||||
|
||||
snprintf (filename, filename_len, "%s/%s.ics", get_zone_directory(),
|
||||
zone->location);
|
||||
|
||||
fp = fopen (filename, "r");
|
||||
@ -1508,12 +1513,12 @@ icaltimezone_load_builtin_timezone (icaltimezone *zone)
|
||||
return;
|
||||
}
|
||||
|
||||
icaltimezone_get_vtimezone_properties (zone, subcomp);
|
||||
|
||||
icalcomponent_remove_component(comp,subcomp);
|
||||
|
||||
icalcomponent_free(comp);
|
||||
|
||||
icaltimezone_get_vtimezone_properties (zone, subcomp);
|
||||
|
||||
icalcomponent_remove_component(comp,subcomp);
|
||||
|
||||
icalcomponent_free(comp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1620,3 +1625,25 @@ format_utc_offset (int utc_offset,
|
||||
else
|
||||
sprintf (buffer, "%s%02i%02i%02i", sign, hours, minutes, seconds);
|
||||
}
|
||||
|
||||
static char* get_zone_directory()
|
||||
{
|
||||
return zone_files_directory == NULL ? ZONEINFO_DIRECTORY : zone_files_directory;
|
||||
}
|
||||
|
||||
void set_zone_directory(char *path)
|
||||
{
|
||||
zone_files_directory = malloc(strlen(path)+1);
|
||||
if ( zone_files_directory != NULL )
|
||||
{
|
||||
strcpy(zone_files_directory,path);
|
||||
}
|
||||
}
|
||||
|
||||
void free_zone_directory()
|
||||
{
|
||||
if ( zone_files_directory != NULL )
|
||||
{
|
||||
free(zone_files_directory);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
CREATOR: Damon Chaplin 15 March 2001
|
||||
|
||||
|
||||
$Id: icaltimezone.h,v 1.1 2001-12-21 19:21:38 mikep%oeone.com Exp $
|
||||
$Id: icaltimezone.h,v 1.2 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2001, Damon Chaplin
|
||||
@ -128,6 +128,15 @@ void icaltimezone_array_append_from_vtimezone (icalarray *timezones,
|
||||
void icaltimezone_array_free (icalarray *timezones);
|
||||
|
||||
|
||||
/*
|
||||
* Handling the default location the timezone files
|
||||
*/
|
||||
|
||||
/* Set the directory to look for the zonefiles */
|
||||
void set_zone_directory(char *path);
|
||||
|
||||
/* Free memory dedicated to the zonefile directory */
|
||||
void free_zone_directory();
|
||||
|
||||
/*
|
||||
* Debugging Output.
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icaltypes.c
|
||||
CREATOR: eric 16 May 1999
|
||||
|
||||
$Id: icaltypes.c,v 1.3 2001-12-21 18:56:27 mikep%oeone.com Exp $
|
||||
$Id: icaltypes.c,v 1.4 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
|
||||
@ -34,11 +34,11 @@
|
||||
#include <errno.h> /* for errno */
|
||||
#include <string.h> /* for icalmemory_strdup */
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#define TEMP_MAX 1024
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalvalue.c
|
||||
CREATOR: eric 02 May 1999
|
||||
|
||||
$Id: icalvalue.c,v 1.3 2001-12-21 18:56:28 mikep%oeone.com Exp $
|
||||
$Id: icalvalue.c,v 1.4 2002-03-14 15:17:52 mikep%oeone.com Exp $
|
||||
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -45,11 +45,11 @@
|
||||
#include <time.h> /* for mktime */
|
||||
#include <stdlib.h> /* for atoi and atof */
|
||||
#include <limits.h> /* for SHRT_MAX */
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#if _MAC_OS_
|
||||
#include "icalmemory_strdup.h"
|
||||
|
||||
@ -85,6 +85,10 @@ LIB32=link.exe -lib
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\caldate.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\icalarray.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
@ -209,6 +213,10 @@ SOURCE=sspm.c
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\astime.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=ical.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
@ -210,6 +210,7 @@ LIBICAL_OBJS= .\$(OBJDIR)\icalarray.obj \
|
||||
.\$(OBJDIR)\icalyacc.obj \
|
||||
.\$(OBJDIR)\pvl.obj \
|
||||
.\$(OBJDIR)\sspm.obj \
|
||||
.\$(OBJDIR)\caldate.obj \
|
||||
$(NULL)
|
||||
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: sspm.c Parse Mime
|
||||
CREATOR: eric 25 June 2000
|
||||
|
||||
$Id: sspm.c,v 1.3 2001-12-21 18:56:30 mikep%oeone.com Exp $
|
||||
$Id: sspm.c,v 1.4 2002-03-14 15:17:53 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
The contents of this file are subject to the Mozilla Public License
|
||||
@ -44,11 +44,11 @@
|
||||
#ifdef DMALLOC
|
||||
#include "dmalloc.h"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#define TMP_BUF_SIZE 1024
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#ifndef WIN32
|
||||
#include "config.h"
|
||||
#ifndef WIN32
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifndef HAVE_SNPRINTF
|
||||
/*
|
||||
@ -27,11 +27,11 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mman.h>
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <signal.h>
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
/* Scanner skeleton version:
|
||||
* $Header: /home/befator/cvs/jail/cvsroot/mozilla/other-licenses/libical/src/libicalss/autogenex/Attic/icalsslexer.c,v 1.1 2001-12-21 19:21:49 mikep%oeone.com Exp $
|
||||
* $Header: /home/befator/cvs/jail/cvsroot/mozilla/other-licenses/libical/src/libicalss/autogenex/Attic/icalsslexer.c,v 1.2 2002-03-14 15:17:58 mikep%oeone.com Exp $
|
||||
*/
|
||||
|
||||
#define FLEX_SCANNER
|
||||
@ -27,8 +27,8 @@
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -425,7 +425,7 @@ char *yytext_ptr;
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icalsslexer.c,v 1.1 2001-12-21 19:21:49 mikep%oeone.com Exp $
|
||||
$Id: icalsslexer.c,v 1.2 2002-03-14 15:17:58 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalclassify.c
|
||||
CREATOR: ebusboom 23 aug 2000
|
||||
|
||||
$Id: icalclassify.c,v 1.2 2001-12-21 18:56:34 mikep%oeone.com Exp $
|
||||
$Id: icalclassify.c,v 1.3 2002-03-14 15:17:55 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -155,15 +155,15 @@ icalproperty* icalclassify_find_attendee(icalcomponent *c,
|
||||
this_upn++;
|
||||
}
|
||||
|
||||
if(strcmp(this_upn,upn)==0){
|
||||
free(lattendee);
|
||||
if(strcmp(this_upn,upn)==0){
|
||||
free(lattendee);
|
||||
free(this_attendee);
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
free(this_attendee);
|
||||
}
|
||||
free(lattendee);
|
||||
free(lattendee);
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalcstps.c
|
||||
CREATOR: ebusboom 23 Jun 2000
|
||||
|
||||
$Id: icalcstp.c,v 1.3 2001-12-21 18:56:34 mikep%oeone.com Exp $
|
||||
$Id: icalcstp.c,v 1.4 2002-03-14 15:17:56 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -31,10 +31,10 @@
|
||||
#include "pvl.h"
|
||||
|
||||
#include <sys/types.h> /* For send(), others */
|
||||
#ifndef WIN32
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h> /* For send(), others. */
|
||||
#include <unistd.h> /* For alarm */
|
||||
#endif
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <stdlib.h> /* for malloc */
|
||||
#include <string.h>
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalcstps.c
|
||||
CREATOR: ebusboom 23 Jun 2000
|
||||
|
||||
$Id: icalcstpclient.c,v 1.3 2001-12-21 18:56:35 mikep%oeone.com Exp $
|
||||
$Id: icalcstpclient.c,v 1.4 2002-03-14 15:17:56 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -32,9 +32,9 @@
|
||||
#include "pvl.h"
|
||||
|
||||
#include <sys/types.h> /* For send(), others */
|
||||
#ifndef WIN32
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h> /* For send(), others. */
|
||||
#include <unistd.h> /* For alarm */
|
||||
#include <unistd.h> /* For alarm */
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <stdlib.h> /* for malloc */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalcstpserver.c
|
||||
CREATOR: ebusboom 13 Feb 01
|
||||
|
||||
$Id: icalcstpserver.c,v 1.3 2001-12-21 18:56:35 mikep%oeone.com Exp $
|
||||
$Id: icalcstpserver.c,v 1.4 2002-03-14 15:17:56 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -32,9 +32,9 @@
|
||||
#include "pvl.h"
|
||||
|
||||
#include <sys/types.h> /* For send(), others */
|
||||
#ifndef WIN32
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h> /* For send(), others. */
|
||||
#include <unistd.h> /* For alarm */
|
||||
#include <unistd.h> /* For alarm */
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <stdlib.h> /* for malloc */
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icaldirset.c
|
||||
CREATOR: eric 28 November 1999
|
||||
|
||||
$Id: icaldirset.c,v 1.3 2001-12-21 18:56:36 mikep%oeone.com Exp $
|
||||
$Id: icaldirset.c,v 1.4 2002-03-14 15:17:56 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -65,14 +65,14 @@
|
||||
#include "icalfilesetimpl.h"
|
||||
#include "icalgauge.h"
|
||||
|
||||
#include <limits.h> /* For PATH_MAX */
|
||||
#include <limits.h> /* For PATH_MAX */
|
||||
#ifndef WIN32
|
||||
#include <dirent.h> /* for opendir() */
|
||||
#include <unistd.h> /* for stat, getpid */
|
||||
#include <sys/utsname.h> /* for uname */
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <process.h>
|
||||
#include <dirent.h> /* for opendir() */
|
||||
#include <unistd.h> /* for stat, getpid */
|
||||
#include <sys/utsname.h> /* for uname */
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <process.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <sys/types.h> /* for opendir() */
|
||||
@ -82,16 +82,16 @@
|
||||
#include <string.h> /* for strdup */
|
||||
#include "icaldirsetimpl.h"
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
|
||||
#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
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
|
||||
#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
|
||||
|
||||
struct icaldirset_impl* icaldirset_new_impl()
|
||||
{
|
||||
@ -144,8 +144,8 @@ 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)
|
||||
{
|
||||
char *str;
|
||||
#ifndef WIN32
|
||||
char *str;
|
||||
#ifndef WIN32
|
||||
struct dirent *de;
|
||||
DIR* dp;
|
||||
|
||||
@ -176,39 +176,39 @@ icalerrorenum icaldirset_read_directory(struct icaldirset_impl* impl)
|
||||
}
|
||||
|
||||
closedir(dp);
|
||||
#else
|
||||
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(impl->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(impl->directory, (void*)strdup(c_file.name));
|
||||
}
|
||||
while ( _findnext( hFile, &c_file ) == 0 );
|
||||
|
||||
_findclose( hFile );
|
||||
}
|
||||
|
||||
#endif
|
||||
#else
|
||||
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(impl->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(impl->directory, (void*)strdup(c_file.name));
|
||||
}
|
||||
while ( _findnext( hFile, &c_file ) == 0 );
|
||||
|
||||
_findclose( hFile );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
return ICAL_NO_ERROR;
|
||||
}
|
||||
@ -383,9 +383,9 @@ void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
|
||||
{
|
||||
char uidstring[ICAL_PATH_MAX];
|
||||
icalproperty *uid;
|
||||
#ifndef WIN32
|
||||
#ifndef WIN32
|
||||
struct utsname unamebuf;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
icalerror_check_arg_rv( (store!=0), "store");
|
||||
icalerror_check_arg_rv( (comp!=0), "comp");
|
||||
@ -394,13 +394,13 @@ void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
|
||||
|
||||
if (uid == 0) {
|
||||
|
||||
#ifndef WIN32
|
||||
#ifndef WIN32
|
||||
uname(&unamebuf);
|
||||
|
||||
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
|
||||
#else
|
||||
sprintf(uidstring,"%d-%s",(int)getpid(),"WINDOWS"); /* FIX: There must be an easy get the system name */
|
||||
#endif
|
||||
|
||||
uid = icalproperty_new_uid(uidstring);
|
||||
icalcomponent_add_property(comp,uid);
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalfileset.c
|
||||
CREATOR: eric 23 December 1999
|
||||
|
||||
$Id: icalfileset.c,v 1.4 2002-02-27 21:04:07 mikep%oeone.com Exp $
|
||||
$Id: icalfileset.c,v 1.5 2002-03-14 15:17:56 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -34,26 +34,26 @@
|
||||
#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
|
||||
#ifndef WIN32
|
||||
#include <unistd.h> /* for stat, getpid */
|
||||
#else
|
||||
#include <io.h>
|
||||
#include <share.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h> /* for fcntl */
|
||||
#include "icalfilesetimpl.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
|
||||
#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
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
|
||||
#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
|
||||
|
||||
extern int errno;
|
||||
|
||||
@ -112,11 +112,11 @@ icalfileset* icalfileset_new_open(const char* path, int flags, mode_t mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
impl->fd = open(impl->path,flags, mode);
|
||||
#else
|
||||
impl->fd = sopen(impl->path,flags, _SH_DENYWR, _S_IREAD | _S_IWRITE);
|
||||
#endif
|
||||
#ifndef WIN32
|
||||
impl->fd = open(impl->path,flags, mode);
|
||||
#else
|
||||
impl->fd = sopen(impl->path,flags, _SH_DENYWR, _S_IREAD | _S_IWRITE);
|
||||
#endif
|
||||
|
||||
if (impl->fd < 0){
|
||||
icalerror_set_errno(ICAL_FILE_ERROR);
|
||||
@ -124,8 +124,8 @@ icalfileset* icalfileset_new_open(const char* path, int flags, mode_t mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
icalfileset_lock(impl);
|
||||
#ifndef WIN32
|
||||
icalfileset_lock(impl);
|
||||
#endif
|
||||
|
||||
if(cluster_file_size > 0 ){
|
||||
@ -270,7 +270,7 @@ const char* icalfileset_path(icalfileset* cluster)
|
||||
|
||||
|
||||
int icalfileset_lock(icalfileset *cluster)
|
||||
{
|
||||
{
|
||||
#ifndef WIN32
|
||||
struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
|
||||
struct flock lock;
|
||||
@ -285,14 +285,14 @@ int icalfileset_lock(icalfileset *cluster)
|
||||
|
||||
rtrn = fcntl(impl->fd, F_SETLKW, &lock);
|
||||
|
||||
return rtrn;
|
||||
#else
|
||||
return 0;
|
||||
return rtrn;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
int icalfileset_unlock(icalfileset *cluster)
|
||||
{
|
||||
{
|
||||
#ifndef WIN32
|
||||
struct icalfileset_impl *impl = (struct icalfileset_impl*)cluster;
|
||||
struct flock lock;
|
||||
@ -304,13 +304,13 @@ int icalfileset_unlock(icalfileset *cluster)
|
||||
lock.l_len = 0; /* #bytes (0 means to EOF) */
|
||||
|
||||
return (fcntl(impl->fd, F_UNLCK, &lock));
|
||||
#else
|
||||
return 0;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ICAL_SAFESAVES
|
||||
int icalfileset_safe_saves=0;
|
||||
int icalfileset_safe_saves=1;
|
||||
#else
|
||||
int icalfileset_safe_saves=0;
|
||||
#endif
|
||||
@ -334,7 +334,11 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
|
||||
}
|
||||
|
||||
if(icalfileset_safe_saves == 1){
|
||||
#ifndef WIN32
|
||||
snprintf(tmp,ICAL_PATH_MAX,"cp %s %s.bak",impl->path,impl->path);
|
||||
#else
|
||||
snprintf(tmp,ICAL_PATH_MAX,"copy %s %s.bak",impl->path,impl->path);
|
||||
#endif
|
||||
|
||||
if(system(tmp) < 0){
|
||||
icalerror_set_errno(ICAL_FILE_ERROR);
|
||||
@ -366,11 +370,11 @@ icalerrorenum icalfileset_commit(icalfileset* cluster)
|
||||
}
|
||||
|
||||
impl->changed = 0;
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
if(ftruncate(impl->fd,write_size) < 0){
|
||||
return ICAL_FILE_ERROR;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return ICAL_NO_ERROR;
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
CREATOR: eric 23 December 1999
|
||||
|
||||
|
||||
$Id: icalgauge.c,v 1.2 2001-12-21 18:56:37 mikep%oeone.com Exp $
|
||||
$Id: icalgauge.c,v 1.3 2002-03-14 15:17:57 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -94,8 +94,8 @@ void icalgauge_free(icalgauge* gauge)
|
||||
|
||||
if(impl->from){
|
||||
pvl_free(impl->from);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
free(impl);
|
||||
|
||||
}
|
||||
@ -318,7 +318,7 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
|
||||
local_pass = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this_clause = local_pass > 0 ? 1 : 0;
|
||||
|
||||
/* Now look at the logic operator for this clause to see how
|
||||
@ -331,10 +331,10 @@ int icalgauge_compare(icalgauge* gauge,icalcomponent* comp)
|
||||
} else {
|
||||
last_clause = this_clause;
|
||||
}
|
||||
|
||||
icalvalue_free(v);
|
||||
|
||||
icalvalue_free(v);
|
||||
}
|
||||
|
||||
|
||||
|
||||
return last_clause;
|
||||
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
FILE: icalspanlist.c
|
||||
CREATOR: ebusboom 23 aug 2000
|
||||
|
||||
$Id: icalspanlist.c,v 1.3 2001-12-21 18:56:38 mikep%oeone.com Exp $
|
||||
$Id: icalspanlist.c,v 1.4 2002-03-14 15:17:57 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -211,8 +211,8 @@ void icalspanlist_free(icalspanlist* s)
|
||||
|
||||
pvl_free(impl->spans);
|
||||
|
||||
impl->spans = 0;
|
||||
|
||||
impl->spans = 0;
|
||||
|
||||
free(impl);
|
||||
}
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
/* A lexical scanner generated by flex */
|
||||
|
||||
/* Scanner skeleton version:
|
||||
* $Header: /home/befator/cvs/jail/cvsroot/mozilla/other-licenses/libical/src/libicalss/Attic/icalsslexer.c,v 1.3 2001-12-21 18:56:39 mikep%oeone.com Exp $
|
||||
* $Header: /home/befator/cvs/jail/cvsroot/mozilla/other-licenses/libical/src/libicalss/Attic/icalsslexer.c,v 1.4 2002-03-14 15:17:57 mikep%oeone.com Exp $
|
||||
*/
|
||||
|
||||
#define FLEX_SCANNER
|
||||
@ -27,8 +27,8 @@
|
||||
#define YY_FLEX_MINOR_VERSION 5
|
||||
|
||||
#include <stdio.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#ifndef WIN32
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
|
||||
@ -425,7 +425,7 @@ char *yytext_ptr;
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: icalsslexer.c,v 1.3 2001-12-21 18:56:39 mikep%oeone.com Exp $
|
||||
$Id: icalsslexer.c,v 1.4 2002-03-14 15:17:57 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
FILE: icalvcal.c
|
||||
CREATOR: eric 25 May 00
|
||||
|
||||
$Id: icalvcal.c,v 1.3 2001-12-21 18:56:46 mikep%oeone.com Exp $
|
||||
$Id: icalvcal.c,v 1.4 2002-03-14 15:17:59 mikep%oeone.com Exp $
|
||||
|
||||
|
||||
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
|
||||
@ -41,11 +41,11 @@
|
||||
|
||||
#include "icalvcal.h"
|
||||
#include <string.h>
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
enum datatype {
|
||||
COMPONENT,
|
||||
|
||||
@ -1,118 +1,118 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "vcaltmp.h"
|
||||
|
||||
#if 0
|
||||
This testcase would generate a file call "frankcal.vcf" with
|
||||
the following content:
|
||||
|
||||
BEGIN:VCALENDAR
|
||||
DCREATED:19960523T100522
|
||||
GEO:37.24,-17.87
|
||||
PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
|
||||
VERSION:0.3
|
||||
BEGIN:VEVENT
|
||||
DTSTART:19960523T120000
|
||||
DTEND:19960523T130000
|
||||
DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
|
||||
With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
|
||||
activities with European Press representatives.
|
||||
SUMMARY:VERSIT PDI PR Teleconference/Interview
|
||||
SUBTYPE:PHONE CALL
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:19960523T100522-4000F100582713-009251
|
||||
UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
|
||||
DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
|
||||
MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
|
||||
PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
|
||||
X-LDC-OR2-OLE:c:\temp\agenda.doc
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VTODO
|
||||
DUE:19960614T0173000
|
||||
DESCRIPTION:Review VCalendar helper API.
|
||||
END:VTODO
|
||||
|
||||
END:VCALENDAR
|
||||
|
||||
#endif
|
||||
|
||||
FILE *cfp;
|
||||
|
||||
void testVcalAPIs() {
|
||||
FILE *fp;
|
||||
VObject *vcal, *vevent;
|
||||
#if _CONSOLE
|
||||
cfp = stdout;
|
||||
#else
|
||||
cfp = fopen("vcaltest.out","w");
|
||||
#endif
|
||||
if (cfp == 0) return;
|
||||
vcal = vcsCreateVCal(
|
||||
"19960523T100522",
|
||||
"37.24,-17.87",
|
||||
"-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
|
||||
0,
|
||||
"0.3"
|
||||
);
|
||||
|
||||
vevent = vcsAddEvent(
|
||||
vcal,
|
||||
"19960523T120000",
|
||||
"19960523T130000",
|
||||
"VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
|
||||
"VERSIT PDI PR Teleconference/Interview",
|
||||
"PHONE CALL",
|
||||
0,
|
||||
"CONFIRMED",
|
||||
"19960523T100522-4000F100582713-009251",
|
||||
"http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
|
||||
0
|
||||
);
|
||||
|
||||
vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
|
||||
"Your Telecon Starts At Noon!!!");
|
||||
vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
|
||||
"Remember 05/23 Noon Telecon!!!");
|
||||
vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
|
||||
"c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
|
||||
|
||||
addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
|
||||
|
||||
vcsAddTodo(
|
||||
vcal,
|
||||
0,
|
||||
"19960614T0173000",
|
||||
0,
|
||||
"Review VCalendar helper API.",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
/* now do something to the resulting VObject */
|
||||
/* pretty print on stdout for fun */
|
||||
printVObject(cfp,vcal);
|
||||
/* open the output text file */
|
||||
|
||||
#define OUTFILE "frankcal.vcf"
|
||||
|
||||
fp = fopen(OUTFILE, "w");
|
||||
if (fp) {
|
||||
/* write it in text form */
|
||||
writeVObject(fp,vcal);
|
||||
fclose(fp);
|
||||
}
|
||||
else {
|
||||
fprintf(cfp,"open output file '%s' failed\n", OUTFILE);
|
||||
}
|
||||
if (cfp != stdout) fclose(cfp);
|
||||
}
|
||||
|
||||
void main() {
|
||||
testVcalAPIs();
|
||||
}
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "vcaltmp.h"
|
||||
|
||||
#if 0
|
||||
This testcase would generate a file call "frankcal.vcf" with
|
||||
the following content:
|
||||
|
||||
BEGIN:VCALENDAR
|
||||
DCREATED:19960523T100522
|
||||
GEO:37.24,-17.87
|
||||
PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
|
||||
VERSION:0.3
|
||||
BEGIN:VEVENT
|
||||
DTSTART:19960523T120000
|
||||
DTEND:19960523T130000
|
||||
DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
|
||||
With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
|
||||
activities with European Press representatives.
|
||||
SUMMARY:VERSIT PDI PR Teleconference/Interview
|
||||
SUBTYPE:PHONE CALL
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:19960523T100522-4000F100582713-009251
|
||||
UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
|
||||
DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
|
||||
MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
|
||||
PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
|
||||
X-LDC-OR2-OLE:c:\temp\agenda.doc
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VTODO
|
||||
DUE:19960614T0173000
|
||||
DESCRIPTION:Review VCalendar helper API.
|
||||
END:VTODO
|
||||
|
||||
END:VCALENDAR
|
||||
|
||||
#endif
|
||||
|
||||
FILE *cfp;
|
||||
|
||||
void testVcalAPIs() {
|
||||
FILE *fp;
|
||||
VObject *vcal, *vevent;
|
||||
#if _CONSOLE
|
||||
cfp = stdout;
|
||||
#else
|
||||
cfp = fopen("vcaltest.out","w");
|
||||
#endif
|
||||
if (cfp == 0) return;
|
||||
vcal = vcsCreateVCal(
|
||||
"19960523T100522",
|
||||
"37.24,-17.87",
|
||||
"-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
|
||||
0,
|
||||
"0.3"
|
||||
);
|
||||
|
||||
vevent = vcsAddEvent(
|
||||
vcal,
|
||||
"19960523T120000",
|
||||
"19960523T130000",
|
||||
"VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
|
||||
"VERSIT PDI PR Teleconference/Interview",
|
||||
"PHONE CALL",
|
||||
0,
|
||||
"CONFIRMED",
|
||||
"19960523T100522-4000F100582713-009251",
|
||||
"http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
|
||||
0
|
||||
);
|
||||
|
||||
vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
|
||||
"Your Telecon Starts At Noon!!!");
|
||||
vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
|
||||
"Remember 05/23 Noon Telecon!!!");
|
||||
vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
|
||||
"c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
|
||||
|
||||
addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
|
||||
|
||||
vcsAddTodo(
|
||||
vcal,
|
||||
0,
|
||||
"19960614T0173000",
|
||||
0,
|
||||
"Review VCalendar helper API.",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
/* now do something to the resulting VObject */
|
||||
/* pretty print on stdout for fun */
|
||||
printVObject(cfp,vcal);
|
||||
/* open the output text file */
|
||||
|
||||
#define OUTFILE "frankcal.vcf"
|
||||
|
||||
fp = fopen(OUTFILE, "w");
|
||||
if (fp) {
|
||||
/* write it in text form */
|
||||
writeVObject(fp,vcal);
|
||||
fclose(fp);
|
||||
}
|
||||
else {
|
||||
fprintf(cfp,"open output file '%s' failed\n", OUTFILE);
|
||||
}
|
||||
if (cfp != stdout) fclose(cfp);
|
||||
}
|
||||
|
||||
void main() {
|
||||
testVcalAPIs();
|
||||
}
|
||||
|
||||
|
||||
@ -1,337 +1,337 @@
|
||||
/*
|
||||
This module provides some helper APIs for creating
|
||||
a VCalendar object.
|
||||
|
||||
Note on APIs:
|
||||
1. The APIs does not attempt to verify if the arguments
|
||||
passed are correct.
|
||||
2. Where the argument to an API is not applicable, pass
|
||||
the value 0.
|
||||
3. See the test program at the bottom of this file as an
|
||||
example of usage.
|
||||
4. This code calls APIs in vobject.c.
|
||||
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "vcaltmp.h"
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsCreateVCal(
|
||||
char *date_created,
|
||||
char *location,
|
||||
char *product_id,
|
||||
char *time_zone,
|
||||
char *version
|
||||
)
|
||||
{
|
||||
VObject *vcal = newVObject(VCCalProp);
|
||||
#define Z(p,v) if (v) addPropValue(vcal,p,v);
|
||||
Z(VCDCreatedProp, date_created);
|
||||
Z(VCLocationProp, location)
|
||||
Z(VCProdIdProp, product_id)
|
||||
Z(VCTimeZoneProp, time_zone)
|
||||
Z(VCVersionProp, version)
|
||||
#undef Z
|
||||
return vcal;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddEvent(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *end_date_time,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *categories,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *transparency,
|
||||
char *uid,
|
||||
char *url
|
||||
)
|
||||
{
|
||||
VObject *vevent = addProp(vcal,VCEventProp);
|
||||
#define Z(p,v) if (v) addPropValue(vevent,p,v);
|
||||
Z(VCDTstartProp,start_date_time);
|
||||
Z(VCDTendProp,end_date_time);
|
||||
if (description) {
|
||||
VObject *p = addPropValue(vevent,VCDescriptionProp,description);
|
||||
if (strchr(description,'\n'))
|
||||
addProp(p,VCQuotedPrintableProp);
|
||||
}
|
||||
Z(VCSummaryProp,summary);
|
||||
Z(VCCategoriesProp,categories);
|
||||
Z(VCClassProp,classification);
|
||||
Z(VCStatusProp,status);
|
||||
Z(VCTranspProp,transparency);
|
||||
Z(VCUniqueStringProp,uid);
|
||||
Z(VCURLProp,url);
|
||||
#undef Z
|
||||
return vevent;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddTodo(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *due_date_time,
|
||||
char *date_time_complete,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *priority,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *uid,
|
||||
char *url
|
||||
)
|
||||
{
|
||||
VObject *vtodo = addProp(vcal,VCTodoProp);
|
||||
#define Z(p,v) if (v) addPropValue(vtodo,p,v);
|
||||
Z(VCDTstartProp,start_date_time);
|
||||
Z(VCDueProp,due_date_time);
|
||||
Z(VCCompletedProp,date_time_complete);
|
||||
if (description) {
|
||||
VObject *p = addPropValue(vtodo,VCDescriptionProp,description);
|
||||
if (strchr(description,'\n'))
|
||||
addProp(p,VCQuotedPrintableProp);
|
||||
}
|
||||
Z(VCSummaryProp,summary);
|
||||
Z(VCPriorityProp,priority);
|
||||
Z(VCClassProp,classification);
|
||||
Z(VCStatusProp,status);
|
||||
Z(VCUniqueStringProp,uid);
|
||||
Z(VCURLProp,url);
|
||||
#undef Z
|
||||
return vtodo;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddAAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *audio_content
|
||||
)
|
||||
{
|
||||
VObject *aalarm= addProp(vevent,VCAAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(aalarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCAudioContentProp,audio_content);
|
||||
#undef Z
|
||||
return aalarm;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddMAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *email_address,
|
||||
char *note
|
||||
)
|
||||
{
|
||||
VObject *malarm= addProp(vevent,VCMAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(malarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCEmailAddressProp,email_address);
|
||||
Z(VCNoteProp,note);
|
||||
#undef Z
|
||||
return malarm;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddDAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *display_string
|
||||
)
|
||||
{
|
||||
VObject *dalarm= addProp(vevent,VCDAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(dalarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCDisplayStringProp,display_string);
|
||||
#undef Z
|
||||
return dalarm;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddPAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *procedure_name
|
||||
)
|
||||
{
|
||||
VObject *palarm= addProp(vevent,VCPAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(palarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCProcedureNameProp,procedure_name);
|
||||
#undef Z
|
||||
return palarm;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _TEST
|
||||
|
||||
#if 0
|
||||
This testcase would generate a file call "frankcal.vcf" with
|
||||
the following content:
|
||||
|
||||
BEGIN:VCALENDAR
|
||||
DCREATED:19960523T100522
|
||||
GEO:37.24,-17.87
|
||||
PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
|
||||
VERSION:0.3
|
||||
BEGIN:VEVENT
|
||||
DTSTART:19960523T120000
|
||||
DTEND:19960523T130000
|
||||
DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
|
||||
With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
|
||||
activities with European Press representatives.
|
||||
SUMMARY:VERSIT PDI PR Teleconference/Interview
|
||||
CATEGORIES:PHONE CALL
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:19960523T100522-4000F100582713-009251
|
||||
UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
|
||||
DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
|
||||
MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
|
||||
PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
|
||||
X-LDC-OR2-OLE:c:\temp\agenda.doc
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VTODO
|
||||
DUE:19960614T0173000
|
||||
DESCRIPTION:Review VCalendar helper API.
|
||||
END:VTODO
|
||||
|
||||
END:VCALENDAR
|
||||
|
||||
#endif
|
||||
|
||||
void testVcalAPIs() {
|
||||
FILE *fp;
|
||||
VObject *vcal = vcsCreateVCal(
|
||||
"19960523T100522",
|
||||
"37.24,-17.87",
|
||||
"-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
|
||||
0,
|
||||
"0.3"
|
||||
);
|
||||
|
||||
VObject *vevent = vcsAddEvent(
|
||||
vcal,
|
||||
"19960523T120000",
|
||||
"19960523T130000",
|
||||
"VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
|
||||
"VERSIT PDI PR Teleconference/Interview",
|
||||
"PHONE CALL",
|
||||
0,
|
||||
"CONFIRMED",
|
||||
"19960523T100522-4000F100582713-009251",
|
||||
"http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
|
||||
0
|
||||
);
|
||||
|
||||
vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
|
||||
"Your Telecon Starts At Noon!!!");
|
||||
vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
|
||||
"Remember 05/23 Noon Telecon!!!");
|
||||
vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
|
||||
"c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
|
||||
|
||||
addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
|
||||
|
||||
vcsAddTodo(
|
||||
vcal,
|
||||
0,
|
||||
"19960614T0173000",
|
||||
0,
|
||||
"Review VCalendar helper API.",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
/* now do something to the resulting VObject */
|
||||
/* pretty print on stdout for fun */
|
||||
printVObject(vcal);
|
||||
/* open the output text file */
|
||||
|
||||
#define OUTFILE "frankcal.vcf"
|
||||
|
||||
fp = fopen(OUTFILE, "w");
|
||||
if (fp) {
|
||||
/* write it in text form */
|
||||
writeVObject(fp,vcal);
|
||||
fclose(fp);
|
||||
}
|
||||
else {
|
||||
printf("open output file '%s' failed\n", OUTFILE);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
testVcalAPIs();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* end of source file vcaltmp.c */
|
||||
/*
|
||||
This module provides some helper APIs for creating
|
||||
a VCalendar object.
|
||||
|
||||
Note on APIs:
|
||||
1. The APIs does not attempt to verify if the arguments
|
||||
passed are correct.
|
||||
2. Where the argument to an API is not applicable, pass
|
||||
the value 0.
|
||||
3. See the test program at the bottom of this file as an
|
||||
example of usage.
|
||||
4. This code calls APIs in vobject.c.
|
||||
|
||||
*/
|
||||
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "vcaltmp.h"
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsCreateVCal(
|
||||
char *date_created,
|
||||
char *location,
|
||||
char *product_id,
|
||||
char *time_zone,
|
||||
char *version
|
||||
)
|
||||
{
|
||||
VObject *vcal = newVObject(VCCalProp);
|
||||
#define Z(p,v) if (v) addPropValue(vcal,p,v);
|
||||
Z(VCDCreatedProp, date_created);
|
||||
Z(VCLocationProp, location)
|
||||
Z(VCProdIdProp, product_id)
|
||||
Z(VCTimeZoneProp, time_zone)
|
||||
Z(VCVersionProp, version)
|
||||
#undef Z
|
||||
return vcal;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddEvent(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *end_date_time,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *categories,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *transparency,
|
||||
char *uid,
|
||||
char *url
|
||||
)
|
||||
{
|
||||
VObject *vevent = addProp(vcal,VCEventProp);
|
||||
#define Z(p,v) if (v) addPropValue(vevent,p,v);
|
||||
Z(VCDTstartProp,start_date_time);
|
||||
Z(VCDTendProp,end_date_time);
|
||||
if (description) {
|
||||
VObject *p = addPropValue(vevent,VCDescriptionProp,description);
|
||||
if (strchr(description,'\n'))
|
||||
addProp(p,VCQuotedPrintableProp);
|
||||
}
|
||||
Z(VCSummaryProp,summary);
|
||||
Z(VCCategoriesProp,categories);
|
||||
Z(VCClassProp,classification);
|
||||
Z(VCStatusProp,status);
|
||||
Z(VCTranspProp,transparency);
|
||||
Z(VCUniqueStringProp,uid);
|
||||
Z(VCURLProp,url);
|
||||
#undef Z
|
||||
return vevent;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddTodo(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *due_date_time,
|
||||
char *date_time_complete,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *priority,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *uid,
|
||||
char *url
|
||||
)
|
||||
{
|
||||
VObject *vtodo = addProp(vcal,VCTodoProp);
|
||||
#define Z(p,v) if (v) addPropValue(vtodo,p,v);
|
||||
Z(VCDTstartProp,start_date_time);
|
||||
Z(VCDueProp,due_date_time);
|
||||
Z(VCCompletedProp,date_time_complete);
|
||||
if (description) {
|
||||
VObject *p = addPropValue(vtodo,VCDescriptionProp,description);
|
||||
if (strchr(description,'\n'))
|
||||
addProp(p,VCQuotedPrintableProp);
|
||||
}
|
||||
Z(VCSummaryProp,summary);
|
||||
Z(VCPriorityProp,priority);
|
||||
Z(VCClassProp,classification);
|
||||
Z(VCStatusProp,status);
|
||||
Z(VCUniqueStringProp,uid);
|
||||
Z(VCURLProp,url);
|
||||
#undef Z
|
||||
return vtodo;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddAAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *audio_content
|
||||
)
|
||||
{
|
||||
VObject *aalarm= addProp(vevent,VCAAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(aalarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCAudioContentProp,audio_content);
|
||||
#undef Z
|
||||
return aalarm;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddMAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *email_address,
|
||||
char *note
|
||||
)
|
||||
{
|
||||
VObject *malarm= addProp(vevent,VCMAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(malarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCEmailAddressProp,email_address);
|
||||
Z(VCNoteProp,note);
|
||||
#undef Z
|
||||
return malarm;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddDAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *display_string
|
||||
)
|
||||
{
|
||||
VObject *dalarm= addProp(vevent,VCDAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(dalarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCDisplayStringProp,display_string);
|
||||
#undef Z
|
||||
return dalarm;
|
||||
}
|
||||
|
||||
|
||||
DLLEXPORT(VObject*) vcsAddPAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *procedure_name
|
||||
)
|
||||
{
|
||||
VObject *palarm= addProp(vevent,VCPAlarmProp);
|
||||
#define Z(p,v) if (v) addPropValue(palarm,p,v);
|
||||
Z(VCRunTimeProp,run_time);
|
||||
Z(VCSnoozeTimeProp,snooze_time);
|
||||
Z(VCRepeatCountProp,repeat_count);
|
||||
Z(VCProcedureNameProp,procedure_name);
|
||||
#undef Z
|
||||
return palarm;
|
||||
}
|
||||
|
||||
|
||||
#ifdef _TEST
|
||||
|
||||
#if 0
|
||||
This testcase would generate a file call "frankcal.vcf" with
|
||||
the following content:
|
||||
|
||||
BEGIN:VCALENDAR
|
||||
DCREATED:19960523T100522
|
||||
GEO:37.24,-17.87
|
||||
PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN
|
||||
VERSION:0.3
|
||||
BEGIN:VEVENT
|
||||
DTSTART:19960523T120000
|
||||
DTEND:19960523T130000
|
||||
DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A=
|
||||
With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A=
|
||||
activities with European Press representatives.
|
||||
SUMMARY:VERSIT PDI PR Teleconference/Interview
|
||||
CATEGORIES:PHONE CALL
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:19960523T100522-4000F100582713-009251
|
||||
UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2
|
||||
DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!;
|
||||
MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!;
|
||||
PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2;
|
||||
X-LDC-OR2-OLE:c:\temp\agenda.doc
|
||||
END:VEVENT
|
||||
|
||||
BEGIN:VTODO
|
||||
DUE:19960614T0173000
|
||||
DESCRIPTION:Review VCalendar helper API.
|
||||
END:VTODO
|
||||
|
||||
END:VCALENDAR
|
||||
|
||||
#endif
|
||||
|
||||
void testVcalAPIs() {
|
||||
FILE *fp;
|
||||
VObject *vcal = vcsCreateVCal(
|
||||
"19960523T100522",
|
||||
"37.24,-17.87",
|
||||
"-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN",
|
||||
0,
|
||||
"0.3"
|
||||
);
|
||||
|
||||
VObject *vevent = vcsAddEvent(
|
||||
vcal,
|
||||
"19960523T120000",
|
||||
"19960523T130000",
|
||||
"VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.",
|
||||
"VERSIT PDI PR Teleconference/Interview",
|
||||
"PHONE CALL",
|
||||
0,
|
||||
"CONFIRMED",
|
||||
"19960523T100522-4000F100582713-009251",
|
||||
"http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2",
|
||||
0
|
||||
);
|
||||
|
||||
vcsAddDAlarm(vevent, "19960523T114500", "5", "3",
|
||||
"Your Telecon Starts At Noon!!!");
|
||||
vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com",
|
||||
"Remember 05/23 Noon Telecon!!!");
|
||||
vcsAddPAlarm(vevent, "19960523T115500", 0 ,0,
|
||||
"c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2");
|
||||
|
||||
addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc");
|
||||
|
||||
vcsAddTodo(
|
||||
vcal,
|
||||
0,
|
||||
"19960614T0173000",
|
||||
0,
|
||||
"Review VCalendar helper API.",
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
);
|
||||
|
||||
/* now do something to the resulting VObject */
|
||||
/* pretty print on stdout for fun */
|
||||
printVObject(vcal);
|
||||
/* open the output text file */
|
||||
|
||||
#define OUTFILE "frankcal.vcf"
|
||||
|
||||
fp = fopen(OUTFILE, "w");
|
||||
if (fp) {
|
||||
/* write it in text form */
|
||||
writeVObject(fp,vcal);
|
||||
fclose(fp);
|
||||
}
|
||||
else {
|
||||
printf("open output file '%s' failed\n", OUTFILE);
|
||||
}
|
||||
}
|
||||
|
||||
void main() {
|
||||
testVcalAPIs();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* end of source file vcaltmp.c */
|
||||
|
||||
@ -1,128 +1,128 @@
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "vcc.h"
|
||||
|
||||
#ifndef __VCALTMP_H__
|
||||
#define __VCALTMP_H__
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsCreateVCal(
|
||||
char *date_created,
|
||||
char *location,
|
||||
char *product_id,
|
||||
char *time_zone,
|
||||
char *version
|
||||
);
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddEvent(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *end_date_time,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *categories,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *transparency,
|
||||
char *uid,
|
||||
char *url
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddTodo(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *due_date_time,
|
||||
char *date_time_complete,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *priority,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *uid,
|
||||
char *url
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddAAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *audio_content
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddMAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *email_address,
|
||||
char *note
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddDAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *display_string
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddPAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *procedure_name
|
||||
);
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __VCALTMP_H__ */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#include "vcc.h"
|
||||
|
||||
#ifndef __VCALTMP_H__
|
||||
#define __VCALTMP_H__
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsCreateVCal(
|
||||
char *date_created,
|
||||
char *location,
|
||||
char *product_id,
|
||||
char *time_zone,
|
||||
char *version
|
||||
);
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddEvent(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *end_date_time,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *categories,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *transparency,
|
||||
char *uid,
|
||||
char *url
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddTodo(
|
||||
VObject *vcal,
|
||||
char *start_date_time,
|
||||
char *due_date_time,
|
||||
char *date_time_complete,
|
||||
char *description,
|
||||
char *summary,
|
||||
char *priority,
|
||||
char *classification,
|
||||
char *status,
|
||||
char *uid,
|
||||
char *url
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddAAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *audio_content
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddMAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *email_address,
|
||||
char *note
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddDAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *display_string
|
||||
);
|
||||
|
||||
|
||||
extern DLLEXPORT(VObject*) vcsAddPAlarm(
|
||||
VObject *vevent,
|
||||
char *run_time,
|
||||
char *snooze_time,
|
||||
char *repeat_count,
|
||||
char *procedure_name
|
||||
);
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __VCALTMP_H__ */
|
||||
|
||||
|
||||
|
||||
@ -23,11 +23,6 @@
|
||||
#define ID 273
|
||||
#define STRING 274
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#line 1 "vcc.y"
|
||||
|
||||
|
||||
@ -87,6 +82,11 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
#define DBG_(x)
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
/**** External Functions ****/
|
||||
|
||||
/* assign local name to parser variables and functions so that
|
||||
@ -201,7 +201,7 @@ static void enterValues(const char *value);
|
||||
static void mime_error_(char *s);
|
||||
|
||||
|
||||
#line 178 "vcc.y"
|
||||
#line 183 "vcc.y"
|
||||
typedef union {
|
||||
char *str;
|
||||
VObject *vobj;
|
||||
@ -281,11 +281,11 @@ static const short yyrhs[] = { 22,
|
||||
|
||||
#if YYDEBUG != 0
|
||||
static const short yyrline[] = { 0,
|
||||
206, 209, 212, 212, 216, 217, 220, 226, 231, 237,
|
||||
243, 244, 247, 251, 257, 260, 265, 265, 271, 272,
|
||||
275, 278, 282, 289, 292, 293, 293, 297, 298, 301,
|
||||
305, 307, 310, 313, 314, 317, 319, 320, 323, 330,
|
||||
335, 341, 347, 354, 359, 365
|
||||
211, 214, 217, 217, 221, 222, 225, 231, 236, 242,
|
||||
248, 249, 252, 256, 262, 265, 270, 270, 276, 277,
|
||||
280, 283, 287, 294, 297, 298, 298, 302, 303, 306,
|
||||
310, 312, 315, 318, 319, 322, 324, 325, 328, 335,
|
||||
340, 346, 352, 359, 364, 370
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -915,49 +915,49 @@ yyreduce:
|
||||
switch (yyn) {
|
||||
|
||||
case 2:
|
||||
#line 210 "vcc.y"
|
||||
#line 215 "vcc.y"
|
||||
{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ;
|
||||
break;}
|
||||
case 4:
|
||||
#line 213 "vcc.y"
|
||||
#line 218 "vcc.y"
|
||||
{ addList(&vObjList, yyvsp[0].vobj); curObj = 0; ;
|
||||
break;}
|
||||
case 7:
|
||||
#line 222 "vcc.y"
|
||||
#line 227 "vcc.y"
|
||||
{
|
||||
lexPushMode(L_VCARD);
|
||||
if (!pushVObject(VCCardProp)) YYERROR;
|
||||
;
|
||||
break;}
|
||||
case 8:
|
||||
#line 227 "vcc.y"
|
||||
#line 232 "vcc.y"
|
||||
{
|
||||
lexPopMode(0);
|
||||
yyval.vobj = popVObject();
|
||||
;
|
||||
break;}
|
||||
case 9:
|
||||
#line 232 "vcc.y"
|
||||
#line 237 "vcc.y"
|
||||
{
|
||||
lexPushMode(L_VCARD);
|
||||
if (!pushVObject(VCCardProp)) YYERROR;
|
||||
;
|
||||
break;}
|
||||
case 10:
|
||||
#line 237 "vcc.y"
|
||||
#line 242 "vcc.y"
|
||||
{
|
||||
lexPopMode(0);
|
||||
yyval.vobj = popVObject();
|
||||
;
|
||||
break;}
|
||||
case 13:
|
||||
#line 248 "vcc.y"
|
||||
#line 253 "vcc.y"
|
||||
{
|
||||
lexPushMode(L_VALUES);
|
||||
;
|
||||
break;}
|
||||
case 14:
|
||||
#line 252 "vcc.y"
|
||||
#line 257 "vcc.y"
|
||||
{
|
||||
if (lexWithinMode(L_BASE64) || lexWithinMode(L_QUOTED_PRINTABLE))
|
||||
lexPopMode(0);
|
||||
@ -965,109 +965,109 @@ case 14:
|
||||
;
|
||||
break;}
|
||||
case 16:
|
||||
#line 261 "vcc.y"
|
||||
{
|
||||
enterProps(yyvsp[0].str);
|
||||
;
|
||||
break;}
|
||||
case 18:
|
||||
#line 266 "vcc.y"
|
||||
{
|
||||
enterProps(yyvsp[0].str);
|
||||
;
|
||||
break;}
|
||||
case 18:
|
||||
#line 271 "vcc.y"
|
||||
{
|
||||
enterProps(yyvsp[0].str);
|
||||
;
|
||||
break;}
|
||||
case 22:
|
||||
#line 279 "vcc.y"
|
||||
#line 284 "vcc.y"
|
||||
{
|
||||
enterAttr(yyvsp[0].str,0);
|
||||
;
|
||||
break;}
|
||||
case 23:
|
||||
#line 283 "vcc.y"
|
||||
#line 288 "vcc.y"
|
||||
{
|
||||
enterAttr(yyvsp[-2].str,yyvsp[0].str);
|
||||
|
||||
;
|
||||
break;}
|
||||
case 25:
|
||||
#line 292 "vcc.y"
|
||||
#line 297 "vcc.y"
|
||||
{ enterValues(yyvsp[-1].str); ;
|
||||
break;}
|
||||
case 27:
|
||||
#line 294 "vcc.y"
|
||||
#line 299 "vcc.y"
|
||||
{ enterValues(yyvsp[0].str); ;
|
||||
break;}
|
||||
case 29:
|
||||
#line 298 "vcc.y"
|
||||
#line 303 "vcc.y"
|
||||
{ yyval.str = 0; ;
|
||||
break;}
|
||||
case 30:
|
||||
#line 303 "vcc.y"
|
||||
{ if (!pushVObject(VCCalProp)) YYERROR; ;
|
||||
break;}
|
||||
case 31:
|
||||
#line 306 "vcc.y"
|
||||
{ yyval.vobj = popVObject(); ;
|
||||
break;}
|
||||
case 32:
|
||||
#line 308 "vcc.y"
|
||||
{ if (!pushVObject(VCCalProp)) YYERROR; ;
|
||||
break;}
|
||||
case 31:
|
||||
#line 311 "vcc.y"
|
||||
{ yyval.vobj = popVObject(); ;
|
||||
break;}
|
||||
case 32:
|
||||
#line 313 "vcc.y"
|
||||
{ if (!pushVObject(VCCalProp)) YYERROR; ;
|
||||
break;}
|
||||
case 33:
|
||||
#line 310 "vcc.y"
|
||||
#line 315 "vcc.y"
|
||||
{ yyval.vobj = popVObject(); ;
|
||||
break;}
|
||||
case 39:
|
||||
#line 325 "vcc.y"
|
||||
#line 330 "vcc.y"
|
||||
{
|
||||
lexPushMode(L_VEVENT);
|
||||
if (!pushVObject(VCEventProp)) YYERROR;
|
||||
;
|
||||
break;}
|
||||
case 40:
|
||||
#line 331 "vcc.y"
|
||||
#line 336 "vcc.y"
|
||||
{
|
||||
lexPopMode(0);
|
||||
popVObject();
|
||||
;
|
||||
break;}
|
||||
case 41:
|
||||
#line 336 "vcc.y"
|
||||
#line 341 "vcc.y"
|
||||
{
|
||||
lexPushMode(L_VEVENT);
|
||||
if (!pushVObject(VCEventProp)) YYERROR;
|
||||
;
|
||||
break;}
|
||||
case 42:
|
||||
#line 341 "vcc.y"
|
||||
#line 346 "vcc.y"
|
||||
{
|
||||
lexPopMode(0);
|
||||
popVObject();
|
||||
;
|
||||
break;}
|
||||
case 43:
|
||||
#line 349 "vcc.y"
|
||||
#line 354 "vcc.y"
|
||||
{
|
||||
lexPushMode(L_VTODO);
|
||||
if (!pushVObject(VCTodoProp)) YYERROR;
|
||||
;
|
||||
break;}
|
||||
case 44:
|
||||
#line 355 "vcc.y"
|
||||
#line 360 "vcc.y"
|
||||
{
|
||||
lexPopMode(0);
|
||||
popVObject();
|
||||
;
|
||||
break;}
|
||||
case 45:
|
||||
#line 360 "vcc.y"
|
||||
#line 365 "vcc.y"
|
||||
{
|
||||
lexPushMode(L_VTODO);
|
||||
if (!pushVObject(VCTodoProp)) YYERROR;
|
||||
;
|
||||
break;}
|
||||
case 46:
|
||||
#line 365 "vcc.y"
|
||||
#line 370 "vcc.y"
|
||||
{
|
||||
lexPopMode(0);
|
||||
popVObject();
|
||||
@ -1295,7 +1295,7 @@ yyerrhandle:
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
#line 371 "vcc.y"
|
||||
#line 376 "vcc.y"
|
||||
|
||||
static int pushVObject(const char *prop)
|
||||
{
|
||||
|
||||
@ -1,80 +1,80 @@
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __VCC_H__
|
||||
#define __VCC_H__ 1
|
||||
|
||||
#include "vobject.h"
|
||||
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*MimeErrorHandler)(char *);
|
||||
|
||||
extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler);
|
||||
|
||||
extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len);
|
||||
extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname);
|
||||
|
||||
|
||||
/* NOTE regarding Parse_MIME_FromFile
|
||||
The function above, Parse_MIME_FromFile, comes in two flavors,
|
||||
neither of which is exported from the DLL. Each version takes
|
||||
a CFile or FILE* as a parameter, neither of which can be
|
||||
passed across a DLL interface (at least that is my experience).
|
||||
If you are linking this code into your build directly then
|
||||
you may find them a more convenient API that the other flavors
|
||||
that take a file name. If you use them with the DLL LIB you
|
||||
will get a link error.
|
||||
*/
|
||||
|
||||
|
||||
#if INCLUDEMFC
|
||||
extern VObject* Parse_MIME_FromFile(CFile *file);
|
||||
#else
|
||||
extern VObject* Parse_MIME_FromFile(FILE *file);
|
||||
#endif
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __VCC_H__ */
|
||||
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef __VCC_H__
|
||||
#define __VCC_H__ 1
|
||||
|
||||
#include "vobject.h"
|
||||
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef void (*MimeErrorHandler)(char *);
|
||||
|
||||
extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler);
|
||||
|
||||
extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len);
|
||||
extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname);
|
||||
|
||||
|
||||
/* NOTE regarding Parse_MIME_FromFile
|
||||
The function above, Parse_MIME_FromFile, comes in two flavors,
|
||||
neither of which is exported from the DLL. Each version takes
|
||||
a CFile or FILE* as a parameter, neither of which can be
|
||||
passed across a DLL interface (at least that is my experience).
|
||||
If you are linking this code into your build directly then
|
||||
you may find them a more convenient API that the other flavors
|
||||
that take a file name. If you use them with the DLL LIB you
|
||||
will get a link error.
|
||||
*/
|
||||
|
||||
|
||||
#if INCLUDEMFC
|
||||
extern VObject* Parse_MIME_FromFile(CFile *file);
|
||||
#else
|
||||
extern VObject* Parse_MIME_FromFile(FILE *file);
|
||||
#endif
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __VCC_H__ */
|
||||
|
||||
|
||||
@ -56,6 +56,11 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
#define DBG_(x)
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
/**** External Functions ****/
|
||||
|
||||
/* assign local name to parser variables and functions so that
|
||||
|
||||
@ -1,95 +1,95 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "vcc.h"
|
||||
|
||||
FILE *cfp;
|
||||
|
||||
void myMimeErrorHandler(char *s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
}
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
int testmem = 0;
|
||||
|
||||
char * foo[2] = {"foo","alden.vcf"};
|
||||
|
||||
argc = 2;
|
||||
argv = foo;
|
||||
|
||||
#ifdef _CONSOLE
|
||||
cfp = stdout;
|
||||
registerMimeErrorHandler(myMimeErrorHandler);
|
||||
#else
|
||||
cfp = fopen("vctest.out", "w");
|
||||
if (!cfp) return;
|
||||
#endif
|
||||
++argv;
|
||||
while (--argc) {
|
||||
FILE *fp;
|
||||
if (strcmp(*argv,"-testmem") == 0) {
|
||||
testmem = 1;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
fprintf(cfp,"processing %s\n",*argv);
|
||||
fp = fopen(*argv,"r");
|
||||
if (!fp) {
|
||||
fprintf(cfp,"error opening file\n");
|
||||
}
|
||||
else {
|
||||
VObject *v, *t;
|
||||
FILE *ofp;
|
||||
char buf[256];
|
||||
char *p;
|
||||
strcpy(buf,*argv);
|
||||
p = strchr(buf,'.');
|
||||
if (p) *p = 0;
|
||||
strcat(buf,".out");
|
||||
fprintf(cfp,"reading text input from '%s'...\n", *argv);
|
||||
/*v = Parse_MIME_FromFile(fp); */
|
||||
v = Parse_MIME_FromFileName(*argv);
|
||||
writeVObjectToFile(buf,v);
|
||||
cleanVObject(v);
|
||||
|
||||
/*
|
||||
fprintf(cfp,"pretty print internal format of '%s'...\n", *argv);
|
||||
ofp = fopen(buf,"w");
|
||||
while (v) {
|
||||
printVObject(cfp,v);
|
||||
if (testmem) {
|
||||
char *s, *p;
|
||||
fprintf(cfp,"test writing to mem...\n");
|
||||
p = s = writeMemVObject(0,0,v);
|
||||
if (s) {
|
||||
while (*s) {
|
||||
fputc(*s,ofp);
|
||||
s++;
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
else {
|
||||
writeVObject(ofp,v);
|
||||
}
|
||||
t = v;
|
||||
v = nextVObjectInList(v);
|
||||
cleanVObject(t);
|
||||
}
|
||||
|
||||
fclose(ofp);
|
||||
fclose(fp);
|
||||
*/
|
||||
}
|
||||
|
||||
cleanStrTbl();
|
||||
argv++;
|
||||
|
||||
}
|
||||
|
||||
if (cfp != stdout) fclose(cfp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "vcc.h"
|
||||
|
||||
FILE *cfp;
|
||||
|
||||
void myMimeErrorHandler(char *s)
|
||||
{
|
||||
printf("%s\n", s);
|
||||
}
|
||||
|
||||
void main(int argc, char **argv)
|
||||
{
|
||||
int testmem = 0;
|
||||
|
||||
char * foo[2] = {"foo","alden.vcf"};
|
||||
|
||||
argc = 2;
|
||||
argv = foo;
|
||||
|
||||
#ifdef _CONSOLE
|
||||
cfp = stdout;
|
||||
registerMimeErrorHandler(myMimeErrorHandler);
|
||||
#else
|
||||
cfp = fopen("vctest.out", "w");
|
||||
if (!cfp) return;
|
||||
#endif
|
||||
++argv;
|
||||
while (--argc) {
|
||||
FILE *fp;
|
||||
if (strcmp(*argv,"-testmem") == 0) {
|
||||
testmem = 1;
|
||||
argv++;
|
||||
continue;
|
||||
}
|
||||
fprintf(cfp,"processing %s\n",*argv);
|
||||
fp = fopen(*argv,"r");
|
||||
if (!fp) {
|
||||
fprintf(cfp,"error opening file\n");
|
||||
}
|
||||
else {
|
||||
VObject *v, *t;
|
||||
FILE *ofp;
|
||||
char buf[256];
|
||||
char *p;
|
||||
strcpy(buf,*argv);
|
||||
p = strchr(buf,'.');
|
||||
if (p) *p = 0;
|
||||
strcat(buf,".out");
|
||||
fprintf(cfp,"reading text input from '%s'...\n", *argv);
|
||||
/*v = Parse_MIME_FromFile(fp); */
|
||||
v = Parse_MIME_FromFileName(*argv);
|
||||
writeVObjectToFile(buf,v);
|
||||
cleanVObject(v);
|
||||
|
||||
/*
|
||||
fprintf(cfp,"pretty print internal format of '%s'...\n", *argv);
|
||||
ofp = fopen(buf,"w");
|
||||
while (v) {
|
||||
printVObject(cfp,v);
|
||||
if (testmem) {
|
||||
char *s, *p;
|
||||
fprintf(cfp,"test writing to mem...\n");
|
||||
p = s = writeMemVObject(0,0,v);
|
||||
if (s) {
|
||||
while (*s) {
|
||||
fputc(*s,ofp);
|
||||
s++;
|
||||
}
|
||||
free(p);
|
||||
}
|
||||
}
|
||||
else {
|
||||
writeVObject(ofp,v);
|
||||
}
|
||||
t = v;
|
||||
v = nextVObjectInList(v);
|
||||
cleanVObject(t);
|
||||
}
|
||||
|
||||
fclose(ofp);
|
||||
fclose(fp);
|
||||
*/
|
||||
}
|
||||
|
||||
cleanStrTbl();
|
||||
argv++;
|
||||
|
||||
}
|
||||
|
||||
if (cfp != stdout) fclose(cfp);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -47,8 +47,8 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#include "vobject.h"
|
||||
|
||||
@ -1,366 +1,366 @@
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
The vCard/vCalendar C interface is implemented in the set
|
||||
of files as follows:
|
||||
|
||||
vcc.y, yacc source, and vcc.c, the yacc output you will use
|
||||
implements the core parser
|
||||
|
||||
vobject.c implements an API that insulates the caller from
|
||||
the parser and changes in the vCard/vCalendar BNF
|
||||
|
||||
port.h defines compilation environment dependent stuff
|
||||
|
||||
vcc.h and vobject.h are header files for their .c counterparts
|
||||
|
||||
vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
|
||||
which you may find useful.
|
||||
|
||||
test.c is a standalone test driver that exercises some of
|
||||
the features of the APIs provided. Invoke test.exe on a
|
||||
VCARD/VCALENDAR input text file and you will see the pretty
|
||||
print output of the internal representation (this pretty print
|
||||
output should give you a good idea of how the internal
|
||||
representation looks like -- there is one such output in the
|
||||
following too). Also, a file with the .out suffix is generated
|
||||
to show that the internal representation can be written back
|
||||
in the original text format.
|
||||
|
||||
For more information on this API see the readme.txt file
|
||||
which accompanied this distribution.
|
||||
|
||||
Also visit:
|
||||
|
||||
http://www.versit.com
|
||||
http://www.ralden.com
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __VOBJECT_H__
|
||||
#define __VOBJECT_H__ 1
|
||||
|
||||
|
||||
#include "port.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define VC7bitProp "7BIT"
|
||||
#define VC8bitProp "8BIT"
|
||||
#define VCAAlarmProp "AALARM"
|
||||
#define VCAdditionalNamesProp "ADDN"
|
||||
#define VCAdrProp "ADR"
|
||||
#define VCAgentProp "AGENT"
|
||||
#define VCAIFFProp "AIFF"
|
||||
#define VCAOLProp "AOL"
|
||||
#define VCAppleLinkProp "APPLELINK"
|
||||
#define VCAttachProp "ATTACH"
|
||||
#define VCAttendeeProp "ATTENDEE"
|
||||
#define VCATTMailProp "ATTMAIL"
|
||||
#define VCAudioContentProp "AUDIOCONTENT"
|
||||
#define VCAVIProp "AVI"
|
||||
#define VCBase64Prop "BASE64"
|
||||
#define VCBBSProp "BBS"
|
||||
#define VCBirthDateProp "BDAY"
|
||||
#define VCBMPProp "BMP"
|
||||
#define VCBodyProp "BODY"
|
||||
#define VCBusinessRoleProp "ROLE"
|
||||
#define VCCalProp "VCALENDAR"
|
||||
#define VCCaptionProp "CAP"
|
||||
#define VCCardProp "VCARD"
|
||||
#define VCCarProp "CAR"
|
||||
#define VCCategoriesProp "CATEGORIES"
|
||||
#define VCCellularProp "CELL"
|
||||
#define VCCGMProp "CGM"
|
||||
#define VCCharSetProp "CS"
|
||||
#define VCCIDProp "CID"
|
||||
#define VCCISProp "CIS"
|
||||
#define VCCityProp "L"
|
||||
#define VCClassProp "CLASS"
|
||||
#define VCCommentProp "NOTE"
|
||||
#define VCCompletedProp "COMPLETED"
|
||||
#define VCContentIDProp "CONTENT-ID"
|
||||
#define VCCountryNameProp "C"
|
||||
#define VCDAlarmProp "DALARM"
|
||||
#define VCDataSizeProp "DATASIZE"
|
||||
#define VCDayLightProp "DAYLIGHT"
|
||||
#define VCDCreatedProp "DCREATED"
|
||||
#define VCDeliveryLabelProp "LABEL"
|
||||
#define VCDescriptionProp "DESCRIPTION"
|
||||
#define VCDIBProp "DIB"
|
||||
#define VCDisplayStringProp "DISPLAYSTRING"
|
||||
#define VCDomesticProp "DOM"
|
||||
#define VCDTendProp "DTEND"
|
||||
#define VCDTstartProp "DTSTART"
|
||||
#define VCDueProp "DUE"
|
||||
#define VCEmailAddressProp "EMAIL"
|
||||
#define VCEncodingProp "ENCODING"
|
||||
#define VCEndProp "END"
|
||||
#define VCEventProp "VEVENT"
|
||||
#define VCEWorldProp "EWORLD"
|
||||
#define VCExNumProp "EXNUM"
|
||||
#define VCExpDateProp "EXDATE"
|
||||
#define VCExpectProp "EXPECT"
|
||||
#define VCExtAddressProp "EXT ADD"
|
||||
#define VCFamilyNameProp "F"
|
||||
#define VCFaxProp "FAX"
|
||||
#define VCFullNameProp "FN"
|
||||
#define VCGeoProp "GEO"
|
||||
#define VCGeoLocationProp "GEO"
|
||||
#define VCGIFProp "GIF"
|
||||
#define VCGivenNameProp "G"
|
||||
#define VCGroupingProp "Grouping"
|
||||
#define VCHomeProp "HOME"
|
||||
#define VCIBMMailProp "IBMMail"
|
||||
#define VCInlineProp "INLINE"
|
||||
#define VCInternationalProp "INTL"
|
||||
#define VCInternetProp "INTERNET"
|
||||
#define VCISDNProp "ISDN"
|
||||
#define VCJPEGProp "JPEG"
|
||||
#define VCLanguageProp "LANG"
|
||||
#define VCLastModifiedProp "LAST-MODIFIED"
|
||||
#define VCLastRevisedProp "REV"
|
||||
#define VCLocationProp "LOCATION"
|
||||
#define VCLogoProp "LOGO"
|
||||
#define VCMailerProp "MAILER"
|
||||
#define VCMAlarmProp "MALARM"
|
||||
#define VCMCIMailProp "MCIMAIL"
|
||||
#define VCMessageProp "MSG"
|
||||
#define VCMETProp "MET"
|
||||
#define VCModemProp "MODEM"
|
||||
#define VCMPEG2Prop "MPEG2"
|
||||
#define VCMPEGProp "MPEG"
|
||||
#define VCMSNProp "MSN"
|
||||
#define VCNamePrefixesProp "NPRE"
|
||||
#define VCNameProp "N"
|
||||
#define VCNameSuffixesProp "NSUF"
|
||||
#define VCNoteProp "NOTE"
|
||||
#define VCOrgNameProp "ORGNAME"
|
||||
#define VCOrgProp "ORG"
|
||||
#define VCOrgUnit2Prop "OUN2"
|
||||
#define VCOrgUnit3Prop "OUN3"
|
||||
#define VCOrgUnit4Prop "OUN4"
|
||||
#define VCOrgUnitProp "OUN"
|
||||
#define VCPagerProp "PAGER"
|
||||
#define VCPAlarmProp "PALARM"
|
||||
#define VCParcelProp "PARCEL"
|
||||
#define VCPartProp "PART"
|
||||
#define VCPCMProp "PCM"
|
||||
#define VCPDFProp "PDF"
|
||||
#define VCPGPProp "PGP"
|
||||
#define VCPhotoProp "PHOTO"
|
||||
#define VCPICTProp "PICT"
|
||||
#define VCPMBProp "PMB"
|
||||
#define VCPostalBoxProp "BOX"
|
||||
#define VCPostalCodeProp "PC"
|
||||
#define VCPostalProp "POSTAL"
|
||||
#define VCPowerShareProp "POWERSHARE"
|
||||
#define VCPreferredProp "PREF"
|
||||
#define VCPriorityProp "PRIORITY"
|
||||
#define VCProcedureNameProp "PROCEDURENAME"
|
||||
#define VCProdIdProp "PRODID"
|
||||
#define VCProdigyProp "PRODIGY"
|
||||
#define VCPronunciationProp "SOUND"
|
||||
#define VCPSProp "PS"
|
||||
#define VCPublicKeyProp "KEY"
|
||||
#define VCQPProp "QP"
|
||||
#define VCQuickTimeProp "QTIME"
|
||||
#define VCQuotedPrintableProp "QUOTED-PRINTABLE"
|
||||
#define VCRDateProp "RDATE"
|
||||
#define VCRegionProp "R"
|
||||
#define VCRelatedToProp "RELATED-TO"
|
||||
#define VCRepeatCountProp "REPEATCOUNT"
|
||||
#define VCResourcesProp "RESOURCES"
|
||||
#define VCRNumProp "RNUM"
|
||||
#define VCRoleProp "ROLE"
|
||||
#define VCRRuleProp "RRULE"
|
||||
#define VCRSVPProp "RSVP"
|
||||
#define VCRunTimeProp "RUNTIME"
|
||||
#define VCSequenceProp "SEQUENCE"
|
||||
#define VCSnoozeTimeProp "SNOOZETIME"
|
||||
#define VCStartProp "START"
|
||||
#define VCStatusProp "STATUS"
|
||||
#define VCStreetAddressProp "STREET"
|
||||
#define VCSubTypeProp "SUBTYPE"
|
||||
#define VCSummaryProp "SUMMARY"
|
||||
#define VCTelephoneProp "TEL"
|
||||
#define VCTIFFProp "TIFF"
|
||||
#define VCTimeZoneProp "TZ"
|
||||
#define VCTitleProp "TITLE"
|
||||
#define VCTLXProp "TLX"
|
||||
#define VCTodoProp "VTODO"
|
||||
#define VCTranspProp "TRANSP"
|
||||
#define VCUniqueStringProp "UID"
|
||||
#define VCURLProp "URL"
|
||||
#define VCURLValueProp "URLVAL"
|
||||
#define VCValueProp "VALUE"
|
||||
#define VCVersionProp "VERSION"
|
||||
#define VCVideoProp "VIDEO"
|
||||
#define VCVoiceProp "VOICE"
|
||||
#define VCWAVEProp "WAVE"
|
||||
#define VCWMFProp "WMF"
|
||||
#define VCWorkProp "WORK"
|
||||
#define VCX400Prop "X400"
|
||||
#define VCX509Prop "X509"
|
||||
#define VCXRuleProp "XRULE"
|
||||
|
||||
/* Extensions */
|
||||
|
||||
#define XPilotIdProp "X-PILOTID"
|
||||
#define XPilotStatusProp "X-PILOTSTAT"
|
||||
|
||||
typedef struct VObject VObject;
|
||||
|
||||
typedef struct VObjectIterator {
|
||||
VObject* start;
|
||||
VObject* next;
|
||||
} VObjectIterator;
|
||||
|
||||
extern DLLEXPORT(VObject*) newVObject(const char *id);
|
||||
extern DLLEXPORT(void) deleteVObject(VObject *p);
|
||||
extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
|
||||
extern DLLEXPORT(void) deleteStr(const char *p);
|
||||
extern DLLEXPORT(void) unUseStr(const char *s);
|
||||
|
||||
extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
|
||||
extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
|
||||
extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
|
||||
extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s);
|
||||
extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s);
|
||||
extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
|
||||
extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
|
||||
extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
|
||||
extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
|
||||
extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
|
||||
|
||||
extern DLLEXPORT(const char*) vObjectName(VObject *o);
|
||||
extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
|
||||
extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o);
|
||||
extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
|
||||
extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
|
||||
extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
|
||||
extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
|
||||
extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
|
||||
|
||||
extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
|
||||
extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
|
||||
extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
|
||||
extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
|
||||
extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
|
||||
extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
|
||||
extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
|
||||
extern DLLEXPORT(void) addList(VObject **o, VObject *p);
|
||||
|
||||
extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
|
||||
|
||||
extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
|
||||
extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
|
||||
extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
|
||||
extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
|
||||
|
||||
extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o);
|
||||
extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list);
|
||||
|
||||
extern DLLEXPORT(const char*) lookupStr(const char *s);
|
||||
extern DLLEXPORT(void) cleanStrTbl();
|
||||
|
||||
extern DLLEXPORT(void) cleanVObject(VObject *o);
|
||||
extern DLLEXPORT(void) cleanVObjects(VObject *list);
|
||||
|
||||
extern DLLEXPORT(const char*) lookupProp(const char* str);
|
||||
extern DLLEXPORT(const char*) lookupProp_(const char* str);
|
||||
|
||||
extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes);
|
||||
extern DLLEXPORT(int) uStrLen(const wchar_t *u);
|
||||
extern DLLEXPORT(char*) fakeCString(const wchar_t *u);
|
||||
|
||||
extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o);
|
||||
extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list);
|
||||
extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
|
||||
extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
|
||||
|
||||
extern DLLEXPORT(int) vObjectValueType(VObject *o);
|
||||
|
||||
/* return type of vObjectValueType: */
|
||||
#define VCVT_NOVALUE 0
|
||||
/* if the VObject has no value associated with it. */
|
||||
#define VCVT_STRINGZ 1
|
||||
/* if the VObject has value set by setVObjectStringZValue. */
|
||||
#define VCVT_USTRINGZ 2
|
||||
/* if the VObject has value set by setVObjectUStringZValue. */
|
||||
#define VCVT_UINT 3
|
||||
/* if the VObject has value set by setVObjectIntegerValue. */
|
||||
#define VCVT_ULONG 4
|
||||
/* if the VObject has value set by setVObjectLongValue. */
|
||||
#define VCVT_RAW 5
|
||||
/* if the VObject has value set by setVObjectAnyValue. */
|
||||
#define VCVT_VOBJECT 6
|
||||
/* if the VObject has value set by setVObjectVObjectValue. */
|
||||
|
||||
extern const char** fieldedProp;
|
||||
|
||||
/* NOTE regarding printVObject and writeVObject
|
||||
|
||||
The functions below are not exported from the DLL because they
|
||||
take a FILE* as a parameter, which cannot be passed across a DLL
|
||||
interface (at least that is my experience). Instead you can use
|
||||
their companion functions which take file names or pointers
|
||||
to memory. However, if you are linking this code into
|
||||
your build directly then you may find them a more convenient API
|
||||
and you can go ahead and use them. If you try to use them with
|
||||
the DLL LIB you will get a link error.
|
||||
*/
|
||||
extern void printVObject(FILE *fp,VObject *o);
|
||||
extern void writeVObject(FILE *fp, VObject *o);
|
||||
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __VOBJECT_H__ */
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
|
||||
For purposes of this license notice, the term Licensors shall mean,
|
||||
collectively, Apple Computer, Inc., AT&T Corp., International
|
||||
Business Machines Corporation and Siemens Rolm Communications Inc.
|
||||
The term Licensor shall mean any of the Licensors.
|
||||
|
||||
Subject to acceptance of the following conditions, permission is hereby
|
||||
granted by Licensors without the need for written agreement and without
|
||||
license or royalty fees, to use, copy, modify and distribute this
|
||||
software for any purpose.
|
||||
|
||||
The above copyright notice and the following four paragraphs must be
|
||||
reproduced in all copies of this software and any software including
|
||||
this software.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE
|
||||
ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR
|
||||
MODIFICATIONS.
|
||||
|
||||
IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT,
|
||||
INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT
|
||||
OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED,
|
||||
INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
|
||||
The software is provided with RESTRICTED RIGHTS. Use, duplication, or
|
||||
disclosure by the government are subject to restrictions set forth in
|
||||
DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
|
||||
|
||||
***************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
The vCard/vCalendar C interface is implemented in the set
|
||||
of files as follows:
|
||||
|
||||
vcc.y, yacc source, and vcc.c, the yacc output you will use
|
||||
implements the core parser
|
||||
|
||||
vobject.c implements an API that insulates the caller from
|
||||
the parser and changes in the vCard/vCalendar BNF
|
||||
|
||||
port.h defines compilation environment dependent stuff
|
||||
|
||||
vcc.h and vobject.h are header files for their .c counterparts
|
||||
|
||||
vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions
|
||||
which you may find useful.
|
||||
|
||||
test.c is a standalone test driver that exercises some of
|
||||
the features of the APIs provided. Invoke test.exe on a
|
||||
VCARD/VCALENDAR input text file and you will see the pretty
|
||||
print output of the internal representation (this pretty print
|
||||
output should give you a good idea of how the internal
|
||||
representation looks like -- there is one such output in the
|
||||
following too). Also, a file with the .out suffix is generated
|
||||
to show that the internal representation can be written back
|
||||
in the original text format.
|
||||
|
||||
For more information on this API see the readme.txt file
|
||||
which accompanied this distribution.
|
||||
|
||||
Also visit:
|
||||
|
||||
http://www.versit.com
|
||||
http://www.ralden.com
|
||||
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __VOBJECT_H__
|
||||
#define __VOBJECT_H__ 1
|
||||
|
||||
|
||||
#include "port.h"
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#define VC7bitProp "7BIT"
|
||||
#define VC8bitProp "8BIT"
|
||||
#define VCAAlarmProp "AALARM"
|
||||
#define VCAdditionalNamesProp "ADDN"
|
||||
#define VCAdrProp "ADR"
|
||||
#define VCAgentProp "AGENT"
|
||||
#define VCAIFFProp "AIFF"
|
||||
#define VCAOLProp "AOL"
|
||||
#define VCAppleLinkProp "APPLELINK"
|
||||
#define VCAttachProp "ATTACH"
|
||||
#define VCAttendeeProp "ATTENDEE"
|
||||
#define VCATTMailProp "ATTMAIL"
|
||||
#define VCAudioContentProp "AUDIOCONTENT"
|
||||
#define VCAVIProp "AVI"
|
||||
#define VCBase64Prop "BASE64"
|
||||
#define VCBBSProp "BBS"
|
||||
#define VCBirthDateProp "BDAY"
|
||||
#define VCBMPProp "BMP"
|
||||
#define VCBodyProp "BODY"
|
||||
#define VCBusinessRoleProp "ROLE"
|
||||
#define VCCalProp "VCALENDAR"
|
||||
#define VCCaptionProp "CAP"
|
||||
#define VCCardProp "VCARD"
|
||||
#define VCCarProp "CAR"
|
||||
#define VCCategoriesProp "CATEGORIES"
|
||||
#define VCCellularProp "CELL"
|
||||
#define VCCGMProp "CGM"
|
||||
#define VCCharSetProp "CS"
|
||||
#define VCCIDProp "CID"
|
||||
#define VCCISProp "CIS"
|
||||
#define VCCityProp "L"
|
||||
#define VCClassProp "CLASS"
|
||||
#define VCCommentProp "NOTE"
|
||||
#define VCCompletedProp "COMPLETED"
|
||||
#define VCContentIDProp "CONTENT-ID"
|
||||
#define VCCountryNameProp "C"
|
||||
#define VCDAlarmProp "DALARM"
|
||||
#define VCDataSizeProp "DATASIZE"
|
||||
#define VCDayLightProp "DAYLIGHT"
|
||||
#define VCDCreatedProp "DCREATED"
|
||||
#define VCDeliveryLabelProp "LABEL"
|
||||
#define VCDescriptionProp "DESCRIPTION"
|
||||
#define VCDIBProp "DIB"
|
||||
#define VCDisplayStringProp "DISPLAYSTRING"
|
||||
#define VCDomesticProp "DOM"
|
||||
#define VCDTendProp "DTEND"
|
||||
#define VCDTstartProp "DTSTART"
|
||||
#define VCDueProp "DUE"
|
||||
#define VCEmailAddressProp "EMAIL"
|
||||
#define VCEncodingProp "ENCODING"
|
||||
#define VCEndProp "END"
|
||||
#define VCEventProp "VEVENT"
|
||||
#define VCEWorldProp "EWORLD"
|
||||
#define VCExNumProp "EXNUM"
|
||||
#define VCExpDateProp "EXDATE"
|
||||
#define VCExpectProp "EXPECT"
|
||||
#define VCExtAddressProp "EXT ADD"
|
||||
#define VCFamilyNameProp "F"
|
||||
#define VCFaxProp "FAX"
|
||||
#define VCFullNameProp "FN"
|
||||
#define VCGeoProp "GEO"
|
||||
#define VCGeoLocationProp "GEO"
|
||||
#define VCGIFProp "GIF"
|
||||
#define VCGivenNameProp "G"
|
||||
#define VCGroupingProp "Grouping"
|
||||
#define VCHomeProp "HOME"
|
||||
#define VCIBMMailProp "IBMMail"
|
||||
#define VCInlineProp "INLINE"
|
||||
#define VCInternationalProp "INTL"
|
||||
#define VCInternetProp "INTERNET"
|
||||
#define VCISDNProp "ISDN"
|
||||
#define VCJPEGProp "JPEG"
|
||||
#define VCLanguageProp "LANG"
|
||||
#define VCLastModifiedProp "LAST-MODIFIED"
|
||||
#define VCLastRevisedProp "REV"
|
||||
#define VCLocationProp "LOCATION"
|
||||
#define VCLogoProp "LOGO"
|
||||
#define VCMailerProp "MAILER"
|
||||
#define VCMAlarmProp "MALARM"
|
||||
#define VCMCIMailProp "MCIMAIL"
|
||||
#define VCMessageProp "MSG"
|
||||
#define VCMETProp "MET"
|
||||
#define VCModemProp "MODEM"
|
||||
#define VCMPEG2Prop "MPEG2"
|
||||
#define VCMPEGProp "MPEG"
|
||||
#define VCMSNProp "MSN"
|
||||
#define VCNamePrefixesProp "NPRE"
|
||||
#define VCNameProp "N"
|
||||
#define VCNameSuffixesProp "NSUF"
|
||||
#define VCNoteProp "NOTE"
|
||||
#define VCOrgNameProp "ORGNAME"
|
||||
#define VCOrgProp "ORG"
|
||||
#define VCOrgUnit2Prop "OUN2"
|
||||
#define VCOrgUnit3Prop "OUN3"
|
||||
#define VCOrgUnit4Prop "OUN4"
|
||||
#define VCOrgUnitProp "OUN"
|
||||
#define VCPagerProp "PAGER"
|
||||
#define VCPAlarmProp "PALARM"
|
||||
#define VCParcelProp "PARCEL"
|
||||
#define VCPartProp "PART"
|
||||
#define VCPCMProp "PCM"
|
||||
#define VCPDFProp "PDF"
|
||||
#define VCPGPProp "PGP"
|
||||
#define VCPhotoProp "PHOTO"
|
||||
#define VCPICTProp "PICT"
|
||||
#define VCPMBProp "PMB"
|
||||
#define VCPostalBoxProp "BOX"
|
||||
#define VCPostalCodeProp "PC"
|
||||
#define VCPostalProp "POSTAL"
|
||||
#define VCPowerShareProp "POWERSHARE"
|
||||
#define VCPreferredProp "PREF"
|
||||
#define VCPriorityProp "PRIORITY"
|
||||
#define VCProcedureNameProp "PROCEDURENAME"
|
||||
#define VCProdIdProp "PRODID"
|
||||
#define VCProdigyProp "PRODIGY"
|
||||
#define VCPronunciationProp "SOUND"
|
||||
#define VCPSProp "PS"
|
||||
#define VCPublicKeyProp "KEY"
|
||||
#define VCQPProp "QP"
|
||||
#define VCQuickTimeProp "QTIME"
|
||||
#define VCQuotedPrintableProp "QUOTED-PRINTABLE"
|
||||
#define VCRDateProp "RDATE"
|
||||
#define VCRegionProp "R"
|
||||
#define VCRelatedToProp "RELATED-TO"
|
||||
#define VCRepeatCountProp "REPEATCOUNT"
|
||||
#define VCResourcesProp "RESOURCES"
|
||||
#define VCRNumProp "RNUM"
|
||||
#define VCRoleProp "ROLE"
|
||||
#define VCRRuleProp "RRULE"
|
||||
#define VCRSVPProp "RSVP"
|
||||
#define VCRunTimeProp "RUNTIME"
|
||||
#define VCSequenceProp "SEQUENCE"
|
||||
#define VCSnoozeTimeProp "SNOOZETIME"
|
||||
#define VCStartProp "START"
|
||||
#define VCStatusProp "STATUS"
|
||||
#define VCStreetAddressProp "STREET"
|
||||
#define VCSubTypeProp "SUBTYPE"
|
||||
#define VCSummaryProp "SUMMARY"
|
||||
#define VCTelephoneProp "TEL"
|
||||
#define VCTIFFProp "TIFF"
|
||||
#define VCTimeZoneProp "TZ"
|
||||
#define VCTitleProp "TITLE"
|
||||
#define VCTLXProp "TLX"
|
||||
#define VCTodoProp "VTODO"
|
||||
#define VCTranspProp "TRANSP"
|
||||
#define VCUniqueStringProp "UID"
|
||||
#define VCURLProp "URL"
|
||||
#define VCURLValueProp "URLVAL"
|
||||
#define VCValueProp "VALUE"
|
||||
#define VCVersionProp "VERSION"
|
||||
#define VCVideoProp "VIDEO"
|
||||
#define VCVoiceProp "VOICE"
|
||||
#define VCWAVEProp "WAVE"
|
||||
#define VCWMFProp "WMF"
|
||||
#define VCWorkProp "WORK"
|
||||
#define VCX400Prop "X400"
|
||||
#define VCX509Prop "X509"
|
||||
#define VCXRuleProp "XRULE"
|
||||
|
||||
/* Extensions */
|
||||
|
||||
#define XPilotIdProp "X-PILOTID"
|
||||
#define XPilotStatusProp "X-PILOTSTAT"
|
||||
|
||||
typedef struct VObject VObject;
|
||||
|
||||
typedef struct VObjectIterator {
|
||||
VObject* start;
|
||||
VObject* next;
|
||||
} VObjectIterator;
|
||||
|
||||
extern DLLEXPORT(VObject*) newVObject(const char *id);
|
||||
extern DLLEXPORT(void) deleteVObject(VObject *p);
|
||||
extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size);
|
||||
extern DLLEXPORT(void) deleteStr(const char *p);
|
||||
extern DLLEXPORT(void) unUseStr(const char *s);
|
||||
|
||||
extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id);
|
||||
extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s);
|
||||
extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s);
|
||||
extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s);
|
||||
extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s);
|
||||
extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i);
|
||||
extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l);
|
||||
extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t);
|
||||
extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size);
|
||||
extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size);
|
||||
|
||||
extern DLLEXPORT(const char*) vObjectName(VObject *o);
|
||||
extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o);
|
||||
extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o);
|
||||
extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o);
|
||||
extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o);
|
||||
extern DLLEXPORT(void*) vObjectAnyValue(VObject *o);
|
||||
extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o);
|
||||
extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p);
|
||||
|
||||
extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p);
|
||||
extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id);
|
||||
extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id);
|
||||
extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v);
|
||||
extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size);
|
||||
extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size);
|
||||
extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g);
|
||||
extern DLLEXPORT(void) addList(VObject **o, VObject *p);
|
||||
|
||||
extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id);
|
||||
|
||||
extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o);
|
||||
extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o);
|
||||
extern DLLEXPORT(int) moreIteration(VObjectIterator *i);
|
||||
extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i);
|
||||
|
||||
extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o);
|
||||
extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list);
|
||||
|
||||
extern DLLEXPORT(const char*) lookupStr(const char *s);
|
||||
extern DLLEXPORT(void) cleanStrTbl();
|
||||
|
||||
extern DLLEXPORT(void) cleanVObject(VObject *o);
|
||||
extern DLLEXPORT(void) cleanVObjects(VObject *list);
|
||||
|
||||
extern DLLEXPORT(const char*) lookupProp(const char* str);
|
||||
extern DLLEXPORT(const char*) lookupProp_(const char* str);
|
||||
|
||||
extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes);
|
||||
extern DLLEXPORT(int) uStrLen(const wchar_t *u);
|
||||
extern DLLEXPORT(char*) fakeCString(const wchar_t *u);
|
||||
|
||||
extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o);
|
||||
extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list);
|
||||
extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o);
|
||||
extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list);
|
||||
|
||||
extern DLLEXPORT(int) vObjectValueType(VObject *o);
|
||||
|
||||
/* return type of vObjectValueType: */
|
||||
#define VCVT_NOVALUE 0
|
||||
/* if the VObject has no value associated with it. */
|
||||
#define VCVT_STRINGZ 1
|
||||
/* if the VObject has value set by setVObjectStringZValue. */
|
||||
#define VCVT_USTRINGZ 2
|
||||
/* if the VObject has value set by setVObjectUStringZValue. */
|
||||
#define VCVT_UINT 3
|
||||
/* if the VObject has value set by setVObjectIntegerValue. */
|
||||
#define VCVT_ULONG 4
|
||||
/* if the VObject has value set by setVObjectLongValue. */
|
||||
#define VCVT_RAW 5
|
||||
/* if the VObject has value set by setVObjectAnyValue. */
|
||||
#define VCVT_VOBJECT 6
|
||||
/* if the VObject has value set by setVObjectVObjectValue. */
|
||||
|
||||
extern const char** fieldedProp;
|
||||
|
||||
/* NOTE regarding printVObject and writeVObject
|
||||
|
||||
The functions below are not exported from the DLL because they
|
||||
take a FILE* as a parameter, which cannot be passed across a DLL
|
||||
interface (at least that is my experience). Instead you can use
|
||||
their companion functions which take file names or pointers
|
||||
to memory. However, if you are linking this code into
|
||||
your build directly then you may find them a more convenient API
|
||||
and you can go ahead and use them. If you try to use them with
|
||||
the DLL LIB you will get a link error.
|
||||
*/
|
||||
extern void printVObject(FILE *fp,VObject *o);
|
||||
extern void writeVObject(FILE *fp, VObject *o);
|
||||
|
||||
|
||||
#if defined(__CPLUSPLUS__) || defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __VOBJECT_H__ */
|
||||
|
||||
|
||||
|
||||
@ -31,18 +31,18 @@
|
||||
#include <stdlib.h> /* for malloc */
|
||||
#include <stdio.h> /* for printf */
|
||||
#include <time.h> /* for time() */
|
||||
#include <signal.h> /* for signal */
|
||||
#include <signal.h> /* for signal */
|
||||
#ifndef WIN32
|
||||
#include <unistd.h> /* for alarm */
|
||||
#include <unistd.h> /* for alarm */
|
||||
#endif
|
||||
#include "icalmemory.h"
|
||||
#include "icaldirset.h"
|
||||
#include "icalfileset.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#define snprintf _snprintf
|
||||
#define strcasecmp stricmp
|
||||
#endif
|
||||
|
||||
static void sig_alrm(int i){
|
||||
fprintf(stderr,"Could not get lock on file\n");
|
||||
@ -59,74 +59,85 @@ int main(int argc, char *argv[])
|
||||
icalrecur_iterator* ritr;
|
||||
time_t tt;
|
||||
char* file;
|
||||
|
||||
|
||||
icalerror_set_error_state(ICAL_PARSE_ERROR, ICAL_ERROR_NONFATAL);
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
signal(SIGALRM,sig_alrm);
|
||||
#endif
|
||||
|
||||
|
||||
if (argc <= 1){
|
||||
file = "../../test-data/recur.txt";
|
||||
file = "../../test-data/recur.txt";
|
||||
} else if (argc == 2){
|
||||
file = argv[1];
|
||||
file = argv[1];
|
||||
} else {
|
||||
fprintf(stderr,"usage: recur [input file]\n");
|
||||
exit(1);
|
||||
fprintf(stderr,"usage: recur [input file]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
#ifndef WIN32
|
||||
alarm(300); /* to get file lock */
|
||||
alarm(300); /* to get file lock */
|
||||
#endif
|
||||
cin = icalfileset_new(file);
|
||||
#ifndef WIN32
|
||||
#ifndef WIN32
|
||||
alarm(0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(cin == 0){
|
||||
fprintf(stderr,"recur: can't open file %s\n",file);
|
||||
exit(1);
|
||||
fprintf(stderr,"recur: can't open file %s\n",file);
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
for (itr = icalfileset_get_first_component(cin);
|
||||
itr != 0;
|
||||
itr = icalfileset_get_next_component(cin)){
|
||||
|
||||
desc = icalcomponent_get_first_property(itr,ICAL_DESCRIPTION_PROPERTY);
|
||||
dtstart = icalcomponent_get_first_property(itr,ICAL_DTSTART_PROPERTY);
|
||||
rrule = icalcomponent_get_first_property(itr,ICAL_RRULE_PROPERTY);
|
||||
|
||||
if (desc == 0 || dtstart == 0 || rrule == 0){
|
||||
printf("\n******** Error in input component ********\n");
|
||||
printf("The following component is malformed:\n %s\n",
|
||||
icalcomponent_as_ical_string(itr));
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("\n\n#### %s\n",icalproperty_get_description(desc));
|
||||
printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule)));
|
||||
recur = icalproperty_get_rrule(rrule);
|
||||
start = icalproperty_get_dtstart(dtstart);
|
||||
|
||||
ritr = icalrecur_iterator_new(recur,start);
|
||||
|
||||
tt = icaltime_as_timet(start);
|
||||
|
||||
printf("#### %s\n",ctime(&tt ));
|
||||
|
||||
for(ritr = icalrecur_iterator_new(recur,start),
|
||||
next = icalrecur_iterator_next(ritr);
|
||||
!icaltime_is_null_time(next);
|
||||
next = icalrecur_iterator_next(ritr)){
|
||||
|
||||
tt = icaltime_as_timet(next);
|
||||
|
||||
printf(" %s",ctime(&tt ));
|
||||
|
||||
}
|
||||
itr != 0;
|
||||
itr = icalfileset_get_next_component(cin)){
|
||||
|
||||
desc = icalcomponent_get_first_property(itr,ICAL_DESCRIPTION_PROPERTY);
|
||||
dtstart = icalcomponent_get_first_property(itr,ICAL_DTSTART_PROPERTY);
|
||||
rrule = icalcomponent_get_first_property(itr,ICAL_RRULE_PROPERTY);
|
||||
|
||||
if (desc == 0 || dtstart == 0 || rrule == 0){
|
||||
printf("\n******** Error in input component ********\n");
|
||||
printf("The following component is malformed:\n %s\n",
|
||||
icalcomponent_as_ical_string(itr));
|
||||
continue;
|
||||
}
|
||||
|
||||
printf("\n\n#### %s\n",icalproperty_get_description(desc));
|
||||
printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule)));
|
||||
recur = icalproperty_get_rrule(rrule);
|
||||
start = icalproperty_get_dtstart(dtstart);
|
||||
|
||||
ritr = icalrecur_iterator_new(recur,start);
|
||||
|
||||
tt = icaltime_as_timet(start);
|
||||
|
||||
printf("#### %s\n",ctime(&tt ));
|
||||
|
||||
icalrecur_iterator_free(ritr);
|
||||
|
||||
for(ritr = icalrecur_iterator_new(recur,start),
|
||||
next = icalrecur_iterator_next(ritr);
|
||||
!icaltime_is_null_time(next);
|
||||
next = icalrecur_iterator_next(ritr)){
|
||||
|
||||
tt = icaltime_as_timet(next);
|
||||
|
||||
printf(" %s",ctime(&tt ));
|
||||
|
||||
}
|
||||
icalrecur_iterator_free(ritr);
|
||||
|
||||
}
|
||||
|
||||
icalfileset_free(cin);
|
||||
|
||||
icaltimezone_free_builtin_timezones();
|
||||
|
||||
icalmemory_free_ring();
|
||||
|
||||
free_zone_directory();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
|
||||
DESCRIPTION:
|
||||
|
||||
$Id: regression.c,v 1.3 2001-12-21 18:56:56 mikep%oeone.com Exp $
|
||||
$Id: regression.c,v 1.4 2002-03-14 15:18:03 mikep%oeone.com Exp $
|
||||
$Locker: $
|
||||
|
||||
(C) COPYRIGHT 1999 Eric Busboom
|
||||
@ -3667,6 +3667,8 @@ int main(int argc, char *argv[])
|
||||
int ttime=0, trecur=0,tspan=0, tmisc=0, tgauge = 0, tfile = 0,
|
||||
tbasic = 0;
|
||||
|
||||
set_zone_directory("../../zoneinfo");
|
||||
|
||||
putenv("TZ=");
|
||||
|
||||
if(argc==1) {
|
||||
@ -3952,6 +3954,8 @@ int main(int argc, char *argv[])
|
||||
|
||||
icalmemory_free_ring();
|
||||
|
||||
free_zone_directory();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ END:VEVENT
|
||||
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION
|
||||
=======
|
||||
:Monday of week number 20 (where the default start of the week is Monday)\,
|
||||
forever:
|
||||
DTSTART
|
||||
@ -469,5 +468,12 @@ RRULE
|
||||
:FREQ=WEEKLY;COUNT=4;INTERVAL=2;BYDAY=TU,SU
|
||||
END:VEVENT
|
||||
|
||||
|
||||
BEGIN:VEVENT
|
||||
DESCRIPTION
|
||||
:Repeat every tuesday and wednesday starting 2 April 2002
|
||||
RRULE
|
||||
:FREQ=WEEKLY;INTERVAL=1;COUNT=6;BYDAY=TU,WE
|
||||
DTSTART
|
||||
:20020402T114500
|
||||
END:VEVENT
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user