[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ann : CCard Parser (vCard/vCal)





On Wednesday, February 5, 2003, at 08:07 AM, J. David Boyd wrote:


I thought the '//' use of comments is C++, not C.


Some C compilers might accept them okay, but they aren't ANSI C, are they?

I believe that they are now.



I only mention this because I have used these (by mistake) on code that we
have compiled on SCO, HP-UX, AIX, and Solaris, and the only compiler that
accepted them in a C file was the SCO compiler (written by Microsoft).


Dave

----- Original Message -----
From: <lindsay@xxxxxxxxxxxxxx>
To: "vCard" <imc-vcard@xxxxxxx>
Sent: Tuesday, February 04, 2003 7:18 PM
Subject: Re: Ann : CCard Parser (vCard/vCal)



Are you sure it's in C? Looks an awful lot like C++.



The parser is C, the test program I posted which uses it is C++. If
compiled
into a dynamic library then most other languages should be able to use it
as well. Also I designed it for portability, its ANSI C.




From the header file (cardparser.h)



/*


Licensing : All code is under the Mozilla Public License 1.1 (MPL 1.1) as
specified in


license.txt

*/



#ifndef CARD_PARSER_H

#define CARD_PARSER_H



#ifdef __cplusplus

extern "C"

{

#endif



typedef char CARD_Char;

typedef void *CARD_Parser;



// setup & parsing

CARD_Parser CARD_ParserCreate(CARD_Char *encoding);

void CARD_ParserFree(CARD_Parser p);

int CARD_Parse(CARD_Parser p, const char *s, int len, int isFinal);



// user data

void CARD_SetUserData(CARD_Parser p, void *userData);

void *CARD_GetUserData(CARD_Parser p);



// handlers

typedef void (*CARD_PropHandler)(void *userData, const CARD_Char
*propname,
const CARD_Char **params);

typedef void (*CARD_DataHandler)(void *userData, const CARD_Char *data,
int
len);



// Set Handlers

void CARD_SetPropHandler(CARD_Parser p, CARD_PropHandler cardProp);

void CARD_SetDataHandler(CARD_Parser p, CARD_DataHandler cardData);



#ifdef __cplusplus

}

#endif





#endif