This commit is contained in:
mikep%oeone.com 2001-11-15 19:28:01 +00:00
Родитель 2a1e3236f3
Коммит 39ce120df2
215 изменённых файлов: 64939 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1 @@
Eric Busboom <eric@softwarestudio.org>

Просмотреть файл

Просмотреть файл

@ -0,0 +1,505 @@
2001-04-01 Eric Busboom <eric@softwarestudio.org>
* icalcomponent.h Changed meaning of
icalcomponent_new_from_string. It used to create a new component
given the text name of the component type to create. Now it calls
icalparser_parse_string to create a new component from the
complete iCalendar text representation of the component.
2001-03-31 Eric Busboom <eric@softwarestudio.org>
* icalvalue Changed ACTION properties to take an ACTION value
instead of TEXT. The ACTION value is enumerated.
2001-03-26 Eric Busboom <eric@softwarestudio.org>
* icalparameter.h icalparameter_rsvp_* routines now take, return
ICAL_RSVP_TRUE and ICAL_RSVP_FALSE, not 0 and 1
2001-03-25 Eric Busboom <eric@softwarestudio.org>
* icalrecur.c Many changes to get YEARLY rules working and fix
other errors. Recurrences are stil broken, but more types of rue
now work.
2001-03-16 Eric Busboom <eric@softwarestudio.org>
* icalparameter.c Changed icalparameter_new_from_string() to
icalparameter_new_from_value_string(). Created new
icalparameter_new_from_string() that takes strings of
form"PARAMNAME=PARAMVALUE"
* *_XNAME changes all _XNAME enumerations to _X
* derived props, values, parameters. Seperated out derived
proeprties, parameters and values into their own files. This makes
it easier to auto generate all of the enumerations for values,
parameters and proeprties.
* icalenum.h Major changes to icalenum. Movel all of the
icalenum_* values to other modules, and changed the names. Look
for #defines in icalenum.h tying the old name to the new
name. Also moved all of the enumerations into other files.
2001-02-26 Eric Busboom <eric@softwarestudio.org>
* src/libical/icalproperty.c Added
icalproperty_set_parameter_from_string and
icalproperty_set_value_from_string to aid in binding to Python
2001-02-15 Eric Busboom <eric@softwarestudio.org>
* design-data/prop-to-value.txt Made a new CSV file,
properties.cvs That collects property-to-value and default value
information
* src/libical/icalproperty.{c,h}.in Moved auto generated code into
icalderivedproperty.{c,h} and created icalderivedproperty.{c,h}.in
2001-02-14 JP Rosevear <jpr@ximian.com>
* src/libical/Makefile.am: Sigh, automake is dumber than i thought
2001-02-12 JP Rosevear <jpr@ximian.com>
* src/test/Makefile.am: link with the static versions
* src/python/Makefile.am: use include dir discovered in configure checks
* src/python/.cvsignore: shush
* src/libical/icalrestriction.c: remove autogenerated file
* src/libical/Makefile.am: the generated files are now disted so
look for them in the source dir rather than the build dir
* src/Makefile.am: Only build the python dir if all the configure
stuff checked out
* configure.in: Remove shared library disabling and add a python
check and allow for the python bindings to not be built
2001-02-11 Eric Busboom <eric@softwarestudio.org>
* src/python/Makefile.am Tweaked makefile to use automake more,
but it stil isn't quie right.
2001-02-09 JP Rosevear <jpr@ximian.com>
* Shush cvs
2001-02-09 JP Rosevear <jpr@ximian.com>
* src/libical/Makefile.am: Slightly over zealous during the merge
2001-02-09 JP Rosevear <jpr@ximian.com>
* src/libical/Makefile.am: Correct typo
* Removal of more auto generated files
2001-02-09 JP Rosevear <jpr@ximian.com>
* Removal of various auto generated files
2001-02-09 JP Rosevear <jpr@ximian.com>
* src/libical/icalparameter.c.in (icalparameter_new_from_string):
its NEEDS-ACTION rather than NEEDSACTION
(icalparameter_as_ical_string): ditto
2001-02-09 Eric Busboom <eric@softwarestudio.org>
* python Added src/python directory. Inserted SWIG wrapper files,
and a simple interface to Component, Time, Duration, Period and
Store.
* icallangbind.c More experimental work
* icalduration.{c,h}, icalperiod.{c,h} Broke out period and
duration types into their own files
2001-02-06 Christopher James Lahey <clahey@ximian.com>
* src/libical/icallangbind.c: Added a missing #include here.
* src/libical/icalrecur.c (icalrecur_add_bydayrules): Copy the
passed in const vals since we change it.
2001-02-06 Eric Busboom <eric@softwarestudio.org>
* icaltime.c Changed icaltime_from_day_of_year to run mktime in
the UTC timezone. This fixed a bug where it would return one day
eariler for some timezones.
2001-02-05 Ettore Perazzoli <ettore@ximian.com>
* src/libical/Makefile.am (COMBINEDHEADERS): `icalvalue.h',
`icalparameter.h', `icalproperty.h' and `icalrestriction.h' are
created in the builddir so they shouldn't be prefixed with
`$(top_builddir)/src/libical'.
2001-01-26 Eric Busboom <eric@softwarestudio.org>
* icalproperty.c.in Improved icalproperty_as_ical_string() to
eliminate the possibility of having a VALUE parameter that does
not match the actual kind of value.
* icalvalue.c.in made icalvalue_*_trigger() and
icalvalue_*_datetimeperiod non-autogenerated. These routines were
for combined value type -- non standard values that can have more
than on standard value type. These non-standard types now delegate
to stadard types.
2001-01-24 Eric Busboom <eric@softwarestudio.org>
* icalfileset.c fixed icalfileset_read-from_file so it will handle
lines longer than 80 char properly.
2001-01-23 JP Rosevear <jpr@ximian.com>
* configure.in: Don't AC_INIT on an autogenerated file that does not
exist beforehand
2001-01-23 Eric Busboom <eric@softwarestudio.org>
* icltime.c Removed all of the _local_ routines and simplified
icaltime_utc_offset and icaltime_as_timet
* regression.c Added tests for triggers and improvements to icaltime.c
* icaltypes.c Addedd icaltriggertype_from_string and changed
icaltriggertype to be a struct
2001-01-22 Eric Busboom <eric@softwarestudio.org>
* icaltime.c implemented icaldurationtype_from_string to parse the
string it self, rather than use lex/yacc
2001-01-15 Eric Busboom <eric@softwarestudio.org>
* icalfileset.c Many improvements. File locking now works, and so
does searching with icalfileset_select()
2001-01-08 Eric Busboom <eric@softwarestudio.org>
* Makefile.am Remove spaces after -I in several
Makefile.am routines.
* icalset.c removed return statements from some void functions.
* icalparameter.c.in Added break to default: case that had no
body. Compilers on Solaris and Tru64 UNIX complained.
2001-01-02 Eric Busboom <eric@softwarestudio.org>
* icaltime.c Changed icaldurationtype_from_time and _as_timet to
_from_int and _as_int. This is a change interface that may break
some code.
* icalgauge.c icalgaugeimpl.h, icalgauge.h., Rewrote gauge code to
use pvl-lists directly, instead of trying to reuse icalcomponent.
2000-12-13 Ettore Perazzoli <ettore@helixcode.com>
* src/libicalvcal/Makefile.am (INCLUDES): Add
`$(top_builddir)/src/libical' to the include directory list.
* src/libical/Makefile.am (icalparameter.h): Use `$(srcdir)'.
(icalparameter.c): Likewise.
(icalproperty.h): Likewise.
(icalproperty.c): Likewise.
(icalvalue.h): Likewise.
(icalvalue.c): Likewise.
(icalrestriction.c): Likewise.
(COMBINEDHEADERS): `icalvalue.h', `icalparameter.h' and
`icalproperty.h' are in builddir, not srcdir, so fix the list to
use `$(top_builddir)' instead of `$(top_srcdir)'.
(all): Removed.
(BUILT_SOURCES): Move `ical.h' here instead.
(ical.h): Don't depend on `(BUILT_SOURCES)'; this a built source
itself.
2000-12-12 Eric Busboom <eric@softwarestudio.org>
* icalparser.c Addedd support for x-parameters.
* icalenum.c Fixed icalenum_parameter_type_to_string and
icalenum_property_type_to_string to property identify X- parameers
and properties.
* icalparameter.c Fixed icalparameter_as_ical_string to property
write out X-Parameters.
2000-12-11 Eric Busboom <eric@softwarestudio.org>
* icalcstp.c added empty bodies to prep_* routines so that shared
libraries would build.
2000-12-11 JP Rosevear <jpr@helixcode.com>
* src/libical/icaltime.c (icaltime_compare_date_only): New
function that compares only the dates, not the times as well.
* src/libical/icaltime.h: Add prototype for the function above.
* src/libical/icalrecur.h (struct icalrecurrencetype): Correct
header documentation.
* src/libical/icaltypes.c: No longer include <limits.h>.
* src/libical/icalrecur.c: Likewise.
* src/libical/icalvalue.c: Likewise.
* src/libical/icalyacc.y: Likewise.
2000-12-11 Federico Mena Quintero <federico@helixcode.com>
* configure.in (AC_OUTPUT): Fixed order of generated files to make
"make distcheck" work. Turn on AM_MAINTAINER_MODE.
* src/libical/Makefile.am (EXTRA_DIST): Add icalversion.h.in.
(COMBINEDHEADERS): Added paths to make "make distcheck" work.
(libical_la_SOURCES): Added headers for distribution in our weird
setup.
2000-12-06 Eric Busboom <eric@softwarestudio.org>
* icaltime.c added icaltime_as_local to convert a UTC time to a
local time
* icaltime.h icaltime.c Removed is_utc argument from
icaltime_from_timet
2000-11-29 Eric Busboom <eric@softwarestudio.org>
* icalrecur.c More testing and bug fixes. Many more of the rules
in recur.txt work correctly.
2000-11-28 Eric Busboom <eric@softwarestudio.org>
* icalrecur.c Several changes to extract icalrecur.c from
libical. I'd like to make it into a reference impl for recurrence
rules. CHanges include moving all of the recurrence type and
recurrence enums from icalenum and icaltypes into icalrecur, and
adding code to parse recurrence rule strings.
* icaltime.c Changed icaltime_from_string to parse the string
directly. Now icaltime.c has no dependency on icalvalue.c
2000-11-21 Eric Busboom <eric@softwarestudio.org>
* icalrecur.c Fixed a bug in the increment_* routines that made
incrementing by more then 1 insensible. Thanks to Martin Neimeier
2000-11-20 Eric Busboom <eric@softwarestudio.org>
* icalmessage.c Many routines to create new ical messages.
* icalspanlist.c Code to generate a list of the busy time f the
VEVENTS in a set. Also includes routiens to generate free and busy
lists from the spanlist, and to find the next free time after a
given time.
* icalvalue.c The STATUS property now has its own value type,
STATUS, which holds the enumeration icalproperty_status.
* icalrestriction.c Added more restrictions. Now handles mutual
and exclusive consitions, and checks for the reight values in
STATUS properties
2000-11-10 Eric Busboom <eric@softwarestudio.org>
* icaltypes.c Added routine to create durationtype from string:
icaldurationtype_from_string
2000-11-09 Eric Busboom <eric@softwarestudio.org>
* icalcomponet.c Add sever get/set convienience routines to access
and manipulate common component propoerties from the component
interface. This eliminates the need to create a lot of temporary
variables if you just want to change the start time of and event.
2000-11-06 Eric Busboom <eric@softwarestudio.org>
* icalcomponent.c Added new routines to icalcomponent:
_get_span -- returns the start and end times of the event in UTC
_get_first_real_component -- return ref to VTODO, VEVENT or VJOURNAL
* icalspanlist.c Added new class, icalspanlist, that generates a
list of alternating busy and free times from an icalset. The class
includes routines to gnerate rfc2445 busy and free lists, and to
get the next avaliable busy or free time after a given time.
2000-11-06 Federico Mena Quintero <federico@helixcode.com>
* src/libical/icalvalue.c (icalvalue_recur_as_ical_string): Handle
both the position and weekday in the by_day field.
2000-10-20 Eric Busboom <eric@agony.busboom.org>
* Const correctness. Added 'const' all over everywhere.
2000-10-19 Eric Busboom <eric@agony.busboom.org>
* icalproperty, icalparameter, icalvalue .c, .h Changed most
instances of char* to const char*
* icalclassify.h Added multiple include protection
* icalset.h and others, got rid of parameter named "new"
2000-10-15 Eric Busboom <eric@softwarestudio.org>
* icalcomponent Added convienience functions for constructing
components: icalcomponent_new_vcalendar(), etc.
* Makefile.am Incorporated build system patch from Federico
Quintero. Misc small fixes and cleanup
* scripts Incorporated auto-gen patch from Frederico. Generated
code in libical now uses icalproperty.c.in (etc) instead of
editing file icalparoperty.c in place.
* libical. Changed flex/bison to use the -P/-p options to set
ical_yy as a prefix. Removed prefix redefinition from icalyacc.y
2000-10-12 Eric Busboom <eric@softwarestudio.org>
* icalproperty.c Fixed icalproperty_get_{first,next}_parameter to
honor the parameter kind argument
* icalparameter.c Added, but did not complete, a new version of
icalparameters_from_string that does not use the hairy nested
case/switch statements of the previous version
2000-10-02 Eric Busboom <eric@softwarestudio.org>
* ical.h ical.h and icalss.h now are concatenations of all of the
public headers for their respective libraries. Thus, only ical.h,
icalss.h and icalvcal.h need to be installed.
2000-09-11 Eric Busboom <eric@softwarestudio.org>
* icalvcal.c Added more comments
2000-08-31 JP Rosevear <jpr@helixcode.com>
* configure.in: Don't list config.h in AC_OUTPUT
2000-08-26 Ettore Perazzoli <ettore@helixcode.com>
* examples/Makefile.am (INCLUDES): More `$(srcdir)' loving.
* src/libicalvcal/Makefile.am (INCLUDES): Add `-I
$(srcdir)/../libical' for builddir != srcdir loving.
2000-08-25 Christopher James Lahey <clahey@helixcode.com>
* examples/access_properties_and_parameters.c,
src/libicalvcal/vcc.y: Got rid of some warnings.
* src/libicalvcal/vcc.c: Checking in generated C file.
2000-08-25 Christopher James Lahey <clahey@helixcode.com>
* src/libical/icalcomponent.c: Fixed an incorrect struct name.
2000-08-25 Peter Williams <peterw@helixcode.com>
* src/libical/icalcomponent.c (icalcomponent_end_component): Compile fix;
use icalerror_check_arg_re so we can return an valid icalcompiter.
(icalcomponent_begin_component): Same.
2000-08-24 Federico Mena Quintero <federico@helixcode.com>
* src/test/Makefile.am: Make it work.
2000-08-04 Eric Busboom <eric@softwarestudio.org>
* stow.c Changed stow to write data to a file ( icalfileset) not a
calendar. Also added MIME parsing capability
* sspm.c Core of the mime processor. Now handles quoted-printable
and base64 encodings
* icalmime.h New file that parses mime data and returns an
icalcomponent that includes all of the parts.
2000-07-26 Eric Busboom <eric@softwarestudio.org>
* icaldirset.h misc bug fixes to get deleting components to work
* icalcomponent.h Eliminated internal use of _get_first_component
and _get_next_component, since these will reset the interal
iterators.
2000-07-23 Eric Busboom <eric@softwarestudio.org>
* icalcomponent.h Added external iterators to icalcomponent for
subcomponents: icalcompiter. These are still experimental, but they
seem to work OK and have a nice syntax
2000-07-18 Eric Busboom <eric@softwarestudio.org>
* icalset This is a new "superclass" for icalstore, icalcluster,
and others. It merges the interfaces of the old icalstore and
icalcluster
* icalstore.{c,h} CHanged name to icaldirset
* icalcluster.{c,h} Changed name to icalfileset
2000-06-12 Eric Busboom <eric@softwarestudio.org>
* icalstow.c misc improvements and bug fixes to make it useful.
2000-06-09 Eric Busboom <eric@softwarestudio.org>
* icalrecur.c More extensive code changes for recurrence rule.
* icalyacc.y Added support for integers in by day lists
2000-06-01 Eric Busboom <eric@softwarestudio.org>
* icalrecur.c moved recur code into new files
2000-05-30 Eric Busboom <eric@softwarestudio.org>
* icaltypes.c Extensive work on code to expand recurences
* icaltypes.h Changed signature icaltimetype_from_timet to include
is_utc flag.
2000-03-17 Eric Busboom <eric@softwarestudio.org>
* icalstore.c Vastly improved icalstore_test.
2000-03-16 Eric Busboom <eric@softwarestudio.org>
* icalcluster.c Added compile flag (ICAL_SAFESAVES) to switch how
icalcluster saves files during commits. When the flag is define,
it will write the data to a temorar file and rename the file to
the target file.
* storage.c Added seterate test suite for sotage components
* icalparser.c Created parser object, implemented line-oriented
parsering, and made message oriented parsing work in terms f line
oriented parsing.
* icalparser.c Fixed icalparser_get_line to remove \r in input.

Просмотреть файл

@ -0,0 +1,24 @@
Building the library
--------------------
This distribution is developed on Red Hat Linux 6.0 and usually
compiles on SunOS 5.6 and FreeBSD 2.27. I have reports of success of
previous version on MacOS ( with CodeWarrior ) and on UnixWare, but I
don't know about any other systems.
The library is configured with automake. From the root directory, run
./configure
To build all of the Makefiles for your system. If you will be installing the library, you may want to use the --prefix flag to set the directory where the library and header files will be installed.
./configure --prefix=/proj/local/
If configure runs fine, run "make" to build the library and
"make install" to install it.
The current version of libical focuses on creating and
manipulating iCal objects. With it, you can parse text representations
of iCal components, add and remove sub-components, properties,
parameters and values, and print the components back out as strings.

Просмотреть файл

@ -0,0 +1,9 @@
EXTRA_DIST = \
ChangeLog \
README \
TEST \
TODO
SUBDIRS = design-data doc scripts test-data src examples

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,100 @@
LIBICAL -- An implementation of basic iCAL protocols
The code and datafiles in this distribution are licensed under the
Mozilla Public License. See http://www.mozilla.org/NPL/MPL-1.0.html
for a copy of the license. Alternately, you may use libical under the
terms of the GNU Library General Public License. See
http://www.fsf.org/copyleft/lesser.html for a copy of the LGPL.
This dual license ensures that the library can be incorporated into
both proprietary code and GPL'd programs, and will benefit from
improvements made by programmers in both realms. I will only accept
changes into my version of the library if they are similarly
dual-licensed.
The code in this distribution implements the iCal protocols as
described in RFC2445 and RFC2446. The code is in very early stages of
development.
Portions of this distribution are (C) Copyright 1996 Apple Computer,
Inc., AT&T Corp., International Business Machines Corporation and
Siemens Rolm Communications Inc. See src/libicalvcal/README.TXT for
details.
This code is under active development. If you would like to contribute
to the project, you can contact me, Eric Busboom, at
eric@softwarestudio.org. The project has a webpage at
http://softwarestudio.org/libical/index.html
and a mailing list that you can join by sending the following mail:
------------
To: minimalist@softwarestudio.org
Subject: subscribe libical
------------
Building the library
--------------------
This distribution is developed on Red Hat Linux 6.0 and usually
compiles on SunOS 5.6 and FreeBSD 2.27. I have reports of success of
previous version on MacOS ( with CodeWarrior ) and on UnixWare, but I
don't know about any other systems.
The library is configured with automake. From the root directory, run
./configure
To build all of the Makefiles for your system. If you will be installing the library, you may want to use the --prefix flag to set the directory where the library and header files will be installed.
./configure --prefix=/proj/local/
If configure runs fine, run "make" to build the library and
"make install" to install it.
Although the distribution uses libtool to generate libraries, it has
shared libraries turned off by default. To create and install shared
libraries use:
./configure --enable-shared
The current version of libical focuses on creating and
manipulating iCal objects. With it, you can parse text representations
of iCal components, add and remove sub-components, properties,
parameters and values, and print the components back out as strings.
Notes for Libical Developers
-------------------
If you don't want to use gcc as the compiler, and you got the sources
from CVS, you should set the CC variable to the path to the compiler
and run "automake --include-deps" to keep automake from using
gcc-specific automatic dependancy tracking.
> CC=/pkg/SUNWspro/bin/cc; export CC
> automake --include-deps
> ./configure --prefix=/proj/local/
> make
You will not need to re-run automake unless you got the sources from CVS.
Using the Library
-----------------
There is rudimentary, unfinished documentation in the /doc directory,
and annotated examples in /examples.
Perl Library
------------
There is a perl language binding of this library, LIBICAL.
It is available from http://www.softwarestudio.org/libical
Eric Busboom
eric@softwarestudio.org

Просмотреть файл

Просмотреть файл

@ -0,0 +1,54 @@
Thanks to:
Allan Clark <allanc@atlas.platypus.bc.ca> for testing libical against
UnixWare.
Graham Davison <g.m.davison@computer.org> for MacOS support and
miscelaneous code bits
Seth Alves <alves@hungry.com> for the first cut at the Makefile.am
files and various utility functions.
Russ Steinthal <rms39@columbia.edu> for several utility functions and
comments.
Ola Lundqvist <olalu526@student.liu.se> for the vCal test data file.
Colin DuPlantis <colin@cp.net> for new functions in icalparser.c
Holger Schmidt <hschmidt@chronolabs.de> for all of icalcstp.c, The
CSTP protocol implementation, and modifications to icalcstp.h
Gisle Hannemyr <gisle@oslonett.no> The decode*() functions in sspm.c
are based on the decode() routine in the mimelite program, Copyright
(c) 1994 Gisle Hannemyr.
The Evolution team at Helixcode ( Federico Mena Quintero
<federico@helixcode.com>, JP Rosevear <jpr@helixcode.com>, Ettore
Perazzoli <ettore@helixcode.com>, Christopher James Lahey
<clahey@helixcode.com>, Peter Williams <peterw@helixcode.com>) for
miscelaneous patches and adjustments to the build system.
Cornelius Schumacher <schumacher@kde.org> for many insightful
suggestions and a few patches.
Mark D. Anderson <mda@discerning.com> for discussions and ideas.
Martin Neimeier <nei@ibn.de> for correcting bugs in icalrecur.c
Tom Leitner <tom@radar.tu-graz.ac.at> For several bug fixes in
compiling on Tru64 UNIX.
Patrick Lewis <plewis@inetarena.com> for several bug reports and
contributions to the Python bindings
Larry W. Virden <lvirden@cas.org> for several bug reports in compiling
on Solaris.
Bryan Bartone <bsb@mesasys.com> for code changes based on porting
libical to Windows.
Hubert V <hubertv@bigfoot.com> for checking and analyzing the output
of the recurrence rule system.
Jonathan Yue <jonathan.yue@cp.net> for icalproperty_get_name()

Просмотреть файл

Просмотреть файл

@ -0,0 +1,20 @@
/* Define to make icalerror_* calls abort instead of internally
signalling an error */
#undef ICAL_ERRORS_ARE_FATAL
/* Define to make icalcluster_commit() save to a temp file and mv to
the original file instead of writing to the orig file directly */
#undef ICAL_SAFESAVES
/* Define to terminate lines with "\n" instead of "\r\n" */
#undef ICAL_UNIX_NEWLINE
/* Define if your libc defines a "timezone" variable */
#undef HAVE_TIMEZONE
/* Define if your libc defines a struct tm containing a "tm_gmtoff" member */
#undef HAVE_TM_GMTOFF
/* Define to 1 if your compile does not like lines like: struct
something foo[]*/
#undef ICAL_NO_EMPTY_ARRAY_DECL

0
other-licenses/libical/aclocal.m4 поставляемый Normal file
Просмотреть файл

0
other-licenses/libical/config.guess поставляемый Executable file
Просмотреть файл

Просмотреть файл

0
other-licenses/libical/config.sub поставляемый Executable file
Просмотреть файл

0
other-licenses/libical/configure поставляемый Executable file
Просмотреть файл

Просмотреть файл

@ -0,0 +1,104 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(src)
AM_INIT_AUTOMAKE(libical,0.23)
AM_CONFIG_HEADER(config.h)
dnl Initialize maintainer mode
AM_MAINTAINER_MODE
dnl Checks for programs.
AC_PROG_YACC
AC_PROG_CC
AM_PROG_LEX
AC_PROG_LN_S
AC_PROG_INSTALL
dnl Initialize libtool
AM_PROG_LIBTOOL
AC_SUBST(AR)
AC_CHECK_PROGS(AR, ar aal, ar)
AC_CHECK_PROGS(PERL, perl5 perl)
AC_DEFINE(ICAL_ERRORS_ARE_FATAL,1)
AC_DEFINE(ICAL_SAFESAVES,1)
AC_DEFINE(ICAL_UNIX_NEWLINE,1)
dnl AC_DEFINE(ICAL_NO_EMPTY_ARRAY_DECL)
dnl Checks for libraries.
dnl Replace `main' with a function in -lical:
dnl AC_CHECK_LIB(ical, main)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(time.h sys/types.h assert.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
dnl Checks for library functions.
AC_CHECK_FUNCS(strdup)
dnl **************************************************
dnl * Check for Python
dnl **************************************************
python_val=false
AC_ARG_ENABLE(python-bindings,
[ --enable-python-bindings=[yes/no] Enable python bindings],,enable_python_bindings=yes)
if test "x$enable_python_bindings" = "xyes"; then
python_val=true
else
python_val=false
fi
if $python_val; then
AC_CHECK_PROG(python_val, python, true, false)
fi
if $python_val; then
AC_CHECK_PROG(python_val, swig, true, false)
fi
if $python_val; then
PY_PREFIX=`python -c 'import sys ; print sys.prefix'`
PY_EXEC_PREFIX=`python -c 'import sys ; print sys.exec_prefix'`
changequote(<<, >>)dnl
PY_VERSION=`python -c 'import sys ; print sys.version[0:3]'`
changequote([, ])dnl
if test -f $PY_PREFIX/include/python$PY_VERSION/Python.h; then
PY_LIBS="python$PY_VERSION"
PY_LIB_LOC="-L$PY_EXEC_PREFIX/lib/python$PY_VERSION/config"
PY_CFLAGS="-I$PY_PREFIX/include/python$PY_VERSION"
PY_MAKEFILE="$PY_EXEC_PREFIX/lib/python$PY_VERSION/config/Makefile"
PY_LOCALMODLIBS=`sed -n -e 's/^LOCALMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_BASEMODLIBS=`sed -n -e 's/^BASEMODLIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_OTHER_LIBS=`sed -n -e 's/^LIBS=\(.*\)/\1/p' $PY_MAKEFILE`
PY_EXTRA_LIBS="$PY_LOCALMODLIBS $PY_BASEMODLIBS $PY_OTHER_LIBS"
AC_SUBST(PY_LIBS)
AC_SUBST(PY_LIB_LOC)
AC_SUBST(PY_CFLAGS)
AC_SUBST(PY_EXTRA_LIBS)
else
python_val=false
fi
fi
AM_CONDITIONAL(WITH_PYTHON, $python_val)
AC_OUTPUT([
Makefile
design-data/Makefile
doc/Makefile
examples/Makefile
scripts/Makefile
src/Makefile
src/libical/Makefile
src/libical/icalversion.h
src/libicalss/Makefile
src/libicalvcal/Makefile
src/python/Makefile
src/test/Makefile
test-data/Makefile
])

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,24 @@
"#Name ","C Type","Enumeration Values"
"ALTREP","const char*",
"CN","const char*",
"CUTYPE","icalparameter_cutype","INDIVIDUAL;GROUP;RESOURCE;ROOM;UNKNOWN"
"DELEGATED-FROM","const char*",
"DELEGATED-TO","const char*",
"DIR","const char*",
"ENCODING","icalparameter_encoding","8BIT;BASE64"
"FBTYPE","icalparameter_fbtype","FREE;BUSY;BUSYUNAVAILABLE;BUSYTENTATIVE"
"FMTTYPE","const char*",
"LANGUAGE","const char*",
"MEMBER","const char*",
"PARTSTAT","icalparameter_partstat","NEEDS-ACTION;ACCEPTED;DECLINED;TENTATIVE;DELEGATED;COMPLETED;INPROCESS"
"RANGE","icalparameter_range","THISANDPRIOR;THISANDFUTURE"
"RELATED","icalparameter_related","START;END "
"RELTYPE","icalparameter_reltype","PARENT;CHILD;SIBLING"
"ROLE","icalparameter_role","CHAIR;REQ-PARTICIPANT;OPT-PARTICIPANT;NON-PARTICIPANT"
"RSVP","icalparameter_rsvp","TRUE;FALSE"
"SENT-BY","const char*",
"TZID","const char*",
"VALUE","icalparameter_value","BINARY;BOOLEAN;DATE;DURATION;FLOAT;INTEGER;PERIOD;RECUR;TEXT;TIME;URI;ERROR;DATE-TIME;UTC-OFFSET;CAL-ADDRESS"
"X","const char*",
"X-LIC-ERRORTYPE","icalparameter_xlicerrortype","COMPONENT-PARSE-ERROR;PROPERTY-PARSE-ERROR;PARAMETER-NAME-PARSE-ERROR;PARAMETER-VALUE-PARSE-ERROR;VALUE-PARSE-ERROR;INVALID-ITIP;UNKNOWN-VCAL-PROP-ERROR;MIME-PARSE-ERROR"
"X-LIC-COMPARETYPE","icalparameter_xliccomparetype","EQUAL;NOTEQUAL;LESS;GREATER;LESSEQUAL;GREATEREQUAL;REGEX"
1 #Name C Type Enumeration Values
2 ALTREP const char*
3 CN const char*
4 CUTYPE icalparameter_cutype INDIVIDUAL;GROUP;RESOURCE;ROOM;UNKNOWN
5 DELEGATED-FROM const char*
6 DELEGATED-TO const char*
7 DIR const char*
8 ENCODING icalparameter_encoding 8BIT;BASE64
9 FBTYPE icalparameter_fbtype FREE;BUSY;BUSYUNAVAILABLE;BUSYTENTATIVE
10 FMTTYPE const char*
11 LANGUAGE const char*
12 MEMBER const char*
13 PARTSTAT icalparameter_partstat NEEDS-ACTION;ACCEPTED;DECLINED;TENTATIVE;DELEGATED;COMPLETED;INPROCESS
14 RANGE icalparameter_range THISANDPRIOR;THISANDFUTURE
15 RELATED icalparameter_related START;END
16 RELTYPE icalparameter_reltype PARENT;CHILD;SIBLING
17 ROLE icalparameter_role CHAIR;REQ-PARTICIPANT;OPT-PARTICIPANT;NON-PARTICIPANT
18 RSVP icalparameter_rsvp TRUE;FALSE
19 SENT-BY const char*
20 TZID const char*
21 VALUE icalparameter_value BINARY;BOOLEAN;DATE;DURATION;FLOAT;INTEGER;PERIOD;RECUR;TEXT;TIME;URI;ERROR;DATE-TIME;UTC-OFFSET;CAL-ADDRESS
22 X const char*
23 X-LIC-ERRORTYPE icalparameter_xlicerrortype COMPONENT-PARSE-ERROR;PROPERTY-PARSE-ERROR;PARAMETER-NAME-PARSE-ERROR;PARAMETER-VALUE-PARSE-ERROR;VALUE-PARSE-ERROR;INVALID-ITIP;UNKNOWN-VCAL-PROP-ERROR;MIME-PARSE-ERROR
24 X-LIC-COMPARETYPE icalparameter_xliccomparetype EQUAL;NOTEQUAL;LESS;GREATER;LESSEQUAL;GREATEREQUAL;REGEX

Просмотреть файл

@ -0,0 +1,66 @@
,,
"#Property Name","libical Value type","iCalendar default value"
"ACTION","ACTION","ACTION"
"ATTACH","ATTACH","URI"
"ATTENDEE","CAL-ADDRESS","CAL-ADDRESS"
"CALSCALE","TEXT","TEXT"
"CATEGORIES","TEXT","TEXT"
"CLASS","TEXT","TEXT"
"COMMENT","TEXT","TEXT"
"COMPLETED","DATE-TIME","DATE-TIME"
"CONTACT","TEXT","TEXT"
"CREATED","DATE-TIME","DATE-TIME"
"DESCRIPTION","TEXT","TEXT"
"DTEND","DATE-TIME","DATE-TIME"
"DTSTAMP","DATE-TIME","DATE-TIME"
"DTSTART","DATE-TIME","DATE-TIME"
"DUE","DATE-TIME","DATE-TIME"
"DURATION","DURATION","DURATION"
"EXDATE","DATE-TIME","DATE-TIME"
"EXRULE","RECUR","RECUR"
"FREEBUSY","PERIOD","PERIOD"
"GEO","GEO","GEO"
"LAST-MODIFIED","DATE-TIME","DATE-TIME"
"LOCATION","TEXT","TEXT"
"METHOD","METHOD","METHOD"
"ORGANIZER","CAL-ADDRESS","CAL-ADDRESS"
"PERCENT-COMPLETE","INTEGER","INTEGER"
"PRIORITY","INTEGER","INTEGER"
"PRODID","TEXT","TEXT"
"RDATE","DATE-TIME-PERIOD","DATE-TIME"
"RECURRENCE-ID","DATE-TIME","DATE-TIME"
"RELATED-TO","TEXT","TEXT"
"REPEAT","INTEGER","INTEGER"
"REQUEST-STATUS","STRING","STRING"
"RESOURCES","TEXT","TEXT"
"RRULE","RECUR","RECUR"
"SEQUENCE","INTEGER","INTEGER"
"STATUS","STATUS","STATUS"
"SUMMARY","TEXT","TEXT"
"TRANSP","TEXT","TEXT"
"TRIGGER","TRIGGER","DURATION"
"TZID","TEXT","TEXT"
"TZNAME","TEXT","TEXT"
"TZOFFSETFROM","UTC-OFFSET","UTC-OFFSET"
"TZOFFSETTO","UTC-OFFSET","UTC-OFFSET"
"TZURL","URI","URI"
"UID","TEXT","TEXT"
"URL","URI","URI"
"VERSION","TEXT","TEXT"
"X","TEXT","TEXT"
"SCOPE","TEXT","TEXT"
"MAXRESULTS","INTEGER","INTEGER"
"MAXRESULTSSIZE","INTEGER","INTEGER"
"QUERY","QUERY","QUERY"
"QUERYNAME","TEXT","TEXT"
"TARGET","CAL-ADDRESS","CAL-ADDRESS"
"X-LIC-ERROR","TEXT","TEXT"
"X-LIC-CLUSTERCOUNT","STRING","STRING"
"X-LIC-MIMECONTENTTYPE","STRING","STRING"
"X-LIC-MIMECHARSET","STRING","STRING"
"X-LIC-MIMEENCODING","STRING","STRING"
"X-LIC-MIMEOPTINFO","STRING","STRING"
"X-LIC-MIMECID","STRING","STRING"
"X-LIC-MIMEFILENAME","STRING","STRING"
"ANY","NO","NO"
"NO","NO","NO"
1
2 #Property Name libical Value type iCalendar default value
3 ACTION ACTION ACTION
4 ATTACH ATTACH URI
5 ATTENDEE CAL-ADDRESS CAL-ADDRESS
6 CALSCALE TEXT TEXT
7 CATEGORIES TEXT TEXT
8 CLASS TEXT TEXT
9 COMMENT TEXT TEXT
10 COMPLETED DATE-TIME DATE-TIME
11 CONTACT TEXT TEXT
12 CREATED DATE-TIME DATE-TIME
13 DESCRIPTION TEXT TEXT
14 DTEND DATE-TIME DATE-TIME
15 DTSTAMP DATE-TIME DATE-TIME
16 DTSTART DATE-TIME DATE-TIME
17 DUE DATE-TIME DATE-TIME
18 DURATION DURATION DURATION
19 EXDATE DATE-TIME DATE-TIME
20 EXRULE RECUR RECUR
21 FREEBUSY PERIOD PERIOD
22 GEO GEO GEO
23 LAST-MODIFIED DATE-TIME DATE-TIME
24 LOCATION TEXT TEXT
25 METHOD METHOD METHOD
26 ORGANIZER CAL-ADDRESS CAL-ADDRESS
27 PERCENT-COMPLETE INTEGER INTEGER
28 PRIORITY INTEGER INTEGER
29 PRODID TEXT TEXT
30 RDATE DATE-TIME-PERIOD DATE-TIME
31 RECURRENCE-ID DATE-TIME DATE-TIME
32 RELATED-TO TEXT TEXT
33 REPEAT INTEGER INTEGER
34 REQUEST-STATUS STRING STRING
35 RESOURCES TEXT TEXT
36 RRULE RECUR RECUR
37 SEQUENCE INTEGER INTEGER
38 STATUS STATUS STATUS
39 SUMMARY TEXT TEXT
40 TRANSP TEXT TEXT
41 TRIGGER TRIGGER DURATION
42 TZID TEXT TEXT
43 TZNAME TEXT TEXT
44 TZOFFSETFROM UTC-OFFSET UTC-OFFSET
45 TZOFFSETTO UTC-OFFSET UTC-OFFSET
46 TZURL URI URI
47 UID TEXT TEXT
48 URL URI URI
49 VERSION TEXT TEXT
50 X TEXT TEXT
51 SCOPE TEXT TEXT
52 MAXRESULTS INTEGER INTEGER
53 MAXRESULTSSIZE INTEGER INTEGER
54 QUERY QUERY QUERY
55 QUERYNAME TEXT TEXT
56 TARGET CAL-ADDRESS CAL-ADDRESS
57 X-LIC-ERROR TEXT TEXT
58 X-LIC-CLUSTERCOUNT STRING STRING
59 X-LIC-MIMECONTENTTYPE STRING STRING
60 X-LIC-MIMECHARSET STRING STRING
61 X-LIC-MIMEENCODING STRING STRING
62 X-LIC-MIMEOPTINFO STRING STRING
63 X-LIC-MIMECID STRING STRING
64 X-LIC-MIMEFILENAME STRING STRING
65 ANY NO NO
66 NO NO NO

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,31 @@
"#Name","C type& gen flag","Python","Component Values","Enum Values"
"BINARY","(a)const char*","file","unitary",
"BOOLEAN","(a)int","integer","unitary",
"CAL-ADDRESS","(a)const char*","string","unitary",
"DATE","(a)struct icaltimetype","Time","unitary",
"DATE-TIME","(a)struct icaltimetype","Time","unitary",
"DURATION","(a)struct icaldurationtype","Duration","unitary",
"FLOAT","(a)float","float","unitary",
"INTEGER","(a)int","integer","unitary",
"PERIOD","(a)struct icalperiodtype","Period","unitary",
"RECUR","(m)struct icalrecurrencetype","RecurrenceSet","unitary",
"TEXT","(a)const char*","string","unitary",
"TIME","(a)struct icaltimetype","Time","unitary",
"URI","(a)const char*","string","unitary",
"UTC-OFFSET","(a)int","integer","unitary",
"QUERY","(a)const char*","string","unitary",
"#Non-standard multi-valued types",,,,
"ATTACH","(a)struct icalattachtype","none","URI;BINARY",
"DATE-TIME-DATE","(a)struct icaltimetype","none","DATE-TIME;DATE",
"DATE-TIME-PERIOD","(m)struct icaldatetimeperiodtype","none","DATE-TIME;PERIOD",
"TRIGGER","(m)struct icaltriggertype","string","DURATION;DATE-TIME",
"#Non-standard property enumeration types",,,,
"METHOD","(a)enum icalproperty_method","string","unitary","PUBLISH;REQUEST;REPLY;ADD;CANCEL;REFRESH;COUNTER;DECLINECOUNTER;CREATE;READ;RESPONSE;MOVE;MODIFY;GENERATEUID;DELETE"
"ACTION","(a)enum icalproperty_action","string","unitary","AUDIO;DISPLAY;EMAIL;PROCEDURE"
"STATUS","(a)enum icalproperty_status","string","unitary","TENTATIVE;CONFIRMED;COMPLETED;NEEDS-ACTION;CANCELLED;IN-PROCESS;DRAFT;FINAL"
"TRANSP","(a)enum icalproperty_transp","string","unitary","OPAQUE;TRANSPARENT"
"CLASS","(a)enum icalproperty_class","string","unitary","PUBLIC;PRIVATE;CONFIDENTIAL"
"#Other non-standard",,,,
"GEO","(a)struct icalgeotype","tuple","unitary",
"STRING","(a)const char*","string","unitary",
"X","(m)const char*","string","unitary",
1 #Name C type& gen flag Python Component Values Enum Values
2 BINARY (a)const char* file unitary
3 BOOLEAN (a)int integer unitary
4 CAL-ADDRESS (a)const char* string unitary
5 DATE (a)struct icaltimetype Time unitary
6 DATE-TIME (a)struct icaltimetype Time unitary
7 DURATION (a)struct icaldurationtype Duration unitary
8 FLOAT (a)float float unitary
9 INTEGER (a)int integer unitary
10 PERIOD (a)struct icalperiodtype Period unitary
11 RECUR (m)struct icalrecurrencetype RecurrenceSet unitary
12 TEXT (a)const char* string unitary
13 TIME (a)struct icaltimetype Time unitary
14 URI (a)const char* string unitary
15 UTC-OFFSET (a)int integer unitary
16 QUERY (a)const char* string unitary
17 #Non-standard multi-valued types
18 ATTACH (a)struct icalattachtype none URI;BINARY
19 DATE-TIME-DATE (a)struct icaltimetype none DATE-TIME;DATE
20 DATE-TIME-PERIOD (m)struct icaldatetimeperiodtype none DATE-TIME;PERIOD
21 TRIGGER (m)struct icaltriggertype string DURATION;DATE-TIME
22 #Non-standard property enumeration types
23 METHOD (a)enum icalproperty_method string unitary PUBLISH;REQUEST;REPLY;ADD;CANCEL;REFRESH;COUNTER;DECLINECOUNTER;CREATE;READ;RESPONSE;MOVE;MODIFY;GENERATEUID;DELETE
24 ACTION (a)enum icalproperty_action string unitary AUDIO;DISPLAY;EMAIL;PROCEDURE
25 STATUS (a)enum icalproperty_status string unitary TENTATIVE;CONFIRMED;COMPLETED;NEEDS-ACTION;CANCELLED;IN-PROCESS;DRAFT;FINAL
26 TRANSP (a)enum icalproperty_transp string unitary OPAQUE;TRANSPARENT
27 CLASS (a)enum icalproperty_class string unitary PUBLIC;PRIVATE;CONFIDENTIAL
28 #Other non-standard
29 GEO (a)struct icalgeotype tuple unitary
30 STRING (a)const char* string unitary
31 X (m)const char* string unitary

Просмотреть файл

Просмотреть файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,319 @@
/* Access_component.c */
#include "ical.h"
#include <assert.h>
#include <string.h> /* for strdup */
#include <stdlib.h> /* for malloc */
#include <stdio.h> /* for printf */
#include <time.h> /* for time() */
#include "icalmemory.h"
void do_something(icalcomponent *c);
/* Creating iCal Components
There are two ways to create new component in libical. You can
build the component from primitive parts, or you can create it
from a string.
There are two variations of the API for building the component from
primitive parts. In the first variation, you add each parameter and
value to a property, and then add each property to a
component. This results in a long series of function calls. This
style is show in create_new_component()
The second variation uses vargs lists to nest many primitive part
constructors, resulting in a compact, neatly formated way to create
components. This style is shown in create_new_component_with_va_args()
*/
icalcomponent* create_new_component()
{
/* variable definitions */
icalcomponent* calendar;
icalcomponent* event;
struct icaltimetype atime = icaltime_from_timet( time(0),0);
struct icalperiodtype rtime;
icalproperty* property;
/* Define a time type that will use as data later. */
rtime.start = icaltime_from_timet( time(0),0);
rtime.end = icaltime_from_timet( time(0),0);
rtime.end.hour++;
/* Create calendar and add properties */
calendar = icalcomponent_new(ICAL_VCALENDAR_COMPONENT);
/* Nearly every libical function call has the same general
form. The first part of the name defines the 'class' for the
function, and the first argument will be a pointer to a struct
of that class. So, icalcomponent_ functions will all take
icalcomponent* as their first argument. */
/* The next call creates a new proeprty and immediately adds it to the
'calendar' component. */
icalcomponent_add_property(
calendar,
icalproperty_new_version("2.0")
);
/* Here is the short version of the memory rules:
If the routine name has "new" in it:
Caller owns the returned memory.
If you pass in a string, the routine takes the memory.
If the routine name has "add" in it:
The routine takes control of the component, property,
parameter or value memory.
If the routine returns a string ( "get" and "as_ical_string" )
The library owns the returned memory.
There are more rules, so refer to the documentation for more
details.
*/
icalcomponent_add_property(
calendar,
icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN")
);
/* Add an event */
event = icalcomponent_new(ICAL_VEVENT_COMPONENT);
icalcomponent_add_property(
event,
icalproperty_new_dtstamp(atime)
);
/* In the previous call, atime is a struct, and it is passed in by value.
This is how all compound types of values are handled. */
icalcomponent_add_property(
event,
icalproperty_new_uid("guid-1.host1.com")
);
/* add a property that has parameters */
property = icalproperty_new_organizer("mailto:mrbig@host.com");
icalproperty_add_parameter(
property,
icalparameter_new_role(ICAL_ROLE_CHAIR)
);
icalcomponent_add_property(event,property);
/* In this style of component creation, you need to use an extra
call to add parameters to properties, but the form of this
operation is the same as adding a property to a component */
/* add another property that has parameters */
property = icalproperty_new_attendee("mailto:employee-A@host.com");
icalproperty_add_parameter(
property,
icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT)
);
icalproperty_add_parameter(
property,
icalparameter_new_rsvp(1)
);
icalproperty_add_parameter(
property,
icalparameter_new_cutype(ICAL_CUTYPE_GROUP)
);
icalcomponent_add_property(event,property);
/* more properties */
icalcomponent_add_property(
event,
icalproperty_new_description("Project XYZ Review Meeting")
);
icalcomponent_add_property(
event,
icalproperty_new_categories("MEETING")
);
icalcomponent_add_property(
event,
icalproperty_new_class("PUBLIC")
);
icalcomponent_add_property(
event,
icalproperty_new_created(atime)
);
icalcomponent_add_property(
event,
icalproperty_new_summary("XYZ Project Review")
);
property = icalproperty_new_dtstart(atime);
icalproperty_add_parameter(
property,
icalparameter_new_tzid("US-Eastern")
);
icalcomponent_add_property(event,property);
property = icalproperty_new_dtend(atime);
icalproperty_add_parameter(
property,
icalparameter_new_tzid("US-Eastern")
);
icalcomponent_add_property(event,property);
icalcomponent_add_property(
event,
icalproperty_new_location("1CP Conference Room 4350")
);
icalcomponent_add_component(calendar,event);
return calendar;
}
/* Now, create the same component as in the previous routine, but use
the constructor style. */
icalcomponent* create_new_component_with_va_args()
{
/* This is a similar set up to the last routine */
icalcomponent* calendar;
struct icaltimetype atime = icaltime_from_timet( time(0),0);
struct icalperiodtype rtime;
rtime.start = icaltime_from_timet( time(0),0);
rtime.end = icaltime_from_timet( time(0),0);
rtime.end.hour++;
/* Some of these routines are the same as those in the previous
routine, but we've also added several 'vanew' routines. These
'vanew' routines take a list of properties, parameters or
values and add each of them to the parent property or
component. */
calendar =
icalcomponent_vanew(
ICAL_VCALENDAR_COMPONENT,
icalproperty_new_version("2.0"),
icalproperty_new_prodid("-//RDU Software//NONSGML HandCal//EN"),
icalcomponent_vanew(
ICAL_VEVENT_COMPONENT,
icalproperty_new_dtstamp(atime),
icalproperty_new_uid("guid-1.host1.com"),
icalproperty_vanew_organizer(
"mailto:mrbig@host.com",
icalparameter_new_role(ICAL_ROLE_CHAIR),
0
),
icalproperty_vanew_attendee(
"mailto:employee-A@host.com",
icalparameter_new_role(ICAL_ROLE_REQPARTICIPANT),
icalparameter_new_rsvp(1),
icalparameter_new_cutype(ICAL_CUTYPE_GROUP),
0
),
icalproperty_new_description("Project XYZ Review Meeting"),
icalproperty_new_categories("MEETING"),
icalproperty_new_class("PUBLIC"),
icalproperty_new_created(atime),
icalproperty_new_summary("XYZ Project Review"),
icalproperty_vanew_dtstart(
atime,
icalparameter_new_tzid("US-Eastern"),
0
),
icalproperty_vanew_dtend(
atime,
icalparameter_new_tzid("US-Eastern"),
0
),
icalproperty_new_location("1CP Conference Room 4350"),
0
),
0
);
/* Note that properties with no parameters can use the regular
'new' constructor, while those with parameters use the 'vanew'
constructor. And, be sure that the last argument in the 'vanew'
call is a zero. Without, your program will probably crash. */
return calendar;
}
void find_sub_components(icalcomponent* comp)
{
icalcomponent *c;
/* The second parameter to icalcomponent_get_first_component
indicates the type of component to search for. This will
iterate through all sub-components */
for(c = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT);
c != 0;
c = icalcomponent_get_next_component(comp,ICAL_ANY_COMPONENT)){
do_something(c);
}
/* This will iterate only though VEVENT sub-components */
for(c = icalcomponent_get_first_component(comp,ICAL_VEVENT_COMPONENT);
c != 0;
c = icalcomponent_get_next_component(comp,ICAL_VEVENT_COMPONENT)){
do_something(c);
}
}
/* Ical components only have one internal iterator, so removing the
object that the iterator points to can cause problems. Here is the
right way to remove components */
void remove_vevent_sub_components(icalcomponent* comp){
icalcomponent *c, *next;
for( c = icalcomponent_get_first_component(comp,ICAL_VEVENT_COMPONENT);
c != 0;
c = next)
{
next = icalcomponent_get_next_component(comp,ICAL_VEVENT_COMPONENT);
icalcomponent_remove_component(comp,c);
do_something(c);
}
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

0
other-licenses/libical/missing Executable file
Просмотреть файл

Просмотреть файл

@ -0,0 +1,40 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.1 2001-11-15 19:26:24 mikep%oeone.com Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -0,0 +1,170 @@
#!/usr/local/bin/perl
use Getopt::Std;
getopts('chspi:');
# ARG 0 is components.txt
open(PV,"$ARGV[0]") || die "Can't open components file $ARGV[0]:$!";
my @components;
while (<PV>){
s/#.*//;
chop;
push(@components,$_);
}
close PV;
# Write the file inline by copying everything before a demarcation
# line, and putting the generated data after the demarcation
if ($opt_i) {
open(IN,$opt_i) || die "Can't open input file \"$opt_i\"";
while(<IN>){
if (/Do not edit/){
last;
}
print;
}
if($opt_i){
print "# Everything below this line is machine generated. Do not edit. \n";
} else {
print "/* Everything below this line is machine generated. Do not edit. */\n";
}
}
if ($opt_c or $opt_h and !$opt_i){
print <<EOM;
/* -*- Mode: C -*-
======================================================================
FILE: icalderivedproperties.{c,h}
CREATOR: eric 09 May 1999
\044Id:\044
(C) COPYRIGHT 1999 Eric Busboom
http://www.softwarestudio.org
The contents of this file are subject to the Mozilla Public License
Version 1.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and
limitations under the License.
======================================================================*/
/*
* THIS FILE IS MACHINE GENERATED DO NOT EDIT
*/
#include <stdarg.h> /* for va_arg functions */
EOM
}
if ($opt_p and !$opt_i){
print <<EOM;
EOM
}
foreach $comp (@components) {
next if !$comp;
my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$comp));
my $lc = lc($ucf);
my $uc = uc($lc);
if($opt_c) { # Make C source
print<<EOM;
/* $comp */
icalcomponent* icalcomponent_new_${lc}()
{
return (icalcomponent*)icalcomponent_new_impl(ICAL_${uc}_COMPONENT);
}
icalcomponent* icalcomponent_vanew_${lc}(...)
{
va_list args;
struct icalcomponent_impl *impl = icalcomponent_new_impl(ICAL_${uc}_component);
va_start(args,v);
icalcomponent_add_properties(impl, args);
va_end(args);
return (icalcomponent*)impl;
}
EOM
} elsif ($opt_h) { # Make a C header
print<<EOM;
/* $comp */
icalcomponent* icalcomponent_new_${lc}();
icalcomponent* icalcomponent_vanew_${lc}(...);
EOM
} elsif ($opt_s) { # Make something for a switch statement
print <<EOM;
case ICAL_${uc}_PROPERTY:
EOM
} elsif ($opt_p) { # make perl source
print <<EOM;
# $comp
package Net::ICal::Component::${ucf};
\@ISA=qw(Net::ICal::Component);
sub new
{
my \$package = shift;
my \$c = Net::ICal::icalcomponent_new(\$Net::ICal::ICAL_${uc}_COMPONENT);
my \$self = Net::ICal::Component::new_from_ref(\$c);
Net::ICal::Component::_add_elements(\$self,\\\@_);
# Self is blessed in new_from_ref
return \$self;
}
EOM
}
}

Просмотреть файл

@ -0,0 +1,321 @@
#!/usr/local/bin/perl
require "readvaluesfile.pl";
use Getopt::Std;
getopts('chspi:');
%no_xname = (RELATED=>1,RANGE=>1,RSVP=>1,XLICERRORTYPE=>1,XLICCOMPARETYPE=>1);
%params = read_parameters_file($ARGV[0]);
# Write the file inline by copying everything before a demarcation
# line, and putting the generated data after the demarcation
if ($opt_i) {
open(IN,$opt_i) || die "Can't open input file $opt_i";
while(<IN>){
if (/Do not edit/){
last;
}
print;
}
if($opt_p){
print "# Everything below this line is machine generated. Do not edit. \n";
} else {
print "/* Everything below this line is machine generated. Do not edit. */\n";
}
}
# Write parameter string map
if ($opt_c){
}
# Write parameter enumerations and datatypes
if($opt_h){
print "typedef enum icalparameter_kind {\n ICAL_ANY_PARAMETER = 0,\n";
foreach $param (sort keys %params) {
next if !$param;
next if $param eq 'NO' or $param eq 'ANY';
my $uc = join("",map {uc($_);} split(/-/,$param));
my @enums = @{$params{$param}->{'enums'}};
print " ICAL_${uc}_PARAMETER, \n";
}
print " ICAL_NO_PARAMETER\n} icalparameter_kind;\n\n";
# Now create enumerations for parameter values
$idx = 20000;
print "#define ICALPARAMETER_FIRST_ENUM $idx\n\n";
foreach $param (sort keys %params) {
next if !$param;
next if $param eq 'NO' or $prop eq 'ANY';
my $type = $params{$param}->{"C"};
my $ucv = join("",map {uc(lc($_));} split(/-/,$param));
my @enums = @{$params{$param}->{'enums'}};
if(@enums){
print "typedef enum $type {\n";
my $first = 1;
unshift(@enums,"X");
push(@enums,"NONE");
foreach $e (@enums) {
if (!$first){
print ",\n";
} else {
$first = 0;
}
my $uce = join("",map {uc(lc($_));} split(/-/,$e));
print " ICAL_${ucv}_${uce} = $idx";
$idx++;
}
$c_type =~ s/enum //;
print "\n} $type;\n\n";
}
}
print "#define ICALPARAMETER_LAST_ENUM $idx\n\n";
}
if ($opt_c){
# Create the icalparameter_value to icalvalue_kind conversion table
print "struct icalparameter_value_kind_map value_kind_map[] = {\n";
foreach $enum (@{$params{'VALUE'}->{'enums'}}){
next if $enum eq 'NO' or $enum eq 'ERROR';
$uc = join("",map {uc(lc($_));} split(/-/,$enum));
print " {ICAL_VALUE_${uc},ICAL_${uc}_VALUE},\n";
}
print " {ICAL_VALUE_X,ICAL_X_VALUE},\n";
print " {ICAL_VALUE_NONE,ICAL_NO_VALUE}\n};\n\n";
#Create the parameter Name map
print "static struct icalparameter_kind_map parameter_map[] = { \n";
foreach $param (sort keys %params) {
next if !$param;
next if $param eq 'NO' or $prop eq 'ANY';
my $lc = join("",map {lc($_);} split(/-/,$param));
my $uc = join("",map {uc(lc($_));} split(/-/,$param));
print " {ICAL_${uc}_PARAMETER,\"$param\"},\n";
}
print " { ICAL_NO_PARAMETER, \"\"}\n};\n\n";
# Create the parameter value map
print "static struct icalparameter_map icalparameter_map[] = {\n";
print "{ICAL_ANY_PARAMETER,0,\"\"},\n";
foreach $param (sort keys %params) {
next if !$param;
next if $param eq 'NO' or $prop eq 'ANY';
my $type = $params{$param}->{"C"};
my $uc = join("",map {uc(lc($_));} split(/-/,$param));
my @enums = @{$params{$param}->{'enums'}};
if(@enums){
foreach $e (@enums){
my $uce = join("",map {uc(lc($_));} split(/-/,$e));
print " {ICAL_${uc}_PARAMETER,ICAL_${uc}_${uce},\"$e\"},\n";
}
}
}
print " {ICAL_NO_PARAMETER,0,\"\"}};\n\n";
}
foreach $param (keys %params){
my $type = $params{$param}->{'C'};
my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$param));
my $lc = lc($ucf);
my $uc = uc($lc);
my $charorenum;
my $set_code;
my $pointer_check;
my $pointer_check_v;
my $xrange;
if ($type=~/char/ ) {
$charorenum = " icalerror_check_arg_rz( (param!=0), \"param\");\n return ($type)((struct icalparameter_impl*)param)->string;";
$set_code = "((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);";
$pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");";
$pointer_check_v = "icalerror_check_arg_rv( (v!=0),\"v\");";
} else {
$xrange =" if ( ((struct icalparameter_impl*)param)->string != 0){\n return ICAL_${uc}_X;\n }\n" if !exists $no_xname{$uc};
$charorenum= "icalerror_check_arg( (param!=0), \"param\");\n$xrange\nreturn ($type)((struct icalparameter_impl*)param)->data;";
$pointer_check = "icalerror_check_arg_rz(v >= ICAL_${uc}_X,\"v\");\n icalerror_check_arg_rz(v < ICAL_${uc}_NONE,\"v\");";
$pointer_check_v = "icalerror_check_arg_rv(v >= ICAL_${uc}_X,\"v\");\n icalerror_check_arg_rv(v < ICAL_${uc}_NONE,\"v\");";
$set_code = "((struct icalparameter_impl*)param)->data = (int)v;";
}
if ($opt_c) {
print <<EOM;
/* $param */
icalparameter* icalparameter_new_${lc}($type v)
{
struct icalparameter_impl *impl;
icalerror_clear_errno();
$pointer_check
impl = icalparameter_new_impl(ICAL_${uc}_PARAMETER);
if (impl == 0) {
return 0;
}
icalparameter_set_${lc}((icalparameter*) impl,v);
if (icalerrno != ICAL_NO_ERROR) {
icalparameter_free((icalparameter*) impl);
return 0;
}
return (icalparameter*) impl;
}
${type} icalparameter_get_${lc}(icalparameter* param)
{
icalerror_clear_errno();
$charorenum
}
void icalparameter_set_${lc}(icalparameter* param, ${type} v)
{
$pointer_check_v
icalerror_check_arg_rv( (param!=0), "param");
icalerror_clear_errno();
$set_code
}
EOM
} elsif( $opt_h) {
print <<EOM;
/* $param */
icalparameter* icalparameter_new_${lc}($type v);
${type} icalparameter_get_${lc}(icalparameter* value);
void icalparameter_set_${lc}(icalparameter* value, ${type} v);
EOM
}
if ($opt_p) {
print <<EOM;
# $param
package Net::ICal::Parameter::${ucf};
\@ISA=qw(Net::ICal::Parameter);
sub new
{
my \$self = [];
my \$package = shift;
my \$value = shift;
bless \$self, \$package;
my \$p;
if (\$value) {
\$p = Net::ICal::icalparameter_new_from_string(\$Net::ICal::ICAL_${uc}_PARAMETER,\$value);
} else {
\$p = Net::ICal::icalparameter_new(\$Net::ICal::ICAL_${uc}_PARAMETER);
}
\$self->[0] = \$p;
return \$self;
}
sub get
{
my \$self = shift;
my \$impl = \$self->_impl();
return Net::ICal::icalparameter_as_ical_string(\$impl);
}
sub set
{
# This is hard to implement, so I've punted for now.
die "Set is not implemented";
}
EOM
}
}
if ($opt_h){
print <<EOM;
#endif /*ICALPARAMETER_H*/
EOM
}

Просмотреть файл

@ -0,0 +1,217 @@
#!/usr/local/bin/perl
require "readvaluesfile.pl";
use Getopt::Std;
getopts('chspmi:');
# ARG 0 is properties.csv
%propmap = read_properties_file($ARGV[0]);
# ARG 1 is value-types.txt
%valuemap = read_values_file($ARGV[1]);
# Write the file inline by copying everything before a demarcation
# line, and putting the generated data after the demarcation
if ($opt_i) {
open(IN,$opt_i) || die "Can't open input file $opt_i";
while(<IN>){
if (/Do not edit/){
last;
}
print;
}
print "/* Everything below this line is machine generated. Do not edit. */\n";
}
sub fudge_data {
my $prop = shift;
my $value = $propmap{$prop}->{'lic_value'};
if (!$value){
die "Can't find value for property \"$prop\"\n";
}
my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$prop));
my $lc = lc($ucf);
my $uc = uc($lc);
my $ucfvalue = join("",map {ucfirst(lc($_));} split(/-/,$value));
my $lcvalue = lc($ucfvalue);
my $ucvalue = uc($lcvalue);
my $type = $valuemap{$value}->{C}->[1];
return ($uc,$lc,$lcvalue,$ucvalue,$type);
}
# Create the property map data
if($opt_c){
print "static struct icalproperty_map property_map[] = {\n";
foreach $prop (sort keys %propmap) {
next if !$prop;
next if $prop eq 'NO';
my ($uc,$lc,$lcvalue,$ucvalue,$type) = fudge_data($prop);
print "{ICAL_${uc}_PROPERTY,\"$prop\",ICAL_${ucvalue}_VALUE},\n";
}
$prop = "NO";
my ($uc,$lc,$lcvalue,$ucvalue,$type) = fudge_data($prop);
print "{ICAL_${uc}_PROPERTY,\"\",ICAL_NO_VALUE}};\n\n";
print "static struct icalproperty_enum_map enum_map[] = {\n";
$idx = 10000;
foreach $value (sort keys %valuemap) {
next if !$value;
next if $value eq 'NO' or $prop eq 'ANY';
my $ucv = join("",map {uc(lc($_));} split(/-/,$value));
my @enums = @{$valuemap{$value}->{'enums'}};
if(@enums){
my ($c_autogen,$c_type) = @{$valuemap{$value}->{'C'}};
unshift(@enums,"X");
push(@enums,"NONE");
foreach $e (@enums) {
my $uce = join("",map {uc(lc($_));} split(/-/,$e));
if($e ne "X" and $e ne "NONE"){
$str = $e;
} else {
$str = "";
}
print " {ICAL_${ucv}_PROPERTY,ICAL_${ucv}_${uce},\"$str\" }, /*$idx*/\n";
$idx++;
}
}
}
print " {ICAL_NO_PROPERTY,0,\"\"}\n};\n\n";
}
if($opt_h){
# Create the property enumerations list
print "typedef enum icalproperty_kind {\n ICAL_ANY_PROPERTY = 0,\n";
foreach $prop (sort keys %propmap) {
next if !$prop;
next if $prop eq 'NO' or $prop eq 'ANY';
my ($uc,$lc,$lcvalue,$ucvalue,$type) = fudge_data($prop);
print " ICAL_${uc}_PROPERTY, \n";
}
print " ICAL_NO_PROPERTY\n} icalproperty_kind;\n\n";
}
foreach $prop (sort keys %propmap) {
next if !$prop;
next if $prop eq 'NO' or $prop eq 'ANY';
my ($uc,$lc,$lcvalue,$ucvalue,$type) = fudge_data($prop);
my $pointer_check;
if ($type =~ /\*/){
$pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");\n" if $type =~ /\*/;
} elsif ( $type eq "void" ){
$pointer_check = "icalerror_check_arg_rv( (v!=0),\"v\");\n" if $type =~ /\*/;
}
my $set_pointer_check = "icalerror_check_arg_rv( (v!=0),\"v\");\n" if $type =~ /\*/;
if($opt_c) { # Generate C source
print<<EOM;
/* $prop */
icalproperty* icalproperty_new_${lc}($type v) {
struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY); $pointer_check
icalproperty_set_${lc}((icalproperty*)impl,v);
return (icalproperty*)impl;
}
icalproperty* icalproperty_vanew_${lc}($type v, ...){
va_list args;
struct icalproperty_impl *impl = icalproperty_new_impl(ICAL_${uc}_PROPERTY); $pointer_check
icalproperty_set_${lc}((icalproperty*)impl,v);
va_start(args,v);
icalproperty_add_parameters(impl, args);
va_end(args);
return (icalproperty*)impl;
}
void icalproperty_set_${lc}(icalproperty* prop, $type v){
icalvalue *value;
$set_pointer_check
icalerror_check_arg_rv( (prop!=0),"prop");
value = icalvalue_new_${lcvalue}(v);
icalproperty_set_value(prop,value);
}
$type icalproperty_get_${lc}(icalproperty* prop){
icalvalue *value;
icalerror_check_arg( (prop!=0),"prop");
value = icalproperty_get_value(prop);
return icalvalue_get_${lcvalue}(value);
}
EOM
} elsif ($opt_h) { # Generate C Header file
print "\
/* $prop */\
icalproperty* icalproperty_new_${lc}($type v);\
icalproperty* icalproperty_vanew_${lc}($type v, ...);\
void icalproperty_set_${lc}(icalproperty* prop, $type v);\
$type icalproperty_get_${lc}(icalproperty* prop);";
}
} # This brace terminates the main loop
if ($opt_h){
print "\n\n#endif /*ICALPROPERTY_H*/\n"
}

Просмотреть файл

@ -0,0 +1,223 @@
#!/usr/bin/perl
use lib '.';
require 'readvaluesfile.pl';
use Getopt::Std;
getopts('chi:');
#Options
# c -> generate c code file
# h-> generate header file
# Open with value-types.txt
my %h = read_values_file($ARGV[0]);
# Write the file inline by copying everything before a demarcation
# line, and putting the generated data after the demarcation
if ($opt_i) {
open(IN,$opt_i) || die "Can't open input file $opt_i";
while(<IN>){
print;
}
}
# Map type names to the value in the icalvalue_impl data union */
%union_map = (
BOOLEAN => 'int',
CALADDRESS=>'string',
DATE=>'time',
DATETIME=>'time',
DATETIMEDATE=>'time',
DATETIMEPERIOD=>'period',
DURATION=>'duration',
INTEGER=>'int',
TEXT=>'string',
URI=>'string',
UTCOFFSET=>'int',
QUERY=>'string',
BINARY=>'string',
X=>'string'
);
if($opt_h){
# First print out the value enumerations
$idx = 5000;
print "typedef enum icalvalue_kind {\n";
print " ICAL_ANY_VALUE=$idx,\n";
foreach $value (keys %h) {
$idx++;
my $ucv = join("",map {uc(lc($_));} split(/-/,$value));
next if $value eq "NO";
print " ICAL_${ucv}_VALUE=$idx,\n";
}
$idx++;
print " ICAL_NO_VALUE=$idx\n} icalvalue_kind ;\n\n";
# Now create enumerations for property values
$idx = 10000;
print "#define ICALPROPERTY_FIRST_ENUM $idx\n\n";
foreach $value (sort keys %h) {
next if !$value;
next if $value eq 'NO' or $prop eq 'ANY';
my $ucv = join("",map {uc(lc($_));} split(/-/,$value));
my @enums = @{$h{$value}->{'enums'}};
if(@enums){
my ($c_autogen,$c_type) = @{$h{$value}->{'C'}};
print "typedef $c_type {\n";
my $first = 1;
unshift(@enums,"X");
push(@enums,"NONE");
foreach $e (@enums) {
if (!$first){
print ",\n";
} else {
$first = 0;
}
my $uce = join("",map {uc(lc($_));} split(/-/,$e));
print " ICAL_${ucv}_${uce} = $idx";
$idx++;
}
$c_type =~ s/enum //;
print "\n} $c_type;\n\n";
}
}
print "#define ICALPROPERTY_LAST_ENUM $idx\n\n";
}
if($opt_c){
# print out the value to string map
print "static struct icalvalue_kind_map value_map[]={\n";
foreach $value (keys %h) {
$idx++;
my $ucv = join("",map {uc(lc($_));} split(/-/,$value));
next if $value eq "NO";
print " {ICAL_${ucv}_VALUE,\"$value\"},\n";
}
print " {ICAL_NO_VALUE,\"\"}\n};";
}
foreach $value (keys %h) {
my $autogen = $h{$value}->{C}->[0];
my $type = $h{$value}->{C}->[1];
my $ucf = join("",map {ucfirst(lc($_));} split(/-/,$value));
my $lc = lc($ucf);
my $uc = uc($lc);
my $pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");\n" if $type =~ /\*/;
my $pointer_check_rv = "icalerror_check_arg_rv( (v!=0),\"v\");\n" if $type =~ /\*/;
my $assign;
if ($type =~ /char/){
$assign = "icalmemory_strdup(v);\n\n if (impl->data.v_string == 0){\n errno = ENOMEM;\n }\n";
} else {
$assign = "v;";
}
my $union_data;
if(@{$h{$value}->{'enums'}}){
$union_data = 'enum';
} elsif (exists $union_map{$uc} ){
$union_data=$union_map{$uc};
} else {
$union_data = $lc;
}
if ($opt_c && $autogen) {
print "\n\n\
icalvalue* icalvalue_new_${lc} ($type v){\
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_${uc}_VALUE);\
$pointer_check\
icalvalue_set_${lc}((icalvalue*)impl,v);\
return (icalvalue*)impl;\
}\
void icalvalue_set_${lc}(icalvalue* value, $type v) {\
struct icalvalue_impl* impl; \
icalerror_check_arg_rv( (value!=0),\"value\");\
$pointer_check_rv\
icalerror_check_value_type(value, ICAL_${uc}_VALUE);\
impl = (struct icalvalue_impl*)value;\n";
if( $union_data eq 'string') {
print " if(impl->data.v_${union_data}!=0) {free((void*)impl->data.v_${union_data});}\n";
}
print "\n impl->data.v_$union_data = $assign \n }\n";
print "$type\ icalvalue_get_${lc}(icalvalue* value)\ {\n\
icalerror_check_arg( (value!=0),\"value\");\
icalerror_check_value_type(value, ICAL_${uc}_VALUE);\
return ((struct icalvalue_impl*)value)->data.v_${union_data};\n}\n";
} elsif($opt_h && $autogen) {
print "\n /* $value */ \
icalvalue* icalvalue_new_${lc}($type v); \
$type icalvalue_get_${lc}(icalvalue* value); \
void icalvalue_set_${lc}(icalvalue* value, ${type} v);\n\n";
}
}
if ($opt_h){
print "#endif /*ICALVALUE_H*/\n";
}
__END__

Просмотреть файл

Просмотреть файл

@ -0,0 +1,109 @@
#!/usr/bin/perl
# Version: 1.0
# Script last updated: 30May1999 GMD
# Change log:
# <none>
# usually open restrictions.csv
open(F,"$ARGV[0]") || die "Can't open restriction file $ARGV[0]:$!";
print <<EOM;
/*
======================================================================
File: restrictionrecords.c
(C) COPYRIGHT 1999 Graham Davison
mailto:g.m.davison\@computer.org
The contents of this file are subject to the Mozilla Public License
Version 1.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and
limitations under the License.
======================================================================*/
/*
* THIS FILE IS MACHINE GENERATED DO NOT EDIT
*/
typedef struct icalrestriction_record {
icalproperty_method method;
icalcomponent_kind component;
icalproperty_kind property;
icalcomponent_kind subcomponent;
icalrestriction_kind restriction;
} icalrestriction_record;
icalrestriction_record icalrestriction_records[] =
{
EOM
my $last_method = "";
my $last_component = "";
my $last_property = "";
my $need_header = 0;
while(<F>)
{
chop;
# split line at commas
my ($method,$component,$property,$subcomponent,$restriction)=split(/\,/,$_);
#
#put in code to generate comments here!
#
if ($method ne $last_method)
{
$need_header = 1;
$last_method = $method;
}
if ($component ne $last_component)
{
$need_header = 1;
$last_component = $component;
}
if ($need_header)
{
print "\n\t/* METHOD: ${method}, COMPONENT: ${component} */\n";
$need_header = 0;
}
foreach $item ($component,$property,$subcomponent,$restriction)
{
# handle special cases.
if ($item eq "NONE")
{ $item = "NO"; }
else { if (substr($item,0,1) eq "X")
{ $item = "X"; }}
# strip out dashes
$item = join("",split(/-/,$item));
}
# strip leading V from component names
$component =~ s/^(V?)(\w+?)((SAVINGS)?)((TIME)?)$/$2/;
$subcomponent =~ s/^V(\w+)/$1/;
print "\t\{ICAL_METHOD_${method},ICAL_${component}_COMPONENT,";
print "ICAL_${property}_PROPERTY,ICAL_${subcomponent}_COMPONENT,";
print "ICAL_RESTRICTION_${restriction}\},\n";
}
print <<EOM;
/* END */
{ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE}
};
EOM

Просмотреть файл

@ -0,0 +1,98 @@
#!/usr/bin/perl
use Getopt::Std;
getopts('i:');
# the argument should be the path to the restriction datafile, usually
# design-data/restrictions.csv
open(F,"$ARGV[0]") || die "Can't open restriction data file $ARGV[0]:$!";
# Write the file inline by copying everything before a demarcation
# line, and putting the generated data after the demarcation
if ($opt_i) {
open(IN,$opt_i) || die "Can't open input file $opt_i";
while(<IN>){
if (/Do not edit/){
last;
}
print;
}
print "/* Everything below this line is machine generated. Do not edit. */\n";
close IN;
}
# First build the property restriction table
print "icalrestriction_property_record icalrestriction_property_records[] = {\n";
while(<F>)
{
chop;
s/\#.*$//;
my($method,$targetcomp,$prop,$subcomp,$restr,$sub) = split(/,/,$_);
next if !$method;
if(!$sub) {
$sub = "0";
} else {
$sub = "icalrestriction_".$sub;
}
if($prop ne "NONE"){
print(" \{ICAL_METHOD_${method},ICAL_${targetcomp}_COMPONENT,ICAL_${prop}_PROPERTY,ICAL_RESTRICTION_${restr},$sub},\n");
}
}
# Print the terminating line
print " {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_NONE}\n";
print "};\n";
print "icalrestriction_component_record icalrestriction_component_records[] = {\n";
# Go back through the entire file and build the component restriction table
close(F);
open(F,"$ARGV[0]") || die "Can't open restriction data file $ARGV[0]:$!";
while(<F>)
{
chop;
s/\#.*$//;
my($method,$targetcomp,$prop,$subcomp,$restr,$sub) = split(/,/,$_);
next if !$method;
if(!$sub) {
$sub = "0";
} else {
$sub = "icalrestriction_".$sub;
}
if($subcomp ne "NONE"){
print(" \{ICAL_METHOD_${method},ICAL_${targetcomp}_COMPONENT,ICAL_${subcomp}_COMPONENT,ICAL_RESTRICTION_${restr},$sub\},\n");
}
}
# print the terminating line
print " {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_NONE}\n";
print "};\n";

Просмотреть файл

@ -0,0 +1,130 @@
sub read_values_file {
my $path = shift;
my %h;
open(F,$path) || die "Can't open values file $path";
while(<F>){
chop;
s/#.*$//g;
s/\"//g;
next if ! $_;
@column = split(/,/,$_);
my $value_name = $column[0];
my $c_type_str = $column[1];
my $c_autogen = ($c_type_str =~ /\(a\)/);
my $c_type = $c_type_str;
$c_type =~ s/\(.\)//;
my $python_type = $column[2];
my $components = $column[3];
my $enum_values = $column[4];
my @components;
if($components ne "unitary"){
@components = split(/;/,$components);
} else {
@components = ();
}
my @enums;
if($enum_values) {
@enums = split(/;/,$enum_values);
} else {
@enums = ();
}
$h{$value_name} = { C => [$c_autogen,$c_type],
perl => $perl_type,
python => $python_type,
components=>[@components],
enums=>[@enums]
};
}
return %h;
}
sub read_properties_file {
my $path = shift;
my %h;
open(F,$path) || die "Can't open properties file $path";
while(<F>){
chop;
s/#.*$//g;
s/\"//g;
next if ! $_;
@column = split(/,/,$_);
my $property_name = $column[0];
my $lic_value = $column[1];
my $default_value = $column[2];
$h{$property_name} = { lic_value => $lic_value,
default_value => $default_value
};
}
return %h;
}
sub read_parameters_file {
my $path = shift;
my %h;
open(F,$path) || die "Can't open parameters file $path";
while(<F>){
chop;
s/#.*$//g;
s/\"//g;
next if ! $_;
@column = split(/\,/,$_);
my $parameter_name = $column[0];
my $data_type = $column[1];
my $enum_string = $column[2];
my @enums;
if($enum_string){
@enums = split(/;/,$enum_string);
}
$h{$parameter_name} = { C => $data_type,
enums => [@enums]
};
}
close(F);
return %h;
}
1;

Просмотреть файл

@ -0,0 +1,7 @@
if WITH_PYTHON
PYTHON_DIR = python
else
PYTHON_DIR =
endif
SUBDIRS = libical libicalss libicalvcal $(PYTHON_DIR) test

Просмотреть файл

Просмотреть файл

@ -0,0 +1,224 @@
#======================================================================
# FILE: Makefile.am
# CREATOR: eric
#
# $Id: Makefile.am,v 1.1 2001-11-15 19:26:49 mikep%oeone.com Exp $
#
#
# (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# The LGPL as published by the Free Software Foundation, version
# 2.1, available at: http://www.fsf.org/copyleft/lesser.html
#
# Or:
#
# The Mozilla Public License Version 1.0. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# The original code is icalcomponent.c
#
#======================================================================
DESIGNDATA = $(top_srcdir)/design-data
ICALSCRIPTS = $(top_srcdir)/scripts
lib_LTLIBRARIES = libical.la
YFLAGS = -d -v -t -pical_yy
LFLAGS = -Pical_yy
LEX_OUTPUT_ROOT = lex.ical_yy
INCLUDES = \
-I$(top_builddir) \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
-I$(srcdir)
libical_la_LDFLAGS = -version-info 0:0:0
libical_la_SOURCES = \
icalattendee.h \
icalattendee.c \
icalcomponent.c \
icalcomponent.h \
icalenums.c \
icalenums.h \
icalerror.c \
icalerror.h \
icallexer.l \
icalmemory.c \
icalmemory.h \
icalmime.c \
icalmime.h \
icalparameter.c \
icalparameter.h \
icalparameterimpl.h \
icalderivedparameter.c \
icalderivedparameter.h \
icalparser.c \
icalparser.h \
icalderivedproperty.c \
icalderivedproperty.h \
icalproperty.c \
icalproperty.h \
icalrecur.c \
icalrecur.h \
icalrestriction.c \
icalrestriction.h \
icaltime.c \
icaltime.h \
icalduration.h \
icalduration.c \
icalperiod.h \
icalperiod.c \
icaltypes.c \
icaltypes.h \
icalvalue.c \
icalvalue.h \
icalvalueimpl.h \
icalderivedvalue.c \
icalderivedvalue.h \
icalyacc.h \
icalyacc.y \
pvl.c \
pvl.h \
sspm.c \
sspm.h \
vsnprintf.c \
icallangbind.h \
icallangbind.c
libicalincludedir = $(includedir)
libicalinclude_HEADERS = ical.h
# ORDERING OF HEADERS IS SIGNIFICANT. Don't change this ordering. It
# is required to make the combined header ical.h properly
COMBINEDHEADERS = \
$(top_builddir)/src/libical/icalversion.h \
$(top_srcdir)/src/libical/icaltime.h \
$(top_srcdir)/src/libical/icalduration.h \
$(top_srcdir)/src/libical/icalperiod.h \
$(top_srcdir)/src/libical/icalenums.h \
$(top_srcdir)/src/libical/icaltypes.h \
$(top_srcdir)/src/libical/icalrecur.h \
icalderivedvalue.h \
icalderivedparameter.h \
icalvalue.h \
icalparameter.h \
icalderivedproperty.h \
icalproperty.h \
$(top_srcdir)/src/libical/icalattendee.h \
$(top_srcdir)/src/libical/pvl.h \
$(top_srcdir)/src/libical/icalcomponent.h \
$(top_srcdir)/src/libical/icalparser.h \
$(top_srcdir)/src/libical/icalmemory.h \
$(top_srcdir)/src/libical/icalerror.h \
$(top_srcdir)/src/libical/icalrestriction.h \
$(top_srcdir)/src/libical/sspm.h \
$(top_srcdir)/src/libical/icalmime.h \
$(top_srcdir)/src/libical/icallangbind.h
BUILT_SOURCES = \
ical.h \
icalderivedparameter.c \
icalderivedparameter.h \
icalderivedproperty.c \
icalderivedproperty.h \
icalrestriction.c \
icalderivedvalue.c \
icalderivedvalue.h
ical.h: $(COMBINEDHEADERS)
cat $(COMBINEDHEADERS) \
| egrep -v "#include.*\"ical" \
| egrep -v "#include.*\"pvl\.h\"" > ical.h
icallexer.c : icalyacc.h
# parameters
PARAMETERDEPS = \
$(ICALSCRIPTS)/mkderivedparameters.pl \
$(DESIGNDATA)/parameters.csv \
icalderivedparameter.c.in \
icalderivedparameter.h.in
icalderivedparameter.h: $(PARAMETERDEPS)
$(PERL) -I $(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedparameters.pl -i $(srcdir)/icalderivedparameter.h.in -h $(DESIGNDATA)/parameters.csv > icalderivedparameter.h
icalderivedparameter.c: $(PARAMETERDEPS) icalparameter.h
$(PERL) -I $(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedparameters.pl -i $(srcdir)/icalderivedparameter.c.in -c $(DESIGNDATA)/parameters.csv > icalderivedparameter.c
# properties
PROPERTYDEPS = \
$(ICALSCRIPTS)/mkderivedproperties.pl \
$(DESIGNDATA)/properties.csv \
$(DESIGNDATA)/value-types.csv \
icalderivedproperty.c.in \
icalderivedproperty.h.in
icalderivedproperty.h: $(PROPERTYDEPS)
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedproperties.pl \
-i $(srcdir)/icalderivedproperty.h.in -h $(DESIGNDATA)/properties.csv\
${DESIGNDATA}/value-types.csv > icalderivedproperty.h
icalderivedproperty.c: $(PROPERTYDEPS) icalproperty.h
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedproperties.pl \
-i $(srcdir)/icalderivedproperty.c.in -c $(DESIGNDATA)/properties.csv \
${DESIGNDATA}/value-types.csv > icalderivedproperty.c
# restrictions
RESTRICTIONDEPS = \
$(ICALSCRIPTS)/mkrestrictiontable.pl \
$(DESIGNDATA)/restrictions.csv \
icalrestriction.c.in
icalrestriction.c: $(RESTRICTIONDEPS)
$(PERL) $(ICALSCRIPTS)/mkrestrictiontable.pl -i $(srcdir)/icalrestriction.c.in \
$(DESIGNDATA)/restrictions.csv > icalrestriction.c
# values
VALUEDEPS = \
$(ICALSCRIPTS)/mkderivedvalues.pl \
$(DESIGNDATA)/value-types.csv \
icalderivedvalue.c.in \
icalderivedvalue.h.in
icalderivedvalue.h: $(VALUEDEPS)
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedvalues.pl \
-i $(srcdir)/icalderivedvalue.h.in -h $(DESIGNDATA)/value-types.csv > icalderivedvalue.h
icalderivedvalue.c: $(VALUEDEPS) icalderivedvalue.h
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedvalues.pl \
-i $(srcdir)/icalderivedvalue.c.in -c $(DESIGNDATA)/value-types.csv > icalderivedvalue.c
# housekeeping
CONFIG_CLEAN_FILES = y.output
CLEANFILES += $(BUILT_SOURCES)
EXTRA_DIST = \
icalderivedparameter.c.in \
icalderivedparameter.h.in \
icalderivedproperty.c.in \
icalderivedproperty.h.in \
icalrestriction.c.in \
icalderivedvalue.c.in \
icalderivedvalue.h.in \
icalversion.h.in \
icallexer.c \
icalyacc.c

Просмотреть файл

@ -0,0 +1,565 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
#======================================================================
# FILE: Makefile.am
# CREATOR: eric
#
# $Id: Makefile.in,v 1.1 2001-11-15 19:26:50 mikep%oeone.com Exp $
#
#
# (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of either:
#
# The LGPL as published by the Free Software Foundation, version
# 2.1, available at: http://www.fsf.org/copyleft/lesser.html
#
# Or:
#
# The Mozilla Public License Version 1.0. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# The original code is icalcomponent.c
#
#======================================================================
SHELL = @SHELL@
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
DESTDIR =
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = ../..
ACLOCAL = @ACLOCAL@
AUTOCONF = @AUTOCONF@
AUTOMAKE = @AUTOMAKE@
AUTOHEADER = @AUTOHEADER@
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
NORMAL_INSTALL = :
PRE_INSTALL = :
POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
host_alias = @host_alias@
host_triplet = @host@
AR = @AR@
AS = @AS@
CC = @CC@
DLLTOOL = @DLLTOOL@
LEX = @LEX@
LIBTOOL = @LIBTOOL@
LN_S = @LN_S@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
OBJDUMP = @OBJDUMP@
PACKAGE = @PACKAGE@
PERL = @PERL@
PY_CFLAGS = @PY_CFLAGS@
PY_EXTRA_LIBS = @PY_EXTRA_LIBS@
PY_LIBS = @PY_LIBS@
PY_LIB_LOC = @PY_LIB_LOC@
RANLIB = @RANLIB@
VERSION = @VERSION@
YACC = @YACC@
python_val = @python_val@
DESIGNDATA = $(top_srcdir)/design-data
ICALSCRIPTS = $(top_srcdir)/scripts
lib_LTLIBRARIES = libical.la
YFLAGS = -d -v -t -pical_yy
LFLAGS = -Pical_yy
LEX_OUTPUT_ROOT = lex.ical_yy
INCLUDES = -I$(top_builddir) -I$(top_srcdir)/src -I$(top_builddir)/src -I$(srcdir)
libical_la_LDFLAGS = -version-info 0:0:0
libical_la_SOURCES = icalattendee.h icalattendee.c icalcomponent.c icalcomponent.h icalenums.c icalenums.h icalerror.c icalerror.h icallexer.l icalmemory.c icalmemory.h icalmime.c icalmime.h icalparameter.c icalparameter.h icalparameterimpl.h icalderivedparameter.c icalderivedparameter.h icalparser.c icalparser.h icalderivedproperty.c icalderivedproperty.h icalproperty.c icalproperty.h icalrecur.c icalrecur.h icalrestriction.c icalrestriction.h icaltime.c icaltime.h icalduration.h icalduration.c icalperiod.h icalperiod.c icaltypes.c icaltypes.h icalvalue.c icalvalue.h icalvalueimpl.h icalderivedvalue.c icalderivedvalue.h icalyacc.h icalyacc.y pvl.c pvl.h sspm.c sspm.h vsnprintf.c icallangbind.h icallangbind.c
libicalincludedir = $(includedir)
libicalinclude_HEADERS = ical.h
# ORDERING OF HEADERS IS SIGNIFICANT. Don't change this ordering. It
# is required to make the combined header ical.h properly
COMBINEDHEADERS = $(top_builddir)/src/libical/icalversion.h $(top_srcdir)/src/libical/icaltime.h $(top_srcdir)/src/libical/icalduration.h $(top_srcdir)/src/libical/icalperiod.h $(top_srcdir)/src/libical/icalenums.h $(top_srcdir)/src/libical/icaltypes.h $(top_srcdir)/src/libical/icalrecur.h icalderivedvalue.h icalderivedparameter.h icalvalue.h icalparameter.h icalderivedproperty.h icalproperty.h $(top_srcdir)/src/libical/icalattendee.h $(top_srcdir)/src/libical/pvl.h $(top_srcdir)/src/libical/icalcomponent.h $(top_srcdir)/src/libical/icalparser.h $(top_srcdir)/src/libical/icalmemory.h $(top_srcdir)/src/libical/icalerror.h $(top_srcdir)/src/libical/icalrestriction.h $(top_srcdir)/src/libical/sspm.h $(top_srcdir)/src/libical/icalmime.h $(top_srcdir)/src/libical/icallangbind.h
BUILT_SOURCES = ical.h icalderivedparameter.c icalderivedparameter.h icalderivedproperty.c icalderivedproperty.h icalrestriction.c icalderivedvalue.c icalderivedvalue.h
# parameters
PARAMETERDEPS = $(ICALSCRIPTS)/mkderivedparameters.pl $(DESIGNDATA)/parameters.csv icalderivedparameter.c.in icalderivedparameter.h.in
# properties
PROPERTYDEPS = $(ICALSCRIPTS)/mkderivedproperties.pl $(DESIGNDATA)/properties.csv $(DESIGNDATA)/value-types.csv icalderivedproperty.c.in icalderivedproperty.h.in
# restrictions
RESTRICTIONDEPS = $(ICALSCRIPTS)/mkrestrictiontable.pl $(DESIGNDATA)/restrictions.csv icalrestriction.c.in
# values
VALUEDEPS = $(ICALSCRIPTS)/mkderivedvalues.pl $(DESIGNDATA)/value-types.csv icalderivedvalue.c.in icalderivedvalue.h.in
# housekeeping
CONFIG_CLEAN_FILES = y.output
CLEANFILES = $(BUILT_SOURCES)
EXTRA_DIST = icalderivedparameter.c.in icalderivedparameter.h.in icalderivedproperty.c.in icalderivedproperty.h.in icalrestriction.c.in icalderivedvalue.c.in icalderivedvalue.h.in icalversion.h.in icallexer.c icalyacc.c
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = ../../config.h
LTLIBRARIES = $(lib_LTLIBRARIES)
DEFS = @DEFS@ -I. -I$(srcdir) -I../..
CPPFLAGS = @CPPFLAGS@
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
libical_la_LIBADD =
libical_la_OBJECTS = icalattendee.lo icalcomponent.lo icalenums.lo \
icalerror.lo icallexer.lo icalmemory.lo icalmime.lo icalparameter.lo \
icalderivedparameter.lo icalparser.lo icalderivedproperty.lo \
icalproperty.lo icalrecur.lo icalrestriction.lo icaltime.lo \
icalduration.lo icalperiod.lo icaltypes.lo icalvalue.lo \
icalderivedvalue.lo icalyacc.lo pvl.lo sspm.lo vsnprintf.lo \
icallangbind.lo
LEXLIB = @LEXLIB@
CFLAGS = @CFLAGS@
COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
HEADERS = $(libicalinclude_HEADERS)
DIST_COMMON = Makefile.am Makefile.in icallexer.c icalversion.h.in \
icalyacc.c
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
TAR = gtar
GZIP_ENV = --best
SOURCES = $(libical_la_SOURCES)
OBJECTS = $(libical_la_OBJECTS)
all: all-redirect
.SUFFIXES:
.SUFFIXES: .S .c .l .lo .o .s .y
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
cd $(top_srcdir) && $(AUTOMAKE) --gnu --include-deps src/libical/Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
cd $(top_builddir) \
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
icalversion.h: $(top_builddir)/config.status icalversion.h.in
cd $(top_builddir) && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
mostlyclean-libLTLIBRARIES:
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
distclean-libLTLIBRARIES:
maintainer-clean-libLTLIBRARIES:
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libdir)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p"; \
$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(libdir)/$$p; \
else :; fi; \
done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
list='$(lib_LTLIBRARIES)'; for p in $$list; do \
$(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
done
.c.o:
$(COMPILE) -c $<
.s.o:
$(COMPILE) -c $<
.S.o:
$(COMPILE) -c $<
mostlyclean-compile:
-rm -f *.o core *.core
clean-compile:
distclean-compile:
-rm -f *.tab.c
maintainer-clean-compile:
.c.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.s.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
.S.lo:
$(LIBTOOL) --mode=compile $(COMPILE) -c $<
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
maintainer-clean-libtool:
libical.la: $(libical_la_OBJECTS) $(libical_la_DEPENDENCIES)
$(LINK) -rpath $(libdir) $(libical_la_LDFLAGS) $(libical_la_OBJECTS) $(libical_la_LIBADD) $(LIBS)
.l.c:
$(LEX) $(AM_LFLAGS) $(LFLAGS) $< && mv $(LEX_OUTPUT_ROOT).c $@
.y.c:
$(YACC) $(AM_YFLAGS) $(YFLAGS) $< && mv y.tab.c $*.c
if test -f y.tab.h; then \
if cmp -s y.tab.h $*.h; then rm -f y.tab.h; else mv y.tab.h $*.h; fi; \
else :; fi
icalyacc.h: icalyacc.c
install-libicalincludeHEADERS: $(libicalinclude_HEADERS)
@$(NORMAL_INSTALL)
$(mkinstalldirs) $(DESTDIR)$(libicalincludedir)
@list='$(libicalinclude_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d= ; else d="$(srcdir)/"; fi; \
echo " $(INSTALL_DATA) $$d$$p $(DESTDIR)$(libicalincludedir)/$$p"; \
$(INSTALL_DATA) $$d$$p $(DESTDIR)$(libicalincludedir)/$$p; \
done
uninstall-libicalincludeHEADERS:
@$(NORMAL_UNINSTALL)
list='$(libicalinclude_HEADERS)'; for p in $$list; do \
rm -f $(DESTDIR)$(libicalincludedir)/$$p; \
done
tags: TAGS
ID: $(HEADERS) $(SOURCES) $(LISP)
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
here=`pwd` && cd $(srcdir) \
&& mkid -f$$here/ID $$unique $(LISP)
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP)
tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS)'; \
unique=`for i in $$list; do echo $$i; done | \
awk ' { files[$$0] = 1; } \
END { for (i in files) print i; }'`; \
test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \
|| (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS)
mostlyclean-tags:
clean-tags:
distclean-tags:
-rm -f TAGS ID
maintainer-clean-tags:
distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
subdir = src/libical
distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $$d/$$file $(distdir)/$$file || :; \
fi; \
done
icalattendee.lo icalattendee.o : icalattendee.c ../../config.h \
icalattendee.h icalenums.h icaltime.h icalduration.h \
icalperiod.h icalderivedparameter.h icalderivedvalue.h \
icaltypes.h icalrecur.h
icalcomponent.lo icalcomponent.o : icalcomponent.c ../../config.h \
icalcomponent.h icalproperty.h icalderivedparameter.h \
icalvalue.h icalenums.h icaltypes.h icaltime.h icalduration.h \
icalperiod.h icalrecur.h icalderivedproperty.h icalparameter.h \
icalderivedvalue.h icalattendee.h pvl.h icalerror.h \
icalmemory.h icalparser.h
icalderivedparameter.lo icalderivedparameter.o : icalderivedparameter.c \
../../config.h icalparameter.h icalderivedparameter.h \
icalparameterimpl.h icalproperty.h icalvalue.h icalenums.h \
icaltypes.h icaltime.h icalduration.h icalperiod.h icalrecur.h \
icalderivedproperty.h icalderivedvalue.h icalerror.h \
icalmemory.h
icalderivedproperty.lo icalderivedproperty.o : icalderivedproperty.c \
../../config.h icalproperty.h icalderivedparameter.h \
icalvalue.h icalenums.h icaltypes.h icaltime.h icalduration.h \
icalperiod.h icalrecur.h icalderivedproperty.h icalparameter.h \
icalderivedvalue.h icalcomponent.h icalattendee.h pvl.h \
icalerror.h icalmemory.h icalparser.h
icalderivedvalue.lo icalderivedvalue.o : icalderivedvalue.c \
../../config.h icalerror.h icalmemory.h icalparser.h \
icalenums.h icaltypes.h icaltime.h icalduration.h icalperiod.h \
icalcomponent.h icalproperty.h icalderivedparameter.h \
icalvalue.h icalrecur.h icalderivedproperty.h icalparameter.h \
icalderivedvalue.h icalattendee.h pvl.h icalvalueimpl.h
icalduration.lo icalduration.o : icalduration.c ../../config.h \
icalduration.h icaltime.h icalerror.h icalmemory.h icalvalue.h \
icalenums.h icaltypes.h icalperiod.h icalrecur.h \
icalderivedproperty.h icalparameter.h icalderivedparameter.h \
icalderivedvalue.h
icalenums.lo icalenums.o : icalenums.c ../../config.h icalenums.h
icalerror.lo icalerror.o : icalerror.c ../../config.h icalerror.h
icallangbind.lo icallangbind.o : icallangbind.c icalcomponent.h \
icalproperty.h icalderivedparameter.h icalvalue.h icalenums.h \
icaltypes.h icaltime.h icalduration.h icalperiod.h icalrecur.h \
icalderivedproperty.h icalparameter.h icalderivedvalue.h \
icalattendee.h pvl.h icalerror.h ../../config.h icalmemory.h
icallexer.lo icallexer.o : icallexer.c icalparser.h icalenums.h \
icaltypes.h icaltime.h icalduration.h icalperiod.h \
icalcomponent.h icalproperty.h icalderivedparameter.h \
icalvalue.h icalrecur.h icalderivedproperty.h icalparameter.h \
icalderivedvalue.h icalattendee.h pvl.h icalmemory.h icalyacc.h
icalmemory.lo icalmemory.o : icalmemory.c ../../config.h icalmemory.h \
icalerror.h
icalmime.lo icalmime.o : icalmime.c icalmime.h icalcomponent.h \
icalproperty.h icalderivedparameter.h icalvalue.h icalenums.h \
icaltypes.h icaltime.h icalduration.h icalperiod.h icalrecur.h \
icalderivedproperty.h icalparameter.h icalderivedvalue.h \
icalattendee.h pvl.h icalparser.h icalerror.h ../../config.h \
icalmemory.h sspm.h
icalparameter.lo icalparameter.o : icalparameter.c ../../config.h \
icalparameter.h icalderivedparameter.h icalproperty.h \
icalvalue.h icalenums.h icaltypes.h icaltime.h icalduration.h \
icalperiod.h icalrecur.h icalderivedproperty.h \
icalderivedvalue.h icalerror.h icalmemory.h icalparameterimpl.h
icalparser.lo icalparser.o : icalparser.c ../../config.h icalparser.h \
icalenums.h icaltypes.h icaltime.h icalduration.h icalperiod.h \
icalcomponent.h icalproperty.h icalderivedparameter.h \
icalvalue.h icalrecur.h icalderivedproperty.h icalparameter.h \
icalderivedvalue.h icalattendee.h pvl.h icalmemory.h \
icalerror.h
icalperiod.lo icalperiod.o : icalperiod.c ../../config.h icalperiod.h \
icaltime.h icalduration.h icalerror.h icalmemory.h
icalproperty.lo icalproperty.o : icalproperty.c ../../config.h \
icalproperty.h icalderivedparameter.h icalvalue.h icalenums.h \
icaltypes.h icaltime.h icalduration.h icalperiod.h icalrecur.h \
icalderivedproperty.h icalparameter.h icalderivedvalue.h \
icalcomponent.h icalattendee.h pvl.h icalerror.h icalmemory.h \
icalparser.h
icalrecur.lo icalrecur.o : icalrecur.c ../../config.h icalrecur.h \
icaltime.h icalerror.h icalmemory.h pvl.h
icalrestriction.lo icalrestriction.o : icalrestriction.c ../../config.h \
icalrestriction.h icalproperty.h icalderivedparameter.h \
icalvalue.h icalenums.h icaltypes.h icaltime.h icalduration.h \
icalperiod.h icalrecur.h icalderivedproperty.h icalparameter.h \
icalderivedvalue.h icalcomponent.h icalattendee.h pvl.h \
icalerror.h
icaltime.lo icaltime.o : icaltime.c ../../config.h icaltime.h \
icalerror.h icalmemory.h icalvalue.h icalenums.h icaltypes.h \
icalduration.h icalperiod.h icalrecur.h icalderivedproperty.h \
icalparameter.h icalderivedparameter.h icalderivedvalue.h
icaltypes.lo icaltypes.o : icaltypes.c ../../config.h icaltypes.h \
icalenums.h icaltime.h icalduration.h icalperiod.h icalerror.h \
icalmemory.h
icalvalue.lo icalvalue.o : icalvalue.c ../../config.h icalerror.h \
icalmemory.h icalparser.h icalenums.h icaltypes.h icaltime.h \
icalduration.h icalperiod.h icalcomponent.h icalproperty.h \
icalderivedparameter.h icalvalue.h icalrecur.h \
icalderivedproperty.h icalparameter.h icalderivedvalue.h \
icalattendee.h pvl.h icalvalueimpl.h
icalyacc.lo icalyacc.o : icalyacc.c icalparser.h icalenums.h icaltypes.h \
icaltime.h icalduration.h icalperiod.h icalcomponent.h \
icalproperty.h icalderivedparameter.h icalvalue.h icalrecur.h \
icalderivedproperty.h icalparameter.h icalderivedvalue.h \
icalattendee.h pvl.h
pvl.lo pvl.o : pvl.c ../../config.h pvl.h
sspm.lo sspm.o : sspm.c sspm.h
vsnprintf.lo vsnprintf.o : vsnprintf.c
info-am:
info: info-am
dvi-am:
dvi: dvi-am
check-am: all-am
check: check-am
installcheck-am:
installcheck: installcheck-am
install-exec-am: install-libLTLIBRARIES
install-exec: install-exec-am
install-data-am: install-libicalincludeHEADERS
install-data: install-data-am
install-am: all-am
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
install: install-am
uninstall-am: uninstall-libLTLIBRARIES uninstall-libicalincludeHEADERS
uninstall: uninstall-am
all-am: Makefile $(LTLIBRARIES) $(HEADERS)
all-redirect: all-am
install-strip:
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
installdirs:
$(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(libicalincludedir)
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
-rm -f Makefile $(CONFIG_CLEAN_FILES)
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
maintainer-clean-generic:
-test -z "icallexerlicalyacchicalyaccc$(BUILT_SOURCES)" || rm -f icallexerl icalyacch icalyaccc $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-libLTLIBRARIES mostlyclean-compile \
mostlyclean-libtool mostlyclean-tags \
mostlyclean-generic
mostlyclean: mostlyclean-am
clean-am: clean-libLTLIBRARIES clean-compile clean-libtool clean-tags \
clean-generic mostlyclean-am
clean: clean-am
distclean-am: distclean-libLTLIBRARIES distclean-compile \
distclean-libtool distclean-tags distclean-generic \
clean-am
-rm -f libtool
distclean: distclean-am
maintainer-clean-am: maintainer-clean-libLTLIBRARIES \
maintainer-clean-compile maintainer-clean-libtool \
maintainer-clean-tags maintainer-clean-generic \
distclean-am
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
maintainer-clean: maintainer-clean-am
.PHONY: mostlyclean-libLTLIBRARIES distclean-libLTLIBRARIES \
clean-libLTLIBRARIES maintainer-clean-libLTLIBRARIES \
uninstall-libLTLIBRARIES install-libLTLIBRARIES mostlyclean-compile \
distclean-compile clean-compile maintainer-clean-compile \
mostlyclean-libtool distclean-libtool clean-libtool \
maintainer-clean-libtool uninstall-libicalincludeHEADERS \
install-libicalincludeHEADERS tags mostlyclean-tags distclean-tags \
clean-tags maintainer-clean-tags distdir info-am info dvi-am dvi check \
check-am installcheck-am installcheck install-exec-am install-exec \
install-data-am install-data install-am install uninstall-am uninstall \
all-redirect all-am all installdirs mostlyclean-generic \
distclean-generic clean-generic maintainer-clean-generic clean \
mostlyclean distclean maintainer-clean
ical.h: $(COMBINEDHEADERS)
cat $(COMBINEDHEADERS) \
| egrep -v "#include.*\"ical" \
| egrep -v "#include.*\"pvl\.h\"" > ical.h
icallexer.c : icalyacc.h
icalderivedparameter.h: $(PARAMETERDEPS)
$(PERL) -I $(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedparameters.pl -i $(srcdir)/icalderivedparameter.h.in -h $(DESIGNDATA)/parameters.csv > icalderivedparameter.h
icalderivedparameter.c: $(PARAMETERDEPS) icalparameter.h
$(PERL) -I $(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedparameters.pl -i $(srcdir)/icalderivedparameter.c.in -c $(DESIGNDATA)/parameters.csv > icalderivedparameter.c
icalderivedproperty.h: $(PROPERTYDEPS)
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedproperties.pl \
-i $(srcdir)/icalderivedproperty.h.in -h $(DESIGNDATA)/properties.csv\
${DESIGNDATA}/value-types.csv > icalderivedproperty.h
icalderivedproperty.c: $(PROPERTYDEPS) icalproperty.h
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedproperties.pl \
-i $(srcdir)/icalderivedproperty.c.in -c $(DESIGNDATA)/properties.csv \
${DESIGNDATA}/value-types.csv > icalderivedproperty.c
icalrestriction.c: $(RESTRICTIONDEPS)
$(PERL) $(ICALSCRIPTS)/mkrestrictiontable.pl -i $(srcdir)/icalrestriction.c.in \
$(DESIGNDATA)/restrictions.csv > icalrestriction.c
icalderivedvalue.h: $(VALUEDEPS)
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedvalues.pl \
-i $(srcdir)/icalderivedvalue.h.in -h $(DESIGNDATA)/value-types.csv > icalderivedvalue.h
icalderivedvalue.c: $(VALUEDEPS) icalderivedvalue.h
$(PERL) -I$(ICALSCRIPTS) $(ICALSCRIPTS)/mkderivedvalues.pl \
-i $(srcdir)/icalderivedvalue.c.in -c $(DESIGNDATA)/value-types.csv > icalderivedvalue.c
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,30 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalattendee.c
CREATOR: eric 08 Mar 01
$Id: icalattendee.c,v 1.2 2001-12-21 18:56:13 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icaltypes.c
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "icalattendee.h"

Просмотреть файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,240 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalcomponent.h
CREATOR: eric 20 March 1999
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalcomponent.h
======================================================================*/
#ifndef ICALCOMPONENT_H
#define ICALCOMPONENT_H
#include "icalproperty.h"
#include "icalvalue.h"
#include "icalenums.h" /* defines icalcomponent_kind */
#include "icalattendee.h"
#include "pvl.h"
typedef void icalcomponent;
/* This is exposed so that callers will not have to allocate and
deallocate iterators. Pretend that you can't see it. */
typedef struct icalcompiter
{
icalcomponent_kind kind;
pvl_elem iter;
} icalcompiter;
icalcomponent* icalcomponent_new(icalcomponent_kind kind);
icalcomponent* icalcomponent_new_clone(icalcomponent* component);
icalcomponent* icalcomponent_new_from_string(char* str);
icalcomponent* icalcomponent_vanew(icalcomponent_kind kind, ...);
void icalcomponent_free(icalcomponent* component);
char* icalcomponent_as_ical_string(icalcomponent* component);
int icalcomponent_is_valid(icalcomponent* component);
icalcomponent_kind icalcomponent_isa(icalcomponent* component);
int icalcomponent_isa_component (void* component);
/*
* Working with properties
*/
void icalcomponent_add_property(icalcomponent* component,
icalproperty* property);
void icalcomponent_remove_property(icalcomponent* component,
icalproperty* property);
int icalcomponent_count_properties(icalcomponent* component,
icalproperty_kind kind);
/* Iterate through the properties */
icalproperty* icalcomponent_get_current_property(icalcomponent* component);
icalproperty* icalcomponent_get_first_property(icalcomponent* component,
icalproperty_kind kind);
icalproperty* icalcomponent_get_next_property(icalcomponent* component,
icalproperty_kind kind);
/*
* Working with components
*/
/* Return the first VEVENT, VTODO or VJOURNAL sub-component of cop, or
comp if it is one of those types */
icalcomponent* icalcomponent_get_inner(icalcomponent* comp);
void icalcomponent_add_component(icalcomponent* parent,
icalcomponent* child);
void icalcomponent_remove_component(icalcomponent* parent,
icalcomponent* child);
int icalcomponent_count_components(icalcomponent* component,
icalcomponent_kind kind);
/* Iteration Routines. There are two forms of iterators, internal and
external. The internal ones came first, and are almost completely
sufficient, but they fail badly when you want to construct a loop that
removes components from the container.*/
/* Iterate through components */
icalcomponent* icalcomponent_get_current_component (icalcomponent* component);
icalcomponent* icalcomponent_get_first_component(icalcomponent* component,
icalcomponent_kind kind);
icalcomponent* icalcomponent_get_next_component(icalcomponent* component,
icalcomponent_kind kind);
/* Using external iterators */
icalcompiter icalcomponent_begin_component(icalcomponent* component,
icalcomponent_kind kind);
icalcompiter icalcomponent_end_component(icalcomponent* component,
icalcomponent_kind kind);
icalcomponent* icalcompiter_next(icalcompiter* i);
icalcomponent* icalcompiter_prior(icalcompiter* i);
icalcomponent* icalcompiter_deref(icalcompiter* i);
/* Working with embedded error properties */
int icalcomponent_count_errors(icalcomponent* component);
/* Remove all X-LIC-ERROR properties*/
void icalcomponent_strip_errors(icalcomponent* component);
/* Convert some X-LIC-ERROR properties into RETURN-STATUS properties*/
void icalcomponent_convert_errors(icalcomponent* component);
/* Internal operations. They are private, and you should not be using them. */
icalcomponent* icalcomponent_get_parent(icalcomponent* component);
void icalcomponent_set_parent(icalcomponent* component,
icalcomponent* parent);
/* Kind conversion routiens */
icalcomponent_kind icalcomponent_string_to_kind(const char* string);
const char* icalcomponent_kind_to_string(icalcomponent_kind kind);
/************* Derived class methods. ****************************
If the code was in an OO language, the remaining routines would be
members of classes derived from icalcomponent. Don't call them on the
wrong component subtypes. */
/* For VCOMPONENT: Return a reference to the first VEVENT, VTODO or
VJOURNAL */
icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c);
/* For VEVENT, VTODO, VJOURNAL and VTIMEZONE: report the start and end
times of an event in UTC */
struct icaltime_span icalcomponent_get_span(icalcomponent* comp);
/******************** Convienience routines **********************/
void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v);
struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp);
/* For the icalcomponent routines only, dtend and duration are tied
together. If you call the set routine for one and the other exists,
the routine will calculate the change to the other. That is, if
there is a DTEND and you call set_duration, the routine will modify
DTEND to be the sum of DTSTART and the duration. If you call a get
routine for one and the other exists, the routine will calculate
the return value. If you call a set routine and neither exists, the
routine will create the apcompriate comperty */
struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp);
void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v);
void icalcomponent_set_duration(icalcomponent* comp,
struct icaldurationtype v);
struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp);
void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method);
icalproperty_method icalcomponent_get_method(icalcomponent* comp);
struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp);
void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v);
void icalcomponent_set_summary(icalcomponent* comp, const char* v);
const char* icalcomponent_get_summary(icalcomponent* comp);
void icalcomponent_set_comment(icalcomponent* comp, const char* v);
const char* icalcomponent_get_comment(icalcomponent* comp);
void icalcomponent_set_uid(icalcomponent* comp, const char* v);
const char* icalcomponent_get_uid(icalcomponent* comp);
void icalcomponent_set_recurrenceid(icalcomponent* comp,
struct icaltimetype v);
struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
void icalcomponent_set_organizer(icalcomponent* comp,
struct icalorganizertype org);
struct icalorganizertype icalcomponent_get_organizer(icalcomponent* comp);
void icalcomponent_add_attendee(icalcomponent *comp,
struct icalattendeetype attendee);
int icalcomponent_remove_attendee(icalcomponent *comp, char* cuid);
/* Get the Nth attendee. Out of range indices return an attendee
with cuid == 0 */
struct icalattendeetype icalcomponent_get_attendee(icalcomponent *comp,
int index);
/*************** Type Specific routines ***************/
icalcomponent* icalcomponent_new_vcalendar();
icalcomponent* icalcomponent_new_vevent();
icalcomponent* icalcomponent_new_vtodo();
icalcomponent* icalcomponent_new_vjournal();
icalcomponent* icalcomponent_new_valarm();
icalcomponent* icalcomponent_new_vfreebusy();
icalcomponent* icalcomponent_new_vtimezone();
icalcomponent* icalcomponent_new_xstandard();
icalcomponent* icalcomponent_new_xdaylight();
#endif /* !ICALCOMPONENT_H */

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,211 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalderivedparameters.{c,h}
CREATOR: eric 09 May 1999
$Id: icalderivedparameter.c.in,v 1.2 2001-12-21 18:56:15 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalderivedparameters.{c,h}
Contributions from:
Graham Davison (g.m.davison@computer.org)
======================================================================*/
/*#line 29 "icalparameter.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalparameter.h"
#include "icalparameterimpl.h"
#include "icalproperty.h"
#include "icalerror.h"
#include "icalmemory.h"
#include <stdlib.h> /* for malloc() */
#include <errno.h>
#include <string.h> /* for memset() */
icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind);
/* This map associates each of the parameters with the string
representation of the paramter's name */
struct icalparameter_kind_map {
icalparameter_kind kind;
char *name;
};
extern struct icalparameter_kind_map parameter_map[];
const char* icalparameter_kind_to_string(icalparameter_kind kind)
{
int i;
for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
if (parameter_map[i].kind == kind) {
return parameter_map[i].name;
}
}
return 0;
}
icalparameter_kind icalparameter_string_to_kind(const char* string)
{
int i;
if (string ==0 ) {
return ICAL_NO_PARAMETER;
}
for (i=0; parameter_map[i].kind != ICAL_NO_PARAMETER; i++) {
if (strcmp(parameter_map[i].name, string) == 0) {
return parameter_map[i].kind;
}
}
if(strncmp(string,"X-",2)==0){
return ICAL_X_PARAMETER;
}
return ICAL_NO_PARAMETER;
}
/* This map associates the enumerations for the VALUE parameter with
the kinds of VALUEs. */
struct icalparameter_value_kind_map {
icalparameter_value value;
icalvalue_kind kind;
};
extern struct icalparameter_value_kind_map value_kind_map[];
icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value)
{
int i;
for (i=0; value_kind_map[i].kind != ICAL_NO_VALUE; i++) {
if (value_kind_map[i].value == value) {
return value_kind_map[i].kind;
}
}
return ICAL_NO_VALUE;
}
/* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */
struct icalparameter_map {
icalparameter_kind kind;
int enumeration;
const char* str;
};
extern struct icalparameter_map icalparameter_map[];
const char* icalparameter_enum_to_string(int e)
{
int i;
icalerror_check_arg_rz(e >= ICALPARAMETER_FIRST_ENUM,"e");
icalerror_check_arg_rz(e <= ICALPARAMETER_LAST_ENUM,"e");
for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
if(e == icalparameter_map[i].enumeration){
return icalparameter_map[i].str;
}
}
return 0;
}
int icalparameter_string_to_enum(const char* str)
{
int i;
icalerror_check_arg_rz(str != 0,"str");
for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
if(strcmp(str,icalparameter_map[i].str) == 0) {
return icalparameter_map[i].enumeration;
}
}
return 0;
}
icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val)
{
struct icalparameter_impl* param=0;
int found_kind = 0;
int i;
icalerror_check_arg_rz((val!=0),"val");
/* Search through the parameter map to find a matching kind */
param = icalparameter_new_impl(kind);
for (i=0; icalparameter_map[i].kind != ICAL_NO_PARAMETER; i++){
if(kind == icalparameter_map[i].kind) {
found_kind = 1;
if(strcmp(val,icalparameter_map[i].str) == 0) {
param->data = (int)icalparameter_map[i].enumeration;
return param;
}
}
}
if(found_kind == 1){
/* The kind was in the parameter map, but the string did not
match, so assume that it is an alternate value, like an
X-value.*/
icalparameter_set_xvalue(param, val);
} else {
/* If the kind was not found, then it must be a string type */
((struct icalparameter_impl*)param)->string = icalmemory_strdup(val);
}
return param;
}
/* Everything below this line is machine generated. Do not edit. */

Просмотреть файл

@ -0,0 +1,308 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalparam.h
CREATOR: eric 20 March 1999
$Id: icalderivedparameter.h,v 1.1 2001-11-15 19:26:53 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalparam.h
======================================================================*/
#ifndef ICALDERIVEDPARAMETER_H
#define ICALDERIVEDPARAMETER_H
typedef void icalparameter;
const char* icalparameter_enum_to_string(int e);
int icalparameter_string_to_enum(const char* str);
/* Everything below this line is machine generated. Do not edit. */
typedef enum icalparameter_kind {
ICAL_ANY_PARAMETER = 0,
ICAL_ALTREP_PARAMETER,
ICAL_CN_PARAMETER,
ICAL_CUTYPE_PARAMETER,
ICAL_DELEGATEDFROM_PARAMETER,
ICAL_DELEGATEDTO_PARAMETER,
ICAL_DIR_PARAMETER,
ICAL_ENCODING_PARAMETER,
ICAL_FBTYPE_PARAMETER,
ICAL_FMTTYPE_PARAMETER,
ICAL_LANGUAGE_PARAMETER,
ICAL_MEMBER_PARAMETER,
ICAL_PARTSTAT_PARAMETER,
ICAL_RANGE_PARAMETER,
ICAL_RELATED_PARAMETER,
ICAL_RELTYPE_PARAMETER,
ICAL_ROLE_PARAMETER,
ICAL_RSVP_PARAMETER,
ICAL_SENTBY_PARAMETER,
ICAL_TZID_PARAMETER,
ICAL_VALUE_PARAMETER,
ICAL_X_PARAMETER,
ICAL_XLICCOMPARETYPE_PARAMETER,
ICAL_XLICERRORTYPE_PARAMETER,
ICAL_NO_PARAMETER
} icalparameter_kind;
#define ICALPARAMETER_FIRST_ENUM 20000
typedef enum icalparameter_cutype {
ICAL_CUTYPE_X = 20000,
ICAL_CUTYPE_INDIVIDUAL = 20001,
ICAL_CUTYPE_GROUP = 20002,
ICAL_CUTYPE_RESOURCE = 20003,
ICAL_CUTYPE_ROOM = 20004,
ICAL_CUTYPE_UNKNOWN = 20005,
ICAL_CUTYPE_NONE = 20006
} icalparameter_cutype;
typedef enum icalparameter_encoding {
ICAL_ENCODING_X = 20007,
ICAL_ENCODING_8BIT = 20008,
ICAL_ENCODING_BASE64 = 20009,
ICAL_ENCODING_NONE = 20010
} icalparameter_encoding;
typedef enum icalparameter_fbtype {
ICAL_FBTYPE_X = 20011,
ICAL_FBTYPE_FREE = 20012,
ICAL_FBTYPE_BUSY = 20013,
ICAL_FBTYPE_BUSYUNAVAILABLE = 20014,
ICAL_FBTYPE_BUSYTENTATIVE = 20015,
ICAL_FBTYPE_NONE = 20016
} icalparameter_fbtype;
typedef enum icalparameter_partstat {
ICAL_PARTSTAT_X = 20017,
ICAL_PARTSTAT_NEEDSACTION = 20018,
ICAL_PARTSTAT_ACCEPTED = 20019,
ICAL_PARTSTAT_DECLINED = 20020,
ICAL_PARTSTAT_TENTATIVE = 20021,
ICAL_PARTSTAT_DELEGATED = 20022,
ICAL_PARTSTAT_COMPLETED = 20023,
ICAL_PARTSTAT_INPROCESS = 20024,
ICAL_PARTSTAT_NONE = 20025
} icalparameter_partstat;
typedef enum icalparameter_range {
ICAL_RANGE_X = 20026,
ICAL_RANGE_THISANDPRIOR = 20027,
ICAL_RANGE_THISANDFUTURE = 20028,
ICAL_RANGE_NONE = 20029
} icalparameter_range;
typedef enum icalparameter_related {
ICAL_RELATED_X = 20030,
ICAL_RELATED_START = 20031,
ICAL_RELATED_END = 20032,
ICAL_RELATED_NONE = 20033
} icalparameter_related;
typedef enum icalparameter_reltype {
ICAL_RELTYPE_X = 20034,
ICAL_RELTYPE_PARENT = 20035,
ICAL_RELTYPE_CHILD = 20036,
ICAL_RELTYPE_SIBLING = 20037,
ICAL_RELTYPE_NONE = 20038
} icalparameter_reltype;
typedef enum icalparameter_role {
ICAL_ROLE_X = 20039,
ICAL_ROLE_CHAIR = 20040,
ICAL_ROLE_REQPARTICIPANT = 20041,
ICAL_ROLE_OPTPARTICIPANT = 20042,
ICAL_ROLE_NONPARTICIPANT = 20043,
ICAL_ROLE_NONE = 20044
} icalparameter_role;
typedef enum icalparameter_rsvp {
ICAL_RSVP_X = 20045,
ICAL_RSVP_TRUE = 20046,
ICAL_RSVP_FALSE = 20047,
ICAL_RSVP_NONE = 20048
} icalparameter_rsvp;
typedef enum icalparameter_value {
ICAL_VALUE_X = 20049,
ICAL_VALUE_BINARY = 20050,
ICAL_VALUE_BOOLEAN = 20051,
ICAL_VALUE_DATE = 20052,
ICAL_VALUE_DURATION = 20053,
ICAL_VALUE_FLOAT = 20054,
ICAL_VALUE_INTEGER = 20055,
ICAL_VALUE_PERIOD = 20056,
ICAL_VALUE_RECUR = 20057,
ICAL_VALUE_TEXT = 20058,
ICAL_VALUE_TIME = 20059,
ICAL_VALUE_URI = 20060,
ICAL_VALUE_ERROR = 20061,
ICAL_VALUE_DATETIME = 20062,
ICAL_VALUE_UTCOFFSET = 20063,
ICAL_VALUE_CALADDRESS = 20064,
ICAL_VALUE_NONE = 20065
} icalparameter_value;
typedef enum icalparameter_xliccomparetype {
ICAL_XLICCOMPARETYPE_X = 20066,
ICAL_XLICCOMPARETYPE_EQUAL = 20067,
ICAL_XLICCOMPARETYPE_NOTEQUAL = 20068,
ICAL_XLICCOMPARETYPE_LESS = 20069,
ICAL_XLICCOMPARETYPE_GREATER = 20070,
ICAL_XLICCOMPARETYPE_LESSEQUAL = 20071,
ICAL_XLICCOMPARETYPE_GREATEREQUAL = 20072,
ICAL_XLICCOMPARETYPE_REGEX = 20073,
ICAL_XLICCOMPARETYPE_NONE = 20074
} icalparameter_xliccomparetype;
typedef enum icalparameter_xlicerrortype {
ICAL_XLICERRORTYPE_X = 20075,
ICAL_XLICERRORTYPE_COMPONENTPARSEERROR = 20076,
ICAL_XLICERRORTYPE_PROPERTYPARSEERROR = 20077,
ICAL_XLICERRORTYPE_PARAMETERNAMEPARSEERROR = 20078,
ICAL_XLICERRORTYPE_PARAMETERVALUEPARSEERROR = 20079,
ICAL_XLICERRORTYPE_VALUEPARSEERROR = 20080,
ICAL_XLICERRORTYPE_INVALIDITIP = 20081,
ICAL_XLICERRORTYPE_UNKNOWNVCALPROPERROR = 20082,
ICAL_XLICERRORTYPE_MIMEPARSEERROR = 20083,
ICAL_XLICERRORTYPE_NONE = 20084
} icalparameter_xlicerrortype;
#define ICALPARAMETER_LAST_ENUM 20085
/* DELEGATED-FROM */
icalparameter* icalparameter_new_delegatedfrom(const char* v);
const char* icalparameter_get_delegatedfrom(icalparameter* value);
void icalparameter_set_delegatedfrom(icalparameter* value, const char* v);
/* RELATED */
icalparameter* icalparameter_new_related(icalparameter_related v);
icalparameter_related icalparameter_get_related(icalparameter* value);
void icalparameter_set_related(icalparameter* value, icalparameter_related v);
/* SENT-BY */
icalparameter* icalparameter_new_sentby(const char* v);
const char* icalparameter_get_sentby(icalparameter* value);
void icalparameter_set_sentby(icalparameter* value, const char* v);
/* LANGUAGE */
icalparameter* icalparameter_new_language(const char* v);
const char* icalparameter_get_language(icalparameter* value);
void icalparameter_set_language(icalparameter* value, const char* v);
/* RELTYPE */
icalparameter* icalparameter_new_reltype(icalparameter_reltype v);
icalparameter_reltype icalparameter_get_reltype(icalparameter* value);
void icalparameter_set_reltype(icalparameter* value, icalparameter_reltype v);
/* ENCODING */
icalparameter* icalparameter_new_encoding(icalparameter_encoding v);
icalparameter_encoding icalparameter_get_encoding(icalparameter* value);
void icalparameter_set_encoding(icalparameter* value, icalparameter_encoding v);
/* ALTREP */
icalparameter* icalparameter_new_altrep(const char* v);
const char* icalparameter_get_altrep(icalparameter* value);
void icalparameter_set_altrep(icalparameter* value, const char* v);
/* FMTTYPE */
icalparameter* icalparameter_new_fmttype(const char* v);
const char* icalparameter_get_fmttype(icalparameter* value);
void icalparameter_set_fmttype(icalparameter* value, const char* v);
/* FBTYPE */
icalparameter* icalparameter_new_fbtype(icalparameter_fbtype v);
icalparameter_fbtype icalparameter_get_fbtype(icalparameter* value);
void icalparameter_set_fbtype(icalparameter* value, icalparameter_fbtype v);
/* RSVP */
icalparameter* icalparameter_new_rsvp(icalparameter_rsvp v);
icalparameter_rsvp icalparameter_get_rsvp(icalparameter* value);
void icalparameter_set_rsvp(icalparameter* value, icalparameter_rsvp v);
/* RANGE */
icalparameter* icalparameter_new_range(icalparameter_range v);
icalparameter_range icalparameter_get_range(icalparameter* value);
void icalparameter_set_range(icalparameter* value, icalparameter_range v);
/* DELEGATED-TO */
icalparameter* icalparameter_new_delegatedto(const char* v);
const char* icalparameter_get_delegatedto(icalparameter* value);
void icalparameter_set_delegatedto(icalparameter* value, const char* v);
/* CN */
icalparameter* icalparameter_new_cn(const char* v);
const char* icalparameter_get_cn(icalparameter* value);
void icalparameter_set_cn(icalparameter* value, const char* v);
/* ROLE */
icalparameter* icalparameter_new_role(icalparameter_role v);
icalparameter_role icalparameter_get_role(icalparameter* value);
void icalparameter_set_role(icalparameter* value, icalparameter_role v);
/* X-LIC-COMPARETYPE */
icalparameter* icalparameter_new_xliccomparetype(icalparameter_xliccomparetype v);
icalparameter_xliccomparetype icalparameter_get_xliccomparetype(icalparameter* value);
void icalparameter_set_xliccomparetype(icalparameter* value, icalparameter_xliccomparetype v);
/* PARTSTAT */
icalparameter* icalparameter_new_partstat(icalparameter_partstat v);
icalparameter_partstat icalparameter_get_partstat(icalparameter* value);
void icalparameter_set_partstat(icalparameter* value, icalparameter_partstat v);
/* X-LIC-ERRORTYPE */
icalparameter* icalparameter_new_xlicerrortype(icalparameter_xlicerrortype v);
icalparameter_xlicerrortype icalparameter_get_xlicerrortype(icalparameter* value);
void icalparameter_set_xlicerrortype(icalparameter* value, icalparameter_xlicerrortype v);
/* MEMBER */
icalparameter* icalparameter_new_member(const char* v);
const char* icalparameter_get_member(icalparameter* value);
void icalparameter_set_member(icalparameter* value, const char* v);
/* X */
icalparameter* icalparameter_new_x(const char* v);
const char* icalparameter_get_x(icalparameter* value);
void icalparameter_set_x(icalparameter* value, const char* v);
/* CUTYPE */
icalparameter* icalparameter_new_cutype(icalparameter_cutype v);
icalparameter_cutype icalparameter_get_cutype(icalparameter* value);
void icalparameter_set_cutype(icalparameter* value, icalparameter_cutype v);
/* TZID */
icalparameter* icalparameter_new_tzid(const char* v);
const char* icalparameter_get_tzid(icalparameter* value);
void icalparameter_set_tzid(icalparameter* value, const char* v);
/* VALUE */
icalparameter* icalparameter_new_value(icalparameter_value v);
icalparameter_value icalparameter_get_value(icalparameter* value);
void icalparameter_set_value(icalparameter* value, icalparameter_value v);
/* DIR */
icalparameter* icalparameter_new_dir(const char* v);
const char* icalparameter_get_dir(icalparameter* value);
void icalparameter_set_dir(icalparameter* value, const char* v);
#endif /*ICALPARAMETER_H*/

Просмотреть файл

@ -0,0 +1,37 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalparam.h
CREATOR: eric 20 March 1999
$Id: icalderivedparameter.h.in,v 1.2 2001-12-21 18:56:15 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalparam.h
======================================================================*/
#ifndef ICALDERIVEDPARAMETER_H
#define ICALDERIVEDPARAMETER_H
typedef void icalparameter;
const char* icalparameter_enum_to_string(int e);
int icalparameter_string_to_enum(const char* str);

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,250 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalderivedproperty.c
CREATOR: eric 15 Feb 2001
$Id: icalderivedproperty.c.in,v 1.2 2001-12-21 18:56:16 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalproperty.c
======================================================================*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalproperty.h"
#include "icalcomponent.h"
#include "pvl.h"
#include "icalenums.h"
#include "icalerror.h"
#include "icalmemory.h"
#include "icalparser.h"
#include <string.h> /* For icalmemory_strdup, rindex */
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h> /* for printf */
#include <stdarg.h> /* for va_list, va_start, etc. */
#define TMP_BUF_SIZE 1024
struct icalproperty_impl*
icalproperty_new_impl (icalproperty_kind kind);
/* This map associates the property kinds with the string
representation of the property name and the kind of VALUE that the
property uses as a default */
struct icalproperty_map {
icalproperty_kind kind;
const char *name;
icalvalue_kind value;
};
extern struct icalproperty_map property_map[];
const char* icalproperty_kind_to_string(icalproperty_kind kind)
{
int i;
for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
if (property_map[i].kind == kind) {
return property_map[i].name;
}
}
return 0;
}
icalproperty_kind icalproperty_string_to_kind(const char* string)
{
int i;
if (string ==0 ) {
return ICAL_NO_PROPERTY;
}
for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
if (strcmp(property_map[i].name, string) == 0) {
return property_map[i].kind;
}
}
if(strncmp(string,"X-",2)==0){
return ICAL_X_PROPERTY;
}
return ICAL_NO_PROPERTY;
}
icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind)
{
int i;
for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
if ( property_map[i].value == kind ) {
return property_map[i].kind;
}
}
return ICAL_NO_VALUE;
}
icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind)
{
int i;
for (i=0; property_map[i].kind != ICAL_NO_PROPERTY; i++) {
if ( property_map[i].kind == kind ) {
return property_map[i].value;
}
}
return ICAL_NO_VALUE;
}
/* This map associates the property enumerations with the king of
property that they are used in and the string representation of the
enumeration */
struct icalproperty_enum_map {
icalproperty_kind prop;
int prop_enum;
const char* str;
};
extern struct icalproperty_enum_map enum_map[];
const char* icalproperty_enum_to_string(int e)
{
icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e");
icalerror_check_arg_rz(e <= ICALPROPERTY_LAST_ENUM,"e");
return enum_map[e-ICALPROPERTY_FIRST_ENUM].str;
}
int icalproperty_string_to_enum(const char* str)
{
int i;
icalerror_check_arg_rz(str!=0,"str")
while(*str == ' '){
str++;
}
for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
}
}
return 0;
}
int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e)
{
int i;
for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
if(enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum == e &&
enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == kind ){
return 1;
}
}
return 0;
}
const char* icalproperty_method_to_string(icalproperty_method method)
{
icalerror_check_arg_rz(method >= ICAL_METHOD_X,"method");
icalerror_check_arg_rz(method <= ICAL_METHOD_NONE,"method");
return enum_map[method-ICALPROPERTY_FIRST_ENUM].str;
}
icalproperty_method icalproperty_string_to_method(const char* str)
{
int i;
icalerror_check_arg_rx(str!=0,"str",ICAL_METHOD_NONE)
while(*str == ' '){
str++;
}
for (i=ICAL_METHOD_X-ICALPROPERTY_FIRST_ENUM;
i != ICAL_METHOD_NONE-ICALPROPERTY_FIRST_ENUM;
i++) {
if ( strcmp(enum_map[i].str, str) == 0) {
return (icalproperty_method)enum_map[i].prop_enum;
}
}
return ICAL_METHOD_NONE;
}
const char* icalenum_status_to_string(icalproperty_status status)
{
icalerror_check_arg_rz(status >= ICAL_STATUS_X,"status");
icalerror_check_arg_rz(status <= ICAL_STATUS_NONE,"status");
return enum_map[status-ICALPROPERTY_FIRST_ENUM].str;
}
icalproperty_status icalenum_string_to_status(const char* str)
{
int i;
icalerror_check_arg_rx(str!=0,"str",ICAL_STATUS_NONE)
while(*str == ' '){
str++;
}
for (i=ICAL_STATUS_X-ICALPROPERTY_FIRST_ENUM;
i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM;
i++) {
if ( strcmp(enum_map[i].str, str) == 0) {
return (icalproperty_method)enum_map[i].prop_enum;
}
}
return ICAL_STATUS_NONE;
}
/* Everything below this line is machine generated. Do not edit. */

Просмотреть файл

@ -0,0 +1,403 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalderivedproperties.{c,h}
CREATOR: eric 09 May 1999
$Id: icalderivedproperty.h,v 1.1 2001-11-15 19:26:55 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
======================================================================*/
#ifndef ICALDERIVEDPROPERTY_H
#define ICALDERIVEDPROPERTY_H
#include <time.h>
#include "icalparameter.h"
#include "icalderivedvalue.h"
#include "icalrecur.h"
typedef void icalproperty;
/* Everything below this line is machine generated. Do not edit. */
typedef enum icalproperty_kind {
ICAL_ANY_PROPERTY = 0,
ICAL_ACTION_PROPERTY,
ICAL_ATTACH_PROPERTY,
ICAL_ATTENDEE_PROPERTY,
ICAL_CALSCALE_PROPERTY,
ICAL_CATEGORIES_PROPERTY,
ICAL_CLASS_PROPERTY,
ICAL_COMMENT_PROPERTY,
ICAL_COMPLETED_PROPERTY,
ICAL_CONTACT_PROPERTY,
ICAL_CREATED_PROPERTY,
ICAL_DESCRIPTION_PROPERTY,
ICAL_DTEND_PROPERTY,
ICAL_DTSTAMP_PROPERTY,
ICAL_DTSTART_PROPERTY,
ICAL_DUE_PROPERTY,
ICAL_DURATION_PROPERTY,
ICAL_EXDATE_PROPERTY,
ICAL_EXRULE_PROPERTY,
ICAL_FREEBUSY_PROPERTY,
ICAL_GEO_PROPERTY,
ICAL_LASTMODIFIED_PROPERTY,
ICAL_LOCATION_PROPERTY,
ICAL_MAXRESULTS_PROPERTY,
ICAL_MAXRESULTSSIZE_PROPERTY,
ICAL_METHOD_PROPERTY,
ICAL_ORGANIZER_PROPERTY,
ICAL_PERCENTCOMPLETE_PROPERTY,
ICAL_PRIORITY_PROPERTY,
ICAL_PRODID_PROPERTY,
ICAL_QUERY_PROPERTY,
ICAL_QUERYNAME_PROPERTY,
ICAL_RDATE_PROPERTY,
ICAL_RECURRENCEID_PROPERTY,
ICAL_RELATEDTO_PROPERTY,
ICAL_REPEAT_PROPERTY,
ICAL_REQUESTSTATUS_PROPERTY,
ICAL_RESOURCES_PROPERTY,
ICAL_RRULE_PROPERTY,
ICAL_SCOPE_PROPERTY,
ICAL_SEQUENCE_PROPERTY,
ICAL_STATUS_PROPERTY,
ICAL_SUMMARY_PROPERTY,
ICAL_TARGET_PROPERTY,
ICAL_TRANSP_PROPERTY,
ICAL_TRIGGER_PROPERTY,
ICAL_TZID_PROPERTY,
ICAL_TZNAME_PROPERTY,
ICAL_TZOFFSETFROM_PROPERTY,
ICAL_TZOFFSETTO_PROPERTY,
ICAL_TZURL_PROPERTY,
ICAL_UID_PROPERTY,
ICAL_URL_PROPERTY,
ICAL_VERSION_PROPERTY,
ICAL_X_PROPERTY,
ICAL_XLICCLUSTERCOUNT_PROPERTY,
ICAL_XLICERROR_PROPERTY,
ICAL_XLICMIMECHARSET_PROPERTY,
ICAL_XLICMIMECID_PROPERTY,
ICAL_XLICMIMECONTENTTYPE_PROPERTY,
ICAL_XLICMIMEENCODING_PROPERTY,
ICAL_XLICMIMEFILENAME_PROPERTY,
ICAL_XLICMIMEOPTINFO_PROPERTY,
ICAL_NO_PROPERTY
} icalproperty_kind;
/* ACTION */
icalproperty* icalproperty_new_action(enum icalproperty_action v);
icalproperty* icalproperty_vanew_action(enum icalproperty_action v, ...);
void icalproperty_set_action(icalproperty* prop, enum icalproperty_action v);
enum icalproperty_action icalproperty_get_action(icalproperty* prop);
/* ATTACH */
icalproperty* icalproperty_new_attach(struct icalattachtype v);
icalproperty* icalproperty_vanew_attach(struct icalattachtype v, ...);
void icalproperty_set_attach(icalproperty* prop, struct icalattachtype v);
struct icalattachtype icalproperty_get_attach(icalproperty* prop);
/* ATTENDEE */
icalproperty* icalproperty_new_attendee(const char* v);
icalproperty* icalproperty_vanew_attendee(const char* v, ...);
void icalproperty_set_attendee(icalproperty* prop, const char* v);
const char* icalproperty_get_attendee(icalproperty* prop);
/* CALSCALE */
icalproperty* icalproperty_new_calscale(const char* v);
icalproperty* icalproperty_vanew_calscale(const char* v, ...);
void icalproperty_set_calscale(icalproperty* prop, const char* v);
const char* icalproperty_get_calscale(icalproperty* prop);
/* CATEGORIES */
icalproperty* icalproperty_new_categories(const char* v);
icalproperty* icalproperty_vanew_categories(const char* v, ...);
void icalproperty_set_categories(icalproperty* prop, const char* v);
const char* icalproperty_get_categories(icalproperty* prop);
/* CLASS */
icalproperty* icalproperty_new_class(const char* v);
icalproperty* icalproperty_vanew_class(const char* v, ...);
void icalproperty_set_class(icalproperty* prop, const char* v);
const char* icalproperty_get_class(icalproperty* prop);
/* COMMENT */
icalproperty* icalproperty_new_comment(const char* v);
icalproperty* icalproperty_vanew_comment(const char* v, ...);
void icalproperty_set_comment(icalproperty* prop, const char* v);
const char* icalproperty_get_comment(icalproperty* prop);
/* COMPLETED */
icalproperty* icalproperty_new_completed(struct icaltimetype v);
icalproperty* icalproperty_vanew_completed(struct icaltimetype v, ...);
void icalproperty_set_completed(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_completed(icalproperty* prop);
/* CONTACT */
icalproperty* icalproperty_new_contact(const char* v);
icalproperty* icalproperty_vanew_contact(const char* v, ...);
void icalproperty_set_contact(icalproperty* prop, const char* v);
const char* icalproperty_get_contact(icalproperty* prop);
/* CREATED */
icalproperty* icalproperty_new_created(struct icaltimetype v);
icalproperty* icalproperty_vanew_created(struct icaltimetype v, ...);
void icalproperty_set_created(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_created(icalproperty* prop);
/* DESCRIPTION */
icalproperty* icalproperty_new_description(const char* v);
icalproperty* icalproperty_vanew_description(const char* v, ...);
void icalproperty_set_description(icalproperty* prop, const char* v);
const char* icalproperty_get_description(icalproperty* prop);
/* DTEND */
icalproperty* icalproperty_new_dtend(struct icaltimetype v);
icalproperty* icalproperty_vanew_dtend(struct icaltimetype v, ...);
void icalproperty_set_dtend(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_dtend(icalproperty* prop);
/* DTSTAMP */
icalproperty* icalproperty_new_dtstamp(struct icaltimetype v);
icalproperty* icalproperty_vanew_dtstamp(struct icaltimetype v, ...);
void icalproperty_set_dtstamp(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_dtstamp(icalproperty* prop);
/* DTSTART */
icalproperty* icalproperty_new_dtstart(struct icaltimetype v);
icalproperty* icalproperty_vanew_dtstart(struct icaltimetype v, ...);
void icalproperty_set_dtstart(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_dtstart(icalproperty* prop);
/* DUE */
icalproperty* icalproperty_new_due(struct icaltimetype v);
icalproperty* icalproperty_vanew_due(struct icaltimetype v, ...);
void icalproperty_set_due(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_due(icalproperty* prop);
/* DURATION */
icalproperty* icalproperty_new_duration(struct icaldurationtype v);
icalproperty* icalproperty_vanew_duration(struct icaldurationtype v, ...);
void icalproperty_set_duration(icalproperty* prop, struct icaldurationtype v);
struct icaldurationtype icalproperty_get_duration(icalproperty* prop);
/* EXDATE */
icalproperty* icalproperty_new_exdate(struct icaltimetype v);
icalproperty* icalproperty_vanew_exdate(struct icaltimetype v, ...);
void icalproperty_set_exdate(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_exdate(icalproperty* prop);
/* EXRULE */
icalproperty* icalproperty_new_exrule(struct icalrecurrencetype v);
icalproperty* icalproperty_vanew_exrule(struct icalrecurrencetype v, ...);
void icalproperty_set_exrule(icalproperty* prop, struct icalrecurrencetype v);
struct icalrecurrencetype icalproperty_get_exrule(icalproperty* prop);
/* FREEBUSY */
icalproperty* icalproperty_new_freebusy(struct icalperiodtype v);
icalproperty* icalproperty_vanew_freebusy(struct icalperiodtype v, ...);
void icalproperty_set_freebusy(icalproperty* prop, struct icalperiodtype v);
struct icalperiodtype icalproperty_get_freebusy(icalproperty* prop);
/* GEO */
icalproperty* icalproperty_new_geo(struct icalgeotype v);
icalproperty* icalproperty_vanew_geo(struct icalgeotype v, ...);
void icalproperty_set_geo(icalproperty* prop, struct icalgeotype v);
struct icalgeotype icalproperty_get_geo(icalproperty* prop);
/* LAST-MODIFIED */
icalproperty* icalproperty_new_lastmodified(struct icaltimetype v);
icalproperty* icalproperty_vanew_lastmodified(struct icaltimetype v, ...);
void icalproperty_set_lastmodified(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_lastmodified(icalproperty* prop);
/* LOCATION */
icalproperty* icalproperty_new_location(const char* v);
icalproperty* icalproperty_vanew_location(const char* v, ...);
void icalproperty_set_location(icalproperty* prop, const char* v);
const char* icalproperty_get_location(icalproperty* prop);
/* MAXRESULTS */
icalproperty* icalproperty_new_maxresults(int v);
icalproperty* icalproperty_vanew_maxresults(int v, ...);
void icalproperty_set_maxresults(icalproperty* prop, int v);
int icalproperty_get_maxresults(icalproperty* prop);
/* MAXRESULTSSIZE */
icalproperty* icalproperty_new_maxresultssize(int v);
icalproperty* icalproperty_vanew_maxresultssize(int v, ...);
void icalproperty_set_maxresultssize(icalproperty* prop, int v);
int icalproperty_get_maxresultssize(icalproperty* prop);
/* METHOD */
icalproperty* icalproperty_new_method(enum icalproperty_method v);
icalproperty* icalproperty_vanew_method(enum icalproperty_method v, ...);
void icalproperty_set_method(icalproperty* prop, enum icalproperty_method v);
enum icalproperty_method icalproperty_get_method(icalproperty* prop);
/* ORGANIZER */
icalproperty* icalproperty_new_organizer(const char* v);
icalproperty* icalproperty_vanew_organizer(const char* v, ...);
void icalproperty_set_organizer(icalproperty* prop, const char* v);
const char* icalproperty_get_organizer(icalproperty* prop);
/* PERCENT-COMPLETE */
icalproperty* icalproperty_new_percentcomplete(int v);
icalproperty* icalproperty_vanew_percentcomplete(int v, ...);
void icalproperty_set_percentcomplete(icalproperty* prop, int v);
int icalproperty_get_percentcomplete(icalproperty* prop);
/* PRIORITY */
icalproperty* icalproperty_new_priority(int v);
icalproperty* icalproperty_vanew_priority(int v, ...);
void icalproperty_set_priority(icalproperty* prop, int v);
int icalproperty_get_priority(icalproperty* prop);
/* PRODID */
icalproperty* icalproperty_new_prodid(const char* v);
icalproperty* icalproperty_vanew_prodid(const char* v, ...);
void icalproperty_set_prodid(icalproperty* prop, const char* v);
const char* icalproperty_get_prodid(icalproperty* prop);
/* QUERY */
icalproperty* icalproperty_new_query(const char* v);
icalproperty* icalproperty_vanew_query(const char* v, ...);
void icalproperty_set_query(icalproperty* prop, const char* v);
const char* icalproperty_get_query(icalproperty* prop);
/* QUERYNAME */
icalproperty* icalproperty_new_queryname(const char* v);
icalproperty* icalproperty_vanew_queryname(const char* v, ...);
void icalproperty_set_queryname(icalproperty* prop, const char* v);
const char* icalproperty_get_queryname(icalproperty* prop);
/* RDATE */
icalproperty* icalproperty_new_rdate(struct icaldatetimeperiodtype v);
icalproperty* icalproperty_vanew_rdate(struct icaldatetimeperiodtype v, ...);
void icalproperty_set_rdate(icalproperty* prop, struct icaldatetimeperiodtype v);
struct icaldatetimeperiodtype icalproperty_get_rdate(icalproperty* prop);
/* RECURRENCE-ID */
icalproperty* icalproperty_new_recurrenceid(struct icaltimetype v);
icalproperty* icalproperty_vanew_recurrenceid(struct icaltimetype v, ...);
void icalproperty_set_recurrenceid(icalproperty* prop, struct icaltimetype v);
struct icaltimetype icalproperty_get_recurrenceid(icalproperty* prop);
/* RELATED-TO */
icalproperty* icalproperty_new_relatedto(const char* v);
icalproperty* icalproperty_vanew_relatedto(const char* v, ...);
void icalproperty_set_relatedto(icalproperty* prop, const char* v);
const char* icalproperty_get_relatedto(icalproperty* prop);
/* REPEAT */
icalproperty* icalproperty_new_repeat(int v);
icalproperty* icalproperty_vanew_repeat(int v, ...);
void icalproperty_set_repeat(icalproperty* prop, int v);
int icalproperty_get_repeat(icalproperty* prop);
/* REQUEST-STATUS */
icalproperty* icalproperty_new_requeststatus(const char* v);
icalproperty* icalproperty_vanew_requeststatus(const char* v, ...);
void icalproperty_set_requeststatus(icalproperty* prop, const char* v);
const char* icalproperty_get_requeststatus(icalproperty* prop);
/* RESOURCES */
icalproperty* icalproperty_new_resources(const char* v);
icalproperty* icalproperty_vanew_resources(const char* v, ...);
void icalproperty_set_resources(icalproperty* prop, const char* v);
const char* icalproperty_get_resources(icalproperty* prop);
/* RRULE */
icalproperty* icalproperty_new_rrule(struct icalrecurrencetype v);
icalproperty* icalproperty_vanew_rrule(struct icalrecurrencetype v, ...);
void icalproperty_set_rrule(icalproperty* prop, struct icalrecurrencetype v);
struct icalrecurrencetype icalproperty_get_rrule(icalproperty* prop);
/* SCOPE */
icalproperty* icalproperty_new_scope(const char* v);
icalproperty* icalproperty_vanew_scope(const char* v, ...);
void icalproperty_set_scope(icalproperty* prop, const char* v);
const char* icalproperty_get_scope(icalproperty* prop);
/* SEQUENCE */
icalproperty* icalproperty_new_sequence(int v);
icalproperty* icalproperty_vanew_sequence(int v, ...);
void icalproperty_set_sequence(icalproperty* prop, int v);
int icalproperty_get_sequence(icalproperty* prop);
/* STATUS */
icalproperty* icalproperty_new_status(enum icalproperty_status v);
icalproperty* icalproperty_vanew_status(enum icalproperty_status v, ...);
void icalproperty_set_status(icalproperty* prop, enum icalproperty_status v);
enum icalproperty_status icalproperty_get_status(icalproperty* prop);
/* SUMMARY */
icalproperty* icalproperty_new_summary(const char* v);
icalproperty* icalproperty_vanew_summary(const char* v, ...);
void icalproperty_set_summary(icalproperty* prop, const char* v);
const char* icalproperty_get_summary(icalproperty* prop);
/* TARGET */
icalproperty* icalproperty_new_target(const char* v);
icalproperty* icalproperty_vanew_target(const char* v, ...);
void icalproperty_set_target(icalproperty* prop, const char* v);
const char* icalproperty_get_target(icalproperty* prop);
/* TRANSP */
icalproperty* icalproperty_new_transp(const char* v);
icalproperty* icalproperty_vanew_transp(const char* v, ...);
void icalproperty_set_transp(icalproperty* prop, const char* v);
const char* icalproperty_get_transp(icalproperty* prop);
/* TRIGGER */
icalproperty* icalproperty_new_trigger(struct icaltriggertype v);
icalproperty* icalproperty_vanew_trigger(struct icaltriggertype v, ...);
void icalproperty_set_trigger(icalproperty* prop, struct icaltriggertype v);
struct icaltriggertype icalproperty_get_trigger(icalproperty* prop);
/* TZID */
icalproperty* icalproperty_new_tzid(const char* v);
icalproperty* icalproperty_vanew_tzid(const char* v, ...);
void icalproperty_set_tzid(icalproperty* prop, const char* v);
const char* icalproperty_get_tzid(icalproperty* prop);
/* TZNAME */
icalproperty* icalproperty_new_tzname(const char* v);
icalproperty* icalproperty_vanew_tzname(const char* v, ...);
void icalproperty_set_tzname(icalproperty* prop, const char* v);
const char* icalproperty_get_tzname(icalproperty* prop);
/* TZOFFSETFROM */
icalproperty* icalproperty_new_tzoffsetfrom(int v);
icalproperty* icalproperty_vanew_tzoffsetfrom(int v, ...);
void icalproperty_set_tzoffsetfrom(icalproperty* prop, int v);
int icalproperty_get_tzoffsetfrom(icalproperty* prop);
/* TZOFFSETTO */
icalproperty* icalproperty_new_tzoffsetto(int v);
icalproperty* icalproperty_vanew_tzoffsetto(int v, ...);
void icalproperty_set_tzoffsetto(icalproperty* prop, int v);
int icalproperty_get_tzoffsetto(icalproperty* prop);
/* TZURL */
icalproperty* icalproperty_new_tzurl(const char* v);
icalproperty* icalproperty_vanew_tzurl(const char* v, ...);
void icalproperty_set_tzurl(icalproperty* prop, const char* v);
const char* icalproperty_get_tzurl(icalproperty* prop);
/* UID */
icalproperty* icalproperty_new_uid(const char* v);
icalproperty* icalproperty_vanew_uid(const char* v, ...);
void icalproperty_set_uid(icalproperty* prop, const char* v);
const char* icalproperty_get_uid(icalproperty* prop);
/* URL */
icalproperty* icalproperty_new_url(const char* v);
icalproperty* icalproperty_vanew_url(const char* v, ...);
void icalproperty_set_url(icalproperty* prop, const char* v);
const char* icalproperty_get_url(icalproperty* prop);
/* VERSION */
icalproperty* icalproperty_new_version(const char* v);
icalproperty* icalproperty_vanew_version(const char* v, ...);
void icalproperty_set_version(icalproperty* prop, const char* v);
const char* icalproperty_get_version(icalproperty* prop);
/* X */
icalproperty* icalproperty_new_x(const char* v);
icalproperty* icalproperty_vanew_x(const char* v, ...);
void icalproperty_set_x(icalproperty* prop, const char* v);
const char* icalproperty_get_x(icalproperty* prop);
/* X-LIC-CLUSTERCOUNT */
icalproperty* icalproperty_new_xlicclustercount(const char* v);
icalproperty* icalproperty_vanew_xlicclustercount(const char* v, ...);
void icalproperty_set_xlicclustercount(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicclustercount(icalproperty* prop);
/* X-LIC-ERROR */
icalproperty* icalproperty_new_xlicerror(const char* v);
icalproperty* icalproperty_vanew_xlicerror(const char* v, ...);
void icalproperty_set_xlicerror(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicerror(icalproperty* prop);
/* X-LIC-MIMECHARSET */
icalproperty* icalproperty_new_xlicmimecharset(const char* v);
icalproperty* icalproperty_vanew_xlicmimecharset(const char* v, ...);
void icalproperty_set_xlicmimecharset(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicmimecharset(icalproperty* prop);
/* X-LIC-MIMECID */
icalproperty* icalproperty_new_xlicmimecid(const char* v);
icalproperty* icalproperty_vanew_xlicmimecid(const char* v, ...);
void icalproperty_set_xlicmimecid(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicmimecid(icalproperty* prop);
/* X-LIC-MIMECONTENTTYPE */
icalproperty* icalproperty_new_xlicmimecontenttype(const char* v);
icalproperty* icalproperty_vanew_xlicmimecontenttype(const char* v, ...);
void icalproperty_set_xlicmimecontenttype(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicmimecontenttype(icalproperty* prop);
/* X-LIC-MIMEENCODING */
icalproperty* icalproperty_new_xlicmimeencoding(const char* v);
icalproperty* icalproperty_vanew_xlicmimeencoding(const char* v, ...);
void icalproperty_set_xlicmimeencoding(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicmimeencoding(icalproperty* prop);
/* X-LIC-MIMEFILENAME */
icalproperty* icalproperty_new_xlicmimefilename(const char* v);
icalproperty* icalproperty_vanew_xlicmimefilename(const char* v, ...);
void icalproperty_set_xlicmimefilename(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicmimefilename(icalproperty* prop);
/* X-LIC-MIMEOPTINFO */
icalproperty* icalproperty_new_xlicmimeoptinfo(const char* v);
icalproperty* icalproperty_vanew_xlicmimeoptinfo(const char* v, ...);
void icalproperty_set_xlicmimeoptinfo(icalproperty* prop, const char* v);
const char* icalproperty_get_xlicmimeoptinfo(icalproperty* prop);
#endif /*ICALPROPERTY_H*/

Просмотреть файл

@ -0,0 +1,23 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalderivedproperties.{c,h}
CREATOR: eric 09 May 1999
$Id: icalderivedproperty.h.in,v 1.2 2001-12-21 18:56:17 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
======================================================================*/
#ifndef ICALDERIVEDPROPERTY_H
#define ICALDERIVEDPROPERTY_H
#include <time.h>
#include "icalparameter.h"
#include "icalderivedvalue.h"
#include "icalrecur.h"
typedef void icalproperty;
/* Everything below this line is machine generated. Do not edit. */

Просмотреть файл

@ -0,0 +1,928 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalvalue.c
CREATOR: eric 02 May 1999
$Id: icalderivedvalue.c,v 1.1 2001-11-15 19:26:55 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalvalue.c
Contributions from:
Graham Davison (g.m.davison@computer.org)
======================================================================*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalerror.h"
#include "icalmemory.h"
#include "icalparser.h"
#include "icalenums.h"
#include "icalvalueimpl.h"
#include <stdlib.h> /* for malloc */
#include <stdio.h> /* for sprintf */
#include <string.h> /* For memset, others */
#include <stddef.h> /* For offsetof() macro */
#include <errno.h>
#include <time.h> /* for mktime */
#include <stdlib.h> /* for atoi and atof */
#include <limits.h> /* for SHRT_MAX */
#define TMP_BUF_SIZE 1024
struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind);
/* This map associates each of the value types with its string
representation */
struct icalvalue_kind_map {
icalvalue_kind kind;
char name[20];
};
extern struct icalvalue_kind_map value_map[];
const char* icalvalue_kind_to_string(icalvalue_kind kind)
{
int i;
for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
if (value_map[i].kind == kind) {
return value_map[i].name;
}
}
return 0;
}
icalvalue_kind icalvalue_string_to_kind(const char* str)
{
int i;
for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
if (strcmp(value_map[i].name,str) == 0) {
return value_map[i].kind;
}
}
return value_map[i].kind;
}
icalvalue* icalvalue_new_x (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_x((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_x(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
impl = (struct icalvalue_impl*)value;
if(impl->x_value!=0) {free((void*)impl->x_value);}
impl->x_value = icalmemory_strdup(v);
if (impl->x_value == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_x(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_X_VALUE);
return ((struct icalvalue_impl*)value)->x_value;
}
/* Recur is a special case, so it is not auto generated. */
icalvalue*
icalvalue_new_recur (struct icalrecurrencetype v)
{
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE);
icalvalue_set_recur((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void
icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v)
{
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_RECUR_VALUE);
impl = (struct icalvalue_impl*)value;
if (impl->data.v_recur != 0){
free(impl->data.v_recur);
impl->data.v_recur = 0;
}
impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
if (impl->data.v_recur == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return;
} else {
memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
}
}
struct icalrecurrencetype
icalvalue_get_recur(icalvalue* value)
{
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_RECUR_VALUE);
return *(((struct icalvalue_impl*)value)->data.v_recur);
}
icalvalue*
icalvalue_new_trigger (struct icaltriggertype v)
{
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE);
icalvalue_set_trigger((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void
icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
{
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
impl = (struct icalvalue_impl*)value;
if(!icaltime_is_null_time(v.time)){
icalvalue_set_datetime((icalvalue*)impl,v.time);
impl->kind = ICAL_DATETIME_VALUE;
} else {
icalvalue_set_duration((icalvalue*)impl,v.duration);
impl->kind = ICAL_DURATION_VALUE;
}
}
struct icaltriggertype
icalvalue_get_trigger(icalvalue* value)
{
struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
struct icaltriggertype tr;
icalerror_check_arg( (value!=0),"value");
icalerror_check_arg( (value!=0),"value");
if(impl->kind == ICAL_DATETIME_VALUE){
tr.duration = icaldurationtype_from_int(0);
tr.time = impl->data.v_time;
} else if(impl->kind == ICAL_DURATION_VALUE){
tr.time = icaltime_null_time();
tr.duration = impl->data.v_duration;
} else {
tr.duration = icaldurationtype_from_int(0);
tr.time = icaltime_null_time();
icalerror_set_errno(ICAL_BADARG_ERROR);
}
return tr;
}
/* DATE-TIME-PERIOD is a special case, and is not auto generated */
icalvalue*
icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v)
{
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE);
icalvalue_set_datetimeperiod((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void
icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v)
{
struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
if(!icaltime_is_null_time(v.time)){
if(!icaltime_is_valid_time(v.time)){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
impl->kind = ICAL_DATETIME_VALUE;
icalvalue_set_datetime(impl,v.time);
} else if (!icalperiodtype_is_null_period(v.period)) {
if(!icalperiodtype_is_valid_period(v.period)){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
impl->kind = ICAL_PERIOD_VALUE;
icalvalue_set_period(impl,v.period);
} else {
icalerror_set_errno(ICAL_BADARG_ERROR);
}
}
struct icaldatetimeperiodtype
icalvalue_get_datetimeperiod(icalvalue* value)
{
struct icaldatetimeperiodtype dtp;
struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
if(impl->kind == ICAL_DATETIME_VALUE){
dtp.period = icalperiodtype_null_period();
dtp.time = impl->data.v_time;
} else if(impl->kind == ICAL_PERIOD_VALUE) {
dtp.period = impl->data.v_period;
dtp.time = icaltime_null_time();
} else {
dtp.period = icalperiodtype_null_period();
dtp.time = icaltime_null_time();
icalerror_set_errno(ICAL_BADARG_ERROR);
}
return dtp;
}
/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
types */
/* Everything below this line is machine generated. Do not edit. */
static struct icalvalue_kind_map value_map[]={
{ICAL_BOOLEAN_VALUE,"BOOLEAN"},
{ICAL_UTCOFFSET_VALUE,"UTC-OFFSET"},
{ICAL_RECUR_VALUE,"RECUR"},
{ICAL_METHOD_VALUE,"METHOD"},
{ICAL_CALADDRESS_VALUE,"CAL-ADDRESS"},
{ICAL_PERIOD_VALUE,"PERIOD"},
{ICAL_STATUS_VALUE,"STATUS"},
{ICAL_BINARY_VALUE,"BINARY"},
{ICAL_TEXT_VALUE,"TEXT"},
{ICAL_DATETIMEDATE_VALUE,"DATE-TIME-DATE"},
{ICAL_DURATION_VALUE,"DURATION"},
{ICAL_DATETIMEPERIOD_VALUE,"DATE-TIME-PERIOD"},
{ICAL_INTEGER_VALUE,"INTEGER"},
{ICAL_TIME_VALUE,"TIME"},
{ICAL_URI_VALUE,"URI"},
{ICAL_TRIGGER_VALUE,"TRIGGER"},
{ICAL_ATTACH_VALUE,"ATTACH"},
{ICAL_CLASS_VALUE,"CLASS"},
{ICAL_FLOAT_VALUE,"FLOAT"},
{ICAL_QUERY_VALUE,"QUERY"},
{ICAL_STRING_VALUE,"STRING"},
{ICAL_TRANSP_VALUE,"TRANSP"},
{ICAL_X_VALUE,"X"},
{ICAL_DATETIME_VALUE,"DATE-TIME"},
{ICAL_GEO_VALUE,"GEO"},
{ICAL_DATE_VALUE,"DATE"},
{ICAL_ACTION_VALUE,"ACTION"},
{ICAL_NO_VALUE,""}
};
icalvalue* icalvalue_new_boolean (int v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BOOLEAN_VALUE);
icalvalue_set_boolean((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_boolean(icalvalue* value, int v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_int = v;
}
int icalvalue_get_boolean(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_BOOLEAN_VALUE);
return ((struct icalvalue_impl*)value)->data.v_int;
}
icalvalue* icalvalue_new_utcoffset (int v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_UTCOFFSET_VALUE);
icalvalue_set_utcoffset((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_utcoffset(icalvalue* value, int v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_int = v;
}
int icalvalue_get_utcoffset(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_UTCOFFSET_VALUE);
return ((struct icalvalue_impl*)value)->data.v_int;
}
icalvalue* icalvalue_new_method (enum icalproperty_method v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_METHOD_VALUE);
icalvalue_set_method((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_method(icalvalue* value, enum icalproperty_method v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_METHOD_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_enum = v;
}
enum icalproperty_method icalvalue_get_method(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_METHOD_VALUE);
return ((struct icalvalue_impl*)value)->data.v_enum;
}
icalvalue* icalvalue_new_caladdress (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CALADDRESS_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_caladdress((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_caladdress(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
impl->data.v_string = icalmemory_strdup(v);
if (impl->data.v_string == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_caladdress(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_CALADDRESS_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
icalvalue* icalvalue_new_period (struct icalperiodtype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_PERIOD_VALUE);
icalvalue_set_period((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_period(icalvalue* value, struct icalperiodtype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_period = v;
}
struct icalperiodtype icalvalue_get_period(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_PERIOD_VALUE);
return ((struct icalvalue_impl*)value)->data.v_period;
}
icalvalue* icalvalue_new_status (enum icalproperty_status v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STATUS_VALUE);
icalvalue_set_status((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_status(icalvalue* value, enum icalproperty_status v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_STATUS_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_enum = v;
}
enum icalproperty_status icalvalue_get_status(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_STATUS_VALUE);
return ((struct icalvalue_impl*)value)->data.v_enum;
}
icalvalue* icalvalue_new_binary (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_BINARY_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_binary((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_binary(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_value_type(value, ICAL_BINARY_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
impl->data.v_string = icalmemory_strdup(v);
if (impl->data.v_string == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_binary(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_BINARY_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
icalvalue* icalvalue_new_text (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TEXT_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_text((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_text(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_value_type(value, ICAL_TEXT_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
impl->data.v_string = icalmemory_strdup(v);
if (impl->data.v_string == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_text(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_TEXT_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
icalvalue* icalvalue_new_datetimedate (struct icaltimetype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEDATE_VALUE);
icalvalue_set_datetimedate((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_datetimedate(icalvalue* value, struct icaltimetype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIMEDATE_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_time = v;
}
struct icaltimetype icalvalue_get_datetimedate(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIMEDATE_VALUE);
return ((struct icalvalue_impl*)value)->data.v_time;
}
icalvalue* icalvalue_new_duration (struct icaldurationtype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DURATION_VALUE);
icalvalue_set_duration((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DURATION_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_duration = v;
}
struct icaldurationtype icalvalue_get_duration(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DURATION_VALUE);
return ((struct icalvalue_impl*)value)->data.v_duration;
}
icalvalue* icalvalue_new_integer (int v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_INTEGER_VALUE);
icalvalue_set_integer((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_integer(icalvalue* value, int v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_INTEGER_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_int = v;
}
int icalvalue_get_integer(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_INTEGER_VALUE);
return ((struct icalvalue_impl*)value)->data.v_int;
}
icalvalue* icalvalue_new_time (struct icaltimetype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TIME_VALUE);
icalvalue_set_time((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_time(icalvalue* value, struct icaltimetype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_TIME_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_time = v;
}
struct icaltimetype icalvalue_get_time(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_TIME_VALUE);
return ((struct icalvalue_impl*)value)->data.v_time;
}
icalvalue* icalvalue_new_uri (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_URI_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_uri((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_uri(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_value_type(value, ICAL_URI_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
impl->data.v_string = icalmemory_strdup(v);
if (impl->data.v_string == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_uri(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_URI_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
icalvalue* icalvalue_new_attach (struct icalattachtype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ATTACH_VALUE);
icalvalue_set_attach((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_attach(icalvalue* value, struct icalattachtype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_attach = v;
}
struct icalattachtype icalvalue_get_attach(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_ATTACH_VALUE);
return ((struct icalvalue_impl*)value)->data.v_attach;
}
icalvalue* icalvalue_new_class (enum icalproperty_class v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_CLASS_VALUE);
icalvalue_set_class((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_class(icalvalue* value, enum icalproperty_class v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_CLASS_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_enum = v;
}
enum icalproperty_class icalvalue_get_class(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_CLASS_VALUE);
return ((struct icalvalue_impl*)value)->data.v_enum;
}
icalvalue* icalvalue_new_float (float v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_FLOAT_VALUE);
icalvalue_set_float((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_float(icalvalue* value, float v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_float = v;
}
float icalvalue_get_float(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_FLOAT_VALUE);
return ((struct icalvalue_impl*)value)->data.v_float;
}
icalvalue* icalvalue_new_query (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_QUERY_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_query((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_query(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_value_type(value, ICAL_QUERY_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
impl->data.v_string = icalmemory_strdup(v);
if (impl->data.v_string == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_query(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_QUERY_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
icalvalue* icalvalue_new_string (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_STRING_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_string((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_string(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
icalerror_check_value_type(value, ICAL_STRING_VALUE);
impl = (struct icalvalue_impl*)value;
if(impl->data.v_string!=0) {free((void*)impl->data.v_string);}
impl->data.v_string = icalmemory_strdup(v);
if (impl->data.v_string == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_string(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_STRING_VALUE);
return ((struct icalvalue_impl*)value)->data.v_string;
}
icalvalue* icalvalue_new_transp (enum icalproperty_transp v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRANSP_VALUE);
icalvalue_set_transp((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_enum = v;
}
enum icalproperty_transp icalvalue_get_transp(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_TRANSP_VALUE);
return ((struct icalvalue_impl*)value)->data.v_enum;
}
icalvalue* icalvalue_new_datetime (struct icaltimetype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIME_VALUE);
icalvalue_set_datetime((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIME_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_time = v;
}
struct icaltimetype icalvalue_get_datetime(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIME_VALUE);
return ((struct icalvalue_impl*)value)->data.v_time;
}
icalvalue* icalvalue_new_geo (struct icalgeotype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_GEO_VALUE);
icalvalue_set_geo((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_geo(icalvalue* value, struct icalgeotype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_GEO_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_geo = v;
}
struct icalgeotype icalvalue_get_geo(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_GEO_VALUE);
return ((struct icalvalue_impl*)value)->data.v_geo;
}
icalvalue* icalvalue_new_date (struct icaltimetype v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATE_VALUE);
icalvalue_set_date((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_date(icalvalue* value, struct icaltimetype v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATE_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_time = v;
}
struct icaltimetype icalvalue_get_date(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATE_VALUE);
return ((struct icalvalue_impl*)value)->data.v_time;
}
icalvalue* icalvalue_new_action (enum icalproperty_action v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_ACTION_VALUE);
icalvalue_set_action((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_action(icalvalue* value, enum icalproperty_action v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_ACTION_VALUE);
impl = (struct icalvalue_impl*)value;
impl->data.v_enum = v;
}
enum icalproperty_action icalvalue_get_action(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_ACTION_VALUE);
return ((struct icalvalue_impl*)value)->data.v_enum;
}

Просмотреть файл

@ -0,0 +1,299 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalvalue.c
CREATOR: eric 02 May 1999
$Id: icalderivedvalue.c.in,v 1.2 2001-12-21 18:56:18 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalvalue.c
Contributions from:
Graham Davison (g.m.davison@computer.org)
======================================================================*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalerror.h"
#include "icalmemory.h"
#include "icalparser.h"
#include "icalenums.h"
#include "icalvalueimpl.h"
#include <stdlib.h> /* for malloc */
#include <stdio.h> /* for sprintf */
#include <string.h> /* For memset, others */
#include <stddef.h> /* For offsetof() macro */
#include <errno.h>
#include <time.h> /* for mktime */
#include <stdlib.h> /* for atoi and atof */
#include <limits.h> /* for SHRT_MAX */
#define TMP_BUF_SIZE 1024
struct icalvalue_impl* icalvalue_new_impl(icalvalue_kind kind);
/* This map associates each of the value types with its string
representation */
struct icalvalue_kind_map {
icalvalue_kind kind;
char name[20];
};
extern struct icalvalue_kind_map value_map[];
const char* icalvalue_kind_to_string(icalvalue_kind kind)
{
int i;
for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
if (value_map[i].kind == kind) {
return value_map[i].name;
}
}
return 0;
}
icalvalue_kind icalvalue_string_to_kind(const char* str)
{
int i;
for (i=0; value_map[i].kind != ICAL_NO_VALUE; i++) {
if (strcmp(value_map[i].name,str) == 0) {
return value_map[i].kind;
}
}
return value_map[i].kind;
}
icalvalue* icalvalue_new_x (const char* v){
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_X_VALUE);
icalerror_check_arg_rz( (v!=0),"v");
icalvalue_set_x((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void icalvalue_set_x(icalvalue* value, const char* v) {
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_arg_rv( (v!=0),"v");
impl = (struct icalvalue_impl*)value;
if(impl->x_value!=0) {free((void*)impl->x_value);}
impl->x_value = icalmemory_strdup(v);
if (impl->x_value == 0){
errno = ENOMEM;
}
}
const char* icalvalue_get_x(icalvalue* value) {
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_X_VALUE);
return ((struct icalvalue_impl*)value)->x_value;
}
/* Recur is a special case, so it is not auto generated. */
icalvalue*
icalvalue_new_recur (struct icalrecurrencetype v)
{
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_RECUR_VALUE);
icalvalue_set_recur((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void
icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v)
{
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_RECUR_VALUE);
impl = (struct icalvalue_impl*)value;
if (impl->data.v_recur != 0){
free(impl->data.v_recur);
impl->data.v_recur = 0;
}
impl->data.v_recur = malloc(sizeof(struct icalrecurrencetype));
if (impl->data.v_recur == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return;
} else {
memcpy(impl->data.v_recur, &v, sizeof(struct icalrecurrencetype));
}
}
struct icalrecurrencetype
icalvalue_get_recur(icalvalue* value)
{
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_RECUR_VALUE);
return *(((struct icalvalue_impl*)value)->data.v_recur);
}
icalvalue*
icalvalue_new_trigger (struct icaltriggertype v)
{
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_TRIGGER_VALUE);
icalvalue_set_trigger((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void
icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v)
{
struct icalvalue_impl* impl;
icalerror_check_arg_rv( (value!=0),"value");
impl = (struct icalvalue_impl*)value;
if(!icaltime_is_null_time(v.time)){
icalvalue_set_datetime((icalvalue*)impl,v.time);
impl->kind = ICAL_DATETIME_VALUE;
} else {
icalvalue_set_duration((icalvalue*)impl,v.duration);
impl->kind = ICAL_DURATION_VALUE;
}
}
struct icaltriggertype
icalvalue_get_trigger(icalvalue* value)
{
struct icalvalue_impl *impl = (struct icalvalue_impl*)value;
struct icaltriggertype tr;
icalerror_check_arg( (value!=0),"value");
icalerror_check_arg( (value!=0),"value");
if(impl->kind == ICAL_DATETIME_VALUE){
tr.duration = icaldurationtype_from_int(0);
tr.time = impl->data.v_time;
} else if(impl->kind == ICAL_DURATION_VALUE){
tr.time = icaltime_null_time();
tr.duration = impl->data.v_duration;
} else {
tr.duration = icaldurationtype_from_int(0);
tr.time = icaltime_null_time();
icalerror_set_errno(ICAL_BADARG_ERROR);
}
return tr;
}
/* DATE-TIME-PERIOD is a special case, and is not auto generated */
icalvalue*
icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v)
{
struct icalvalue_impl* impl = icalvalue_new_impl(ICAL_DATETIMEPERIOD_VALUE);
icalvalue_set_datetimeperiod((icalvalue*)impl,v);
return (icalvalue*)impl;
}
void
icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v)
{
struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
icalerror_check_arg_rv( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
if(!icaltime_is_null_time(v.time)){
if(!icaltime_is_valid_time(v.time)){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
impl->kind = ICAL_DATETIME_VALUE;
icalvalue_set_datetime(impl,v.time);
} else if (!icalperiodtype_is_null_period(v.period)) {
if(!icalperiodtype_is_valid_period(v.period)){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
impl->kind = ICAL_PERIOD_VALUE;
icalvalue_set_period(impl,v.period);
} else {
icalerror_set_errno(ICAL_BADARG_ERROR);
}
}
struct icaldatetimeperiodtype
icalvalue_get_datetimeperiod(icalvalue* value)
{
struct icaldatetimeperiodtype dtp;
struct icalvalue_impl* impl = (struct icalvalue_impl*)value;
icalerror_check_arg( (value!=0),"value");
icalerror_check_value_type(value, ICAL_DATETIMEPERIOD_VALUE);
if(impl->kind == ICAL_DATETIME_VALUE){
dtp.period = icalperiodtype_null_period();
dtp.time = impl->data.v_time;
} else if(impl->kind == ICAL_PERIOD_VALUE) {
dtp.period = impl->data.v_period;
dtp.time = icaltime_null_time();
} else {
dtp.period = icalperiodtype_null_period();
dtp.time = icaltime_null_time();
icalerror_set_errno(ICAL_BADARG_ERROR);
}
return dtp;
}
/* The remaining interfaces are 'new', 'set' and 'get' for each of the value
types */
/* Everything below this line is machine generated. Do not edit. */

Просмотреть файл

@ -0,0 +1,290 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalvalue.h
CREATOR: eric 20 March 1999
$Id: icalderivedvalue.h,v 1.1 2001-11-15 19:26:55 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalvalue.h
======================================================================*/
#ifndef ICALDERIVEDVALUE_H
#define ICALDERIVEDVALUE_H
#include "icaltypes.h"
#include "icalrecur.h"
#include "icaltime.h"
#include "icalduration.h"
#include "icalperiod.h"
typedef void icalvalue;
void icalvalue_set_x(icalvalue* value, const char* v);
icalvalue* icalvalue_new_x(const char* v);
const char* icalvalue_get_x(icalvalue* value);
icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v);
struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
/* Everything below this line is machine generated. Do not edit. */
typedef enum icalvalue_kind {
ICAL_ANY_VALUE=5000,
ICAL_BOOLEAN_VALUE=5001,
ICAL_UTCOFFSET_VALUE=5002,
ICAL_RECUR_VALUE=5003,
ICAL_METHOD_VALUE=5004,
ICAL_CALADDRESS_VALUE=5005,
ICAL_PERIOD_VALUE=5006,
ICAL_STATUS_VALUE=5007,
ICAL_BINARY_VALUE=5008,
ICAL_TEXT_VALUE=5009,
ICAL_DATETIMEDATE_VALUE=5010,
ICAL_DURATION_VALUE=5011,
ICAL_DATETIMEPERIOD_VALUE=5012,
ICAL_INTEGER_VALUE=5013,
ICAL_TIME_VALUE=5014,
ICAL_URI_VALUE=5015,
ICAL_TRIGGER_VALUE=5016,
ICAL_ATTACH_VALUE=5017,
ICAL_CLASS_VALUE=5018,
ICAL_FLOAT_VALUE=5019,
ICAL_QUERY_VALUE=5020,
ICAL_STRING_VALUE=5021,
ICAL_TRANSP_VALUE=5022,
ICAL_X_VALUE=5023,
ICAL_DATETIME_VALUE=5024,
ICAL_GEO_VALUE=5025,
ICAL_DATE_VALUE=5026,
ICAL_ACTION_VALUE=5027,
ICAL_NO_VALUE=5028
} icalvalue_kind ;
#define ICALPROPERTY_FIRST_ENUM 10000
typedef enum icalproperty_action {
ICAL_ACTION_X = 10000,
ICAL_ACTION_AUDIO = 10001,
ICAL_ACTION_DISPLAY = 10002,
ICAL_ACTION_EMAIL = 10003,
ICAL_ACTION_PROCEDURE = 10004,
ICAL_ACTION_NONE = 10005
} icalproperty_action;
typedef enum icalproperty_class {
ICAL_CLASS_X = 10006,
ICAL_CLASS_PUBLIC = 10007,
ICAL_CLASS_PRIVATE = 10008,
ICAL_CLASS_CONFIDENTIAL = 10009,
ICAL_CLASS_NONE = 10010
} icalproperty_class;
typedef enum icalproperty_method {
ICAL_METHOD_X = 10011,
ICAL_METHOD_PUBLISH = 10012,
ICAL_METHOD_REQUEST = 10013,
ICAL_METHOD_REPLY = 10014,
ICAL_METHOD_ADD = 10015,
ICAL_METHOD_CANCEL = 10016,
ICAL_METHOD_REFRESH = 10017,
ICAL_METHOD_COUNTER = 10018,
ICAL_METHOD_DECLINECOUNTER = 10019,
ICAL_METHOD_CREATE = 10020,
ICAL_METHOD_READ = 10021,
ICAL_METHOD_RESPONSE = 10022,
ICAL_METHOD_MOVE = 10023,
ICAL_METHOD_MODIFY = 10024,
ICAL_METHOD_GENERATEUID = 10025,
ICAL_METHOD_DELETE = 10026,
ICAL_METHOD_NONE = 10027
} icalproperty_method;
typedef enum icalproperty_status {
ICAL_STATUS_X = 10028,
ICAL_STATUS_TENTATIVE = 10029,
ICAL_STATUS_CONFIRMED = 10030,
ICAL_STATUS_COMPLETED = 10031,
ICAL_STATUS_NEEDSACTION = 10032,
ICAL_STATUS_CANCELLED = 10033,
ICAL_STATUS_INPROCESS = 10034,
ICAL_STATUS_DRAFT = 10035,
ICAL_STATUS_FINAL = 10036,
ICAL_STATUS_NONE = 10037
} icalproperty_status;
typedef enum icalproperty_transp {
ICAL_TRANSP_X = 10038,
ICAL_TRANSP_OPAQUE = 10039,
ICAL_TRANSP_TRANSPARENT = 10040,
ICAL_TRANSP_NONE = 10041
} icalproperty_transp;
#define ICALPROPERTY_LAST_ENUM 10042
/* BOOLEAN */
icalvalue* icalvalue_new_boolean(int v);
int icalvalue_get_boolean(icalvalue* value);
void icalvalue_set_boolean(icalvalue* value, int v);
/* UTC-OFFSET */
icalvalue* icalvalue_new_utcoffset(int v);
int icalvalue_get_utcoffset(icalvalue* value);
void icalvalue_set_utcoffset(icalvalue* value, int v);
/* METHOD */
icalvalue* icalvalue_new_method(enum icalproperty_method v);
enum icalproperty_method icalvalue_get_method(icalvalue* value);
void icalvalue_set_method(icalvalue* value, enum icalproperty_method v);
/* CAL-ADDRESS */
icalvalue* icalvalue_new_caladdress(const char* v);
const char* icalvalue_get_caladdress(icalvalue* value);
void icalvalue_set_caladdress(icalvalue* value, const char* v);
/* PERIOD */
icalvalue* icalvalue_new_period(struct icalperiodtype v);
struct icalperiodtype icalvalue_get_period(icalvalue* value);
void icalvalue_set_period(icalvalue* value, struct icalperiodtype v);
/* STATUS */
icalvalue* icalvalue_new_status(enum icalproperty_status v);
enum icalproperty_status icalvalue_get_status(icalvalue* value);
void icalvalue_set_status(icalvalue* value, enum icalproperty_status v);
/* BINARY */
icalvalue* icalvalue_new_binary(const char* v);
const char* icalvalue_get_binary(icalvalue* value);
void icalvalue_set_binary(icalvalue* value, const char* v);
/* TEXT */
icalvalue* icalvalue_new_text(const char* v);
const char* icalvalue_get_text(icalvalue* value);
void icalvalue_set_text(icalvalue* value, const char* v);
/* DATE-TIME-DATE */
icalvalue* icalvalue_new_datetimedate(struct icaltimetype v);
struct icaltimetype icalvalue_get_datetimedate(icalvalue* value);
void icalvalue_set_datetimedate(icalvalue* value, struct icaltimetype v);
/* DURATION */
icalvalue* icalvalue_new_duration(struct icaldurationtype v);
struct icaldurationtype icalvalue_get_duration(icalvalue* value);
void icalvalue_set_duration(icalvalue* value, struct icaldurationtype v);
/* INTEGER */
icalvalue* icalvalue_new_integer(int v);
int icalvalue_get_integer(icalvalue* value);
void icalvalue_set_integer(icalvalue* value, int v);
/* TIME */
icalvalue* icalvalue_new_time(struct icaltimetype v);
struct icaltimetype icalvalue_get_time(icalvalue* value);
void icalvalue_set_time(icalvalue* value, struct icaltimetype v);
/* URI */
icalvalue* icalvalue_new_uri(const char* v);
const char* icalvalue_get_uri(icalvalue* value);
void icalvalue_set_uri(icalvalue* value, const char* v);
/* ATTACH */
icalvalue* icalvalue_new_attach(struct icalattachtype v);
struct icalattachtype icalvalue_get_attach(icalvalue* value);
void icalvalue_set_attach(icalvalue* value, struct icalattachtype v);
/* CLASS */
icalvalue* icalvalue_new_class(enum icalproperty_class v);
enum icalproperty_class icalvalue_get_class(icalvalue* value);
void icalvalue_set_class(icalvalue* value, enum icalproperty_class v);
/* FLOAT */
icalvalue* icalvalue_new_float(float v);
float icalvalue_get_float(icalvalue* value);
void icalvalue_set_float(icalvalue* value, float v);
/* QUERY */
icalvalue* icalvalue_new_query(const char* v);
const char* icalvalue_get_query(icalvalue* value);
void icalvalue_set_query(icalvalue* value, const char* v);
/* STRING */
icalvalue* icalvalue_new_string(const char* v);
const char* icalvalue_get_string(icalvalue* value);
void icalvalue_set_string(icalvalue* value, const char* v);
/* TRANSP */
icalvalue* icalvalue_new_transp(enum icalproperty_transp v);
enum icalproperty_transp icalvalue_get_transp(icalvalue* value);
void icalvalue_set_transp(icalvalue* value, enum icalproperty_transp v);
/* DATE-TIME */
icalvalue* icalvalue_new_datetime(struct icaltimetype v);
struct icaltimetype icalvalue_get_datetime(icalvalue* value);
void icalvalue_set_datetime(icalvalue* value, struct icaltimetype v);
/* GEO */
icalvalue* icalvalue_new_geo(struct icalgeotype v);
struct icalgeotype icalvalue_get_geo(icalvalue* value);
void icalvalue_set_geo(icalvalue* value, struct icalgeotype v);
/* DATE */
icalvalue* icalvalue_new_date(struct icaltimetype v);
struct icaltimetype icalvalue_get_date(icalvalue* value);
void icalvalue_set_date(icalvalue* value, struct icaltimetype v);
/* ACTION */
icalvalue* icalvalue_new_action(enum icalproperty_action v);
enum icalproperty_action icalvalue_get_action(icalvalue* value);
void icalvalue_set_action(icalvalue* value, enum icalproperty_action v);
#endif /*ICALVALUE_H*/

Просмотреть файл

@ -0,0 +1,58 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalvalue.h
CREATOR: eric 20 March 1999
$Id: icalderivedvalue.h.in,v 1.1 2001-11-15 19:26:55 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalvalue.h
======================================================================*/
#ifndef ICALDERIVEDVALUE_H
#define ICALDERIVEDVALUE_H
#include "icaltypes.h"
#include "icalrecur.h"
#include "icaltime.h"
#include "icalduration.h"
#include "icalperiod.h"
typedef void icalvalue;
void icalvalue_set_x(icalvalue* value, const char* v);
icalvalue* icalvalue_new_x(const char* v);
const char* icalvalue_get_x(icalvalue* value);
icalvalue* icalvalue_new_recur (struct icalrecurrencetype v);
void icalvalue_set_recur(icalvalue* value, struct icalrecurrencetype v);
struct icalrecurrencetype icalvalue_get_recur(icalvalue* value);
icalvalue* icalvalue_new_trigger (struct icaltriggertype v);
void icalvalue_set_trigger(icalvalue* value, struct icaltriggertype v);
struct icaltriggertype icalvalue_get_trigger(icalvalue* value);
icalvalue* icalvalue_new_datetimeperiod (struct icaldatetimeperiodtype v);
void icalvalue_set_datetimeperiod(icalvalue* value, struct icaldatetimeperiodtype v);
struct icaldatetimeperiodtype icalvalue_get_datetimeperiod(icalvalue* value);
/* Everything below this line is machine generated. Do not edit. */

Просмотреть файл

@ -0,0 +1,320 @@
/* -*- Mode: C -*-
======================================================================
FILE: icaltime.c
CREATOR: eric 02 June 2000
$Id: icalduration.c,v 1.2 2001-12-21 18:56:19 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalduration.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef ICAL_NO_LIBICAL
#define icalerror_set_errno(x)
#define icalerror_check_arg_rv(x,y)
#define icalerror_check_arg_re(x,y,z)
#else
#include "icalerror.h"
#include "icalmemory.h"
#endif
/* From Seth Alves, <alves@hungry.com> */
struct icaldurationtype icaldurationtype_from_int(int t)
{
struct icaldurationtype dur;
int used = 0;
dur = icaldurationtype_null_duration();
if(t < 0){
dur.is_neg = 1;
t = -t;
}
dur.weeks = (t - used) / (60 * 60 * 24 * 7);
used += dur.weeks * (60 * 60 * 24 * 7);
dur.days = (t - used) / (60 * 60 * 24);
used += dur.days * (60 * 60 * 24);
dur.hours = (t - used) / (60 * 60);
used += dur.hours * (60 * 60);
dur.minutes = (t - used) / (60);
used += dur.minutes * (60);
dur.seconds = (t - used);
return dur;
}
#ifndef ICAL_NO_LIBICAL
#include "icalvalue.h"
struct icaldurationtype icaldurationtype_from_string(const char* str)
{
int i;
int begin_flag = 0;
int time_flag = 0;
int date_flag = 0;
int week_flag = 0;
int digits=-1;
int scan_size = -1;
int size = strlen(str);
char p;
struct icaldurationtype d;
memset(&d, 0, sizeof(struct icaldurationtype));
for(i=0;i != size;i++){
p = str[i];
switch(p)
{
case '-': {
if(i != 0 || begin_flag == 1) goto error;
d.is_neg = 1;
break;
}
case 'P': {
if (i != 0 && i !=1 ) goto error;
begin_flag = 1;
break;
}
case 'T': {
time_flag = 1;
break;
}
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
{
/* HACK. Skip any more digits if the l;ast one
read has not been assigned */
if(digits != -1){
break;
}
if (begin_flag == 0) goto error;
/* Get all of the digits, not one at a time */
scan_size = sscanf((char*)(str+i),"%d",&digits);
if(scan_size == 0) goto error;
break;
}
case 'H': {
if (time_flag == 0||week_flag == 1||d.hours !=0||digits ==-1)
goto error;
d.hours = digits; digits = -1;
break;
}
case 'M': {
if (time_flag == 0||week_flag==1||d.minutes != 0||digits ==-1)
goto error;
d.minutes = digits; digits = -1;
break;
}
case 'S': {
if (time_flag == 0||week_flag==1||d.seconds!=0||digits ==-1)
goto error;
d.seconds = digits; digits = -1;
break;
}
case 'W': {
if (time_flag==1||date_flag==1||d.weeks!=0||digits ==-1)
goto error;
week_flag = 1;
d.weeks = digits; digits = -1;
break;
}
case 'D': {
if (time_flag==1||week_flag==1||d.days!=0||digits ==-1)
goto error;
date_flag = 1;
d.days = digits; digits = -1;
break;
}
default: {
goto error;
}
}
}
return d;
error:
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
memset(&d, 0, sizeof(struct icaldurationtype));
return d;
}
#define TMP_BUF_SIZE 1024
void append_duration_segment(char** buf, char** buf_ptr, size_t* buf_size,
char* sep, unsigned int value) {
char temp[TMP_BUF_SIZE];
sprintf(temp,"%d",value);
icalmemory_append_string(buf, buf_ptr, buf_size, temp);
icalmemory_append_string(buf, buf_ptr, buf_size, sep);
}
char* icaldurationtype_as_ical_string(struct icaldurationtype d)
{
char *buf, *output_line;
size_t buf_size = 256;
char* buf_ptr = 0;
int seconds;
buf = (char*)icalmemory_new_buffer(buf_size);
buf_ptr = buf;
seconds = icaldurationtype_as_int(d);
if(seconds !=0){
if(d.is_neg == 1){
icalmemory_append_char(&buf, &buf_ptr, &buf_size, '-');
}
icalmemory_append_char(&buf, &buf_ptr, &buf_size, 'P');
if (d.weeks != 0 ) {
append_duration_segment(&buf, &buf_ptr, &buf_size, "W", d.weeks);
}
if (d.days != 0 ) {
append_duration_segment(&buf, &buf_ptr, &buf_size, "D", d.days);
}
if (d.hours != 0 || d.minutes != 0 || d.seconds != 0) {
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "T");
if (d.hours != 0 ) {
append_duration_segment(&buf, &buf_ptr, &buf_size, "H", d.hours);
}
if (d.minutes != 0 ) {
append_duration_segment(&buf, &buf_ptr, &buf_size, "M",
d.minutes);
}
if (d.seconds != 0 ) {
append_duration_segment(&buf, &buf_ptr, &buf_size, "S",
d.seconds);
}
}
} else {
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "PTS0");
}
output_line = icalmemory_tmp_copy(buf);
icalmemory_free_buffer(buf);
return output_line;
}
#endif
/* From Russel Steinthal */
int icaldurationtype_as_int(struct icaldurationtype dur)
{
return (int)( (dur.seconds +
(60 * dur.minutes) +
(60 * 60 * dur.hours) +
(60 * 60 * 24 * dur.days) +
(60 * 60 * 24 * 7 * dur.weeks))
* (dur.is_neg==1? -1 : 1) ) ;
}
struct icaldurationtype icaldurationtype_null_duration()
{
struct icaldurationtype d;
memset(&d,0,sizeof(struct icaldurationtype));
return d;
}
int icaldurationtype_is_null_duration(struct icaldurationtype d)
{
if(icaldurationtype_as_int(d) == 0){
return 1;
} else {
return 0;
}
}
struct icaltimetype icaltime_add(struct icaltimetype t,
struct icaldurationtype d)
{
int dt = icaldurationtype_as_int(d);
t.second += dt;
t = icaltime_normalize(t);
return t;
}
struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
struct icaltimetype t2)
{
time_t t1t = icaltime_as_timet(t1);
time_t t2t = icaltime_as_timet(t2);
return icaldurationtype_from_int(t1t-t2t);
}

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalduration.h
CREATOR: eric 26 Jan 2001
$Id: icalduration.h,v 1.2 2001-12-21 18:56:19 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
#ifndef ICALDURATION_H
#define ICALDURATION_H
#include "icaltime.h"
struct icaldurationtype
{
int is_neg;
unsigned int days;
unsigned int weeks;
unsigned int hours;
unsigned int minutes;
unsigned int seconds;
};
struct icaldurationtype icaldurationtype_from_int(int t);
struct icaldurationtype icaldurationtype_from_string(const char*);
int icaldurationtype_as_int(struct icaldurationtype duration);
char* icaldurationtype_as_ical_string(struct icaldurationtype d);
struct icaldurationtype icaldurationtype_null_duration();
int icaldurationtype_is_null_duration(struct icaldurationtype d);
struct icaltimetype icaltime_add(struct icaltimetype t,
struct icaldurationtype d);
struct icaldurationtype icaltime_subtract(struct icaltimetype t1,
struct icaltimetype t2);
#endif /* !ICALDURATION_H */

Просмотреть файл

@ -0,0 +1,135 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalenum.c
CREATOR: eric 29 April 1999
$Id: icalenums.c,v 1.2 2001-12-21 18:56:19 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalenum.c
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "icalenums.h"
#include <stdio.h> /* For fprintf */
#include <stdio.h> /* For stderr */
#include <string.h> /* For strncmp */
#include <assert.h>
struct {
enum icalrequeststatus kind;
int major;
int minor;
const char* str;
} request_status_map[] = {
{ICAL_2_0_SUCCESS_STATUS, 2,0,"Success."},
{ICAL_2_1_FALLBACK_STATUS, 2,1,"Success but fallback taken on one or more property values."},
{ICAL_2_2_IGPROP_STATUS, 2,2,"Success, invalid property ignored."},
{ICAL_2_3_IGPARAM_STATUS, 2,3,"Success, invalid property parameter ignored."},
{ICAL_2_4_IGXPROP_STATUS, 2,4,"Success, unknown non-standard property ignored."},
{ICAL_2_5_IGXPARAM_STATUS, 2,5,"Success, unknown non standard property value ignored."},
{ICAL_2_6_IGCOMP_STATUS, 2,6,"Success, invalid calendar component ignored."},
{ICAL_2_7_FORWARD_STATUS, 2,7,"Success, request forwarded to Calendar User."},
{ICAL_2_8_ONEEVENT_STATUS, 2,8,"Success, repeating event ignored. Scheduled as a single component."},
{ICAL_2_9_TRUNC_STATUS, 2,9,"Success, truncated end date time to date boundary."},
{ICAL_2_10_ONETODO_STATUS, 2,10,"Success, repeating VTODO ignored. Scheduled as a single VTODO."},
{ICAL_2_11_TRUNCRRULE_STATUS, 2,11,"Success, unbounded RRULE clipped at some finite number of instances "},
{ICAL_3_0_INVPROPNAME_STATUS, 3,0,"Invalid property name."},
{ICAL_3_1_INVPROPVAL_STATUS, 3,1,"Invalid property value."},
{ICAL_3_2_INVPARAM_STATUS, 3,2,"Invalid property parameter."},
{ICAL_3_3_INVPARAMVAL_STATUS, 3,3,"Invalid property parameter value."},
{ICAL_3_4_INVCOMP_STATUS, 3,4,"Invalid calendar component."},
{ICAL_3_5_INVTIME_STATUS, 3,5,"Invalid date or time."},
{ICAL_3_6_INVRULE_STATUS, 3,6,"Invalid rule."},
{ICAL_3_7_INVCU_STATUS, 3,7,"Invalid Calendar User."},
{ICAL_3_8_NOAUTH_STATUS, 3,8,"No authority."},
{ICAL_3_9_BADVERSION_STATUS, 3,9,"Unsupported version."},
{ICAL_3_10_TOOBIG_STATUS, 3,10,"Request entity too large."},
{ICAL_3_11_MISSREQCOMP_STATUS, 3,11,"Required component or property missing."},
{ICAL_3_12_UNKCOMP_STATUS, 3,12,"Unknown component or property found."},
{ICAL_3_13_BADCOMP_STATUS, 3,13,"Unsupported component or property found"},
{ICAL_3_14_NOCAP_STATUS, 3,14,"Unsupported capability."},
{ICAL_4_0_BUSY_STATUS, 4,0,"Event conflict. Date/time is busy."},
{ICAL_5_0_MAYBE_STATUS, 5,0,"Request MAY supported."},
{ICAL_5_1_UNAVAIL_STATUS, 5,1,"Service unavailable."},
{ICAL_5_2_NOSERVICE_STATUS, 5,2,"Invalid calendar service."},
{ICAL_5_3_NOSCHED_STATUS, 5,3,"No scheduling support for user."},
{ICAL_UNKNOWN_STATUS, 0,0,"Error: Unknown request status"}
};
const char* icalenum_reqstat_desc(icalrequeststatus stat)
{
int i;
for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if ( request_status_map[i].kind == stat) {
return request_status_map[i].str;
}
}
return 0;
}
short icalenum_reqstat_major(icalrequeststatus stat)
{
int i;
for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if ( request_status_map[i].kind == stat) {
return request_status_map[i].major;
}
}
return -1;
}
short icalenum_reqstat_minor(icalrequeststatus stat)
{
int i;
for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if ( request_status_map[i].kind == stat) {
return request_status_map[i].minor;
}
}
return -1;
}
icalrequeststatus icalenum_num_to_reqstat(short major, short minor)
{
int i;
for (i=0; request_status_map[i].kind != ICAL_UNKNOWN_STATUS; i++) {
if ( request_status_map[i].major == major && request_status_map[i].minor == minor) {
return request_status_map[i].kind;
}
}
return 0;
}

Просмотреть файл

Просмотреть файл

@ -0,0 +1,194 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalerror.c
CREATOR: eric 16 May 1999
$Id: icalerror.c,v 1.1 2001-11-15 19:26:56 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalerror.c
======================================================================*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "icalerror.h"
icalerrorenum icalerrno;
int foo;
void icalerror_stop_here(void)
{
foo++; /* Keep optimizers from removing routine */
}
void icalerror_crash_here(void)
{
int *p=0;
*p = 1;
assert( *p);
}
void icalerror_clear_errno() {
icalerrno = ICAL_NO_ERROR;
}
#ifdef ICAL_ERRORS_ARE_FATAL
int icalerror_errors_are_fatal = 1;
#else
int icalerror_errors_are_fatal = 0;
#endif
struct icalerror_state {
icalerrorenum error;
icalerrorstate state;
};
struct icalerror_state error_state_map[] =
{
{ ICAL_BADARG_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_NEWFAILED_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_PARSE_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_INTERNAL_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_FILE_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_USAGE_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_UNIMPLEMENTED_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_UNKNOWN_ERROR,ICAL_ERROR_DEFAULT},
{ ICAL_NO_ERROR,ICAL_ERROR_DEFAULT}
};
struct icalerror_string_map {
const char* str;
icalerrorenum error;
char name[160];
};
static struct icalerror_string_map string_map[] =
{
{"BADARG",ICAL_BADARG_ERROR,"BADARG: Bad argument to function"},
{ "NEWFAILED",ICAL_NEWFAILED_ERROR,"NEWFAILED: Failed to create a new object via a *_new() routine"},
{"MALFORMEDDATA",ICAL_MALFORMEDDATA_ERROR,"MALFORMEDDATA: An input string was not correctly formed or a component has missing or extra properties"},
{ "PARSE",ICAL_PARSE_ERROR,"PARSE: Failed to parse a part of an iCal component"},
{"INTERNAL",ICAL_INTERNAL_ERROR,"INTERNAL: Random internal error. This indicates an error in the library code, not an error in use"},
{ "FILE",ICAL_FILE_ERROR,"FILE: An operation on a file failed. Check errno for more detail."},
{ "USAGE",ICAL_USAGE_ERROR,"USAGE: Failed to propertyl sequence calls to a set of interfaces"},
{ "UNIMPLEMENTED",ICAL_UNIMPLEMENTED_ERROR,"UNIMPLEMENTED: This feature has not been implemented"},
{ "NO",ICAL_NO_ERROR,"NO: No error"},
{"UNKNOWN",ICAL_UNKNOWN_ERROR,"UNKNOWN: Unknown error type -- icalerror_strerror() was probably given bad input"}
};
icalerrorenum icalerror_error_from_string(const char* str){
icalerrorenum e;
int i = 0;
for( i = 0; string_map[i].error != ICAL_NO_ERROR; i++){
if (strcmp(string_map[i].str,str) == 0){
e = string_map[i].error;
}
}
return e;
}
icalerrorstate icalerror_supress(const char* error){
icalerrorenum e = icalerror_error_from_string(error);
icalerrorstate es;
if (e == ICAL_NO_ERROR){
return ICAL_ERROR_UNKNOWN;
}
es = icalerror_get_error_state(e);
icalerror_set_error_state(e,ICAL_ERROR_NONFATAL);
return es;
}
char* icalerror_perror()
{
return icalerror_strerror(icalerrno);
}
void icalerror_restore(const char* error, icalerrorstate es){
icalerrorenum e = icalerror_error_from_string(error);
if (e != ICAL_NO_ERROR){
icalerror_set_error_state(e,es);
}
}
void icalerror_set_error_state( icalerrorenum error,
icalerrorstate state)
{
int i;
for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){
if(error_state_map[i].error == error){
error_state_map[i].state = state;
}
}
}
icalerrorstate icalerror_get_error_state( icalerrorenum error)
{
int i;
for(i = ICAL_BADARG_ERROR; error_state_map[i].error!= ICAL_NO_ERROR;i++){
if(error_state_map[i].error == error){
return error_state_map[i].state;
}
}
return ICAL_ERROR_UNKNOWN;
}
char* icalerror_strerror(icalerrorenum e) {
int i;
for (i=0; string_map[i].error != ICAL_UNKNOWN_ERROR; i++) {
if (string_map[i].error == e) {
return string_map[i].name;
}
}
return string_map[i].name; /* Return string for ICAL_UNKNOWN_ERROR*/
}

Просмотреть файл

@ -0,0 +1,153 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalerror.h
CREATOR: eric 09 May 1999
$Id: icalerror.h,v 1.1 2001-11-15 19:26:57 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalerror.h
======================================================================*/
#ifndef ICALERROR_H
#define ICALERROR_H
#include <assert.h>
#include <stdio.h> /* For icalerror_warn() */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
/* This routine is called before any error is triggered. It is called
by icalerror_set_errno, so it does not appear in all of the macros
below */
void icalerror_stop_here(void);
void icalerror_crash_here(void);
typedef enum icalerrorenum {
ICAL_BADARG_ERROR,
ICAL_NEWFAILED_ERROR,
ICAL_ALLOCATION_ERROR,
ICAL_MALFORMEDDATA_ERROR,
ICAL_PARSE_ERROR,
ICAL_INTERNAL_ERROR, /* Like assert --internal consist. prob */
ICAL_FILE_ERROR,
ICAL_USAGE_ERROR,
ICAL_UNIMPLEMENTED_ERROR,
ICAL_UNKNOWN_ERROR, /* Used for problems in input to icalerror_strerror()*/
ICAL_NO_ERROR
} icalerrorenum;
/* The libical error enumeration, like errno*/
extern icalerrorenum icalerrno;
/* If true, libicl aborts after a call to icalerror_set_error*/
extern int icalerror_errors_are_fatal;
/* Warning messages */
#ifdef __GNUC__ca
#define icalerror_warn(message) {fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);}
#else /* __GNU_C__ */
#define icalerror_warn(message) {fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);}
#endif /* __GNU_C__ */
void icalerror_clear_errno(void);
void _icalerror_set_errno(icalerrorenum);
/* Make an individual error fatal or non-fatal. */
typedef enum icalerrorstate {
ICAL_ERROR_FATAL, /* Not fata */
ICAL_ERROR_NONFATAL, /* Fatal */
ICAL_ERROR_DEFAULT, /* Use the value of icalerror_errors_are_fatal*/
ICAL_ERROR_UNKNOWN /* Asked state for an unknown error type */
} icalerrorstate ;
char* icalerror_strerror(icalerrorenum e);
char* icalerror_perror();
void icalerror_set_error_state( icalerrorenum error, icalerrorstate);
icalerrorstate icalerror_get_error_state( icalerrorenum error);
#define icalerror_set_errno(x) \
icalerrno = x; \
if(icalerror_get_error_state(x)==ICAL_ERROR_FATAL || \
(icalerror_get_error_state(x)==ICAL_ERROR_DEFAULT && \
icalerror_errors_are_fatal == 1 )){ \
icalerror_warn(icalerror_strerror(x)); \
assert(0); \
}
#ifdef ICAL_ERRORS_ARE_FATAL
#undef NDEBUG
#endif
#define icalerror_check_value_type(value,type);
#define icalerror_check_property_type(value,type);
#define icalerror_check_parameter_type(value,type);
#define icalerror_check_component_type(value,type);
/* Assert with a message */
#ifdef ICAL_ERRORS_ARE_FATAL
#ifdef __GNUC__
#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s(), %s:%d: %s\n",__FUNCTION__,__FILE__,__LINE__,message);icalerror_stop_here(); abort();}
#else /*__GNUC__*/
#define icalerror_assert(test,message) if(!(test)){fprintf(stderr,"%s:%d: %s\n",__FILE__,__LINE__,message);icalerror_stop_here(); abort();}
#endif /*__GNUC__*/
#else /* ICAL_ERRORS_ARE_FATAL */
#define icalerror_assert(test,message)
#endif /* ICAL_ERRORS_ARE_FATAL */
/* Check & abort if check fails */
#define icalerror_check_arg(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); }
/* Check & return void if check fails*/
#define icalerror_check_arg_rv(test,arg) if(!(test)) {icalerror_set_errno(ICAL_BADARG_ERROR); return; }
/* Check & return 0 if check fails*/
#define icalerror_check_arg_rz(test,arg) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return 0;}
/* Check & return an error if check fails*/
#define icalerror_check_arg_re(test,arg,error) if(!(test)) { icalerror_stop_here(); assert(0); return error;}
/* Check & return something*/
#define icalerror_check_arg_rx(test,arg,x) if(!(test)) { icalerror_set_errno(ICAL_BADARG_ERROR); return x;}
/* String interfaces to set an error to NONFATAL and restore it to its
original value */
icalerrorstate icalerror_supress(const char* error);
void icalerror_restore(const char* error, icalerrorstate es);
#endif /* !ICALERROR_H */

Просмотреть файл

@ -0,0 +1,272 @@
/* -*- Mode: C -*-
======================================================================
FILE: icallangbind.c
CREATOR: eric 15 dec 2000
DESCRIPTION:
$Id: icallangbind.c,v 1.1 2001-11-15 19:26:57 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 1999 Eric Busboom
http://www.softwarestudio.org
This package is free software and is provided "as is" without
express or implied warranty. It may be used, redistributed and/or
modified under the same terms as perl itself. ( Either the Artistic
License or the GPL. )
======================================================================*/
#include "icalcomponent.h"
#include "icalproperty.h"
#include "icalerror.h"
#include "icalmemory.h"
#include <malloc.h>
#include <string.h>
int* icallangbind_new_array(int size){
int* p = (int*)malloc(size*sizeof(int));
return p; /* Caller handles failures */
}
void icallangbind_free_array(int* array){
free(array);
}
int icallangbind_access_array(int* array, int index) {
return array[index];
}
/* LIke icalcomponent_get_first_component, buut takes a string for the
kind and can iterate over X properties as if each X name was a
seperate kind */
icalproperty* icallangbind_get_first_property(icalcomponent *c,
const char* prop)
{
icalproperty_kind kind = icalproperty_string_to_kind(prop);
icalproperty *p;
if (kind == ICAL_NO_PROPERTY){
return 0;
}
if(kind == ICAL_X_PROPERTY){
for(p = icalcomponent_get_first_property(c,kind);
p !=0;
p = icalcomponent_get_next_property(c,kind)){
if(strcmp(icalproperty_get_x_name(p),prop) == 0){
return p;
}
}
} else {
p=icalcomponent_get_first_property(c,kind);
return p;
}
return 0;
}
icalproperty* icallangbind_get_next_property(icalcomponent *c,
const char* prop)
{
icalproperty_kind kind = icalenum_string_to_property_kind(prop);
icalproperty *p;
if (kind == ICAL_NO_PROPERTY){
return 0;
}
if(kind == ICAL_X_PROPERTY){
for(p = icalcomponent_get_next_property(c,kind);
p !=0;
p = icalcomponent_get_next_property(c,kind)){
if(strcmp(icalproperty_get_x_name(p),prop) == 0){
return p;
}
}
} else {
p=icalcomponent_get_next_property(c,kind);
return p;
}
return 0;
}
icalcomponent* icallangbind_get_first_component(icalcomponent *c,
const char* comp)
{
icalcomponent_kind kind = icalenum_string_to_component_kind(comp);
if (kind == ICAL_NO_COMPONENT){
return 0;
}
return icalcomponent_get_first_component(c,kind);
}
icalcomponent* icallangbind_get_next_component(icalcomponent *c,
const char* comp)
{
icalcomponent_kind kind = icalenum_string_to_component_kind(comp);
if (kind == ICAL_NO_COMPONENT){
return 0;
}
return icalcomponent_get_next_component(c,kind);
}
#define APPENDS(x) icalmemory_append_string(&buf, &buf_ptr, &buf_size, x);
#define APPENDC(x) icalmemory_append_char(&buf, &buf_ptr, &buf_size, x);
const char* icallangbind_property_eval_string(icalproperty* prop, char* sep)
{
char tmp[25];
size_t buf_size = 1024;
char* buf = icalmemory_new_buffer(buf_size);
char* buf_ptr = buf;
icalparameter *param;
icalvalue* value;
if( prop == 0){
return 0;
}
APPENDS("{ ");
value = icalproperty_get_value(prop);
APPENDS(" 'name' ");
APPENDS(sep);
APPENDC('\'');
APPENDS(icalenum_property_kind_to_string(icalproperty_isa(prop)));
APPENDC('\'');
if(value){
APPENDS(", 'value_type' ");
APPENDS(sep);
APPENDC('\'');
APPENDS(icalenum_value_kind_to_string(icalvalue_isa(value)));
APPENDC('\'');
}
APPENDS(", 'pid' ");
APPENDS(sep);
APPENDC('\'');
snprintf(tmp,25,"%p",prop);
APPENDS(tmp);
APPENDC('\'');
if(value){
switch (icalvalue_isa(value)){
case ICAL_ATTACH_VALUE:
case ICAL_BINARY_VALUE:
case ICAL_NO_VALUE: {
icalerror_set_errno(ICAL_INTERNAL_ERROR);
break;
}
default:
{
const char* str = icalvalue_as_ical_string(value);
char* copy = (char*) malloc(strlen(str)+1);
const char *i;
char *j;
if(copy ==0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
break;
}
/* Remove any newlines */
for(j=copy, i = str; *i != 0; j++,i++){
if(*i=='\n'){
i++;
}
*j = *i;
}
*j = 0;
APPENDS(", 'value'");
APPENDS(sep);
APPENDC('\'');
APPENDS(copy);
APPENDC('\'');
free(copy);
break;
}
}
}
/* Add Parameters */
for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER);
param != 0;
param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)){
const char* str = icalparameter_as_ical_string(param);
char *copy = icalmemory_tmp_copy(str);
char *v;
if(copy == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
continue;
}
v = strchr(copy,'=');
if(v == 0){
continue;
}
*v = 0;
v++;
APPENDS(", ");
APPENDC('\'');
APPENDS(copy);
APPENDC('\'');
APPENDS(sep);
APPENDC('\'');
APPENDS(v);
APPENDC('\'');
}
APPENDC('}');
icalmemory_add_tmp_buffer(buf);
return buf;
}
#include "fcntl.h"
int icallangbind_string_to_open_flag(const char* str)
{
if (strcmp(str,"r") == 0) {return O_RDONLY;}
else if (strcmp(str,"r+") == 0) {return O_RDWR;}
else if (strcmp(str,"w") == 0) {return O_WRONLY;}
else if (strcmp(str,"a") == 0) {return O_WRONLY|O_APPEND;}
else return -1;
}

Просмотреть файл

@ -0,0 +1,49 @@
/* -*- Mode: C -*-
======================================================================
FILE: icallangbind.h
CREATOR: eric 25 jan 2001
DESCRIPTION:
$Id: icallangbind.h,v 1.2 2001-12-21 18:56:21 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 1999 Eric Busboom
http://www.softwarestudio.org
This package is free software and is provided "as is" without
express or implied warranty. It may be used, redistributed and/or
modified under the same terms as perl itself. ( Either the Artistic
License or the GPL. )
======================================================================*/
#ifndef __ICALLANGBIND_H__
#define __ICALLANGBIND_H__
int* icallangbind_new_array(int size);
void icallangbind_free_array(int* array);
int icallangbind_access_array(int* array, int index);
icalproperty* icallangbind_get_property(icalcomponent *c, int n, const char* prop);
const char* icallangbind_get_property_val(icalproperty* p);
const char* icallangbind_get_parameter(icalproperty *p, const char* parameter);
icalcomponent* icallangbind_get_component(icalcomponent *c, const char* comp);
icalproperty* icallangbind_get_first_property(icalcomponent *c,
const char* prop);
icalproperty* icallangbind_get_next_property(icalcomponent *c,
const char* prop);
icalcomponent* icallangbind_get_first_component(icalcomponent *c,
const char* comp);
icalcomponent* icallangbind_get_next_component(icalcomponent *c,
const char* comp);
const char* icallangbind_property_eval_string(icalproperty* prop, char* sep);
int icallangbind_string_to_open_flag(const char* str);
#endif /*__ICALLANGBIND_H__*/

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,168 @@
%{
/* -*- Mode: C -*-
======================================================================
FILE: icallexer.l
CREATOR: eric 10 June 1999
DESCRIPTION:
$Id: icallexer.l,v 1.1 2001-11-15 19:26:58 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 1999 Eric Busboom
http://www.softwarestudio.org
The contents of this file are subject to the Mozilla Public License
Version 1.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and
limitations under the License.
The original author is Eric Busboom
The original code is icalitip.y
======================================================================*/
#include "icalparser.h"
#include "icalenums.h"
#include "icalmemory.h"
#include "assert.h"
#include "icalyacc.h"
#include <string.h> /* For strdup() */
int icalparser_flex_input(char* buf, int max_size);
void icalparser_clear_flex_input(void);
#define ICAL_MAX_STR_CONST 1024
#undef YY_INPUT
#define YY_INPUT(b,r,ms) ( r= icalparser_flex_input(b,ms))
#undef yywrap
#undef YY_FATAL_ERROR
#define YY_FATAL_ERROR(msg) ical_yyerror(msg)
icalvalue_kind value_kind=ICAL_NO_VALUE;
void set_parser_value_state(icalvalue_kind kind);
extern int yydebug;
void ical_yyerror(char *s);
void init_str_buf(void);
int last_state;
char *str_buf;
char *str_buf_p;
size_t buf_sz; /* = ICAL_MAX_STR_CONST;*/
/* Define routines that were not propertly defined because of the
renaming hack applied in icalyacc.y */
YY_BUFFER_STATE ical_yy_scan_buffer ( char *base, yy_size_t size );
YY_BUFFER_STATE ical_yy_scan_string ( yyconst char *yy_str );
YY_BUFFER_STATE ical_yy_scan_bytes ( yyconst char *bytes, int len );
%}
crlf \x0D?\x0A
space [ ]
qsafechar [^\x00-\x1F\"]
safechar [^\x00-\x1F\"\:\;\,]
tsafechar [\x20-\x21\x23-\x2B\x2D-\x39\x3C-\x5B\x5D-\x7E]
valuechar [^\x00-\x08\x10-\x1F]
xname X-[a-zA-Z0-9\-]+
xname2 [a-zA-Z0-9\-\ ]
paramtext {safechar}+
value {valuechar}+
quotedstring \"{qsafechar}+\"
digit [0-9]
%array /* Make yytext an array. Slow, but handy. HACK */
%option caseless
%s quoted_string
%s binary_value boolean_value uri_value time_value duration_value number_value period_value recur_value text_value utcoffset_value
%s enum_param_value string_param_value stringlist_param_value keyword line_start component seperator parameter end_of_value paramtext
%%
%{
%}
<time_value>{
{digit}+ { ical_yylval.v_string =icalmemory_tmp_copy(yytext) ;
return DIGITS; }
T { return TIME_CHAR; }
Z { return UTC_CHAR; }
[\/\+\-PWHMSD] { return yytext[0]; }
{crlf} { return EOL;}
}
<utcoffset_value>{
{crlf} { return EOL;}
\-|\+ { return yytext[0]; }
{digit}{digit} { ical_yylval.v_int=atoi(yytext); return INTNUMBER; }
}
<enum_param_value>{
. { return CHARACTER; }
{crlf} { return EOL;}
}
<seperator>{
, { BEGIN(last_state); return COMMA; }
}
%%
int yywrap()
{
return 1;
}
void set_parser_value_state(icalvalue_kind kind)
{
switch (kind){
case ICAL_UTCOFFSET_VALUE:
{BEGIN(utcoffset_value);break;}
case ICAL_DATETIMEPERIOD_VALUE:
case ICAL_DURATION_VALUE:
case ICAL_PERIOD_VALUE:
{BEGIN(time_value);break;}
default:
{
assert(1==0);
}
}
}
void init_str_buf(void)
{
str_buf = icalmemory_tmp_buffer(ICAL_MAX_STR_CONST);
str_buf_p = str_buf;
buf_sz = ICAL_MAX_STR_CONST;
}

Просмотреть файл

@ -0,0 +1,287 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalmemory.c
CREATOR: eric 30 June 1999
$Id: icalmemory.c,v 1.1 2001-11-15 19:26:58 mikep%oeone.com Exp $
$Locker: $
The contents of this file are subject to the Mozilla Public License
Version 1.0 (the "License"); you may not use this file except in
compliance with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS"
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and
limitations under the License.
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The Original Code is icalmemory.h
======================================================================*/
/* libical often passes strings back to the caller. To make these
* interfaces simple, I did not want the caller to have to pass in a
* memory buffer, but having libical pass out newly allocated memory
* makes it difficult to de-allocate the memory.
*
* The ring buffer in this scheme makes it possible for libical to pass
* out references to memory which the caller does not own, and be able
* to de-allocate the memory later. The ring allows libical to have
* several buffers active simultaneously, which is handy when creating
* string representations of components. */
#define ICALMEMORY_C
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifdef DMALLOC
#include "dmalloc.h"
#endif
#include "icalmemory.h"
#include "icalerror.h"
#include <stdio.h> /* for printf (debugging) */
#include <stdlib.h> /* for malloc, realloc */
#include <string.h> /* for memset(), strdup */
#define BUFFER_RING_SIZE 25
#define MIN_BUFFER_SIZE 200
void icalmemory_free_tmp_buffer (void* buf);
/* HACK. Not threadsafe */
void* buffer_ring[BUFFER_RING_SIZE];
int buffer_pos = -1;
int initialized = 0;
/* Add an existing buffer to the buffer ring */
void icalmemory_add_tmp_buffer(void* buf)
{
/* I don't think I need this -- I think static arrays are
initialized to 0 as a standard part of C, but I am not sure. */
if (initialized == 0){
int i;
for(i=0; i<BUFFER_RING_SIZE; i++){
buffer_ring[i] = 0;
}
initialized = 1;
}
/* Wrap around the ring */
if(++buffer_pos == BUFFER_RING_SIZE){
buffer_pos = 0;
}
/* Free buffers as their slots are overwritten */
if ( buffer_ring[buffer_pos] != 0){
free( buffer_ring[buffer_pos]);
buffer_ring[buffer_pos] = 0;
}
/* Assign the buffer to a slot */
buffer_ring[buffer_pos] = buf;
}
/* Create a new temporary buffer on the ring. Libical owns these and
wil deallocate them. */
void*
icalmemory_tmp_buffer (size_t size)
{
char *buf;
if (size < MIN_BUFFER_SIZE){
size = MIN_BUFFER_SIZE;
}
buf = (void*)malloc(size);
if( buf == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
memset(buf,0,size);
icalmemory_add_tmp_buffer(buf);
return buf;
}
void icalmemory_free_ring()
{
int i;
for(i=0; i<BUFFER_RING_SIZE; i++){
if ( buffer_ring[i] != 0){
free( buffer_ring[i]);
}
buffer_ring[i] = 0;
}
initialized = 1;
}
/* Like strdup, but the buffer is on the ring. */
char*
icalmemory_tmp_copy(const char* str)
{
char* b = icalmemory_tmp_buffer(strlen(str)+1);
strcpy(b,str);
return b;
}
char* icalmemory_strdup(const char *s)
{
return strdup(s);
}
void
icalmemory_free_tmp_buffer (void* buf)
{
if(buf == 0)
{
return;
}
free(buf);
}
/* These buffer routines create memory the old fashioned way -- so the
caller will have to delocate the new memory */
void* icalmemory_new_buffer(size_t size)
{
void *b = malloc(size);
if( b == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
memset(b,0,size);
return b;
}
void* icalmemory_resize_buffer(void* buf, size_t size)
{
void *b = realloc(buf, size);
if( b == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
return b;
}
void icalmemory_free_buffer(void* buf)
{
free(buf);
}
void
icalmemory_append_string(char** buf, char** pos, size_t* buf_size,
const char* string)
{
char *new_buf;
char *new_pos;
size_t data_length, final_length, string_length;
#ifndef ICAL_NO_INTERNAL_DEBUG
icalerror_check_arg_rv( (buf!=0),"buf");
icalerror_check_arg_rv( (*buf!=0),"*buf");
icalerror_check_arg_rv( (pos!=0),"pos");
icalerror_check_arg_rv( (*pos!=0),"*pos");
icalerror_check_arg_rv( (buf_size!=0),"buf_size");
icalerror_check_arg_rv( (*buf_size!=0),"*buf_size");
icalerror_check_arg_rv( (string!=0),"string");
#endif
string_length = strlen(string);
data_length = (size_t)*pos - (size_t)*buf;
final_length = data_length + string_length;
if ( final_length >= (size_t) *buf_size) {
*buf_size = (*buf_size) * 2 + final_length;
new_buf = realloc(*buf,*buf_size);
new_pos = (void*)((size_t)new_buf + data_length);
*pos = new_pos;
*buf = new_buf;
}
strcpy(*pos, string);
*pos += string_length;
}
void
icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
char ch)
{
char *new_buf;
char *new_pos;
size_t data_length, final_length;
#ifndef ICAL_NO_INTERNAL_DEBUG
icalerror_check_arg_rv( (buf!=0),"buf");
icalerror_check_arg_rv( (*buf!=0),"*buf");
icalerror_check_arg_rv( (pos!=0),"pos");
icalerror_check_arg_rv( (*pos!=0),"*pos");
icalerror_check_arg_rv( (buf_size!=0),"buf_size");
icalerror_check_arg_rv( (*buf_size!=0),"*buf_size");
#endif
data_length = (size_t)*pos - (size_t)*buf;
final_length = data_length + 2;
if ( final_length > (size_t) *buf_size ) {
*buf_size = (*buf_size) * 2 + final_length +1;
new_buf = realloc(*buf,*buf_size);
new_pos = (void*)((size_t)new_buf + data_length);
*pos = new_pos;
*buf = new_buf;
}
**pos = ch;
*pos += 1;
**pos = 0;
}

Просмотреть файл

@ -0,0 +1,80 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalmemory.h
CREATOR: eric 30 June 1999
$Id: icalmemory.h,v 1.1 2001-11-15 19:26:59 mikep%oeone.com Exp $
$Locker: $
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The Initial Developer of the Original Code is Eric Busboom
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
======================================================================*/
#ifndef ICALMEMORY_H
#define ICALMEMORY_H
#include <sys/types.h> /* for size_t */
/* Tmp buffers are managed by ical. References can be returned to the
caller, although the caller will not own the memory. */
void* icalmemory_tmp_buffer(size_t size);
char* icalmemory_tmp_copy(const char* str);
/* Add an externally allocated buffer to the ring. */
void icalmemory_add_tmp_buffer(void*);
/* Free all memory used in the ring */
void icalmemory_free_ring(void);
/* Non-tmp buffers must be freed. These are mostly wrappers around
* malloc, etc, but are used so the caller can change the memory
* allocators in a future version of the library */
void* icalmemory_new_buffer(size_t size);
void* icalmemory_resize_buffer(void* buf, size_t size);
void icalmemory_free_buffer(void* buf);
/* icalmemory_append_string will copy the string 'string' to the
buffer 'buf' starting at position 'pos', reallocing 'buf' if it is
too small. 'buf_size' is the size of 'buf' and will be changed if
'buf' is reallocated. 'pos' will point to the last byte of the new
string in 'buf', usually a '\0' */
/* THESE ROUTINES CAN NOT BE USED ON TMP BUFFERS. Only use them on
normally allocated memory, or on buffers created from
icalmemory_new_buffer, never with buffers created by
icalmemory_tmp_buffer. If icalmemory_append_string has to resize a
buffer on the ring, the ring will loose track of it an you will
have memory problems. */
void icalmemory_append_string(char** buf, char** pos, size_t* buf_size,
const char* string);
/* icalmemory_append_char is similar, but is appends a character instead of a string */
void icalmemory_append_char(char** buf, char** pos, size_t* buf_size,
char ch);
/* A wrapper around strdup. Partly to trap calls to strdup, partly
because in -ansi, gcc on Red Hat claims that strudup is undeclared */
char* icalmemory_strdup(const char *s);
#endif /* !ICALMEMORY_H */

Просмотреть файл

@ -0,0 +1,386 @@
/* -*- Mode: C -*-*/
/*======================================================================
FILE: icalmime.c
CREATOR: eric 26 July 2000
$Id: icalmime.c,v 1.1 2001-11-15 19:26:59 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
#include "icalmime.h"
#include "icalerror.h"
#include "icalmemory.h"
#include "sspm.h"
#include "stdlib.h"
#include <string.h> /* For strdup */
#include <stdio.h> /* for snprintf*/
#ifdef DMALLOC
#include "dmalloc.h"
#endif
/* These *_part routines are called by the MIME parser via the
local_action_map */
struct text_part
{
char* buf;
char* buf_pos;
size_t buf_size;
};
void* icalmime_text_new_part()
{
#define BUF_SIZE 2048
struct text_part* impl;
if ( ( impl = (struct text_part*)
malloc(sizeof(struct text_part))) == 0) {
return 0;
}
impl->buf = icalmemory_new_buffer(BUF_SIZE);
impl->buf_pos = impl->buf;
impl->buf_size = BUF_SIZE;
return impl;
}
void icalmime_text_add_line(void *part,
struct sspm_header *header,
char* line, size_t size)
{
struct text_part* impl = (struct text_part*) part;
icalmemory_append_string(&(impl->buf),&(impl->buf_pos),
&(impl->buf_size),line);
}
void* icalmime_textcalendar_end_part(void* part)
{
struct text_part* impl = (struct text_part*) part;
icalcomponent *c = icalparser_parse_string(impl->buf);
icalmemory_free_buffer(impl->buf);
free(impl);
return c;
}
void* icalmime_text_end_part(void* part)
{
struct text_part* impl = ( struct text_part*) part;
icalmemory_add_tmp_buffer(impl->buf);
free(impl);
return impl->buf;
}
void icalmime_text_free_part(void *part)
{
part = part;
}
/* Ignore Attachments for now */
void* icalmime_attachment_new_part()
{
return 0;
}
void icalmime_attachment_add_line(void *part, struct sspm_header *header,
char* line, size_t size)
{
part = part;
header = header;
line = line;
size = size;
}
void* icalmime_attachment_end_part(void* part)
{
return 0;
}
void icalmime_attachment_free_part(void *part)
{
}
struct sspm_action_map icalmime_local_action_map[] =
{
{SSPM_TEXT_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_text_new_part,icalmime_text_add_line,icalmime_textcalendar_end_part,icalmime_text_free_part},
{SSPM_TEXT_MAJOR_TYPE,SSPM_ANY_MINOR_TYPE,icalmime_text_new_part,icalmime_text_add_line,icalmime_text_end_part,icalmime_text_free_part},
{SSPM_TEXT_MAJOR_TYPE,SSPM_PLAIN_MINOR_TYPE,icalmime_text_new_part,icalmime_text_add_line,icalmime_text_end_part,icalmime_text_free_part},
{SSPM_APPLICATION_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
{SSPM_IMAGE_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
{SSPM_AUDIO_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
{SSPM_IMAGE_MAJOR_TYPE,SSPM_CALENDAR_MINOR_TYPE,icalmime_attachment_new_part,icalmime_attachment_add_line,icalmime_attachment_end_part,icalmime_attachment_free_part},
{SSPM_UNKNOWN_MAJOR_TYPE,SSPM_UNKNOWN_MINOR_TYPE,0,0,0,0}
};
#define NUM_PARTS 100 /* HACK. Hard Limit */
struct sspm_part* icalmime_make_part(icalcomponent* comp)
{
comp = comp;
return 0;
}
char* icalmime_as_mime_string(char* icalcomponent);
icalcomponent* icalmime_parse(char* (*get_string)(char *s, size_t size,
void *d),
void *data)
{
struct sspm_part *parts;
int i, last_level=0;
icalcomponent *root=0, *parent=0, *comp=0, *last = 0;
if ( (parts = (struct sspm_part *)
malloc(NUM_PARTS*sizeof(struct sspm_part)))==0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
memset(parts,0,sizeof(parts));
sspm_parse_mime(parts,
NUM_PARTS, /* Max parts */
icalmime_local_action_map, /* Actions */
get_string,
data, /* data for get_string*/
0 /* First header */);
for(i = 0; i <NUM_PARTS && parts[i].header.major != SSPM_NO_MAJOR_TYPE ; i++){
#define TMPSZ 1024
char mimetype[TMPSZ];
char* major = sspm_major_type_string(parts[i].header.major);
char* minor = sspm_minor_type_string(parts[i].header.minor);
if(parts[i].header.minor == SSPM_UNKNOWN_MINOR_TYPE ){
assert(parts[i].header.minor_text !=0);
minor = parts[i].header.minor_text;
}
sprintf(mimetype,"%s/%s",major,minor);
comp = icalcomponent_new(ICAL_XLICMIMEPART_COMPONENT);
if(comp == 0){
/* HACK Handle Error */
assert(0);
}
if(parts[i].header.error!=SSPM_NO_ERROR){
char *str;
char* temp[256];
if(parts[i].header.error==SSPM_UNEXPECTED_BOUNDARY_ERROR){
str = "Got an unexpected boundary, possibly due to a MIME header for a MULTIPART part that is missing the Content-Type line";
}
if(parts[i].header.error==SSPM_WRONG_BOUNDARY_ERROR){
str = "Got the wrong boundary for the opening of a MULTIPART part.";
}
if(parts[i].header.error==SSPM_NO_BOUNDARY_ERROR){
str = "Got a multipart header that did not specify a boundary";
}
if(parts[i].header.error==SSPM_NO_HEADER_ERROR){
str = "Did not get a header for the part. Is there a blank\
line between the header and the previous boundary\?";
}
if(parts[i].header.error_text != 0){
snprintf((char*)temp,256,
"%s: %s",str,parts[i].header.error_text);
} else {
strcpy((char*)temp,str);
}
icalcomponent_add_property
(comp,
icalproperty_vanew_xlicerror(
(char*)temp,
icalparameter_new_xlicerrortype(
ICAL_XLICERRORTYPE_MIMEPARSEERROR),
0));
}
if(parts[i].header.major != SSPM_NO_MAJOR_TYPE &&
parts[i].header.major != SSPM_UNKNOWN_MAJOR_TYPE){
icalcomponent_add_property(comp,
icalproperty_new_xlicmimecontenttype((char*)
icalmemory_strdup(mimetype)));
}
if (parts[i].header.encoding != SSPM_NO_ENCODING){
icalcomponent_add_property(comp,
icalproperty_new_xlicmimeencoding(
sspm_encoding_string(parts[i].header.encoding)));
}
if (parts[i].header.filename != 0){
icalcomponent_add_property(comp,
icalproperty_new_xlicmimefilename(parts[i].header.filename));
}
if (parts[i].header.content_id != 0){
icalcomponent_add_property(comp,
icalproperty_new_xlicmimecid(parts[i].header.content_id));
}
if (parts[i].header.charset != 0){
icalcomponent_add_property(comp,
icalproperty_new_xlicmimecharset(parts[i].header.charset));
}
/* Add iCal components as children of the component */
if(parts[i].header.major == SSPM_TEXT_MAJOR_TYPE &&
parts[i].header.minor == SSPM_CALENDAR_MINOR_TYPE &&
parts[i].data != 0){
icalcomponent_add_component(comp,
(icalcomponent*)parts[i].data);
parts[i].data = 0;
} else if(parts[i].header.major == SSPM_TEXT_MAJOR_TYPE &&
parts[i].header.minor != SSPM_CALENDAR_MINOR_TYPE &&
parts[i].data != 0){
/* Add other text components as "DESCRIPTION" properties */
icalcomponent_add_property(comp,
icalproperty_new_description(
(char*)icalmemory_strdup((char*)parts[i].data)));
parts[i].data = 0;
}
if(root!= 0 && parts[i].level == 0){
/* We've already assigned the root, but there is another
part at the root level. This is probably a parse
error*/
icalcomponent_free(comp);
continue;
}
if(parts[i].level == last_level && last_level != 0){
icalerror_assert(parent!=0,"No parent for adding component");
icalcomponent_add_component(parent,comp);
} else if (parts[i].level == last_level && last_level == 0 &&
root == 0) {
root = comp;
parent = comp;
} else if (parts[i].level > last_level){
parent = last;
icalcomponent_add_component(parent,comp);
last_level = parts[i].level;
} else if (parts[i].level < last_level){
parent = icalcomponent_get_parent(parent);
icalcomponent_add_component(parent,comp);
last_level = parts[i].level;
} else {
assert(0);
}
last = comp;
last_level = parts[i].level;
assert(parts[i].data == 0);
}
sspm_free_parts(parts,NUM_PARTS);
free(parts);
return root;
}
int icalmime_test(char* (*get_string)(char *s, size_t size, void *d),
void *data)
{
char *out;
struct sspm_part *parts;
int i;
if ( (parts = (struct sspm_part *)
malloc(NUM_PARTS*sizeof(struct sspm_part)))==0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
memset(parts,0,sizeof(parts));
sspm_parse_mime(parts,
NUM_PARTS, /* Max parts */
icalmime_local_action_map, /* Actions */
get_string,
data, /* data for get_string*/
0 /* First header */);
for(i = 0; i <NUM_PARTS && parts[i].header.major != SSPM_NO_MAJOR_TYPE ;
i++){
if(parts[i].header.minor == SSPM_CALENDAR_MINOR_TYPE){
parts[i].data = icalmemory_strdup(
icalcomponent_as_ical_string((icalcomponent*)parts[i].data));
}
}
sspm_write_mime(parts,NUM_PARTS,&out,"To: bob@bob.org");
printf("%s\n",out);
return 0;
}

Просмотреть файл

@ -0,0 +1,43 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalmime.h
CREATOR: eric 26 July 2000
$Id: icalmime.h,v 1.2 2001-12-21 18:56:22 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
======================================================================*/
#ifndef ICALMIME_H
#define ICALMIME_H
#include "icalcomponent.h"
#include "icalparser.h"
icalcomponent* icalmime_parse( char* (*line_gen_func)(char *s, size_t size,
void *d),
void *data);
/* The inverse of icalmime_parse, not implemented yet. Use sspm.h directly. */
char* icalmime_as_mime_string(char* component);
#endif /* !ICALMIME_H */

Просмотреть файл

@ -0,0 +1,382 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalderivedparameters.{c,h}
CREATOR: eric 09 May 1999
$Id: icalparameter.c,v 1.1 2001-11-15 19:27:00 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalderivedparameters.{c,h}
Contributions from:
Graham Davison (g.m.davison@computer.org)
======================================================================*/
/*#line 29 "icalparameter.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalparameter.h"
#include "icalproperty.h"
#include "icalerror.h"
#include "icalmemory.h"
#include "icalparameterimpl.h"
#include <stdlib.h> /* for malloc() */
#include <errno.h>
#include <string.h> /* for memset() */
/* In icalderivedparameter */
icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const char* val);
struct icalparameter_impl* icalparameter_new_impl(icalparameter_kind kind)
{
struct icalparameter_impl* v;
if ( ( v = (struct icalparameter_impl*)
malloc(sizeof(struct icalparameter_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
strcpy(v->id,"para");
v->kind = kind;
v->size = 0;
v->string = 0;
v->x_name = 0;
v->parent = 0;
v->data = 0;
return v;
}
icalparameter*
icalparameter_new (icalparameter_kind kind)
{
struct icalparameter_impl* v = icalparameter_new_impl(kind);
return (icalparameter*) v;
}
void
icalparameter_free (icalparameter* parameter)
{
struct icalparameter_impl * impl;
impl = (struct icalparameter_impl*)parameter;
/* HACK. This always triggers, even when parameter is non-zero
icalerror_check_arg_rv((parameter==0),"parameter");*/
#ifdef ICAL_FREE_ON_LIST_IS_ERROR
icalerror_assert( (impl->parent ==0),"Tried to free a parameter that is still attached to a component. ");
#else
if(impl->parent !=0){
return;
}
#endif
if (impl->string != 0){
free ((void*)impl->string);
}
if (impl->x_name != 0){
free ((void*)impl->x_name);
}
memset(impl,0,sizeof(impl));
impl->parent = 0;
impl->id[0] = 'X';
free(impl);
}
icalparameter*
icalparameter_new_clone(icalparameter* param)
{
struct icalparameter_impl *old;
struct icalparameter_impl *new;
old = (struct icalparameter_impl *)param;
new = icalparameter_new_impl(old->kind);
icalerror_check_arg_rz((param!=0),"param");
if (new == 0){
return 0;
}
memcpy(new,old,sizeof(struct icalparameter_impl));
if (old->string != 0){
new->string = icalmemory_strdup(old->string);
if (new->string == 0){
icalparameter_free(new);
return 0;
}
}
if (old->x_name != 0){
new->x_name = icalmemory_strdup(old->x_name);
if (new->x_name == 0){
icalparameter_free(new);
return 0;
}
}
return new;
}
icalparameter* icalparameter_new_from_string(const char *str)
{
char* eq;
char* cpy;
icalparameter_kind kind;
icalparameter *param;
icalerror_check_arg_rz(str != 0,"str");
cpy = icalmemory_strdup(str);
if (cpy == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
eq = strchr(cpy,'=');
if(eq == 0){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
}
*eq = '\0';
eq++;
kind = icalparameter_string_to_kind(cpy);
if(kind == ICAL_NO_PARAMETER){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
}
param = icalparameter_new_from_value_string(kind,eq);
if(kind == ICAL_X_PARAMETER){
icalparameter_set_xname(param,cpy);
}
free(cpy);
return param;
}
char*
icalparameter_as_ical_string (icalparameter* parameter)
{
struct icalparameter_impl* impl;
size_t buf_size = 1024;
char* buf;
char* buf_ptr;
char *out_buf;
const char *kind_string;
icalerror_check_arg_rz( (parameter!=0), "parameter");
/* Create new buffer that we can append names, parameters and a
value to, and reallocate as needed. Later, this buffer will be
copied to a icalmemory_tmp_buffer, which is managed internally
by libical, so it can be given to the caller without fear of
the caller forgetting to free it */
buf = icalmemory_new_buffer(buf_size);
buf_ptr = buf;
impl = (struct icalparameter_impl*)parameter;
if(impl->kind == ICAL_X_PARAMETER) {
icalmemory_append_string(&buf, &buf_ptr, &buf_size,
icalparameter_get_xname(impl));
} else {
kind_string = icalparameter_kind_to_string(impl->kind);
if (impl->kind == ICAL_NO_PARAMETER ||
impl->kind == ICAL_ANY_PARAMETER ||
kind_string == 0)
{
icalerror_set_errno(ICAL_BADARG_ERROR);
return 0;
}
/* Put the parameter name into the string */
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "=");
if(impl->string !=0){
icalmemory_append_string(&buf, &buf_ptr, &buf_size, impl->string);
} else if (impl->data != 0){
const char* str = icalparameter_enum_to_string(impl->data);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
} else {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
}
/* Now, copy the buffer to a tmp_buffer, which is safe to give to
the caller without worring about de-allocating it. */
out_buf = icalmemory_tmp_buffer(strlen(buf));
strcpy(out_buf, buf);
icalmemory_free_buffer(buf);
return out_buf;
}
int
icalparameter_is_valid (icalparameter* parameter);
icalparameter_kind
icalparameter_isa (icalparameter* parameter)
{
if(parameter == 0){
return ICAL_NO_PARAMETER;
}
return ((struct icalparameter_impl *)parameter)->kind;
}
int
icalparameter_isa_parameter (void* parameter)
{
struct icalparameter_impl *impl = (struct icalparameter_impl *)parameter;
if (parameter == 0){
return 0;
}
if (strcmp(impl->id,"para") == 0) {
return 1;
} else {
return 0;
}
}
void
icalparameter_set_xname (icalparameter* param, const char* v)
{
struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rv( (param!=0),"param");
icalerror_check_arg_rv( (v!=0),"v");
if (impl->x_name != 0){
free((void*)impl->x_name);
}
impl->x_name = icalmemory_strdup(v);
if (impl->x_name == 0){
errno = ENOMEM;
}
}
const char*
icalparameter_get_xname (icalparameter* param)
{
struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rz( (param!=0),"param");
return impl->x_name;
}
void
icalparameter_set_xvalue (icalparameter* param, const char* v)
{
struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rv( (param!=0),"param");
icalerror_check_arg_rv( (v!=0),"v");
if (impl->string != 0){
free((void*)impl->string);
}
impl->string = icalmemory_strdup(v);
if (impl->string == 0){
errno = ENOMEM;
}
}
const char*
icalparameter_get_xvalue (icalparameter* param)
{
struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rz( (param!=0),"param");
return impl->string;
}
void icalparameter_set_parent(icalparameter* param,
icalproperty* property)
{
struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rv( (param!=0),"param");
impl->parent = property;
}
icalproperty* icalparameter_get_parent(icalparameter* param)
{
struct icalparameter_impl *impl = (struct icalparameter_impl*)param;
icalerror_check_arg_rz( (param!=0),"param");
return impl->parent;
}
/* Everything below this line is machine generated. Do not edit. */
/* ALTREP */

Просмотреть файл

@ -0,0 +1,69 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalparam.h
CREATOR: eric 20 March 1999
$Id: icalparameter.h,v 1.2 2001-12-21 18:56:22 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalparam.h
======================================================================*/
#ifndef ICALPARAM_H
#define ICALPARAM_H
#include "icalderivedparameter.h"
/* Declared in icalderivedparameter.h */
/*typedef void icalparameter;*/
icalparameter* icalparameter_new(icalparameter_kind kind);
icalparameter* icalparameter_new_clone(icalparameter* p);
/* Create from string of form "PARAMNAME=VALUE" */
icalparameter* icalparameter_new_from_string(const char* value);
/* Create from just the value, the part after the "=" */
icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind, const char* value);
void icalparameter_free(icalparameter* parameter);
char* icalparameter_as_ical_string(icalparameter* parameter);
int icalparameter_is_valid(icalparameter* parameter);
icalparameter_kind icalparameter_isa(icalparameter* parameter);
int icalparameter_isa_parameter(void* param);
/* Acess the name of an X parameer */
void icalparameter_set_xname (icalparameter* param, const char* v);
const char* icalparameter_get_xname(icalparameter* param);
void icalparameter_set_xvalue (icalparameter* param, const char* v);
const char* icalparameter_get_xvalue(icalparameter* param);
/* Convert enumerations */
const char* icalparameter_kind_to_string(icalparameter_kind kind);
icalparameter_kind icalparameter_string_to_kind(const char* string);
#endif

Просмотреть файл

@ -0,0 +1,52 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalparameterimpl.h
CREATOR: eric 09 May 1999
$Id: icalparameterimpl.h,v 1.2 2001-12-21 18:56:23 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalderivedparameters.{c,h}
Contributions from:
Graham Davison (g.m.davison@computer.org)
======================================================================*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#ifndef ICALPARAMETER_IMPL
#define ICALPARAMETER_IMPL
#include "icalparameter.h"
#include "icalproperty.h"
struct icalparameter_impl
{
icalparameter_kind kind;
char id[5];
int size;
const char* string;
const char* x_name;
icalproperty* parent;
int data;
};
#endif /*ICALPARAMETER_IMPL*/

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,93 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalparser.h
CREATOR: eric 20 April 1999
$Id: icalparser.h,v 1.2 2001-12-21 18:56:23 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalparser.h
======================================================================*/
#ifndef ICALPARSER_H
#define ICALPARSER_H
#include "icalenums.h"
#include "icaltypes.h"
#include"icalcomponent.h"
#include <stdio.h> /* For FILE* */
typedef void* icalparser;
/***********************************************************************
* Line-oriented parsing.
*
* Create a new parser via icalparse_new_parser, then add ines one at
* a time with icalparse_add_line(). icalparser_add_line() will return
* non-zero when it has finished with a component.
***********************************************************************/
typedef enum icalparser_state {
ICALPARSER_ERROR,
ICALPARSER_SUCCESS,
ICALPARSER_BEGIN_COMP,
ICALPARSER_END_COMP,
ICALPARSER_IN_PROGRESS
} icalparser_state;
icalparser* icalparser_new(void);
icalcomponent* icalparser_add_line(icalparser* parser, char* str );
icalcomponent* icalparser_clean(icalparser* parser);
icalparser_state icalparser_get_state(icalparser* parser);
void icalparser_free(icalparser* parser);
/***********************************************************************
* Message oriented parsing. icalparser_parse takes a string that
* holds the text ( in RFC 2445 format ) and returns a pointer to an
* icalcomponent. The caller owns the memory. line_gen_func is a
* pointer to a function that returns one content line per invocation
**********************************************************************/
icalcomponent* icalparser_parse(icalparser *parser,
char* (*line_gen_func)(char *s, size_t size, void *d));
/* Set the data that icalparser_parse will give to the line_gen_func
as the parameter 'd'*/
void icalparser_set_gen_data(icalparser* parser, void* data);
icalcomponent* icalparser_parse_string(const char* str);
/***********************************************************************
* Parser support functions
***********************************************************************/
/* Use the flex/bison parser to turn a string into a value type */
icalvalue* icalparser_parse_value(icalvalue_kind kind,
const char* str, icalcomponent** errors);
/* Given a line generator function, return a single iCal content line.*/
char* icalparser_get_line(icalparser* parser, char* (*line_gen_func)(char *s, size_t size, void *d));
char* string_line_generator(char *out, size_t buf_size, void *d);
#endif /* !ICALPARSE_H */

Просмотреть файл

@ -0,0 +1,170 @@
/* -*- Mode: C -*-
======================================================================
FILE: icalperiod.c
CREATOR: eric 02 June 2000
$Id: icalperiod.c,v 1.1 2001-11-15 19:27:04 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalperiod.h"
#include <assert.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#ifdef ICAL_NO_LIBICAL
#define icalerror_set_errno(x)
#define icalerror_check_arg_rv(x,y)
#define icalerror_check_arg_re(x,y,z)
#else
#include "icalerror.h"
#include "icalmemory.h"
#endif
struct icalperiodtype icalperiodtype_from_string (const char* str)
{
struct icalperiodtype p, null_p;
char *s = icalmemory_strdup(str);
char *start, *end = s;
icalerrorstate es;
/* Errors are normally generated in the following code, so save
the error state for resoration later */
icalerrorenum e = icalerrno;
p.start = p.end = icaltime_null_time();
p.duration = icaldurationtype_from_int(0);
null_p = p;
if(s == 0) goto error;
start = s;
end = strchr(s, '/');
if(end == 0) goto error;
*end = 0;
end++;
p.start = icaltime_from_string(start);
if (icaltime_is_null_time(p.start)) goto error;
es = icalerror_get_error_state(ICAL_MALFORMEDDATA_ERROR);
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,ICAL_ERROR_NONFATAL);
p.end = icaltime_from_string(end);
icalerror_set_error_state(ICAL_MALFORMEDDATA_ERROR,es);
if (icaltime_is_null_time(p.end)){
p.duration = icaldurationtype_from_string(end);
if(icaldurationtype_as_int(p.duration) == 0) goto error;
}
icalerrno = e;
return p;
error:
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return null_p;
}
const char* icalperiodtype_as_ical_string(struct icalperiodtype p)
{
const char* start;
const char* end;
char *buf;
size_t buf_size = 40;
char* buf_ptr = 0;
buf = (char*)icalmemory_new_buffer(buf_size);
buf_ptr = buf;
start = icaltime_as_ical_string(p.start);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, start);
if(!icaltime_is_null_time(p.end)){
end = icaltime_as_ical_string(p.end);
} else {
end = icaldurationtype_as_ical_string(p.duration);
}
icalmemory_append_char(&buf, &buf_ptr, &buf_size, '/');
icalmemory_append_string(&buf, &buf_ptr, &buf_size, end);
return buf;
}
struct icalperiodtype icalperiodtype_null_period() {
struct icalperiodtype p;
p.start = icaltime_null_time();
p.end = icaltime_null_time();
p.duration = icaldurationtype_null_duration();
return p;
}
int icalperiodtype_is_null_period(struct icalperiodtype p){
if(icaltime_is_null_time(p.start) &&
icaltime_is_null_time(p.end) &&
icaldurationtype_is_null_duration(p.duration)){
return 1;
} else {
return 0;
}
}
int icalperiodtype_is_valid_period(struct icalperiodtype p){
if(icaltime_is_valid_time(p.start) &&
(icaltime_is_valid_time(p.end) || icaltime_is_null_time(p.end)) )
{
return 1;
}
return 0;
}

Просмотреть файл

@ -0,0 +1,55 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalperiod.h
CREATOR: eric 26 Jan 2001
$Id: icalperiod.h,v 1.2 2001-12-21 18:56:23 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The Original Code is eric. The Initial Developer of the Original
Code is Eric Busboom
======================================================================*/
#ifndef ICALPERIOD_H
#define ICALPERIOD_H
#include "icaltime.h"
#include "icalduration.h"
struct icalperiodtype
{
struct icaltimetype start;
struct icaltimetype end;
struct icaldurationtype duration;
};
struct icalperiodtype icalperiodtype_from_string (const char* str);
const char* icalperiodtype_as_ical_string(struct icalperiodtype p);
struct icalperiodtype icalperiodtype_null_period();
int icalperiodtype_is_null_period(struct icalperiodtype p);
int icalperiodtype_is_valid_period(struct icalperiodtype p);
#endif /* !ICALTIME_H */

Просмотреть файл

@ -0,0 +1,808 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalproperty.c
CREATOR: eric 28 April 1999
$Id: icalproperty.c,v 1.1 2001-11-15 19:27:07 mikep%oeone.com Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalproperty.c
======================================================================*/
/*#line 27 "icalproperty.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalproperty.h"
#include "icalparameter.h"
#include "icalcomponent.h"
#include "pvl.h"
#include "icalenums.h"
#include "icalerror.h"
#include "icalmemory.h"
#include "icalparser.h"
#include <string.h> /* For icalmemory_strdup, rindex */
#include <assert.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h> /* for printf */
#include <stdarg.h> /* for va_list, va_start, etc. */
#define TMP_BUF_SIZE 1024
/* Private routines for icalproperty */
void icalvalue_set_parent(icalvalue* value,
icalproperty* property);
icalproperty* icalvalue_get_parent(icalvalue* value);
void icalparameter_set_parent(icalparameter* param,
icalproperty* property);
icalproperty* icalparameter_get_parent(icalparameter* value);
void icalproperty_set_x_name(icalproperty* prop, char* name);
struct icalproperty_impl
{
char id[5];
icalproperty_kind kind;
char* x_name;
pvl_list parameters;
pvl_elem parameter_iterator;
icalvalue* value;
icalcomponent *parent;
};
void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args)
{
void* vp;
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
while((vp = va_arg(args, void*)) != 0) {
if (icalvalue_isa_value(vp) != 0 ){
} else if (icalparameter_isa_parameter(vp) != 0 ){
icalproperty_add_parameter((icalproperty*)impl,
(icalparameter*)vp);
} else {
assert(0);
}
}
}
struct icalproperty_impl*
icalproperty_new_impl (icalproperty_kind kind)
{
struct icalproperty_impl* prop;
if ( ( prop = (struct icalproperty_impl*)
malloc(sizeof(struct icalproperty_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
strcpy(prop->id,"prop");
prop->kind = kind;
prop->parameters = pvl_newlist();
prop->parameter_iterator = 0;
prop->value = 0;
prop->x_name = 0;
prop->parent = 0;
return prop;
}
icalproperty*
icalproperty_new (icalproperty_kind kind)
{
if(kind == ICAL_NO_PROPERTY){
return 0;
}
return (icalproperty*)icalproperty_new_impl(kind);
}
icalproperty*
icalproperty_new_clone(icalproperty* prop)
{
struct icalproperty_impl *old = (struct icalproperty_impl*)prop;
struct icalproperty_impl *new = icalproperty_new_impl(old->kind);
pvl_elem p;
icalerror_check_arg_rz((prop!=0),"Prop");
icalerror_check_arg_rz((old!=0),"old");
icalerror_check_arg_rz((new!=0),"new");
if (old->value !=0) {
new->value = icalvalue_new_clone(old->value);
}
if (old->x_name != 0) {
new->x_name = icalmemory_strdup(old->x_name);
if (new->x_name == 0) {
icalproperty_free(new);
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
}
for(p=pvl_head(old->parameters);p != 0; p = pvl_next(p)){
icalparameter *param = icalparameter_new_clone(pvl_data(p));
if (param == 0){
icalproperty_free(new);
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
pvl_push(new->parameters,param);
}
return new;
}
icalproperty* icalproperty_new_from_string(char* str)
{
size_t buf_size = 1024;
char* buf = icalmemory_new_buffer(buf_size);
char* buf_ptr = buf;
icalproperty *prop;
icalcomponent *comp;
int errors = 0;
icalerror_check_arg_rz( (str!=0),"str");
/* Is this a HACK or a crafty reuse of code? */
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "BEGIN:VCALENDAR\n");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "\n");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:VCALENDAR\n");
comp = icalparser_parse_string(buf);
if(comp == 0){
icalerror_set_errno(ICAL_PARSE_ERROR);
return 0;
}
errors = icalcomponent_count_errors(comp);
prop = icalcomponent_get_first_property(comp,ICAL_ANY_PROPERTY);
icalcomponent_remove_property(comp,prop);
icalcomponent_free(comp);
free(buf);
if(errors > 0){
icalproperty_free(prop);
return 0;
} else {
return prop;
}
}
void
icalproperty_free (icalproperty* prop)
{
struct icalproperty_impl *p;
icalparameter* param;
icalerror_check_arg_rv((prop!=0),"prop");
p = (struct icalproperty_impl*)prop;
#ifdef ICAL_FREE_ON_LIST_IS_ERROR
icalerror_assert( (p->parent ==0),"Tried to free a property that is still attached to a component. ");
#else
if(p->parent !=0){
return;
}
#endif
if (p->value != 0){
icalvalue_set_parent(p->value,0);
icalvalue_free(p->value);
}
while( (param = pvl_pop(p->parameters)) != 0){
icalparameter_free(param);
}
pvl_free(p->parameters);
if (p->x_name != 0) {
free(p->x_name);
}
p->kind = ICAL_NO_PROPERTY;
p->parameters = 0;
p->parameter_iterator = 0;
p->value = 0;
p->x_name = 0;
p->id[0] = 'X';
free(p);
}
char*
icalproperty_as_ical_string (icalproperty* prop)
{
icalparameter *param;
/* Create new buffer that we can append names, parameters and a
value to, and reallocate as needed. Later, this buffer will be
copied to a icalmemory_tmp_buffer, which is managed internally
by libical, so it can be given to the caller without fear of
the caller forgetting to free it */
const char* property_name = 0;
size_t buf_size = 1024;
char* buf = icalmemory_new_buffer(buf_size);
char* buf_ptr = buf;
icalvalue* value;
char *out_buf;
char newline[] = "\n";
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
/* Append property name */
if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
property_name = impl->x_name;
} else {
property_name = icalproperty_kind_to_string(impl->kind);
}
if (property_name == 0 ) {
icalerror_warn("Got a property of an unknown kind.");
icalmemory_free_buffer(buf);
return 0;
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
/* Determine what VALUE parameter to include. The VALUE parameters
are ignored in the normal parameter printing ( the block after
this one, so we need to do it here */
{
const char* kind_string = 0;
icalparameter *orig_val_param
= icalproperty_get_first_parameter(prop,ICAL_VALUE_PARAMETER);
icalvalue *value = icalproperty_get_value(impl);
icalvalue_kind orig_kind = ICAL_NO_VALUE;
icalvalue_kind this_kind = ICAL_NO_VALUE;
icalvalue_kind default_kind
= icalproperty_kind_to_value_kind(impl->kind);
if(orig_val_param){
orig_kind = (icalvalue_kind)icalparameter_get_value(orig_val_param);
}
if(value != 0){
this_kind = icalvalue_isa(value);
}
if(this_kind == default_kind &&
orig_kind != ICAL_NO_VALUE){
/* The kind is the default, so it does not need to be
included, but do it anyway, since it was explicit in
the property. But, use the default, not the one
specified in the property */
kind_string = icalvalue_kind_to_string(default_kind);
} else if (this_kind != default_kind && this_kind != ICAL_NO_VALUE){
/* Not the default, so it must be specified */
kind_string = icalvalue_kind_to_string(this_kind);
} else {
/* Don'tinclude the VALUE parameter at all */
}
if(kind_string!=0){
icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "VALUE=");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
}
}
/* Append parameters */
for(param = icalproperty_get_first_parameter(prop,ICAL_ANY_PARAMETER);
param != 0;
param = icalproperty_get_next_parameter(prop,ICAL_ANY_PARAMETER)) {
char* kind_string = icalparameter_as_ical_string(param);
icalparameter_kind kind = icalparameter_isa(param);
if(kind==ICAL_VALUE_PARAMETER){
continue;
}
if (kind_string == 0 ) {
char temp[TMP_BUF_SIZE];
snprintf(temp, TMP_BUF_SIZE,"Got a parameter of unknown kind in %s property",property_name);
icalerror_warn(temp);
continue;
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, " ;");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, kind_string);
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
}
/* Append value */
icalmemory_append_string(&buf, &buf_ptr, &buf_size, " :");
value = icalproperty_get_value(prop);
if (value != 0){
const char *str = icalvalue_as_ical_string(value);
icalerror_assert((str !=0),"Could not get string representation of a value");
icalmemory_append_string(&buf, &buf_ptr, &buf_size, str);
} else {
icalmemory_append_string(&buf, &buf_ptr, &buf_size,"ERROR: No Value");
}
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
/* Now, copy the buffer to a tmp_buffer, which is safe to give to
the caller without worring about de-allocating it. */
out_buf = icalmemory_tmp_buffer(strlen(buf)+1);
strcpy(out_buf, buf);
icalmemory_free_buffer(buf);
return out_buf;
}
icalproperty_kind
icalproperty_isa (icalproperty* property)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)property;
if(property != 0){
return p->kind;
}
return ICAL_NO_PROPERTY;
}
int
icalproperty_isa_property (void* property)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
icalerror_check_arg_rz( (property!=0), "property");
if (strcmp(impl->id,"prop") == 0) {
return 1;
} else {
return 0;
}
}
void
icalproperty_add_parameter (icalproperty* prop,icalparameter* parameter)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv( (prop!=0),"prop");
icalerror_check_arg_rv( (parameter!=0),"parameter");
pvl_push(p->parameters, parameter);
}
void
icalproperty_set_parameter (icalproperty* prop,icalparameter* parameter)
{
icalparameter_kind kind;
icalerror_check_arg_rv( (prop!=0),"prop");
icalerror_check_arg_rv( (parameter!=0),"parameter");
kind = icalparameter_isa(parameter);
icalproperty_remove_parameter(prop,kind);
icalproperty_add_parameter(prop,parameter);
}
void icalproperty_set_parameter_from_string(icalproperty* prop,
const char* name, const char* value)
{
icalparameter_kind kind;
icalparameter *param;
icalerror_check_arg_rv( (prop!=0),"prop");
icalerror_check_arg_rv( (name!=0),"name");
icalerror_check_arg_rv( (value!=0),"value");
kind = icalparameter_string_to_kind(name);
if(kind == ICAL_NO_PARAMETER){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
param = icalparameter_new_from_value_string(kind,value);
if (param == 0){
icalerror_set_errno(ICAL_BADARG_ERROR);
return;
}
icalproperty_set_parameter(prop,param);
}
const char* icalproperty_get_parameter_as_string(icalproperty* prop,
const char* name)
{
icalparameter_kind kind;
icalparameter *param;
char* str;
char* pv;
icalerror_check_arg_rz( (prop!=0),"prop");
icalerror_check_arg_rz( (name!=0),"name");
kind = icalparameter_string_to_kind(name);
if(kind == ICAL_NO_PROPERTY){
/* icalenum_string_to_parameter_kind will set icalerrno */
return 0;
}
param = icalproperty_get_first_parameter(prop,kind);
if (param == 0){
return 0;
}
str = icalparameter_as_ical_string(param);
pv = strchr(str,'=');
if(pv == 0){
icalerror_set_errno(ICAL_INTERNAL_ERROR);
return 0;
}
return pv+1;
}
void
icalproperty_remove_parameter (icalproperty* prop, icalparameter_kind kind)
{
pvl_elem p;
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv((prop!=0),"prop");
for(p=pvl_head(impl->parameters);p != 0; p = pvl_next(p)){
icalparameter* param = (icalparameter *)pvl_data (p);
if (icalparameter_isa(param) == kind) {
pvl_remove (impl->parameters, p);
icalparameter_free (param);
break;
}
}
}
int
icalproperty_count_parameters (icalproperty* prop)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
if(prop != 0){
return pvl_count(p->parameters);
}
icalerror_set_errno(ICAL_USAGE_ERROR);
return -1;
}
icalparameter*
icalproperty_get_first_parameter (icalproperty* prop, icalparameter_kind kind)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
p->parameter_iterator = pvl_head(p->parameters);
if (p->parameter_iterator == 0) {
return 0;
}
for( p->parameter_iterator = pvl_head(p->parameters);
p->parameter_iterator !=0;
p->parameter_iterator = pvl_next(p->parameter_iterator)){
icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
return param;
}
}
return 0;
}
icalparameter*
icalproperty_get_next_parameter (icalproperty* prop, icalparameter_kind kind)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
if (p->parameter_iterator == 0) {
return 0;
}
for( p->parameter_iterator = pvl_next(p->parameter_iterator);
p->parameter_iterator !=0;
p->parameter_iterator = pvl_next(p->parameter_iterator)){
icalparameter *param = (icalparameter*)pvl_data(p->parameter_iterator);
if(icalparameter_isa(param) == kind || kind == ICAL_ANY_PARAMETER){
return param;
}
}
return 0;
}
void
icalproperty_set_value (icalproperty* prop, icalvalue* value)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv((prop !=0),"prop");
icalerror_check_arg_rv((value !=0),"value");
if (p->value != 0){
icalvalue_set_parent(p->value,0);
icalvalue_free(p->value);
p->value = 0;
}
p->value = value;
icalvalue_set_parent(value,prop);
}
void icalproperty_set_value_from_string(icalproperty* prop,const char* str,
const char* type)
{
icalvalue *oval,*nval;
icalvalue_kind kind = ICAL_NO_VALUE;
icalerror_check_arg_rv( (prop!=0),"prop");
icalerror_check_arg_rv( (str!=0),"str");
icalerror_check_arg_rv( (type!=0),"type");
if(strcmp(type,"NO")==0){
/* Get the type from the value the property already has, if it exists */
oval = icalproperty_get_value(prop);
if(oval != 0){
/* Use the existing value kind */
kind = icalvalue_isa(oval);
} else {
/* Use the default kind for the property */
kind = icalproperty_kind_to_value_kind(icalproperty_isa(prop));
}
} else {
/* Use the given kind string */
kind = icalvalue_string_to_kind(type);
}
if(kind == ICAL_NO_VALUE){
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return;
}
nval = icalvalue_new_from_string(kind, str);
if(nval == 0){
/* icalvalue_new_from_string sets errno */
assert(icalerrno != ICAL_NO_ERROR);
return;
}
icalproperty_set_value(prop,nval);
}
icalvalue*
icalproperty_get_value (icalproperty* prop)
{
struct icalproperty_impl *p = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
return p->value;
}
const char* icalproperty_get_value_as_string(icalproperty* prop)
{
icalvalue *value;
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
value = impl->value;
return icalvalue_as_ical_string(value);
}
void icalproperty_set_x_name(icalproperty* prop, char* name)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rv( (name!=0),"name");
icalerror_check_arg_rv( (prop!=0),"prop");
if (impl->x_name != 0) {
free(impl->x_name);
}
impl->x_name = icalmemory_strdup(name);
if(impl->x_name == 0){
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
}
}
char* icalproperty_get_x_name(icalproperty* prop){
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
return impl->x_name;
}
/* From Jonathan Yue <jonathan.yue@cp.net> */
char* icalproperty_get_name (icalproperty* prop)
{
const char* property_name = 0;
size_t buf_size = 256;
char* buf = icalmemory_new_buffer(buf_size);
char* buf_ptr = buf;
struct icalproperty_impl *impl = (struct icalproperty_impl*)prop;
icalerror_check_arg_rz( (prop!=0),"prop");
if (impl->kind == ICAL_X_PROPERTY && impl->x_name != 0){
property_name = impl->x_name;
} else {
property_name = icalproperty_kind_to_string(impl->kind);
}
if (property_name == 0 ) {
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
return 0;
} else {
/* _append_string will automatically grow the buffer if
property_name is longer than the initial buffer size */
icalmemory_append_string(&buf, &buf_ptr, &buf_size, property_name);
}
/* Add the buffer to the temporary buffer ring -- the caller will
not have to free the memory. */
icalmemory_add_tmp_buffer(buf);
return buf;
}
void icalproperty_set_parent(icalproperty* property,
icalcomponent* component)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
icalerror_check_arg_rv( (property!=0),"property");
impl->parent = component;
}
icalcomponent* icalproperty_get_parent(icalproperty* property)
{
struct icalproperty_impl *impl = (struct icalproperty_impl*)property;
icalerror_check_arg_rz( (property!=0),"property");
return impl->parent;
}
/* Everything below this line is machine generated. Do not edit. */

Просмотреть файл

@ -0,0 +1,116 @@
/* -*- Mode: C -*- */
/*======================================================================
FILE: icalproperty.h
CREATOR: eric 20 March 1999
$Id: icalproperty.h,v 1.1 2001-11-15 19:27:08 mikep%oeone.com Exp $
$Locker: $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
it under the terms of either:
The LGPL as published by the Free Software Foundation, version
2.1, available at: http://www.fsf.org/copyleft/lesser.html
Or:
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
The original code is icalparam.h
======================================================================*/
#ifndef ICALPROPERTY_H
#define ICALPROPERTY_H
#include <time.h>
#include "icalderivedparameter.h"
#include "icalvalue.h"
#include "icalrecur.h"
/* Actually in icalderivedproperty.h:
typedef void icalproperty; */
#include "icalderivedproperty.h" /* To get icalproperty_kind enumerations */
icalproperty* icalproperty_new(icalproperty_kind kind);
icalproperty* icalproperty_new_clone(icalproperty * prop);
icalproperty* icalproperty_new_from_string(char* str);
char* icalproperty_as_ical_string(icalproperty* prop);
void icalproperty_free(icalproperty* prop);
icalproperty_kind icalproperty_isa(icalproperty* property);
int icalproperty_isa_property(void* property);
void icalproperty_add_parameter(icalproperty* prop,icalparameter* parameter);
void icalproperty_set_parameter(icalproperty* prop,icalparameter* parameter);
void icalproperty_set_parameter_from_string(icalproperty* prop,
const char* name, const char* value);
const char* icalproperty_get_parameter_as_string(icalproperty* prop,
const char* name);
void icalproperty_remove_parameter(icalproperty* prop,
icalparameter_kind kind);
int icalproperty_count_parameters(icalproperty* prop);
/* Iterate through the parameters */
icalparameter* icalproperty_get_first_parameter(icalproperty* prop,
icalparameter_kind kind);
icalparameter* icalproperty_get_next_parameter(icalproperty* prop,
icalparameter_kind kind);
/* Access the value of the property */
void icalproperty_set_value(icalproperty* prop, icalvalue* value);
void icalproperty_set_value_from_string(icalproperty* prop,const char* value, const char* kind);
icalvalue* icalproperty_get_value(icalproperty* prop);
const char* icalproperty_get_value_as_string(icalproperty* prop);
/* Deal with X properties */
void icalproperty_set_x_name(icalproperty* prop, char* name);
char* icalproperty_get_x_name(icalproperty* prop);
/* Return the name of the property -- the type name converted to a
string, or the value of _get_x_name if the type is and X property */
char* icalproperty_get_name (icalproperty* prop);
icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value);
/* Convert kinds to string and get default value type */
icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind);
icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind);
const char* icalproperty_kind_to_string(icalproperty_kind kind);
icalproperty_kind icalproperty_string_to_kind(const char* string);
icalproperty_method icalproperty_string_to_method(const char* str);
const char* icalproperty_method_to_string(icalproperty_method method);
const char* icalproperty_enum_to_string(int e);
int icalproperty_string_to_enum(const char* str);
const char* icalproperty_status_to_string(icalproperty_status);
icalproperty_status icalproperty_string_to_status(const char* string);
int icalproperty_enum_belongs_to_property(icalproperty_kind kind, int e);
#endif /*ICALPROPERTY_H*/

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,447 @@
/* -*- Mode: C -*- */
/* ======================================================================
File: icalrestriction.c
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
======================================================================*/
/*#line 7 "icalrestriction.c.in"*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include "icalrestriction.h"
#include "icalenums.h"
#include "icalerror.h"
#include <assert.h>
#include <stdio.h> /* For snprintf */
#define TMP_BUF_SIZE 1024
/* Define the structs for the restrictions. these data are filled out
in machine generated code below */
struct icalrestriction_property_record;
typedef char* (*restriction_func)(struct icalrestriction_property_record* rec,icalcomponent* comp,icalproperty* prop);
typedef struct icalrestriction_property_record {
icalproperty_method method;
icalcomponent_kind component;
icalproperty_kind property;
icalrestriction_kind restriction;
restriction_func function;
} icalrestriction_property_record;
typedef struct icalrestriction_component_record {
icalproperty_method method;
icalcomponent_kind component;
icalcomponent_kind subcomponent;
icalrestriction_kind restriction;
restriction_func function;
} icalrestriction_component_record;
icalrestriction_property_record*
icalrestriction_get_property_restriction(icalproperty_method method,
icalcomponent_kind component,
icalproperty_kind property);
icalrestriction_component_record*
icalrestriction_get_component_restriction(icalproperty_method method,
icalcomponent_kind component,
icalcomponent_kind subcomponent);
icalrestriction_component_record icalrestriction_component_records[];
icalrestriction_property_record icalrestriction_property_records[];
icalrestriction_property_record null_prop_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_PROPERTY,ICAL_RESTRICTION_UNKNOWN,0};
icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_UNKNOWN,0};
/* The each row gives the result of comparing a restriction against a
count. The columns in each row represent 0,1,2+. '-1' indicates
'invalid, 'don't care' or 'needs more analysis' So, for
ICAL_RESTRICTION_ONE, if there is 1 of a property with that
restriction, it passes, but if there are 0 or 2+, it fails. */
char compare_map[ICAL_RESTRICTION_UNKNOWN+1][3] = {
{ 1, 1, 1},/*ICAL_RESTRICTION_NONE*/
{ 1, 0, 0},/*ICAL_RESTRICTION_ZERO*/
{ 0, 1, 0},/*ICAL_RESTRICTION_ONE*/
{ 1, 1, 1},/*ICAL_RESTRICTION_ZEROPLUS*/
{ 0, 1, 1},/*ICAL_RESTRICTION_ONEPLUS*/
{ 1, 1, 0},/*ICAL_RESTRICTION_ZEROORONE*/
{ 1, 1, 0},/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
{ 1, 1, 0},/*ICAL_RESTRICTION_ONEMUTUAL*/
{ 1, 1, 1} /*ICAL_RESTRICTION_UNKNOWN*/
};
char restr_string_map[ICAL_RESTRICTION_UNKNOWN+1][60] = {
"unknown number",/*ICAL_RESTRICTION_NONE*/
"0",/*ICAL_RESTRICTION_ZERO*/
"1",/*ICAL_RESTRICTION_ONE*/
"zero or more",/*ICAL_RESTRICTION_ZEROPLUS*/
"one or more" ,/*ICAL_RESTRICTION_ONEPLUS*/
"zero or one",/*ICAL_RESTRICTION_ZEROORONE*/
"zero or one, exclusive with another property",/*ICAL_RESTRICTION_ONEEXCLUSIVE*/
"zero or one, mutual with another property",/*ICAL_RESTRICTION_ONEMUTUAL*/
"unknown number" /*ICAL_RESTRICTION_UNKNOWN*/
};
int
icalrestriction_compare(icalrestriction_kind restr, int count){
if ( restr < ICAL_RESTRICTION_NONE || restr > ICAL_RESTRICTION_UNKNOWN
|| count < 0){
return -1;
}
if (count > 2) {
count = 2;
}
return compare_map[restr][count];
}
/* Special case routines */
char* icalrestriction_may_be_draft_final_canceled(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_DRAFT ||
stat == ICAL_STATUS_FINAL ||
stat == ICAL_STATUS_CANCELLED )){
return "Failed iTIP restrictions for STATUS property. Value must be one of DRAFT, FINAL, or CANCELED";
}
return 0;
}
char* icalrestriction_may_be_comp_need_process(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_COMPLETED ||
stat == ICAL_STATUS_NEEDSACTION ||
stat == ICAL_STATUS_INPROCESS )){
return "Failed iTIP restrictions for STATUS property. Value must be one of COMPLETED, NEEDS-ACTION or IN-PROCESS";
}
return 0;
}
char* icalrestriction_may_be_tent_conf(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_TENTATIVE ||
stat == ICAL_STATUS_CONFIRMED )){
return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE or CONFIRMED";
}
return 0;
}
char* icalrestriction_may_be_tent_conf_cancel(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
icalproperty_status stat = icalproperty_get_status(prop);
if( !( stat == ICAL_STATUS_TENTATIVE ||
stat == ICAL_STATUS_CONFIRMED ||
stat == ICAL_STATUS_CANCELLED )){
return "Failed iTIP restrictions for STATUS property. Value must be one of TENTATIVE, CONFIRMED or CANCELED";
}
return 0;
}
char* icalrestriction_must_be_cancel_if_present(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
/* This routine will not be called if prop == 0 */
icalproperty_status stat = icalproperty_get_status(prop);
if( stat != ICAL_STATUS_CANCELLED)
{
return "Failed iTIP restrictions for STATUS property. Value must be CANCELLED";
}
return 0;
}
char* icalrestriction_must_be_canceled_no_attendee(
icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop)
{
/* Hack. see rfc2446, 3.2.5 CANCEL for porperty STATUS. I don't
understand the note */
return 0;
}
char* icalrestriction_must_be_recurring(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
/* Hack */
return 0;
}
char* icalrestriction_must_have_duration(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
if( !icalcomponent_get_first_property(comp,ICAL_DURATION_PROPERTY)){
return "Failed iTIP restrictions for STATUS property. This component must have a DURATION property";
}
return 0;
}
char* icalrestriction_must_have_repeat(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
if( !icalcomponent_get_first_property(comp,ICAL_REPEAT_PROPERTY)){
return "Failed iTIP restrictions for STATUS property. This component must have a REPEAT property";
}
return 0;
}
char* icalrestriction_must_if_tz_ref(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
/* Hack */
return 0;
}
char* icalrestriction_no_dtend(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
return "Failed iTIP restrictions for STATUS property. The component must not have both DURATION and DTEND";
}
return 0;
}
char* icalrestriction_no_duration(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
/* _no_dtend takes care of this one */
return 0;
}
int icalrestriction_check_component(icalproperty_method method,
icalcomponent* comp)
{
icalproperty_kind kind;
icalcomponent_kind comp_kind;
icalrestriction_kind restr;
icalrestriction_property_record *prop_record;
icalrestriction_component_record *comp_record;
char* funcr = 0;
icalproperty *prop;
int count;
int compare;
int valid = 1;
comp_kind = icalcomponent_isa(comp);
/* Check all of the properties in this component */
for(kind = ICAL_ANY_PROPERTY+1; kind != ICAL_NO_PROPERTY; kind++){
count = icalcomponent_count_properties(comp, kind);
prop_record = icalrestriction_get_property_restriction(method,
comp_kind,
kind);
restr = prop_record->restriction;
if(restr == ICAL_RESTRICTION_ONEEXCLUSIVE ||
restr == ICAL_RESTRICTION_ONEMUTUAL) {
/* First treat is as a 0/1 restriction */
restr = ICAL_RESTRICTION_ZEROORONE;
compare = icalrestriction_compare(restr,count);
} else {
compare = icalrestriction_compare(restr,count);
}
assert(compare != -1);
if (compare == 0){
char temp[TMP_BUF_SIZE];
snprintf(temp, TMP_BUF_SIZE,"Failed iTIP restrictions for %s property. Expected %s instances of the property and got %d",
icalenum_property_kind_to_string(kind),
restr_string_map[restr], count);
icalcomponent_add_property
(comp,
icalproperty_vanew_xlicerror(
temp,
icalparameter_new_xlicerrortype(ICAL_XLICERRORTYPE_INVALIDITIP),
0));
}
prop = icalcomponent_get_first_property(comp, kind);
if (prop != 0 && prop_record->function !=0 ){
funcr = prop_record->function(prop_record,comp,prop);
}
if(funcr !=0){
icalcomponent_add_property
(comp,
icalproperty_vanew_xlicerror(
funcr,
icalparameter_new_xlicerrortype(
ICAL_XLICERRORTYPE_INVALIDITIP),
0));
compare = 0;
}
valid = valid && compare;
}
return valid;
}
int icalrestriction_check(icalcomponent* outer_comp)
{
icalcomponent_kind comp_kind;
icalproperty_method method;
icalcomponent* inner_comp;
icalproperty *method_prop;
int valid;
icalerror_check_arg_rz( (outer_comp!=0), "outer comp");
/* Get the Method value from the outer component */
comp_kind = icalcomponent_isa(outer_comp);
if (comp_kind != ICAL_VCALENDAR_COMPONENT){
icalerror_set_errno(ICAL_BADARG_ERROR);
return 0;
}
method_prop = icalcomponent_get_first_property(outer_comp,
ICAL_METHOD_PROPERTY);
if (method_prop == 0){
method = ICAL_METHOD_NONE;
} else {
method = icalproperty_get_method(method_prop);
}
/* Check the VCALENDAR wrapper */
valid = icalrestriction_check_component(ICAL_METHOD_NONE,outer_comp);
/* Now check the inner components */
for(inner_comp= icalcomponent_get_first_component(outer_comp,
ICAL_ANY_COMPONENT);
inner_comp != 0;
inner_comp= icalcomponent_get_next_component(outer_comp,
ICAL_ANY_COMPONENT)){
valid = valid && icalrestriction_check_component(method,inner_comp);
}
return valid;
}
icalrestriction_property_record*
icalrestriction_get_property_restriction(icalproperty_method method,
icalcomponent_kind component,
icalproperty_kind property)
{
int i;
for(i = 0;
icalrestriction_property_records[i].restriction != ICAL_RESTRICTION_NONE;
i++){
if (method == icalrestriction_property_records[i].method &&
component == icalrestriction_property_records[i].component &&
property == icalrestriction_property_records[i].property ){
return &icalrestriction_property_records[i];
}
}
return &null_prop_record;
}
icalrestriction_component_record*
icalrestriction_get_component_restriction(icalproperty_method method,
icalcomponent_kind component,
icalcomponent_kind subcomponent)
{
int i;
for(i = 0;
icalrestriction_component_records[i].restriction != ICAL_RESTRICTION_NONE;
i++){
if (method == icalrestriction_component_records[i].method &&
component == icalrestriction_component_records[i].component &&
subcomponent == icalrestriction_component_records[i].subcomponent ){
return &icalrestriction_component_records[i];
}
}
return &null_comp_record;
}

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше