-rw-r--r-- | library/backend/vobject.cpp | 7 | ||||
-rw-r--r-- | library/backend/vobject_p.h | 15 |
2 files changed, 21 insertions, 1 deletions
diff --git a/library/backend/vobject.cpp b/library/backend/vobject.cpp index dab128e..2f22c20 100644 --- a/library/backend/vobject.cpp +++ b/library/backend/vobject.cpp @@ -922,394 +922,399 @@ stuff: else if (fp->alloc) { fp->limit = fp->limit + OFILE_REALLOC_SIZE; fp->s = (char *)realloc(fp->s,fp->limit); if (fp->s) goto stuff; } if (fp->alloc) free(fp->s); fp->s = 0; fp->fail = 1; } } static void appendcOFile(OFile *fp, char c) { if (c == '\n') { /* write out as <CR><LF> */ appendcOFile_(fp,0xd); appendcOFile_(fp,0xa); } else appendcOFile_(fp,c); } static void appendsOFile(OFile *fp, const char *s) { int i, slen; slen = strlen(s); for (i=0; i<slen; i++) { appendcOFile(fp,s[i]); } } #endif static void initOFile(OFile *fp, FILE *ofp) { fp->fp = ofp; fp->s = 0; fp->len = 0; fp->limit = 0; fp->alloc = 0; fp->fail = 0; } static int writeBase64(OFile *fp, unsigned char *s, long len) { long cur = 0; int i, numQuads = 0; unsigned long trip; unsigned char b; char quad[5]; #define MAXQUADS 16 quad[4] = 0; while (cur < len) { // collect the triplet of bytes into 'trip' trip = 0; for (i = 0; i < 3; i++) { b = (cur < len) ? *(s + cur) : 0; cur++; trip = trip << 8 | b; } // fill in 'quad' with the appropriate four characters for (i = 3; i >= 0; i--) { b = (unsigned char)(trip & 0x3F); trip = trip >> 6; if ((3 - i) < (cur - len)) quad[i] = '='; // pad char else if (b < 26) quad[i] = (char)b + 'A'; else if (b < 52) quad[i] = (char)(b - 26) + 'a'; else if (b < 62) quad[i] = (char)(b - 52) + '0'; else if (b == 62) quad[i] = '+'; else quad[i] = '/'; } // now output 'quad' with appropriate whitespace and line ending appendsOFile(fp, (numQuads == 0 ? " " : "")); appendsOFile(fp, quad); appendsOFile(fp, ((cur >= len)?"\n" :(numQuads==MAXQUADS-1?"\n" : ""))); numQuads = (numQuads + 1) % MAXQUADS; } appendcOFile(fp,'\n'); return 1; } static const char *replaceChar(unsigned char c) { if (c == '\n') { return "=0A=\n"; } else if ( (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c >= '\'' && c <= ')') || (c >= '+' && c <= '-') || (c == '/') || (c == '?') || (c == ' ')) { return 0; } static char trans[4]; trans[0] = '='; trans[3] = '\0'; int rem = c % 16; int div = c / 16; if (div < 10) trans[1] = '0' + div; else trans[1] = 'A' + (div - 10); if (rem < 10) trans[2] = '0' + rem; else trans[2] = 'A' + (rem - 10); return trans; } static void writeQPString(OFile *fp, const char *s) { /* only A-Z, 0-9 and "'" (ASCII code 39) "(" (ASCII code 40) ")" (ASCII code 41) "+" (ASCII code 43) "," (ASCII code 44) "-" (ASCII code 45) "/" (ASCII code 47) "?" (ASCII code 63) should remain un-encoded. '=' needs to be encoded as it is the escape character. ';' needs to be as it is a field separator. */ const char *p = s; while (*p) { const char *rep = replaceChar(*p); if (rep) appendsOFile(fp, rep); else appendcOFile(fp, *p); p++; } } static bool includesUnprintable(VObject *o) { if (o) { if (VALUE_TYPE(o) == VCVT_STRINGZ) { const char *p = STRINGZ_VALUE_OF(o); if (p) { while (*p) { if (replaceChar(*p)) return TRUE; p++; } } } } return FALSE; } static void writeVObject_(OFile *fp, VObject *o); static void writeValue(OFile *fp, VObject *o, unsigned long size) { if (o == 0) return; switch (VALUE_TYPE(o)) { case VCVT_STRINGZ: { writeQPString(fp, STRINGZ_VALUE_OF(o)); break; } case VCVT_UINT: { char buf[16]; sprintf(buf,"%u", INTEGER_VALUE_OF(o)); appendsOFile(fp,buf); break; } case VCVT_ULONG: { char buf[16]; sprintf(buf,"%lu", LONG_VALUE_OF(o)); appendsOFile(fp,buf); break; } case VCVT_RAW: { appendcOFile(fp,'\n'); writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size); break; } case VCVT_VOBJECT: appendcOFile(fp,'\n'); writeVObject_(fp,VOBJECT_VALUE_OF(o)); break; } } static void writeAttrValue(OFile *fp, VObject *o) { if (NAME_OF(o)) { struct PreDefProp *pi; pi = lookupPropInfo(NAME_OF(o)); if (pi && ((pi->flags & PD_INTERNAL) != 0)) return; if ( includesUnprintable(o) ) { appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); } appendcOFile(fp,';'); appendsOFile(fp,NAME_OF(o)); } else appendcOFile(fp,';'); if (VALUE_TYPE(o)) { appendcOFile(fp,'='); writeValue(fp,o,0); } } static void writeGroup(OFile *fp, VObject *o) { char buf1[256]; char buf2[256]; strcpy(buf1,NAME_OF(o)); while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) { strcpy(buf2,STRINGZ_VALUE_OF(o)); strcat(buf2,"."); strcat(buf2,buf1); strcpy(buf1,buf2); } appendsOFile(fp,buf1); } static int inList(const char **list, const char *s) { if (list == 0) return 0; while (*list) { if (qstricmp(*list,s) == 0) return 1; list++; } return 0; } static void writeProp(OFile *fp, VObject *o) { if (NAME_OF(o)) { struct PreDefProp *pi; VObjectIterator t; const char **fields_ = 0; pi = lookupPropInfo(NAME_OF(o)); if (pi && ((pi->flags & PD_BEGIN) != 0)) { writeVObject_(fp,o); return; } if (isAPropertyOf(o,VCGroupingProp)) writeGroup(fp,o); else appendsOFile(fp,NAME_OF(o)); if (pi) fields_ = pi->fields; initPropIterator(&t,o); while (moreIteration(&t)) { const char *s; VObject *eachProp = nextVObject(&t); s = NAME_OF(eachProp); if (qstricmp(VCGroupingProp,s) && !inList(fields_,s)) writeAttrValue(fp,eachProp); } if (fields_) { int i = 0, n = 0; const char** fields = fields_; /* output prop as fields */ bool printable = TRUE; while (*fields && printable) { VObject *t = isAPropertyOf(o,*fields); if (includesUnprintable(t)) printable = FALSE; fields++; } fields = fields_; if (!printable) { appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); } appendcOFile(fp,':'); while (*fields) { VObject *t = isAPropertyOf(o,*fields); i++; if (t) n = i; fields++; } fields = fields_; for (i=0;i<n;i++) { writeValue(fp,isAPropertyOf(o,*fields),0); fields++; if (i<(n-1)) appendcOFile(fp,';'); } } } if (VALUE_TYPE(o)) { if ( includesUnprintable(o) ) { appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); } unsigned long size = 0; VObject *p = isAPropertyOf(o,VCDataSizeProp); if (p) size = LONG_VALUE_OF(p); appendcOFile(fp,':'); writeValue(fp,o,size); } appendcOFile(fp,'\n'); } static void writeVObject_(OFile *fp, VObject *o) { if (NAME_OF(o)) { struct PreDefProp *pi; pi = lookupPropInfo(NAME_OF(o)); if (pi && ((pi->flags & PD_BEGIN) != 0)) { VObjectIterator t; const char *begin = NAME_OF(o); appendsOFile(fp,"BEGIN:"); appendsOFile(fp,begin); appendcOFile(fp,'\n'); initPropIterator(&t,o); while (moreIteration(&t)) { VObject *eachProp = nextVObject(&t); writeProp(fp, eachProp); } appendsOFile(fp,"END:"); appendsOFile(fp,begin); appendsOFile(fp,"\n\n"); } } } void writeVObject(FILE *fp, VObject *o) { OFile ofp; // ##### //_setmode(_fileno(fp), _O_BINARY); initOFile(&ofp,fp); writeVObject_(&ofp,o); } DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o) { QFileDirect f( fname); if ( !f.open( IO_WriteOnly ) ) { qWarning("Unable to open vobject write %s", fname); return; } writeVObject( f.directHandle(),o ); } DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list) { QFileDirect f( fname); if ( !f.open( IO_WriteOnly ) ) { qWarning("Unable to open vobject write %s", fname); return; } while (list) { writeVObject(f.directHandle(),list); list = nextVObjectInList(list); } } +#ifndef __SHARP_COMP_ + +// This function is not available in the Sharp ROM for SL 5500 ! +// Therefore I have to move it into the header file.. (se) + DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) { const char *type = vObjectName( o ); if ( strcmp( type, "TYPE" ) == 0 ) type = vObjectStringZValue( o ); return type; } - +#endif // end of source file vobject.c diff --git a/library/backend/vobject_p.h b/library/backend/vobject_p.h index 0d0a2a8..bab22bb 100644 --- a/library/backend/vobject_p.h +++ b/library/backend/vobject_p.h @@ -17,390 +17,405 @@ 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 */ // No tr() anywhere in this file #ifndef __VOBJECT_H__ #define __VOBJECT_H__ 1 #include <qstring.h> #define vCardClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCard" #define vCalendarClipboardFormat "+//ISBN 1-887687-00-9::versit::PDI//vCalendar" /* The above strings vCardClipboardFormat and vCalendarClipboardFormat are globally unique IDs which can be used to generate clipboard format ID's as per the requirements of a specific platform. For example, in Windows they are used as the parameter in a call to RegisterClipboardFormat. For example: CLIPFORMAT foo = RegisterClipboardFormat(vCardClipboardFormat); */ #define vCardMimeType "text/x-vCard" #define vCalendarMimeType "text/x-vCalendar" #undef DLLEXPORT #include <qglobal.h> #if defined(Q_WS_WIN) #define DLLEXPORT(t) __declspec(dllexport) t #else #define DLLEXPORT(t) t #endif #ifndef FALSE #define FALSE 0 #endif #ifndef TRUE #define TRUE 1 #endif #include <stdlib.h> #include <stdio.h> #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 "CHARSET" #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" 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) 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(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(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(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_UINT 2 /* if the VObject has value set by setVObjectIntegerValue. */ #define VCVT_ULONG 3 /* if the VObject has value set by setVObjectLongValue. */ #define VCVT_RAW 4 /* if the VObject has value set by setVObjectAnyValue. */ #define VCVT_VOBJECT 5 /* if the VObject has value set by setVObjectVObjectValue. */ extern const char** fieldedProp; /*************************************************** * The methods below are implemented in vcc.c (generated from vcc.y ) ***************************************************/ /* 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 writeVObject(FILE *fp, VObject *o); 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 +#define __SHARP_COMP_ + +#ifndef __SHARP_COMP_ extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); +#else +// This function is not available in the Sharp ROM for SL 5500 ! +// Therefore I have to move it into the header file.. (se) + +inline const char* vObjectTypeInfo(VObject *o) +{ + const char *type = vObjectName( o ); + if ( strcmp( type, "TYPE" ) == 0 ) + type = vObjectStringZValue( o ); + return type; +} +#endif #endif /* __VOBJECT_H__ */ |