--- ./libversit/README.TXT Wed Apr 1 21:18:41 1998 +++ ../gnome-pim-1.4.0/./libversit/README.TXT Sun Sep 23 10:10:12 2001 @@ -1,951 +1,951 @@ -NOTE: If you used the earlier APIs released by Versit -then you will want to look at the document "migrate.doc" -included with this package. It contains a discussion of -the differences between the old API and this one. - ----------------------------------------------------------------- - -The vCard/vCalendar C interface is implemented in the set -of files as follows: - -vcc.y, yacc source, and vcc.c, the yacc output you will use -implements the core parser - -vobject.c implements an API that insulates the caller from -the parser and changes in the vCard/vCalendar BNF - -port.h defines compilation environment dependent stuff - -vcc.h and vobject.h are header files for their .c counterparts - -vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions -which you may find useful. - -test.c is a standalone test driver that exercises some of -the features of the APIs provided. Invoke test.exe on a -VCARD/VCALENDAR input text file and you will see the pretty -print output of the internal representation (this pretty print -output should give you a good idea of how the internal -representation looks like -- there is one such output in the -following too). Also, a file with the .out suffix is generated -to show that the internal representation can be written back -in the original text format. - ------------------------------------------------------------------ - - - VObject for VCard/VCalendar - -Table of Contents -================= -1. VObject -2. Internal Representations of VCard/VCalendar -3. Iterating Through VObject's Properties or Values -4. Pretty Printing a VObject Tree -5. Building A VObject Representation of A VCard/VCalendar -6. Converting A VObject Representation Into Its Textual Representation -7. Miscellaneous Notes On VObject APIs usages -8. Brief descriptions of each APIs -9. Additional Programming Notes. - -This document is mainly about the VObject and its APIs. The main -use of a VObject is to represent a VCard or a VCalendar inside -a program. However, its use is not limited to aforemention as it -can represent an arbitrary information that makes up of a tree or -forest of properties/values. - -1. VObject - ======= -A VObject can have a name (id) and a list of associated properties and -a value. Each property is itself a VObject. - -2. Internal Representations of VCard/VCalendar - =========================================== -A list of VCard or a VCalendar is represented by a list of VObjects. -The name (id) of the VObjects in the list is either VCCardProp or -VCCalProp. Each of these VObjects can have a list of properties. -Since a property is represented as a VObject, each of these properties -can have a name, a list of properties, and a value. - -For example, the input file "vobject.vcf": - -BEGIN:VCARD -N:Alden;Roland -FN:Roland H. Alden -ORG:AT&T;Versit Project Office -TITLE:Consultant -EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com -EMAIL;INTERNET:ralden@sfgate.com -EMAIL;MCIMail:242-2200 -LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= -Suite 2208=0A= -One Pine Street=0A= -San Francisco, CA 94111 -LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= -Suite 2208=0A= -One Pine Street=0A= -San Francisco, CA 94111=0A= -U.S.A. -TEL;WORK;PREF;MSG:+1 415 296 9106 -TEL;WORK;FAX:+1 415 296 9016 -TEL;MSG;CELL:+1 415 608 5981 -ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A. -SOUND:ROW-LAND H ALL-DIN -LOGO;GIF;BASE64: - R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC - QjExMSEhIRAQEO///87v9973/73n95zW71K13jGl1nvG50Kt3iGc1gCMzq3e94zO - 7xCU1nO952O15wAAACwAAAAApgBOAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv - /8CgcEj8QTaeywWTyWCUno2kSK0KI5tLc8vtNi+WiHVMlj0mFK96nalsxOW4fPSw - cNj4tQc+7xcjGh4WExJTJYUTFkp3eU0eEH6RkpOUlTARhRoWm5ydFpCWoS0QEqAu - ARKaHRcVjV0borEoFl0cSre4Sq67FA+yvwAeTU8XHZ7HmxS6u2wVfMCVpAE3pJoW - ylrMptDcOqSF4OHg3eQ5pInInb7lcc86mNbLzBXsZbRfUOn6ucyNHvVWJHCpQFDf - MWwEEzLqx2YCQCqF3OnItClJNmYcJD7cSAKTuI/gtnEcOQKkyVIk6/+ds5CkFcMM - 61LiENikwi1jBnNyuvUSjwWZOS5uIZarqNFcNl32XMMB6I06GgoJ+bZp1ZKeDl8E - +MC1K1cBIhZ4HUu2LAsCZdOWRQDt20lxIlccSHsgrNq7Xc/ixcsWmNu34WKyYJCW - gQjCe9XqTZy2L4pv04gg2sSKSc8OLgTcBSuWsdkVaD2TdXyiQxebFyjo1Gnx6tJm - LuaqrdtZtNfFtruSNmF5IKujwIsmJbjwtRqNJhrcNVw79wcRAgogmE4ArIjQzj/s - JvHAGCFDQR4UqigPK4sBe62XwO51OwADiMcqUG+iOdcFAL+hW20BfAoEexlwAnu6 - mZDAXQ1EVh//WfhxJB5gIbHgwFgOTOiVAgOuVQKAfKFg3weGwSBYFZMp4hpDGKyA - 3lgJKECWgiMQyBVpW+0V4oJjNfhCNkR1IgWEb21QlRK9GdfFCgeOZYBsXgm4noYj - GEBhAQHYh0J8XenoQnFGdrkUciJY6FUAK15ogozakcBhliKsyZWHDMZQ0wWC/Aim - DB6h01KRr/lXQgFxAqDcWDACgCZpUnrVQJtjwTnWjS6MWAYqqfDnSaEkJOlVXQBo - 2pWTMUJ53WgAuPncCR9q6VQMAYjZlXWJmknCoSUM2p4BC+SaKwG88hoZlvfFMM4f - hQh5TXkv+RklWYtC91mopJIAKFkJlDAW/wF25ShnLbeo5gmQ+1FGkJdrKCuCi2OR - BuwHBcwqKgABrMtVAgpem61XkLbAJ7n8uiIpvGVhO4KpH1QLbbpqLheZvQCkGoNL - thSzSTg2UGVBBzbtaxwKsYrmgLvRAlCmWgwMAADD66rKAgR3XlGspcdkZYK8ibU7 - asgEl+XAyB8I7PCqMWiWncGGimpfAgO4ypXSPpOVLwsRCDJxRD2AoyeRRv5kApO5 - fXwzwvfOKLKtaTWtbQxccmGLTZy8xYlVSvXbhbk0M2YzrYfJJ0K8m+V9NgxpyC04 - UycI/aiuiH9Y8NftDUwWp1Wm5UABnAUKwwRsPFGBt4Oc9PZvGvNLwf8JOZt8Arpe - eY23yDovwIDiBX74NAsPVLDJj3Hh4JEExsKcjrlKf9DsCVx3ZfLqAKBuG1s/A90C - z2KjYHjjyPOdG1spz6BBUr+BcUxUb1nDCTa/VZD2Uv+YkLPAKJC9dNEh7628WgqI - ybzlaA+ufxMa6bxC6ciLUQLcx5UGIAAsAkDA6wQkOxrcY39yo4cQMNWCAPTKV1R4 - wPkgaBxzOc8FtMiF1NoGoXBRJjgoPApmPsjCFlbMdzCM4TFy50IXxI2DPcHAv2rY - gghsEIeu8CAPW6ABIPYEFkOsAeaMyIz0JfGJUExBBGRIRX0IMYovWCIT1eBELNpA - i1vcgta8iANPCIQOghzQABl30J0tXqBla4wjFLFQxZzAUY42CIAd5OYBCuKxB2c4 - I0b28EcrQKADgmSKB9RYyDhA4BqCxIBqrtjIMTwoFeCjYSU3KZMQAAA7 - -BEGIN:VCALENDAR -DCREATED:19960523T100522 -PRODID:-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN -VERSION:0.3 -BEGIN:VEVENT -START:19960523T120000 -END:19960523T130000 -SUBTYPE:PHONE CALL -SUMMARY:VERSIT PDI PR Teleconference/Interview -DESCRIPTION:VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland -END:VEVENT -BEGIN:VEVENT -START:19960523T113000 -END:19960523T115500 -SUBTYPE:LUNCH -SUMMARY:Eat in the cafeteria today -END:VEVENT -END:VCALENDAR - -END:VCARD - - -will conceptually be be represented as - vcard - VCNameProp - VCFamilyNameProp=Alden - VCGivenNameProp=Roland - VCFullNameProp=Roland H.Alden - .... - -note that - EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com -will be represented as: - VCEmailAddress=sf!rincon!ralden@alden.attmail.com - VCWork - VCPreferred - VCInternet -where the lower level properties are properties of the property -VCEmailAddress. - -Groupings are flattened out in the VObject representation such -that: - a.b:blah - a.c:blahblah -are represented as: - b=blah - VCGrouping=a - c=blahblah - VCGrouping=a -i.e. one can read the above as: - the property "b" has value "blah" and property "VCGrouping" - with the value "a". - the property "c" has value "blahblah" and property "VCGrouping" - with the value "a". -likewise, multi-level groupings are flatten similarly. e.g. - a.b.c:blah - a.b.e:blahblah ---> - c=blah - VCGrouping=b - VCGrouping=a - e=blahblah - VCGrouping=b - VCGrouping=a -which read: - the property "c" has value "blah" and property "VCGrouping" - with the value "b" which has property "VCGrouping" - with value "a". - the property "e" has value "blahblah" and property "VCGrouping" - with the value "b" which has property "VCGrouping" - with value "a". - -3. Iterating Through VObject's Properties or Values - ================================================ -The following is a skeletal form of iterating through -all properties of a vobject, o: - - // assume the object of interest, o, is of type VObject - VObjectIterator i; - initPropIterator(&i,o); - while (moreIteration(&i)) { - VObject *each = nextVObject(&i); - // ... do something with "each" property - } - -Use the API vObjectName() to access a VObject's name. -Use the API vObjectValueType() to determine if a VObject has - a value. For VCard/VCalendar application, you - should not need this function as practically - all values are either of type VCVT_USTRINGZ or - VCVT_RAW (i.e set by setVObjectUStringZValue and - setVObjectAnyValue APIs respectively), and the - value returned by calls to vObjectUStringZValue - and vObjectAnyValue are 0 if a VObject has no - value. (There is a minor exception where VObject with - VCDataSizeProp has value that is set by - setVObjectLongValue). -Use the APIs vObject???Value() to access a VObject's value. - where ??? is the expected type. -Use the APIs setvObject???Value() to set or modify a VObject's value. - where ??? is the expected type. -Use the API isAPropertyOf() to query if a name match the name of - a property of a VObject. Since isAPropertyOf() return - the matching property, we can use that to retrieve - a property and subsequently the value of the property. - -4. Pretty Printing a VObject Tree - ============================== -VObject tree can be pretty printed with the printVObject() function. -The output of pretty printing a VObject representation of the input -test file "vobject.vcf" is shown below. Note that the indentation -indicates the tree hirerarchy where the immediate children nodes -of a parent node is all at the same indentation level and the -immediate children nodes are the immediate properties of the -associated parent nodes. In the following, {N,FN,ORG,TITLE,...} -are immediate properties of VCARD. {F and G} are properties of N -with value {"Alden" and "Roland"} respectively; FN has no property -but has the value "Roland H. Alden"; EMAIL has value and -the properties WORK, PREF, and INTERNET. - - -VCARD - N - F="Alden" - G="Roland" - FN="Roland H. Alden" - ORG - ORGNAME="AT&T" - OUN="Versit Project Office" - TITLE="Consultant" - EMAIL="sf!rincon!ralden@alden.attmail.com" - WORK - PREF - INTERNET - EMAIL="ralden@sfgate.com" - INTERNET - EMAIL="242-2200" - MCIMail - LABEL="Roland H. Alden - Suite 2208 - One Pine Street - San Francisco, CA 94111" - DOM - POSTAL - PARCEL - HOME - WORK - QP - LABEL="Roland H. Alden - Suite 2208 - One Pine Street - San Francisco, CA 94111 - U.S.A." - POSTAL - PARCEL - HOME - WORK - QP - TEL="+1 415 296 9106" - WORK - PREF - MSG - TEL="+1 415 296 9016" - WORK - FAX - TEL="+1 415 608 5981" - MSG - CELL - ADR - EXT ADD="Suite 2208" - STREET="One Pine Street" - L="San Francisco" - R="CA" - PC="94111" - C="U.S.A." - SOUND="ROW-LAND H ALL-DIN" - LOGO=[raw data] - GIF - BASE64 - DataSize=1482 -VCALENDAR - DCREATED="19960523T100522" - PRODID="-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN" - VERSION="0.3" - VEVENT - START="19960523T120000" - END="19960523T130000" - SUBTYPE="PHONE CALL" - SUMMARY="VERSIT PDI PR Teleconference/Interview" - DESCRIPTION="VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland" - VEVENT - START="19960523T113000" - END="19960523T115500" - SUBTYPE="LUNCH" - SUMMARY="Eat in the cafeteria today" - -5. Building A VObject Representation of A VCard/VCalendar - ====================================================== -The parser in vcc.y converts an input file with one or more -VCard/VCalendar that is in their textual representation -into their corresponding VObject representation. - -VObject representation of a VCard/VCalendar can also be built -directly with calls to the VObject building APIs. e.g. - - VObject *prop; - VObject *vcard = newVObject(VCCardProp); - prop = addProp(vcard,VCNameProp); - addPropValue(prop,VCFamilyNameProp,"Alden"); - addPropValue(prop,VCGivenNameProp,"Roland"); - addPropValue(vcard,VCFullNameProp,"Roland H. Alden"); - .... - -6. Converting A VObject Representation Into Its Textual Representation - =================================================================== -The VObject representation can be converted back to its textual -representation via the call to writeVObject() or writeMemVObject() -API. e.g. - a. to write to a file: - // assume vcard is of type VObject - FILE *fp = fopen("alden.vcf","w"); - writeVObject(fp,vcard); - a. to write to memory, and let the API allocate the required memory. - char* clipboard = writeVObject(0,0,vcard); - ... do something to clipboard - free(clipboard); - b. to write to a user allocated buffer: - char clipboard[16384]; - int len = 16384; - char *buf = writeVObject(clipboard,&len,vcard); - ... buf will be equal to clipboard if the write - is successful otherwise 0. - -In the case of writing to memory, the memory buffer can be either -allocated by the API or the user. If the user allocate the -memory for the buffer, then the length of the buffer needs to be -communicated to the API via a variable. The variable passed as -the length argument will be overwritten with the actual size -of the text output. A 0 return value from writeMemVObject() -indicates an error which could be caused by overflowing the -size of the buffer or lack of heap memory. - -7. Miscellaneous Notes On VObject APIs usages - ========================================== -a. vcc.h -- contains basic interfaces to the parser: - VObject* Parse_MIME(const char *input, unsigned long len); - VObject* Parse_MIME_FromFile(FILE *file); - -- both of this return a null-terminated list of - VObject that is either a VCARD or VCALENDAR. - To iterate through this list, do - VObject *t, *v; - v = Parse_Mime_FromFile(fp); - while (v) { - // ... do something to v. - t = v; - v = nextVObjectInList(v); - cleanVObject(t); - } - note that call to cleanVObject will release - resource used to represent the VObject. - -b. vobject.h -- contains basic interfaces to the VObject APIs. - see the header for more details. - The structure of VObject is purposely (hiddened) not exposed - to the user. Every access has to be done via - the APIs. This way, if we need to change the - structure or implementation, the client need not - recompile as long as the interfaces remain the - same. - -c. values of a property is determined by the property definition - itself. The vobject APIs does not attempt to enforce - any of such definition. It is the consumer responsibility - to know what value is expected from a property. e.g - most properties have unicode string value, so to access - the value of these type of properties, you will use - the vObjectUStringZValue() to read the value and - setVObjectUStringZValue() to set or modify the value. - Refer to the VCard and VCalendar specifications for - the definition of each property. - -d. properties name (id) are case incensitive. - -8. Brief descriptions of each APIs - =============================== - * the predefined properties' names (id) are listed under vobject.h - each is of the form VC*Prop. e.g. - #define VC7bitProp "7BIT" - #define VCAAlarmProp "AALARM" - .... - - * consumer of a VObject can only define pointers to VObject. - - * a variable of type VObjectIterator, say "i", can be used to iterate - through a VObject's properties, say "o". The APIs related to - VObjectIterator are: - void initPropIterator(VObjectIterator *i, VObject *o); - -- e.g. usage - initPropIterator(&i,o); - int moreIteration(VObjectIterator *i); - -- e.g. usage - while (moreIteration(&i)) { ... } - VObject* nextVObject(VObjectIterator *i); - -- e.g. usage - while (moreIteration(&i)) { - VObject *each = nextVObject(&i); - } - - * VObject can be chained together to form a list. e.g. of such - use is in the parser where the return value of the parser is - a link list of VObject. A link list of VObject can be - built by: - void addList(VObject **o, VObject *p); - and iterated by - VObject* nextVObjectInList(VObject *o); - -- next VObjectInList return 0 if the list - is exhausted. - - * the following APIs are mainly used to construct a VObject tree: - VObject* newVObject(const char *id); - -- used extensively internally by VObject APIs but when - used externally, its use is mainly limited to the - construction of top level object (e.g. an object - with VCCardProp or VCCalendarProp id). - - void deleteVObject(VObject *p); - -- to deallocate single VObject, for most user, use - cleanVObject(VObject *o) instead for freeing all - resources associated with the VObject. - - char* dupStr(const char *s, unsigned int size); - -- duplicate a string s. If size is 0, the string is - assume to be a null-terminated. - - void deleteStr(const char *p); - -- used to deallocate a string allocated by dupStr(); - - void setVObjectName(VObject *o, const char* id); - -- set the id of VObject o. This function is not - normally used by the user. The setting of id - is normally done as part of other APIs (e.g. - addProp()). - - void setVObjectStringZValue(VObject *o, const char *s); - -- set a string value of a VObject. - - void setVObjectUStringZValue(VObject *o, const wchar_t *s); - -- set a Unicode string value of a VObject. - - void setVObjectIntegerValue(VObject *o, unsigned int i); - -- set an integer value of a VObject. - - void setVObjectLongValue(VObject *o, unsigned long l); - -- set an long integer value of a VObject. - - void setVObjectAnyValue(VObject *o, void *t); - -- set any value of a VObject. The value type is - unspecified. - - VObject* setValueWithSize(VObject *prop, void *val, unsigned int size); - -- set a raw data (stream of bytes) value of a VObject - whose size is size. The internal VObject representation - is - this object = val - VCDataSizeProp=size - i.e. the value val will be attached to the VObject prop - and a property of VCDataSize whose value is size - is also added to the object. - - void setVObjectVObjectValue(VObject *o, VObject *p); - -- set a VObject as the value of another VObject. - - const char* vObjectName(VObject *o); - -- retrieve the VObject's Name (i.e. id). - - const char* vObjectStringZValue(VObject *o); - -- retrieve the VObject's value interpreted as - null-terminated string. - - const wchar_t* vObjectUStringZValue(VObject *o); - -- retrieve the VObject's value interpreted as - null-terminated unicode string. - - unsigned int vObjectIntegerValue(VObject *o); - -- retrieve the VObject's value interpreted as - integer. - - unsigned long vObjectLongValue(VObject *o); - -- retrieve the VObject's value interpreted as - long integer. - - void* vObjectAnyValue(VObject *o); - -- retrieve the VObject's value interpreted as - any value. - - VObject* vObjectVObjectValue(VObject *o); - -- retrieve the VObject's value interpreted as - a VObject. - - VObject* addVObjectProp(VObject *o, VObject *p); - -- add a VObject p as a property of VObject o. - (not normally used externally for building a - VObject). - - VObject* addProp(VObject *o, const char *id); - -- add a property whose name is id to VObject o. - - VObject* addPropValue(VObject *o, const char *id, const char *v); - -- add a property whose name is id and whose value - is a null-terminated string to VObject o. - - VObject* addPropSizedValue(VObject *o, const char *id, - const char *v, unsigned int size); - -- add a property whose name is id and whose value - is a stream of bytes of size size, to VObject o. - - VObject* addGroup(VObject *o, const char *g); - -- add a group g to VObject o. - e.g. if g is a.b.c, you will have - o - c - VCGroupingProp=b - VCGroupingProp=a - and the object c is returned. - - VObject* isAPropertyOf(VObject *o, const char *id); - -- query if a property by the name id is in o and - return the VObject that represent that property. - - void printVObject(VObject *o); - -- pretty print VObject o to stdout (for debugging use). - - void writeVObject(FILE *fp, VObject *o); - -- convert VObject o to its textual representation and - write it to file. - - char* writeMemVObject(char *s, int *len, VObject *o); - -- convert VObject o to its textual representation and - write it to memory. If s is 0, then memory required - to hold the textual representation will be allocated - by this API. If a variable len is passed, len will - be overwriten with the byte size of the textual - representation. If s is non-zero, then s has to - be a user allocated buffer whose size has be passed - in len as a variable. Memory allocated by the API - has to be freed with call to free. The return value - of this API is either the user supplied buffer, - the memory allocated by the API, or 0 (in case of - failure). - - void cleanStrTbl(); - -- this function has to be called when all - VObject has been destroyed. - - void cleanVObject(VObject *o); - -- release all resources used by VObject o. - - wchar_t* fakeUnicode(const char *ps, int *bytes); - -- convert char* to wchar_t*. - - extern int uStrLen(const wchar_t *u); - -- length of unicode u. - - char *fakeCString(const wchar_t *u); - -- convert wchar_t to CString (blindly assumes that - this could be done). - -9. Additional Programming Notes - ============================ -In the following notes, please refers to the listing -of Example.vcf and its VObject Representation -(shown at the end of this section). - -* Handling the Return Value of the VCard/VCalendar Parser - The example input text file contains two root VObjects - (a VCalendar and a VCard). The output of the VCard/VCalendar - parser is a null-terminated list of VObjects. For this - particular input file, the list will have two VObjects. - The following shows a template for iterating through the - output of the Parser: - - VObject *t, *v; - v = Parse_Mime_fromFileName("example.vcf"); - while (v) { - // currently, v will either be a VCard or a VCalendar - // do whatever your application need to do to - // v here ... - t = v; - v = nextVObjectInList(v); - cleanVObject(t); - } - -* Iterating Through a VCard/VCalendar VObject - From the VObject APIs point of view, a VCard VObject - is the same as a VCalendar VObject. However, the application - needs to know what are in a VCard or a VCalendar. - For example, A VCalendar VObject can have VCDCreatedProp, - a VCGEOLocationProp, etc, and one or more VCEventProp and - or VCTodoProp. The VCEventProp and VCTodoProp can have - many properties of their own, which in turn could have - more properties (e.g. VCDAlarmProp can be a VCEventProp - VObject's property, and VCRunTimeProp can be a - VCDAlarmProp VObject's property. Because a VObject tree - can be arbitrarily complex, in general, to process all - properties and values of a VObject tree, a recursive walk - is desirable. An example recursive VObject tree walk - can be found in the vobject.c source lines for printVObject* - and writeVObject* APIs. Depending on what the application need - to do with a VCard or a VCalendar, a recursive walk - of the VObject tree may or may not be desirable. An example - template of a non-recursive walk is shown below: - - void processVCardVCalendar(char *inputFile) - { - VObject *t, *v; - v = Parse_Mime_fromFileName(inputFile); - while (v) { - char *n = vObjectName(v); - if (strcmp(n,VCCardProp) == 0) { - do_VCard(v); - } - else if (strcmp(n,VCCalendarProp) == 0) { - do_VCalendar(v); - } - else { - // don't know how to handle anything else! - } - t = v; - v = nextVObjectInList(v); - cleanVObject(t); - } - } - - void do_VCard(VObject *vcard) - { - VObjectIterator t; - initPropIterator(&t,vcard); - while (moreIteration(&t)) { - VObject *eachProp = nextVObject(&t); - // The primarly purpose of this example is to - // show how to iterate through a VCard VObject, - // it is not meant to be efficient at all. - char *n = vObjectName(eachProp); - if (strcmp(n,VCNameProp)==0) { - do_name(eachProp); - } - else if (strcmp(n,VCEmailProp)==0) { - do_email(eachProp); - } - else if (strcmp(n,VCLabelProp)==0) { - do_label(eachProp); - } - else if .... - } - } - - void do_VCalendar(VObject *vcal) - { - VObjectIterator t; - initPropIterator(&t,vcard); - while (moreIteration(&t)) { - VObject *eachProp = nextVObject(&t); - // The primarly purpose of this example is to - // show how to iterate through a VCalendar VObject, - // it is not meant to be efficient at all. - char *n = vObjectName(eachProp); - if (strcmp(n,VCDCreatedProp)==0) { - do_DCreated(eachProp); - } - else if (strcmp(n,VCVersionProp)==0) { - do_Version(eachProp); - } - else if (strcmp(n,VCTodoProp)==0) { - do_Todo(eachProp); - } - else if (strcmp(n,VCEventProp)==0) { - do_Event(eachProp); - } - else if .... - } - } - - void do_Todo(VObject *vtodo) { ... } - - void do_Event(VObject *vevent) { ... } - - ... - -* Property's Values and Properties - The VObject APIs do not attempt to check for the - correctness of the values of a property. Nor do they - will prevent the user from attaching a non-VCard/VCalendar - standard property to a VCard/VCalendar property. Take - the example of line [11] of the example, "O.K" is not - a valid value of VCStatusProp. It is up to the application - to accept or reject the value of a property. - -* Output of printVObject - PrintVObject pretty prints a VObject tree in human - readable form. See the listing at the end of the file - for an example output of printVObject on the example - input file "Example.vcf". - - Note that binary data are not shown in the output of - printVObject. Instead, a note is made ([raw data]) to - indicate that there exists such a binary data. - -* Note on Binary Data - When the value of a property is a binary data, it is only - useful to know the size of the binary data. - - In the case of the VCard/VCalendar parser, it chooses - to represent the size information as a separate property - called VCDataSizeProp whose value is the size of the binary - data. The APIs sequence to construct the VObject subtree - of line [44] of Example.vcf is - - // VObject *vcard; - VObject *p1 = addProp(vcard,VCLogoProp); - (void) addProp(p1,VCGIFProp); - (void) addProp(p1,VCBASE64Prop); - VObject *p2 = addProp(p1,VCDataSizeProp); - (void) setVObjectLongValue(p2,1482); - setVObjectAnyValue(vcard,...pointer to binary data); - - Note the presence of VCBase64Prop will cause the - writeVObject API to output the binary data as BASE64 text. - For VCard/VCalendar application, having the VCBase64Prop - property is pratically always neccessary for property with - binary data as its value. - -* Note on Quoted-Printable String - String value with embedded newline are written out as - quoted-prinatable string. It is therefore important - to mark a property with a string value that has - one or more embedded newlines, with the VCQutedPrintableProp - property. e.g. - - // VObject *root; - char *msg="To be\nor\nnot to be"; - VObject *p = addPropValue(root,VCDescriptionProp,msg); - // the following is how you mark a property with - // a property. In this case, the marker is - // VCQuotedPrintableProp - addProp(p,VCQuotedPrintableProp); - -* Note on Unicode - Although, the current parser takes ASCII text file only, - string values are all stored as Unicode in the VObject tree. - For now, when using the VObject APIs to construct a - VObject tree, one should always convert ASCII string value - to a Unicode string value: - - // VObject *root; - VObject *p = addProp(root,VCSomeProp); - setVObjectUStringZValue(p,fakeUnicode(someASCIIStringZvalue)); - - An API is provided to simplify the above process: - - addPropValue(root,VCSomeProp,someASCIIStringZValue); - - Note that someASCIISTringZValue is automatically converted to - Unicode by addPropValue API, where as, the former code - sequence do an explicit call to fakeUnicode. - - To read back the value, one should use the vObjectUStringZValue - API not vObjectStringZValue API. The value returned by the - vObjectUStringZValue API is a Unicode string. If the application - do not know how to handle Unicode string, it can use the - fakeCString API to convert it back to ASCII string (as long - as the conversion is meaningful). - - Note that fakeCString return a heap allocated memory. It is - important to call deleteStr on fakeCString return value if - it is not longer required (or there will be memory leak). - - NOTE: Unfortunately, at the point when this document is written, - there is still no consensus on how Unicode is to be handled - in the textual representation of VCard/VCalendar. So, there - is no version of writeVObject and the parser to output and - input Unicode textual representation of VCard/VCalendar. - - -Example.vcf ------------ -line -number Input Text (example.vcf) ------- ---------- -1 BEGIN:VCALENDAR -2 DCREATED:19961102T100522 -3 GEO:0,0 -4 VERSION:1.0 -5 BEGIN:VEVENT -6 DTSTART:19961103T000000 -7 DTEND:20000101T000000 -8 DESCRIPTION;QUOTED-PRINTABLE:To be =0A= -9 or =0A= -10 not to be -11 STATUS:O.K. -12 X-ACTION:No action required -13 DALARM:19961103T114500;5;3;Enjoy -14 MALARM:19970101T120000;;;johny@nowhere.com;Call Mom. -15 END:VEVENT -16 -17 BEGIN:VTODO -18 DUE:19960614T0173000 -19 DESCRIPTION:Relex. -20 END:VTODO -21 -22 END:VCALENDAR -23 -24 BEGIN:VCARD -25 N:Alden;Roland -26 FN:Roland H. Alden -27 ORG:AT&T;Versit Project Office -28 TITLE:Consultant -29 EMAIL;WORK;PREF;INTERNET:ralden@ralden.com -30 LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= -31 Suite 2208=0A= -32 One Pine Street=0A= -33 San Francisco, CA 94111 -34 LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= -35 Suite 2208=0A= -36 One Pine Street=0A= -37 San Francisco, CA 94111=0A= -38 U.S.A. -39 TEL;WORK;PREF;MSG:+1 415 296 9106 -40 TEL;WORK;FAX:+1 415 296 9016 -41 TEL;MSG;CELL:+1 415 608 5981 -42 ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A. -43 SOUND:ROW-LAND H ALL-DIN -44 LOGO;GIF;BASE64: -45 R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC - ... 30 lines of BASE64 data not shown here. -76 END:VCARD - - -VObject Representation of Example.vcf: -------------------------------------- -line -in -text -file VObject Tree as Printed by printVObject API ----- ------------------------------------------- -1 VCALENDAR -2 DCREATED="19961102T100522" -3 GEO="0,0" -4 VERSION="1.0" -5 VEVENT -6 DTSTART="19961103T000000" -7 DTEND="20000101T000000" -8 DESCRIPTION="To be -9 or -10 not to be" -8 QUOTED-PRINTABLE -11 STATUS="O.K." -12 X-ACTION="No action required" -13 DALARM -13 RUNTIME="19961103T114500" -13 SNOOZETIME="5" -13 REPEATCOUNT="3" -13 DISPLAYSTRING="Enjoy" -14 MALARM -14 RUNTIME="19970101T120000" -14 EMAIL="johny@nowhere.com" -14 NOTE="Call Mom" -17 VTODO -18 DUE="19960614T0173000" -19 DESCRIPTION="Relex." -24 VCARD -25 N -25 F="Alden" -25 G="Roland" -26 FN="Roland H. Alden" -27 ORG -27 ORGNAME="AT&T" -27 OUN="Versit Project Office" -28 TITLE="Consultant" -29 EMAIL="ralden@alden.com" -29 WORK -29 PREF -29 INTERNET -30 LABEL="Roland H. Alden -31 Suite 2208 -32 One Pine Street -33 San Francisco, CA 94111" -30 DOM -30 POSTAL -30 PARCEL -30 HOME -30 WORK -30 QUOTED-PRINTABLE -34 LABEL="Roland H. Alden -35 Suite 2208 -36 One Pine Street -37 San Francisco, CA 94111 -38 U.S.A." -34 POSTAL -34 PARCEL -34 HOME -34 WORK -34 QUOTED-PRINTABLE -39 TEL="+1 415 296 9106" -39 WORK -39 PREF -39 MSG -40 TEL="+1 415 296 9016" -40 WORK -40 FAX -41 TEL="+1 415 608 5981" -41 MSG -41 CELL -42 ADR -42 EXT ADD="Suite 2208" -42 STREET="One Pine Street" -42 L="San Francisco" -42 R="CA" -42 PC="94111" -42 C="U.S.A." -43 SOUND="ROW-LAND H ALL-DIN" -44 LOGO=[raw data] -44 GIF -44 BASE64 -44 DATASIZE=1482 - +NOTE: If you used the earlier APIs released by Versit +then you will want to look at the document "migrate.doc" +included with this package. It contains a discussion of +the differences between the old API and this one. + +---------------------------------------------------------------- + +The vCard/vCalendar C interface is implemented in the set +of files as follows: + +vcc.y, yacc source, and vcc.c, the yacc output you will use +implements the core parser + +vobject.c implements an API that insulates the caller from +the parser and changes in the vCard/vCalendar BNF + +port.h defines compilation environment dependent stuff + +vcc.h and vobject.h are header files for their .c counterparts + +vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions +which you may find useful. + +test.c is a standalone test driver that exercises some of +the features of the APIs provided. Invoke test.exe on a +VCARD/VCALENDAR input text file and you will see the pretty +print output of the internal representation (this pretty print +output should give you a good idea of how the internal +representation looks like -- there is one such output in the +following too). Also, a file with the .out suffix is generated +to show that the internal representation can be written back +in the original text format. + +----------------------------------------------------------------- + + + VObject for VCard/VCalendar + +Table of Contents +================= +1. VObject +2. Internal Representations of VCard/VCalendar +3. Iterating Through VObject's Properties or Values +4. Pretty Printing a VObject Tree +5. Building A VObject Representation of A VCard/VCalendar +6. Converting A VObject Representation Into Its Textual Representation +7. Miscellaneous Notes On VObject APIs usages +8. Brief descriptions of each APIs +9. Additional Programming Notes. + +This document is mainly about the VObject and its APIs. The main +use of a VObject is to represent a VCard or a VCalendar inside +a program. However, its use is not limited to aforemention as it +can represent an arbitrary information that makes up of a tree or +forest of properties/values. + +1. VObject + ======= +A VObject can have a name (id) and a list of associated properties and +a value. Each property is itself a VObject. + +2. Internal Representations of VCard/VCalendar + =========================================== +A list of VCard or a VCalendar is represented by a list of VObjects. +The name (id) of the VObjects in the list is either VCCardProp or +VCCalProp. Each of these VObjects can have a list of properties. +Since a property is represented as a VObject, each of these properties +can have a name, a list of properties, and a value. + +For example, the input file "vobject.vcf": + +BEGIN:VCARD +N:Alden;Roland +FN:Roland H. Alden +ORG:AT&T;Versit Project Office +TITLE:Consultant +EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com +EMAIL;INTERNET:ralden@sfgate.com +EMAIL;MCIMail:242-2200 +LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= +Suite 2208=0A= +One Pine Street=0A= +San Francisco, CA 94111 +LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= +Suite 2208=0A= +One Pine Street=0A= +San Francisco, CA 94111=0A= +U.S.A. +TEL;WORK;PREF;MSG:+1 415 296 9106 +TEL;WORK;FAX:+1 415 296 9016 +TEL;MSG;CELL:+1 415 608 5981 +ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A. +SOUND:ROW-LAND H ALL-DIN +LOGO;GIF;BASE64: + R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC + QjExMSEhIRAQEO///87v9973/73n95zW71K13jGl1nvG50Kt3iGc1gCMzq3e94zO + 7xCU1nO952O15wAAACwAAAAApgBOAAAF/yAgjmRpnmiqrmzrvnAsz3Rt33iu73zv + /8CgcEj8QTaeywWTyWCUno2kSK0KI5tLc8vtNi+WiHVMlj0mFK96nalsxOW4fPSw + cNj4tQc+7xcjGh4WExJTJYUTFkp3eU0eEH6RkpOUlTARhRoWm5ydFpCWoS0QEqAu + ARKaHRcVjV0borEoFl0cSre4Sq67FA+yvwAeTU8XHZ7HmxS6u2wVfMCVpAE3pJoW + ylrMptDcOqSF4OHg3eQ5pInInb7lcc86mNbLzBXsZbRfUOn6ucyNHvVWJHCpQFDf + MWwEEzLqx2YCQCqF3OnItClJNmYcJD7cSAKTuI/gtnEcOQKkyVIk6/+ds5CkFcMM + 61LiENikwi1jBnNyuvUSjwWZOS5uIZarqNFcNl32XMMB6I06GgoJ+bZp1ZKeDl8E + +MC1K1cBIhZ4HUu2LAsCZdOWRQDt20lxIlccSHsgrNq7Xc/ixcsWmNu34WKyYJCW + gQjCe9XqTZy2L4pv04gg2sSKSc8OLgTcBSuWsdkVaD2TdXyiQxebFyjo1Gnx6tJm + LuaqrdtZtNfFtruSNmF5IKujwIsmJbjwtRqNJhrcNVw79wcRAgogmE4ArIjQzj/s + JvHAGCFDQR4UqigPK4sBe62XwO51OwADiMcqUG+iOdcFAL+hW20BfAoEexlwAnu6 + mZDAXQ1EVh//WfhxJB5gIbHgwFgOTOiVAgOuVQKAfKFg3weGwSBYFZMp4hpDGKyA + 3lgJKECWgiMQyBVpW+0V4oJjNfhCNkR1IgWEb21QlRK9GdfFCgeOZYBsXgm4noYj + GEBhAQHYh0J8XenoQnFGdrkUciJY6FUAK15ogozakcBhliKsyZWHDMZQ0wWC/Aim + DB6h01KRr/lXQgFxAqDcWDACgCZpUnrVQJtjwTnWjS6MWAYqqfDnSaEkJOlVXQBo + 2pWTMUJ53WgAuPncCR9q6VQMAYjZlXWJmknCoSUM2p4BC+SaKwG88hoZlvfFMM4f + hQh5TXkv+RklWYtC91mopJIAKFkJlDAW/wF25ShnLbeo5gmQ+1FGkJdrKCuCi2OR + BuwHBcwqKgABrMtVAgpem61XkLbAJ7n8uiIpvGVhO4KpH1QLbbpqLheZvQCkGoNL + thSzSTg2UGVBBzbtaxwKsYrmgLvRAlCmWgwMAADD66rKAgR3XlGspcdkZYK8ibU7 + asgEl+XAyB8I7PCqMWiWncGGimpfAgO4ypXSPpOVLwsRCDJxRD2AoyeRRv5kApO5 + fXwzwvfOKLKtaTWtbQxccmGLTZy8xYlVSvXbhbk0M2YzrYfJJ0K8m+V9NgxpyC04 + UycI/aiuiH9Y8NftDUwWp1Wm5UABnAUKwwRsPFGBt4Oc9PZvGvNLwf8JOZt8Arpe + eY23yDovwIDiBX74NAsPVLDJj3Hh4JEExsKcjrlKf9DsCVx3ZfLqAKBuG1s/A90C + z2KjYHjjyPOdG1spz6BBUr+BcUxUb1nDCTa/VZD2Uv+YkLPAKJC9dNEh7628WgqI + ybzlaA+ufxMa6bxC6ciLUQLcx5UGIAAsAkDA6wQkOxrcY39yo4cQMNWCAPTKV1R4 + wPkgaBxzOc8FtMiF1NoGoXBRJjgoPApmPsjCFlbMdzCM4TFy50IXxI2DPcHAv2rY + gghsEIeu8CAPW6ABIPYEFkOsAeaMyIz0JfGJUExBBGRIRX0IMYovWCIT1eBELNpA + i1vcgta8iANPCIQOghzQABl30J0tXqBla4wjFLFQxZzAUY42CIAd5OYBCuKxB2c4 + I0b28EcrQKADgmSKB9RYyDhA4BqCxIBqrtjIMTwoFeCjYSU3KZMQAAA7 + +BEGIN:VCALENDAR +DCREATED:19960523T100522 +PRODID:-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN +VERSION:0.3 +BEGIN:VEVENT +START:19960523T120000 +END:19960523T130000 +SUBTYPE:PHONE CALL +SUMMARY:VERSIT PDI PR Teleconference/Interview +DESCRIPTION:VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland +END:VEVENT +BEGIN:VEVENT +START:19960523T113000 +END:19960523T115500 +SUBTYPE:LUNCH +SUMMARY:Eat in the cafeteria today +END:VEVENT +END:VCALENDAR + +END:VCARD + + +will conceptually be be represented as + vcard + VCNameProp + VCFamilyNameProp=Alden + VCGivenNameProp=Roland + VCFullNameProp=Roland H.Alden + .... + +note that + EMAIL;WORK;PREF;INTERNET:sf!rincon!ralden@alden.attmail.com +will be represented as: + VCEmailAddress=sf!rincon!ralden@alden.attmail.com + VCWork + VCPreferred + VCInternet +where the lower level properties are properties of the property +VCEmailAddress. + +Groupings are flattened out in the VObject representation such +that: + a.b:blah + a.c:blahblah +are represented as: + b=blah + VCGrouping=a + c=blahblah + VCGrouping=a +i.e. one can read the above as: + the property "b" has value "blah" and property "VCGrouping" + with the value "a". + the property "c" has value "blahblah" and property "VCGrouping" + with the value "a". +likewise, multi-level groupings are flatten similarly. e.g. + a.b.c:blah + a.b.e:blahblah +--> + c=blah + VCGrouping=b + VCGrouping=a + e=blahblah + VCGrouping=b + VCGrouping=a +which read: + the property "c" has value "blah" and property "VCGrouping" + with the value "b" which has property "VCGrouping" + with value "a". + the property "e" has value "blahblah" and property "VCGrouping" + with the value "b" which has property "VCGrouping" + with value "a". + +3. Iterating Through VObject's Properties or Values + ================================================ +The following is a skeletal form of iterating through +all properties of a vobject, o: + + // assume the object of interest, o, is of type VObject + VObjectIterator i; + initPropIterator(&i,o); + while (moreIteration(&i)) { + VObject *each = nextVObject(&i); + // ... do something with "each" property + } + +Use the API vObjectName() to access a VObject's name. +Use the API vObjectValueType() to determine if a VObject has + a value. For VCard/VCalendar application, you + should not need this function as practically + all values are either of type VCVT_USTRINGZ or + VCVT_RAW (i.e set by setVObjectUStringZValue and + setVObjectAnyValue APIs respectively), and the + value returned by calls to vObjectUStringZValue + and vObjectAnyValue are 0 if a VObject has no + value. (There is a minor exception where VObject with + VCDataSizeProp has value that is set by + setVObjectLongValue). +Use the APIs vObject???Value() to access a VObject's value. + where ??? is the expected type. +Use the APIs setvObject???Value() to set or modify a VObject's value. + where ??? is the expected type. +Use the API isAPropertyOf() to query if a name match the name of + a property of a VObject. Since isAPropertyOf() return + the matching property, we can use that to retrieve + a property and subsequently the value of the property. + +4. Pretty Printing a VObject Tree + ============================== +VObject tree can be pretty printed with the printVObject() function. +The output of pretty printing a VObject representation of the input +test file "vobject.vcf" is shown below. Note that the indentation +indicates the tree hirerarchy where the immediate children nodes +of a parent node is all at the same indentation level and the +immediate children nodes are the immediate properties of the +associated parent nodes. In the following, {N,FN,ORG,TITLE,...} +are immediate properties of VCARD. {F and G} are properties of N +with value {"Alden" and "Roland"} respectively; FN has no property +but has the value "Roland H. Alden"; EMAIL has value and +the properties WORK, PREF, and INTERNET. + + +VCARD + N + F="Alden" + G="Roland" + FN="Roland H. Alden" + ORG + ORGNAME="AT&T" + OUN="Versit Project Office" + TITLE="Consultant" + EMAIL="sf!rincon!ralden@alden.attmail.com" + WORK + PREF + INTERNET + EMAIL="ralden@sfgate.com" + INTERNET + EMAIL="242-2200" + MCIMail + LABEL="Roland H. Alden + Suite 2208 + One Pine Street + San Francisco, CA 94111" + DOM + POSTAL + PARCEL + HOME + WORK + QP + LABEL="Roland H. Alden + Suite 2208 + One Pine Street + San Francisco, CA 94111 + U.S.A." + POSTAL + PARCEL + HOME + WORK + QP + TEL="+1 415 296 9106" + WORK + PREF + MSG + TEL="+1 415 296 9016" + WORK + FAX + TEL="+1 415 608 5981" + MSG + CELL + ADR + EXT ADD="Suite 2208" + STREET="One Pine Street" + L="San Francisco" + R="CA" + PC="94111" + C="U.S.A." + SOUND="ROW-LAND H ALL-DIN" + LOGO=[raw data] + GIF + BASE64 + DataSize=1482 +VCALENDAR + DCREATED="19960523T100522" + PRODID="-//Alden Roland/Hand Crafted In North Carolina//NONSGML Made By Hand//EN" + VERSION="0.3" + VEVENT + START="19960523T120000" + END="19960523T130000" + SUBTYPE="PHONE CALL" + SUMMARY="VERSIT PDI PR Teleconference/Interview" + DESCRIPTION="VERSIT PDI PR Teleconference/Interview With Tom Streeter and Alden Roland" + VEVENT + START="19960523T113000" + END="19960523T115500" + SUBTYPE="LUNCH" + SUMMARY="Eat in the cafeteria today" + +5. Building A VObject Representation of A VCard/VCalendar + ====================================================== +The parser in vcc.y converts an input file with one or more +VCard/VCalendar that is in their textual representation +into their corresponding VObject representation. + +VObject representation of a VCard/VCalendar can also be built +directly with calls to the VObject building APIs. e.g. + + VObject *prop; + VObject *vcard = newVObject(VCCardProp); + prop = addProp(vcard,VCNameProp); + addPropValue(prop,VCFamilyNameProp,"Alden"); + addPropValue(prop,VCGivenNameProp,"Roland"); + addPropValue(vcard,VCFullNameProp,"Roland H. Alden"); + .... + +6. Converting A VObject Representation Into Its Textual Representation + =================================================================== +The VObject representation can be converted back to its textual +representation via the call to writeVObject() or writeMemVObject() +API. e.g. + a. to write to a file: + // assume vcard is of type VObject + FILE *fp = fopen("alden.vcf","w"); + writeVObject(fp,vcard); + a. to write to memory, and let the API allocate the required memory. + char* clipboard = writeVObject(0,0,vcard); + ... do something to clipboard + free(clipboard); + b. to write to a user allocated buffer: + char clipboard[16384]; + int len = 16384; + char *buf = writeVObject(clipboard,&len,vcard); + ... buf will be equal to clipboard if the write + is successful otherwise 0. + +In the case of writing to memory, the memory buffer can be either +allocated by the API or the user. If the user allocate the +memory for the buffer, then the length of the buffer needs to be +communicated to the API via a variable. The variable passed as +the length argument will be overwritten with the actual size +of the text output. A 0 return value from writeMemVObject() +indicates an error which could be caused by overflowing the +size of the buffer or lack of heap memory. + +7. Miscellaneous Notes On VObject APIs usages + ========================================== +a. vcc.h -- contains basic interfaces to the parser: + VObject* Parse_MIME(const char *input, unsigned long len); + VObject* Parse_MIME_FromFile(FILE *file); + -- both of this return a null-terminated list of + VObject that is either a VCARD or VCALENDAR. + To iterate through this list, do + VObject *t, *v; + v = Parse_Mime_FromFile(fp); + while (v) { + // ... do something to v. + t = v; + v = nextVObjectInList(v); + cleanVObject(t); + } + note that call to cleanVObject will release + resource used to represent the VObject. + +b. vobject.h -- contains basic interfaces to the VObject APIs. + see the header for more details. + The structure of VObject is purposely (hiddened) not exposed + to the user. Every access has to be done via + the APIs. This way, if we need to change the + structure or implementation, the client need not + recompile as long as the interfaces remain the + same. + +c. values of a property is determined by the property definition + itself. The vobject APIs does not attempt to enforce + any of such definition. It is the consumer responsibility + to know what value is expected from a property. e.g + most properties have unicode string value, so to access + the value of these type of properties, you will use + the vObjectUStringZValue() to read the value and + setVObjectUStringZValue() to set or modify the value. + Refer to the VCard and VCalendar specifications for + the definition of each property. + +d. properties name (id) are case incensitive. + +8. Brief descriptions of each APIs + =============================== + * the predefined properties' names (id) are listed under vobject.h + each is of the form VC*Prop. e.g. + #define VC7bitProp "7BIT" + #define VCAAlarmProp "AALARM" + .... + + * consumer of a VObject can only define pointers to VObject. + + * a variable of type VObjectIterator, say "i", can be used to iterate + through a VObject's properties, say "o". The APIs related to + VObjectIterator are: + void initPropIterator(VObjectIterator *i, VObject *o); + -- e.g. usage + initPropIterator(&i,o); + int moreIteration(VObjectIterator *i); + -- e.g. usage + while (moreIteration(&i)) { ... } + VObject* nextVObject(VObjectIterator *i); + -- e.g. usage + while (moreIteration(&i)) { + VObject *each = nextVObject(&i); + } + + * VObject can be chained together to form a list. e.g. of such + use is in the parser where the return value of the parser is + a link list of VObject. A link list of VObject can be + built by: + void addList(VObject **o, VObject *p); + and iterated by + VObject* nextVObjectInList(VObject *o); + -- next VObjectInList return 0 if the list + is exhausted. + + * the following APIs are mainly used to construct a VObject tree: + VObject* newVObject(const char *id); + -- used extensively internally by VObject APIs but when + used externally, its use is mainly limited to the + construction of top level object (e.g. an object + with VCCardProp or VCCalendarProp id). + + void deleteVObject(VObject *p); + -- to deallocate single VObject, for most user, use + cleanVObject(VObject *o) instead for freeing all + resources associated with the VObject. + + char* dupStr(const char *s, unsigned int size); + -- duplicate a string s. If size is 0, the string is + assume to be a null-terminated. + + void deleteStr(const char *p); + -- used to deallocate a string allocated by dupStr(); + + void setVObjectName(VObject *o, const char* id); + -- set the id of VObject o. This function is not + normally used by the user. The setting of id + is normally done as part of other APIs (e.g. + addProp()). + + void setVObjectStringZValue(VObject *o, const char *s); + -- set a string value of a VObject. + + void setVObjectUStringZValue(VObject *o, const wchar_t *s); + -- set a Unicode string value of a VObject. + + void setVObjectIntegerValue(VObject *o, unsigned int i); + -- set an integer value of a VObject. + + void setVObjectLongValue(VObject *o, unsigned long l); + -- set an long integer value of a VObject. + + void setVObjectAnyValue(VObject *o, void *t); + -- set any value of a VObject. The value type is + unspecified. + + VObject* setValueWithSize(VObject *prop, void *val, unsigned int size); + -- set a raw data (stream of bytes) value of a VObject + whose size is size. The internal VObject representation + is + this object = val + VCDataSizeProp=size + i.e. the value val will be attached to the VObject prop + and a property of VCDataSize whose value is size + is also added to the object. + + void setVObjectVObjectValue(VObject *o, VObject *p); + -- set a VObject as the value of another VObject. + + const char* vObjectName(VObject *o); + -- retrieve the VObject's Name (i.e. id). + + const char* vObjectStringZValue(VObject *o); + -- retrieve the VObject's value interpreted as + null-terminated string. + + const wchar_t* vObjectUStringZValue(VObject *o); + -- retrieve the VObject's value interpreted as + null-terminated unicode string. + + unsigned int vObjectIntegerValue(VObject *o); + -- retrieve the VObject's value interpreted as + integer. + + unsigned long vObjectLongValue(VObject *o); + -- retrieve the VObject's value interpreted as + long integer. + + void* vObjectAnyValue(VObject *o); + -- retrieve the VObject's value interpreted as + any value. + + VObject* vObjectVObjectValue(VObject *o); + -- retrieve the VObject's value interpreted as + a VObject. + + VObject* addVObjectProp(VObject *o, VObject *p); + -- add a VObject p as a property of VObject o. + (not normally used externally for building a + VObject). + + VObject* addProp(VObject *o, const char *id); + -- add a property whose name is id to VObject o. + + VObject* addPropValue(VObject *o, const char *id, const char *v); + -- add a property whose name is id and whose value + is a null-terminated string to VObject o. + + VObject* addPropSizedValue(VObject *o, const char *id, + const char *v, unsigned int size); + -- add a property whose name is id and whose value + is a stream of bytes of size size, to VObject o. + + VObject* addGroup(VObject *o, const char *g); + -- add a group g to VObject o. + e.g. if g is a.b.c, you will have + o + c + VCGroupingProp=b + VCGroupingProp=a + and the object c is returned. + + VObject* isAPropertyOf(VObject *o, const char *id); + -- query if a property by the name id is in o and + return the VObject that represent that property. + + void printVObject(VObject *o); + -- pretty print VObject o to stdout (for debugging use). + + void writeVObject(FILE *fp, VObject *o); + -- convert VObject o to its textual representation and + write it to file. + + char* writeMemVObject(char *s, int *len, VObject *o); + -- convert VObject o to its textual representation and + write it to memory. If s is 0, then memory required + to hold the textual representation will be allocated + by this API. If a variable len is passed, len will + be overwriten with the byte size of the textual + representation. If s is non-zero, then s has to + be a user allocated buffer whose size has be passed + in len as a variable. Memory allocated by the API + has to be freed with call to free. The return value + of this API is either the user supplied buffer, + the memory allocated by the API, or 0 (in case of + failure). + + void cleanStrTbl(); + -- this function has to be called when all + VObject has been destroyed. + + void cleanVObject(VObject *o); + -- release all resources used by VObject o. + + wchar_t* fakeUnicode(const char *ps, int *bytes); + -- convert char* to wchar_t*. + + extern int uStrLen(const wchar_t *u); + -- length of unicode u. + + char *fakeCString(const wchar_t *u); + -- convert wchar_t to CString (blindly assumes that + this could be done). + +9. Additional Programming Notes + ============================ +In the following notes, please refers to the listing +of Example.vcf and its VObject Representation +(shown at the end of this section). + +* Handling the Return Value of the VCard/VCalendar Parser + The example input text file contains two root VObjects + (a VCalendar and a VCard). The output of the VCard/VCalendar + parser is a null-terminated list of VObjects. For this + particular input file, the list will have two VObjects. + The following shows a template for iterating through the + output of the Parser: + + VObject *t, *v; + v = Parse_Mime_fromFileName("example.vcf"); + while (v) { + // currently, v will either be a VCard or a VCalendar + // do whatever your application need to do to + // v here ... + t = v; + v = nextVObjectInList(v); + cleanVObject(t); + } + +* Iterating Through a VCard/VCalendar VObject + From the VObject APIs point of view, a VCard VObject + is the same as a VCalendar VObject. However, the application + needs to know what are in a VCard or a VCalendar. + For example, A VCalendar VObject can have VCDCreatedProp, + a VCGEOLocationProp, etc, and one or more VCEventProp and + or VCTodoProp. The VCEventProp and VCTodoProp can have + many properties of their own, which in turn could have + more properties (e.g. VCDAlarmProp can be a VCEventProp + VObject's property, and VCRunTimeProp can be a + VCDAlarmProp VObject's property. Because a VObject tree + can be arbitrarily complex, in general, to process all + properties and values of a VObject tree, a recursive walk + is desirable. An example recursive VObject tree walk + can be found in the vobject.c source lines for printVObject* + and writeVObject* APIs. Depending on what the application need + to do with a VCard or a VCalendar, a recursive walk + of the VObject tree may or may not be desirable. An example + template of a non-recursive walk is shown below: + + void processVCardVCalendar(char *inputFile) + { + VObject *t, *v; + v = Parse_Mime_fromFileName(inputFile); + while (v) { + char *n = vObjectName(v); + if (strcmp(n,VCCardProp) == 0) { + do_VCard(v); + } + else if (strcmp(n,VCCalendarProp) == 0) { + do_VCalendar(v); + } + else { + // don't know how to handle anything else! + } + t = v; + v = nextVObjectInList(v); + cleanVObject(t); + } + } + + void do_VCard(VObject *vcard) + { + VObjectIterator t; + initPropIterator(&t,vcard); + while (moreIteration(&t)) { + VObject *eachProp = nextVObject(&t); + // The primarly purpose of this example is to + // show how to iterate through a VCard VObject, + // it is not meant to be efficient at all. + char *n = vObjectName(eachProp); + if (strcmp(n,VCNameProp)==0) { + do_name(eachProp); + } + else if (strcmp(n,VCEmailProp)==0) { + do_email(eachProp); + } + else if (strcmp(n,VCLabelProp)==0) { + do_label(eachProp); + } + else if .... + } + } + + void do_VCalendar(VObject *vcal) + { + VObjectIterator t; + initPropIterator(&t,vcard); + while (moreIteration(&t)) { + VObject *eachProp = nextVObject(&t); + // The primarly purpose of this example is to + // show how to iterate through a VCalendar VObject, + // it is not meant to be efficient at all. + char *n = vObjectName(eachProp); + if (strcmp(n,VCDCreatedProp)==0) { + do_DCreated(eachProp); + } + else if (strcmp(n,VCVersionProp)==0) { + do_Version(eachProp); + } + else if (strcmp(n,VCTodoProp)==0) { + do_Todo(eachProp); + } + else if (strcmp(n,VCEventProp)==0) { + do_Event(eachProp); + } + else if .... + } + } + + void do_Todo(VObject *vtodo) { ... } + + void do_Event(VObject *vevent) { ... } + + ... + +* Property's Values and Properties + The VObject APIs do not attempt to check for the + correctness of the values of a property. Nor do they + will prevent the user from attaching a non-VCard/VCalendar + standard property to a VCard/VCalendar property. Take + the example of line [11] of the example, "O.K" is not + a valid value of VCStatusProp. It is up to the application + to accept or reject the value of a property. + +* Output of printVObject + PrintVObject pretty prints a VObject tree in human + readable form. See the listing at the end of the file + for an example output of printVObject on the example + input file "Example.vcf". + + Note that binary data are not shown in the output of + printVObject. Instead, a note is made ([raw data]) to + indicate that there exists such a binary data. + +* Note on Binary Data + When the value of a property is a binary data, it is only + useful to know the size of the binary data. + + In the case of the VCard/VCalendar parser, it chooses + to represent the size information as a separate property + called VCDataSizeProp whose value is the size of the binary + data. The APIs sequence to construct the VObject subtree + of line [44] of Example.vcf is + + // VObject *vcard; + VObject *p1 = addProp(vcard,VCLogoProp); + (void) addProp(p1,VCGIFProp); + (void) addProp(p1,VCBASE64Prop); + VObject *p2 = addProp(p1,VCDataSizeProp); + (void) setVObjectLongValue(p2,1482); + setVObjectAnyValue(vcard,...pointer to binary data); + + Note the presence of VCBase64Prop will cause the + writeVObject API to output the binary data as BASE64 text. + For VCard/VCalendar application, having the VCBase64Prop + property is pratically always neccessary for property with + binary data as its value. + +* Note on Quoted-Printable String + String value with embedded newline are written out as + quoted-prinatable string. It is therefore important + to mark a property with a string value that has + one or more embedded newlines, with the VCQutedPrintableProp + property. e.g. + + // VObject *root; + char *msg="To be\nor\nnot to be"; + VObject *p = addPropValue(root,VCDescriptionProp,msg); + // the following is how you mark a property with + // a property. In this case, the marker is + // VCQuotedPrintableProp + addProp(p,VCQuotedPrintableProp); + +* Note on Unicode + Although, the current parser takes ASCII text file only, + string values are all stored as Unicode in the VObject tree. + For now, when using the VObject APIs to construct a + VObject tree, one should always convert ASCII string value + to a Unicode string value: + + // VObject *root; + VObject *p = addProp(root,VCSomeProp); + setVObjectUStringZValue(p,fakeUnicode(someASCIIStringZvalue)); + + An API is provided to simplify the above process: + + addPropValue(root,VCSomeProp,someASCIIStringZValue); + + Note that someASCIISTringZValue is automatically converted to + Unicode by addPropValue API, where as, the former code + sequence do an explicit call to fakeUnicode. + + To read back the value, one should use the vObjectUStringZValue + API not vObjectStringZValue API. The value returned by the + vObjectUStringZValue API is a Unicode string. If the application + do not know how to handle Unicode string, it can use the + fakeCString API to convert it back to ASCII string (as long + as the conversion is meaningful). + + Note that fakeCString return a heap allocated memory. It is + important to call deleteStr on fakeCString return value if + it is not longer required (or there will be memory leak). + + NOTE: Unfortunately, at the point when this document is written, + there is still no consensus on how Unicode is to be handled + in the textual representation of VCard/VCalendar. So, there + is no version of writeVObject and the parser to output and + input Unicode textual representation of VCard/VCalendar. + + +Example.vcf +----------- +line +number Input Text (example.vcf) +------ ---------- +1 BEGIN:VCALENDAR +2 DCREATED:19961102T100522 +3 GEO:0,0 +4 VERSION:1.0 +5 BEGIN:VEVENT +6 DTSTART:19961103T000000 +7 DTEND:20000101T000000 +8 DESCRIPTION;QUOTED-PRINTABLE:To be =0A= +9 or =0A= +10 not to be +11 STATUS:O.K. +12 X-ACTION:No action required +13 DALARM:19961103T114500;5;3;Enjoy +14 MALARM:19970101T120000;;;johny@nowhere.com;Call Mom. +15 END:VEVENT +16 +17 BEGIN:VTODO +18 DUE:19960614T0173000 +19 DESCRIPTION:Relex. +20 END:VTODO +21 +22 END:VCALENDAR +23 +24 BEGIN:VCARD +25 N:Alden;Roland +26 FN:Roland H. Alden +27 ORG:AT&T;Versit Project Office +28 TITLE:Consultant +29 EMAIL;WORK;PREF;INTERNET:ralden@ralden.com +30 LABEL;DOM;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= +31 Suite 2208=0A= +32 One Pine Street=0A= +33 San Francisco, CA 94111 +34 LABEL;POSTAL;PARCEL;HOME;WORK;QUOTED-PRINTABLE:Roland H. Alden=0A= +35 Suite 2208=0A= +36 One Pine Street=0A= +37 San Francisco, CA 94111=0A= +38 U.S.A. +39 TEL;WORK;PREF;MSG:+1 415 296 9106 +40 TEL;WORK;FAX:+1 415 296 9016 +41 TEL;MSG;CELL:+1 415 608 5981 +42 ADR:;Suite 2208;One Pine Street;San Francisco;CA;94111;U.S.A. +43 SOUND:ROW-LAND H ALL-DIN +44 LOGO;GIF;BASE64: +45 R0lGODdhpgBOAMQAAP///+/v797e3s7Ozr29va2trZycnIyMjHt7e2NjY1JSUkJC + ... 30 lines of BASE64 data not shown here. +76 END:VCARD + + +VObject Representation of Example.vcf: +------------------------------------- +line +in +text +file VObject Tree as Printed by printVObject API +---- ------------------------------------------- +1 VCALENDAR +2 DCREATED="19961102T100522" +3 GEO="0,0" +4 VERSION="1.0" +5 VEVENT +6 DTSTART="19961103T000000" +7 DTEND="20000101T000000" +8 DESCRIPTION="To be +9 or +10 not to be" +8 QUOTED-PRINTABLE +11 STATUS="O.K." +12 X-ACTION="No action required" +13 DALARM +13 RUNTIME="19961103T114500" +13 SNOOZETIME="5" +13 REPEATCOUNT="3" +13 DISPLAYSTRING="Enjoy" +14 MALARM +14 RUNTIME="19970101T120000" +14 EMAIL="johny@nowhere.com" +14 NOTE="Call Mom" +17 VTODO +18 DUE="19960614T0173000" +19 DESCRIPTION="Relex." +24 VCARD +25 N +25 F="Alden" +25 G="Roland" +26 FN="Roland H. Alden" +27 ORG +27 ORGNAME="AT&T" +27 OUN="Versit Project Office" +28 TITLE="Consultant" +29 EMAIL="ralden@alden.com" +29 WORK +29 PREF +29 INTERNET +30 LABEL="Roland H. Alden +31 Suite 2208 +32 One Pine Street +33 San Francisco, CA 94111" +30 DOM +30 POSTAL +30 PARCEL +30 HOME +30 WORK +30 QUOTED-PRINTABLE +34 LABEL="Roland H. Alden +35 Suite 2208 +36 One Pine Street +37 San Francisco, CA 94111 +38 U.S.A." +34 POSTAL +34 PARCEL +34 HOME +34 WORK +34 QUOTED-PRINTABLE +39 TEL="+1 415 296 9106" +39 WORK +39 PREF +39 MSG +40 TEL="+1 415 296 9016" +40 WORK +40 FAX +41 TEL="+1 415 608 5981" +41 MSG +41 CELL +42 ADR +42 EXT ADD="Suite 2208" +42 STREET="One Pine Street" +42 L="San Francisco" +42 R="CA" +42 PC="94111" +42 C="U.S.A." +43 SOUND="ROW-LAND H ALL-DIN" +44 LOGO=[raw data] +44 GIF +44 BASE64 +44 DATASIZE=1482 + --- ./libversit/vobject.h Thu Jul 29 16:16:00 1999 +++ ../gnome-pim-1.4.0/./libversit/vobject.h Sun Sep 23 10:10:13 2001 @@ -1,366 +1,366 @@ -/*************************************************************************** -(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. - -For purposes of this license notice, the term Licensors shall mean, -collectively, Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. -The term Licensor shall mean any of the Licensors. - -Subject to acceptance of the following conditions, permission is hereby -granted by Licensors without the need for written agreement and without -license or royalty fees, to use, copy, modify and distribute this -software for any purpose. - -The above copyright notice and the following four paragraphs must be -reproduced in all copies of this software and any software including -this software. - -THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE -ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR -MODIFICATIONS. - -IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, -INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT -OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. - -The software is provided with RESTRICTED RIGHTS. Use, duplication, or -disclosure by the government are subject to restrictions set forth in -DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. - -***************************************************************************/ - -/* - -The vCard/vCalendar C interface is implemented in the set -of files as follows: - -vcc.y, yacc source, and vcc.c, the yacc output you will use -implements the core parser - -vobject.c implements an API that insulates the caller from -the parser and changes in the vCard/vCalendar BNF - -port.h defines compilation environment dependent stuff - -vcc.h and vobject.h are header files for their .c counterparts - -vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions -which you may find useful. - -test.c is a standalone test driver that exercises some of -the features of the APIs provided. Invoke test.exe on a -VCARD/VCALENDAR input text file and you will see the pretty -print output of the internal representation (this pretty print -output should give you a good idea of how the internal -representation looks like -- there is one such output in the -following too). Also, a file with the .out suffix is generated -to show that the internal representation can be written back -in the original text format. - -For more information on this API see the readme.txt file -which accompanied this distribution. - - Also visit: - - http://www.versit.com - http://www.ralden.com - -*/ - - -#ifndef __VOBJECT_H__ -#define __VOBJECT_H__ 1 - - -#include "port.h" -#include -#include - -#if defined(__CPLUSPLUS__) || defined(__cplusplus) -extern "C" { -#endif - - -#define VC7bitProp "7BIT" -#define VC8bitProp "8BIT" -#define VCAAlarmProp "AALARM" -#define VCAdditionalNamesProp "ADDN" -#define VCAdrProp "ADR" -#define VCAgentProp "AGENT" -#define VCAIFFProp "AIFF" -#define VCAOLProp "AOL" -#define VCAppleLinkProp "APPLELINK" -#define VCAttachProp "ATTACH" -#define VCAttendeeProp "ATTENDEE" -#define VCATTMailProp "ATTMAIL" -#define VCAudioContentProp "AUDIOCONTENT" -#define VCAVIProp "AVI" -#define VCBase64Prop "BASE64" -#define VCBBSProp "BBS" -#define VCBirthDateProp "BDAY" -#define VCBMPProp "BMP" -#define VCBodyProp "BODY" -#define VCBusinessRoleProp "ROLE" -#define VCCalProp "VCALENDAR" -#define VCCaptionProp "CAP" -#define VCCardProp "VCARD" -#define VCCarProp "CAR" -#define VCCategoriesProp "CATEGORIES" -#define VCCellularProp "CELL" -#define VCCGMProp "CGM" -#define VCCharSetProp "CS" -#define VCCIDProp "CID" -#define VCCISProp "CIS" -#define VCCityProp "L" -#define VCClassProp "CLASS" -#define VCCommentProp "NOTE" -#define VCCompletedProp "COMPLETED" -#define VCContentIDProp "CONTENT-ID" -#define VCCountryNameProp "C" -#define VCDAlarmProp "DALARM" -#define VCDataSizeProp "DATASIZE" -#define VCDayLightProp "DAYLIGHT" -#define VCDCreatedProp "DCREATED" -#define VCDeliveryLabelProp "LABEL" -#define VCDescriptionProp "DESCRIPTION" -#define VCDIBProp "DIB" -#define VCDisplayStringProp "DISPLAYSTRING" -#define VCDomesticProp "DOM" -#define VCDTendProp "DTEND" -#define VCDTstartProp "DTSTART" -#define VCDueProp "DUE" -#define VCEmailAddressProp "EMAIL" -#define VCEncodingProp "ENCODING" -#define VCEndProp "END" -#define VCEventProp "VEVENT" -#define VCEWorldProp "EWORLD" -#define VCExNumProp "EXNUM" -#define VCExpDateProp "EXDATE" -#define VCExpectProp "EXPECT" -#define VCExtAddressProp "EXT ADD" -#define VCFamilyNameProp "F" -#define VCFaxProp "FAX" -#define VCFullNameProp "FN" -#define VCGeoProp "GEO" -#define VCGeoLocationProp "GEO" -#define VCGIFProp "GIF" -#define VCGivenNameProp "G" -#define VCGroupingProp "Grouping" -#define VCHomeProp "HOME" -#define VCIBMMailProp "IBMMail" -#define VCInlineProp "INLINE" -#define VCInternationalProp "INTL" -#define VCInternetProp "INTERNET" -#define VCISDNProp "ISDN" -#define VCJPEGProp "JPEG" -#define VCLanguageProp "LANG" -#define VCLastModifiedProp "LAST-MODIFIED" -#define VCLastRevisedProp "REV" -#define VCLocationProp "LOCATION" -#define VCLogoProp "LOGO" -#define VCMailerProp "MAILER" -#define VCMAlarmProp "MALARM" -#define VCMCIMailProp "MCIMAIL" -#define VCMessageProp "MSG" -#define VCMETProp "MET" -#define VCModemProp "MODEM" -#define VCMPEG2Prop "MPEG2" -#define VCMPEGProp "MPEG" -#define VCMSNProp "MSN" -#define VCNamePrefixesProp "NPRE" -#define VCNameProp "N" -#define VCNameSuffixesProp "NSUF" -#define VCNoteProp "NOTE" -#define VCOrgNameProp "ORGNAME" -#define VCOrgProp "ORG" -#define VCOrgUnit2Prop "OUN2" -#define VCOrgUnit3Prop "OUN3" -#define VCOrgUnit4Prop "OUN4" -#define VCOrgUnitProp "OUN" -#define VCPagerProp "PAGER" -#define VCPAlarmProp "PALARM" -#define VCParcelProp "PARCEL" -#define VCPartProp "PART" -#define VCPCMProp "PCM" -#define VCPDFProp "PDF" -#define VCPGPProp "PGP" -#define VCPhotoProp "PHOTO" -#define VCPICTProp "PICT" -#define VCPMBProp "PMB" -#define VCPostalBoxProp "BOX" -#define VCPostalCodeProp "PC" -#define VCPostalProp "POSTAL" -#define VCPowerShareProp "POWERSHARE" -#define VCPreferredProp "PREF" -#define VCPriorityProp "PRIORITY" -#define VCProcedureNameProp "PROCEDURENAME" -#define VCProdIdProp "PRODID" -#define VCProdigyProp "PRODIGY" -#define VCPronunciationProp "SOUND" -#define VCPSProp "PS" -#define VCPublicKeyProp "KEY" -#define VCQPProp "QP" -#define VCQuickTimeProp "QTIME" -#define VCQuotedPrintableProp "QUOTED-PRINTABLE" -#define VCRDateProp "RDATE" -#define VCRegionProp "R" -#define VCRelatedToProp "RELATED-TO" -#define VCRepeatCountProp "REPEATCOUNT" -#define VCResourcesProp "RESOURCES" -#define VCRNumProp "RNUM" -#define VCRoleProp "ROLE" -#define VCRRuleProp "RRULE" -#define VCRSVPProp "RSVP" -#define VCRunTimeProp "RUNTIME" -#define VCSequenceProp "SEQUENCE" -#define VCSnoozeTimeProp "SNOOZETIME" -#define VCStartProp "START" -#define VCStatusProp "STATUS" -#define VCStreetAddressProp "STREET" -#define VCSubTypeProp "SUBTYPE" -#define VCSummaryProp "SUMMARY" -#define VCTelephoneProp "TEL" -#define VCTIFFProp "TIFF" -#define VCTimeZoneProp "TZ" -#define VCTitleProp "TITLE" -#define VCTLXProp "TLX" -#define VCTodoProp "VTODO" -#define VCTranspProp "TRANSP" -#define VCUniqueStringProp "UID" -#define VCURLProp "URL" -#define VCURLValueProp "URLVAL" -#define VCValueProp "VALUE" -#define VCVersionProp "VERSION" -#define VCVideoProp "VIDEO" -#define VCVoiceProp "VOICE" -#define VCWAVEProp "WAVE" -#define VCWMFProp "WMF" -#define VCWorkProp "WORK" -#define VCX400Prop "X400" -#define VCX509Prop "X509" -#define VCXRuleProp "XRULE" - -/* Extensions */ - -#define XPilotIdProp "X-PILOTID" -#define XPilotStatusProp "X-PILOTSTAT" - -typedef struct VObject VObject; - -typedef struct VObjectIterator { - VObject* start; - VObject* next; - } VObjectIterator; - -extern DLLEXPORT(VObject*) newVObject(const char *id); -extern DLLEXPORT(void) deleteVObject(VObject *p); -extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); -extern DLLEXPORT(void) deleteStr(const char *p); -extern DLLEXPORT(void) unUseStr(const char *s); - -extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); -extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); -extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); -extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s); -extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s); -extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); -extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); -extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); -extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); -extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); - -extern DLLEXPORT(const char*) vObjectName(VObject *o); -extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); -extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o); -extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); -extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); -extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); -extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); -extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); - -extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); -extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); -extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); -extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); -extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); -extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); -extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); -extern DLLEXPORT(void) addList(VObject **o, VObject *p); - -extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); - -extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); -extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); -extern DLLEXPORT(int) moreIteration(VObjectIterator *i); -extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); - -extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o); -extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list); - -extern DLLEXPORT(const char*) lookupStr(const char *s); -extern DLLEXPORT(void) cleanStrTbl(); - -extern DLLEXPORT(void) cleanVObject(VObject *o); -extern DLLEXPORT(void) cleanVObjects(VObject *list); - -extern DLLEXPORT(const char*) lookupProp(const char* str); -extern DLLEXPORT(const char*) lookupProp_(const char* str); - -extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes); -extern DLLEXPORT(int) uStrLen(const wchar_t *u); -extern DLLEXPORT(char*) fakeCString(const wchar_t *u); - -extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o); -extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list); -extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); -extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); - -extern DLLEXPORT(int) vObjectValueType(VObject *o); - -/* return type of vObjectValueType: */ -#define VCVT_NOVALUE 0 - /* if the VObject has no value associated with it. */ -#define VCVT_STRINGZ 1 - /* if the VObject has value set by setVObjectStringZValue. */ -#define VCVT_USTRINGZ 2 - /* if the VObject has value set by setVObjectUStringZValue. */ -#define VCVT_UINT 3 - /* if the VObject has value set by setVObjectIntegerValue. */ -#define VCVT_ULONG 4 - /* if the VObject has value set by setVObjectLongValue. */ -#define VCVT_RAW 5 - /* if the VObject has value set by setVObjectAnyValue. */ -#define VCVT_VOBJECT 6 - /* if the VObject has value set by setVObjectVObjectValue. */ - -extern const char** fieldedProp; - -/* NOTE regarding printVObject and writeVObject - -The functions below are not exported from the DLL because they -take a FILE* as a parameter, which cannot be passed across a DLL -interface (at least that is my experience). Instead you can use -their companion functions which take file names or pointers -to memory. However, if you are linking this code into -your build directly then you may find them a more convenient API -and you can go ahead and use them. If you try to use them with -the DLL LIB you will get a link error. -*/ -extern void printVObject(FILE *fp,VObject *o); -extern void writeVObject(FILE *fp, VObject *o); - - -#if defined(__CPLUSPLUS__) || defined(__cplusplus) -} -#endif - -#endif /* __VOBJECT_H__ */ - - +/*************************************************************************** +(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. + +For purposes of this license notice, the term Licensors shall mean, +collectively, Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. +The term Licensor shall mean any of the Licensors. + +Subject to acceptance of the following conditions, permission is hereby +granted by Licensors without the need for written agreement and without +license or royalty fees, to use, copy, modify and distribute this +software for any purpose. + +The above copyright notice and the following four paragraphs must be +reproduced in all copies of this software and any software including +this software. + +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE +ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR +MODIFICATIONS. + +IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, +INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT +OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +The software is provided with RESTRICTED RIGHTS. Use, duplication, or +disclosure by the government are subject to restrictions set forth in +DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. + +***************************************************************************/ + +/* + +The vCard/vCalendar C interface is implemented in the set +of files as follows: + +vcc.y, yacc source, and vcc.c, the yacc output you will use +implements the core parser + +vobject.c implements an API that insulates the caller from +the parser and changes in the vCard/vCalendar BNF + +port.h defines compilation environment dependent stuff + +vcc.h and vobject.h are header files for their .c counterparts + +vcaltmp.h and vcaltmp.c implement vCalendar "macro" functions +which you may find useful. + +test.c is a standalone test driver that exercises some of +the features of the APIs provided. Invoke test.exe on a +VCARD/VCALENDAR input text file and you will see the pretty +print output of the internal representation (this pretty print +output should give you a good idea of how the internal +representation looks like -- there is one such output in the +following too). Also, a file with the .out suffix is generated +to show that the internal representation can be written back +in the original text format. + +For more information on this API see the readme.txt file +which accompanied this distribution. + + Also visit: + + http://www.versit.com + http://www.ralden.com + +*/ + + +#ifndef __VOBJECT_H__ +#define __VOBJECT_H__ 1 + + +#include "port.h" +#include +#include + +#if defined(__CPLUSPLUS__) || defined(__cplusplus) +extern "C" { +#endif + + +#define VC7bitProp "7BIT" +#define VC8bitProp "8BIT" +#define VCAAlarmProp "AALARM" +#define VCAdditionalNamesProp "ADDN" +#define VCAdrProp "ADR" +#define VCAgentProp "AGENT" +#define VCAIFFProp "AIFF" +#define VCAOLProp "AOL" +#define VCAppleLinkProp "APPLELINK" +#define VCAttachProp "ATTACH" +#define VCAttendeeProp "ATTENDEE" +#define VCATTMailProp "ATTMAIL" +#define VCAudioContentProp "AUDIOCONTENT" +#define VCAVIProp "AVI" +#define VCBase64Prop "BASE64" +#define VCBBSProp "BBS" +#define VCBirthDateProp "BDAY" +#define VCBMPProp "BMP" +#define VCBodyProp "BODY" +#define VCBusinessRoleProp "ROLE" +#define VCCalProp "VCALENDAR" +#define VCCaptionProp "CAP" +#define VCCardProp "VCARD" +#define VCCarProp "CAR" +#define VCCategoriesProp "CATEGORIES" +#define VCCellularProp "CELL" +#define VCCGMProp "CGM" +#define VCCharSetProp "CS" +#define VCCIDProp "CID" +#define VCCISProp "CIS" +#define VCCityProp "L" +#define VCClassProp "CLASS" +#define VCCommentProp "NOTE" +#define VCCompletedProp "COMPLETED" +#define VCContentIDProp "CONTENT-ID" +#define VCCountryNameProp "C" +#define VCDAlarmProp "DALARM" +#define VCDataSizeProp "DATASIZE" +#define VCDayLightProp "DAYLIGHT" +#define VCDCreatedProp "DCREATED" +#define VCDeliveryLabelProp "LABEL" +#define VCDescriptionProp "DESCRIPTION" +#define VCDIBProp "DIB" +#define VCDisplayStringProp "DISPLAYSTRING" +#define VCDomesticProp "DOM" +#define VCDTendProp "DTEND" +#define VCDTstartProp "DTSTART" +#define VCDueProp "DUE" +#define VCEmailAddressProp "EMAIL" +#define VCEncodingProp "ENCODING" +#define VCEndProp "END" +#define VCEventProp "VEVENT" +#define VCEWorldProp "EWORLD" +#define VCExNumProp "EXNUM" +#define VCExpDateProp "EXDATE" +#define VCExpectProp "EXPECT" +#define VCExtAddressProp "EXT ADD" +#define VCFamilyNameProp "F" +#define VCFaxProp "FAX" +#define VCFullNameProp "FN" +#define VCGeoProp "GEO" +#define VCGeoLocationProp "GEO" +#define VCGIFProp "GIF" +#define VCGivenNameProp "G" +#define VCGroupingProp "Grouping" +#define VCHomeProp "HOME" +#define VCIBMMailProp "IBMMail" +#define VCInlineProp "INLINE" +#define VCInternationalProp "INTL" +#define VCInternetProp "INTERNET" +#define VCISDNProp "ISDN" +#define VCJPEGProp "JPEG" +#define VCLanguageProp "LANG" +#define VCLastModifiedProp "LAST-MODIFIED" +#define VCLastRevisedProp "REV" +#define VCLocationProp "LOCATION" +#define VCLogoProp "LOGO" +#define VCMailerProp "MAILER" +#define VCMAlarmProp "MALARM" +#define VCMCIMailProp "MCIMAIL" +#define VCMessageProp "MSG" +#define VCMETProp "MET" +#define VCModemProp "MODEM" +#define VCMPEG2Prop "MPEG2" +#define VCMPEGProp "MPEG" +#define VCMSNProp "MSN" +#define VCNamePrefixesProp "NPRE" +#define VCNameProp "N" +#define VCNameSuffixesProp "NSUF" +#define VCNoteProp "NOTE" +#define VCOrgNameProp "ORGNAME" +#define VCOrgProp "ORG" +#define VCOrgUnit2Prop "OUN2" +#define VCOrgUnit3Prop "OUN3" +#define VCOrgUnit4Prop "OUN4" +#define VCOrgUnitProp "OUN" +#define VCPagerProp "PAGER" +#define VCPAlarmProp "PALARM" +#define VCParcelProp "PARCEL" +#define VCPartProp "PART" +#define VCPCMProp "PCM" +#define VCPDFProp "PDF" +#define VCPGPProp "PGP" +#define VCPhotoProp "PHOTO" +#define VCPICTProp "PICT" +#define VCPMBProp "PMB" +#define VCPostalBoxProp "BOX" +#define VCPostalCodeProp "PC" +#define VCPostalProp "POSTAL" +#define VCPowerShareProp "POWERSHARE" +#define VCPreferredProp "PREF" +#define VCPriorityProp "PRIORITY" +#define VCProcedureNameProp "PROCEDURENAME" +#define VCProdIdProp "PRODID" +#define VCProdigyProp "PRODIGY" +#define VCPronunciationProp "SOUND" +#define VCPSProp "PS" +#define VCPublicKeyProp "KEY" +#define VCQPProp "QP" +#define VCQuickTimeProp "QTIME" +#define VCQuotedPrintableProp "QUOTED-PRINTABLE" +#define VCRDateProp "RDATE" +#define VCRegionProp "R" +#define VCRelatedToProp "RELATED-TO" +#define VCRepeatCountProp "REPEATCOUNT" +#define VCResourcesProp "RESOURCES" +#define VCRNumProp "RNUM" +#define VCRoleProp "ROLE" +#define VCRRuleProp "RRULE" +#define VCRSVPProp "RSVP" +#define VCRunTimeProp "RUNTIME" +#define VCSequenceProp "SEQUENCE" +#define VCSnoozeTimeProp "SNOOZETIME" +#define VCStartProp "START" +#define VCStatusProp "STATUS" +#define VCStreetAddressProp "STREET" +#define VCSubTypeProp "SUBTYPE" +#define VCSummaryProp "SUMMARY" +#define VCTelephoneProp "TEL" +#define VCTIFFProp "TIFF" +#define VCTimeZoneProp "TZ" +#define VCTitleProp "TITLE" +#define VCTLXProp "TLX" +#define VCTodoProp "VTODO" +#define VCTranspProp "TRANSP" +#define VCUniqueStringProp "UID" +#define VCURLProp "URL" +#define VCURLValueProp "URLVAL" +#define VCValueProp "VALUE" +#define VCVersionProp "VERSION" +#define VCVideoProp "VIDEO" +#define VCVoiceProp "VOICE" +#define VCWAVEProp "WAVE" +#define VCWMFProp "WMF" +#define VCWorkProp "WORK" +#define VCX400Prop "X400" +#define VCX509Prop "X509" +#define VCXRuleProp "XRULE" + +/* Extensions */ + +#define XPilotIdProp "X-PILOTID" +#define XPilotStatusProp "X-PILOTSTAT" + +typedef struct VObject VObject; + +typedef struct VObjectIterator { + VObject* start; + VObject* next; + } VObjectIterator; + +extern DLLEXPORT(VObject*) newVObject(const char *id); +extern DLLEXPORT(void) deleteVObject(VObject *p); +extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); +extern DLLEXPORT(void) deleteStr(const char *p); +extern DLLEXPORT(void) unUseStr(const char *s); + +extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); +extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); +extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); +extern DLLEXPORT(void) setVObjectUStringZValue(VObject *o, const wchar_t *s); +extern DLLEXPORT(void) setVObjectUStringZValue_(VObject *o, const wchar_t *s); +extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); +extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); +extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); +extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); +extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); + +extern DLLEXPORT(const char*) vObjectName(VObject *o); +extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); +extern DLLEXPORT(const wchar_t*) vObjectUStringZValue(VObject *o); +extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); +extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); +extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); +extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); +extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); + +extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); +extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); +extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); +extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); +extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); +extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); +extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); +extern DLLEXPORT(void) addList(VObject **o, VObject *p); + +extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); + +extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); +extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); +extern DLLEXPORT(int) moreIteration(VObjectIterator *i); +extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); + +extern DLLEXPORT(char*) writeMemVObject(char *s, int *len, VObject *o); +extern DLLEXPORT(char*) writeMemVObjects(char *s, int *len, VObject *list); + +extern DLLEXPORT(const char*) lookupStr(const char *s); +extern DLLEXPORT(void) cleanStrTbl(); + +extern DLLEXPORT(void) cleanVObject(VObject *o); +extern DLLEXPORT(void) cleanVObjects(VObject *list); + +extern DLLEXPORT(const char*) lookupProp(const char* str); +extern DLLEXPORT(const char*) lookupProp_(const char* str); + +extern DLLEXPORT(wchar_t*) fakeUnicode(const char *ps, int *bytes); +extern DLLEXPORT(int) uStrLen(const wchar_t *u); +extern DLLEXPORT(char*) fakeCString(const wchar_t *u); + +extern DLLEXPORT(void) printVObjectToFile(char *fname,VObject *o); +extern DLLEXPORT(void) printVObjectsToFile(char *fname,VObject *list); +extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); +extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); + +extern DLLEXPORT(int) vObjectValueType(VObject *o); + +/* return type of vObjectValueType: */ +#define VCVT_NOVALUE 0 + /* if the VObject has no value associated with it. */ +#define VCVT_STRINGZ 1 + /* if the VObject has value set by setVObjectStringZValue. */ +#define VCVT_USTRINGZ 2 + /* if the VObject has value set by setVObjectUStringZValue. */ +#define VCVT_UINT 3 + /* if the VObject has value set by setVObjectIntegerValue. */ +#define VCVT_ULONG 4 + /* if the VObject has value set by setVObjectLongValue. */ +#define VCVT_RAW 5 + /* if the VObject has value set by setVObjectAnyValue. */ +#define VCVT_VOBJECT 6 + /* if the VObject has value set by setVObjectVObjectValue. */ + +extern const char** fieldedProp; + +/* NOTE regarding printVObject and writeVObject + +The functions below are not exported from the DLL because they +take a FILE* as a parameter, which cannot be passed across a DLL +interface (at least that is my experience). Instead you can use +their companion functions which take file names or pointers +to memory. However, if you are linking this code into +your build directly then you may find them a more convenient API +and you can go ahead and use them. If you try to use them with +the DLL LIB you will get a link error. +*/ +extern void printVObject(FILE *fp,VObject *o); +extern void writeVObject(FILE *fp, VObject *o); + + +#if defined(__CPLUSPLUS__) || defined(__cplusplus) +} +#endif + +#endif /* __VOBJECT_H__ */ + + --- ./libversit/vcaltmp.c Wed Sep 1 14:09:57 1999 +++ ../gnome-pim-1.4.0/./libversit/vcaltmp.c Sun Sep 23 10:10:12 2001 @@ -1,337 +1,337 @@ -/* -This module provides some helper APIs for creating -a VCalendar object. - -Note on APIs: - 1. The APIs does not attempt to verify if the arguments - passed are correct. - 2. Where the argument to an API is not applicable, pass - the value 0. - 3. See the test program at the bottom of this file as an - example of usage. - 4. This code calls APIs in vobject.c. - -*/ - -/*************************************************************************** -(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. - -For purposes of this license notice, the term Licensors shall mean, -collectively, Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. -The term Licensor shall mean any of the Licensors. - -Subject to acceptance of the following conditions, permission is hereby -granted by Licensors without the need for written agreement and without -license or royalty fees, to use, copy, modify and distribute this -software for any purpose. - -The above copyright notice and the following four paragraphs must be -reproduced in all copies of this software and any software including -this software. - -THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE -ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR -MODIFICATIONS. - -IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, -INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT -OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. - -The software is provided with RESTRICTED RIGHTS. Use, duplication, or -disclosure by the government are subject to restrictions set forth in -DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. - -***************************************************************************/ - - -#include -#include -#include "vcaltmp.h" - - -DLLEXPORT(VObject*) vcsCreateVCal( - char *date_created, - char *location, - char *product_id, - char *time_zone, - char *version - ) - { - VObject *vcal = newVObject(VCCalProp); -#define Z(p,v) if (v) addPropValue(vcal,p,v); - Z(VCDCreatedProp, date_created); - Z(VCLocationProp, location) - Z(VCProdIdProp, product_id) - Z(VCTimeZoneProp, time_zone) - Z(VCVersionProp, version) -#undef Z - return vcal; - } - - -DLLEXPORT(VObject*) vcsAddEvent( - VObject *vcal, - char *start_date_time, - char *end_date_time, - char *description, - char *summary, - char *categories, - char *classification, - char *status, - char *transparency, - char *uid, - char *url - ) - { - VObject *vevent = addProp(vcal,VCEventProp); -#define Z(p,v) if (v) addPropValue(vevent,p,v); - Z(VCDTstartProp,start_date_time); - Z(VCDTendProp,end_date_time); - if (description) { - VObject *p = addPropValue(vevent,VCDescriptionProp,description); - if (strchr(description,'\n')) - addProp(p,VCQuotedPrintableProp); - } - Z(VCSummaryProp,summary); - Z(VCCategoriesProp,categories); - Z(VCClassProp,classification); - Z(VCStatusProp,status); - Z(VCTranspProp,transparency); - Z(VCUniqueStringProp,uid); - Z(VCURLProp,url); -#undef Z - return vevent; - } - - -DLLEXPORT(VObject*) vcsAddTodo( - VObject *vcal, - char *start_date_time, - char *due_date_time, - char *date_time_complete, - char *description, - char *summary, - char *priority, - char *classification, - char *status, - char *uid, - char *url - ) - { - VObject *vtodo = addProp(vcal,VCTodoProp); -#define Z(p,v) if (v) addPropValue(vtodo,p,v); - Z(VCDTstartProp,start_date_time); - Z(VCDueProp,due_date_time); - Z(VCCompletedProp,date_time_complete); - if (description) { - VObject *p = addPropValue(vtodo,VCDescriptionProp,description); - if (strchr(description,'\n')) - addProp(p,VCQuotedPrintableProp); - } - Z(VCSummaryProp,summary); - Z(VCPriorityProp,priority); - Z(VCClassProp,classification); - Z(VCStatusProp,status); - Z(VCUniqueStringProp,uid); - Z(VCURLProp,url); -#undef Z - return vtodo; - } - - -DLLEXPORT(VObject*) vcsAddAAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *audio_content - ) - { - VObject *aalarm= addProp(vevent,VCAAlarmProp); -#define Z(p,v) if (v) addPropValue(aalarm,p,v); - Z(VCRunTimeProp,run_time); - Z(VCSnoozeTimeProp,snooze_time); - Z(VCRepeatCountProp,repeat_count); - Z(VCAudioContentProp,audio_content); -#undef Z - return aalarm; - } - - -DLLEXPORT(VObject*) vcsAddMAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *email_address, - char *note - ) - { - VObject *malarm= addProp(vevent,VCMAlarmProp); -#define Z(p,v) if (v) addPropValue(malarm,p,v); - Z(VCRunTimeProp,run_time); - Z(VCSnoozeTimeProp,snooze_time); - Z(VCRepeatCountProp,repeat_count); - Z(VCEmailAddressProp,email_address); - Z(VCNoteProp,note); -#undef Z - return malarm; - } - - -DLLEXPORT(VObject*) vcsAddDAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *display_string - ) - { - VObject *dalarm= addProp(vevent,VCDAlarmProp); -#define Z(p,v) if (v) addPropValue(dalarm,p,v); - Z(VCRunTimeProp,run_time); - Z(VCSnoozeTimeProp,snooze_time); - Z(VCRepeatCountProp,repeat_count); - Z(VCDisplayStringProp,display_string); -#undef Z - return dalarm; - } - - -DLLEXPORT(VObject*) vcsAddPAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *procedure_name - ) - { - VObject *palarm= addProp(vevent,VCPAlarmProp); -#define Z(p,v) if (v) addPropValue(palarm,p,v); - Z(VCRunTimeProp,run_time); - Z(VCSnoozeTimeProp,snooze_time); - Z(VCRepeatCountProp,repeat_count); - Z(VCProcedureNameProp,procedure_name); -#undef Z - return palarm; - } - - -#ifdef _TEST - -#if 0 -This testcase would generate a file call "frankcal.vcf" with -the following content: - -BEGIN:VCALENDAR -DCREATED:19960523T100522 -GEO:37.24,-17.87 -PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN -VERSION:0.3 -BEGIN:VEVENT -DTSTART:19960523T120000 -DTEND:19960523T130000 -DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A= -With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A= -activities with European Press representatives. -SUMMARY:VERSIT PDI PR Teleconference/Interview -CATEGORIES:PHONE CALL -STATUS:CONFIRMED -TRANSP:19960523T100522-4000F100582713-009251 -UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2 -DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!; -MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!; -PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2; -X-LDC-OR2-OLE:c:\temp\agenda.doc -END:VEVENT - -BEGIN:VTODO -DUE:19960614T0173000 -DESCRIPTION:Review VCalendar helper API. -END:VTODO - -END:VCALENDAR - -#endif - -void testVcalAPIs() { - FILE *fp; - VObject *vcal = vcsCreateVCal( - "19960523T100522", - "37.24,-17.87", - "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN", - 0, - "0.3" - ); - - VObject *vevent = vcsAddEvent( - vcal, - "19960523T120000", - "19960523T130000", - "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.", - "VERSIT PDI PR Teleconference/Interview", - "PHONE CALL", - 0, - "CONFIRMED", - "19960523T100522-4000F100582713-009251", - "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2", - 0 - ); - - vcsAddDAlarm(vevent, "19960523T114500", "5", "3", - "Your Telecon Starts At Noon!!!"); - vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com", - "Remember 05/23 Noon Telecon!!!"); - vcsAddPAlarm(vevent, "19960523T115500", 0 ,0, - "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2"); - - addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc"); - - vcsAddTodo( - vcal, - 0, - "19960614T0173000", - 0, - "Review VCalendar helper API.", - 0, - 0, - 0, - 0, - 0, - 0 - ); - - /* now do something to the resulting VObject */ - /* pretty print on stdout for fun */ - printVObject(vcal); - /* open the output text file */ - -#define OUTFILE "frankcal.vcf" - - fp = fopen(OUTFILE, "w"); - if (fp) { - /* write it in text form */ - writeVObject(fp,vcal); - fclose(fp); - } - else { - printf("open output file '%s' failed\n", OUTFILE); - } - } - -void main() { - testVcalAPIs(); - } - -#endif - - -/* end of source file vcaltmp.c */ +/* +This module provides some helper APIs for creating +a VCalendar object. + +Note on APIs: + 1. The APIs does not attempt to verify if the arguments + passed are correct. + 2. Where the argument to an API is not applicable, pass + the value 0. + 3. See the test program at the bottom of this file as an + example of usage. + 4. This code calls APIs in vobject.c. + +*/ + +/*************************************************************************** +(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. + +For purposes of this license notice, the term Licensors shall mean, +collectively, Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. +The term Licensor shall mean any of the Licensors. + +Subject to acceptance of the following conditions, permission is hereby +granted by Licensors without the need for written agreement and without +license or royalty fees, to use, copy, modify and distribute this +software for any purpose. + +The above copyright notice and the following four paragraphs must be +reproduced in all copies of this software and any software including +this software. + +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE +ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR +MODIFICATIONS. + +IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, +INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT +OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +The software is provided with RESTRICTED RIGHTS. Use, duplication, or +disclosure by the government are subject to restrictions set forth in +DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. + +***************************************************************************/ + + +#include +#include +#include "vcaltmp.h" + + +DLLEXPORT(VObject*) vcsCreateVCal( + char *date_created, + char *location, + char *product_id, + char *time_zone, + char *version + ) + { + VObject *vcal = newVObject(VCCalProp); +#define Z(p,v) if (v) addPropValue(vcal,p,v); + Z(VCDCreatedProp, date_created); + Z(VCLocationProp, location) + Z(VCProdIdProp, product_id) + Z(VCTimeZoneProp, time_zone) + Z(VCVersionProp, version) +#undef Z + return vcal; + } + + +DLLEXPORT(VObject*) vcsAddEvent( + VObject *vcal, + char *start_date_time, + char *end_date_time, + char *description, + char *summary, + char *categories, + char *classification, + char *status, + char *transparency, + char *uid, + char *url + ) + { + VObject *vevent = addProp(vcal,VCEventProp); +#define Z(p,v) if (v) addPropValue(vevent,p,v); + Z(VCDTstartProp,start_date_time); + Z(VCDTendProp,end_date_time); + if (description) { + VObject *p = addPropValue(vevent,VCDescriptionProp,description); + if (strchr(description,'\n')) + addProp(p,VCQuotedPrintableProp); + } + Z(VCSummaryProp,summary); + Z(VCCategoriesProp,categories); + Z(VCClassProp,classification); + Z(VCStatusProp,status); + Z(VCTranspProp,transparency); + Z(VCUniqueStringProp,uid); + Z(VCURLProp,url); +#undef Z + return vevent; + } + + +DLLEXPORT(VObject*) vcsAddTodo( + VObject *vcal, + char *start_date_time, + char *due_date_time, + char *date_time_complete, + char *description, + char *summary, + char *priority, + char *classification, + char *status, + char *uid, + char *url + ) + { + VObject *vtodo = addProp(vcal,VCTodoProp); +#define Z(p,v) if (v) addPropValue(vtodo,p,v); + Z(VCDTstartProp,start_date_time); + Z(VCDueProp,due_date_time); + Z(VCCompletedProp,date_time_complete); + if (description) { + VObject *p = addPropValue(vtodo,VCDescriptionProp,description); + if (strchr(description,'\n')) + addProp(p,VCQuotedPrintableProp); + } + Z(VCSummaryProp,summary); + Z(VCPriorityProp,priority); + Z(VCClassProp,classification); + Z(VCStatusProp,status); + Z(VCUniqueStringProp,uid); + Z(VCURLProp,url); +#undef Z + return vtodo; + } + + +DLLEXPORT(VObject*) vcsAddAAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *audio_content + ) + { + VObject *aalarm= addProp(vevent,VCAAlarmProp); +#define Z(p,v) if (v) addPropValue(aalarm,p,v); + Z(VCRunTimeProp,run_time); + Z(VCSnoozeTimeProp,snooze_time); + Z(VCRepeatCountProp,repeat_count); + Z(VCAudioContentProp,audio_content); +#undef Z + return aalarm; + } + + +DLLEXPORT(VObject*) vcsAddMAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *email_address, + char *note + ) + { + VObject *malarm= addProp(vevent,VCMAlarmProp); +#define Z(p,v) if (v) addPropValue(malarm,p,v); + Z(VCRunTimeProp,run_time); + Z(VCSnoozeTimeProp,snooze_time); + Z(VCRepeatCountProp,repeat_count); + Z(VCEmailAddressProp,email_address); + Z(VCNoteProp,note); +#undef Z + return malarm; + } + + +DLLEXPORT(VObject*) vcsAddDAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *display_string + ) + { + VObject *dalarm= addProp(vevent,VCDAlarmProp); +#define Z(p,v) if (v) addPropValue(dalarm,p,v); + Z(VCRunTimeProp,run_time); + Z(VCSnoozeTimeProp,snooze_time); + Z(VCRepeatCountProp,repeat_count); + Z(VCDisplayStringProp,display_string); +#undef Z + return dalarm; + } + + +DLLEXPORT(VObject*) vcsAddPAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *procedure_name + ) + { + VObject *palarm= addProp(vevent,VCPAlarmProp); +#define Z(p,v) if (v) addPropValue(palarm,p,v); + Z(VCRunTimeProp,run_time); + Z(VCSnoozeTimeProp,snooze_time); + Z(VCRepeatCountProp,repeat_count); + Z(VCProcedureNameProp,procedure_name); +#undef Z + return palarm; + } + + +#ifdef _TEST + +#if 0 +This testcase would generate a file call "frankcal.vcf" with +the following content: + +BEGIN:VCALENDAR +DCREATED:19960523T100522 +GEO:37.24,-17.87 +PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN +VERSION:0.3 +BEGIN:VEVENT +DTSTART:19960523T120000 +DTEND:19960523T130000 +DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A= +With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A= +activities with European Press representatives. +SUMMARY:VERSIT PDI PR Teleconference/Interview +CATEGORIES:PHONE CALL +STATUS:CONFIRMED +TRANSP:19960523T100522-4000F100582713-009251 +UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2 +DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!; +MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!; +PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2; +X-LDC-OR2-OLE:c:\temp\agenda.doc +END:VEVENT + +BEGIN:VTODO +DUE:19960614T0173000 +DESCRIPTION:Review VCalendar helper API. +END:VTODO + +END:VCALENDAR + +#endif + +void testVcalAPIs() { + FILE *fp; + VObject *vcal = vcsCreateVCal( + "19960523T100522", + "37.24,-17.87", + "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN", + 0, + "0.3" + ); + + VObject *vevent = vcsAddEvent( + vcal, + "19960523T120000", + "19960523T130000", + "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.", + "VERSIT PDI PR Teleconference/Interview", + "PHONE CALL", + 0, + "CONFIRMED", + "19960523T100522-4000F100582713-009251", + "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2", + 0 + ); + + vcsAddDAlarm(vevent, "19960523T114500", "5", "3", + "Your Telecon Starts At Noon!!!"); + vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com", + "Remember 05/23 Noon Telecon!!!"); + vcsAddPAlarm(vevent, "19960523T115500", 0 ,0, + "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2"); + + addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc"); + + vcsAddTodo( + vcal, + 0, + "19960614T0173000", + 0, + "Review VCalendar helper API.", + 0, + 0, + 0, + 0, + 0, + 0 + ); + + /* now do something to the resulting VObject */ + /* pretty print on stdout for fun */ + printVObject(vcal); + /* open the output text file */ + +#define OUTFILE "frankcal.vcf" + + fp = fopen(OUTFILE, "w"); + if (fp) { + /* write it in text form */ + writeVObject(fp,vcal); + fclose(fp); + } + else { + printf("open output file '%s' failed\n", OUTFILE); + } + } + +void main() { + testVcalAPIs(); + } + +#endif + + +/* end of source file vcaltmp.c */ --- ./libversit/vcaltmp.h Wed Apr 1 21:18:42 1998 +++ ../gnome-pim-1.4.0/./libversit/vcaltmp.h Sun Sep 23 10:10:12 2001 @@ -1,128 +1,128 @@ -/*************************************************************************** -(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. - -For purposes of this license notice, the term Licensors shall mean, -collectively, Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. -The term Licensor shall mean any of the Licensors. - -Subject to acceptance of the following conditions, permission is hereby -granted by Licensors without the need for written agreement and without -license or royalty fees, to use, copy, modify and distribute this -software for any purpose. - -The above copyright notice and the following four paragraphs must be -reproduced in all copies of this software and any software including -this software. - -THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE -ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR -MODIFICATIONS. - -IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, -INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT -OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. - -The software is provided with RESTRICTED RIGHTS. Use, duplication, or -disclosure by the government are subject to restrictions set forth in -DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. - -***************************************************************************/ - -#include "vcc.h" - -#ifndef __VCALTMP_H__ -#define __VCALTMP_H__ - -#if defined(__CPLUSPLUS__) || defined(__cplusplus) -extern "C" { -#endif - -extern DLLEXPORT(VObject*) vcsCreateVCal( - char *date_created, - char *location, - char *product_id, - char *time_zone, - char *version - ); - -extern DLLEXPORT(VObject*) vcsAddEvent( - VObject *vcal, - char *start_date_time, - char *end_date_time, - char *description, - char *summary, - char *categories, - char *classification, - char *status, - char *transparency, - char *uid, - char *url - ); - - -extern DLLEXPORT(VObject*) vcsAddTodo( - VObject *vcal, - char *start_date_time, - char *due_date_time, - char *date_time_complete, - char *description, - char *summary, - char *priority, - char *classification, - char *status, - char *uid, - char *url - ); - - -extern DLLEXPORT(VObject*) vcsAddAAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *audio_content - ); - - -extern DLLEXPORT(VObject*) vcsAddMAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *email_address, - char *note - ); - - -extern DLLEXPORT(VObject*) vcsAddDAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *display_string - ); - - -extern DLLEXPORT(VObject*) vcsAddPAlarm( - VObject *vevent, - char *run_time, - char *snooze_time, - char *repeat_count, - char *procedure_name - ); - -#if defined(__CPLUSPLUS__) || defined(__cplusplus) -} -#endif - -#endif /* __VCALTMP_H__ */ - - +/*************************************************************************** +(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. + +For purposes of this license notice, the term Licensors shall mean, +collectively, Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. +The term Licensor shall mean any of the Licensors. + +Subject to acceptance of the following conditions, permission is hereby +granted by Licensors without the need for written agreement and without +license or royalty fees, to use, copy, modify and distribute this +software for any purpose. + +The above copyright notice and the following four paragraphs must be +reproduced in all copies of this software and any software including +this software. + +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE +ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR +MODIFICATIONS. + +IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, +INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT +OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +The software is provided with RESTRICTED RIGHTS. Use, duplication, or +disclosure by the government are subject to restrictions set forth in +DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. + +***************************************************************************/ + +#include "vcc.h" + +#ifndef __VCALTMP_H__ +#define __VCALTMP_H__ + +#if defined(__CPLUSPLUS__) || defined(__cplusplus) +extern "C" { +#endif + +extern DLLEXPORT(VObject*) vcsCreateVCal( + char *date_created, + char *location, + char *product_id, + char *time_zone, + char *version + ); + +extern DLLEXPORT(VObject*) vcsAddEvent( + VObject *vcal, + char *start_date_time, + char *end_date_time, + char *description, + char *summary, + char *categories, + char *classification, + char *status, + char *transparency, + char *uid, + char *url + ); + + +extern DLLEXPORT(VObject*) vcsAddTodo( + VObject *vcal, + char *start_date_time, + char *due_date_time, + char *date_time_complete, + char *description, + char *summary, + char *priority, + char *classification, + char *status, + char *uid, + char *url + ); + + +extern DLLEXPORT(VObject*) vcsAddAAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *audio_content + ); + + +extern DLLEXPORT(VObject*) vcsAddMAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *email_address, + char *note + ); + + +extern DLLEXPORT(VObject*) vcsAddDAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *display_string + ); + + +extern DLLEXPORT(VObject*) vcsAddPAlarm( + VObject *vevent, + char *run_time, + char *snooze_time, + char *repeat_count, + char *procedure_name + ); + +#if defined(__CPLUSPLUS__) || defined(__cplusplus) +} +#endif + +#endif /* __VCALTMP_H__ */ + + --- ./libversit/vcaltest.c Wed Apr 1 21:18:42 1998 +++ ../gnome-pim-1.4.0/./libversit/vcaltest.c Sun Sep 23 10:10:12 2001 @@ -1,118 +1,118 @@ -#include -#include -#include "vcaltmp.h" - -#if 0 -This testcase would generate a file call "frankcal.vcf" with -the following content: - -BEGIN:VCALENDAR -DCREATED:19960523T100522 -GEO:37.24,-17.87 -PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN -VERSION:0.3 -BEGIN:VEVENT -DTSTART:19960523T120000 -DTEND:19960523T130000 -DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A= -With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A= -activities with European Press representatives. -SUMMARY:VERSIT PDI PR Teleconference/Interview -SUBTYPE:PHONE CALL -STATUS:CONFIRMED -TRANSP:19960523T100522-4000F100582713-009251 -UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2 -DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!; -MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!; -PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2; -X-LDC-OR2-OLE:c:\temp\agenda.doc -END:VEVENT - -BEGIN:VTODO -DUE:19960614T0173000 -DESCRIPTION:Review VCalendar helper API. -END:VTODO - -END:VCALENDAR - -#endif - -FILE *cfp; - -void testVcalAPIs() { - FILE *fp; - VObject *vcal, *vevent; -#if _CONSOLE - cfp = stdout; -#else - cfp = fopen("vcaltest.out","w"); -#endif - if (cfp == 0) return; - vcal = vcsCreateVCal( - "19960523T100522", - "37.24,-17.87", - "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN", - 0, - "0.3" - ); - - vevent = vcsAddEvent( - vcal, - "19960523T120000", - "19960523T130000", - "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.", - "VERSIT PDI PR Teleconference/Interview", - "PHONE CALL", - 0, - "CONFIRMED", - "19960523T100522-4000F100582713-009251", - "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2", - 0 - ); - - vcsAddDAlarm(vevent, "19960523T114500", "5", "3", - "Your Telecon Starts At Noon!!!"); - vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com", - "Remember 05/23 Noon Telecon!!!"); - vcsAddPAlarm(vevent, "19960523T115500", 0 ,0, - "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2"); - - addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc"); - - vcsAddTodo( - vcal, - 0, - "19960614T0173000", - 0, - "Review VCalendar helper API.", - 0, - 0, - 0, - 0, - 0, - 0 - ); - - /* now do something to the resulting VObject */ - /* pretty print on stdout for fun */ - printVObject(cfp,vcal); - /* open the output text file */ - -#define OUTFILE "frankcal.vcf" - - fp = fopen(OUTFILE, "w"); - if (fp) { - /* write it in text form */ - writeVObject(fp,vcal); - fclose(fp); - } - else { - fprintf(cfp,"open output file '%s' failed\n", OUTFILE); - } - if (cfp != stdout) fclose(cfp); - } - -void main() { - testVcalAPIs(); - } - +#include +#include +#include "vcaltmp.h" + +#if 0 +This testcase would generate a file call "frankcal.vcf" with +the following content: + +BEGIN:VCALENDAR +DCREATED:19960523T100522 +GEO:37.24,-17.87 +PRODID:-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN +VERSION:0.3 +BEGIN:VEVENT +DTSTART:19960523T120000 +DTEND:19960523T130000 +DESCRIPTION;QUOTED-PRINTABLE:VERSIT PDI PR Teleconference/Interview =0A= +With Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar=0A= +activities with European Press representatives. +SUMMARY:VERSIT PDI PR Teleconference/Interview +SUBTYPE:PHONE CALL +STATUS:CONFIRMED +TRANSP:19960523T100522-4000F100582713-009251 +UID:http://www.ibm.com/raleigh/fdawson/~c:\or2\orgfiles\versit.or2 +DALARM:19960523T114500;5;3;Your Telecon Starts At Noon!!!; +MALARM:19960522T120000;;;fdawson@raleigh.ibm.com;Remember 05/23 Noon Telecon!!!; +PALARM:19960523T115500;;;c:\or2\organize.exe c:\or2\orgfiles\versit.or2; +X-LDC-OR2-OLE:c:\temp\agenda.doc +END:VEVENT + +BEGIN:VTODO +DUE:19960614T0173000 +DESCRIPTION:Review VCalendar helper API. +END:VTODO + +END:VCALENDAR + +#endif + +FILE *cfp; + +void testVcalAPIs() { + FILE *fp; + VObject *vcal, *vevent; +#if _CONSOLE + cfp = stdout; +#else + cfp = fopen("vcaltest.out","w"); +#endif + if (cfp == 0) return; + vcal = vcsCreateVCal( + "19960523T100522", + "37.24,-17.87", + "-//Frank Dawson/Hand Crafted In North Carolina//NONSGML Made By Hand//EN", + 0, + "0.3" + ); + + vevent = vcsAddEvent( + vcal, + "19960523T120000", + "19960523T130000", + "VERSIT PDI PR Teleconference/Interview \nWith Tom Streeter and Frank Dawson - Discuss VERSIT PDI project and vCard and vCalendar\nactivities with European Press representatives.", + "VERSIT PDI PR Teleconference/Interview", + "PHONE CALL", + 0, + "CONFIRMED", + "19960523T100522-4000F100582713-009251", + "http://www.ibm.com/raleigh/fdawson/~c:\\or2\\orgfiles\\versit.or2", + 0 + ); + + vcsAddDAlarm(vevent, "19960523T114500", "5", "3", + "Your Telecon Starts At Noon!!!"); + vcsAddMAlarm(vevent, "19960522T120000", 0, 0, "fdawson@raleigh.ibm.com", + "Remember 05/23 Noon Telecon!!!"); + vcsAddPAlarm(vevent, "19960523T115500", 0 ,0, + "c:\\or2\\organize.exe c:\\or2\\orgfiles\\versit.or2"); + + addPropValue(vevent, "X-LDC-OR2-OLE", "c:\\temp\\agenda.doc"); + + vcsAddTodo( + vcal, + 0, + "19960614T0173000", + 0, + "Review VCalendar helper API.", + 0, + 0, + 0, + 0, + 0, + 0 + ); + + /* now do something to the resulting VObject */ + /* pretty print on stdout for fun */ + printVObject(cfp,vcal); + /* open the output text file */ + +#define OUTFILE "frankcal.vcf" + + fp = fopen(OUTFILE, "w"); + if (fp) { + /* write it in text form */ + writeVObject(fp,vcal); + fclose(fp); + } + else { + fprintf(cfp,"open output file '%s' failed\n", OUTFILE); + } + if (cfp != stdout) fclose(cfp); + } + +void main() { + testVcalAPIs(); + } + --- ./libversit/vctest.c Wed Sep 1 14:09:57 1999 +++ ../gnome-pim-1.4.0/./libversit/vctest.c Sun Sep 23 10:10:13 2001 @@ -1,95 +1,95 @@ - -#include -#include -#include "vcc.h" - -FILE *cfp; - -void myMimeErrorHandler(char *s) -{ - printf("%s\n", s); -} - -void main(int argc, char **argv) -{ - int testmem = 0; - - char * foo[2] = {"foo","alden.vcf"}; - -argc = 2; -argv = foo; - -#ifdef _CONSOLE - cfp = stdout; - registerMimeErrorHandler(myMimeErrorHandler); -#else - cfp = fopen("vctest.out", "w"); - if (!cfp) return; -#endif - ++argv; - while (--argc) { - FILE *fp; - if (strcmp(*argv,"-testmem") == 0) { - testmem = 1; - argv++; - continue; - } - fprintf(cfp,"processing %s\n",*argv); - fp = fopen(*argv,"r"); - if (!fp) { - fprintf(cfp,"error opening file\n"); - } - else { - VObject *v, *t; - FILE *ofp; - char buf[256]; - char *p; - strcpy(buf,*argv); - p = strchr(buf,'.'); - if (p) *p = 0; - strcat(buf,".out"); - fprintf(cfp,"reading text input from '%s'...\n", *argv); - /*v = Parse_MIME_FromFile(fp); */ - v = Parse_MIME_FromFileName(*argv); - writeVObjectToFile(buf,v); - cleanVObject(v); - - /* - fprintf(cfp,"pretty print internal format of '%s'...\n", *argv); - ofp = fopen(buf,"w"); - while (v) { - printVObject(cfp,v); - if (testmem) { - char *s, *p; - fprintf(cfp,"test writing to mem...\n"); - p = s = writeMemVObject(0,0,v); - if (s) { - while (*s) { - fputc(*s,ofp); - s++; - } - free(p); - } - } - else { - writeVObject(ofp,v); - } - t = v; - v = nextVObjectInList(v); - cleanVObject(t); - } - - fclose(ofp); - fclose(fp); - */ - } - - cleanStrTbl(); - argv++; - - } - - if (cfp != stdout) fclose(cfp); - -} - + +#include +#include +#include "vcc.h" + +FILE *cfp; + +void myMimeErrorHandler(char *s) +{ + printf("%s\n", s); +} + +void main(int argc, char **argv) +{ + int testmem = 0; + + char * foo[2] = {"foo","alden.vcf"}; + +argc = 2; +argv = foo; + +#ifdef _CONSOLE + cfp = stdout; + registerMimeErrorHandler(myMimeErrorHandler); +#else + cfp = fopen("vctest.out", "w"); + if (!cfp) return; +#endif + ++argv; + while (--argc) { + FILE *fp; + if (strcmp(*argv,"-testmem") == 0) { + testmem = 1; + argv++; + continue; + } + fprintf(cfp,"processing %s\n",*argv); + fp = fopen(*argv,"r"); + if (!fp) { + fprintf(cfp,"error opening file\n"); + } + else { + VObject *v, *t; + FILE *ofp; + char buf[256]; + char *p; + strcpy(buf,*argv); + p = strchr(buf,'.'); + if (p) *p = 0; + strcat(buf,".out"); + fprintf(cfp,"reading text input from '%s'...\n", *argv); + /*v = Parse_MIME_FromFile(fp); */ + v = Parse_MIME_FromFileName(*argv); + writeVObjectToFile(buf,v); + cleanVObject(v); + + /* + fprintf(cfp,"pretty print internal format of '%s'...\n", *argv); + ofp = fopen(buf,"w"); + while (v) { + printVObject(cfp,v); + if (testmem) { + char *s, *p; + fprintf(cfp,"test writing to mem...\n"); + p = s = writeMemVObject(0,0,v); + if (s) { + while (*s) { + fputc(*s,ofp); + s++; + } + free(p); + } + } + else { + writeVObject(ofp,v); + } + t = v; + v = nextVObjectInList(v); + cleanVObject(t); + } + + fclose(ofp); + fclose(fp); + */ + } + + cleanStrTbl(); + argv++; + + } + + if (cfp != stdout) fclose(cfp); + +} + --- ./libversit/vcc.h Fri Jan 21 17:38:57 2000 +++ ../gnome-pim-1.4.0/./libversit/vcc.h Sun Sep 23 10:18:49 2001 @@ -1,80 +1,80 @@ -/*************************************************************************** -(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. - -For purposes of this license notice, the term Licensors shall mean, -collectively, Apple Computer, Inc., AT&T Corp., International -Business Machines Corporation and Siemens Rolm Communications Inc. -The term Licensor shall mean any of the Licensors. - -Subject to acceptance of the following conditions, permission is hereby -granted by Licensors without the need for written agreement and without -license or royalty fees, to use, copy, modify and distribute this -software for any purpose. - -The above copyright notice and the following four paragraphs must be -reproduced in all copies of this software and any software including -this software. - -THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE -ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR -MODIFICATIONS. - -IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, -INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT -OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH -DAMAGE. - -EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, -INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. - -The software is provided with RESTRICTED RIGHTS. Use, duplication, or -disclosure by the government are subject to restrictions set forth in -DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. - -***************************************************************************/ - -#ifndef __VCC_H__ -#define __VCC_H__ 1 - -#include "vobject.h" - - -#if defined(__CPLUSPLUS__) || defined(__cplusplus) -extern "C" { -#endif - -typedef void (*MimeErrorHandler)(char *); - -extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler); - -extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len); -extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname); - - -/* NOTE regarding Parse_MIME_FromFile -The function above, Parse_MIME_FromFile, comes in two flavors, -neither of which is exported from the DLL. Each version takes -a CFile or FILE* as a parameter, neither of which can be -passed across a DLL interface (at least that is my experience). -If you are linking this code into your build directly then -you may find them a more convenient API that the other flavors -that take a file name. If you use them with the DLL LIB you -will get a link error. -*/ - - -#if INCLUDEMFC -extern VObject* Parse_MIME_FromFile(CFile *file); -#else -extern VObject* Parse_MIME_FromFile(FILE *file); -#endif - -#if defined(__CPLUSPLUS__) || defined(__cplusplus) -} -#endif - -#endif /* __VCC_H__ */ - +/*************************************************************************** +(C) Copyright 1996 Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. + +For purposes of this license notice, the term Licensors shall mean, +collectively, Apple Computer, Inc., AT&T Corp., International +Business Machines Corporation and Siemens Rolm Communications Inc. +The term Licensor shall mean any of the Licensors. + +Subject to acceptance of the following conditions, permission is hereby +granted by Licensors without the need for written agreement and without +license or royalty fees, to use, copy, modify and distribute this +software for any purpose. + +The above copyright notice and the following four paragraphs must be +reproduced in all copies of this software and any software including +this software. + +THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS AND NO LICENSOR SHALL HAVE +ANY OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS OR +MODIFICATIONS. + +IN NO EVENT SHALL ANY LICENSOR BE LIABLE TO ANY PARTY FOR DIRECT, +INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES OR LOST PROFITS ARISING OUT +OF THE USE OF THIS SOFTWARE EVEN IF ADVISED OF THE POSSIBILITY OF SUCH +DAMAGE. + +EACH LICENSOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, EXPRESS OR IMPLIED, +INCLUDING BUT NOT LIMITED TO ANY WARRANTY OF NONINFRINGEMENT OR THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. + +The software is provided with RESTRICTED RIGHTS. Use, duplication, or +disclosure by the government are subject to restrictions set forth in +DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable. + +***************************************************************************/ + +#ifndef __VCC_H__ +#define __VCC_H__ 1 + +#include "vobject.h" + + +#if defined(__CPLUSPLUS__) || defined(__cplusplus) +extern "C" { +#endif + +typedef void (*MimeErrorHandler)(char *); + +extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler); + +extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len); +extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname); + + +/* NOTE regarding Parse_MIME_FromFile +The function above, Parse_MIME_FromFile, comes in two flavors, +neither of which is exported from the DLL. Each version takes +a CFile or FILE* as a parameter, neither of which can be +passed across a DLL interface (at least that is my experience). +If you are linking this code into your build directly then +you may find them a more convenient API that the other flavors +that take a file name. If you use them with the DLL LIB you +will get a link error. +*/ + + +#if INCLUDEMFC +extern VObject* Parse_MIME_FromFile(CFile *file); +#else +extern VObject* Parse_MIME_FromFile(FILE *file); +#endif + +#if defined(__CPLUSPLUS__) || defined(__cplusplus) +} +#endif + +#endif /* __VCC_H__ */ + --- ./gnomecard/Makefile.am Mon Feb 19 18:50:29 2001 +++ ../gnome-pim-1.4.0/./gnomecard/Makefile.am Sun Sep 23 20:35:39 2001 @@ -91,7 +91,7 @@ address-conduit.c libaddress_conduit_la_LIBADD = \ - ../libversit/libversit.la \ + ../libversit/vcc.lo ../libversit/vobject.lo ../libversit/vcaltmp.lo \ $(PISOCK_LIBS) \ $(GNOME_LIBDIR) \ $(GNOME_LIBS) --- ./gnomecard/Makefile.in Thu Mar 29 02:54:37 2001 +++ ../gnome-pim-1.4.0/./gnomecard/Makefile.in Sun Sep 23 20:35:12 2001 @@ -164,7 +164,7 @@ libaddress_conduit_la_SOURCES = card.c my.c address-conduit.h address-conduit.c -libaddress_conduit_la_LIBADD = ../libversit/libversit.la $(PISOCK_LIBS) $(GNOME_LIBDIR) $(GNOME_LIBS) +libaddress_conduit_la_LIBADD = ../libversit/vcc.lo ../libversit/vobject.lo ../libversit/vcaltmp.lo $(PISOCK_LIBS) $(GNOME_LIBDIR) $(GNOME_LIBS) address_conduit_capplet_SOURCES = address-conduit-capplet.c gnomecard.conduit.in --- ./gnomecard/address-conduit.c Mon Mar 13 00:13:16 2000 +++ ../gnome-pim-1.4.0/./gnomecard/address-conduit.c Sun Sep 23 20:27:40 2001 @@ -20,7 +20,9 @@ #include "address-conduit.h" /* #define AC_DEBUG */ -#ifdef AC_DEBUG +#ifndef __GNUC__ +static void LOG(gchar *mesg, ...); +#elif defined(AC_DEBUG) #define LOG(args...) g_log (G_LOG_DOMAIN, \ G_LOG_LEVEL_MESSAGE, \ "address: "##args) @@ -968,3 +970,16 @@ } +#ifndef __GNUC__ +static void LOG(gchar *mesg,...) +{ +#ifdef AC_DEBUG + va_list ap; + gchar *format = g_strconcat("address: ", mesg, NULL); + va_start(ap,mesg); + g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE,format,&ap); + va_end(ap); + g_free(format); +#endif +} +#endif --- ./gnomecard/address-conduit-capplet.c Sat Dec 2 22:26:46 2000 +++ ../gnome-pim-1.4.0/./gnomecard/address-conduit-capplet.c Sun Sep 23 20:28:11 2001 @@ -350,7 +350,7 @@ } entry = gtk_entry_new_with_max_length(128); gtk_object_set_data(GTK_OBJECT(vbox), fields[i].obj_data, entry); - gtk_table_attach_defaults(GTK_TABLE(table), entry, 2, 3, i, i+1); //, 0,0,0,0); + gtk_table_attach_defaults(GTK_TABLE(table), entry, 2, 3, i, i+1); /*, 0,0,0,0);*/ gtk_signal_connect(GTK_OBJECT(entry), "insert_text", GTK_SIGNAL_FUNC(fields[i].insert_func), NULL); --- ./gncal/gncal-todo.c Mon Nov 20 13:25:22 2000 +++ ../gnome-pim-1.4.0/./gncal/gncal-todo.c Sun Sep 23 20:30:09 2001 @@ -514,13 +514,13 @@ GtkWidget *w; GtkWidget *sw; GtkWidget *hbox; - gchar *titles[5] = { - _("Summary"), - _("Due Date"), - _("Priority"), - _("Time Left"), - _("Categories") - }; + gchar *titles[5]; + + titles[0] = _("Summary"); + titles[1] = _("Due Date"); + titles[2] = _("Priority"); + titles[3] = _("Time Left"); + titles[4] = _("Categories"); gtk_box_set_spacing (GTK_BOX (todo), 5); --- ./gncal/Makefile.am Mon Feb 19 18:50:29 2001 +++ ../gnome-pim-1.4.0/./gncal/Makefile.am Sun Sep 23 20:36:08 2001 @@ -141,7 +141,7 @@ -rpath $(libdir) libcalendar_conduit_la_LIBADD = \ - ../libversit/libversit.la \ + ../libversit/vcc.lo ../libversit/vobject.lo ../libversit/vcaltmp.lo \ $(PISOCK_LIBS) \ $(GNOME_LIBDIR) \ $(GNOME_LIBS) --- ./gncal/Makefile.in Thu Mar 29 02:54:29 2001 +++ ../gnome-pim-1.4.0/./gncal/Makefile.in Sun Sep 23 20:36:30 2001 @@ -171,7 +171,7 @@ libcalendar_conduit_la_LDFLAGS = -rpath $(libdir) -libcalendar_conduit_la_LIBADD = ../libversit/libversit.la $(PISOCK_LIBS) $(GNOME_LIBDIR) $(GNOME_LIBS) +libcalendar_conduit_la_LIBADD = ../libversit/vcc.lo ../libversit/vobject.lo ../libversit/vcaltmp.lo $(PISOCK_LIBS) $(GNOME_LIBDIR) $(GNOME_LIBS) calendar_conduit_control_applet_SOURCES = calendar-conduit-control-applet.c gnomecal.conduit.in --- ./gncal/calendar-conduit.c Sat Dec 2 22:26:46 2000 +++ ../gnome-pim-1.4.0/./gncal/calendar-conduit.c Sun Sep 23 20:31:27 2001 @@ -77,16 +77,27 @@ #define DEBUG_CALCONDUIT #undef DEBUG_CALCONDUIT +#ifndef __GNUC__ +static void LOG(gchar *mesg, ...); +#elif defined(DEBUG_CALCONDUIT) +#define LOG(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e) +#else +#define LOG(e...) +#endif + #ifdef DEBUG_CALCONDUIT #define show_exception(e) g_warning ("Exception: %s\n", CORBA_exception_id (e)) -#define LOG(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e) #else #define show_exception(e) -#define LOG(e...) #endif +#ifndef __GNUC__ +static void WARN(gchar *mesg, ...); +static void INFO(gchar *mesg, ...); +#else #define WARN(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING, e) #define INFO(e...) g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE, e) +#endif #define catch_ret_val(_env,ret) \ if (_env._major != CORBA_NO_EXCEPTION) { \ @@ -1465,3 +1476,30 @@ } +#ifndef __GNUC__ +static void LOG(gchar *mesg,...) +{ +#ifdef DEBUG_CONDUIT + va_list ap; + va_start(ap,mesg); + g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE,mesg,&ap); + va_end(ap); +#endif +} + +static void WARN(gchar *mesg,...) +{ + va_list ap; + va_start(ap,mesg); + g_log(G_LOG_DOMAIN,G_LOG_LEVEL_WARNING,mesg,&ap); + va_end(ap); +} + +static void INFO(gchar *mesg,...) +{ + va_list ap; + va_start(ap,mesg); + g_log(G_LOG_DOMAIN,G_LOG_LEVEL_MESSAGE,mesg,&ap); + va_end(ap); +} +#endif --- ./configure Thu Mar 29 02:53:56 2001 +++ ../gnome-pim-1.4.0/./configure Sun Sep 23 20:16:24 2001 @@ -3856,11 +3856,12 @@ if test x$piversion_include = x; then + : This code assumes it knows where CC found pi-version.h. It is wrong. piversion_include="pi-version.h" - pi_version=`cat $incdir/pi-version.h|grep PILOT_LINK_VERSION|sed 's/#define PILOT_LINK_VERSION \([[0-9]]*\)/\1/'` - pi_major=`cat $incdir/pi-version.h|grep PILOT_LINK_MAJOR|sed 's/#define PILOT_LINK_MAJOR \([[0-9]]*\)/\1/'` - pi_minor=`cat $incdir/pi-version.h|grep PILOT_LINK_MINOR|sed 's/#define PILOT_LINK_MINOR \([[0-9]]*\)/\1/'` - pi_patch=`cat $incdir/pi-version.h|grep PILOT_LINK_PATCH|sed 's/#define PILOT_LINK_PATCH \"\(.*\)\"/\1/'` + pi_version=`cat ${ROOT}$prefix/include/pi-version.h|grep PILOT_LINK_VERSION|sed 's/#define PILOT_LINK_VERSION \([[0-9]]*\)/\1/'` + pi_major=`cat ${ROOT}$prefix/include/pi-version.h|grep PILOT_LINK_MAJOR|sed 's/#define PILOT_LINK_MAJOR \([[0-9]]*\)/\1/'` + pi_minor=`cat ${ROOT}$prefix/include/pi-version.h|grep PILOT_LINK_MINOR|sed 's/#define PILOT_LINK_MINOR \([[0-9]]*\)/\1/'` + pi_patch=`cat ${ROOT}$prefix/include/pi-version.h|grep PILOT_LINK_PATCH|sed 's/#define PILOT_LINK_PATCH \"\(.*\)\"/\1/'` fi PILOT_LINK_VERSION="$pi_version.$pi_major.$pi_minor$pi_patch"