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 | |||
@@ -1258,58 +1258,63 @@ static void writeVObject_(OFile *fp, VObject *o) | |||
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 | |||
@@ -353,54 +353,69 @@ extern DLLEXPORT(int) vObjectValueType(VObject *o); | |||
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 | ||