author | ecalot
<ecalot> 2005-12-16 17:03:51 UTC |
committer | ecalot
<ecalot> 2005-12-16 17:03:51 UTC |
parent | 912f7808cf9b078a8fda82a34da13e6b2a2a1e7e |
PR/src/Makefile | +1 | -1 |
PR/src/include/translate.h | +3 | -2 |
PR/src/lib/xml/search.c | +3 | -2 |
PR/src/lib/xml/tree.c | +3 | -2 |
PR/src/lib/xml/unknown.c | +3 | -2 |
diff --git a/PR/src/Makefile b/PR/src/Makefile index d01d24f..eb57725 100644 --- a/PR/src/Makefile +++ b/PR/src/Makefile @@ -52,7 +52,7 @@ else endif ACTIONS = .import.o .export.o .classify.o -XML = .parse.o .search.o .resources.o +XML = .parse.o .search.o .resources.o .translate.o COMPRESS = .compress.o .lzg_compress.o .lzg_uncompress.o .rle_compress.o .rle_uncompress.o LAYERS = .dat.o .memory.o .list.o .reslist.o .disk.o .idlist.o .autodetect.o FORMAT = .bmp.o .mid.o .pal.o .wav.o .plv.o diff --git a/PR/src/include/translate.h b/PR/src/include/translate.h index 48e89f5..f4c2164 100644 --- a/PR/src/include/translate.h +++ b/PR/src/include/translate.h @@ -36,14 +36,15 @@ translate.c: Princed Resources : array translating resources #define TRANS_ARRAY_INDEX_INT {"pop1", "shap", "fram", "shpl", "palt" } #define TRANS_ARRAY_INDEX_EXT {"pop 1","shape","frame","shape palette","palette tga"} +#define TRANS_ARRAY_INDEX_SIZ 5 extern const char* _indexInt[]; extern const char* _indexExt[]; const char* translate (const char* input, const char** s1, const char** s2,int sizeOfArray); -#define translateInt2Ext(a) translate (a, _indexInt, _indexExt, sizeof(_indexInt)/sizeof(char*)) -#define translateExt2Int(a) translate (a, _indexExt, _indexInt, sizeof(_indexInt)/sizeof(char*)) +#define translateInt2Ext(a) translate (a, _indexInt, _indexExt, TRANS_ARRAY_INDEX_SIZ) +#define translateExt2Int(a) translate (a, _indexExt, _indexInt, TRANS_ARRAY_INDEX_SIZ) #endif diff --git a/PR/src/lib/xml/search.c b/PR/src/lib/xml/search.c index 6c60792..ddaeddf 100644 --- a/PR/src/lib/xml/search.c +++ b/PR/src/lib/xml/search.c @@ -42,6 +42,7 @@ search.c: Princed Resources : specific xml handling functions #include "search.h" #include "memory.h" #include <string.h> +#include "translate.h" /* to translate indexes */ /****************************************************************\ | Tag Tree Searching Functions | @@ -52,11 +53,11 @@ search.c: Princed Resources : specific xml handling functions #define keepStringAttribute(attribute) res.attribute=strallocandcopy(t->attribute) #define keepIntAttribute(attribute,type) res.attribute=(type)ptoi(t->attribute); #define keepIdAttributes(attribute,idnum,idindex) res.attribute.value=(unsigned short int)ptoi(t->idnum);\ - if (t->idindex) str5lowercpy(res.attribute.index,t->idindex);\ + if (t->idindex) str5lowercpy(res.attribute.index,translateExt2Int(t->idindex));\ else res.attribute.index[0]=0 #define keepIdAttributesElse(attribute,idnum,idindex,idelse) res.attribute.value=(unsigned short int)ptoi(t->idnum);\ - if (t->idindex) str5lowercpy(res.attribute.index,t->idindex);\ + if (t->idindex) str5lowercpy(res.attribute.index,translateExt2Int(t->idindex));\ else str5lowercpy(res.attribute.index,t->idelse) void workTag(const tTag* t,void* pass) { /* diff --git a/PR/src/lib/xml/tree.c b/PR/src/lib/xml/tree.c index 90d8efb..48ead30 100644 --- a/PR/src/lib/xml/tree.c +++ b/PR/src/lib/xml/tree.c @@ -41,6 +41,7 @@ resources.c: Princed Resources : Resource Handler #include "disk.h" #include "resources.h" #include "search.h" +#include "translate.h" /***************************************************************\ | Filtering xml structure to tResourceList | @@ -96,13 +97,13 @@ void AddToUnknownXml(const char* vFiledatWithPath,tResourceId id,const char* ext /* Save headers */ if (type==eResTypePalette) pal=id; fprintf(unknownXmlFile,RES_XML_UNKNOWN_START, - vFiledat,vFiledatWithPath,pal.value,toLower(pal.index) + vFiledat,vFiledatWithPath,pal.value,translateInt2Ext(toLower(pal.index)) ); } /* Write item */ fprintf(unknownXmlFile,RES_XML_UNKNOWN_ITEM, - id.value,toLower(id.index),getExtDesc(type),count,ext,getExtDesc(type),flags,getExtDesc(type),count + id.value,translateInt2Ext(toLower(id.index)),getExtDesc(type),count,ext,getExtDesc(type),flags,getExtDesc(type),count ); /* To the xml output */ } diff --git a/PR/src/lib/xml/unknown.c b/PR/src/lib/xml/unknown.c index 90d8efb..48ead30 100644 --- a/PR/src/lib/xml/unknown.c +++ b/PR/src/lib/xml/unknown.c @@ -41,6 +41,7 @@ resources.c: Princed Resources : Resource Handler #include "disk.h" #include "resources.h" #include "search.h" +#include "translate.h" /***************************************************************\ | Filtering xml structure to tResourceList | @@ -96,13 +97,13 @@ void AddToUnknownXml(const char* vFiledatWithPath,tResourceId id,const char* ext /* Save headers */ if (type==eResTypePalette) pal=id; fprintf(unknownXmlFile,RES_XML_UNKNOWN_START, - vFiledat,vFiledatWithPath,pal.value,toLower(pal.index) + vFiledat,vFiledatWithPath,pal.value,translateInt2Ext(toLower(pal.index)) ); } /* Write item */ fprintf(unknownXmlFile,RES_XML_UNKNOWN_ITEM, - id.value,toLower(id.index),getExtDesc(type),count,ext,getExtDesc(type),flags,getExtDesc(type),count + id.value,translateInt2Ext(toLower(id.index)),getExtDesc(type),count,ext,getExtDesc(type),flags,getExtDesc(type),count ); /* To the xml output */ }