author | eilers <eilers> | 2002-10-22 09:07:07 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-10-22 09:07:07 (UTC) |
commit | bbb2c5fee87baa345ff5c16404204054442f5c11 (patch) (unidiff) | |
tree | 7a61b3afc81c9c3d96bfe12e82689843bf58d972 | |
parent | 896bea1ee64705bfc8753d7b3d1d51fddf43efaf (diff) | |
download | opie-bbb2c5fee87baa345ff5c16404204054442f5c11.zip opie-bbb2c5fee87baa345ff5c16404204054442f5c11.tar.gz opie-bbb2c5fee87baa345ff5c16404204054442f5c11.tar.bz2 |
fixing incompatibility to orignal sharp rom
-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 | |||
@@ -1114,202 +1114,207 @@ static void writeValue(OFile *fp, VObject *o, unsigned long size) | |||
1114 | char buf[16]; | 1114 | char buf[16]; |
1115 | sprintf(buf,"%lu", LONG_VALUE_OF(o)); | 1115 | sprintf(buf,"%lu", LONG_VALUE_OF(o)); |
1116 | appendsOFile(fp,buf); | 1116 | appendsOFile(fp,buf); |
1117 | break; | 1117 | break; |
1118 | } | 1118 | } |
1119 | case VCVT_RAW: { | 1119 | case VCVT_RAW: { |
1120 | appendcOFile(fp,'\n'); | 1120 | appendcOFile(fp,'\n'); |
1121 | writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size); | 1121 | writeBase64(fp,(unsigned char*)(ANY_VALUE_OF(o)),size); |
1122 | break; | 1122 | break; |
1123 | } | 1123 | } |
1124 | case VCVT_VOBJECT: | 1124 | case VCVT_VOBJECT: |
1125 | appendcOFile(fp,'\n'); | 1125 | appendcOFile(fp,'\n'); |
1126 | writeVObject_(fp,VOBJECT_VALUE_OF(o)); | 1126 | writeVObject_(fp,VOBJECT_VALUE_OF(o)); |
1127 | break; | 1127 | break; |
1128 | } | 1128 | } |
1129 | } | 1129 | } |
1130 | 1130 | ||
1131 | static void writeAttrValue(OFile *fp, VObject *o) | 1131 | static void writeAttrValue(OFile *fp, VObject *o) |
1132 | { | 1132 | { |
1133 | if (NAME_OF(o)) { | 1133 | if (NAME_OF(o)) { |
1134 | struct PreDefProp *pi; | 1134 | struct PreDefProp *pi; |
1135 | pi = lookupPropInfo(NAME_OF(o)); | 1135 | pi = lookupPropInfo(NAME_OF(o)); |
1136 | if (pi && ((pi->flags & PD_INTERNAL) != 0)) return; | 1136 | if (pi && ((pi->flags & PD_INTERNAL) != 0)) return; |
1137 | if ( includesUnprintable(o) ) { | 1137 | if ( includesUnprintable(o) ) { |
1138 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); | 1138 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); |
1139 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); | 1139 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); |
1140 | } | 1140 | } |
1141 | appendcOFile(fp,';'); | 1141 | appendcOFile(fp,';'); |
1142 | appendsOFile(fp,NAME_OF(o)); | 1142 | appendsOFile(fp,NAME_OF(o)); |
1143 | } | 1143 | } |
1144 | else | 1144 | else |
1145 | appendcOFile(fp,';'); | 1145 | appendcOFile(fp,';'); |
1146 | if (VALUE_TYPE(o)) { | 1146 | if (VALUE_TYPE(o)) { |
1147 | appendcOFile(fp,'='); | 1147 | appendcOFile(fp,'='); |
1148 | writeValue(fp,o,0); | 1148 | writeValue(fp,o,0); |
1149 | } | 1149 | } |
1150 | } | 1150 | } |
1151 | 1151 | ||
1152 | static void writeGroup(OFile *fp, VObject *o) | 1152 | static void writeGroup(OFile *fp, VObject *o) |
1153 | { | 1153 | { |
1154 | char buf1[256]; | 1154 | char buf1[256]; |
1155 | char buf2[256]; | 1155 | char buf2[256]; |
1156 | strcpy(buf1,NAME_OF(o)); | 1156 | strcpy(buf1,NAME_OF(o)); |
1157 | while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) { | 1157 | while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) { |
1158 | strcpy(buf2,STRINGZ_VALUE_OF(o)); | 1158 | strcpy(buf2,STRINGZ_VALUE_OF(o)); |
1159 | strcat(buf2,"."); | 1159 | strcat(buf2,"."); |
1160 | strcat(buf2,buf1); | 1160 | strcat(buf2,buf1); |
1161 | strcpy(buf1,buf2); | 1161 | strcpy(buf1,buf2); |
1162 | } | 1162 | } |
1163 | appendsOFile(fp,buf1); | 1163 | appendsOFile(fp,buf1); |
1164 | } | 1164 | } |
1165 | 1165 | ||
1166 | static int inList(const char **list, const char *s) | 1166 | static int inList(const char **list, const char *s) |
1167 | { | 1167 | { |
1168 | if (list == 0) return 0; | 1168 | if (list == 0) return 0; |
1169 | while (*list) { | 1169 | while (*list) { |
1170 | if (qstricmp(*list,s) == 0) return 1; | 1170 | if (qstricmp(*list,s) == 0) return 1; |
1171 | list++; | 1171 | list++; |
1172 | } | 1172 | } |
1173 | return 0; | 1173 | return 0; |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | static void writeProp(OFile *fp, VObject *o) | 1176 | static void writeProp(OFile *fp, VObject *o) |
1177 | { | 1177 | { |
1178 | if (NAME_OF(o)) { | 1178 | if (NAME_OF(o)) { |
1179 | struct PreDefProp *pi; | 1179 | struct PreDefProp *pi; |
1180 | VObjectIterator t; | 1180 | VObjectIterator t; |
1181 | const char **fields_ = 0; | 1181 | const char **fields_ = 0; |
1182 | pi = lookupPropInfo(NAME_OF(o)); | 1182 | pi = lookupPropInfo(NAME_OF(o)); |
1183 | if (pi && ((pi->flags & PD_BEGIN) != 0)) { | 1183 | if (pi && ((pi->flags & PD_BEGIN) != 0)) { |
1184 | writeVObject_(fp,o); | 1184 | writeVObject_(fp,o); |
1185 | return; | 1185 | return; |
1186 | } | 1186 | } |
1187 | if (isAPropertyOf(o,VCGroupingProp)) | 1187 | if (isAPropertyOf(o,VCGroupingProp)) |
1188 | writeGroup(fp,o); | 1188 | writeGroup(fp,o); |
1189 | else | 1189 | else |
1190 | appendsOFile(fp,NAME_OF(o)); | 1190 | appendsOFile(fp,NAME_OF(o)); |
1191 | if (pi) fields_ = pi->fields; | 1191 | if (pi) fields_ = pi->fields; |
1192 | initPropIterator(&t,o); | 1192 | initPropIterator(&t,o); |
1193 | while (moreIteration(&t)) { | 1193 | while (moreIteration(&t)) { |
1194 | const char *s; | 1194 | const char *s; |
1195 | VObject *eachProp = nextVObject(&t); | 1195 | VObject *eachProp = nextVObject(&t); |
1196 | s = NAME_OF(eachProp); | 1196 | s = NAME_OF(eachProp); |
1197 | if (qstricmp(VCGroupingProp,s) && !inList(fields_,s)) | 1197 | if (qstricmp(VCGroupingProp,s) && !inList(fields_,s)) |
1198 | writeAttrValue(fp,eachProp); | 1198 | writeAttrValue(fp,eachProp); |
1199 | } | 1199 | } |
1200 | if (fields_) { | 1200 | if (fields_) { |
1201 | int i = 0, n = 0; | 1201 | int i = 0, n = 0; |
1202 | const char** fields = fields_; | 1202 | const char** fields = fields_; |
1203 | /* output prop as fields */ | 1203 | /* output prop as fields */ |
1204 | bool printable = TRUE; | 1204 | bool printable = TRUE; |
1205 | while (*fields && printable) { | 1205 | while (*fields && printable) { |
1206 | VObject *t = isAPropertyOf(o,*fields); | 1206 | VObject *t = isAPropertyOf(o,*fields); |
1207 | if (includesUnprintable(t)) | 1207 | if (includesUnprintable(t)) |
1208 | printable = FALSE; | 1208 | printable = FALSE; |
1209 | fields++; | 1209 | fields++; |
1210 | } | 1210 | } |
1211 | fields = fields_; | 1211 | fields = fields_; |
1212 | if (!printable) { | 1212 | if (!printable) { |
1213 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); | 1213 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); |
1214 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); | 1214 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); |
1215 | } | 1215 | } |
1216 | appendcOFile(fp,':'); | 1216 | appendcOFile(fp,':'); |
1217 | while (*fields) { | 1217 | while (*fields) { |
1218 | VObject *t = isAPropertyOf(o,*fields); | 1218 | VObject *t = isAPropertyOf(o,*fields); |
1219 | i++; | 1219 | i++; |
1220 | if (t) n = i; | 1220 | if (t) n = i; |
1221 | fields++; | 1221 | fields++; |
1222 | } | 1222 | } |
1223 | fields = fields_; | 1223 | fields = fields_; |
1224 | for (i=0;i<n;i++) { | 1224 | for (i=0;i<n;i++) { |
1225 | writeValue(fp,isAPropertyOf(o,*fields),0); | 1225 | writeValue(fp,isAPropertyOf(o,*fields),0); |
1226 | fields++; | 1226 | fields++; |
1227 | if (i<(n-1)) appendcOFile(fp,';'); | 1227 | if (i<(n-1)) appendcOFile(fp,';'); |
1228 | } | 1228 | } |
1229 | } | 1229 | } |
1230 | } | 1230 | } |
1231 | 1231 | ||
1232 | 1232 | ||
1233 | if (VALUE_TYPE(o)) { | 1233 | if (VALUE_TYPE(o)) { |
1234 | if ( includesUnprintable(o) ) { | 1234 | if ( includesUnprintable(o) ) { |
1235 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); | 1235 | appendsOFile(fp, ";" VCEncodingProp "=" VCQuotedPrintableProp); |
1236 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); | 1236 | appendsOFile(fp, ";" VCCharSetProp "=" "UTF-8"); |
1237 | } | 1237 | } |
1238 | unsigned long size = 0; | 1238 | unsigned long size = 0; |
1239 | VObject *p = isAPropertyOf(o,VCDataSizeProp); | 1239 | VObject *p = isAPropertyOf(o,VCDataSizeProp); |
1240 | if (p) size = LONG_VALUE_OF(p); | 1240 | if (p) size = LONG_VALUE_OF(p); |
1241 | appendcOFile(fp,':'); | 1241 | appendcOFile(fp,':'); |
1242 | writeValue(fp,o,size); | 1242 | writeValue(fp,o,size); |
1243 | } | 1243 | } |
1244 | 1244 | ||
1245 | appendcOFile(fp,'\n'); | 1245 | appendcOFile(fp,'\n'); |
1246 | } | 1246 | } |
1247 | 1247 | ||
1248 | static void writeVObject_(OFile *fp, VObject *o) | 1248 | static void writeVObject_(OFile *fp, VObject *o) |
1249 | { | 1249 | { |
1250 | if (NAME_OF(o)) { | 1250 | if (NAME_OF(o)) { |
1251 | struct PreDefProp *pi; | 1251 | struct PreDefProp *pi; |
1252 | pi = lookupPropInfo(NAME_OF(o)); | 1252 | pi = lookupPropInfo(NAME_OF(o)); |
1253 | 1253 | ||
1254 | if (pi && ((pi->flags & PD_BEGIN) != 0)) { | 1254 | if (pi && ((pi->flags & PD_BEGIN) != 0)) { |
1255 | VObjectIterator t; | 1255 | VObjectIterator t; |
1256 | const char *begin = NAME_OF(o); | 1256 | const char *begin = NAME_OF(o); |
1257 | appendsOFile(fp,"BEGIN:"); | 1257 | appendsOFile(fp,"BEGIN:"); |
1258 | appendsOFile(fp,begin); | 1258 | appendsOFile(fp,begin); |
1259 | appendcOFile(fp,'\n'); | 1259 | appendcOFile(fp,'\n'); |
1260 | initPropIterator(&t,o); | 1260 | initPropIterator(&t,o); |
1261 | while (moreIteration(&t)) { | 1261 | while (moreIteration(&t)) { |
1262 | VObject *eachProp = nextVObject(&t); | 1262 | VObject *eachProp = nextVObject(&t); |
1263 | writeProp(fp, eachProp); | 1263 | writeProp(fp, eachProp); |
1264 | } | 1264 | } |
1265 | appendsOFile(fp,"END:"); | 1265 | appendsOFile(fp,"END:"); |
1266 | appendsOFile(fp,begin); | 1266 | appendsOFile(fp,begin); |
1267 | appendsOFile(fp,"\n\n"); | 1267 | appendsOFile(fp,"\n\n"); |
1268 | } | 1268 | } |
1269 | } | 1269 | } |
1270 | } | 1270 | } |
1271 | 1271 | ||
1272 | void writeVObject(FILE *fp, VObject *o) | 1272 | void writeVObject(FILE *fp, VObject *o) |
1273 | { | 1273 | { |
1274 | OFile ofp; | 1274 | OFile ofp; |
1275 | // ##### | 1275 | // ##### |
1276 | //_setmode(_fileno(fp), _O_BINARY); | 1276 | //_setmode(_fileno(fp), _O_BINARY); |
1277 | initOFile(&ofp,fp); | 1277 | initOFile(&ofp,fp); |
1278 | writeVObject_(&ofp,o); | 1278 | writeVObject_(&ofp,o); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o) | 1281 | DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o) |
1282 | { | 1282 | { |
1283 | QFileDirect f( fname); | 1283 | QFileDirect f( fname); |
1284 | if ( !f.open( IO_WriteOnly ) ) { | 1284 | if ( !f.open( IO_WriteOnly ) ) { |
1285 | qWarning("Unable to open vobject write %s", fname); | 1285 | qWarning("Unable to open vobject write %s", fname); |
1286 | return; | 1286 | return; |
1287 | } | 1287 | } |
1288 | 1288 | ||
1289 | writeVObject( f.directHandle(),o ); | 1289 | writeVObject( f.directHandle(),o ); |
1290 | } | 1290 | } |
1291 | 1291 | ||
1292 | DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list) | 1292 | DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list) |
1293 | { | 1293 | { |
1294 | QFileDirect f( fname); | 1294 | QFileDirect f( fname); |
1295 | if ( !f.open( IO_WriteOnly ) ) { | 1295 | if ( !f.open( IO_WriteOnly ) ) { |
1296 | qWarning("Unable to open vobject write %s", fname); | 1296 | qWarning("Unable to open vobject write %s", fname); |
1297 | return; | 1297 | return; |
1298 | } | 1298 | } |
1299 | 1299 | ||
1300 | while (list) { | 1300 | while (list) { |
1301 | writeVObject(f.directHandle(),list); | 1301 | writeVObject(f.directHandle(),list); |
1302 | list = nextVObjectInList(list); | 1302 | list = nextVObjectInList(list); |
1303 | } | 1303 | } |
1304 | } | 1304 | } |
1305 | 1305 | ||
1306 | #ifndef __SHARP_COMP_ | ||
1307 | |||
1308 | // This function is not available in the Sharp ROM for SL 5500 ! | ||
1309 | // Therefore I have to move it into the header file.. (se) | ||
1310 | |||
1306 | DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) | 1311 | DLLEXPORT(const char *) vObjectTypeInfo(VObject *o) |
1307 | { | 1312 | { |
1308 | const char *type = vObjectName( o ); | 1313 | const char *type = vObjectName( o ); |
1309 | if ( strcmp( type, "TYPE" ) == 0 ) | 1314 | if ( strcmp( type, "TYPE" ) == 0 ) |
1310 | type = vObjectStringZValue( o ); | 1315 | type = vObjectStringZValue( o ); |
1311 | return type; | 1316 | return type; |
1312 | } | 1317 | } |
1313 | 1318 | #endif | |
1314 | 1319 | ||
1315 | // end of source file vobject.c | 1320 | // 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 | |||
@@ -209,198 +209,213 @@ For example: | |||
209 | #define VCNoteProp "NOTE" | 209 | #define VCNoteProp "NOTE" |
210 | #define VCOrgNameProp "ORGNAME" | 210 | #define VCOrgNameProp "ORGNAME" |
211 | #define VCOrgProp "ORG" | 211 | #define VCOrgProp "ORG" |
212 | #define VCOrgUnit2Prop "OUN2" | 212 | #define VCOrgUnit2Prop "OUN2" |
213 | #define VCOrgUnit3Prop "OUN3" | 213 | #define VCOrgUnit3Prop "OUN3" |
214 | #define VCOrgUnit4Prop "OUN4" | 214 | #define VCOrgUnit4Prop "OUN4" |
215 | #define VCOrgUnitProp "OUN" | 215 | #define VCOrgUnitProp "OUN" |
216 | #define VCPagerProp "PAGER" | 216 | #define VCPagerProp "PAGER" |
217 | #define VCPAlarmProp "PALARM" | 217 | #define VCPAlarmProp "PALARM" |
218 | #define VCParcelProp "PARCEL" | 218 | #define VCParcelProp "PARCEL" |
219 | #define VCPartProp "PART" | 219 | #define VCPartProp "PART" |
220 | #define VCPCMProp "PCM" | 220 | #define VCPCMProp "PCM" |
221 | #define VCPDFProp "PDF" | 221 | #define VCPDFProp "PDF" |
222 | #define VCPGPProp "PGP" | 222 | #define VCPGPProp "PGP" |
223 | #define VCPhotoProp "PHOTO" | 223 | #define VCPhotoProp "PHOTO" |
224 | #define VCPICTProp "PICT" | 224 | #define VCPICTProp "PICT" |
225 | #define VCPMBProp "PMB" | 225 | #define VCPMBProp "PMB" |
226 | #define VCPostalBoxProp "BOX" | 226 | #define VCPostalBoxProp "BOX" |
227 | #define VCPostalCodeProp "PC" | 227 | #define VCPostalCodeProp "PC" |
228 | #define VCPostalProp "POSTAL" | 228 | #define VCPostalProp "POSTAL" |
229 | #define VCPowerShareProp "POWERSHARE" | 229 | #define VCPowerShareProp "POWERSHARE" |
230 | #define VCPreferredProp "PREF" | 230 | #define VCPreferredProp "PREF" |
231 | #define VCPriorityProp "PRIORITY" | 231 | #define VCPriorityProp "PRIORITY" |
232 | #define VCProcedureNameProp "PROCEDURENAME" | 232 | #define VCProcedureNameProp "PROCEDURENAME" |
233 | #define VCProdIdProp "PRODID" | 233 | #define VCProdIdProp "PRODID" |
234 | #define VCProdigyProp "PRODIGY" | 234 | #define VCProdigyProp "PRODIGY" |
235 | #define VCPronunciationProp "SOUND" | 235 | #define VCPronunciationProp "SOUND" |
236 | #define VCPSProp "PS" | 236 | #define VCPSProp "PS" |
237 | #define VCPublicKeyProp "KEY" | 237 | #define VCPublicKeyProp "KEY" |
238 | #define VCQPProp "QP" | 238 | #define VCQPProp "QP" |
239 | #define VCQuickTimeProp "QTIME" | 239 | #define VCQuickTimeProp "QTIME" |
240 | #define VCQuotedPrintableProp"QUOTED-PRINTABLE" | 240 | #define VCQuotedPrintableProp"QUOTED-PRINTABLE" |
241 | #define VCRDateProp "RDATE" | 241 | #define VCRDateProp "RDATE" |
242 | #define VCRegionProp "R" | 242 | #define VCRegionProp "R" |
243 | #define VCRelatedToProp "RELATED-TO" | 243 | #define VCRelatedToProp "RELATED-TO" |
244 | #define VCRepeatCountProp "REPEATCOUNT" | 244 | #define VCRepeatCountProp "REPEATCOUNT" |
245 | #define VCResourcesProp "RESOURCES" | 245 | #define VCResourcesProp "RESOURCES" |
246 | #define VCRNumProp "RNUM" | 246 | #define VCRNumProp "RNUM" |
247 | #define VCRoleProp "ROLE" | 247 | #define VCRoleProp "ROLE" |
248 | #define VCRRuleProp "RRULE" | 248 | #define VCRRuleProp "RRULE" |
249 | #define VCRSVPProp "RSVP" | 249 | #define VCRSVPProp "RSVP" |
250 | #define VCRunTimeProp "RUNTIME" | 250 | #define VCRunTimeProp "RUNTIME" |
251 | #define VCSequenceProp "SEQUENCE" | 251 | #define VCSequenceProp "SEQUENCE" |
252 | #define VCSnoozeTimeProp "SNOOZETIME" | 252 | #define VCSnoozeTimeProp "SNOOZETIME" |
253 | #define VCStartProp "START" | 253 | #define VCStartProp "START" |
254 | #define VCStatusProp "STATUS" | 254 | #define VCStatusProp "STATUS" |
255 | #define VCStreetAddressProp "STREET" | 255 | #define VCStreetAddressProp "STREET" |
256 | #define VCSubTypeProp "SUBTYPE" | 256 | #define VCSubTypeProp "SUBTYPE" |
257 | #define VCSummaryProp "SUMMARY" | 257 | #define VCSummaryProp "SUMMARY" |
258 | #define VCTelephoneProp "TEL" | 258 | #define VCTelephoneProp "TEL" |
259 | #define VCTIFFProp "TIFF" | 259 | #define VCTIFFProp "TIFF" |
260 | #define VCTimeZoneProp "TZ" | 260 | #define VCTimeZoneProp "TZ" |
261 | #define VCTitleProp "TITLE" | 261 | #define VCTitleProp "TITLE" |
262 | #define VCTLXProp "TLX" | 262 | #define VCTLXProp "TLX" |
263 | #define VCTodoProp "VTODO" | 263 | #define VCTodoProp "VTODO" |
264 | #define VCTranspProp "TRANSP" | 264 | #define VCTranspProp "TRANSP" |
265 | #define VCUniqueStringProp "UID" | 265 | #define VCUniqueStringProp "UID" |
266 | #define VCURLProp "URL" | 266 | #define VCURLProp "URL" |
267 | #define VCURLValueProp "URLVAL" | 267 | #define VCURLValueProp "URLVAL" |
268 | #define VCValueProp "VALUE" | 268 | #define VCValueProp "VALUE" |
269 | #define VCVersionProp "VERSION" | 269 | #define VCVersionProp "VERSION" |
270 | #define VCVideoProp "VIDEO" | 270 | #define VCVideoProp "VIDEO" |
271 | #define VCVoiceProp "VOICE" | 271 | #define VCVoiceProp "VOICE" |
272 | #define VCWAVEProp "WAVE" | 272 | #define VCWAVEProp "WAVE" |
273 | #define VCWMFProp "WMF" | 273 | #define VCWMFProp "WMF" |
274 | #define VCWorkProp "WORK" | 274 | #define VCWorkProp "WORK" |
275 | #define VCX400Prop "X400" | 275 | #define VCX400Prop "X400" |
276 | #define VCX509Prop "X509" | 276 | #define VCX509Prop "X509" |
277 | #define VCXRuleProp "XRULE" | 277 | #define VCXRuleProp "XRULE" |
278 | 278 | ||
279 | 279 | ||
280 | typedef struct VObject VObject; | 280 | typedef struct VObject VObject; |
281 | 281 | ||
282 | typedef struct VObjectIterator { | 282 | typedef struct VObjectIterator { |
283 | VObject* start; | 283 | VObject* start; |
284 | VObject* next; | 284 | VObject* next; |
285 | } VObjectIterator; | 285 | } VObjectIterator; |
286 | 286 | ||
287 | extern DLLEXPORT(VObject*) newVObject(const char *id); | 287 | extern DLLEXPORT(VObject*) newVObject(const char *id); |
288 | extern DLLEXPORT(void) deleteVObject(VObject *p); | 288 | extern DLLEXPORT(void) deleteVObject(VObject *p); |
289 | extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); | 289 | extern DLLEXPORT(char*) dupStr(const char *s, unsigned int size); |
290 | extern DLLEXPORT(void) deleteStr(const char *p); | 290 | extern DLLEXPORT(void) deleteStr(const char *p); |
291 | extern DLLEXPORT(void) unUseStr(const char *s); | 291 | extern DLLEXPORT(void) unUseStr(const char *s); |
292 | 292 | ||
293 | extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); | 293 | extern DLLEXPORT(void) setVObjectName(VObject *o, const char* id); |
294 | extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); | 294 | extern DLLEXPORT(void) setVObjectStringZValue(VObject *o, const char *s); |
295 | extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); | 295 | extern DLLEXPORT(void) setVObjectStringZValue_(VObject *o, const char *s); |
296 | extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); | 296 | extern DLLEXPORT(void) setVObjectIntegerValue(VObject *o, unsigned int i); |
297 | extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); | 297 | extern DLLEXPORT(void) setVObjectLongValue(VObject *o, unsigned long l); |
298 | extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); | 298 | extern DLLEXPORT(void) setVObjectAnyValue(VObject *o, void *t); |
299 | extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); | 299 | extern DLLEXPORT(VObject*) setValueWithSize(VObject *prop, void *val, unsigned int size); |
300 | extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); | 300 | extern DLLEXPORT(VObject*) setValueWithSize_(VObject *prop, void *val, unsigned int size); |
301 | 301 | ||
302 | extern DLLEXPORT(const char*) vObjectName(VObject *o); | 302 | extern DLLEXPORT(const char*) vObjectName(VObject *o); |
303 | extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); | 303 | extern DLLEXPORT(const char*) vObjectStringZValue(VObject *o); |
304 | extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); | 304 | extern DLLEXPORT(unsigned int) vObjectIntegerValue(VObject *o); |
305 | extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); | 305 | extern DLLEXPORT(unsigned long) vObjectLongValue(VObject *o); |
306 | extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); | 306 | extern DLLEXPORT(void*) vObjectAnyValue(VObject *o); |
307 | extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); | 307 | extern DLLEXPORT(VObject*) vObjectVObjectValue(VObject *o); |
308 | extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); | 308 | extern DLLEXPORT(void) setVObjectVObjectValue(VObject *o, VObject *p); |
309 | 309 | ||
310 | extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); | 310 | extern DLLEXPORT(VObject*) addVObjectProp(VObject *o, VObject *p); |
311 | extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); | 311 | extern DLLEXPORT(VObject*) addProp(VObject *o, const char *id); |
312 | extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); | 312 | extern DLLEXPORT(VObject*) addProp_(VObject *o, const char *id); |
313 | extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); | 313 | extern DLLEXPORT(VObject*) addPropValue(VObject *o, const char *p, const char *v); |
314 | extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); | 314 | extern DLLEXPORT(VObject*) addPropSizedValue_(VObject *o, const char *p, const char *v, unsigned int size); |
315 | extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); | 315 | extern DLLEXPORT(VObject*) addPropSizedValue(VObject *o, const char *p, const char *v, unsigned int size); |
316 | extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); | 316 | extern DLLEXPORT(VObject*) addGroup(VObject *o, const char *g); |
317 | extern DLLEXPORT(void) addList(VObject **o, VObject *p); | 317 | extern DLLEXPORT(void) addList(VObject **o, VObject *p); |
318 | 318 | ||
319 | extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); | 319 | extern DLLEXPORT(VObject*) isAPropertyOf(VObject *o, const char *id); |
320 | 320 | ||
321 | extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); | 321 | extern DLLEXPORT(VObject*) nextVObjectInList(VObject *o); |
322 | extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); | 322 | extern DLLEXPORT(void) initPropIterator(VObjectIterator *i, VObject *o); |
323 | extern DLLEXPORT(int) moreIteration(VObjectIterator *i); | 323 | extern DLLEXPORT(int) moreIteration(VObjectIterator *i); |
324 | extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); | 324 | extern DLLEXPORT(VObject*) nextVObject(VObjectIterator *i); |
325 | 325 | ||
326 | extern DLLEXPORT(const char*) lookupStr(const char *s); | 326 | extern DLLEXPORT(const char*) lookupStr(const char *s); |
327 | extern DLLEXPORT(void) cleanStrTbl(); | 327 | extern DLLEXPORT(void) cleanStrTbl(); |
328 | 328 | ||
329 | extern DLLEXPORT(void) cleanVObject(VObject *o); | 329 | extern DLLEXPORT(void) cleanVObject(VObject *o); |
330 | extern DLLEXPORT(void) cleanVObjects(VObject *list); | 330 | extern DLLEXPORT(void) cleanVObjects(VObject *list); |
331 | 331 | ||
332 | extern DLLEXPORT(const char*) lookupProp(const char* str); | 332 | extern DLLEXPORT(const char*) lookupProp(const char* str); |
333 | extern DLLEXPORT(const char*) lookupProp_(const char* str); | 333 | extern DLLEXPORT(const char*) lookupProp_(const char* str); |
334 | 334 | ||
335 | extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); | 335 | extern DLLEXPORT(void) writeVObjectToFile(char *fname, VObject *o); |
336 | extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); | 336 | extern DLLEXPORT(void) writeVObjectsToFile(char *fname, VObject *list); |
337 | 337 | ||
338 | extern DLLEXPORT(int) vObjectValueType(VObject *o); | 338 | extern DLLEXPORT(int) vObjectValueType(VObject *o); |
339 | 339 | ||
340 | /* return type of vObjectValueType: */ | 340 | /* return type of vObjectValueType: */ |
341 | #define VCVT_NOVALUE0 | 341 | #define VCVT_NOVALUE0 |
342 | /* if the VObject has no value associated with it. */ | 342 | /* if the VObject has no value associated with it. */ |
343 | #define VCVT_STRINGZ1 | 343 | #define VCVT_STRINGZ1 |
344 | /* if the VObject has value set by setVObjectStringZValue. */ | 344 | /* if the VObject has value set by setVObjectStringZValue. */ |
345 | #define VCVT_UINT 2 | 345 | #define VCVT_UINT 2 |
346 | /* if the VObject has value set by setVObjectIntegerValue. */ | 346 | /* if the VObject has value set by setVObjectIntegerValue. */ |
347 | #define VCVT_ULONG 3 | 347 | #define VCVT_ULONG 3 |
348 | /* if the VObject has value set by setVObjectLongValue. */ | 348 | /* if the VObject has value set by setVObjectLongValue. */ |
349 | #define VCVT_RAW 4 | 349 | #define VCVT_RAW 4 |
350 | /* if the VObject has value set by setVObjectAnyValue. */ | 350 | /* if the VObject has value set by setVObjectAnyValue. */ |
351 | #define VCVT_VOBJECT5 | 351 | #define VCVT_VOBJECT5 |
352 | /* if the VObject has value set by setVObjectVObjectValue. */ | 352 | /* if the VObject has value set by setVObjectVObjectValue. */ |
353 | 353 | ||
354 | extern const char** fieldedProp; | 354 | extern const char** fieldedProp; |
355 | 355 | ||
356 | /*************************************************** | 356 | /*************************************************** |
357 | * The methods below are implemented in vcc.c (generated from vcc.y ) | 357 | * The methods below are implemented in vcc.c (generated from vcc.y ) |
358 | ***************************************************/ | 358 | ***************************************************/ |
359 | 359 | ||
360 | /* NOTE regarding printVObject and writeVObject | 360 | /* NOTE regarding printVObject and writeVObject |
361 | 361 | ||
362 | The functions below are not exported from the DLL because they | 362 | The functions below are not exported from the DLL because they |
363 | take a FILE* as a parameter, which cannot be passed across a DLL | 363 | take a FILE* as a parameter, which cannot be passed across a DLL |
364 | interface (at least that is my experience). Instead you can use | 364 | interface (at least that is my experience). Instead you can use |
365 | their companion functions which take file names or pointers | 365 | their companion functions which take file names or pointers |
366 | to memory. However, if you are linking this code into | 366 | to memory. However, if you are linking this code into |
367 | your build directly then you may find them a more convenient API | 367 | your build directly then you may find them a more convenient API |
368 | and you can go ahead and use them. If you try to use them with | 368 | and you can go ahead and use them. If you try to use them with |
369 | the DLL LIB you will get a link error. | 369 | the DLL LIB you will get a link error. |
370 | */ | 370 | */ |
371 | extern void writeVObject(FILE *fp, VObject *o); | 371 | extern void writeVObject(FILE *fp, VObject *o); |
372 | 372 | ||
373 | 373 | ||
374 | 374 | ||
375 | typedef void (*MimeErrorHandler)(char *); | 375 | typedef void (*MimeErrorHandler)(char *); |
376 | 376 | ||
377 | extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler); | 377 | extern DLLEXPORT(void) registerMimeErrorHandler(MimeErrorHandler); |
378 | 378 | ||
379 | extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len); | 379 | extern DLLEXPORT(VObject*) Parse_MIME(const char *input, unsigned long len); |
380 | extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname); | 380 | extern DLLEXPORT(VObject*) Parse_MIME_FromFileName(char* fname); |
381 | 381 | ||
382 | 382 | ||
383 | /* NOTE regarding Parse_MIME_FromFile | 383 | /* NOTE regarding Parse_MIME_FromFile |
384 | The function above, Parse_MIME_FromFile, comes in two flavors, | 384 | The function above, Parse_MIME_FromFile, comes in two flavors, |
385 | neither of which is exported from the DLL. Each version takes | 385 | neither of which is exported from the DLL. Each version takes |
386 | a CFile or FILE* as a parameter, neither of which can be | 386 | a CFile or FILE* as a parameter, neither of which can be |
387 | passed across a DLL interface (at least that is my experience). | 387 | passed across a DLL interface (at least that is my experience). |
388 | If you are linking this code into your build directly then | 388 | If you are linking this code into your build directly then |
389 | you may find them a more convenient API that the other flavors | 389 | you may find them a more convenient API that the other flavors |
390 | that take a file name. If you use them with the DLL LIB you | 390 | that take a file name. If you use them with the DLL LIB you |
391 | will get a link error. | 391 | will get a link error. |
392 | */ | 392 | */ |
393 | 393 | ||
394 | 394 | ||
395 | #if INCLUDEMFC | 395 | #if INCLUDEMFC |
396 | extern VObject* Parse_MIME_FromFile(CFile *file); | 396 | extern VObject* Parse_MIME_FromFile(CFile *file); |
397 | #else | 397 | #else |
398 | extern VObject* Parse_MIME_FromFile(FILE *file); | 398 | extern VObject* Parse_MIME_FromFile(FILE *file); |
399 | #endif | 399 | #endif |
400 | 400 | ||
401 | #define __SHARP_COMP_ | ||
402 | |||
403 | #ifndef __SHARP_COMP_ | ||
401 | extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); | 404 | extern DLLEXPORT(const char *) vObjectTypeInfo(VObject *o); |
402 | 405 | ||
406 | #else | ||
407 | // This function is not available in the Sharp ROM for SL 5500 ! | ||
408 | // Therefore I have to move it into the header file.. (se) | ||
409 | |||
410 | inline const char* vObjectTypeInfo(VObject *o) | ||
411 | { | ||
412 | const char *type = vObjectName( o ); | ||
413 | if ( strcmp( type, "TYPE" ) == 0 ) | ||
414 | type = vObjectStringZValue( o ); | ||
415 | return type; | ||
416 | } | ||
417 | #endif | ||
403 | 418 | ||
404 | #endif /* __VOBJECT_H__ */ | 419 | #endif /* __VOBJECT_H__ */ |
405 | 420 | ||
406 | 421 | ||